gemini-cli-leo 0.1.25 → 0.1.27
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/gemini.mjs +69 -12
- package/package.json +1 -1
package/gemini.mjs
CHANGED
|
@@ -173286,8 +173286,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
173286
173286
|
var init_git_commit = __esm({
|
|
173287
173287
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
173288
173288
|
"use strict";
|
|
173289
|
-
GIT_COMMIT_INFO = "
|
|
173290
|
-
CLI_VERSION = "0.1.
|
|
173289
|
+
GIT_COMMIT_INFO = "3868b69";
|
|
173290
|
+
CLI_VERSION = "0.1.27";
|
|
173291
173291
|
}
|
|
173292
173292
|
});
|
|
173293
173293
|
|
|
@@ -316489,7 +316489,7 @@ function getVersion() {
|
|
|
316489
316489
|
}
|
|
316490
316490
|
versionPromise = (async () => {
|
|
316491
316491
|
const pkgJson = await getPackageJson(__dirname4);
|
|
316492
|
-
return "0.1.
|
|
316492
|
+
return "0.1.27";
|
|
316493
316493
|
})();
|
|
316494
316494
|
return versionPromise;
|
|
316495
316495
|
}
|
|
@@ -318858,6 +318858,19 @@ function isWorkspaceLocalPath(token2, options) {
|
|
|
318858
318858
|
return false;
|
|
318859
318859
|
}
|
|
318860
318860
|
}
|
|
318861
|
+
function isCliManagedPathToken(token2, options) {
|
|
318862
|
+
if (!options?.cwd || !options.isCliManagedPath || token2.startsWith("http://") || token2.startsWith("https://") || EXECUTABLE_SCRIPT_REGEX.test(token2) || /[$`~]/.test(token2)) {
|
|
318863
|
+
return false;
|
|
318864
|
+
}
|
|
318865
|
+
try {
|
|
318866
|
+
return options.isCliManagedPath(path43.resolve(options.cwd, token2));
|
|
318867
|
+
} catch {
|
|
318868
|
+
return false;
|
|
318869
|
+
}
|
|
318870
|
+
}
|
|
318871
|
+
function isFlaggingRelevantPath(token2, options) {
|
|
318872
|
+
return !isWorkspaceLocalPath(token2, options) && !isCliManagedPathToken(token2, options);
|
|
318873
|
+
}
|
|
318861
318874
|
function hasUntrustedSubstring(untrustedContext, value) {
|
|
318862
318875
|
const normalized2 = value.toLowerCase().replace(/\\/g, "/");
|
|
318863
318876
|
return untrustedContext.untrustedTexts.some((text) => text.toLowerCase().includes(normalized2));
|
|
@@ -318982,7 +318995,7 @@ function findUntrustedFlags(command2, untrustedContext, options) {
|
|
|
318982
318995
|
}
|
|
318983
318996
|
}
|
|
318984
318997
|
if (valToCheck && rawValToCheck) {
|
|
318985
|
-
const isRiskyValuePattern = isHighRiskPatternToken(rawValToCheck) && (isHighRiskFlag ||
|
|
318998
|
+
const isRiskyValuePattern = isHighRiskPatternToken(rawValToCheck) && (isHighRiskFlag || isFlaggingRelevantPath(rawValToCheck, options));
|
|
318986
318999
|
const isValUntrusted = untrustedContext.untrustedTokens.has(valToCheck) && (isHighRiskFlag || !isSafeFlag && isRiskyValuePattern);
|
|
318987
319000
|
const isHighRiskValSubstring = (!isSafeFlag || isHighRiskFlag) && isRiskyValuePattern && hasUntrustedSubstring(untrustedContext, valToCheck);
|
|
318988
319001
|
if (isValUntrusted || isHighRiskValSubstring) {
|
|
@@ -319001,7 +319014,7 @@ function findUntrustedFlags(command2, untrustedContext, options) {
|
|
|
319001
319014
|
if (token2.length <= 1 || BARE_SHELL_VARIABLE_REGEX.test(token2)) {
|
|
319002
319015
|
continue;
|
|
319003
319016
|
}
|
|
319004
|
-
if (isHighRiskPatternToken(token2) &&
|
|
319017
|
+
if (isHighRiskPatternToken(token2) && isFlaggingRelevantPath(token2, options)) {
|
|
319005
319018
|
if (untrustedContext.untrustedTokens.has(lowerToken)) {
|
|
319006
319019
|
detected.add(token2);
|
|
319007
319020
|
continue;
|
|
@@ -319082,6 +319095,19 @@ function resetModifiedBuildFiles(sessionKey) {
|
|
|
319082
319095
|
delete sessionKey[MODIFIED_BUILD_FILES_SYMBOL];
|
|
319083
319096
|
}
|
|
319084
319097
|
}
|
|
319098
|
+
function acknowledgeAllSecurityWarnings(sessionKey) {
|
|
319099
|
+
if (hasSessionRecord(sessionKey)) {
|
|
319100
|
+
sessionKey[SECURITY_WARNING_BYPASS_SYMBOL] = true;
|
|
319101
|
+
}
|
|
319102
|
+
}
|
|
319103
|
+
function isSecurityWarningBypassEnabled(sessionKey) {
|
|
319104
|
+
return hasSessionRecord(sessionKey) && sessionKey[SECURITY_WARNING_BYPASS_SYMBOL] === true;
|
|
319105
|
+
}
|
|
319106
|
+
function resetSecurityWarningBypass(sessionKey) {
|
|
319107
|
+
if (hasSessionRecord(sessionKey)) {
|
|
319108
|
+
delete sessionKey[SECURITY_WARNING_BYPASS_SYMBOL];
|
|
319109
|
+
}
|
|
319110
|
+
}
|
|
319085
319111
|
function getRootCommandScope(rootCommands) {
|
|
319086
319112
|
return [...new Set(rootCommands)].sort().join(",");
|
|
319087
319113
|
}
|
|
@@ -319110,7 +319136,7 @@ function resetAcknowledgedUntrustedFlags(sessionKey) {
|
|
|
319110
319136
|
delete sessionKey[ACKNOWLEDGED_UNTRUSTED_FLAGS_SYMBOL];
|
|
319111
319137
|
}
|
|
319112
319138
|
}
|
|
319113
|
-
var import_shell_quote5, UNTRUSTED_CONTEXT_REGEX, REMOTE_SHELL_OUTPUT_SOURCE, REMOTE_CONTENT_COMMAND_ROOTS, COMMAND_WRAPPER_ROOTS, SOURCE_ATTRIBUTE_REGEX, BUILD_TEST_COMMAND_ROOTS, BENIGN_SUBCOMMAND_TOKENS, SAFE_SHORT_FLAGS, SAFE_LONG_FLAGS, HIGH_RISK_VALUE_FLAGS, FILE_MODE_STRING_REGEX, BARE_DASHES_REGEX, BARE_SHELL_VARIABLE_REGEX, EXECUTABLE_SCRIPT_REGEX, MODIFIED_BUILD_FILES_SYMBOL, ACKNOWLEDGED_UNTRUSTED_FLAGS_SYMBOL;
|
|
319139
|
+
var import_shell_quote5, UNTRUSTED_CONTEXT_REGEX, REMOTE_SHELL_OUTPUT_SOURCE, REMOTE_CONTENT_COMMAND_ROOTS, COMMAND_WRAPPER_ROOTS, SOURCE_ATTRIBUTE_REGEX, BUILD_TEST_COMMAND_ROOTS, BENIGN_SUBCOMMAND_TOKENS, SAFE_SHORT_FLAGS, SAFE_LONG_FLAGS, HIGH_RISK_VALUE_FLAGS, FILE_MODE_STRING_REGEX, BARE_DASHES_REGEX, BARE_SHELL_VARIABLE_REGEX, EXECUTABLE_SCRIPT_REGEX, MODIFIED_BUILD_FILES_SYMBOL, ACKNOWLEDGED_UNTRUSTED_FLAGS_SYMBOL, SECURITY_WARNING_BYPASS_SYMBOL;
|
|
319114
319140
|
var init_untrustedContextTracker = __esm({
|
|
319115
319141
|
"packages/core/dist/src/utils/untrustedContextTracker.js"() {
|
|
319116
319142
|
"use strict";
|
|
@@ -319315,6 +319341,7 @@ var init_untrustedContextTracker = __esm({
|
|
|
319315
319341
|
EXECUTABLE_SCRIPT_REGEX = /\.(sh|bash|zsh|ps1|bat|cmd|exe)$/i;
|
|
319316
319342
|
MODIFIED_BUILD_FILES_SYMBOL = Symbol("sessionModifiedBuildFiles");
|
|
319317
319343
|
ACKNOWLEDGED_UNTRUSTED_FLAGS_SYMBOL = Symbol("sessionAcknowledgedUntrustedFlags");
|
|
319344
|
+
SECURITY_WARNING_BYPASS_SYMBOL = Symbol("sessionSecurityWarningBypass");
|
|
319318
319345
|
}
|
|
319319
319346
|
});
|
|
319320
319347
|
|
|
@@ -342902,6 +342929,25 @@ function trimLiveOutputBuffer(output) {
|
|
|
342902
342929
|
}
|
|
342903
342930
|
return output.slice(startIndex);
|
|
342904
342931
|
}
|
|
342932
|
+
function isGeminiManagedPath(absolutePath, config2) {
|
|
342933
|
+
const managedRoots = [
|
|
342934
|
+
Storage.getGlobalGeminiDir(),
|
|
342935
|
+
config2.storage.getProjectTempDir()
|
|
342936
|
+
];
|
|
342937
|
+
let resolvedPath;
|
|
342938
|
+
try {
|
|
342939
|
+
resolvedPath = resolveToRealPath(absolutePath);
|
|
342940
|
+
} catch {
|
|
342941
|
+
return false;
|
|
342942
|
+
}
|
|
342943
|
+
return managedRoots.some((root) => {
|
|
342944
|
+
try {
|
|
342945
|
+
return isSubpath(resolveToRealPath(root), resolvedPath);
|
|
342946
|
+
} catch {
|
|
342947
|
+
return false;
|
|
342948
|
+
}
|
|
342949
|
+
});
|
|
342950
|
+
}
|
|
342905
342951
|
var OUTPUT_UPDATE_INTERVAL_MS, LIVE_OUTPUT_MAX_BUFFER_CHARS, BACKGROUND_DELAY_MS, SHOW_NL_DESCRIPTION_THRESHOLD, LOW_SURROGATE_START, LOW_SURROGATE_END, ShellToolInvocation, ShellTool;
|
|
342906
342952
|
var init_shell = __esm({
|
|
342907
342953
|
"packages/core/dist/src/tools/shell.js"() {
|
|
@@ -342922,6 +342968,7 @@ var init_shell = __esm({
|
|
|
342922
342968
|
init_coreTools();
|
|
342923
342969
|
init_resolver();
|
|
342924
342970
|
init_paths();
|
|
342971
|
+
init_storage();
|
|
342925
342972
|
init_proactivePermissions();
|
|
342926
342973
|
init_textUtils();
|
|
342927
342974
|
OUTPUT_UPDATE_INTERVAL_MS = 1e3;
|
|
@@ -343085,7 +343132,8 @@ exit $__code`;
|
|
|
343085
343132
|
const workspaceContext = config2.getWorkspaceContext();
|
|
343086
343133
|
const untrustedFlags = findUntrustedFlags(command2, untrustedContext, {
|
|
343087
343134
|
cwd: this.params.dir_path ? path64.resolve(targetDir, this.params.dir_path) : targetDir,
|
|
343088
|
-
isPathWithinWorkspace: (absolutePath) => workspaceContext.isPathWithinWorkspace(absolutePath)
|
|
343135
|
+
isPathWithinWorkspace: (absolutePath) => workspaceContext.isPathWithinWorkspace(absolutePath),
|
|
343136
|
+
isCliManagedPath: (absolutePath) => isGeminiManagedPath(absolutePath, config2)
|
|
343089
343137
|
});
|
|
343090
343138
|
let roots = [];
|
|
343091
343139
|
try {
|
|
@@ -343096,6 +343144,9 @@ exit $__code`;
|
|
|
343096
343144
|
return getUnacknowledgedUntrustedFlags(untrustedFlags, roots, config2);
|
|
343097
343145
|
}
|
|
343098
343146
|
hasTaintedOrBuildFileRisk() {
|
|
343147
|
+
if (isSecurityWarningBypassEnabled(this.context.config)) {
|
|
343148
|
+
return false;
|
|
343149
|
+
}
|
|
343099
343150
|
const command2 = stripShellWrapper(this.params.command);
|
|
343100
343151
|
const untrustedFlags = this.getUntrustedFlags(command2);
|
|
343101
343152
|
const modifiedBuildFiles = getModifiedBuildFiles(this.context.config);
|
|
@@ -343252,6 +343303,9 @@ exit $__code`;
|
|
|
343252
343303
|
return;
|
|
343253
343304
|
}
|
|
343254
343305
|
acknowledgeUntrustedFlags(untrustedFlags, rootCommands, this.context.config);
|
|
343306
|
+
if (hasSecurityWarning && (outcome === ToolConfirmationOutcome.ProceedAlways || outcome === ToolConfirmationOutcome.ProceedAlwaysAndSave)) {
|
|
343307
|
+
acknowledgeAllSecurityWarnings(this.context.config);
|
|
343308
|
+
}
|
|
343255
343309
|
if (isBuildCmd && modifiedBuildFiles.length > 0) {
|
|
343256
343310
|
resetModifiedBuildFiles(this.context.config);
|
|
343257
343311
|
}
|
|
@@ -401391,6 +401445,7 @@ var init_config4 = __esm({
|
|
|
401391
401445
|
this.skillManager.reset();
|
|
401392
401446
|
resetModifiedBuildFiles(this);
|
|
401393
401447
|
resetAcknowledgedUntrustedFlags(this);
|
|
401448
|
+
resetSecurityWarningBypass(this);
|
|
401394
401449
|
this.latestApiRequest = void 0;
|
|
401395
401450
|
this.lastModeSwitchTime = performance.now();
|
|
401396
401451
|
this.compressionTruncationCounter = 0;
|
|
@@ -481352,7 +481407,7 @@ var GIT_COMMIT_INFO2;
|
|
|
481352
481407
|
var init_git_commit2 = __esm({
|
|
481353
481408
|
"packages/cli/src/generated/git-commit.ts"() {
|
|
481354
481409
|
"use strict";
|
|
481355
|
-
GIT_COMMIT_INFO2 = "
|
|
481410
|
+
GIT_COMMIT_INFO2 = "3868b69";
|
|
481356
481411
|
}
|
|
481357
481412
|
});
|
|
481358
481413
|
|
|
@@ -603504,13 +603559,13 @@ ${deceptiveUrlWarnings.map(
|
|
|
603504
603559
|
});
|
|
603505
603560
|
const hasUntrustedFlags = confirmationDetails.untrustedFlags && confirmationDetails.untrustedFlags.length > 0;
|
|
603506
603561
|
const hasModifiedBuildFiles = confirmationDetails.modifiedBuildFiles && confirmationDetails.modifiedBuildFiles.length > 0;
|
|
603507
|
-
if (isTrustedFolder && !
|
|
603562
|
+
if (isTrustedFolder && !hasModifiedBuildFiles) {
|
|
603508
603563
|
options2.push({
|
|
603509
603564
|
label: `Allow for this session`,
|
|
603510
603565
|
value: ToolConfirmationOutcome.ProceedAlways,
|
|
603511
603566
|
key: `Allow for this session`
|
|
603512
603567
|
});
|
|
603513
|
-
if (allowPermanentApproval) {
|
|
603568
|
+
if (allowPermanentApproval && !hasUntrustedFlags) {
|
|
603514
603569
|
options2.push({
|
|
603515
603570
|
label: `Allow this command for all future sessions`,
|
|
603516
603571
|
value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
@@ -603669,7 +603724,8 @@ Inspect every line of the change below carefully before approving.`;
|
|
|
603669
603724
|
The following flags/arguments were sourced from external untrusted input (e.g., Buganizer ticket, external document):
|
|
603670
603725
|
` + confirmationDetails.untrustedFlags.map((f5) => ` \u2022 ${f5}`).join("\n") + `
|
|
603671
603726
|
Executing commands with flags sourced from untrusted input can execute arbitrary code on your machine.
|
|
603672
|
-
Carefully verify these flags before approving
|
|
603727
|
+
Carefully verify these flags before approving.
|
|
603728
|
+
"Allow for this session" approves these flags and stops further security prompts until the session ends.`;
|
|
603673
603729
|
securityWarnings2 = securityWarnings2 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(import_jsx_runtime113.Fragment, { children: [
|
|
603674
603730
|
securityWarnings2,
|
|
603675
603731
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(WarningMessage, { text: flagsWarningText })
|
|
@@ -603685,7 +603741,8 @@ Carefully verify these flags before approving.`;
|
|
|
603685
603741
|
].join(", ");
|
|
603686
603742
|
const buildModWarningText = `\u26A0\uFE0F CAUTION: Build Configuration Was Recently Modified
|
|
603687
603743
|
Build file(s) (${modifiedBuildFileNames}) were modified earlier in this session. Running '${confirmationDetails.rootCommand}' will execute the updated build definitions.
|
|
603688
|
-
Ensure you trust all modifications made to build files before approving execution
|
|
603744
|
+
Ensure you trust all modifications made to build files before approving execution.
|
|
603745
|
+
"Allow for this session" stops further security prompts until the session ends.`;
|
|
603689
603746
|
securityWarnings2 = securityWarnings2 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(import_jsx_runtime113.Fragment, { children: [
|
|
603690
603747
|
securityWarnings2,
|
|
603691
603748
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(WarningMessage, { text: buildModWarningText })
|