@google/gemini-cli 0.40.0-preview.2 → 0.40.0-preview.3
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-WL5MCPV2.js → chunk-35STMVQ6.js} +2 -2
- package/bundle/{chunk-EFCQXWIF.js → chunk-47HVBRLD.js} +3 -3
- package/bundle/{chunk-HV36F4CL.js → chunk-5UA5NDVP.js} +134 -354
- package/bundle/{chunk-IUVLJUOL.js → chunk-B4NHGUNE.js} +2 -2
- package/bundle/{chunk-NO7STVVM.js → chunk-EEQGWBJU.js} +1413 -1089
- package/bundle/{chunk-IMEC72NS.js → chunk-EJ5U5A3P.js} +1 -1
- package/bundle/{chunk-33ANPP4S.js → chunk-ELANWZTZ.js} +3 -3
- package/bundle/{chunk-3GU3LF3I.js → chunk-F2KGMQCY.js} +180 -9
- package/bundle/{chunk-VCGILCZV.js → chunk-F73F75XM.js} +16 -0
- package/bundle/{chunk-PLUWJHZZ.js → chunk-FRCZJECU.js} +237 -54
- package/bundle/{chunk-UBXB5AEJ.js → chunk-GDNYA45E.js} +3 -3
- package/bundle/{chunk-TDW6FM3A.js → chunk-KITSDDOZ.js} +1 -1
- package/bundle/{chunk-WHIWQCI5.js → chunk-KKO2XSBY.js} +1 -1
- package/bundle/{chunk-GXRQOXQF.js → chunk-KUAEOA2Q.js} +177 -7
- package/bundle/{chunk-4IJPDKI6.js → chunk-KVGAAOEJ.js} +146 -364
- package/bundle/{chunk-QK7UWGBN.js → chunk-MRSOTTBM.js} +1380 -1081
- package/bundle/{chunk-MUGUV6RZ.js → chunk-MUEKKRWF.js} +2 -2
- package/bundle/chunk-R4ZCSDPK.js +80018 -0
- package/bundle/chunk-RMQT572G.js +156 -0
- package/bundle/chunk-RVU5Q4NB.js +118 -0
- package/bundle/{chunk-2RHFUIH4.js → chunk-UHHRGNIO.js} +16 -0
- package/bundle/chunk-UX5CFZ75.js +17505 -0
- package/bundle/{chunk-RM43GNQQ.js → chunk-UZ5SUJO4.js} +7709 -12907
- package/bundle/chunk-VQVLJLWD.js +1571 -0
- package/bundle/{chunk-NIVCRM5L.js → chunk-VUHGADMU.js} +134 -354
- package/bundle/chunk-YCTQOSY2.js +351149 -0
- package/bundle/{cleanup-A7WXWAMI.js → cleanup-BWZ7GONS.js} +3 -3
- package/bundle/{cleanup-EWPIME2M.js → cleanup-F6XR3KDW.js} +3 -3
- package/bundle/{cleanup-IPLJJT5S.js → cleanup-PS3UGKWX.js} +3 -3
- package/bundle/cleanup-VV6AV4T2.js +33 -0
- package/bundle/{core-VCDK23ZC.js → core-NDKZ44LE.js} +28 -2
- package/bundle/{devtoolsService-B5VVZ752.js → devtoolsService-DNFLMYOX.js} +3 -3
- package/bundle/{devtoolsService-2JXSALRU.js → devtoolsService-F6QBRWPB.js} +5 -4
- package/bundle/{devtoolsService-6Y6YER6T.js → devtoolsService-XGIYIDBD.js} +3 -3
- package/bundle/devtoolsService-YD6JSR34.js +852 -0
- package/bundle/{dist-UIXQETMC.js → dist-54TUMSKA.js} +28 -2
- package/bundle/{core-BQT6T3CH.js → dist-6KUUELBS.js} +28 -2
- package/bundle/dist-QHCXV4N4.js +2046 -0
- package/bundle/docs/cli/cli-reference.md +1 -0
- package/bundle/docs/cli/trusted-folders.md +28 -0
- package/bundle/docs/reference/configuration.md +14 -0
- package/bundle/{gemini-ID44Z5SV.js → gemini-HLGERR6W.js} +65 -21
- package/bundle/{gemini-54LH6RUH.js → gemini-IRPF2U4N.js} +241 -182
- package/bundle/gemini-QZM4UKD6.js +16087 -0
- package/bundle/{gemini-44W2QEZI.js → gemini-TU6PHHWE.js} +63 -20
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-5MTJDFYC.js → interactiveCli-374EDFUA.js} +17 -167
- package/bundle/{interactiveCli-JFBPGMNM.js → interactiveCli-EKTBCA5F.js} +30 -179
- package/bundle/{interactiveCli-5B3X6RNB.js → interactiveCli-GRSDCSR3.js} +300 -432
- package/bundle/interactiveCli-HN4DKCW5.js +34448 -0
- package/bundle/{liteRtServerManager-76V63PRJ.js → liteRtServerManager-46V57ROR.js} +4 -4
- package/bundle/{liteRtServerManager-WQMDPACQ.js → liteRtServerManager-E34UIEBJ.js} +4 -4
- package/bundle/{liteRtServerManager-6GJWEP5W.js → liteRtServerManager-EAWDC35K.js} +4 -4
- package/bundle/liteRtServerManager-HTDKEOQC.js +65 -0
- package/bundle/{memoryDiscovery-RYHYLAPJ.js → memoryDiscovery-CZURD35O.js} +1 -1
- package/bundle/{memoryDiscovery-HWEYBJE7.js → memoryDiscovery-GZLXKRGB.js} +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-JCKLNKRV.js → oauth2-provider-N7Q7FNNA.js} +2 -2
- package/bundle/{oauth2-provider-EX6SQEZP.js → oauth2-provider-TW3RXTUS.js} +2 -2
- package/bundle/{oauth2-provider-ZF52AWQY.js → oauth2-provider-UQIDMKYA.js} +39 -73
- package/bundle/oauth2-provider-WTRWHBI2.js +237 -0
- package/bundle/{start-CYDJTOAP.js → start-4D5PYHGK.js} +6 -6
- package/bundle/{start-SHOUHW3Y.js → start-7DJXXKMH.js} +6 -6
- package/bundle/{start-B6EMQCH5.js → start-ERRBQVDH.js} +6 -6
- package/bundle/start-TKRKH572.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
isTelemetrySdkInitialized,
|
|
5
|
+
resetBrowserSession,
|
|
6
|
+
shutdownTelemetry
|
|
7
|
+
} from "./chunk-YCTQOSY2.js";
|
|
8
|
+
import {
|
|
9
|
+
Storage
|
|
10
|
+
} from "./chunk-F73F75XM.js";
|
|
11
|
+
|
|
12
|
+
// packages/cli/src/utils/cleanup.ts
|
|
13
|
+
import { promises as fs } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
var cleanupFunctions = [];
|
|
16
|
+
var syncCleanupFunctions = [];
|
|
17
|
+
var configForTelemetry = null;
|
|
18
|
+
var isShuttingDown = false;
|
|
19
|
+
function registerCleanup(fn) {
|
|
20
|
+
cleanupFunctions.push(fn);
|
|
21
|
+
}
|
|
22
|
+
function removeCleanup(fn) {
|
|
23
|
+
const index = cleanupFunctions.indexOf(fn);
|
|
24
|
+
if (index !== -1) {
|
|
25
|
+
cleanupFunctions.splice(index, 1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function registerSyncCleanup(fn) {
|
|
29
|
+
syncCleanupFunctions.push(fn);
|
|
30
|
+
}
|
|
31
|
+
function removeSyncCleanup(fn) {
|
|
32
|
+
const index = syncCleanupFunctions.indexOf(fn);
|
|
33
|
+
if (index !== -1) {
|
|
34
|
+
syncCleanupFunctions.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function resetCleanupForTesting() {
|
|
38
|
+
cleanupFunctions.length = 0;
|
|
39
|
+
syncCleanupFunctions.length = 0;
|
|
40
|
+
configForTelemetry = null;
|
|
41
|
+
isShuttingDown = false;
|
|
42
|
+
}
|
|
43
|
+
function runSyncCleanup() {
|
|
44
|
+
for (const fn of syncCleanupFunctions) {
|
|
45
|
+
try {
|
|
46
|
+
fn();
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
syncCleanupFunctions.length = 0;
|
|
51
|
+
}
|
|
52
|
+
function registerTelemetryConfig(config) {
|
|
53
|
+
configForTelemetry = config;
|
|
54
|
+
}
|
|
55
|
+
async function runExitCleanup() {
|
|
56
|
+
await drainStdin();
|
|
57
|
+
runSyncCleanup();
|
|
58
|
+
for (const fn of cleanupFunctions) {
|
|
59
|
+
try {
|
|
60
|
+
await fn();
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
cleanupFunctions.length = 0;
|
|
65
|
+
try {
|
|
66
|
+
await resetBrowserSession();
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
if (configForTelemetry) {
|
|
70
|
+
try {
|
|
71
|
+
await configForTelemetry.dispose();
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (configForTelemetry && isTelemetrySdkInitialized()) {
|
|
76
|
+
try {
|
|
77
|
+
await shutdownTelemetry(configForTelemetry);
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function drainStdin() {
|
|
83
|
+
if (!process.stdin?.isTTY) return;
|
|
84
|
+
process.stdin.resume().removeAllListeners("data").on("data", () => {
|
|
85
|
+
});
|
|
86
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
87
|
+
}
|
|
88
|
+
async function gracefulShutdown(_reason) {
|
|
89
|
+
if (isShuttingDown) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
isShuttingDown = true;
|
|
93
|
+
await runExitCleanup();
|
|
94
|
+
process.exit(ExitCodes.SUCCESS);
|
|
95
|
+
}
|
|
96
|
+
function setupSignalHandlers() {
|
|
97
|
+
process.on("SIGHUP", () => gracefulShutdown("SIGHUP"));
|
|
98
|
+
process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
|
|
99
|
+
process.on("SIGINT", () => gracefulShutdown("SIGINT"));
|
|
100
|
+
}
|
|
101
|
+
function setupTtyCheck() {
|
|
102
|
+
let intervalId = null;
|
|
103
|
+
let isCheckingTty = false;
|
|
104
|
+
intervalId = setInterval(async () => {
|
|
105
|
+
if (isCheckingTty || isShuttingDown) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (process.env["SANDBOX"]) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!process.stdin.isTTY && !process.stdout.isTTY) {
|
|
112
|
+
isCheckingTty = true;
|
|
113
|
+
if (intervalId) {
|
|
114
|
+
clearInterval(intervalId);
|
|
115
|
+
intervalId = null;
|
|
116
|
+
}
|
|
117
|
+
await gracefulShutdown("TTY loss");
|
|
118
|
+
}
|
|
119
|
+
}, 5e3);
|
|
120
|
+
intervalId.unref();
|
|
121
|
+
return () => {
|
|
122
|
+
if (intervalId) {
|
|
123
|
+
clearInterval(intervalId);
|
|
124
|
+
intervalId = null;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async function cleanupCheckpoints() {
|
|
129
|
+
const storage = new Storage(process.cwd());
|
|
130
|
+
await storage.initialize();
|
|
131
|
+
const tempDir = storage.getProjectTempDir();
|
|
132
|
+
const checkpointsDir = join(tempDir, "checkpoints");
|
|
133
|
+
try {
|
|
134
|
+
await fs.rm(checkpointsDir, { recursive: true, force: true });
|
|
135
|
+
} catch {
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
registerCleanup,
|
|
141
|
+
removeCleanup,
|
|
142
|
+
registerSyncCleanup,
|
|
143
|
+
removeSyncCleanup,
|
|
144
|
+
resetCleanupForTesting,
|
|
145
|
+
runSyncCleanup,
|
|
146
|
+
registerTelemetryConfig,
|
|
147
|
+
runExitCleanup,
|
|
148
|
+
setupSignalHandlers,
|
|
149
|
+
setupTtyCheck,
|
|
150
|
+
cleanupCheckpoints
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @license
|
|
154
|
+
* Copyright 2025 Google LLC
|
|
155
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
156
|
+
*/
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
exitCli,
|
|
4
|
+
require_source
|
|
5
|
+
} from "./chunk-KKO2XSBY.js";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_PORT,
|
|
8
|
+
SERVER_START_WAIT_MS,
|
|
9
|
+
getBinaryPath,
|
|
10
|
+
getLiteRtBinDir,
|
|
11
|
+
getLogFilePath,
|
|
12
|
+
getPidFilePath,
|
|
13
|
+
isBinaryInstalled,
|
|
14
|
+
isServerRunning,
|
|
15
|
+
resolveGemmaConfig,
|
|
16
|
+
writeServerProcessInfo
|
|
17
|
+
} from "./chunk-VUHGADMU.js";
|
|
18
|
+
import {
|
|
19
|
+
debugLogger
|
|
20
|
+
} from "./chunk-UHHRGNIO.js";
|
|
21
|
+
import {
|
|
22
|
+
__toESM
|
|
23
|
+
} from "./chunk-34MYV7JD.js";
|
|
24
|
+
|
|
25
|
+
// packages/cli/src/commands/gemma/start.ts
|
|
26
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
27
|
+
import fs from "node:fs";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { spawn } from "node:child_process";
|
|
30
|
+
async function startServer(binaryPath, port) {
|
|
31
|
+
const alreadyRunning = await isServerRunning(port);
|
|
32
|
+
if (alreadyRunning) {
|
|
33
|
+
debugLogger.log(`LiteRT server already running on port ${port}`);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
const logPath = getLogFilePath();
|
|
37
|
+
fs.mkdirSync(getLiteRtBinDir(), { recursive: true });
|
|
38
|
+
const tmpDir = path.dirname(getPidFilePath());
|
|
39
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
40
|
+
const logFd = fs.openSync(logPath, "a");
|
|
41
|
+
try {
|
|
42
|
+
const child = spawn(binaryPath, ["serve", `--port=${port}`, "--verbose"], {
|
|
43
|
+
detached: true,
|
|
44
|
+
stdio: ["ignore", logFd, logFd]
|
|
45
|
+
});
|
|
46
|
+
if (child.pid) {
|
|
47
|
+
writeServerProcessInfo({
|
|
48
|
+
pid: child.pid,
|
|
49
|
+
binaryPath,
|
|
50
|
+
port
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
child.unref();
|
|
54
|
+
} finally {
|
|
55
|
+
fs.closeSync(logFd);
|
|
56
|
+
}
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, SERVER_START_WAIT_MS));
|
|
58
|
+
return isServerRunning(port);
|
|
59
|
+
}
|
|
60
|
+
var startCommand = {
|
|
61
|
+
command: "start",
|
|
62
|
+
describe: "Start the LiteRT-LM server",
|
|
63
|
+
builder: (yargs) => yargs.option("port", {
|
|
64
|
+
type: "number",
|
|
65
|
+
description: "Port for the LiteRT server"
|
|
66
|
+
}),
|
|
67
|
+
handler: async (argv) => {
|
|
68
|
+
let port;
|
|
69
|
+
if (argv["port"] !== void 0) {
|
|
70
|
+
port = Number(argv["port"]);
|
|
71
|
+
}
|
|
72
|
+
if (!port) {
|
|
73
|
+
const { configuredPort } = resolveGemmaConfig(DEFAULT_PORT);
|
|
74
|
+
port = configuredPort;
|
|
75
|
+
}
|
|
76
|
+
const binaryPath = getBinaryPath();
|
|
77
|
+
if (!binaryPath || !isBinaryInstalled(binaryPath)) {
|
|
78
|
+
debugLogger.error(
|
|
79
|
+
import_chalk.default.red(
|
|
80
|
+
'LiteRT-LM binary not found. Run "gemini gemma setup" first.'
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
await exitCli(1);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const alreadyRunning = await isServerRunning(port);
|
|
87
|
+
if (alreadyRunning) {
|
|
88
|
+
debugLogger.log(
|
|
89
|
+
import_chalk.default.green(`LiteRT server is already running on port ${port}.`)
|
|
90
|
+
);
|
|
91
|
+
await exitCli(0);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
debugLogger.log(`Starting LiteRT server on port ${port}...`);
|
|
95
|
+
const started = await startServer(binaryPath, port);
|
|
96
|
+
if (started) {
|
|
97
|
+
debugLogger.log(import_chalk.default.green(`LiteRT server started on port ${port}.`));
|
|
98
|
+
debugLogger.log(import_chalk.default.dim(`Logs: ${getLogFilePath()}`));
|
|
99
|
+
await exitCli(0);
|
|
100
|
+
} else {
|
|
101
|
+
debugLogger.error(
|
|
102
|
+
import_chalk.default.red("Server may not have started correctly. Check logs:")
|
|
103
|
+
);
|
|
104
|
+
debugLogger.error(import_chalk.default.dim(` ${getLogFilePath()}`));
|
|
105
|
+
await exitCli(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
startServer,
|
|
112
|
+
startCommand
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* @license
|
|
116
|
+
* Copyright 2026 Google LLC
|
|
117
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
118
|
+
*/
|
|
@@ -25749,6 +25749,12 @@ var FatalToolExecutionError = class extends FatalError {
|
|
|
25749
25749
|
this.name = "FatalToolExecutionError";
|
|
25750
25750
|
}
|
|
25751
25751
|
};
|
|
25752
|
+
var FatalUntrustedWorkspaceError = class extends FatalError {
|
|
25753
|
+
constructor(message) {
|
|
25754
|
+
super(message, 55);
|
|
25755
|
+
this.name = "FatalUntrustedWorkspaceError";
|
|
25756
|
+
}
|
|
25757
|
+
};
|
|
25752
25758
|
var FatalCancellationError = class extends FatalError {
|
|
25753
25759
|
constructor(message) {
|
|
25754
25760
|
super(message, 130);
|
|
@@ -41703,6 +41709,7 @@ import * as fs4 from "node:fs";
|
|
|
41703
41709
|
import { fileURLToPath } from "node:url";
|
|
41704
41710
|
var GEMINI_DIR = ".gemini";
|
|
41705
41711
|
var GOOGLE_ACCOUNTS_FILENAME = "google_accounts.json";
|
|
41712
|
+
var TRUSTED_FOLDERS_FILENAME = "trustedFolders.json";
|
|
41706
41713
|
function homedir() {
|
|
41707
41714
|
const envHome = process.env["GEMINI_CLI_HOME"];
|
|
41708
41715
|
if (envHome) {
|
|
@@ -42320,6 +42327,7 @@ var StorageMigration = class {
|
|
|
42320
42327
|
|
|
42321
42328
|
// packages/core/src/config/storage.ts
|
|
42322
42329
|
var OAUTH_FILE = "oauth_creds.json";
|
|
42330
|
+
var TRUSTED_FOLDERS_FILENAME2 = "trustedFolders.json";
|
|
42323
42331
|
var TMP_DIR_NAME = "tmp";
|
|
42324
42332
|
var BIN_DIR_NAME = "bin";
|
|
42325
42333
|
var AGENTS_DIR_NAME = ".agents";
|
|
@@ -42372,6 +42380,12 @@ var Storage = class _Storage {
|
|
|
42372
42380
|
static getGoogleAccountsPath() {
|
|
42373
42381
|
return path6.join(_Storage.getGlobalGeminiDir(), GOOGLE_ACCOUNTS_FILENAME);
|
|
42374
42382
|
}
|
|
42383
|
+
static getTrustedFoldersPath() {
|
|
42384
|
+
if (process.env["GEMINI_CLI_TRUSTED_FOLDERS_PATH"]) {
|
|
42385
|
+
return process.env["GEMINI_CLI_TRUSTED_FOLDERS_PATH"];
|
|
42386
|
+
}
|
|
42387
|
+
return path6.join(_Storage.getGlobalGeminiDir(), TRUSTED_FOLDERS_FILENAME2);
|
|
42388
|
+
}
|
|
42375
42389
|
static getUserCommandsDir() {
|
|
42376
42390
|
return path6.join(_Storage.getGlobalGeminiDir(), "commands");
|
|
42377
42391
|
}
|
|
@@ -52572,6 +52586,7 @@ export {
|
|
|
52572
52586
|
READ_ONLY_KINDS,
|
|
52573
52587
|
GEMINI_DIR,
|
|
52574
52588
|
GOOGLE_ACCOUNTS_FILENAME,
|
|
52589
|
+
TRUSTED_FOLDERS_FILENAME,
|
|
52575
52590
|
homedir,
|
|
52576
52591
|
tmpdir,
|
|
52577
52592
|
tildeifyPath,
|
|
@@ -52600,6 +52615,7 @@ export {
|
|
|
52600
52615
|
FatalConfigError,
|
|
52601
52616
|
FatalTurnLimitedError,
|
|
52602
52617
|
FatalToolExecutionError,
|
|
52618
|
+
FatalUntrustedWorkspaceError,
|
|
52603
52619
|
FatalCancellationError,
|
|
52604
52620
|
CanceledError,
|
|
52605
52621
|
ForbiddenError,
|