Skip to content
Merged
7 changes: 0 additions & 7 deletions core/config/migrateSharedConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

const { disableInFiles, ...withoutDisableInFiles } = migratedAutocomplete;
if (disableInFiles !== undefined) {
if (currentSharedConfig.disableAutocompleteInFiles !== undefined) {

Check warning on line 80 in core/config/migrateSharedConfig.ts

View workflow job for this annotation

GitHub Actions / core-checks

Unexpected negated condition
// safe merge for security
shareConfigUpdates.disableAutocompleteInFiles = deduplicateArray(
[
Expand Down Expand Up @@ -173,13 +173,6 @@
effected = true;
}

const { autoAcceptEditToolDiffs, ...withoutAutoApply } = migratedUI;
if (autoAcceptEditToolDiffs !== undefined) {
shareConfigUpdates.autoAcceptEditToolDiffs = autoAcceptEditToolDiffs;
migratedUI = withoutAutoApply;
effected = true;
}

const { showChatScrollbar, ...withoutShowChatScrollbar } = migratedUI;
if (showChatScrollbar !== undefined) {
shareConfigUpdates.showChatScrollbar = showChatScrollbar;
Expand Down
5 changes: 0 additions & 5 deletions core/config/sharedConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const sharedConfigSchema = z
codeWrap: z.boolean(),
displayRawMarkdown: z.boolean(),
showChatScrollbar: z.boolean(),
autoAcceptEditToolDiffs: z.boolean(),
continueAfterToolRejection: z.boolean(),

// `tabAutocompleteOptions` in `ContinueConfig`
Expand Down Expand Up @@ -140,10 +139,6 @@ export function modifyAnyConfigWithSharedConfig<
if (sharedConfig.showChatScrollbar !== undefined) {
configCopy.ui.showChatScrollbar = sharedConfig.showChatScrollbar;
}
if (sharedConfig.autoAcceptEditToolDiffs !== undefined) {
configCopy.ui.autoAcceptEditToolDiffs =
sharedConfig.autoAcceptEditToolDiffs;
}

if (sharedConfig.allowAnonymousTelemetry !== undefined) {
configCopy.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry;
Expand Down
1 change: 0 additions & 1 deletion core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,6 @@ export interface ContinueUIConfig {
showChatScrollbar?: boolean;
codeWrap?: boolean;
showSessionTabs?: boolean;
autoAcceptEditToolDiffs?: boolean;
continueAfterToolRejection?: boolean;
}

Expand Down
5 changes: 4 additions & 1 deletion gui/src/pages/config/components/ToolPoliciesGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChevronDownIcon,
WrenchScrewdriverIcon,
} from "@heroicons/react/24/outline";
import { Tool } from "core";
import { useMemo, useState } from "react";
import ToggleSwitch from "../../../components/gui/Switch";
import { ToolTip } from "../../../components/gui/Tooltip";
Expand All @@ -28,7 +29,9 @@ export function ToolPoliciesGroup({
const dispatch = useAppDispatch();
const [isExpanded, setIsExpanded] = useState(false);

const availableTools = useAppSelector((state) => state.config.config.tools);
const availableTools = useAppSelector(
(state) => state.config.config.tools as Tool[],
);
const tools = useMemo(() => {
return availableTools.filter((t) => t.group === groupName);
}, [availableTools, groupName]);
Expand Down
39 changes: 6 additions & 33 deletions gui/src/pages/config/components/ToolPolicyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
import { useFontSize } from "../../../components/ui/font";
import { useAppSelector } from "../../../redux/hooks";
import { addTool, setToolPolicy } from "../../../redux/slices/uiSlice";
import { isEditTool } from "../../../util/toolCallState";

interface ToolPolicyItemProps {
tool: Tool;
Expand All @@ -29,22 +28,12 @@ interface ToolPolicyItemProps {

export function ToolPolicyItem(props: ToolPolicyItemProps) {
const dispatch = useDispatch();
const toolPolicy = useAppSelector(
const policy = useAppSelector(
(state) => state.ui.toolSettings[props.tool.function.name],
);
const [isExpanded, setIsExpanded] = useState(false);
const mode = useAppSelector((state) => state.session.mode);

const autoAcceptEditToolDiffs = useAppSelector(
(state) => state.config.config.ui?.autoAcceptEditToolDiffs,
);
const isAutoAcceptedToolCall =
isEditTool(props.tool.function.name) && autoAcceptEditToolDiffs;

const policy = isAutoAcceptedToolCall
? "allowedWithoutPermission"
: toolPolicy;

useEffect(() => {
if (!policy) {
dispatch(addTool(props.tool));
Expand All @@ -64,7 +53,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
const fontSize = useFontSize(-2);

const disabled =
isAutoAcceptedToolCall ||
!props.isGroupEnabled ||
(mode === "plan" &&
props.tool.group === BUILT_IN_GROUP_NAME &&
Expand Down Expand Up @@ -112,19 +100,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
</ToolTip>
) : null}
{isAutoAcceptedToolCall ? (
<ToolTip
place="bottom"
className="flex flex-wrap items-center"
content={
<p className="m-0 p-0">
Auto-Accept Agent Edits setting is on
</p>
}
>
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
</ToolTip>
) : null}
{props.tool.faviconUrl && (
<img
src={props.tool.faviconUrl}
Expand Down Expand Up @@ -164,13 +139,11 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
data-tooltip-id={disabled ? disabledTooltipId : undefined}
>
<span className="text-xs">
{isAutoAcceptedToolCall
? "Automatic"
: disabled || policy === "disabled"
? "Excluded"
: policy === "allowedWithoutPermission"
? "Automatic"
: "Ask First"}
{disabled || policy === "disabled"
? "Excluded"
: policy === "allowedWithoutPermission"
? "Automatic"
: "Ask First"}
</span>
<ChevronDownIcon className="h-3 w-3" />
</ListboxButton>
Expand Down
10 changes: 0 additions & 10 deletions gui/src/pages/config/sections/UserSettingsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function UserSettingsSection() {
const codeWrap = config.ui?.codeWrap ?? false;
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
const autoAcceptEditToolDiffs = config.ui?.autoAcceptEditToolDiffs ?? false;
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
const disableSessionTitles = config.disableSessionTitles ?? false;
const useCurrentFileAsContext =
Expand Down Expand Up @@ -163,15 +162,6 @@ export function UserSettingsSection() {
handleUpdate({ displayRawMarkdown: !value })
}
/>
<UserSetting
type="toggle"
title="Auto-Accept Agent Edits"
description="Diffs generated by the edit tool are automatically accepted and Agent proceeds with the next conversational turn."
value={autoAcceptEditToolDiffs}
onChange={(value) =>
handleUpdate({ autoAcceptEditToolDiffs: value })
}
/>
</div>
</Card>
</div>
Expand Down
12 changes: 0 additions & 12 deletions gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { BuiltInToolNames } from "core/tools/builtIn";
import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar";
import {
addAndSelectMockLlm,
triggerConfigUpdate,
} from "../../../util/test/config";
import { updateConfig } from "../../../redux/slices/configSlice";
import { renderWithProviders } from "../../../util/test/render";
import { Chat } from "../Chat";

import { waitFor } from "@testing-library/dom";
import { act } from "@testing-library/react";
import { ChatMessage } from "core";
import { setToolPolicy } from "../../../redux/slices/uiSlice";
import { setInactive } from "../../../redux/slices/sessionSlice";
import {
getElementByTestId,
Expand Down Expand Up @@ -133,12 +127,6 @@ test(
await user.click(toggleCodeblockChevron);
await getElementByText(EDIT_CHANGES);

// Pending tool call - find and click the accept button
const acceptToolCallButton = await getElementByTestId(
generateToolCallButtonTestId("accept", EDIT_TOOL_CALL_ID),
);
await user.click(acceptToolCallButton);

// Tool call, check that applyToFile was called for edit
await waitFor(() => {
expect(messengerRequestSpy).toHaveBeenCalledWith("applyToFile", {
Expand Down
Loading
Loading