feat: Add intelligent auto-router and enhanced integrations

- Add intelligent-router.sh hook for automatic agent routing
- Add AUTO-TRIGGER-SUMMARY.md documentation
- Add FINAL-INTEGRATION-SUMMARY.md documentation
- Complete Prometheus integration (6 commands + 4 tools)
- Complete Dexto integration (12 commands + 5 tools)
- Enhanced Ralph with access to all agents
- Fix /clawd command (removed disable-model-invocation)
- Update hooks.json to v5 with intelligent routing
- 291 total skills now available
- All 21 commands with automatic routing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
admin
2026-01-28 00:27:56 +04:00
Unverified
parent 3b128ba3bd
commit b52318eeae
1724 changed files with 351216 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
import { Key, Volume2, Palette, X, ChevronDown } from 'lucide-react';
import { Button } from '../ui/button';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '../ui/dropdown-menu';
import { cn } from '@/lib/utils';
export type SettingsSection = 'api-keys' | 'voice' | 'appearance';
type SettingsNavigationProps = {
activeSection: SettingsSection;
onSectionChange: (section: SettingsSection) => void;
onClose: () => void;
variant?: 'desktop' | 'mobile';
};
const sections: { id: SettingsSection; label: string; icon: typeof Key }[] = [
{ id: 'api-keys', label: 'API Keys', icon: Key },
{ id: 'voice', label: 'Voice & TTS', icon: Volume2 },
{ id: 'appearance', label: 'Appearance', icon: Palette },
];
export function SettingsNavigation({
activeSection,
onSectionChange,
onClose,
variant = 'desktop',
}: SettingsNavigationProps) {
if (variant === 'mobile') {
const activeItem = sections.find((s) => s.id === activeSection);
const ActiveIcon = activeItem?.icon || Key;
return (
<div className="flex items-center justify-between w-full">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="flex items-center gap-2">
<ActiveIcon className="h-4 w-4" />
<span>{activeItem?.label}</span>
<ChevronDown className="h-4 w-4 text-muted-foreground" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-48">
{sections.map((section) => {
const Icon = section.icon;
return (
<DropdownMenuItem
key={section.id}
onClick={() => onSectionChange(section.id)}
className={cn(
'flex items-center gap-2',
activeSection === section.id && 'bg-accent'
)}
>
<Icon className="h-4 w-4" />
<span>{section.label}</span>
</DropdownMenuItem>
);
})}
</DropdownMenuContent>
</DropdownMenu>
<Button variant="ghost" size="icon" onClick={onClose} aria-label="Close settings">
<X className="h-4 w-4" />
</Button>
</div>
);
}
return (
<div className="flex flex-col h-full">
<div className="flex items-center justify-between px-4 py-4 border-b border-border">
<h2 className="font-semibold">Settings</h2>
<Button
variant="ghost"
size="icon"
className="h-8 w-8"
onClick={onClose}
aria-label="Close settings"
>
<X className="h-4 w-4" />
</Button>
</div>
<nav className="flex-1 py-2">
{sections.map((section) => {
const Icon = section.icon;
const isActive = activeSection === section.id;
return (
<button
type="button"
key={section.id}
onClick={() => onSectionChange(section.id)}
aria-current={isActive ? 'page' : undefined}
className={cn(
'w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors',
'hover:bg-accent hover:text-accent-foreground',
isActive
? 'bg-accent text-accent-foreground font-medium'
: 'text-muted-foreground'
)}
>
<Icon className="h-4 w-4 shrink-0" />
<span>{section.label}</span>
</button>
);
})}
</nav>
</div>
);
}

View File

@@ -0,0 +1,91 @@
import { useState } from 'react';
import { Dialog, DialogContent, DialogTitle } from '../ui/dialog';
import { SettingsNavigation, type SettingsSection } from './SettingsNavigation';
import { ApiKeysSection } from './sections/ApiKeysSection';
import { VoiceSection } from './sections/VoiceSection';
import { AppearanceSection } from './sections/AppearanceSection';
type SettingsPanelProps = {
isOpen: boolean;
onClose: () => void;
};
const sectionTitles: Record<SettingsSection, string> = {
'api-keys': 'API Keys',
voice: 'Voice & TTS',
appearance: 'Appearance',
};
const sectionDescriptions: Record<SettingsSection, string> = {
'api-keys': 'Manage API keys for LLM providers',
voice: 'Configure text-to-speech settings',
appearance: 'Customize theme and UI preferences',
};
export function SettingsPanel({ isOpen, onClose }: SettingsPanelProps) {
const [activeSection, setActiveSection] = useState<SettingsSection>('api-keys');
const renderSection = () => {
switch (activeSection) {
case 'api-keys':
return <ApiKeysSection />;
case 'voice':
return <VoiceSection active={isOpen} />;
case 'appearance':
return <AppearanceSection />;
default:
return null;
}
};
return (
<Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
<DialogContent
className="max-w-4xl! w-[90vw] h-[85vh] p-0! gap-0! flex flex-col"
hideCloseButton
>
{/* Visually hidden title for accessibility */}
<DialogTitle className="sr-only">Settings</DialogTitle>
<div className="flex flex-1 min-h-0">
{/* Left Navigation - hidden on mobile, shown on md+ */}
<div className="hidden md:flex md:flex-col w-56 border-r border-border bg-muted/30 shrink-0">
<SettingsNavigation
activeSection={activeSection}
onSectionChange={setActiveSection}
onClose={onClose}
/>
</div>
{/* Right Content Area */}
<div className="flex-1 flex flex-col min-h-0 min-w-0">
{/* Mobile header with navigation */}
<div className="md:hidden flex items-center gap-2 px-4 py-3 border-b border-border shrink-0">
<SettingsNavigation
activeSection={activeSection}
onSectionChange={setActiveSection}
onClose={onClose}
variant="mobile"
/>
</div>
{/* Desktop header */}
<div className="hidden md:block px-6 py-4 border-b border-border shrink-0">
<h2 className="text-lg font-semibold">
{sectionTitles[activeSection]}
</h2>
<p className="text-sm text-muted-foreground mt-1">
{sectionDescriptions[activeSection]}
</p>
</div>
{/* Section content - scrollable */}
<div className="flex-1 min-h-0 overflow-y-auto px-6 py-4">
{renderSection()}
</div>
</div>
</div>
</DialogContent>
</Dialog>
);
}

View File

@@ -0,0 +1,300 @@
import { useState } from 'react';
import {
useLLMCatalog,
useSaveApiKey,
useProviderApiKey,
type LLMProvider,
} from '../../hooks/useLLM';
import { Button } from '../../ui/button';
import { Input } from '../../ui/input';
import { Label } from '../../ui/label';
import { Alert, AlertDescription } from '../../ui/alert';
import { Check, Eye, EyeOff, ExternalLink, Loader2 } from 'lucide-react';
// Provider info with display names and key URLs
const PROVIDER_INFO: Record<
string,
{ displayName: string; keyUrl?: string; description?: string }
> = {
openai: {
displayName: 'OpenAI',
keyUrl: 'https://platform.openai.com/api-keys',
description: 'GPT models',
},
anthropic: {
displayName: 'Anthropic',
keyUrl: 'https://console.anthropic.com/settings/keys',
description: 'Claude models',
},
google: {
displayName: 'Google AI',
keyUrl: 'https://aistudio.google.com/apikey',
description: 'Gemini models (Free tier available)',
},
groq: {
displayName: 'Groq',
keyUrl: 'https://console.groq.com/keys',
description: 'Fast inference',
},
xai: {
displayName: 'xAI',
keyUrl: 'https://console.x.ai/team/default/api-keys',
description: 'Grok models',
},
cohere: {
displayName: 'Cohere',
keyUrl: 'https://dashboard.cohere.com/api-keys',
description: 'Command models',
},
openrouter: {
displayName: 'OpenRouter',
keyUrl: 'https://openrouter.ai/keys',
description: 'Multi-provider gateway',
},
glama: {
displayName: 'Glama',
keyUrl: 'https://glama.ai/settings/api-keys',
description: 'OpenAI-compatible',
},
ollama: {
displayName: 'Ollama',
description: 'Local models (no key needed)',
},
local: {
displayName: 'Local',
description: 'GGUF models (no key needed)',
},
};
// Providers that don't need API keys or need special configuration
// These are handled by the ModelPicker's custom model form instead
const EXCLUDED_PROVIDERS = [
'ollama', // Local, no key needed
'local', // Local GGUF, no key needed
'openai-compatible', // Needs baseURL + model name (use ModelPicker)
'litellm', // Needs baseURL (use ModelPicker)
'bedrock', // Uses AWS credentials, not API key
'vertex', // Uses Google Cloud ADC, not API key
];
type ProviderRowProps = {
provider: LLMProvider;
hasKey: boolean;
envVar: string;
onSave: (key: string) => Promise<void>;
};
function ProviderRow({ provider, hasKey, envVar, onSave }: ProviderRowProps) {
const [isEditing, setIsEditing] = useState(false);
const [apiKey, setApiKey] = useState('');
const [showKey, setShowKey] = useState(false);
const [error, setError] = useState<string | null>(null);
const [isSaving, setIsSaving] = useState(false);
const [saveSuccess, setSaveSuccess] = useState(false);
const info = PROVIDER_INFO[provider] || { displayName: provider };
// Query for masked key value when has key
const { data: keyData } = useProviderApiKey(hasKey ? provider : null);
const handleSave = async () => {
if (!apiKey.trim()) {
setError('API key is required');
return;
}
setError(null);
setIsSaving(true);
try {
await onSave(apiKey);
setApiKey('');
setIsEditing(false);
setSaveSuccess(true);
setTimeout(() => setSaveSuccess(false), 2000);
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to save');
} finally {
setIsSaving(false);
}
};
const handleCancel = () => {
setIsEditing(false);
setApiKey('');
setError(null);
};
return (
<div className="py-3 px-4 rounded-lg border border-border">
<div className="flex items-start justify-between gap-4">
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<span className="font-medium">{info.displayName}</span>
{hasKey && !isEditing && (
<span className="flex items-center gap-1 text-xs text-green-600 dark:text-green-400">
<Check className="h-3 w-3" />
Configured
</span>
)}
{saveSuccess && (
<span className="text-xs text-green-600 dark:text-green-400">
Saved!
</span>
)}
</div>
<div className="text-sm text-muted-foreground">{info.description}</div>
{hasKey && keyData?.keyValue && !isEditing && (
<div className="mt-1 text-xs text-muted-foreground font-mono">
{keyData.keyValue}
</div>
)}
</div>
<div className="flex items-center gap-2 shrink-0">
{info.keyUrl && (
<Button
variant="ghost"
size="sm"
className="h-8 px-2"
onClick={() => window.open(info.keyUrl, '_blank')}
>
<ExternalLink className="h-4 w-4" />
</Button>
)}
{!isEditing ? (
<Button variant="outline" size="sm" onClick={() => setIsEditing(true)}>
{hasKey ? 'Update' : 'Add Key'}
</Button>
) : null}
</div>
</div>
{isEditing && (
<div className="mt-3 space-y-3">
<div className="space-y-2">
<Label className="text-xs text-muted-foreground">API Key ({envVar})</Label>
<div className="flex gap-2">
<div className="relative flex-1">
<Input
type={showKey ? 'text' : 'password'}
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
placeholder={`Enter ${info.displayName} API key`}
className="pr-10"
/>
<button
type="button"
onClick={() => setShowKey(!showKey)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
>
{showKey ? (
<EyeOff className="h-4 w-4" />
) : (
<Eye className="h-4 w-4" />
)}
</button>
</div>
</div>
</div>
{error && (
<Alert variant="destructive" className="py-2">
<AlertDescription className="text-sm">{error}</AlertDescription>
</Alert>
)}
<div className="flex justify-end gap-2">
<Button
variant="outline"
size="sm"
onClick={handleCancel}
disabled={isSaving}
>
Cancel
</Button>
<Button size="sm" onClick={handleSave} disabled={isSaving}>
{isSaving ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
Saving...
</>
) : (
'Save'
)}
</Button>
</div>
</div>
)}
</div>
);
}
export function ApiKeysSection() {
const { data: catalog, isLoading, error } = useLLMCatalog({ mode: 'grouped' });
const { mutateAsync: saveApiKey } = useSaveApiKey();
if (isLoading) {
return (
<div className="flex items-center justify-center py-8">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
);
}
if (error) {
return (
<Alert variant="destructive">
<AlertDescription>Failed to load providers: {error.message}</AlertDescription>
</Alert>
);
}
if (!catalog || !('providers' in catalog)) {
return (
<Alert>
<AlertDescription>No providers available</AlertDescription>
</Alert>
);
}
const providers = Object.entries(catalog.providers) as [
LLMProvider,
{ hasApiKey: boolean; primaryEnvVar: string },
][];
// Filter out providers handled elsewhere (openai-compatible is in Default Model)
const regularProviders = providers.filter(([id]) => !EXCLUDED_PROVIDERS.includes(id));
// Sort: configured first, then by display name
const sortedProviders = regularProviders.sort((a, b) => {
const aHasKey = a[1].hasApiKey;
const bHasKey = b[1].hasApiKey;
if (aHasKey !== bHasKey) return bHasKey ? 1 : -1;
const aName = PROVIDER_INFO[a[0]]?.displayName || a[0];
const bName = PROVIDER_INFO[b[0]]?.displayName || b[0];
return aName.localeCompare(bName);
});
const handleSave = async (provider: LLMProvider, apiKey: string) => {
await saveApiKey({ provider, apiKey });
};
return (
<div className="space-y-3">
<p className="text-sm text-muted-foreground">
API keys are stored securely in your local .env file and are never shared with third
parties.
</p>
{sortedProviders.map(([provider, info]) => (
<ProviderRow
key={provider}
provider={provider}
hasKey={info.hasApiKey}
envVar={info.primaryEnvVar}
onSave={(key) => handleSave(provider, key)}
/>
))}
</div>
);
}

View File

@@ -0,0 +1,64 @@
import { useTheme } from '../../hooks/useTheme';
import { usePreferenceStore } from '@/lib/stores/preferenceStore';
import { Label } from '../../ui/label';
import { Switch } from '../../ui/switch';
import { Moon, Sun, Zap } from 'lucide-react';
export function AppearanceSection() {
const { theme, toggleTheme } = useTheme();
const { isStreaming, setStreaming } = usePreferenceStore();
return (
<div className="space-y-6">
<p className="text-sm text-muted-foreground">
Customize the look and feel of the application.
</p>
{/* Theme Setting */}
<div className="space-y-4">
<div className="flex items-center justify-between py-3 px-4 rounded-lg border border-border">
<div className="flex items-center gap-3">
<div className="p-2 rounded-md bg-muted">
{theme === 'dark' ? (
<Moon className="h-4 w-4" />
) : (
<Sun className="h-4 w-4" />
)}
</div>
<div>
<Label className="text-sm font-medium">Dark Mode</Label>
<p className="text-sm text-muted-foreground">
Switch between light and dark themes
</p>
</div>
</div>
<Switch
checked={theme === 'dark'}
onCheckedChange={toggleTheme}
aria-label="Toggle dark mode"
/>
</div>
{/* Streaming Setting */}
<div className="flex items-center justify-between py-3 px-4 rounded-lg border border-border">
<div className="flex items-center gap-3">
<div className="p-2 rounded-md bg-muted">
<Zap className="h-4 w-4" />
</div>
<div>
<Label className="text-sm font-medium">Streaming Responses</Label>
<p className="text-sm text-muted-foreground">
Show responses as they are generated (recommended)
</p>
</div>
</div>
<Switch
checked={isStreaming}
onCheckedChange={setStreaming}
aria-label="Toggle streaming mode"
/>
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,27 @@
import { Label } from '../../ui/label';
import { SpeechVoiceSelect } from '../../ui/speech-voice-select';
type VoiceSectionProps = {
active?: boolean;
};
export function VoiceSection({ active = false }: VoiceSectionProps) {
return (
<div className="space-y-6">
<p className="text-sm text-muted-foreground">
Configure text-to-speech settings for voice output.
</p>
<div className="space-y-4">
<div className="space-y-2">
<Label htmlFor="voice-select">Voice Selection</Label>
<p className="text-sm text-muted-foreground mb-3">
Choose a preferred text-to-speech voice. "Auto" selects the best available
voice on your device.
</p>
<SpeechVoiceSelect id="voice-select" active={active} />
</div>
</div>
</div>
);
}