@@ -19,7 +19,6 @@ import {
1919import { useFontSize } from "../../../components/ui/font" ;
2020import { useAppSelector } from "../../../redux/hooks" ;
2121import { addTool , setToolPolicy } from "../../../redux/slices/uiSlice" ;
22- import { isEditTool } from "../../../util/toolCallState" ;
2322
2423interface ToolPolicyItemProps {
2524 tool : Tool ;
@@ -29,22 +28,12 @@ interface ToolPolicyItemProps {
2928
3029export function ToolPolicyItem ( props : ToolPolicyItemProps ) {
3130 const dispatch = useDispatch ( ) ;
32- const toolPolicy = useAppSelector (
31+ const policy = useAppSelector (
3332 ( state ) => state . ui . toolSettings [ props . tool . function . name ] ,
3433 ) ;
3534 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
3635 const mode = useAppSelector ( ( state ) => state . session . mode ) ;
3736
38- const autoAcceptEditToolDiffs = useAppSelector (
39- ( state ) => state . config . config . ui ?. autoAcceptEditToolDiffs ,
40- ) ;
41- const isAutoAcceptedToolCall =
42- isEditTool ( props . tool . function . name ) && autoAcceptEditToolDiffs ;
43-
44- const policy = isAutoAcceptedToolCall
45- ? "allowedWithoutPermission"
46- : toolPolicy ;
47-
4837 useEffect ( ( ) => {
4938 if ( ! policy ) {
5039 dispatch ( addTool ( props . tool ) ) ;
@@ -64,7 +53,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
6453 const fontSize = useFontSize ( - 2 ) ;
6554
6655 const disabled =
67- isAutoAcceptedToolCall ||
6856 ! props . isGroupEnabled ||
6957 ( mode === "plan" &&
7058 props . tool . group === BUILT_IN_GROUP_NAME &&
@@ -112,19 +100,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
112100 < InformationCircleIcon className = "h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
113101 </ ToolTip >
114102 ) : null }
115- { isAutoAcceptedToolCall ? (
116- < ToolTip
117- place = "bottom"
118- className = "flex flex-wrap items-center"
119- content = {
120- < p className = "m-0 p-0" >
121- Auto-Accept Agent Edits setting is on
122- </ p >
123- }
124- >
125- < InformationCircleIcon className = "h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
126- </ ToolTip >
127- ) : null }
128103 { props . tool . faviconUrl && (
129104 < img
130105 src = { props . tool . faviconUrl }
@@ -164,13 +139,11 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
164139 data-tooltip-id = { disabled ? disabledTooltipId : undefined }
165140 >
166141 < span className = "text-xs" >
167- { isAutoAcceptedToolCall
168- ? "Automatic"
169- : disabled || policy === "disabled"
170- ? "Excluded"
171- : policy === "allowedWithoutPermission"
172- ? "Automatic"
173- : "Ask First" }
142+ { disabled || policy === "disabled"
143+ ? "Excluded"
144+ : policy === "allowedWithoutPermission"
145+ ? "Automatic"
146+ : "Ask First" }
174147 </ span >
175148 < ChevronDownIcon className = "h-3 w-3" />
176149 </ ListboxButton >
0 commit comments