Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | import { SUPPORTED_DICTATION_LANGUAGES } from "@shared/DictationSettings" import { McpDisplayMode } from "@shared/McpDisplayMode" import { EmptyRequest } from "@shared/proto/index.cline" import { OpenaiReasoningEffort } from "@shared/storage/types" import { VSCodeButton, VSCodeCheckbox, VSCodeDropdown, VSCodeOption, VSCodeTextField } from "@vscode/webview-ui-toolkit/react" import { memo, useEffect, useState } from "react" import HeroTooltip from "@/components/common/HeroTooltip" import McpDisplayModeDropdown from "@/components/mcp/chat-display/McpDisplayModeDropdown" import { useExtensionState } from "@/context/ExtensionStateContext" import { StateServiceClient } from "@/services/grpc-client" import Section from "../Section" import SubagentOutputLineLimitSlider from "../SubagentOutputLineLimitSlider" import { updateSetting } from "../utils/settingsHandlers" interface FeatureSettingsSectionProps { renderSectionHeader: (tabId: string) => JSX.Element | null } const FeatureSettingsSection = ({ renderSectionHeader }: FeatureSettingsSectionProps) => { const { enableCheckpointsSetting, mcpMarketplaceEnabled, mcpDisplayMode, mcpResponsesCollapsed, openaiReasoningEffort, strictPlanModeEnabled, yoloModeToggled, dictationSettings, useAutoCondense, focusChainSettings, multiRootSetting, hooksEnabled, remoteConfigSettings, subagentsEnabled, platform, } = useExtensionState() const isMacOS = platform === "darwin" const [isAiHydroCliInstalled, setIsAiHydroCliInstalled] = useState(false) const handleReasoningEffortChange = (newValue: OpenaiReasoningEffort) => { updateSetting("openaiReasoningEffort", newValue) } // Poll for CLI installation status while the component is mounted useEffect(() => { const checkInstallation = async () => { try { const result = await StateServiceClient.checkCliInstallation(EmptyRequest.create()) setIsAiHydroCliInstalled(result.value) } catch (error) { console.error("Failed to check CLI installation:", error) } } checkInstallation() // Poll ever 1.5 seconds to see if CLI is installed (only when form is open) const pollInterval = setInterval(checkInstallation, 1500) return () => { clearInterval(pollInterval) } }, []) return ( <div> {renderSectionHeader("features")} <Section> <div style={{ marginBottom: 20 }}> {/* Subagents - Only show on macOS (for now) */} {isMacOS && ( <div className="relative p-3 mb-3 rounded-md" id="subagents-section" style={{ border: "1px solid var(--vscode-widget-border)", backgroundColor: "var(--vscode-list-hoverBackground)", }}> <div className="absolute -top-2 -right-2 px-2 py-0.5 rounded text-xs font-semibold" style={{ backgroundColor: "var(--vscode-button-secondaryBackground)", color: "var(--vscode-button-secondaryForeground)", }}> NEW </div> <div className="mt-1.5 mb-2 px-2 pt-0.5 pb-1.5 rounded" style={{ backgroundColor: "color-mix(in srgb, var(--vscode-sideBar-background) 99%, black)", }}> <p className="text-xs mb-2 flex items-start" style={{ color: "var(--vscode-inputValidation-warningForeground)" }}> <span className="codicon codicon-warning mr-1" style={{ fontSize: "12px", marginTop: "1px", flexShrink: 0 }}></span> <span> AI-Hydro CLI is required for subagents. Install it with: <code className="ml-1 px-1 rounded" style={{ backgroundColor: "var(--vscode-editor-background)", color: "var(--vscode-foreground)", opacity: 0.9, }}> npm install -g aihydro </code> , then run <code className="ml-1 px-1 rounded" style={{ backgroundColor: "var(--vscode-editor-background)", color: "var(--vscode-foreground)", opacity: 0.9, }}> aihydro auth </code> To authenticate with AI-Hydro or configure an API provider. </span> </p> {!isAiHydroCliInstalled && ( <VSCodeButton appearance="secondary" onClick={async () => { try { await StateServiceClient.installAiHydroCli(EmptyRequest.create()) } catch (error) { console.error("Failed to initiate CLI installation:", error) } }} style={{ transform: "scale(0.85)", transformOrigin: "left center", marginLeft: "-2px", }}> Install Now </VSCodeButton> )} </div> <VSCodeCheckbox checked={subagentsEnabled} disabled={!isAiHydroCliInstalled} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("subagentsEnabled", checked) }}> <span className="font-semibold"> {subagentsEnabled ? "Subagents Enabled" : "Enable Subagents"} </span> </VSCodeCheckbox> <p className="text-xs mt-1 mb-0"> <span className="text-[var(--vscode-errorForeground)]">Experimental: </span>{" "} <span className="text-description"> Allows AI-Hydro to spawn subprocesses to handle focused tasks like exploring large codebases, keeping your main context clean. </span> </p> {subagentsEnabled && ( <div className="mt-3"> <SubagentOutputLineLimitSlider /> </div> )} </div> )} <div> <VSCodeCheckbox checked={enableCheckpointsSetting} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("enableCheckpointsSetting", checked) }}> Enable Checkpoints </VSCodeCheckbox> <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Enables extension to save checkpoints of workspace throughout the task. Uses git under the hood which may not work well with large workspaces. </p> </div> <div style={{ marginTop: 10 }}> {remoteConfigSettings?.mcpMarketplaceEnabled !== undefined ? ( <HeroTooltip content="This setting is managed by your organization's remote configuration"> <div className="flex items-center gap-2"> <VSCodeCheckbox checked={mcpMarketplaceEnabled} disabled={true} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("mcpMarketplaceEnabled", checked) }}> Enable MCP Marketplace </VSCodeCheckbox> <i className="codicon codicon-lock text-[var(--vscode-descriptionForeground)] text-sm" /> </div> </HeroTooltip> ) : ( <VSCodeCheckbox checked={mcpMarketplaceEnabled} disabled={false} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("mcpMarketplaceEnabled", checked) }}> Enable MCP Marketplace </VSCodeCheckbox> )} <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Enables the MCP Marketplace tab for discovering and installing MCP servers. </p> </div> <div style={{ marginTop: 10 }}> <label className="block text-sm font-medium text-[var(--vscode-foreground)] mb-1" htmlFor="mcp-display-mode-dropdown"> MCP Display Mode </label> <McpDisplayModeDropdown className="w-full" id="mcp-display-mode-dropdown" onChange={(newMode: McpDisplayMode) => updateSetting("mcpDisplayMode", newMode)} value={mcpDisplayMode} /> <p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]"> Controls how MCP responses are displayed: plain text, rich formatting with links/images, or markdown rendering. </p> </div> <div style={{ marginTop: 10 }}> <VSCodeCheckbox checked={mcpResponsesCollapsed} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("mcpResponsesCollapsed", checked) }}> Collapse MCP Responses </VSCodeCheckbox> <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Sets the default display mode for MCP response panels </p> </div> <div style={{ marginTop: 10 }}> <label className="block text-sm font-medium text-[var(--vscode-foreground)] mb-1" htmlFor="openai-reasoning-effort-dropdown"> OpenAI Reasoning Effort </label> <VSCodeDropdown className="w-full" currentValue={openaiReasoningEffort || "medium"} id="openai-reasoning-effort-dropdown" onChange={(e: any) => { const newValue = e.target.currentValue as OpenaiReasoningEffort handleReasoningEffortChange(newValue) }}> <VSCodeOption value="minimal">Minimal</VSCodeOption> <VSCodeOption value="low">Low</VSCodeOption> <VSCodeOption value="medium">Medium</VSCodeOption> <VSCodeOption value="high">High</VSCodeOption> </VSCodeDropdown> <p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]"> Reasoning effort for the OpenAI family of models(applies to all OpenAI model providers) </p> </div> <div style={{ marginTop: 10 }}> <VSCodeCheckbox checked={strictPlanModeEnabled} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("strictPlanModeEnabled", checked) }}> Enable strict plan mode </VSCodeCheckbox> <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Enforces strict tool use while in plan mode, preventing file edits. </p> </div> { <div style={{ marginTop: 10 }}> <VSCodeCheckbox checked={focusChainSettings?.enabled || false} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("focusChainSettings", { ...focusChainSettings, enabled: checked }) }}> Enable Focus Chain </VSCodeCheckbox> <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Enables enhanced task progress tracking and automatic focus chain list management throughout tasks. </p> </div> } {focusChainSettings?.enabled && ( <div style={{ marginTop: 10, marginLeft: 20 }}> <label className="block text-sm font-medium text-[var(--vscode-foreground)] mb-1" htmlFor="focus-chain-remind-interval"> Focus Chain Reminder Interval </label> <VSCodeTextField className="w-20" id="focus-chain-remind-interval" onChange={(e: any) => { const value = parseInt(e.target.value, 10) if (!Number.isNaN(value) && value >= 1 && value <= 100) { updateSetting("focusChainSettings", { ...focusChainSettings, remindAiHydroInterval: value, }) } }} value={String(focusChainSettings?.remindAiHydroInterval || 6)} /> <p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]"> Interval (in messages) to remind AI-Hydro about its focus chain checklist (1-100). Lower values provide more frequent reminders. </p> </div> )} {dictationSettings?.featureEnabled && ( <> <div className="mt-2.5"> <VSCodeCheckbox checked={dictationSettings?.dictationEnabled} onChange={(e: any) => { const checked = e.target.checked === true const updatedDictationSettings = { ...dictationSettings, dictationEnabled: checked, } updateSetting("dictationSettings", updatedDictationSettings) }}> Enable Dictation </VSCodeCheckbox> <p className="text-xs text-description mt-1"> Enables speech-to-text transcription using your AI-Hydro account. Uses the Whisper model, at $0.006 credits per minute of audio processed. 5 minutes max per message. </p> </div> {/* TODO: Fix and use CollapsibleContent, the animation is good but it breaks the dropdown <CollapsibleContent isOpen={dictationSettings?.dictationEnabled}> */} {dictationSettings?.dictationEnabled && ( <div className="mt-2.5 ml-5"> <label className="block text-sm font-medium text-foreground mb-1" htmlFor="dictation-language-dropdown"> Dictation Language </label> <VSCodeDropdown className="w-full" currentValue={dictationSettings?.dictationLanguage || "en"} id="dictation-language-dropdown" onChange={(e: any) => { const newValue = e.target.value const updatedDictationSettings = { ...dictationSettings, dictationLanguage: newValue, } updateSetting("dictationSettings", updatedDictationSettings) }}> {SUPPORTED_DICTATION_LANGUAGES.map((language) => ( <VSCodeOption className="py-0.5" key={language.code} value={language.code}> {language.name} </VSCodeOption> ))} </VSCodeDropdown> <p className="text-xs mt-1 text-description"> The language you want to speak to the Dictation service in. This is separate from your preferred UI language. </p> </div> )} </> )} <div style={{ marginTop: 10 }}> <VSCodeCheckbox checked={useAutoCondense} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("useAutoCondense", checked) }}> Enable Auto Compact </VSCodeCheckbox> <p className="text-xs text-[var(--vscode-descriptionForeground)]"> Enables advanced context management system which uses LLM based condensing for next-gen models.{" "} <a className="text-[var(--vscode-textLink-foreground)] hover:text-[var(--vscode-textLink-activeForeground)]" href="https://github.com/AI-Hydro/AI-Hydro#readme" rel="noopener noreferrer" target="_blank"> Learn more </a> </p> </div> {multiRootSetting.featureFlag && ( <div className="mt-2.5"> <VSCodeCheckbox checked={multiRootSetting.user} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("multiRootEnabled", checked) }}> Enable Multi-Root Workspace </VSCodeCheckbox> <p className="text-xs"> <span className="text-[var(--vscode-errorForeground)]">Experimental: </span>{" "} <span className="text-description">Allows AI-Hydro to work across multiple workspaces.</span> </p> </div> )} {hooksEnabled?.featureFlag && ( <div className="mt-2.5"> <VSCodeCheckbox checked={hooksEnabled.user} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("hooksEnabled", checked) }}> Enable Hooks </VSCodeCheckbox> <p className="text-xs"> <span className="text-[var(--vscode-errorForeground)]">Experimental: </span>{" "} <span className="text-description"> Allows execution of hooks from .aihydrorules/hooks/ directory. </span> </p> </div> )} <div style={{ marginTop: 10 }}> {remoteConfigSettings?.yoloModeToggled !== undefined ? ( <HeroTooltip content="This setting is managed by your organization's remote configuration"> <div className="flex items-center gap-2"> <VSCodeCheckbox checked={yoloModeToggled} disabled={true} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("yoloModeToggled", checked) }}> Enable YOLO Mode </VSCodeCheckbox> <i className="codicon codicon-lock text-[var(--vscode-descriptionForeground)] text-sm" /> </div> </HeroTooltip> ) : ( <VSCodeCheckbox checked={yoloModeToggled} disabled={false} onChange={(e: any) => { const checked = e.target.checked === true updateSetting("yoloModeToggled", checked) }}> Enable YOLO Mode </VSCodeCheckbox> )} <p className="text-xs text-[var(--vscode-errorForeground)]"> EXPERIMENTAL & DANGEROUS: This mode disables safety checks and user confirmations. AI-Hydro will automatically approve all actions without asking. Use with extreme caution. </p> </div> </div> </Section> </div> ) } export default memo(FeatureSettingsSection) |