import React, { useMemo } from 'react'; import { resolveAnthropicFastMode, resolveAnthropicRuntimeSelection, } from '@features/anthropic-runtime-profile/renderer'; import { Label } from '@renderer/components/ui/label'; import { useEffectiveCliProviderStatus } from '@renderer/hooks/useEffectiveCliProviderStatus'; import { cn } from '@renderer/lib/utils'; import { Zap } from 'lucide-react'; import type { TeamFastMode } from '@shared/types'; export interface AnthropicFastModeSelectorProps { value: TeamFastMode; onValueChange: (value: TeamFastMode) => void; providerFastModeDefault: boolean; model?: string; limitContext: boolean; id?: string; } export const AnthropicFastModeSelector: React.FC = ({ value, onValueChange, providerFastModeDefault, model, limitContext, id, }) => { const { providerStatus } = useEffectiveCliProviderStatus('anthropic'); const selection = useMemo( () => resolveAnthropicRuntimeSelection({ source: { modelCatalog: providerStatus?.modelCatalog, runtimeCapabilities: providerStatus?.runtimeCapabilities, }, selectedModel: model, limitContext, }), [limitContext, model, providerStatus?.modelCatalog, providerStatus?.runtimeCapabilities] ); const resolution = useMemo( () => resolveAnthropicFastMode({ selection, selectedFastMode: value, providerFastModeDefault, }), [providerFastModeDefault, selection, value] ); if (!resolution.showFastModeControl) { return null; } const defaultLabel = providerFastModeDefault ? 'Default (Fast)' : 'Default (Off)'; const helperText = value === 'inherit' ? `Default currently resolves to ${resolution.resolvedFastMode ? 'Fast' : 'Off'}.` : (resolution.disabledReason ?? 'Fast mode is runtime-backed and only unlocks when the resolved Anthropic launch model supports it.'); return (
{[ { value: 'inherit' as const, label: defaultLabel, disabled: false }, { value: 'on' as const, label: 'Fast', disabled: !resolution.selectable }, { value: 'off' as const, label: 'Off', disabled: false }, ].map((option) => ( ))}

{helperText}

); };