@google/gemini-cli 0.44.0 → 0.45.0-nightly.20260527.g41c9260ca
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-FOOWNGAB.js → chunk-2RAPXSOV.js} +1 -1
- package/bundle/{chunk-TN4WXWFM.js → chunk-5SQYZFP6.js} +3 -3
- package/bundle/{chunk-BOYNQXWU.js → chunk-6SMPX7UU.js} +2 -2
- package/bundle/{chunk-QUZ62PY7.js → chunk-6VVFXG4V.js} +2 -2
- package/bundle/{chunk-DALZZYPQ.js → chunk-7EPRHON5.js} +1 -1
- package/bundle/{chunk-XTG4JBIR.js → chunk-AAGSPORB.js} +1 -1
- package/bundle/{chunk-BE42OOYM.js → chunk-EVYFBIGQ.js} +377 -297
- package/bundle/{chunk-5CABHQOE.js → chunk-FHQHQ6DS.js} +1 -1
- package/bundle/{chunk-ONQVFEHS.js → chunk-GIZR3U4X.js} +1 -1
- package/bundle/{chunk-CBT4PN4R.js → chunk-H4PA4O33.js} +8 -8
- package/bundle/{chunk-M3EDSAPV.js → chunk-I6UPFWEQ.js} +1 -1
- package/bundle/{chunk-TW47A6FW.js → chunk-IGGUR3YU.js} +7827 -14242
- package/bundle/{chunk-VUERI7WB.js → chunk-K4FVPC4T.js} +8 -8
- package/bundle/{chunk-EKUU3KNX.js → chunk-KSJ6OVGZ.js} +1 -1
- package/bundle/{chunk-OLBOCZ5F.js → chunk-P4IX67II.js} +68 -55
- package/bundle/{chunk-6W2Z7FTE.js → chunk-P4YCK66H.js} +3 -3
- package/bundle/{chunk-SIXPHUVZ.js → chunk-PN5LGMOT.js} +423 -330
- package/bundle/{chunk-N4SGO3W6.js → chunk-RJZUBUMQ.js} +2 -2
- package/bundle/{chunk-3K52543M.js → chunk-SJJUCWYW.js} +56 -2
- package/bundle/{chunk-G2L4VCSN.js → chunk-SS6WZNE5.js} +9 -8
- package/bundle/{chunk-LM6XTSWQ.js → chunk-T5BJFXUT.js} +56 -2
- package/bundle/chunk-TKOMYARC.js +81685 -0
- package/bundle/{chunk-OTLI6LZ3.js → chunk-TREYQA4O.js} +1 -1
- package/bundle/chunk-U3JK5HRW.js +394429 -0
- package/bundle/chunk-UHMKT6SK.js +154 -0
- package/bundle/chunk-UJJ75A5I.js +398 -0
- package/bundle/{chunk-7KIX5G5D.js → chunk-UMBPNYQU.js} +3 -3
- package/bundle/{chunk-7ZH745HC.js → chunk-VC3YLUFW.js} +63 -6
- package/bundle/chunk-VCSWELYF.js +512 -0
- package/bundle/chunk-VG6I25WK.js +1571 -0
- package/bundle/chunk-WU3YM7M5.js +118 -0
- package/bundle/chunk-YHUFSS4V.js +17320 -0
- package/bundle/{cleanup-PDT5ATZB.js → cleanup-DAEFNP5D.js} +2 -2
- package/bundle/{cleanup-SF7XW2P3.js → cleanup-QLHTBBSJ.js} +2 -2
- package/bundle/{cleanup-UW3DZLXP.js → cleanup-SWVNBESF.js} +2 -2
- package/bundle/cleanup-V5HN45VV.js +32 -0
- package/bundle/{core-LN2S4IOX.js → core-RLNQPUYW.js} +3 -7
- package/bundle/{devtoolsService-64QE2V7E.js → devtoolsService-F5XNH3LW.js} +2 -2
- package/bundle/{devtoolsService-ZC7E4R2A.js → devtoolsService-KSXJ7ZBM.js} +4 -3
- package/bundle/devtoolsService-N5XYKGOS.js +856 -0
- package/bundle/{devtoolsService-DUEWJW52.js → devtoolsService-Y4US3JKZ.js} +2 -2
- package/bundle/{dist-J4RONYVV.js → dist-CMC3RCEI.js} +3 -7
- package/bundle/{core-GW6VAL53.js → dist-XPJBSOYP.js} +3 -7
- package/bundle/dist-YCN22NGW.js +2134 -0
- package/bundle/docs/changelogs/index.md +15 -0
- package/bundle/docs/changelogs/latest.md +198 -262
- package/bundle/docs/changelogs/preview.md +202 -181
- package/bundle/docs/reference/configuration.md +24 -29
- package/bundle/{gemini-SSQIKHR2.js → gemini-3FB3K6RR.js} +41 -30
- package/bundle/{gemini-CMBH5YG6.js → gemini-AAR7OIGT.js} +239 -212
- package/bundle/{gemini-CSPRLMWN.js → gemini-BKWLRTMK.js} +41 -30
- package/bundle/gemini-JVLQYJ2G.js +16406 -0
- package/bundle/gemini.js +15 -10
- package/bundle/{interactiveCli-RDMZS6KL.js → interactiveCli-7AF74ES4.js} +33 -57
- package/bundle/{interactiveCli-TOEU7LIO.js → interactiveCli-LEZF6KPA.js} +33 -57
- package/bundle/{interactiveCli-Q2A2JFLA.js → interactiveCli-PCGUDXG4.js} +339 -344
- package/bundle/interactiveCli-QC3CJANH.js +34726 -0
- package/bundle/{liteRtServerManager-ASKAVAO7.js → liteRtServerManager-2ZSZW3IA.js} +4 -4
- package/bundle/{liteRtServerManager-6BWTXMUI.js → liteRtServerManager-A3Z4AS3V.js} +4 -4
- package/bundle/{liteRtServerManager-ZS3BCW53.js → liteRtServerManager-EDFTLOS6.js} +4 -4
- package/bundle/liteRtServerManager-YPEZDSGQ.js +65 -0
- package/bundle/{oauth2-provider-SYRZDGL5.js → oauth2-provider-5ZA5OIVB.js} +1 -1
- package/bundle/{oauth2-provider-FGI6QDEM.js → oauth2-provider-O4BUOOYR.js} +1 -1
- package/bundle/{oauth2-provider-7JOVY727.js → oauth2-provider-O635QVSF.js} +38 -72
- package/bundle/oauth2-provider-WIBCYDQG.js +235 -0
- package/bundle/{start-KJCIH3GX.js → start-7TRTTGGV.js} +6 -6
- package/bundle/{start-TU5WNP77.js → start-A4YSRLHR.js} +6 -6
- package/bundle/{start-47OYCVVA.js → start-HFZVWJGC.js} +6 -6
- package/bundle/start-KH23TWSE.js +18 -0
- 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-PN5LGMOT.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-UHMKT6SK.js";
|
|
5
|
+
import {
|
|
6
|
+
RELEASE_CHANNEL_STABILITY,
|
|
7
|
+
debugLogger,
|
|
8
|
+
getChannelFromVersion,
|
|
9
|
+
isGitRepository
|
|
10
|
+
} from "./chunk-PN5LGMOT.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
|
+
*/
|
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
exitCli,
|
|
4
4
|
require_source
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TREYQA4O.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_PORT,
|
|
8
8
|
SERVER_START_WAIT_MS,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
isServerRunning,
|
|
15
15
|
resolveGemmaConfig,
|
|
16
16
|
writeServerProcessInfo
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VC3YLUFW.js";
|
|
18
18
|
import {
|
|
19
19
|
debugLogger
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EVYFBIGQ.js";
|
|
21
21
|
import {
|
|
22
22
|
__toESM
|
|
23
23
|
} from "./chunk-34MYV7JD.js";
|
|
@@ -1,6 +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
3
|
AuthProviderType,
|
|
4
|
+
AuthType,
|
|
5
|
+
CoreEvent,
|
|
6
|
+
CoreToolCallStatus,
|
|
4
7
|
DEFAULT_MODEL_CONFIGS,
|
|
5
8
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
6
9
|
EDITOR_OPTIONS,
|
|
@@ -29,7 +32,7 @@ import {
|
|
|
29
32
|
require_strip_json_comments,
|
|
30
33
|
sanitizeFilenamePart,
|
|
31
34
|
stripAnsi
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-EVYFBIGQ.js";
|
|
33
36
|
import {
|
|
34
37
|
__commonJS,
|
|
35
38
|
__require,
|
|
@@ -10176,7 +10179,11 @@ function convertSessionToHistoryFormats(messages) {
|
|
|
10176
10179
|
const displayContentString = msg.displayContent ? partListUnionToString(msg.displayContent) : void 0;
|
|
10177
10180
|
const contentString = partListUnionToString(msg.content);
|
|
10178
10181
|
const uiText = displayContentString || contentString;
|
|
10179
|
-
|
|
10182
|
+
const trimmedText = uiText.trim();
|
|
10183
|
+
if (trimmedText.startsWith("<session_context>") || trimmedText.startsWith("<hook_context>")) {
|
|
10184
|
+
continue;
|
|
10185
|
+
}
|
|
10186
|
+
if (trimmedText) {
|
|
10180
10187
|
let messageType;
|
|
10181
10188
|
switch (msg.type) {
|
|
10182
10189
|
case "user":
|
|
@@ -10213,7 +10220,7 @@ function convertSessionToHistoryFormats(messages) {
|
|
|
10213
10220
|
args: tool.args,
|
|
10214
10221
|
description: tool.description || "",
|
|
10215
10222
|
renderOutputAsMarkdown: tool.renderOutputAsMarkdown ?? true,
|
|
10216
|
-
status: tool.status === "success" ?
|
|
10223
|
+
status: tool.status === "success" ? CoreToolCallStatus.Success : CoreToolCallStatus.Error,
|
|
10217
10224
|
resultDisplay: tool.resultDisplay,
|
|
10218
10225
|
confirmationDetails: void 0
|
|
10219
10226
|
}))
|
|
@@ -14551,6 +14558,15 @@ var SETTINGS_SCHEMA = {
|
|
|
14551
14558
|
description: "Suitable for general coding and software development tasks.",
|
|
14552
14559
|
showInDialog: true
|
|
14553
14560
|
},
|
|
14561
|
+
powerUserProfile: {
|
|
14562
|
+
type: "boolean",
|
|
14563
|
+
label: "Use the power user profile to manage agent contexts.",
|
|
14564
|
+
category: "Experimental",
|
|
14565
|
+
requiresRestart: true,
|
|
14566
|
+
default: false,
|
|
14567
|
+
description: "Less cache friendly version of the generalist profile.",
|
|
14568
|
+
showInDialog: false
|
|
14569
|
+
},
|
|
14554
14570
|
contextManagement: {
|
|
14555
14571
|
type: "boolean",
|
|
14556
14572
|
label: "Enable Context Management",
|
|
@@ -16265,8 +16281,8 @@ var LoadedSettings = class {
|
|
|
16265
16281
|
// React will pass a listener fn into this subscribe fn
|
|
16266
16282
|
// that listener fn will perform an object identity check on the snapshot and trigger a React re render if the snapshot has changed
|
|
16267
16283
|
subscribe(listener) {
|
|
16268
|
-
coreEvents.on(
|
|
16269
|
-
return () => coreEvents.off(
|
|
16284
|
+
coreEvents.on(CoreEvent.SettingsChanged, listener);
|
|
16285
|
+
return () => coreEvents.off(CoreEvent.SettingsChanged, listener);
|
|
16270
16286
|
}
|
|
16271
16287
|
getSnapshot() {
|
|
16272
16288
|
return this._snapshot;
|
|
@@ -16327,6 +16343,47 @@ var LoadedSettings = class {
|
|
|
16327
16343
|
this._remoteAdminSettings = { admin };
|
|
16328
16344
|
this._merged = this.computeMergedSettings();
|
|
16329
16345
|
}
|
|
16346
|
+
/**
|
|
16347
|
+
* Returns a consolidated list of excluded MCP servers across all settings files.
|
|
16348
|
+
*/
|
|
16349
|
+
getConsolidatedExcludedMcpServers() {
|
|
16350
|
+
const scopes = [
|
|
16351
|
+
this.system,
|
|
16352
|
+
this.systemDefaults,
|
|
16353
|
+
this.user,
|
|
16354
|
+
this.workspace
|
|
16355
|
+
];
|
|
16356
|
+
return scopes.flatMap((scope) => {
|
|
16357
|
+
const excluded = scope?.settings?.mcp?.excluded;
|
|
16358
|
+
return Array.isArray(excluded) ? excluded : [];
|
|
16359
|
+
});
|
|
16360
|
+
}
|
|
16361
|
+
/**
|
|
16362
|
+
* Returns a consolidated list of allowed MCP servers (via intersection of all defined lists).
|
|
16363
|
+
*/
|
|
16364
|
+
getConsolidatedAllowedMcpServers() {
|
|
16365
|
+
const scopes = [
|
|
16366
|
+
this.system,
|
|
16367
|
+
this.systemDefaults,
|
|
16368
|
+
this.user,
|
|
16369
|
+
this.workspace
|
|
16370
|
+
];
|
|
16371
|
+
const definedAllowlists = scopes.flatMap((scope) => {
|
|
16372
|
+
const allowed = scope?.settings?.mcp?.allowed;
|
|
16373
|
+
return Array.isArray(allowed) ? [allowed] : [];
|
|
16374
|
+
});
|
|
16375
|
+
if (definedAllowlists.length === 0) {
|
|
16376
|
+
return void 0;
|
|
16377
|
+
}
|
|
16378
|
+
return definedAllowlists.reduce((acc, current) => {
|
|
16379
|
+
const normalizedCurrent = new Set(
|
|
16380
|
+
current.map((item) => item.toLowerCase().trim())
|
|
16381
|
+
);
|
|
16382
|
+
return acc.filter(
|
|
16383
|
+
(item) => normalizedCurrent.has(item.toLowerCase().trim())
|
|
16384
|
+
);
|
|
16385
|
+
});
|
|
16386
|
+
}
|
|
16330
16387
|
};
|
|
16331
16388
|
function findEnvFile(startDir, isTrusted, ignoreLocalEnv) {
|
|
16332
16389
|
let currentDir = path3.resolve(startDir);
|
|
@@ -16369,7 +16426,7 @@ function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed, selecte
|
|
|
16369
16426
|
}
|
|
16370
16427
|
}
|
|
16371
16428
|
let value = "cloudshell-gca";
|
|
16372
|
-
if (selectedAuthType ===
|
|
16429
|
+
if (selectedAuthType === AuthType.USE_VERTEX_AI) {
|
|
16373
16430
|
value = process2.env[USER_GCP_PROJECT];
|
|
16374
16431
|
}
|
|
16375
16432
|
if (envFilePath && fs4.existsSync(envFilePath)) {
|