@google/gemini-cli 0.57.0-preview.1 → 0.58.0-preview.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 (74) hide show
  1. package/bundle/{chunk-3BVBON3V.js → chunk-2BLMLPHM.js} +1 -1
  2. package/bundle/{chunk-GK7NUJ35.js → chunk-2DH4DX65.js} +1 -1
  3. package/bundle/{chunk-ZMPGHLGO.js → chunk-2XOTT2FI.js} +2 -2
  4. package/bundle/{chunk-S5UX3QS5.js → chunk-4FKXMALD.js} +3 -3
  5. package/bundle/{chunk-O7SBKM7M.js → chunk-4KFMA4KD.js} +242 -106
  6. package/bundle/{chunk-UMQE7UC6.js → chunk-6EGII27G.js} +3 -3
  7. package/bundle/{chunk-VBK54QCZ.js → chunk-7HQEQECM.js} +1 -1
  8. package/bundle/{chunk-RLDNUS35.js → chunk-BOI2NL3I.js} +1 -1
  9. package/bundle/{chunk-EAK33LFP.js → chunk-CNAVMEMA.js} +1 -1
  10. package/bundle/{chunk-AKCYXG7C.js → chunk-E7K62ODO.js} +7 -7
  11. package/bundle/{chunk-ALVDOQNA.js → chunk-FJTXPUG2.js} +1 -1
  12. package/bundle/{chunk-4ALCU2HQ.js → chunk-FMLOQLUD.js} +5 -8
  13. package/bundle/{chunk-MBWROXYM.js → chunk-GNLIR4RW.js} +2 -2
  14. package/bundle/{chunk-GMQ6QNZB.js → chunk-JCGNL7TH.js} +1 -1
  15. package/bundle/{chunk-65C235NM.js → chunk-JO5YRKX4.js} +7 -7
  16. package/bundle/{chunk-3NPMAHLX.js → chunk-JPMNKIVX.js} +1 -1
  17. package/bundle/{chunk-NPOI4K6X.js → chunk-M33HH4UA.js} +14468 -7648
  18. package/bundle/{chunk-NQ4RH42O.js → chunk-OEY2TDVE.js} +8 -9
  19. package/bundle/{chunk-W23OOD2C.js → chunk-PGYTXBPD.js} +3 -3
  20. package/bundle/{chunk-SCBVGZXH.js → chunk-PXFYRLFH.js} +1 -1
  21. package/bundle/{chunk-Q73BPF7A.js → chunk-RBQHWQSS.js} +1 -1
  22. package/bundle/{chunk-G65GW52B.js → chunk-TYMOJXZO.js} +181 -45
  23. package/bundle/{chunk-FHDRG5U4.js → chunk-WE4JKUV6.js} +54 -67
  24. package/bundle/{chunk-NMMXRZ53.js → chunk-WHCFVERV.js} +2 -2
  25. package/bundle/{cleanup-2W5DPMY3.js → cleanup-KTXX3JEU.js} +2 -2
  26. package/bundle/{cleanup-OTHE7RNU.js → cleanup-NLNXSTS6.js} +2 -2
  27. package/bundle/{cleanup-SM67K64R.js → cleanup-RW3JYSTT.js} +2 -2
  28. package/bundle/{core-US34OW5M.js → core-SU4ABXSV.js} +3 -1
  29. package/bundle/{dist-5TYMQVIZ.js → core-WFITWJMX.js} +3 -1
  30. package/bundle/{devtoolsService-GU2GQSOF.js → devtoolsService-BUAVSMN6.js} +2 -2
  31. package/bundle/{devtoolsService-5J53UK6Z.js → devtoolsService-MNBGW66M.js} +2 -2
  32. package/bundle/{devtoolsService-JBFUXTCT.js → devtoolsService-P42LXPJX.js} +3 -4
  33. package/bundle/{dist-OWKHVWTR.js → dist-2CGQYGZC.js} +3 -1
  34. package/bundle/docs/changelogs/preview.md +78 -94
  35. package/bundle/{gemini-LSMTDETS.js → gemini-3PHRRMWS.js} +266 -20
  36. package/bundle/{gemini-W2B6CLJC.js → gemini-BUCCXM4N.js} +450 -220
  37. package/bundle/{gemini-3M22N2C3.js → gemini-VIRT6VT3.js} +266 -20
  38. package/bundle/gemini.js +7 -7
  39. package/bundle/{interactiveCli-LQJM6LRE.js → interactiveCli-BP2ZFGLX.js} +8 -9
  40. package/bundle/{interactiveCli-L3ZXOVEV.js → interactiveCli-GGARXT6P.js} +296 -316
  41. package/bundle/{interactiveCli-D6H37PJQ.js → interactiveCli-N6VXS5Z4.js} +8 -9
  42. package/bundle/{liteRtServerManager-3BY6TBHG.js → liteRtServerManager-L46MRFSW.js} +4 -4
  43. package/bundle/{liteRtServerManager-C5WZRQUF.js → liteRtServerManager-QUODN3RR.js} +4 -4
  44. package/bundle/{liteRtServerManager-IGKUGGP4.js → liteRtServerManager-YLOGF7RQ.js} +4 -4
  45. package/bundle/{oauth2-provider-KSRLPOK3.js → oauth2-provider-BKWSLZJ6.js} +1 -1
  46. package/bundle/{oauth2-provider-VHNLCU4Y.js → oauth2-provider-IIC2YPC5.js} +72 -38
  47. package/bundle/{oauth2-provider-RWKTMYJF.js → oauth2-provider-KVIL4ITH.js} +1 -1
  48. package/bundle/policies/write.toml +10 -2
  49. package/bundle/sandbox-macos-permissive-open.sb +50 -0
  50. package/bundle/sandbox-macos-permissive-proxied.sb +50 -0
  51. package/bundle/sandbox-macos-restrictive-open.sb +50 -1
  52. package/bundle/sandbox-macos-restrictive-proxied.sb +50 -0
  53. package/bundle/sandbox-macos-strict-open.sb +50 -0
  54. package/bundle/sandbox-macos-strict-proxied.sb +50 -0
  55. package/bundle/{start-EXAQFM4Y.js → start-2365H4YX.js} +6 -6
  56. package/bundle/{start-IPZF32E3.js → start-VPQOFEIR.js} +6 -6
  57. package/bundle/{start-SVNTSNHV.js → start-Y7LKFE47.js} +6 -6
  58. package/package.json +1 -1
  59. package/bundle/chunk-4SNEOO5E.js +0 -398
  60. package/bundle/chunk-LNXGFWGZ.js +0 -17332
  61. package/bundle/chunk-QJP6CMLN.js +0 -118
  62. package/bundle/chunk-SWQAIZEQ.js +0 -102506
  63. package/bundle/chunk-VGGWKRAC.js +0 -154
  64. package/bundle/chunk-WDFSF5L4.js +0 -397601
  65. package/bundle/chunk-XESAM7IL.js +0 -512
  66. package/bundle/chunk-Y3APL4PE.js +0 -1571
  67. package/bundle/cleanup-XAUT5CMD.js +0 -32
  68. package/bundle/devtoolsService-V46GUHRF.js +0 -4359
  69. package/bundle/dist-V5VJYW6J.js +0 -2180
  70. package/bundle/gemini-OZOYJF22.js +0 -17091
  71. package/bundle/interactiveCli-RGOYDSMH.js +0 -34984
  72. package/bundle/liteRtServerManager-IJ4I2PZA.js +0 -65
  73. package/bundle/oauth2-provider-ZT4OFVMK.js +0 -235
  74. package/bundle/start-ZXU5BFZY.js +0 -18
@@ -130,3 +130,53 @@
130
130
  ;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
131
131
  ;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
132
132
  (allow network-outbound (remote tcp "localhost:8877"))
133
+
134
+ ;; Block Docker & container daemon UNIX domain sockets (read & write)
135
+ (deny file-read* file-write*
136
+ (literal "/var/run/docker.sock")
137
+ (literal "/var/run/docker.sock.raw")
138
+ (literal "/private/var/run/docker.sock")
139
+ (literal "/private/var/run/docker.sock.raw")
140
+ (subpath "/var/run/docker")
141
+ (subpath "/private/var/run/docker")
142
+ (subpath "/Users/Shared/.docker")
143
+ (subpath (string-append (param "HOME_DIR") "/.docker/run"))
144
+ (subpath (string-append (param "HOME_DIR") "/.docker/desktop"))
145
+ (subpath (string-append (param "HOME_DIR") "/.colima"))
146
+ (subpath (string-append (param "HOME_DIR") "/.orbstack/run"))
147
+ (subpath (string-append (param "HOME_DIR") "/.rd"))
148
+ )
149
+
150
+ ;; Block container CLI and daemon binaries from execution
151
+ (deny process-exec
152
+ (literal "/usr/local/bin/docker")
153
+ (literal "/usr/local/bin/dockerd")
154
+ (literal "/usr/local/bin/docker-compose")
155
+ (literal "/usr/bin/docker")
156
+ (literal "/opt/homebrew/bin/docker")
157
+ (literal "/opt/homebrew/bin/dockerd")
158
+ (literal "/opt/homebrew/bin/docker-compose")
159
+ (literal "/opt/homebrew/bin/podman")
160
+ (literal "/usr/local/bin/podman")
161
+ (literal "/opt/homebrew/bin/colima")
162
+ (literal "/usr/local/bin/colima")
163
+ (literal "/opt/homebrew/bin/orb")
164
+ (literal "/Applications/Docker.app/Contents/Resources/bin/docker")
165
+ (subpath "/Applications/Docker.app/Contents/MacOS/")
166
+ (subpath "/Applications/OrbStack.app/Contents/MacOS/")
167
+ (subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
168
+ )
169
+
170
+ ;; Block com.docker.* and container manager Mach lookup / XPC services
171
+ (deny mach-lookup
172
+ (xpc-service-name-prefix "com.docker.")
173
+ (global-name-prefix "com.docker.")
174
+ (global-name-prefix "dev.kdrag0n.OrbStack")
175
+ )
176
+
177
+ ;; Block Docker POSIX Shared Memory
178
+ (deny ipc-posix-shm*
179
+ (ipc-posix-name-prefix "docker")
180
+ (ipc-posix-name-prefix "com.docker.")
181
+ )
182
+
@@ -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-S5UX3QS5.js";
6
- import "./chunk-SCBVGZXH.js";
7
- import "./chunk-ALVDOQNA.js";
8
- import "./chunk-VBK54QCZ.js";
9
- import "./chunk-Q73BPF7A.js";
10
- import "./chunk-O7SBKM7M.js";
5
+ } from "./chunk-6EGII27G.js";
6
+ import "./chunk-BOI2NL3I.js";
7
+ import "./chunk-FJTXPUG2.js";
8
+ import "./chunk-OEY2TDVE.js";
9
+ import "./chunk-RBQHWQSS.js";
10
+ import "./chunk-4KFMA4KD.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-IUUIT4SU.js";
13
13
  import "./chunk-TUDYL3X4.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-UMQE7UC6.js";
6
- import "./chunk-3BVBON3V.js";
7
- import "./chunk-4ALCU2HQ.js";
8
- import "./chunk-NQ4RH42O.js";
9
- import "./chunk-VGGWKRAC.js";
10
- import "./chunk-NPOI4K6X.js";
5
+ } from "./chunk-PGYTXBPD.js";
6
+ import "./chunk-2BLMLPHM.js";
7
+ import "./chunk-FMLOQLUD.js";
8
+ import "./chunk-7HQEQECM.js";
9
+ import "./chunk-JPMNKIVX.js";
10
+ import "./chunk-M33HH4UA.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-IUUIT4SU.js";
13
13
  import "./chunk-TUDYL3X4.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-QJP6CMLN.js";
6
- import "./chunk-RLDNUS35.js";
7
- import "./chunk-LNXGFWGZ.js";
8
- import "./chunk-GMQ6QNZB.js";
9
- import "./chunk-EAK33LFP.js";
10
- import "./chunk-WDFSF5L4.js";
5
+ } from "./chunk-4FKXMALD.js";
6
+ import "./chunk-PXFYRLFH.js";
7
+ import "./chunk-2DH4DX65.js";
8
+ import "./chunk-JCGNL7TH.js";
9
+ import "./chunk-CNAVMEMA.js";
10
+ import "./chunk-TYMOJXZO.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-IUUIT4SU.js";
13
13
  import "./chunk-TUDYL3X4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli",
3
- "version": "0.57.0-preview.1",
3
+ "version": "0.58.0-preview.0",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,398 +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
- runExitCleanup
4
- } from "./chunk-Q73BPF7A.js";
5
- import {
6
- RELEASE_CHANNEL_STABILITY,
7
- debugLogger,
8
- getChannelFromVersion,
9
- isGitRepository
10
- } from "./chunk-O7SBKM7M.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
- */