feat: auto-approve pending tool calls when auto_edit/yolo is activated (#6665)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
This commit is contained in:
Arya Gummadi
2025-09-14 20:20:21 -07:00
committed by GitHub
parent 00ecfdeb06
commit 1145f25ee3
5 changed files with 649 additions and 24 deletions
@@ -12,12 +12,14 @@ import { MessageType } from '../types.js';
export interface UseAutoAcceptIndicatorArgs {
config: Config;
addItem: (item: HistoryItemWithoutId, timestamp: number) => void;
addItem?: (item: HistoryItemWithoutId, timestamp: number) => void;
onApprovalModeChange?: (mode: ApprovalMode) => void;
}
export function useAutoAcceptIndicator({
config,
addItem,
onApprovalModeChange,
}: UseAutoAcceptIndicatorArgs): ApprovalMode {
const currentConfigValue = config.getApprovalMode();
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] =
@@ -48,14 +50,19 @@ export function useAutoAcceptIndicator({
config.setApprovalMode(nextApprovalMode);
// Update local state immediately for responsiveness
setShowAutoAcceptIndicator(nextApprovalMode);
// Notify the central handler about the approval mode change
onApprovalModeChange?.(nextApprovalMode);
} catch (e) {
addItem(
{
type: MessageType.INFO,
text: (e as Error).message,
},
Date.now(),
);
if (addItem) {
addItem(
{
type: MessageType.INFO,
text: (e as Error).message,
},
Date.now(),
);
}
}
}
},