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:
74
dexto/packages/webui/components/hooks/useServerRegistry.ts
Normal file
74
dexto/packages/webui/components/hooks/useServerRegistry.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import { useState } from 'react';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { serverRegistry } from '@/lib/serverRegistry';
|
||||
import type { ServerRegistryEntry, ServerRegistryFilter } from '@dexto/registry';
|
||||
import { queryKeys } from '@/lib/queryKeys.js';
|
||||
|
||||
interface UseServerRegistryOptions {
|
||||
autoLoad?: boolean;
|
||||
initialFilter?: ServerRegistryFilter;
|
||||
}
|
||||
|
||||
export function useServerRegistry(options: UseServerRegistryOptions = {}) {
|
||||
const { autoLoad = true, initialFilter } = options;
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const [filter, setFilter] = useState<ServerRegistryFilter>(initialFilter || {});
|
||||
|
||||
const {
|
||||
data: entries = [],
|
||||
isLoading,
|
||||
error,
|
||||
} = useQuery({
|
||||
queryKey: queryKeys.serverRegistry(filter),
|
||||
queryFn: () => serverRegistry.getEntries(filter),
|
||||
enabled: autoLoad,
|
||||
});
|
||||
|
||||
const markAsInstalledMutation = useMutation({
|
||||
mutationFn: async (entryId: string) => {
|
||||
await serverRegistry.setInstalled(entryId, true);
|
||||
return entryId;
|
||||
},
|
||||
onSuccess: (entryId) => {
|
||||
// Optimistically update the cache
|
||||
queryClient.setQueryData<ServerRegistryEntry[]>(
|
||||
queryKeys.serverRegistry(filter),
|
||||
(old) =>
|
||||
old?.map((entry) =>
|
||||
entry.id === entryId ? { ...entry, isInstalled: true } : entry
|
||||
) ?? []
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const updateFilter = (newFilter: ServerRegistryFilter) => {
|
||||
setFilter(newFilter);
|
||||
};
|
||||
|
||||
const loadEntries = async (newFilter?: ServerRegistryFilter) => {
|
||||
if (newFilter) {
|
||||
setFilter(newFilter);
|
||||
} else {
|
||||
// Trigger a refetch with current filter
|
||||
await queryClient.refetchQueries({ queryKey: queryKeys.serverRegistry(filter) });
|
||||
}
|
||||
};
|
||||
|
||||
const markAsInstalled = async (entryId: string) => {
|
||||
await markAsInstalledMutation.mutateAsync(entryId);
|
||||
};
|
||||
|
||||
return {
|
||||
entries,
|
||||
isLoading,
|
||||
error: error?.message ?? null,
|
||||
filter,
|
||||
loadEntries,
|
||||
updateFilter,
|
||||
markAsInstalled,
|
||||
clearError: () => {
|
||||
// Errors are automatically cleared when query succeeds
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user