diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 3b2ed52ea17..b26f6850d72 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -38,6 +38,15 @@ const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [ "repo-map", ]; +// Slash command sources that should be allowed in edit mode +const EDIT_ALLOWED_SLASH_COMMAND_SOURCES: Set = new Set([ + "yaml-prompt-block", + "mcp-prompt", + "prompt-file-v1", + "prompt-file-v2", + "invokable-rule", +]); + function ContinueInputBox(props: ContinueInputBoxProps) { const isStreaming = useAppSelector((state) => state.session.isStreaming); const availableSlashCommands = useAppSelector( @@ -50,7 +59,15 @@ function ContinueInputBox(props: ContinueInputBoxProps) { const editModeState = useAppSelector((state) => state.editModeState); const filteredSlashCommands = useMemo(() => { - return isInEdit ? [] : availableSlashCommands; + if (!isInEdit) { + return availableSlashCommands; + } + + // In edit mode, only allow prompt-based slash commands + return availableSlashCommands.filter((command) => { + // Check if this command has a source property and if it's allowed in edit mode + return command.source && EDIT_ALLOWED_SLASH_COMMAND_SOURCES.has(command.source); + }); }, [isInEdit, availableSlashCommands]); const filteredContextProviders = useMemo(() => { diff --git a/gui/src/components/mainInput/types.d.ts b/gui/src/components/mainInput/types.d.ts index 70f5a5c61ce..52ccc5838a2 100644 --- a/gui/src/components/mainInput/types.d.ts +++ b/gui/src/components/mainInput/types.d.ts @@ -26,4 +26,5 @@ export interface ComboBoxItem { icon?: string; action?: () => void; subActions?: ComboBoxSubAction[]; + source?: string; } diff --git a/gui/src/redux/selectors/index.ts b/gui/src/redux/selectors/index.ts index 8247e56e028..99f6f659fbb 100644 --- a/gui/src/redux/selectors/index.ts +++ b/gui/src/redux/selectors/index.ts @@ -22,6 +22,7 @@ export const selectSlashCommandComboBoxInputs = createSelector( description: cmd.description, type: "slashCommand" as ComboBoxItemType, content: content, + source: cmd.source, } as ComboBoxItem; }) || [] );