From 8a7baaaa489596e6e8b74149883d76becfcd1f9a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 20:45:23 -0700 Subject: [PATCH 1/8] plan mode --- gui/src/components/ModeSelect/ModeIcon.tsx | 10 +- gui/src/components/ModeSelect/ModeSelect.tsx | 89 +++++++++++++++-- gui/src/components/gui/Switch.tsx | 8 +- .../tool-policies/ToolPoliciesSection.tsx | 96 +++++++++++++------ .../sections/tool-policies/ToolPolicyItem.tsx | 15 ++- gui/src/redux/slices/sessionSlice.ts | 6 ++ gui/src/redux/store.ts | 1 + gui/src/redux/thunks/streamNormalInput.ts | 10 +- 8 files changed, 187 insertions(+), 48 deletions(-) diff --git a/gui/src/components/ModeSelect/ModeIcon.tsx b/gui/src/components/ModeSelect/ModeIcon.tsx index 83201d5ae..1a34eb988 100644 --- a/gui/src/components/ModeSelect/ModeIcon.tsx +++ b/gui/src/components/ModeSelect/ModeIcon.tsx @@ -1,8 +1,12 @@ -import { ChatBubbleLeftIcon, SparklesIcon } from "@heroicons/react/24/outline"; +import { + ChatBubbleLeftIcon, + SparklesIcon, + SwatchIcon, +} from "@heroicons/react/24/outline"; import { MessageModes } from "core"; interface ModeIconProps { - mode: MessageModes; + mode: MessageModes | "plan"; className?: string; } @@ -13,6 +17,8 @@ export function ModeIcon({ switch (mode) { case "agent": return ; + case "plan": + return ; case "chat": return ; } diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index 9e1b5afef..df29976a9 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -1,11 +1,16 @@ -import { CheckIcon, ChevronDownIcon } from "@heroicons/react/24/outline"; +import { + CheckIcon, + ChevronDownIcon, + InformationCircleIcon, +} from "@heroicons/react/24/outline"; import { MessageModes } from "core"; import { modelSupportsTools } from "core/llm/autodetect"; import { useCallback, useEffect, useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; -import { setMode } from "../../redux/slices/sessionSlice"; +import { setMode, setReadOnly } from "../../redux/slices/sessionSlice"; import { getFontSize, getMetaKeyLabel } from "../../util"; +import { ToolTip } from "../gui/Tooltip"; import { useMainEditor } from "../mainInput/TipTapEditor"; import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui"; import { ModeIcon } from "./ModeIcon"; @@ -32,13 +37,25 @@ export function ModeSelect() { } }, [mode, agentModeSupported, dispatch, selectedModel]); + const readOnlyMode = useAppSelector((store) => store.session.readOnlyMode); + const pseudoMode = useMemo(() => { + return mode === "chat" ? "chat" : readOnlyMode ? "plan" : "agent"; + }, [mode, readOnlyMode]); const cycleMode = useCallback(() => { - dispatch(setMode(mode === "chat" ? "agent" : "chat")); + if (pseudoMode === "chat") { + dispatch(setMode("agent")); + dispatch(setReadOnly(true)); + } else if (pseudoMode === "plan") { + dispatch(setReadOnly(false)); + } else { + dispatch(setReadOnly(true)); + dispatch(setMode("chat")); + } // Only focus main editor if another one doesn't already have focus if (!document.activeElement?.classList?.contains("ProseMirror")) { mainEditor?.commands.focus(); } - }, [mode, mainEditor]); + }, [pseudoMode, mainEditor]); const selectMode = useCallback( (newMode: MessageModes) => { @@ -72,9 +89,13 @@ export function ModeSelect() { data-testid="mode-select-button" className="xs:px-2 text-description bg-lightgray/20 gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110" > - + - {mode.charAt(0).toUpperCase() + mode.slice(1)} + {pseudoMode === "chat" + ? "Chat" + : pseudoMode === "agent" + ? "Agent" + : "Plan"} - {mode === "chat" && } + {pseudoMode === "chat" && } - { + dispatch(setReadOnly(true)); + }} + > +
+ + Agent (Plan) + + + In Plan mode, the Agent can only use read-only tools + +
+ {agentModeSupported ? ( + + ) : ( + (Not supported) + )} +
+ { + dispatch(setReadOnly(false)); + }} >
- Agent + Agent (Act) + + + In Act mode, the Agent can use create/edit tools +
{agentModeSupported ? ( - mode === "agent" && + ) : ( (Not supported) )} diff --git a/gui/src/components/gui/Switch.tsx b/gui/src/components/gui/Switch.tsx index 7004ae9d8..2422c6cd5 100644 --- a/gui/src/components/gui/Switch.tsx +++ b/gui/src/components/gui/Switch.tsx @@ -7,6 +7,7 @@ type ToggleSwitchProps = { text: string; size?: number; showIfToggled?: ReactNode; + disabled?: boolean; }; const ToggleSwitch: React.FC = ({ @@ -15,15 +16,18 @@ const ToggleSwitch: React.FC = ({ text, size = 16, showIfToggled, + disabled = false, }) => { return ( -
+
{text}
{isToggled && !!showIfToggled && showIfToggled}
void; + isSelected: boolean; +} +const ModeBadge = ({ text, onClick, isSelected, icon }: ModeBadgeProps) => { + return ( +
+ {icon} + {text} +
+ ); +}; + export const ToolPoliciesSection = () => { + const mode = useAppSelector((state) => state.session.mode); + const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); const availableTools = useAppSelector((state) => state.config.config.tools); const toolGroupSettings = useAppSelector( (store) => store.ui.toolGroupSettings, @@ -39,38 +60,57 @@ export const ToolPoliciesSection = () => { ); }, [availableTools]); + const allToolsOff = mode === "chat"; + + const pseudoMode = mode === "chat" ? "chat" : readOnlyMode ? "plan" : "act"; + const message = + pseudoMode === "chat" + ? "All tools are disabled in Chat mode" + : pseudoMode === "plan" + ? "Plan mode: only MCP and read-only tools" + : "Act mode: all tool policies apply"; + return ( <> - {toolsByGroup.map(([groupName, tools]) => ( -
-
-

- {groupName} -

- dispatch(toggleToolGroupSetting(groupName))} - text="" - size={10} - /> -
-
- {tools.map((tool) => ( - + + {message} +
+ {toolsByGroup.map(([groupName, tools]) => { + const isGroupEnabled = + !allToolsOff && toolGroupSettings[groupName] !== "exclude"; + return ( +
+
+

+ {groupName} +

+ dispatch(toggleToolGroupSetting(groupName))} + text="" + size={10} + disabled={allToolsOff} /> - ))} +
+
+ {tools.map((tool) => ( + + ))} +
-
- ))} + ); + })} ); }; diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index b92816839..38f9416fe 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -3,6 +3,7 @@ import { InformationCircleIcon, } from "@heroicons/react/24/outline"; import { Tool } from "core"; +import { BUILT_IN_GROUP_NAME } from "core/tools/builtIn"; import { useEffect, useMemo, useState } from "react"; import { useDispatch } from "react-redux"; import { useAppSelector } from "../../../../../redux/hooks"; @@ -16,7 +17,7 @@ import { useFontSize } from "../../../../ui/font"; interface ToolDropdownItemProps { tool: Tool; duplicatesDetected: boolean; - excluded: boolean; + isGroupEnabled: boolean; } function ToolPolicyItem(props: ToolDropdownItemProps) { @@ -25,6 +26,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { (state) => state.ui.toolSettings[props.tool.function.name], ); const [isExpanded, setIsExpanded] = useState(false); + const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); useEffect(() => { if (!policy) { @@ -44,6 +46,12 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { const fontSize = useFontSize(-2); + const disabled = + !props.isGroupEnabled || + (readOnlyMode && + props.tool.group === BUILT_IN_GROUP_NAME && + !props.tool.readonly); + if (!policy) { return null; } @@ -106,8 +114,9 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
+
{ dispatch(toggleToolSetting(props.tool.function.name)); @@ -115,7 +124,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { e.preventDefault(); }} > - {props.excluded || policy === "disabled" ? ( + {disabled || policy === "disabled" ? ( <> Off diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 6cd96dd8e..c48a9840d 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -54,6 +54,7 @@ type SessionState = { mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; + readOnlyMode: boolean; isInEdit: boolean; codeBlockApplyStates: { states: ApplyState[]; @@ -73,6 +74,7 @@ const initialState: SessionState = { streamAborter: new AbortController(), symbols: {}, mode: "chat", + readOnlyMode: false, isInEdit: false, codeBlockApplyStates: { states: [], @@ -668,6 +670,9 @@ export const sessionSlice = createSlice({ setMode: (state, action: PayloadAction) => { state.mode = action.payload; }, + setReadOnly: (state, action: PayloadAction) => { + state.readOnlyMode = action.payload; + }, setIsInEdit: (state, action: PayloadAction) => { state.isInEdit = action.payload; }, @@ -768,6 +773,7 @@ export const { setToolGenerated, updateToolCallOutput, setMode, + setReadOnly, setIsSessionMetadataLoading, setAllSessionMetadata, addSessionMetadata, diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 10ecdd2e5..40bd76160 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -42,6 +42,7 @@ const saveSubsetFilters = [ // Persist edit mode in case closes in middle "mode", + "readOnlyMode", // higher risk to persist // codeBlockApplyStates diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index c7c4de02d..2d25f9e29 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -40,12 +40,16 @@ export const streamNormalInput = createAsyncThunk< // Get tools const activeTools = selectActiveTools(state); const toolsSupported = modelSupportsTools(selectedChatModel); + const readOnlyMode = state.session.readOnlyMode; + const filteredTools = readOnlyMode + ? activeTools.filter((t) => t.readonly) + : activeTools; // Construct completion options let completionOptions: LLMFullCompletionOptions = {}; - if (toolsSupported && activeTools.length > 0) { + if (toolsSupported && filteredTools.length > 0) { completionOptions = { - tools: activeTools, + tools: filteredTools, }; } @@ -125,7 +129,7 @@ export const streamNormalInput = createAsyncThunk< modelTitle: selectedChatModel.title, sessionId: state.session.id, ...(state.session.mode === "agent" && { - tools: activeTools.map((tool) => tool.function.name), + tools: filteredTools.map((tool) => tool.function.name), }), }, }); From d1651b4a2dde8a5680a90bb186bcfe2df97d39ab Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 3 Jul 2025 20:47:01 -0700 Subject: [PATCH 2/8] add plan to toggle test --- gui/src/pages/gui/chat-tests/Chat.test.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index d3e6aa18b..d1bae6d07 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -27,7 +27,19 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Agent mode + // Check that it switched to Plan mode + await getElementByText("Plan"); + + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + + // Check that it switched to Plan mode await getElementByText("Agent"); act(() => { From be561ff54c1ed59a28fd98c8a9f8a7af62a39477 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:35:39 -0700 Subject: [PATCH 3/8] add plan as actual mode in redux, add basePlanSystemMessage --- core/config/load.ts | 1 + core/config/yaml/models.ts | 1 + core/index.d.ts | 10 ++- core/llm/defaultSystemMessages.ts | 2 + core/llm/index.ts | 2 + core/llm/llms/index.ts | 8 +- gui/src/components/ModeSelect/ModeIcon.tsx | 2 +- gui/src/components/ModeSelect/ModeSelect.tsx | 52 +++++-------- .../mainInput/Lump/sections/RulesSection.tsx | 36 ++++++--- .../tool-policies/ToolPoliciesSection.tsx | 6 +- .../mainInput/belowMainInput/RulesPeek.tsx | 6 +- gui/src/redux/selectors/selectActiveTools.ts | 13 +++- gui/src/redux/slices/sessionSlice.ts | 6 -- gui/src/redux/store.ts | 1 - gui/src/redux/thunks/edit.ts | 73 +++++++++---------- gui/src/redux/thunks/streamNormalInput.ts | 36 ++++----- gui/src/redux/thunks/streamThunkWrapper.tsx | 2 +- gui/src/redux/util/constructMessages.test.ts | 14 +++- gui/src/redux/util/constructMessages.ts | 3 + packages/config-yaml/src/schemas/models.ts | 1 + 20 files changed, 146 insertions(+), 129 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 3504cd8d5..4f5226bf0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -643,6 +643,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription { template: llm.template, completionOptions: llm.completionOptions, baseAgentSystemMessage: llm.baseAgentSystemMessage, + basePlanSystemMessage: llm.basePlanSystemMessage, baseChatSystemMessage: llm.baseChatSystemMessage, requestOptions: llm.requestOptions, promptTemplates: serializePromptTemplates(llm.promptTemplates), diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index edb47f59e..f1a3df43b 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -63,6 +63,7 @@ async function modelConfigToBaseLLM({ template: model.promptTemplates?.chat, promptTemplates: model.promptTemplates, baseAgentSystemMessage: model.chatOptions?.baseAgentSystemMessage, + basePlanSystemMessage: model.chatOptions?.basePlanSystemMessage, baseChatSystemMessage: model.chatOptions?.baseSystemMessage, capabilities: { tools: model.capabilities?.includes("tool_use"), diff --git a/core/index.d.ts b/core/index.d.ts index fdee1f262..7eae1a493 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -427,7 +427,7 @@ export interface PromptLog { completion: string; } -export type MessageModes = "chat" | "agent"; +export type MessageModes = "chat" | "agent" | "plan"; export type ToolStatus = | "generating" @@ -567,6 +567,7 @@ export interface LLMOptions { title?: string; uniqueId?: string; baseAgentSystemMessage?: string; + basePlanSystemMessage?: string; baseChatSystemMessage?: string; autocompleteOptions?: Partial; contextLength?: number; @@ -1090,6 +1091,7 @@ export interface ModelDescription { template?: TemplateType; completionOptions?: BaseCompletionOptions; baseAgentSystemMessage?: string; + basePlanSystemMessage?: string; baseChatSystemMessage?: string; requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; @@ -1629,9 +1631,11 @@ export interface TerminalOptions { export type RuleSource = | "default-chat" + | "default-plan" | "default-agent" - | "model-chat-options" - | "model-agent-options" + | "model-options-chat" + | "model-options-plan" + | "model-options-agent" | "rules-block" | "json-systemMessage" | ".continuerules"; diff --git a/core/llm/defaultSystemMessages.ts b/core/llm/defaultSystemMessages.ts index c2f82bac4..e51ea0013 100644 --- a/core/llm/defaultSystemMessages.ts +++ b/core/llm/defaultSystemMessages.ts @@ -66,3 +66,5 @@ export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\ ${CODEBLOCK_FORMATTING_INSTRUCTIONS} `; + +export const DEFAULT_PLAN_SYSTEM_MESSAGE = DEFAULT_AGENT_SYSTEM_MESSAGE; diff --git a/core/llm/index.ts b/core/llm/index.ts index bfb5c1085..47d6c57cf 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -141,6 +141,7 @@ export abstract class BaseLLM implements ILLM { title?: string; baseChatSystemMessage?: string; + basePlanSystemMessage?: string; baseAgentSystemMessage?: string; contextLength: number; maxStopWords?: number | undefined; @@ -209,6 +210,7 @@ export abstract class BaseLLM implements ILLM { this.title = options.title; this.uniqueId = options.uniqueId ?? "None"; this.baseAgentSystemMessage = options.baseAgentSystemMessage; + this.basePlanSystemMessage = options.basePlanSystemMessage; this.baseChatSystemMessage = options.baseChatSystemMessage; this.contextLength = options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index e45828c40..0522bbda6 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -8,7 +8,6 @@ import { LLMOptions, } from "../.."; import { renderTemplatedString } from "../../util/handlebars/renderTemplatedString"; -import { DEFAULT_CHAT_SYSTEM_MESSAGE } from "../defaultSystemMessages"; import { BaseLLM } from "../index"; import Anthropic from "./Anthropic"; import Asksage from "./Asksage"; @@ -141,9 +140,9 @@ export async function llmFromDescription( let baseChatSystemMessage: string | undefined = undefined; if (desc.systemMessage !== undefined) { - baseChatSystemMessage = DEFAULT_CHAT_SYSTEM_MESSAGE; - baseChatSystemMessage += "\n\n"; - baseChatSystemMessage += await renderTemplatedString( + // baseChatSystemMessage = DEFAULT_CHAT_SYSTEM_MESSAGE; + // baseChatSystemMessage += "\n\n"; + baseChatSystemMessage = await renderTemplatedString( Handlebars, desc.systemMessage, {}, @@ -163,6 +162,7 @@ export async function llmFromDescription( cls.defaultOptions?.completionOptions?.maxTokens, }, baseChatSystemMessage, + basePlanSystemMessage: baseChatSystemMessage, baseAgentSystemMessage: baseChatSystemMessage, logger: llmLogger, uniqueId, diff --git a/gui/src/components/ModeSelect/ModeIcon.tsx b/gui/src/components/ModeSelect/ModeIcon.tsx index 1a34eb988..92dfc1723 100644 --- a/gui/src/components/ModeSelect/ModeIcon.tsx +++ b/gui/src/components/ModeSelect/ModeIcon.tsx @@ -6,7 +6,7 @@ import { import { MessageModes } from "core"; interface ModeIconProps { - mode: MessageModes | "plan"; + mode: MessageModes; className?: string; } diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index df29976a9..224799184 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -8,7 +8,7 @@ import { modelSupportsTools } from "core/llm/autodetect"; import { useCallback, useEffect, useMemo } from "react"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; -import { setMode, setReadOnly } from "../../redux/slices/sessionSlice"; +import { setMode } from "../../redux/slices/sessionSlice"; import { getFontSize, getMetaKeyLabel } from "../../util"; import { ToolTip } from "../gui/Tooltip"; import { useMainEditor } from "../mainInput/TipTapEditor"; @@ -32,30 +32,24 @@ export function ModeSelect() { if (!selectedModel) { return; } - if (mode === "agent" && !agentModeSupported) { + if (mode !== "chat" && !agentModeSupported) { dispatch(setMode("chat")); } }, [mode, agentModeSupported, dispatch, selectedModel]); - const readOnlyMode = useAppSelector((store) => store.session.readOnlyMode); - const pseudoMode = useMemo(() => { - return mode === "chat" ? "chat" : readOnlyMode ? "plan" : "agent"; - }, [mode, readOnlyMode]); const cycleMode = useCallback(() => { - if (pseudoMode === "chat") { + if (mode === "chat") { + dispatch(setMode("plan")); + } else if (mode === "plan") { dispatch(setMode("agent")); - dispatch(setReadOnly(true)); - } else if (pseudoMode === "plan") { - dispatch(setReadOnly(false)); } else { - dispatch(setReadOnly(true)); dispatch(setMode("chat")); } // Only focus main editor if another one doesn't already have focus if (!document.activeElement?.classList?.contains("ProseMirror")) { mainEditor?.commands.focus(); } - }, [pseudoMode, mainEditor]); + }, [mode, mainEditor]); const selectMode = useCallback( (newMode: MessageModes) => { @@ -89,13 +83,9 @@ export function ModeSelect() { data-testid="mode-select-button" className="xs:px-2 text-description bg-lightgray/20 gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110" > - + - {pseudoMode === "chat" - ? "Chat" - : pseudoMode === "agent" - ? "Agent" - : "Plan"} + {mode === "chat" ? "Chat" : mode === "agent" ? "Agent" : "Plan"}
- {pseudoMode === "chat" && } + {mode === "chat" && } { - dispatch(setReadOnly(true)); - }} >
- Agent (Plan) + Plan - In Plan mode, the Agent can only use read-only tools + In Plan mode, only use read-only and MCP tools are enabled
{agentModeSupported ? ( ) : ( (Not supported) @@ -151,29 +138,26 @@ export function ModeSelect() { value="agent" disabled={!agentModeSupported} className={"gap-1"} - onClick={() => { - dispatch(setReadOnly(false)); - }} >
- Agent (Act) + Agent - In Act mode, the Agent can use create/edit tools + All tools are enabled based on policies
{agentModeSupported ? ( ) : ( (Not supported) diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 761973428..8a6754457 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -54,6 +54,8 @@ const RuleCard: React.FC = ({ rule }) => { }); } else if (rule.source === "default-chat" && mode === "chat") { ideMessenger.post("openUrl", DEFAULT_CHAT_SYSTEM_MESSAGE_URL); + } else if (rule.source === "default-plan" && mode === "plan") { + ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); } else if (rule.source === "default-agent" && mode === "agent") { ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); } else { @@ -81,9 +83,11 @@ const RuleCard: React.FC = ({ rule }) => { return "Default agent system message"; } else if (rule.source === "json-systemMessage") { return "JSON systemMessage)"; - } else if (rule.source === "model-agent-options") { + } else if (rule.source === "model-options-agent") { return "Base System Agent Message"; - } else if (rule.source === "model-chat-options") { + } else if (rule.source === "model-options-plan") { + return "Base System Plan Message"; + } else if (rule.source === "model-options-chat") { return "Base System Chat Message"; } else { return "Assistant rule"; @@ -215,11 +219,24 @@ export function RulesSection() { } } - if (mode === "agent") { + if (mode === "chat") { + if (config.selectedModelByRole.chat?.baseChatSystemMessage) { + rules.unshift({ + rule: config.selectedModelByRole.chat?.baseChatSystemMessage, + source: "model-options-chat", + }); + } else { + rules.unshift({ + rule: DEFAULT_CHAT_SYSTEM_MESSAGE, + source: "default-chat", + }); + } + } else if (mode === "agent") { + // agent if (config.selectedModelByRole.chat?.baseAgentSystemMessage) { rules.unshift({ rule: config.selectedModelByRole.chat?.baseAgentSystemMessage, - source: "model-agent-options", + source: "model-options-agent", }); } else { rules.unshift({ @@ -228,15 +245,16 @@ export function RulesSection() { }); } } else { - if (config.selectedModelByRole.chat?.baseChatSystemMessage) { + // plan + if (config.selectedModelByRole.chat?.basePlanSystemMessage) { rules.unshift({ - rule: config.selectedModelByRole.chat?.baseChatSystemMessage, - source: "model-chat-options", + rule: config.selectedModelByRole.chat?.basePlanSystemMessage, + source: "model-options-plan", }); } else { rules.unshift({ - rule: DEFAULT_CHAT_SYSTEM_MESSAGE, - source: "default-chat", + rule: DEFAULT_AGENT_SYSTEM_MESSAGE, + source: "default-agent", }); } } diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx index eec72c7fe..718051103 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx @@ -27,7 +27,6 @@ const ModeBadge = ({ text, onClick, isSelected, icon }: ModeBadgeProps) => { export const ToolPoliciesSection = () => { const mode = useAppSelector((state) => state.session.mode); - const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); const availableTools = useAppSelector((state) => state.config.config.tools); const toolGroupSettings = useAppSelector( (store) => store.ui.toolGroupSettings, @@ -62,11 +61,10 @@ export const ToolPoliciesSection = () => { const allToolsOff = mode === "chat"; - const pseudoMode = mode === "chat" ? "chat" : readOnlyMode ? "plan" : "act"; const message = - pseudoMode === "chat" + mode === "chat" ? "All tools are disabled in Chat mode" - : pseudoMode === "plan" + : mode === "plan" ? "Plan mode: only MCP and read-only tools" : "Act mode: all tool policies apply"; diff --git a/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx b/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx index 12bd90811..4bc45e3a3 100644 --- a/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx +++ b/gui/src/components/mainInput/belowMainInput/RulesPeek.tsx @@ -19,9 +19,11 @@ const getSourceLabel = (source: RuleSource): string => { return "Default Chat"; case "default-agent": return "Default Agent"; - case "model-chat-options": + case "model-options-chat": return "Model Chat Options"; - case "model-agent-options": + case "model-options-plan": + return "Model Plan Options"; + case "model-options-agent": return "Model Agent Options"; case "rules-block": return "Rules Block"; diff --git a/gui/src/redux/selectors/selectActiveTools.ts b/gui/src/redux/selectors/selectActiveTools.ts index 7aae43765..2e90bbfd5 100644 --- a/gui/src/redux/selectors/selectActiveTools.ts +++ b/gui/src/redux/selectors/selectActiveTools.ts @@ -1,5 +1,6 @@ import { createSelector } from "@reduxjs/toolkit"; import { Tool } from "core"; +import { BUILT_IN_GROUP_NAME } from "core/tools/builtIn"; import { RootState } from "../store"; export const selectActiveTools = createSelector( @@ -12,14 +13,18 @@ export const selectActiveTools = createSelector( (mode, tools, policies, groupPolicies): Tool[] => { if (mode === "chat") { return []; - } else if (mode === "agent") { - return tools.filter( + } else { + const enabledTools = tools.filter( (tool) => policies[tool.function.name] !== "disabled" && groupPolicies[tool.group] !== "exclude", ); - } else { - return []; + if (mode === "plan") { + return enabledTools.filter( + (t) => t.group !== BUILT_IN_GROUP_NAME || t.readonly, + ); + } + return enabledTools; } }, ); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index c48a9840d..6cd96dd8e 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -54,7 +54,6 @@ type SessionState = { mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; - readOnlyMode: boolean; isInEdit: boolean; codeBlockApplyStates: { states: ApplyState[]; @@ -74,7 +73,6 @@ const initialState: SessionState = { streamAborter: new AbortController(), symbols: {}, mode: "chat", - readOnlyMode: false, isInEdit: false, codeBlockApplyStates: { states: [], @@ -670,9 +668,6 @@ export const sessionSlice = createSlice({ setMode: (state, action: PayloadAction) => { state.mode = action.payload; }, - setReadOnly: (state, action: PayloadAction) => { - state.readOnlyMode = action.payload; - }, setIsInEdit: (state, action: PayloadAction) => { state.isInEdit = action.payload; }, @@ -773,7 +768,6 @@ export const { setToolGenerated, updateToolCallOutput, setMode, - setReadOnly, setIsSessionMetadataLoading, setAllSessionMetadata, addSessionMetadata, diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 40bd76160..10ecdd2e5 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -42,7 +42,6 @@ const saveSubsetFilters = [ // Persist edit mode in case closes in middle "mode", - "readOnlyMode", // higher risk to persist // codeBlockApplyStates diff --git a/gui/src/redux/thunks/edit.ts b/gui/src/redux/thunks/edit.ts index 73b65740e..4fc8bac7a 100644 --- a/gui/src/redux/thunks/edit.ts +++ b/gui/src/redux/thunks/edit.ts @@ -73,52 +73,49 @@ export const streamEditThunk = createAsyncThunk< export const exitEdit = createAsyncThunk< void, - { goToMode?: MessageModes; openNewSession?: boolean }, + { openNewSession?: boolean }, ThunkApiType ->( - "edit/exit", - async ({ goToMode, openNewSession }, { dispatch, extra, getState }) => { - const state = getState(); - const codeToEdit = state.editModeState.codeToEdit; - const isInEdit = state.session.isInEdit; - const previousModeEditorContent = - state.editModeState.previousModeEditorContent; +>("edit/exit", async ({ openNewSession }, { dispatch, extra, getState }) => { + const state = getState(); + const codeToEdit = state.editModeState.codeToEdit; + const isInEdit = state.session.isInEdit; + const previousModeEditorContent = + state.editModeState.previousModeEditorContent; - if (!isInEdit) { - return; - } + if (!isInEdit) { + return; + } - if (codeToEdit[0] && state.editModeState.applyState.numDiffs) { - extra.ideMessenger.post("rejectDiff", { - filepath: codeToEdit[0].filepath, - }); - } + if (codeToEdit[0] && state.editModeState.applyState.numDiffs) { + extra.ideMessenger.post("rejectDiff", { + filepath: codeToEdit[0].filepath, + }); + } - extra.ideMessenger.post("edit/clearDecorations", undefined); + extra.ideMessenger.post("edit/clearDecorations", undefined); - dispatch(clearCodeToEdit()); - dispatch(updateEditStateApplyState(INITIAL_EDIT_APPLY_STATE)); - dispatch(setIsInEdit(false)); + dispatch(clearCodeToEdit()); + dispatch(updateEditStateApplyState(INITIAL_EDIT_APPLY_STATE)); + dispatch(setIsInEdit(false)); - // Restore the previous editor content if available - if (previousModeEditorContent) { - dispatch(setMainEditorContentTrigger(previousModeEditorContent)); - dispatch(setPreviousModeEditorContent(undefined)); - } + // Restore the previous editor content if available + if (previousModeEditorContent) { + dispatch(setMainEditorContentTrigger(previousModeEditorContent)); + dispatch(setPreviousModeEditorContent(undefined)); + } - if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) { - dispatch(newSession()); - } else { - await dispatch( - loadLastSession({ - saveCurrentSession: false, - }), - ); - } + if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) { + dispatch(newSession()); + } else { + await dispatch( + loadLastSession({ + saveCurrentSession: false, + }), + ); + } - dispatch(setMode(goToMode ?? state.editModeState.returnToMode)); - }, -); + dispatch(setMode(state.editModeState.returnToMode)); +}); export const enterEdit = createAsyncThunk< void, diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 2d25f9e29..ab86aa85c 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -40,16 +40,12 @@ export const streamNormalInput = createAsyncThunk< // Get tools const activeTools = selectActiveTools(state); const toolsSupported = modelSupportsTools(selectedChatModel); - const readOnlyMode = state.session.readOnlyMode; - const filteredTools = readOnlyMode - ? activeTools.filter((t) => t.readonly) - : activeTools; // Construct completion options let completionOptions: LLMFullCompletionOptions = {}; - if (toolsSupported && filteredTools.length > 0) { + if (toolsSupported && activeTools.length > 0) { completionOptions = { - tools: filteredTools, + tools: activeTools, }; } @@ -119,21 +115,19 @@ export const streamNormalInput = createAsyncThunk< dispatch(addPromptCompletionPair([next.value])); try { - if (state.session.mode === "chat" || state.session.mode === "agent") { - extra.ideMessenger.post("devdata/log", { - name: "chatInteraction", - data: { - prompt: next.value.prompt, - completion: next.value.completion, - modelProvider: selectedChatModel.underlyingProviderName, - modelTitle: selectedChatModel.title, - sessionId: state.session.id, - ...(state.session.mode === "agent" && { - tools: filteredTools.map((tool) => tool.function.name), - }), - }, - }); - } + extra.ideMessenger.post("devdata/log", { + name: "chatInteraction", + data: { + prompt: next.value.prompt, + completion: next.value.completion, + modelProvider: selectedChatModel.underlyingProviderName, + modelTitle: selectedChatModel.title, + sessionId: state.session.id, + ...(!!activeTools.length && { + tools: activeTools.map((tool) => tool.function.name), + }), + }, + }); // else if (state.session.mode === "edit") { // extra.ideMessenger.post("devdata/log", { // name: "editInteraction", diff --git a/gui/src/redux/thunks/streamThunkWrapper.tsx b/gui/src/redux/thunks/streamThunkWrapper.tsx index 9e40f4f06..00de92227 100644 --- a/gui/src/redux/thunks/streamThunkWrapper.tsx +++ b/gui/src/redux/thunks/streamThunkWrapper.tsx @@ -13,7 +13,7 @@ export const streamThunkWrapper = createAsyncThunk< try { await runStream(); const state = getState(); - if (state.session.mode === "chat" || state.session.mode === "agent") { + if (!state.session.isInEdit) { await dispatch( saveCurrentSession({ openNewSession: false, diff --git a/gui/src/redux/util/constructMessages.test.ts b/gui/src/redux/util/constructMessages.test.ts index 18ab0ed45..b1d808662 100644 --- a/gui/src/redux/util/constructMessages.test.ts +++ b/gui/src/redux/util/constructMessages.test.ts @@ -12,6 +12,7 @@ import { import { DEFAULT_AGENT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE, + DEFAULT_PLAN_SYSTEM_MESSAGE, } from "core/llm/defaultSystemMessages"; import { renderChatMessage } from "core/util/messageContent"; import { beforeEach, describe, expect, test, vi } from "vitest"; @@ -90,8 +91,9 @@ vi.mock("core/llm/rules/getSystemMessageWithRules", async (importOriginal) => { test("getBaseSystemMessage should return the correct system message based on mode", () => { const mockModel = { - baseAgentSystemMessage: "Custom Agent System Message", baseChatSystemMessage: "Custom Chat System Message", + basePlanSystemMessage: "Custom Plan System Message", + baseAgentSystemMessage: "Custom Agent System Message", } as ModelDescription; // Test agent mode with custom message @@ -99,6 +101,11 @@ test("getBaseSystemMessage should return the correct system message based on mod "Custom Agent System Message", ); + // Test plan mode with custom message + expect(getBaseSystemMessage("plan", mockModel)).toBe( + "Custom Plan System Message", + ); + // Test chat mode with custom message expect(getBaseSystemMessage("chat", mockModel)).toBe( "Custom Chat System Message", @@ -109,6 +116,11 @@ test("getBaseSystemMessage should return the correct system message based on mod DEFAULT_AGENT_SYSTEM_MESSAGE, ); + // Test agent mode with default message + expect(getBaseSystemMessage("plan", {} as ModelDescription)).toBe( + DEFAULT_PLAN_SYSTEM_MESSAGE, + ); + // Test chat mode with default message expect(getBaseSystemMessage("chat", {} as ModelDescription)).toBe( DEFAULT_CHAT_SYSTEM_MESSAGE, diff --git a/gui/src/redux/util/constructMessages.ts b/gui/src/redux/util/constructMessages.ts index 15f8120db..566608d67 100644 --- a/gui/src/redux/util/constructMessages.ts +++ b/gui/src/redux/util/constructMessages.ts @@ -11,6 +11,7 @@ import { import { DEFAULT_AGENT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE, + DEFAULT_PLAN_SYSTEM_MESSAGE, } from "core/llm/defaultSystemMessages"; import { chatMessageIsEmpty } from "core/llm/messages"; import { getSystemMessageWithRules } from "core/llm/rules/getSystemMessageWithRules"; @@ -167,6 +168,8 @@ export function getBaseSystemMessage( ): string { if (messageMode === "agent") { return model.baseAgentSystemMessage ?? DEFAULT_AGENT_SYSTEM_MESSAGE; + } else if (messageMode === "plan") { + return model.basePlanSystemMessage ?? DEFAULT_PLAN_SYSTEM_MESSAGE; } else { return model.baseChatSystemMessage ?? DEFAULT_CHAT_SYSTEM_MESSAGE; } diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 99d324ac2..103cdff55 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -85,6 +85,7 @@ export type EmbedOptions = z.infer; export const chatOptionsSchema = z.object({ baseSystemMessage: z.string().optional(), baseAgentSystemMessage: z.string().optional(), + basePlanSystemMessage: z.string().optional(), }); export type ChatOptions = z.infer; From 518e18df43b766810c66b2c610432a97b73ddd95 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:45:24 -0700 Subject: [PATCH 4/8] update plan mode system message --- core/llm/defaultSystemMessages.ts | 19 ++++++++++++++----- .../mainInput/Lump/sections/RulesSection.tsx | 15 +++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/core/llm/defaultSystemMessages.ts b/core/llm/defaultSystemMessages.ts index e51ea0013..a6b3afc6c 100644 --- a/core/llm/defaultSystemMessages.ts +++ b/core/llm/defaultSystemMessages.ts @@ -1,7 +1,4 @@ -export const DEFAULT_CHAT_SYSTEM_MESSAGE_URL = - "https://github.com/continuedev/continue/blob/main/core/llm/defaultSystemMessages.ts"; - -export const DEFAULT_AGENT_SYSTEM_MESSAGE_URL = +export const DEFAULT_SYSTEM_MESSAGES_URL = "https://github.com/continuedev/continue/blob/main/core/llm/defaultSystemMessages.ts"; export const CODEBLOCK_FORMATTING_INSTRUCTIONS = `\ @@ -67,4 +64,16 @@ export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\ ${CODEBLOCK_FORMATTING_INSTRUCTIONS} `; -export const DEFAULT_PLAN_SYSTEM_MESSAGE = DEFAULT_AGENT_SYSTEM_MESSAGE; +// The note about read-only tools is for MCP servers +// For now, all MCP tools are included so model can decide if they are read-only +export const DEFAULT_PLAN_SYSTEM_MESSAGE = `\ + + You are in plan mode, in which you help the user understand and construct a plan. + Only use read-only tools. Do not use any tools that would write to non-temporary files. + If the user wants to make changes, offer that they can switch to Agent mode to give you access to write tools to make the suggested updates. + +${CODEBLOCK_FORMATTING_INSTRUCTIONS} +${EDIT_CODE_INSTRUCTIONS} + + In plan mode, only write code when directly suggesting changes. Prioritize understanding and developing a plan. +`; diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index 8a6754457..5f145a169 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -7,9 +7,8 @@ import { import { RuleWithSource } from "core"; import { DEFAULT_AGENT_SYSTEM_MESSAGE, - DEFAULT_AGENT_SYSTEM_MESSAGE_URL, DEFAULT_CHAT_SYSTEM_MESSAGE, - DEFAULT_CHAT_SYSTEM_MESSAGE_URL, + DEFAULT_SYSTEM_MESSAGES_URL, } from "core/llm/defaultSystemMessages"; import { useContext, useMemo } from "react"; import { useAuth } from "../../../../context/Auth"; @@ -52,12 +51,12 @@ const RuleCard: React.FC = ({ rule }) => { ideMessenger.post("openFile", { path: rule.ruleFile, }); - } else if (rule.source === "default-chat" && mode === "chat") { - ideMessenger.post("openUrl", DEFAULT_CHAT_SYSTEM_MESSAGE_URL); - } else if (rule.source === "default-plan" && mode === "plan") { - ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); - } else if (rule.source === "default-agent" && mode === "agent") { - ideMessenger.post("openUrl", DEFAULT_AGENT_SYSTEM_MESSAGE_URL); + } else if ( + rule.source === "default-chat" || + rule.source === "default-plan" || + rule.source === "default-agent" + ) { + ideMessenger.post("openUrl", DEFAULT_SYSTEM_MESSAGES_URL); } else { ideMessenger.post("config/openProfile", { profileId: undefined, From b855109408776508dd647db6fa17543a3fe15a58 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:46:56 -0700 Subject: [PATCH 5/8] fix tool policies copy --- .../Lump/sections/tool-policies/ToolPoliciesSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx index 718051103..9303f3392 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection.tsx @@ -65,8 +65,8 @@ export const ToolPoliciesSection = () => { mode === "chat" ? "All tools are disabled in Chat mode" : mode === "plan" - ? "Plan mode: only MCP and read-only tools" - : "Act mode: all tool policies apply"; + ? "Plan mode: only read-only and MCP tools" + : "Agent mode: all tool policies apply"; return ( <> From 9b66433abc3fa3a00ac6a078c7fbeaa7f6fd0e62 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:52:14 -0700 Subject: [PATCH 6/8] fix tool policies logic --- .../mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index 38f9416fe..4a575a812 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -26,7 +26,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { (state) => state.ui.toolSettings[props.tool.function.name], ); const [isExpanded, setIsExpanded] = useState(false); - const readOnlyMode = useAppSelector((state) => state.session.readOnlyMode); + const mode = useAppSelector((state) => state.session.mode); useEffect(() => { if (!policy) { @@ -48,7 +48,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { const disabled = !props.isGroupEnabled || - (readOnlyMode && + (mode === "plan" && props.tool.group === BUILT_IN_GROUP_NAME && !props.tool.readonly); From b984c25b8fe2dedfa3bd35da7b52a817d42df439 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 7 Jul 2025 10:58:40 -0700 Subject: [PATCH 7/8] cubic-feedback --- .../Lump/sections/tool-policies/ToolPolicyItem.tsx | 14 +++++++++----- gui/src/pages/gui/chat-tests/Chat.test.tsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index 4a575a812..edccf3923 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -118,11 +118,15 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
{ - dispatch(toggleToolSetting(props.tool.function.name)); - e.stopPropagation(); - e.preventDefault(); - }} + onClick={ + disabled + ? undefined + : (e) => { + dispatch(toggleToolSetting(props.tool.function.name)); + e.stopPropagation(); + e.preventDefault(); + } + } > {disabled || policy === "disabled" ? ( <> diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx index d1bae6d07..b0164a437 100644 --- a/gui/src/pages/gui/chat-tests/Chat.test.tsx +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -39,7 +39,7 @@ test("should be able to toggle modes", async () => { ); }); - // Check that it switched to Plan mode + // Check that it switched to Agent mode await getElementByText("Agent"); act(() => { From 860174eaa420b6010ae9c5dc89d82d35d76f9c8f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 13:04:50 -0700 Subject: [PATCH 8/8] fix typo --- gui/src/components/ModeSelect/ModeSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index 224799184..9de391852 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -123,7 +123,7 @@ export function ModeSelect() { zIndex: 200001, }} > - In Plan mode, only use read-only and MCP tools are enabled + In Plan mode, only read-only and MCP tools are enabled
{agentModeSupported ? (