@google/gemini-cli 0.60.0-nightly.20260908.g85aca163f → 0.60.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.
- package/bundle/{chunk-G4V32KTT.js → chunk-2CNCBL5E.js} +1 -1
- package/bundle/{chunk-3QU7MFQ7.js → chunk-2VRC3EDT.js} +8 -9
- package/bundle/{chunk-3CDPEGVA.js → chunk-32DXU4EF.js} +1 -1
- package/bundle/{chunk-TVCSMCKT.js → chunk-4IIDTAFR.js} +1 -1
- package/bundle/{chunk-FX53IMQ4.js → chunk-7QC7KWAE.js} +1 -1
- package/bundle/{chunk-L5DTYBPR.js → chunk-CMLALLX3.js} +7 -7
- package/bundle/{chunk-OSSPFBB5.js → chunk-D3BC6B5F.js} +1 -1
- package/bundle/{chunk-ACSEKHMC.js → chunk-E62PES2E.js} +2 -2
- package/bundle/{chunk-YMZA4EO3.js → chunk-GFHSA4BE.js} +1 -1
- package/bundle/{chunk-A6IXIFRW.js → chunk-GNCCSIBA.js} +7 -7
- package/bundle/{chunk-FYCX7S2H.js → chunk-JJLODN2F.js} +1 -1
- package/bundle/{chunk-VIXOL23X.js → chunk-KAXMFUK5.js} +1 -1
- package/bundle/{chunk-AXAX7FSE.js → chunk-M6NSK26M.js} +123 -104
- package/bundle/{chunk-FIESYQDV.js → chunk-MOYC3UGL.js} +127 -106
- package/bundle/{chunk-BOGYC66X.js → chunk-OCLZG6C5.js} +1 -1
- package/bundle/{chunk-OI5WY42W.js → chunk-P3SNRA43.js} +2 -2
- package/bundle/{chunk-XTLORUWQ.js → chunk-PJREBWY3.js} +2 -2
- package/bundle/{chunk-N7PUYZ2C.js → chunk-QRYVAS35.js} +3 -3
- package/bundle/{chunk-4YTSRQAI.js → chunk-RZALYEQN.js} +1 -1
- package/bundle/{chunk-J5XD2NH2.js → chunk-S7PDUHJI.js} +3 -3
- package/bundle/{chunk-JE7V5AAP.js → chunk-UEQMLKXK.js} +3 -3
- package/bundle/{chunk-GD2JGMGI.js → chunk-VCAJDPDX.js} +14699 -7842
- package/bundle/{chunk-CYA6LLPT.js → chunk-WRNJPSJG.js} +5 -8
- package/bundle/{chunk-AL25HEEO.js → chunk-XRNOQZLR.js} +54 -67
- package/bundle/{cleanup-4FION7X5.js → cleanup-HEQUL3UY.js} +2 -2
- package/bundle/{cleanup-GWIY2YES.js → cleanup-THNE7RD2.js} +2 -2
- package/bundle/{cleanup-SXOQFKSA.js → cleanup-XYVEFB7E.js} +2 -2
- package/bundle/{core-T6ZA3RPN.js → core-A6JH6DY6.js} +5 -1
- package/bundle/{dist-CUTV6FXO.js → core-PCNYIQML.js} +5 -1
- package/bundle/{devtoolsService-FPEN37GX.js → devtoolsService-J7SM2WQQ.js} +2 -2
- package/bundle/{devtoolsService-J5IMHON6.js → devtoolsService-TEWMGXKI.js} +2 -2
- package/bundle/{devtoolsService-HJR727UG.js → devtoolsService-YPPCMYGQ.js} +3 -4
- package/bundle/{dist-IYMU3MAT.js → dist-PD4ABRTS.js} +5 -1
- package/bundle/{gemini-RLSAAMB2.js → gemini-7INSUCPB.js} +318 -272
- package/bundle/{gemini-FPHQ6YA6.js → gemini-LUNNHKPJ.js} +134 -72
- package/bundle/{gemini-DM7UHG5I.js → gemini-ZTU7EMI3.js} +134 -72
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-BNCDBJK2.js → interactiveCli-COQJBPC2.js} +8 -8
- package/bundle/{interactiveCli-NC7ZBX74.js → interactiveCli-NQE3X2WY.js} +8 -8
- package/bundle/{interactiveCli-SWGF5F7W.js → interactiveCli-X63QLGIH.js} +296 -315
- package/bundle/{liteRtServerManager-6VWY6OO6.js → liteRtServerManager-5YXPHG3Q.js} +4 -4
- package/bundle/{liteRtServerManager-HE2FE4FH.js → liteRtServerManager-7W4APCRB.js} +4 -4
- package/bundle/{liteRtServerManager-JSW26OPJ.js → liteRtServerManager-PEAZFGHW.js} +4 -4
- package/bundle/{oauth2-provider-IGJGMQ4U.js → oauth2-provider-H2X6UMUS.js} +1 -1
- package/bundle/{oauth2-provider-I665TJQN.js → oauth2-provider-M3PIKLLI.js} +1 -1
- package/bundle/{oauth2-provider-T2HJJ7SP.js → oauth2-provider-WINJTB44.js} +72 -38
- package/bundle/{start-AA23VJDL.js → start-AH7HKN5D.js} +6 -6
- package/bundle/{start-EQIIZYZY.js → start-J5DOY6JW.js} +6 -6
- package/bundle/{start-QHU4R4ZE.js → start-QYNDA2U4.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-5AXHFT2M.js +0 -512
- package/bundle/chunk-JIOJKKRV.js +0 -1571
- package/bundle/chunk-JIXDRDKL.js +0 -17353
- package/bundle/chunk-M24MUPYL.js +0 -398992
- package/bundle/chunk-MI66NSWG.js +0 -154
- package/bundle/chunk-R55JHECT.js +0 -102670
- package/bundle/chunk-RRTGK7KM.js +0 -118
- package/bundle/chunk-WET7Q2Z2.js +0 -398
- package/bundle/cleanup-XSTC4XRT.js +0 -32
- package/bundle/devtoolsService-R3332TAT.js +0 -4359
- package/bundle/dist-VMLS7TDS.js +0 -2212
- package/bundle/gemini-ZT27CSNJ.js +0 -17370
- package/bundle/interactiveCli-WG2TABNS.js +0 -34983
- package/bundle/liteRtServerManager-Y7KT37QX.js +0 -65
- package/bundle/oauth2-provider-WUYROQ6O.js +0 -235
- package/bundle/start-WLQTESZU.js +0 -18
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QRYVAS35.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-GNCCSIBA.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-RZALYEQN.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange,
|
|
90
90
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-OCLZG6C5.js";
|
|
92
92
|
import {
|
|
93
93
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-PJREBWY3.js";
|
|
95
|
+
import "./chunk-4IIDTAFR.js";
|
|
96
96
|
import {
|
|
97
97
|
cleanupCheckpoints,
|
|
98
98
|
registerCleanup,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
runExitCleanup,
|
|
102
102
|
runSyncCleanup,
|
|
103
103
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-GFHSA4BE.js";
|
|
105
105
|
import {
|
|
106
106
|
ASK_USER_TOOL_NAME,
|
|
107
107
|
ApprovalMode,
|
|
@@ -255,7 +255,7 @@ import {
|
|
|
255
255
|
updatePolicy,
|
|
256
256
|
writeToStderr,
|
|
257
257
|
writeToStdout
|
|
258
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-M6NSK26M.js";
|
|
259
259
|
import "./chunk-664ZODQF.js";
|
|
260
260
|
import "./chunk-IUUIT4SU.js";
|
|
261
261
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -1540,11 +1540,11 @@ var parser = new YargsParser({
|
|
|
1540
1540
|
resolve: resolve2,
|
|
1541
1541
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
1542
1542
|
// we can exercise all the lines below:
|
|
1543
|
-
require: (
|
|
1543
|
+
require: (path17) => {
|
|
1544
1544
|
if (typeof __require !== "undefined") {
|
|
1545
|
-
return __require(
|
|
1546
|
-
} else if (
|
|
1547
|
-
return JSON.parse(readFileSync(
|
|
1545
|
+
return __require(path17);
|
|
1546
|
+
} else if (path17.match(/\.json$/)) {
|
|
1547
|
+
return JSON.parse(readFileSync(path17, "utf8"));
|
|
1548
1548
|
} else {
|
|
1549
1549
|
throw Error("only .json config files are supported in ESM");
|
|
1550
1550
|
}
|
|
@@ -6329,27 +6329,27 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
6329
6329
|
var __filename = fileURLToPath2(import.meta.url);
|
|
6330
6330
|
var __dirname2 = dirname3(__filename);
|
|
6331
6331
|
var EXAMPLES_PATH = join(__dirname2, "examples");
|
|
6332
|
-
async function pathExists(
|
|
6332
|
+
async function pathExists(path17) {
|
|
6333
6333
|
try {
|
|
6334
|
-
await access(
|
|
6334
|
+
await access(path17);
|
|
6335
6335
|
return true;
|
|
6336
6336
|
} catch {
|
|
6337
6337
|
return false;
|
|
6338
6338
|
}
|
|
6339
6339
|
}
|
|
6340
|
-
async function createDirectory(
|
|
6341
|
-
if (await pathExists(
|
|
6342
|
-
throw new Error(`Path already exists: ${
|
|
6340
|
+
async function createDirectory(path17) {
|
|
6341
|
+
if (await pathExists(path17)) {
|
|
6342
|
+
throw new Error(`Path already exists: ${path17}`);
|
|
6343
6343
|
}
|
|
6344
|
-
await mkdir(
|
|
6344
|
+
await mkdir(path17, { recursive: true });
|
|
6345
6345
|
}
|
|
6346
|
-
async function copyDirectory(template,
|
|
6347
|
-
await createDirectory(
|
|
6346
|
+
async function copyDirectory(template, path17) {
|
|
6347
|
+
await createDirectory(path17);
|
|
6348
6348
|
const examplePath = join(EXAMPLES_PATH, template);
|
|
6349
6349
|
const entries = await readdir(examplePath, { withFileTypes: true });
|
|
6350
6350
|
for (const entry of entries) {
|
|
6351
6351
|
const srcPath = join(examplePath, entry.name);
|
|
6352
|
-
const destPath = join(
|
|
6352
|
+
const destPath = join(path17, entry.name);
|
|
6353
6353
|
await cp(srcPath, destPath, { recursive: true });
|
|
6354
6354
|
}
|
|
6355
6355
|
}
|
|
@@ -6630,7 +6630,7 @@ async function handleEnable3(args) {
|
|
|
6630
6630
|
const result = enableSkill(settings, name);
|
|
6631
6631
|
const feedback = renderSkillActionFeedback(
|
|
6632
6632
|
result,
|
|
6633
|
-
(label,
|
|
6633
|
+
(label, path17) => `${import_chalk5.default.bold(label)} (${import_chalk5.default.dim(path17)})`
|
|
6634
6634
|
);
|
|
6635
6635
|
debugLogger.log(feedback);
|
|
6636
6636
|
}
|
|
@@ -6660,7 +6660,7 @@ async function handleDisable3(args) {
|
|
|
6660
6660
|
const result = disableSkill(settings, name, scope);
|
|
6661
6661
|
const feedback = renderSkillActionFeedback(
|
|
6662
6662
|
result,
|
|
6663
|
-
(label,
|
|
6663
|
+
(label, path17) => `${import_chalk6.default.bold(label)} (${import_chalk6.default.dim(path17)})`
|
|
6664
6664
|
);
|
|
6665
6665
|
debugLogger.log(feedback);
|
|
6666
6666
|
}
|
|
@@ -7855,7 +7855,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7855
7855
|
}
|
|
7856
7856
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7857
7857
|
const packageJson = await getPackageJson(__dirname3);
|
|
7858
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.60.0
|
|
7858
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.60.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7859
7859
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7860
7860
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7861
7861
|
}
|
|
@@ -8790,7 +8790,7 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
8790
8790
|
import v8 from "node:v8";
|
|
8791
8791
|
import os6 from "node:os";
|
|
8792
8792
|
import dns from "node:dns";
|
|
8793
|
-
import * as
|
|
8793
|
+
import * as path16 from "node:path";
|
|
8794
8794
|
import * as fsPromises from "node:fs/promises";
|
|
8795
8795
|
|
|
8796
8796
|
// packages/cli/src/utils/sandbox.ts
|
|
@@ -8802,7 +8802,7 @@ import {
|
|
|
8802
8802
|
spawn as spawn2,
|
|
8803
8803
|
spawnSync
|
|
8804
8804
|
} from "node:child_process";
|
|
8805
|
-
import
|
|
8805
|
+
import path9 from "node:path";
|
|
8806
8806
|
import fs7 from "node:fs";
|
|
8807
8807
|
import os3 from "node:os";
|
|
8808
8808
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
@@ -8813,6 +8813,7 @@ import { randomBytes } from "node:crypto";
|
|
|
8813
8813
|
var import_shell_quote = __toESM(require_shell_quote(), 1);
|
|
8814
8814
|
import os2 from "node:os";
|
|
8815
8815
|
import fs6 from "node:fs";
|
|
8816
|
+
import path8 from "node:path";
|
|
8816
8817
|
import { readFile } from "node:fs/promises";
|
|
8817
8818
|
var LOCAL_DEV_SANDBOX_IMAGE_NAME = "gemini-cli-sandbox";
|
|
8818
8819
|
var SANDBOX_NETWORK_NAME = "gemini-cli-sandbox";
|
|
@@ -8827,6 +8828,58 @@ var BUILTIN_SEATBELT_PROFILES = [
|
|
|
8827
8828
|
"strict-open",
|
|
8828
8829
|
"strict-proxied"
|
|
8829
8830
|
];
|
|
8831
|
+
var SENSITIVE_SETTINGS_FILENAMES = /* @__PURE__ */ new Set([
|
|
8832
|
+
"oauth_creds.json",
|
|
8833
|
+
"google_accounts.json",
|
|
8834
|
+
"gemini-credentials.json",
|
|
8835
|
+
"mcp-oauth-tokens.json",
|
|
8836
|
+
"a2a-oauth-tokens.json"
|
|
8837
|
+
]);
|
|
8838
|
+
function isCredentialOrSensitivePath(targetPath, rootDir) {
|
|
8839
|
+
if (rootDir && path8.resolve(targetPath) === path8.resolve(rootDir)) {
|
|
8840
|
+
return false;
|
|
8841
|
+
}
|
|
8842
|
+
const base = path8.basename(targetPath).toLowerCase();
|
|
8843
|
+
if (SENSITIVE_SETTINGS_FILENAMES.has(base)) {
|
|
8844
|
+
return true;
|
|
8845
|
+
}
|
|
8846
|
+
const isRootChild = rootDir ? path8.dirname(path8.resolve(targetPath)) === path8.resolve(rootDir) : true;
|
|
8847
|
+
if (isRootChild && (base === "history" || base === "tmp" || base === "bin")) {
|
|
8848
|
+
return true;
|
|
8849
|
+
}
|
|
8850
|
+
const hasSensitiveSuffix = (s) => {
|
|
8851
|
+
if (base === s) return true;
|
|
8852
|
+
if (base.endsWith(s)) {
|
|
8853
|
+
const charBefore = base.charAt(base.length - s.length - 1);
|
|
8854
|
+
return charBefore === "-" || charBefore === "_" || charBefore === ".";
|
|
8855
|
+
}
|
|
8856
|
+
return false;
|
|
8857
|
+
};
|
|
8858
|
+
if (base.endsWith(".credentials") || hasSensitiveSuffix("credentials") || hasSensitiveSuffix("credentials.json") || hasSensitiveSuffix("tokens.json") || hasSensitiveSuffix("token.json") || hasSensitiveSuffix("token") || hasSensitiveSuffix("creds.json") || hasSensitiveSuffix("cred.json") || base.endsWith(".env") || base.endsWith(".key") || base.endsWith(".pem") || base.endsWith(".p12") || hasSensitiveSuffix("key.json")) {
|
|
8859
|
+
return true;
|
|
8860
|
+
}
|
|
8861
|
+
return false;
|
|
8862
|
+
}
|
|
8863
|
+
function prepareIsolatedSettingsDir(userSettingsDirOnHost) {
|
|
8864
|
+
const baseTmpDir = os2.tmpdir() || "/tmp";
|
|
8865
|
+
const isolatedDir = fs6.mkdtempSync(
|
|
8866
|
+
path8.join(baseTmpDir, "gemini-sandbox-settings-")
|
|
8867
|
+
);
|
|
8868
|
+
fs6.chmodSync(isolatedDir, 448);
|
|
8869
|
+
if (fs6.existsSync(userSettingsDirOnHost)) {
|
|
8870
|
+
try {
|
|
8871
|
+
fs6.cpSync(userSettingsDirOnHost, isolatedDir, {
|
|
8872
|
+
recursive: true,
|
|
8873
|
+
filter: (source) => !isCredentialOrSensitivePath(source, userSettingsDirOnHost)
|
|
8874
|
+
});
|
|
8875
|
+
} catch (err) {
|
|
8876
|
+
debugLogger.warn(
|
|
8877
|
+
`Failed to copy user settings to sandbox directory: ${err instanceof Error ? err.message : String(err)}`
|
|
8878
|
+
);
|
|
8879
|
+
}
|
|
8880
|
+
}
|
|
8881
|
+
return isolatedDir;
|
|
8882
|
+
}
|
|
8830
8883
|
function getContainerPath(hostPath) {
|
|
8831
8884
|
if (os2.platform() !== "win32") {
|
|
8832
8885
|
return hostPath;
|
|
@@ -9729,7 +9782,18 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9729
9782
|
let stopProxy = void 0;
|
|
9730
9783
|
let tempProfileFile = null;
|
|
9731
9784
|
let sandboxTmpDir = null;
|
|
9785
|
+
let isolatedSettingsDir = null;
|
|
9732
9786
|
const cleanup = () => {
|
|
9787
|
+
if (isolatedSettingsDir) {
|
|
9788
|
+
const dirToDelete = isolatedSettingsDir;
|
|
9789
|
+
isolatedSettingsDir = null;
|
|
9790
|
+
try {
|
|
9791
|
+
if (fs7.existsSync(dirToDelete)) {
|
|
9792
|
+
fs7.rmSync(dirToDelete, { recursive: true, force: true });
|
|
9793
|
+
}
|
|
9794
|
+
} catch {
|
|
9795
|
+
}
|
|
9796
|
+
}
|
|
9733
9797
|
if (sandboxTmpDir) {
|
|
9734
9798
|
const dirToDelete = sandboxTmpDir;
|
|
9735
9799
|
sandboxTmpDir = null;
|
|
@@ -9782,10 +9846,10 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9782
9846
|
new URL(`sandbox-macos-${profile}.sb`, import.meta.url)
|
|
9783
9847
|
);
|
|
9784
9848
|
if (!BUILTIN_SEATBELT_PROFILES.includes(profile)) {
|
|
9785
|
-
const safeProfile =
|
|
9849
|
+
const safeProfile = path9.basename(profile);
|
|
9786
9850
|
const fileName = `sandbox-macos-${safeProfile}.sb`;
|
|
9787
|
-
const userProfileFile =
|
|
9788
|
-
const projectProfileFile =
|
|
9851
|
+
const userProfileFile = path9.join(homedir(), GEMINI_DIR, fileName);
|
|
9852
|
+
const projectProfileFile = path9.join(GEMINI_DIR, fileName);
|
|
9789
9853
|
profileFile = fs7.existsSync(userProfileFile) ? userProfileFile : projectProfileFile;
|
|
9790
9854
|
} else {
|
|
9791
9855
|
if (!fs7.existsSync(profileFile)) {
|
|
@@ -9794,7 +9858,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9794
9858
|
try {
|
|
9795
9859
|
const tempDir = fs7.realpathSync(os3.tmpdir());
|
|
9796
9860
|
const rand = randomBytes(8).toString("hex");
|
|
9797
|
-
tempProfileFile =
|
|
9861
|
+
tempProfileFile = path9.join(
|
|
9798
9862
|
tempDir,
|
|
9799
9863
|
`gemini-sandbox-macos-${profile}-${rand}.sb`
|
|
9800
9864
|
);
|
|
@@ -9824,7 +9888,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9824
9888
|
].join(" ");
|
|
9825
9889
|
const hostTmpDir = fs7.realpathSync(os3.tmpdir());
|
|
9826
9890
|
const resolvedTmpDir = fs7.mkdtempSync(
|
|
9827
|
-
|
|
9891
|
+
path9.join(hostTmpDir, "gemini-sandbox-")
|
|
9828
9892
|
);
|
|
9829
9893
|
sandboxTmpDir = resolvedTmpDir;
|
|
9830
9894
|
const args2 = [
|
|
@@ -9852,7 +9916,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9852
9916
|
}
|
|
9853
9917
|
if (config.allowedPaths) {
|
|
9854
9918
|
for (const hostPath of config.allowedPaths) {
|
|
9855
|
-
if (hostPath &&
|
|
9919
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
9856
9920
|
const realDir = fs7.realpathSync(hostPath);
|
|
9857
9921
|
if (!includedDirs.includes(realDir) && realDir !== targetDir) {
|
|
9858
9922
|
includedDirs.push(realDir);
|
|
@@ -9958,7 +10022,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9958
10022
|
if (!command2) throw new FatalSandboxError("Sandbox command is required");
|
|
9959
10023
|
debugLogger.log(`hopping into sandbox (command: ${command2}) ...`);
|
|
9960
10024
|
const gcPath = process.argv[1] ? fs7.realpathSync(process.argv[1]) : "";
|
|
9961
|
-
const projectSandboxDockerfile =
|
|
10025
|
+
const projectSandboxDockerfile = path9.join(
|
|
9962
10026
|
GEMINI_DIR,
|
|
9963
10027
|
"sandbox.Dockerfile"
|
|
9964
10028
|
);
|
|
@@ -9967,7 +10031,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9967
10031
|
if (!image) throw new FatalSandboxError("Sandbox image is required");
|
|
9968
10032
|
if (!/^[a-zA-Z0-9_.:/-]+$/.test(image))
|
|
9969
10033
|
throw new FatalSandboxError("Invalid sandbox image name");
|
|
9970
|
-
const workdir =
|
|
10034
|
+
const workdir = path9.resolve(process.cwd());
|
|
9971
10035
|
const containerWorkdir = getContainerPath(workdir);
|
|
9972
10036
|
if (process.env["BUILD_SANDBOX"]) {
|
|
9973
10037
|
if (!gcPath.includes("gemini-cli/packages/")) {
|
|
@@ -9978,13 +10042,13 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9978
10042
|
debugLogger.log("building sandbox ...");
|
|
9979
10043
|
const gcRoot = gcPath.split("/packages/")[0];
|
|
9980
10044
|
let buildArgs = "";
|
|
9981
|
-
const projectSandboxDockerfile2 =
|
|
10045
|
+
const projectSandboxDockerfile2 = path9.join(
|
|
9982
10046
|
GEMINI_DIR,
|
|
9983
10047
|
"sandbox.Dockerfile"
|
|
9984
10048
|
);
|
|
9985
10049
|
if (isCustomProjectSandbox) {
|
|
9986
10050
|
debugLogger.log(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
9987
|
-
buildArgs += `-f ${
|
|
10051
|
+
buildArgs += `-f ${path9.resolve(projectSandboxDockerfile2)} -i ${image}`;
|
|
9988
10052
|
}
|
|
9989
10053
|
execSync(
|
|
9990
10054
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
@@ -10028,18 +10092,16 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10028
10092
|
if (!fs7.existsSync(userHomeDirOnHost)) {
|
|
10029
10093
|
fs7.mkdirSync(userHomeDirOnHost, { recursive: true });
|
|
10030
10094
|
}
|
|
10031
|
-
const userSettingsDirOnHost =
|
|
10095
|
+
const userSettingsDirOnHost = path9.join(userHomeDirOnHost, GEMINI_DIR);
|
|
10032
10096
|
if (!fs7.existsSync(userSettingsDirOnHost)) {
|
|
10033
10097
|
fs7.mkdirSync(userSettingsDirOnHost, { recursive: true });
|
|
10034
10098
|
}
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
`${userSettingsDirOnHost}:${userSettingsDirInSandbox}`
|
|
10038
|
-
);
|
|
10099
|
+
isolatedSettingsDir = prepareIsolatedSettingsDir(userSettingsDirOnHost);
|
|
10100
|
+
args.push("--volume", `${isolatedSettingsDir}:${userSettingsDirInSandbox}`);
|
|
10039
10101
|
if (userSettingsDirInSandbox !== getContainerPath(userSettingsDirOnHost)) {
|
|
10040
10102
|
args.push(
|
|
10041
10103
|
"--volume",
|
|
10042
|
-
`${
|
|
10104
|
+
`${isolatedSettingsDir}:${getContainerPath(userSettingsDirOnHost)}`
|
|
10043
10105
|
);
|
|
10044
10106
|
}
|
|
10045
10107
|
args.push("--volume", `${os3.tmpdir()}:${getContainerPath(os3.tmpdir())}`);
|
|
@@ -10049,7 +10111,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10049
10111
|
`${userHomeDirOnHost}:${getContainerPath(userHomeDirOnHost)}`
|
|
10050
10112
|
);
|
|
10051
10113
|
}
|
|
10052
|
-
const gcloudConfigDir =
|
|
10114
|
+
const gcloudConfigDir = path9.join(homedir(), ".config", "gcloud");
|
|
10053
10115
|
if (fs7.existsSync(gcloudConfigDir)) {
|
|
10054
10116
|
args.push(
|
|
10055
10117
|
"--volume",
|
|
@@ -10073,7 +10135,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10073
10135
|
to = to || from;
|
|
10074
10136
|
opts = opts || "ro";
|
|
10075
10137
|
mount = `${from}:${to}:${opts}`;
|
|
10076
|
-
if (!
|
|
10138
|
+
if (!path9.isAbsolute(from)) {
|
|
10077
10139
|
throw new FatalSandboxError(
|
|
10078
10140
|
`Path '${from}' listed in SANDBOX_MOUNTS must be absolute`
|
|
10079
10141
|
);
|
|
@@ -10090,7 +10152,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10090
10152
|
}
|
|
10091
10153
|
if (config.allowedPaths) {
|
|
10092
10154
|
for (const hostPath of config.allowedPaths) {
|
|
10093
|
-
if (hostPath &&
|
|
10155
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
10094
10156
|
const containerPath = getContainerPath(hostPath);
|
|
10095
10157
|
debugLogger.log(
|
|
10096
10158
|
`Config allowedPath: ${hostPath} -> ${containerPath} (ro)`
|
|
@@ -10210,7 +10272,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10210
10272
|
}
|
|
10211
10273
|
}
|
|
10212
10274
|
if (process.env["VIRTUAL_ENV"]?.toLowerCase().startsWith(workdir.toLowerCase())) {
|
|
10213
|
-
const sandboxVenvPath =
|
|
10275
|
+
const sandboxVenvPath = path9.resolve(GEMINI_DIR, "sandbox.venv");
|
|
10214
10276
|
if (!fs7.existsSync(sandboxVenvPath)) {
|
|
10215
10277
|
fs7.mkdirSync(sandboxVenvPath, { recursive: true });
|
|
10216
10278
|
}
|
|
@@ -10247,7 +10309,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10247
10309
|
}
|
|
10248
10310
|
args.push("--env", `SANDBOX=${containerName}`);
|
|
10249
10311
|
if (command2 === "podman") {
|
|
10250
|
-
const emptyAuthFilePath =
|
|
10312
|
+
const emptyAuthFilePath = path9.join(os3.tmpdir(), "empty_auth.json");
|
|
10251
10313
|
fs7.writeFileSync(emptyAuthFilePath, "{}", "utf-8");
|
|
10252
10314
|
args.push("--authfile", emptyAuthFilePath);
|
|
10253
10315
|
}
|
|
@@ -10376,7 +10438,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10376
10438
|
}
|
|
10377
10439
|
async function start_lxc_sandbox(config, nodeArgs = [], cliArgs = []) {
|
|
10378
10440
|
const containerName = config.image || "gemini-sandbox";
|
|
10379
|
-
const workdir =
|
|
10441
|
+
const workdir = path9.resolve(process.cwd());
|
|
10380
10442
|
debugLogger.log(
|
|
10381
10443
|
`starting lxc sandbox (container: ${containerName}, workdir: ${workdir}) ...`
|
|
10382
10444
|
);
|
|
@@ -10457,7 +10519,7 @@ async function start_lxc_sandbox(config, nodeArgs = [], cliArgs = []) {
|
|
|
10457
10519
|
}
|
|
10458
10520
|
if (config.allowedPaths) {
|
|
10459
10521
|
for (const hostPath of config.allowedPaths) {
|
|
10460
|
-
if (hostPath &&
|
|
10522
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
10461
10523
|
const allowedDeviceName = `gemini-allowed-${randomBytes(4).toString(
|
|
10462
10524
|
"hex"
|
|
10463
10525
|
)}`;
|
|
@@ -10703,7 +10765,7 @@ async function getStartupWarnings() {
|
|
|
10703
10765
|
// packages/cli/src/utils/userStartupWarnings.ts
|
|
10704
10766
|
import fs9 from "node:fs/promises";
|
|
10705
10767
|
import { homedir as osHomedir } from "node:os";
|
|
10706
|
-
import
|
|
10768
|
+
import path10 from "node:path";
|
|
10707
10769
|
import process4 from "node:process";
|
|
10708
10770
|
var homeDirectoryCheck = {
|
|
10709
10771
|
id: "home-directory",
|
|
@@ -10717,7 +10779,7 @@ var homeDirectoryCheck = {
|
|
|
10717
10779
|
fs9.realpath(workspaceRoot),
|
|
10718
10780
|
fs9.realpath(osHomedir())
|
|
10719
10781
|
]);
|
|
10720
|
-
if (
|
|
10782
|
+
if (path10.resolve(workspaceRealPath) === path10.resolve(homeRealPath)) {
|
|
10721
10783
|
if (isFolderTrustEnabled(settings) && isWorkspaceTrusted(settings).isTrusted) {
|
|
10722
10784
|
return null;
|
|
10723
10785
|
}
|
|
@@ -10736,7 +10798,7 @@ var rootDirectoryCheck = {
|
|
|
10736
10798
|
try {
|
|
10737
10799
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
10738
10800
|
const errorMessage = "Warning: You are running Gemini CLI in the root directory. Your entire folder structure will be used for context. It is strongly recommended to run in a project-specific directory.";
|
|
10739
|
-
if (
|
|
10801
|
+
if (path10.dirname(workspaceRealPath) === workspaceRealPath) {
|
|
10740
10802
|
return errorMessage;
|
|
10741
10803
|
}
|
|
10742
10804
|
return null;
|
|
@@ -11134,7 +11196,7 @@ async function runNonInteractive({
|
|
|
11134
11196
|
}
|
|
11135
11197
|
});
|
|
11136
11198
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11137
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11199
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-J7SM2WQQ.js");
|
|
11138
11200
|
setupInitialActivityLogger(config);
|
|
11139
11201
|
}
|
|
11140
11202
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11644,7 +11706,7 @@ async function runNonInteractive2(params) {
|
|
|
11644
11706
|
}
|
|
11645
11707
|
});
|
|
11646
11708
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11647
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11709
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-J7SM2WQQ.js");
|
|
11648
11710
|
setupInitialActivityLogger(config);
|
|
11649
11711
|
}
|
|
11650
11712
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -13635,7 +13697,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
13635
13697
|
|
|
13636
13698
|
// packages/cli/src/acp/acpSession.ts
|
|
13637
13699
|
import * as fs12 from "node:fs/promises";
|
|
13638
|
-
import * as
|
|
13700
|
+
import * as path13 from "node:path";
|
|
13639
13701
|
import { randomUUID } from "node:crypto";
|
|
13640
13702
|
|
|
13641
13703
|
// packages/cli/src/acp/commands/commandRegistry.ts
|
|
@@ -14077,7 +14139,7 @@ var UpdateExtensionCommand = class {
|
|
|
14077
14139
|
|
|
14078
14140
|
// packages/cli/src/acp/commands/init.ts
|
|
14079
14141
|
import * as fs10 from "node:fs";
|
|
14080
|
-
import * as
|
|
14142
|
+
import * as path11 from "node:path";
|
|
14081
14143
|
var InitCommand = class {
|
|
14082
14144
|
name = "init";
|
|
14083
14145
|
description = "Analyzes the project and creates a tailored GEMINI.md file";
|
|
@@ -14087,7 +14149,7 @@ var InitCommand = class {
|
|
|
14087
14149
|
if (!targetDir) {
|
|
14088
14150
|
throw new Error("Command requires a workspace.");
|
|
14089
14151
|
}
|
|
14090
|
-
const geminiMdPath =
|
|
14152
|
+
const geminiMdPath = path11.join(targetDir, "GEMINI.md");
|
|
14091
14153
|
const result = performInit(fs10.existsSync(geminiMdPath));
|
|
14092
14154
|
switch (result.type) {
|
|
14093
14155
|
case "message":
|
|
@@ -14120,7 +14182,7 @@ ${result.content}`
|
|
|
14120
14182
|
|
|
14121
14183
|
// packages/cli/src/acp/commands/restore.ts
|
|
14122
14184
|
import * as fs11 from "node:fs/promises";
|
|
14123
|
-
import * as
|
|
14185
|
+
import * as path12 from "node:path";
|
|
14124
14186
|
var RestoreCommand = class {
|
|
14125
14187
|
name = "restore";
|
|
14126
14188
|
description = "Restore to a previous checkpoint, or list available checkpoints to restore. This will reset the conversation and file history to the state it was in when the checkpoint was created";
|
|
@@ -14142,7 +14204,7 @@ var RestoreCommand = class {
|
|
|
14142
14204
|
}
|
|
14143
14205
|
const selectedFile = argsStr.endsWith(".json") ? argsStr : `${argsStr}.json`;
|
|
14144
14206
|
const checkpointDir = config.storage.getProjectTempCheckpointsDir();
|
|
14145
|
-
const filePath =
|
|
14207
|
+
const filePath = path12.join(checkpointDir, selectedFile);
|
|
14146
14208
|
let data;
|
|
14147
14209
|
try {
|
|
14148
14210
|
data = await fs11.readFile(filePath, "utf-8");
|
|
@@ -14216,7 +14278,7 @@ var ListCheckpointsCommand = class {
|
|
|
14216
14278
|
}
|
|
14217
14279
|
const checkpointFiles = /* @__PURE__ */ new Map();
|
|
14218
14280
|
for (const file of jsonFiles) {
|
|
14219
|
-
const filePath =
|
|
14281
|
+
const filePath = path12.join(checkpointDir, file);
|
|
14220
14282
|
const data = await fs11.readFile(filePath, "utf-8");
|
|
14221
14283
|
checkpointFiles.set(file, data);
|
|
14222
14284
|
}
|
|
@@ -15478,7 +15540,7 @@ ${event.value.description}`;
|
|
|
15478
15540
|
} else if (result.status === "invalid") {
|
|
15479
15541
|
continue;
|
|
15480
15542
|
} else {
|
|
15481
|
-
absolutePath =
|
|
15543
|
+
absolutePath = path13.resolve(
|
|
15482
15544
|
this.context.config.getTargetDir(),
|
|
15483
15545
|
pathName
|
|
15484
15546
|
);
|
|
@@ -15552,7 +15614,7 @@ ${event.value.description}`;
|
|
|
15552
15614
|
}
|
|
15553
15615
|
try {
|
|
15554
15616
|
if (!validationError) {
|
|
15555
|
-
if ((
|
|
15617
|
+
if ((path13.isAbsolute(pathName) || !isWithinRoot(
|
|
15556
15618
|
absolutePath,
|
|
15557
15619
|
this.context.config.getTargetDir()
|
|
15558
15620
|
)) && !readDirectly) {
|
|
@@ -15656,7 +15718,7 @@ ${contentToPush}`;
|
|
|
15656
15718
|
const lines = globResult.llmContent.split("\n");
|
|
15657
15719
|
if (lines.length > 1 && lines[1]) {
|
|
15658
15720
|
const firstMatchAbsolute = lines[1].trim();
|
|
15659
|
-
currentPathSpec =
|
|
15721
|
+
currentPathSpec = path13.relative(
|
|
15660
15722
|
this.context.config.getTargetDir(),
|
|
15661
15723
|
firstMatchAbsolute
|
|
15662
15724
|
);
|
|
@@ -15874,7 +15936,7 @@ Content from @${contextPart.uri}:
|
|
|
15874
15936
|
|
|
15875
15937
|
// packages/cli/src/acp/acpFileSystemService.ts
|
|
15876
15938
|
import os5 from "node:os";
|
|
15877
|
-
import
|
|
15939
|
+
import path14 from "node:path";
|
|
15878
15940
|
var AcpFileSystemService = class {
|
|
15879
15941
|
constructor(connection, sessionId, capabilities, fallback, root) {
|
|
15880
15942
|
this.connection = connection;
|
|
@@ -15883,7 +15945,7 @@ var AcpFileSystemService = class {
|
|
|
15883
15945
|
this.fallback = fallback;
|
|
15884
15946
|
this.root = root;
|
|
15885
15947
|
}
|
|
15886
|
-
geminiDir =
|
|
15948
|
+
geminiDir = path14.join(os5.homedir(), ".gemini");
|
|
15887
15949
|
shouldUseFallback(filePath) {
|
|
15888
15950
|
return !isWithinRoot(filePath, this.root) || isWithinRoot(filePath, this.geminiDir);
|
|
15889
15951
|
}
|
|
@@ -16519,7 +16581,7 @@ async function setupTerminalAndTheme(config, settings) {
|
|
|
16519
16581
|
|
|
16520
16582
|
// packages/cli/src/utils/logCleanup.ts
|
|
16521
16583
|
import { promises as fs13 } from "node:fs";
|
|
16522
|
-
import * as
|
|
16584
|
+
import * as path15 from "node:path";
|
|
16523
16585
|
var RETENTION_PERIOD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
16524
16586
|
async function cleanupBackgroundLogs(debugMode = false) {
|
|
16525
16587
|
try {
|
|
@@ -16534,7 +16596,7 @@ async function cleanupBackgroundLogs(debugMode = false) {
|
|
|
16534
16596
|
let deletedCount = 0;
|
|
16535
16597
|
for (const entry of entries) {
|
|
16536
16598
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
16537
|
-
const filePath =
|
|
16599
|
+
const filePath = path15.join(logDir, entry.name);
|
|
16538
16600
|
try {
|
|
16539
16601
|
const stats = await fs13.stat(filePath);
|
|
16540
16602
|
if (now - stats.mtime.getTime() > RETENTION_PERIOD_MS) {
|
|
@@ -16785,8 +16847,8 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16785
16847
|
sessionData.projectHash = getProjectHash(storage.getProjectRoot());
|
|
16786
16848
|
sessionData.startTime = isoNow;
|
|
16787
16849
|
sessionData.lastUpdated = isoNow;
|
|
16788
|
-
const chatsDir =
|
|
16789
|
-
const newSessionPath =
|
|
16850
|
+
const chatsDir = path16.join(storage.getProjectTempDir(), "chats");
|
|
16851
|
+
const newSessionPath = path16.join(
|
|
16790
16852
|
chatsDir,
|
|
16791
16853
|
`session-${now}-${newSessionId.slice(0, 8)}.jsonl`
|
|
16792
16854
|
);
|
|
@@ -16854,7 +16916,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16854
16916
|
}
|
|
16855
16917
|
}
|
|
16856
16918
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
16857
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
16919
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-COQJBPC2.js");
|
|
16858
16920
|
await doStartUI(
|
|
16859
16921
|
config,
|
|
16860
16922
|
settings,
|
|
@@ -17063,7 +17125,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17063
17125
|
await config.storage.initialize();
|
|
17064
17126
|
adminControlsListner.setConfig(config);
|
|
17065
17127
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17066
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17128
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-J7SM2WQQ.js");
|
|
17067
17129
|
setupInitialActivityLogger(config);
|
|
17068
17130
|
}
|
|
17069
17131
|
registerTelemetryConfig(config);
|
|
@@ -17122,7 +17184,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17122
17184
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17123
17185
|
const initializationResult = await initializeApp(config, settings);
|
|
17124
17186
|
initAppHandle?.end();
|
|
17125
|
-
import("./liteRtServerManager-
|
|
17187
|
+
import("./liteRtServerManager-PEAZFGHW.js").then(({ LiteRtServerManager }) => {
|
|
17126
17188
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17127
17189
|
if (!mergedGemma) return;
|
|
17128
17190
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|