mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 21:14:35 -07:00
feat(policy): map --yolo to allowedTools wildcard policy
This PR maps the `--yolo` flag natively into a wildcard policy array (`allowedTools: ["*"]`) and removes the concept of `ApprovalMode.YOLO` as a distinct state in the application, fulfilling issue #11303. This removes the hardcoded `ApprovalMode.YOLO` state and its associated UI/bypasses. The `PolicyEngine` now evaluates YOLO purely via data-driven rules. - Removes `ApprovalMode.YOLO` - Removes UI toggle (`Ctrl+Y`) and indicators for YOLO - Removes `yolo.toml` - Updates A2A server and CLI config logic to translate YOLO into a wildcard tool - Rewrites policy engine tests to evaluate the wildcard - Enforces enterprise `disableYoloMode` and `secureModeEnabled` controls by actively preventing manual `--allowed-tools=*` bypasses. Fixes #11303
This commit is contained in:
@@ -15,8 +15,6 @@ import {
|
||||
UnauthorizedError,
|
||||
UserPromptEvent,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
logConversationFinishedEvent,
|
||||
ConversationFinishedEvent,
|
||||
ApprovalMode,
|
||||
parseAndFormatApiError,
|
||||
ToolConfirmationOutcome,
|
||||
@@ -604,27 +602,6 @@ export const useGeminiStream = (
|
||||
prevActiveShellPtyIdRef.current = activeShellPtyId;
|
||||
}, [activeShellPtyId, addItem, setIsResponding]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
config.getApprovalMode() === ApprovalMode.YOLO &&
|
||||
streamingState === StreamingState.Idle
|
||||
) {
|
||||
const lastUserMessageIndex = history.findLastIndex(
|
||||
(item: HistoryItem) => item.type === MessageType.USER,
|
||||
);
|
||||
|
||||
const turnCount =
|
||||
lastUserMessageIndex === -1 ? 0 : history.length - lastUserMessageIndex;
|
||||
|
||||
if (turnCount > 0) {
|
||||
logConversationFinishedEvent(
|
||||
config,
|
||||
new ConversationFinishedEvent(config.getApprovalMode(), turnCount),
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [streamingState, config, history]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isResponding) {
|
||||
setRetryStatus(null);
|
||||
@@ -1652,10 +1629,7 @@ export const useGeminiStream = (
|
||||
previousApprovalModeRef.current = newApprovalMode;
|
||||
|
||||
// Auto-approve pending tool calls when switching to auto-approval modes
|
||||
if (
|
||||
newApprovalMode === ApprovalMode.YOLO ||
|
||||
newApprovalMode === ApprovalMode.AUTO_EDIT
|
||||
) {
|
||||
if (newApprovalMode === ApprovalMode.AUTO_EDIT) {
|
||||
let awaitingApprovalCalls = toolCalls.filter(
|
||||
(call): call is TrackedWaitingToolCall =>
|
||||
call.status === 'awaiting_approval',
|
||||
|
||||
Reference in New Issue
Block a user