import { HTMLAttributes } from "react" import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" import { Cog } from "lucide-react" import { EXPERIMENT_IDS, ExperimentId } from "../../../../src/shared/experiments" import { TERMINAL_OUTPUT_LIMIT } from "../../../../src/shared/terminal" import { cn } from "@/lib/utils" import { SetCachedStateField, SetExperimentEnabled } from "./types" import { sliderLabelStyle } from "./styles" import { SectionHeader } from "./SectionHeader" import { Section } from "./Section" type AdvancedSettingsProps = HTMLAttributes & { rateLimitSeconds: number terminalOutputLimit?: number maxOpenTabsContext: number diffEnabled?: boolean fuzzyMatchThreshold?: number showRooIgnoredFiles?: boolean setCachedStateField: SetCachedStateField< | "rateLimitSeconds" | "terminalOutputLimit" | "maxOpenTabsContext" | "diffEnabled" | "fuzzyMatchThreshold" | "showRooIgnoredFiles" > experiments: Record setExperimentEnabled: SetExperimentEnabled } export const AdvancedSettings = ({ rateLimitSeconds, terminalOutputLimit = TERMINAL_OUTPUT_LIMIT, maxOpenTabsContext, diffEnabled, fuzzyMatchThreshold, showRooIgnoredFiles, setCachedStateField, experiments, setExperimentEnabled, className, ...props }: AdvancedSettingsProps) => { return (
Advanced
Rate limit
setCachedStateField("rateLimitSeconds", parseInt(e.target.value))} className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background" /> {rateLimitSeconds}s

Minimum time between API requests.

Terminal output limit
setCachedStateField("terminalOutputLimit", parseInt(e.target.value))} className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background" /> {Math.floor(terminalOutputLimit / 1024)} KB

Maximum amount of terminal output (in kilobytes) to send to the LLM when executing commands. If the output exceeds this limit, it will be removed from the middle so that the start and end of the output are preserved.

Open tabs context limit
setCachedStateField("maxOpenTabsContext", parseInt(e.target.value))} className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background" /> {maxOpenTabsContext ?? 20}

Maximum number of VSCode open tabs to include in context. Higher values provide more context but increase token usage.

{ setCachedStateField("diffEnabled", e.target.checked) if (!e.target.checked) { // Reset both experimental strategies when diffs are disabled. setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, false) setExperimentEnabled(EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE, false) } }}> Enable editing through diffs

When enabled, Roo will be able to edit files more quickly and will automatically reject truncated full-file writes. Works best with the latest Claude 3.7 Sonnet model.

{diffEnabled && (
Diff strategy
{/* Description for selected strategy */}

{!experiments[EXPERIMENT_IDS.DIFF_STRATEGY] && !experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] && "Standard diff strategy applies changes to a single code block at a time."} {experiments[EXPERIMENT_IDS.DIFF_STRATEGY] && "Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach."} {experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] && "Multi-block diff strategy allows updating multiple code blocks in a file in one request."}

{/* Match precision slider */} Match precision
{ setCachedStateField("fuzzyMatchThreshold", parseFloat(e.target.value)) }} className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background" /> {Math.round((fuzzyMatchThreshold || 1) * 100)}%

This slider controls how precisely code sections must match when applying diffs. Lower values allow more flexible matching but increase the risk of incorrect replacements. Use values below 100% with extreme caution.

)}
{ setCachedStateField("showRooIgnoredFiles", e.target.checked) }}> Show .rooignore'd files in lists and searches

When enabled, files matching patterns in .rooignore will be shown in lists with a lock symbol. When disabled, these files will be completely hidden from file lists and searches.

) }