@google/gemini-cli 0.45.0-preview.0 → 0.45.0-preview.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.
Files changed (66) hide show
  1. package/bundle/{chunk-I7UI7NB6.js → chunk-2ZH72RHY.js} +3 -3
  2. package/bundle/{chunk-EZCW6IDX.js → chunk-3NDAYKF4.js} +1 -1
  3. package/bundle/{chunk-IPQLMJS5.js → chunk-4KX3ETW3.js} +1 -1
  4. package/bundle/{chunk-4FNXKOEB.js → chunk-565MWDPP.js} +23 -13
  5. package/bundle/{chunk-J4QUIOHJ.js → chunk-5BX5PJIE.js} +7 -7
  6. package/bundle/{chunk-J7SEBVDD.js → chunk-5YTIYFJO.js} +7544 -14042
  7. package/bundle/{chunk-GIXFMPPJ.js → chunk-6WWGBNKT.js} +1 -1
  8. package/bundle/{chunk-4M3TG6ZU.js → chunk-BLUAEAZN.js} +1 -1
  9. package/bundle/{chunk-2RRZM3IR.js → chunk-BO72FGK2.js} +7 -7
  10. package/bundle/{chunk-NOJPXYUJ.js → chunk-CJHCK2YW.js} +1 -1
  11. package/bundle/{chunk-S4CJ6KAO.js → chunk-CJTRYZPP.js} +3 -3
  12. package/bundle/chunk-DDJWQSDN.js +394439 -0
  13. package/bundle/{chunk-APSDEHHA.js → chunk-E3KBY4EQ.js} +1 -1
  14. package/bundle/{chunk-WPCNMQ6J.js → chunk-FEY3T6LA.js} +9 -8
  15. package/bundle/{chunk-Q3UZDZZV.js → chunk-HA5VES5S.js} +3 -3
  16. package/bundle/{chunk-Y5REX36P.js → chunk-HVWNKZSB.js} +1 -1
  17. package/bundle/{chunk-2O7YSVPU.js → chunk-HZCAEM2F.js} +2 -2
  18. package/bundle/{chunk-DMCSPKNM.js → chunk-IGJG7DNZ.js} +1 -1
  19. package/bundle/{chunk-TH3OOWK4.js → chunk-JWWA32XO.js} +67 -54
  20. package/bundle/{chunk-LUQGJPIY.js → chunk-JXVK53RJ.js} +2 -2
  21. package/bundle/{chunk-VS2OY6HJ.js → chunk-K43EAKOP.js} +8 -5
  22. package/bundle/{chunk-N4X4WHSW.js → chunk-NB2NOE4L.js} +2 -2
  23. package/bundle/chunk-NVJOR76X.js +1571 -0
  24. package/bundle/chunk-NYWYNF2Z.js +81685 -0
  25. package/bundle/chunk-OQLEYMM2.js +512 -0
  26. package/bundle/{chunk-OY6QYVTR.js → chunk-OWSYSTWM.js} +1 -1
  27. package/bundle/{chunk-CWAXEILN.js → chunk-R52453KY.js} +26 -16
  28. package/bundle/{chunk-R5OZKB4U.js → chunk-S6AQSJNU.js} +1 -1
  29. package/bundle/chunk-SKDT4PWC.js +118 -0
  30. package/bundle/chunk-TCAVPMJX.js +17320 -0
  31. package/bundle/chunk-WTRP3GGZ.js +154 -0
  32. package/bundle/chunk-Y6SLZFPD.js +398 -0
  33. package/bundle/{cleanup-2WCUS5XU.js → cleanup-2FHZMQ3Z.js} +2 -2
  34. package/bundle/{cleanup-7FHLTEXT.js → cleanup-F7XRM3DT.js} +2 -2
  35. package/bundle/{cleanup-WGOZFAQJ.js → cleanup-OZH3SJVM.js} +2 -2
  36. package/bundle/cleanup-ZO5CVKGH.js +32 -0
  37. package/bundle/{core-SIRU2VWJ.js → core-B47ZXN3Y.js} +1 -1
  38. package/bundle/{devtoolsService-IANYOK3R.js → devtoolsService-L7PYKOHR.js} +2 -2
  39. package/bundle/{devtoolsService-4Y2RGEUE.js → devtoolsService-OYQJHPEW.js} +4 -3
  40. package/bundle/devtoolsService-SGV7MSUA.js +856 -0
  41. package/bundle/{devtoolsService-F5XFL4BF.js → devtoolsService-XYSZCMQM.js} +2 -2
  42. package/bundle/{dist-67ZORME5.js → dist-C6L3MGQS.js} +1 -1
  43. package/bundle/{core-LD6MHGD6.js → dist-MOEHPHUN.js} +1 -1
  44. package/bundle/dist-WLKMTHZQ.js +2134 -0
  45. package/bundle/{gemini-5ZI322FJ.js → gemini-2XSNIT2N.js} +212 -196
  46. package/bundle/{gemini-24ENZ343.js → gemini-CHS2YNJG.js} +13 -13
  47. package/bundle/gemini-CQDPCFEE.js +16406 -0
  48. package/bundle/{gemini-74UML3PJ.js → gemini-LT5MWLZQ.js} +13 -13
  49. package/bundle/gemini.js +10 -9
  50. package/bundle/{interactiveCli-7GM3U7SA.js → interactiveCli-2YFAMDR5.js} +8 -8
  51. package/bundle/{interactiveCli-XM5HDVD7.js → interactiveCli-6EFCVZP7.js} +314 -295
  52. package/bundle/interactiveCli-HA3BASZN.js +34726 -0
  53. package/bundle/{interactiveCli-BVZLMTVC.js → interactiveCli-UUI7OUZK.js} +8 -8
  54. package/bundle/{liteRtServerManager-6N5DYDEQ.js → liteRtServerManager-2VKZTPMY.js} +4 -4
  55. package/bundle/{liteRtServerManager-JVMDH3TN.js → liteRtServerManager-4PZ3X7SS.js} +4 -4
  56. package/bundle/{liteRtServerManager-3HS3VUPU.js → liteRtServerManager-GH6VHWTU.js} +4 -4
  57. package/bundle/liteRtServerManager-OMSM6SJU.js +65 -0
  58. package/bundle/{oauth2-provider-U72EWZHQ.js → oauth2-provider-4UIWNIX3.js} +1 -1
  59. package/bundle/{oauth2-provider-RUFABDNL.js → oauth2-provider-BDX6V2YX.js} +1 -1
  60. package/bundle/{oauth2-provider-WS7LUQ5V.js → oauth2-provider-N2ZY2DXQ.js} +38 -72
  61. package/bundle/oauth2-provider-TRRJCE2P.js +235 -0
  62. package/bundle/{start-KOAGXRA2.js → start-3LEQZELI.js} +6 -6
  63. package/bundle/{start-XLIGOOW3.js → start-FH2E2VQ2.js} +6 -6
  64. package/bundle/{start-DJ6EBFEA.js → start-FPEO7KCZ.js} +6 -6
  65. package/bundle/start-J7G6YXDJ.js +18 -0
  66. package/package.json +1 -1
@@ -0,0 +1,154 @@
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-565MWDPP.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
+ */
@@ -0,0 +1,398 @@
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
+ runExitCleanup
4
+ } from "./chunk-WTRP3GGZ.js";
5
+ import {
6
+ RELEASE_CHANNEL_STABILITY,
7
+ debugLogger,
8
+ getChannelFromVersion,
9
+ isGitRepository
10
+ } from "./chunk-565MWDPP.js";
11
+
12
+ // packages/cli/src/utils/installationInfo.ts
13
+ import * as fs from "node:fs";
14
+ import * as path from "node:path";
15
+ import * as childProcess from "node:child_process";
16
+ import process2 from "node:process";
17
+ var isDevelopment = process2.env["NODE_ENV"] === "development";
18
+ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
19
+ const cliPath = process2.argv[1];
20
+ if (!cliPath) {
21
+ return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
22
+ }
23
+ try {
24
+ if (process2.env["IS_BINARY"] === "true") {
25
+ return {
26
+ packageManager: "binary" /* BINARY */,
27
+ isGlobal: true,
28
+ updateMessage: "Running as a standalone binary. Please update by downloading the latest version from GitHub."
29
+ };
30
+ }
31
+ const realPath = fs.realpathSync(cliPath).replace(/\\/g, "/");
32
+ const normalizedProjectRoot = projectRoot?.replace(/\\/g, "/");
33
+ const isGit = isGitRepository(process2.cwd());
34
+ if (isGit && normalizedProjectRoot && realPath.startsWith(normalizedProjectRoot) && !realPath.includes("/node_modules/")) {
35
+ return {
36
+ packageManager: "unknown" /* UNKNOWN */,
37
+ // Not managed by a package manager in this sense
38
+ isGlobal: false,
39
+ updateMessage: 'Running from a local git clone. Please update with "git pull".'
40
+ };
41
+ }
42
+ if (realPath.includes("/.npm/_npx") || realPath.includes("/npm/_npx")) {
43
+ return {
44
+ packageManager: "npx" /* NPX */,
45
+ isGlobal: false,
46
+ updateMessage: "Running via npx, update not applicable."
47
+ };
48
+ }
49
+ if (realPath.includes("/.pnpm/_pnpx") || realPath.includes("/.cache/pnpm/dlx")) {
50
+ return {
51
+ packageManager: "pnpx" /* PNPX */,
52
+ isGlobal: false,
53
+ updateMessage: "Running via pnpx, update not applicable."
54
+ };
55
+ }
56
+ if (process2.platform === "darwin") {
57
+ try {
58
+ const brewPrefix = childProcess.execSync("brew --prefix gemini-cli", {
59
+ encoding: "utf8",
60
+ stdio: ["ignore", "pipe", "ignore"]
61
+ }).trim();
62
+ const brewRealPath = fs.realpathSync(brewPrefix);
63
+ if (realPath.startsWith(brewRealPath)) {
64
+ return {
65
+ packageManager: "homebrew" /* HOMEBREW */,
66
+ isGlobal: true,
67
+ updateMessage: 'Installed via Homebrew. Please update with "brew upgrade gemini-cli".'
68
+ };
69
+ }
70
+ } catch {
71
+ }
72
+ }
73
+ if (realPath.includes("/.volta/") || realPath.includes("/Volta/")) {
74
+ const updateCommand2 = "volta install @google/gemini-cli@latest";
75
+ return {
76
+ packageManager: "volta" /* VOLTA */,
77
+ isGlobal: true,
78
+ updateCommand: updateCommand2,
79
+ updateMessage: isAutoUpdateEnabled ? "Installed with Volta. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
80
+ };
81
+ }
82
+ if (realPath.includes("/.pnpm/global") || realPath.includes("/.local/share/pnpm") || realPath.includes("/Library/pnpm/global/") || realPath.includes("/AppData/Local/pnpm/global/")) {
83
+ const updateCommand2 = "pnpm add -g @google/gemini-cli@latest";
84
+ return {
85
+ packageManager: "pnpm" /* PNPM */,
86
+ isGlobal: true,
87
+ updateCommand: updateCommand2,
88
+ updateMessage: isAutoUpdateEnabled ? "Installed with pnpm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
89
+ };
90
+ }
91
+ if (realPath.includes("/.yarn/global")) {
92
+ const updateCommand2 = "yarn global add @google/gemini-cli@latest";
93
+ return {
94
+ packageManager: "yarn" /* YARN */,
95
+ isGlobal: true,
96
+ updateCommand: updateCommand2,
97
+ updateMessage: isAutoUpdateEnabled ? "Installed with yarn. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
98
+ };
99
+ }
100
+ if (realPath.includes("/.bun/install/cache")) {
101
+ return {
102
+ packageManager: "bunx" /* BUNX */,
103
+ isGlobal: false,
104
+ updateMessage: "Running via bunx, update not applicable."
105
+ };
106
+ }
107
+ if (realPath.includes("/.bun/install/global")) {
108
+ const updateCommand2 = "bun add -g @google/gemini-cli@latest";
109
+ return {
110
+ packageManager: "bun" /* BUN */,
111
+ isGlobal: true,
112
+ updateCommand: updateCommand2,
113
+ updateMessage: isAutoUpdateEnabled ? "Installed with bun. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
114
+ };
115
+ }
116
+ if (normalizedProjectRoot && realPath.startsWith(`${normalizedProjectRoot}/node_modules`)) {
117
+ let pm = "npm" /* NPM */;
118
+ if (fs.existsSync(path.join(projectRoot, "yarn.lock"))) {
119
+ pm = "yarn" /* YARN */;
120
+ } else if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml"))) {
121
+ pm = "pnpm" /* PNPM */;
122
+ } else if (fs.existsSync(path.join(projectRoot, "bun.lockb"))) {
123
+ pm = "bun" /* BUN */;
124
+ }
125
+ return {
126
+ packageManager: pm,
127
+ isGlobal: false,
128
+ updateMessage: "Locally installed. Please update via your project's package.json."
129
+ };
130
+ }
131
+ const updateCommand = "npm install -g @google/gemini-cli@latest";
132
+ return {
133
+ packageManager: "npm" /* NPM */,
134
+ isGlobal: true,
135
+ updateCommand,
136
+ updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand} to update`
137
+ };
138
+ } catch (error) {
139
+ debugLogger.log(error);
140
+ return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
141
+ }
142
+ }
143
+
144
+ // packages/cli/src/utils/updateEventEmitter.ts
145
+ import { EventEmitter } from "node:events";
146
+ var updateEventEmitter = new EventEmitter();
147
+
148
+ // packages/cli/src/utils/spawnWrapper.ts
149
+ import { spawn } from "node:child_process";
150
+ var spawnWrapper = spawn;
151
+
152
+ // packages/cli/src/utils/handleAutoUpdate.ts
153
+ var _updateInProgress = false;
154
+ async function waitForUpdateCompletion(timeoutMs = 3e4) {
155
+ if (!_updateInProgress) {
156
+ return;
157
+ }
158
+ debugLogger.log(
159
+ "\nGemini CLI is waiting for a background update to complete before restarting..."
160
+ );
161
+ return new Promise((resolve) => {
162
+ if (!_updateInProgress) {
163
+ resolve();
164
+ return;
165
+ }
166
+ const timer = setTimeout(cleanup, timeoutMs);
167
+ function cleanup() {
168
+ clearTimeout(timer);
169
+ updateEventEmitter.off("update-success", cleanup);
170
+ updateEventEmitter.off("update-failed", cleanup);
171
+ resolve();
172
+ }
173
+ updateEventEmitter.once("update-success", cleanup);
174
+ updateEventEmitter.once("update-failed", cleanup);
175
+ });
176
+ }
177
+ function handleAutoUpdate(info, settings, projectRoot, isSandboxEnabled, spawnFn = spawnWrapper) {
178
+ if (!info) {
179
+ return;
180
+ }
181
+ if (isSandboxEnabled) {
182
+ updateEventEmitter.emit("update-info", {
183
+ message: `${info.message}
184
+ Automatic update is not available in sandbox mode.`
185
+ });
186
+ return;
187
+ }
188
+ if (!settings.merged.general.enableAutoUpdateNotification) {
189
+ return;
190
+ }
191
+ const installationInfo = getInstallationInfo(
192
+ projectRoot,
193
+ settings.merged.general.enableAutoUpdate
194
+ );
195
+ if ([
196
+ "npx" /* NPX */,
197
+ "pnpx" /* PNPX */,
198
+ "bunx" /* BUNX */,
199
+ "binary" /* BINARY */
200
+ ].includes(installationInfo.packageManager)) {
201
+ return;
202
+ }
203
+ let combinedMessage = info.message;
204
+ if (installationInfo.updateMessage) {
205
+ combinedMessage += `
206
+ ${installationInfo.updateMessage}`;
207
+ }
208
+ if (!installationInfo.updateCommand || !settings.merged.general.enableAutoUpdate) {
209
+ updateEventEmitter.emit("update-received", {
210
+ ...info,
211
+ message: combinedMessage,
212
+ isUpdating: false
213
+ });
214
+ return;
215
+ }
216
+ updateEventEmitter.emit("update-received", {
217
+ ...info,
218
+ message: combinedMessage,
219
+ isUpdating: true
220
+ });
221
+ if (_updateInProgress) {
222
+ return;
223
+ }
224
+ const currentVersion = info.update.current;
225
+ if (!currentVersion) {
226
+ debugLogger.warn(
227
+ "Update check: current version is missing. Skipping automatic update for safety."
228
+ );
229
+ return;
230
+ }
231
+ const currentChannel = getChannelFromVersion(currentVersion);
232
+ const targetChannel = getChannelFromVersion(info.update.latest);
233
+ if (RELEASE_CHANNEL_STABILITY[targetChannel] < RELEASE_CHANNEL_STABILITY[currentChannel]) {
234
+ return;
235
+ }
236
+ const isNightly = info.update.latest.includes("nightly");
237
+ const updateCommand = installationInfo.updateCommand.replace(
238
+ "@latest",
239
+ isNightly ? "@nightly" : `@${info.update.latest}`
240
+ );
241
+ const updateProcess = spawnFn(updateCommand, {
242
+ stdio: "ignore",
243
+ shell: true,
244
+ detached: true
245
+ });
246
+ _updateInProgress = true;
247
+ updateProcess.unref();
248
+ updateProcess.on("close", (code) => {
249
+ _updateInProgress = false;
250
+ if (code === 0) {
251
+ updateEventEmitter.emit("update-success", {
252
+ message: "Update successful! The new version will be used on your next run."
253
+ });
254
+ } else {
255
+ updateEventEmitter.emit("update-failed", {
256
+ message: `Automatic update failed. Please try updating manually:
257
+
258
+ ${updateCommand}`
259
+ });
260
+ }
261
+ });
262
+ updateProcess.on("error", (err) => {
263
+ _updateInProgress = false;
264
+ updateEventEmitter.emit("update-failed", {
265
+ message: `Automatic update failed. Please try updating manually. (error: ${err.message})
266
+
267
+ ${updateCommand}`
268
+ });
269
+ });
270
+ return updateProcess;
271
+ }
272
+ function setUpdateHandler(addItem, setUpdateInfo) {
273
+ let successfullyInstalled = false;
274
+ const handleUpdateReceived = (info) => {
275
+ setUpdateInfo(info);
276
+ const savedMessage = info.message;
277
+ setTimeout(() => {
278
+ if (!successfullyInstalled) {
279
+ addItem(
280
+ {
281
+ type: "info" /* INFO */,
282
+ text: savedMessage
283
+ },
284
+ Date.now()
285
+ );
286
+ }
287
+ setUpdateInfo(null);
288
+ }, 6e4);
289
+ };
290
+ const handleUpdateFailed = (data) => {
291
+ setUpdateInfo(null);
292
+ addItem(
293
+ {
294
+ type: "error" /* ERROR */,
295
+ text: data?.message || `Automatic update failed. Please try updating manually`
296
+ },
297
+ Date.now()
298
+ );
299
+ };
300
+ const handleUpdateSuccess = () => {
301
+ successfullyInstalled = true;
302
+ setUpdateInfo(null);
303
+ addItem(
304
+ {
305
+ type: "info" /* INFO */,
306
+ text: `Update successful! The new version will be used on your next run.`
307
+ },
308
+ Date.now()
309
+ );
310
+ };
311
+ const handleUpdateInfo = (data) => {
312
+ addItem(
313
+ {
314
+ type: "info" /* INFO */,
315
+ text: data.message
316
+ },
317
+ Date.now()
318
+ );
319
+ };
320
+ updateEventEmitter.on("update-received", handleUpdateReceived);
321
+ updateEventEmitter.on("update-failed", handleUpdateFailed);
322
+ updateEventEmitter.on("update-success", handleUpdateSuccess);
323
+ updateEventEmitter.on("update-info", handleUpdateInfo);
324
+ return () => {
325
+ updateEventEmitter.off("update-received", handleUpdateReceived);
326
+ updateEventEmitter.off("update-failed", handleUpdateFailed);
327
+ updateEventEmitter.off("update-success", handleUpdateSuccess);
328
+ updateEventEmitter.off("update-info", handleUpdateInfo);
329
+ };
330
+ }
331
+
332
+ // packages/cli/src/utils/processUtils.ts
333
+ var RELAUNCH_EXIT_CODE = 199;
334
+ var isRelaunching = false;
335
+ async function relaunchApp() {
336
+ if (isRelaunching) return;
337
+ isRelaunching = true;
338
+ await waitForUpdateCompletion();
339
+ await runExitCleanup();
340
+ process.exit(RELAUNCH_EXIT_CODE);
341
+ }
342
+ function isStandardSea() {
343
+ return process.argv[0] !== process.argv[1] && (process.env["IS_BINARY"] === "true" || process.isSea?.() === true);
344
+ }
345
+ function getScriptArgs() {
346
+ return process.argv.slice(isStandardSea() ? 1 : 2);
347
+ }
348
+ function isSeaEnvironment() {
349
+ return process.env["IS_BINARY"] === "true" || process.isSea?.() === true || process.argv[0] === process.argv[1];
350
+ }
351
+ function getSpawnConfig(nodeArgs, scriptArgs) {
352
+ const isBinary = isSeaEnvironment();
353
+ const newEnv = {
354
+ ...process.env,
355
+ GEMINI_CLI_NO_RELAUNCH: "true"
356
+ };
357
+ const finalSpawnArgs = [];
358
+ if (isBinary) {
359
+ if (nodeArgs.length > 0) {
360
+ for (const arg of nodeArgs) {
361
+ if (/[\s"'\\]/.test(arg)) {
362
+ throw new Error(
363
+ `Unsupported node argument for SEA relaunch: ${arg}. Complex escaping is not supported.`
364
+ );
365
+ }
366
+ }
367
+ const existingNodeOptions = process.env["NODE_OPTIONS"] || "";
368
+ newEnv["NODE_OPTIONS"] = `${existingNodeOptions} ${nodeArgs.join(" ")}`.trim();
369
+ }
370
+ finalSpawnArgs.push(process.execPath, ...scriptArgs);
371
+ } else {
372
+ finalSpawnArgs.push(
373
+ ...process.execArgv,
374
+ ...nodeArgs,
375
+ process.argv[1],
376
+ ...scriptArgs
377
+ );
378
+ }
379
+ return {
380
+ spawnArgs: finalSpawnArgs,
381
+ env: newEnv
382
+ };
383
+ }
384
+
385
+ export {
386
+ isDevelopment,
387
+ handleAutoUpdate,
388
+ setUpdateHandler,
389
+ RELAUNCH_EXIT_CODE,
390
+ relaunchApp,
391
+ getScriptArgs,
392
+ getSpawnConfig
393
+ };
394
+ /**
395
+ * @license
396
+ * Copyright 2025 Google LLC
397
+ * SPDX-License-Identifier: Apache-2.0
398
+ */
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-R5OZKB4U.js";
15
- import "./chunk-4FNXKOEB.js";
14
+ } from "./chunk-OWSYSTWM.js";
15
+ import "./chunk-DDJWQSDN.js";
16
16
  import "./chunk-6HI7VNOG.js";
17
17
  import "./chunk-TUDYL3X4.js";
18
18
  import "./chunk-IUUIT4SU.js";
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-OY6QYVTR.js";
15
- import "./chunk-CWAXEILN.js";
14
+ } from "./chunk-WTRP3GGZ.js";
15
+ import "./chunk-565MWDPP.js";
16
16
  import "./chunk-6HI7VNOG.js";
17
17
  import "./chunk-TUDYL3X4.js";
18
18
  import "./chunk-IUUIT4SU.js";
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-Y5REX36P.js";
15
- import "./chunk-J7SEBVDD.js";
14
+ } from "./chunk-HVWNKZSB.js";
15
+ import "./chunk-R52453KY.js";
16
16
  import "./chunk-6HI7VNOG.js";
17
17
  import "./chunk-TUDYL3X4.js";
18
18
  import "./chunk-IUUIT4SU.js";
@@ -0,0 +1,32 @@
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
+ cleanupCheckpoints,
4
+ registerCleanup,
5
+ registerSyncCleanup,
6
+ registerTelemetryConfig,
7
+ removeCleanup,
8
+ removeSyncCleanup,
9
+ resetCleanupForTesting,
10
+ runExitCleanup,
11
+ runSyncCleanup,
12
+ setupSignalHandlers,
13
+ setupTtyCheck
14
+ } from "./chunk-S6AQSJNU.js";
15
+ import "./chunk-5YTIYFJO.js";
16
+ import "./chunk-6HI7VNOG.js";
17
+ import "./chunk-TUDYL3X4.js";
18
+ import "./chunk-IUUIT4SU.js";
19
+ import "./chunk-34MYV7JD.js";
20
+ export {
21
+ cleanupCheckpoints,
22
+ registerCleanup,
23
+ registerSyncCleanup,
24
+ registerTelemetryConfig,
25
+ removeCleanup,
26
+ removeSyncCleanup,
27
+ resetCleanupForTesting,
28
+ runExitCleanup,
29
+ runSyncCleanup,
30
+ setupSignalHandlers,
31
+ setupTtyCheck
32
+ };
@@ -1060,7 +1060,7 @@ import {
1060
1060
  wrapInAccountChooser,
1061
1061
  writeToStderr,
1062
1062
  writeToStdout
1063
- } from "./chunk-J7SEBVDD.js";
1063
+ } from "./chunk-R52453KY.js";
1064
1064
  import "./chunk-6HI7VNOG.js";
1065
1065
  import "./chunk-TUDYL3X4.js";
1066
1066
  import {
@@ -3,7 +3,7 @@ import {
3
3
  CoreEvent,
4
4
  coreEvents,
5
5
  debugLogger
6
- } from "./chunk-4FNXKOEB.js";
6
+ } from "./chunk-DDJWQSDN.js";
7
7
  import {
8
8
  wrapper_default
9
9
  } from "./chunk-6HI7VNOG.js";
@@ -822,7 +822,7 @@ async function toggleDevToolsPanel(config, isOpen, toggle, setOpen) {
822
822
  return;
823
823
  }
824
824
  try {
825
- const { openBrowserSecurely, shouldLaunchBrowser } = await import("./dist-67ZORME5.js");
825
+ const { openBrowserSecurely, shouldLaunchBrowser } = await import("./dist-MOEHPHUN.js");
826
826
  const url = await startDevToolsServer(config);
827
827
  if (shouldLaunchBrowser()) {
828
828
  try {
@@ -1,8 +1,9 @@
1
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
2
  import {
3
+ CoreEvent,
3
4
  coreEvents,
4
5
  debugLogger
5
- } from "./chunk-CWAXEILN.js";
6
+ } from "./chunk-565MWDPP.js";
6
7
  import {
7
8
  wrapper_default
8
9
  } from "./chunk-6HI7VNOG.js";
@@ -670,7 +671,7 @@ var bridgeAttached = false;
670
671
  function bridgeCoreEvents(capture) {
671
672
  if (bridgeAttached) return;
672
673
  bridgeAttached = true;
673
- coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
674
+ coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
674
675
  capture.logConsole(payload);
675
676
  });
676
677
  }
@@ -821,7 +822,7 @@ async function toggleDevToolsPanel(config, isOpen, toggle, setOpen) {
821
822
  return;
822
823
  }
823
824
  try {
824
- const { openBrowserSecurely, shouldLaunchBrowser } = await import("./core-LD6MHGD6.js");
825
+ const { openBrowserSecurely, shouldLaunchBrowser } = await import("./dist-C6L3MGQS.js");
825
826
  const url = await startDevToolsServer(config);
826
827
  if (shouldLaunchBrowser()) {
827
828
  try {