@google/gemini-cli 0.64.0-preview.0 → 0.65.0-nightly.20261007.gef59c532f
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.
- package/bundle/{chunk-EDVFNWRG.js → chunk-2QX7AFU2.js} +1 -1
- package/bundle/{chunk-EDYPRCAA.js → chunk-354KMHUX.js} +2 -2
- package/bundle/{chunk-UFQDAROY.js → chunk-3F7OA7UU.js} +1 -1
- package/bundle/{chunk-HN74ORTP.js → chunk-46A63GIT.js} +27 -4
- package/bundle/{chunk-ZQW7OGUO.js → chunk-6FH32SR7.js} +184 -45
- package/bundle/{chunk-SDWOC67Z.js → chunk-7NUXN3UV.js} +1 -1
- package/bundle/{chunk-Y2HXXBXI.js → chunk-ASQYH7O3.js} +1 -1
- package/bundle/{chunk-EBP6K2WG.js → chunk-BT4BJCGX.js} +32 -16
- package/bundle/{chunk-UBGF6JU5.js → chunk-CIKQQ32X.js} +1 -1
- package/bundle/chunk-DIMRHS5O.js +154 -0
- package/bundle/{chunk-NX7TO2DU.js → chunk-EIHDEZQ3.js} +1 -1
- package/bundle/{chunk-QUCRASYB.js → chunk-FE5UXCSL.js} +1 -1
- package/bundle/{chunk-EFX5XL6M.js → chunk-FTB4FVEK.js} +2 -2
- package/bundle/{chunk-A4TO2DY2.js → chunk-HYF74TEA.js} +8018 -14883
- package/bundle/{chunk-6OFXOGEG.js → chunk-JYWQ73Z5.js} +193 -47
- package/bundle/{chunk-HSZIYPL6.js → chunk-KHG7NKQK.js} +3 -3
- package/bundle/chunk-KTOZF7BG.js +401335 -0
- package/bundle/{chunk-2NQXIWQK.js → chunk-KV6RPWUP.js} +27 -4
- package/bundle/{chunk-KCCVXZ52.js → chunk-LNFN3PQL.js} +32 -16
- package/bundle/{chunk-MLSLNORV.js → chunk-LS355CSQ.js} +3 -3
- package/bundle/{chunk-2VN53SWW.js → chunk-NDVLWD4V.js} +9 -8
- package/bundle/{chunk-ZOHM7BPT.js → chunk-NUWDVBI7.js} +1 -1
- package/bundle/{chunk-VJYKQD5D.js → chunk-PYD373NJ.js} +3 -3
- package/bundle/{chunk-VBVCLWLA.js → chunk-QTGBWTWR.js} +2 -2
- package/bundle/chunk-U6ZQ2RUE.js +1571 -0
- package/bundle/chunk-UV4NDIKL.js +118 -0
- package/bundle/{chunk-U76XPSKR.js → chunk-VAONEIPY.js} +96 -67
- package/bundle/chunk-WGJZZTZY.js +425 -0
- package/bundle/{chunk-ZPLFLZQA.js → chunk-WXXOP3OP.js} +33 -8
- package/bundle/chunk-XOG2HJ3Y.js +17530 -0
- package/bundle/chunk-YSKY65XX.js +512 -0
- package/bundle/chunk-ZTPICUAP.js +103137 -0
- package/bundle/{cleanup-GGCB2LVD.js → cleanup-3V27AYOD.js} +2 -2
- package/bundle/{cleanup-JRDG3OTL.js → cleanup-4G3NPQT4.js} +2 -2
- package/bundle/{cleanup-SSW6IXTR.js → cleanup-5XQCOW5U.js} +2 -2
- package/bundle/cleanup-BBUUFPW4.js +32 -0
- package/bundle/{core-IUIZE6JW.js → core-AAGHH24E.js} +1 -1
- package/bundle/{devtoolsService-XZCKFZP5.js → devtoolsService-EVGTOLCK.js} +2 -2
- package/bundle/{devtoolsService-3SADPKKB.js → devtoolsService-J7VIMPHG.js} +2 -2
- package/bundle/{devtoolsService-MF6JKRUV.js → devtoolsService-PZBHHYCE.js} +4 -3
- package/bundle/devtoolsService-Z4ND55GM.js +4359 -0
- package/bundle/{dist-7L3BRW6V.js → dist-6PBUOORE.js} +1 -1
- package/bundle/{core-6HRWFQZW.js → dist-Q7B3BSZW.js} +1 -1
- package/bundle/dist-Z23CJKTC.js +2252 -0
- package/bundle/docs/changelogs/index.md +14 -0
- package/bundle/docs/changelogs/latest.md +55 -34
- package/bundle/docs/changelogs/preview.md +59 -54
- package/bundle/docs/tools/mcp-server.md +41 -12
- package/bundle/{gemini-JPMMQ3KA.js → gemini-2ZS4H5D5.js} +41 -21
- package/bundle/{gemini-QOQNG5VY.js → gemini-NHT6XRJ6.js} +241 -205
- package/bundle/gemini-ORQLMSXW.js +17954 -0
- package/bundle/{gemini-ZMMDUAQJ.js → gemini-YDK3BHCP.js} +41 -21
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-R3P4A3FC.js → interactiveCli-22MUJI66.js} +23 -14
- package/bundle/{interactiveCli-UDWGRVJL.js → interactiveCli-2JNS4RJW.js} +23 -14
- package/bundle/{interactiveCli-3I4TG5SK.js → interactiveCli-EHUGFQPB.js} +327 -299
- package/bundle/interactiveCli-YANG53MI.js +34988 -0
- package/bundle/{liteRtServerManager-OVPUSK2T.js → liteRtServerManager-PGT3WQWS.js} +4 -4
- package/bundle/{liteRtServerManager-RAV63AGE.js → liteRtServerManager-TW45VSAX.js} +4 -4
- package/bundle/{liteRtServerManager-4MWCEVVM.js → liteRtServerManager-VCTOOEN4.js} +4 -4
- package/bundle/liteRtServerManager-Y2QFKZ5W.js +65 -0
- package/bundle/{oauth2-provider-XFP63FGJ.js → oauth2-provider-4AK74O2H.js} +1 -1
- package/bundle/{oauth2-provider-FVTRRJZR.js → oauth2-provider-IUYZ2A7H.js} +1 -1
- package/bundle/{oauth2-provider-EWOA64PR.js → oauth2-provider-JCJGEWMM.js} +38 -72
- package/bundle/oauth2-provider-QTTPZS6I.js +235 -0
- package/bundle/{start-DJAIXPPY.js → start-4O4IKUM4.js} +6 -6
- package/bundle/{start-VQQ2Q5KT.js → start-74BH6SEW.js} +6 -6
- package/bundle/{start-5O7TBK5L.js → start-EDAVUSEX.js} +6 -6
- package/bundle/start-Q6WRPG2O.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,425 @@
|
|
|
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-3F7OA7UU.js";
|
|
5
|
+
import {
|
|
6
|
+
RELEASE_CHANNEL_STABILITY,
|
|
7
|
+
debugLogger,
|
|
8
|
+
getChannelFromVersion,
|
|
9
|
+
isGitRepository
|
|
10
|
+
} from "./chunk-6FH32SR7.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(options) {
|
|
336
|
+
if (isRelaunching) return;
|
|
337
|
+
isRelaunching = true;
|
|
338
|
+
await waitForUpdateCompletion();
|
|
339
|
+
if (process.send && !process.env["VITEST"] && options?.overrideAuthType) {
|
|
340
|
+
await new Promise((resolve) => {
|
|
341
|
+
let resolved = false;
|
|
342
|
+
const done = () => {
|
|
343
|
+
if (!resolved) {
|
|
344
|
+
resolved = true;
|
|
345
|
+
resolve();
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const timeout = setTimeout(done, 500);
|
|
349
|
+
try {
|
|
350
|
+
process.send(
|
|
351
|
+
{
|
|
352
|
+
type: "auth-selected-type",
|
|
353
|
+
authType: options.overrideAuthType
|
|
354
|
+
},
|
|
355
|
+
() => {
|
|
356
|
+
clearTimeout(timeout);
|
|
357
|
+
done();
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
} catch {
|
|
361
|
+
clearTimeout(timeout);
|
|
362
|
+
done();
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
await runExitCleanup();
|
|
367
|
+
process.exit(RELAUNCH_EXIT_CODE);
|
|
368
|
+
}
|
|
369
|
+
function isStandardSea() {
|
|
370
|
+
return process.argv[0] !== process.argv[1] && (process.env["IS_BINARY"] === "true" || process.isSea?.() === true);
|
|
371
|
+
}
|
|
372
|
+
function getScriptArgs() {
|
|
373
|
+
return process.argv.slice(isStandardSea() ? 1 : 2);
|
|
374
|
+
}
|
|
375
|
+
function isSeaEnvironment() {
|
|
376
|
+
return process.env["IS_BINARY"] === "true" || process.isSea?.() === true || process.argv[0] === process.argv[1];
|
|
377
|
+
}
|
|
378
|
+
function getSpawnConfig(nodeArgs, scriptArgs) {
|
|
379
|
+
const isBinary = isSeaEnvironment();
|
|
380
|
+
const newEnv = {
|
|
381
|
+
...process.env,
|
|
382
|
+
GEMINI_CLI_NO_RELAUNCH: "true"
|
|
383
|
+
};
|
|
384
|
+
const finalSpawnArgs = [];
|
|
385
|
+
if (isBinary) {
|
|
386
|
+
if (nodeArgs.length > 0) {
|
|
387
|
+
for (const arg of nodeArgs) {
|
|
388
|
+
if (/[\s"'\\]/.test(arg)) {
|
|
389
|
+
throw new Error(
|
|
390
|
+
`Unsupported node argument for SEA relaunch: ${arg}. Complex escaping is not supported.`
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const existingNodeOptions = process.env["NODE_OPTIONS"] || "";
|
|
395
|
+
newEnv["NODE_OPTIONS"] = `${existingNodeOptions} ${nodeArgs.join(" ")}`.trim();
|
|
396
|
+
}
|
|
397
|
+
finalSpawnArgs.push(process.execPath, ...scriptArgs);
|
|
398
|
+
} else {
|
|
399
|
+
finalSpawnArgs.push(
|
|
400
|
+
...process.execArgv,
|
|
401
|
+
...nodeArgs,
|
|
402
|
+
process.argv[1],
|
|
403
|
+
...scriptArgs
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
spawnArgs: finalSpawnArgs,
|
|
408
|
+
env: newEnv
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export {
|
|
413
|
+
isDevelopment,
|
|
414
|
+
handleAutoUpdate,
|
|
415
|
+
setUpdateHandler,
|
|
416
|
+
RELAUNCH_EXIT_CODE,
|
|
417
|
+
relaunchApp,
|
|
418
|
+
getScriptArgs,
|
|
419
|
+
getSpawnConfig
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* @license
|
|
423
|
+
* Copyright 2025 Google LLC
|
|
424
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
425
|
+
*/
|
|
@@ -2,6 +2,8 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
AuthProviderType,
|
|
4
4
|
AuthType,
|
|
5
|
+
CoreEvent,
|
|
6
|
+
CoreToolCallStatus,
|
|
5
7
|
DEFAULT_MODEL_CONFIGS,
|
|
6
8
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
7
9
|
EDITOR_OPTIONS,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
partListUnionToString,
|
|
32
34
|
require_strip_json_comments,
|
|
33
35
|
sanitizeFilenamePart
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-KTOZF7BG.js";
|
|
35
37
|
import {
|
|
36
38
|
__commonJS,
|
|
37
39
|
__require,
|
|
@@ -10289,7 +10291,7 @@ function convertSessionToHistoryFormats(messages) {
|
|
|
10289
10291
|
args: tool.args,
|
|
10290
10292
|
description: tool.description || "",
|
|
10291
10293
|
renderOutputAsMarkdown: tool.renderOutputAsMarkdown ?? true,
|
|
10292
|
-
status: tool.status === "success" ?
|
|
10294
|
+
status: tool.status === "success" ? CoreToolCallStatus.Success : CoreToolCallStatus.Error,
|
|
10293
10295
|
resultDisplay: tool.resultDisplay,
|
|
10294
10296
|
confirmationDetails: void 0
|
|
10295
10297
|
}))
|
|
@@ -15246,7 +15248,13 @@ var SETTINGS_SCHEMA_DEFINITIONS = {
|
|
|
15246
15248
|
oauth: {
|
|
15247
15249
|
type: "object",
|
|
15248
15250
|
description: "OAuth configuration for authenticating with the server.",
|
|
15249
|
-
additionalProperties: true
|
|
15251
|
+
additionalProperties: true,
|
|
15252
|
+
properties: {
|
|
15253
|
+
authorizationResponseIssParameterSupported: {
|
|
15254
|
+
type: "boolean",
|
|
15255
|
+
description: 'Whether the authorization server returns the "iss" parameter in the authorization response (RFC 9207). When true, callbacks without "iss" are rejected; when false, they are accepted. A provided "iss" is always validated. Overrides the "authorization_response_iss_parameter_supported" value discovered from server metadata.'
|
|
15256
|
+
}
|
|
15257
|
+
}
|
|
15250
15258
|
},
|
|
15251
15259
|
authProviderType: {
|
|
15252
15260
|
type: "string",
|
|
@@ -15307,7 +15315,13 @@ var SETTINGS_SCHEMA_DEFINITIONS = {
|
|
|
15307
15315
|
oauth: {
|
|
15308
15316
|
type: "object",
|
|
15309
15317
|
description: "OAuth configuration for authenticating with the server.",
|
|
15310
|
-
additionalProperties: true
|
|
15318
|
+
additionalProperties: true,
|
|
15319
|
+
properties: {
|
|
15320
|
+
authorizationResponseIssParameterSupported: {
|
|
15321
|
+
type: "boolean",
|
|
15322
|
+
description: 'Whether the authorization server returns the "iss" parameter in the authorization response (RFC 9207). When true, callbacks without "iss" are rejected; when false, they are accepted. A provided "iss" is always validated. Overrides the "authorization_response_iss_parameter_supported" value discovered from server metadata.'
|
|
15323
|
+
}
|
|
15324
|
+
}
|
|
15311
15325
|
},
|
|
15312
15326
|
authProviderType: {
|
|
15313
15327
|
type: "string",
|
|
@@ -16330,6 +16344,7 @@ function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
|
|
|
16330
16344
|
system
|
|
16331
16345
|
);
|
|
16332
16346
|
}
|
|
16347
|
+
var UNTRUSTED_WORKSPACE_SETTINGS_ERROR = "Cannot modify settings in an untrusted workspace. To enable this, verify the source of the repository and set GEMINI_CLI_TRUST_WORKSPACE=true or move your configuration to the global settings file.";
|
|
16333
16348
|
var LoadedSettings = class {
|
|
16334
16349
|
constructor(system, systemDefaults, user, workspace, isTrusted, errors = []) {
|
|
16335
16350
|
this.system = system;
|
|
@@ -16376,7 +16391,8 @@ var LoadedSettings = class {
|
|
|
16376
16391
|
return {
|
|
16377
16392
|
...workspace,
|
|
16378
16393
|
settings: {},
|
|
16379
|
-
originalSettings: {}
|
|
16394
|
+
originalSettings: {},
|
|
16395
|
+
readOnly: true
|
|
16380
16396
|
};
|
|
16381
16397
|
}
|
|
16382
16398
|
computeMergedSettings(forceTrusted = false) {
|
|
@@ -16421,8 +16437,8 @@ var LoadedSettings = class {
|
|
|
16421
16437
|
// React will pass a listener fn into this subscribe fn
|
|
16422
16438
|
// that listener fn will perform an object identity check on the snapshot and trigger a React re render if the snapshot has changed
|
|
16423
16439
|
subscribe(listener) {
|
|
16424
|
-
coreEvents.on(
|
|
16425
|
-
return () => coreEvents.off(
|
|
16440
|
+
coreEvents.on(CoreEvent.SettingsChanged, listener);
|
|
16441
|
+
return () => coreEvents.off(CoreEvent.SettingsChanged, listener);
|
|
16426
16442
|
}
|
|
16427
16443
|
getSnapshot() {
|
|
16428
16444
|
return this._snapshot;
|
|
@@ -16446,6 +16462,14 @@ var LoadedSettings = class {
|
|
|
16446
16462
|
}
|
|
16447
16463
|
setValue(scope, key, value) {
|
|
16448
16464
|
const settingsFile = this.forScope(scope);
|
|
16465
|
+
if (scope === "Workspace" /* Workspace */ && !this.isPersistable(settingsFile)) {
|
|
16466
|
+
if (settingsFile.path === "" || settingsFile.path === this.user.path) {
|
|
16467
|
+
throw new Error(
|
|
16468
|
+
"Cannot modify workspace settings in the home directory. Please use user scope instead."
|
|
16469
|
+
);
|
|
16470
|
+
}
|
|
16471
|
+
throw new Error(UNTRUSTED_WORKSPACE_SETTINGS_ERROR);
|
|
16472
|
+
}
|
|
16449
16473
|
const valueToSet = typeof value === "object" && value !== null ? structuredClone(value) : value;
|
|
16450
16474
|
setNestedProperty(settingsFile.settings, key, valueToSet);
|
|
16451
16475
|
if (this.isPersistable(settingsFile)) {
|
|
@@ -16566,7 +16590,7 @@ function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed, selecte
|
|
|
16566
16590
|
}
|
|
16567
16591
|
}
|
|
16568
16592
|
let value = "cloudshell-gca";
|
|
16569
|
-
if (selectedAuthType ===
|
|
16593
|
+
if (selectedAuthType === AuthType.USE_VERTEX_AI) {
|
|
16570
16594
|
value = process2.env[USER_GCP_PROJECT];
|
|
16571
16595
|
}
|
|
16572
16596
|
if (envFilePath && fs4.existsSync(envFilePath)) {
|
|
@@ -17459,6 +17483,7 @@ export {
|
|
|
17459
17483
|
USER_SETTINGS_PATH,
|
|
17460
17484
|
SettingScope,
|
|
17461
17485
|
isLoadableSettingScope,
|
|
17486
|
+
UNTRUSTED_WORKSPACE_SETTINGS_ERROR,
|
|
17462
17487
|
loadEnvironment,
|
|
17463
17488
|
isWorktreeEnabled,
|
|
17464
17489
|
loadSettings,
|