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:
62
dexto/packages/webui/components/hooks/useApprovals.ts
Normal file
62
dexto/packages/webui/components/hooks/useApprovals.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { client } from '@/lib/client';
|
||||
import { queryKeys } from '@/lib/queryKeys';
|
||||
|
||||
type ApprovalPayload = Parameters<(typeof client.api.approvals)[':approvalId']['$post']>[0]['json'];
|
||||
|
||||
export function useSubmitApproval() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (
|
||||
payload: { approvalId: string; sessionId: string } & ApprovalPayload
|
||||
) => {
|
||||
const { approvalId, sessionId: _sessionId, ...body } = payload;
|
||||
const response = await client.api.approvals[':approvalId'].$post({
|
||||
param: { approvalId },
|
||||
json: body,
|
||||
header: {},
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to submit approval: ${response.status}`);
|
||||
}
|
||||
return await response.json();
|
||||
},
|
||||
onSuccess: (_, variables) => {
|
||||
// Invalidate pending approvals cache when an approval is submitted
|
||||
// Query is keyed by sessionId, not approvalId
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.approvals.pending(variables.sessionId),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch pending approvals for a session.
|
||||
* Use this to restore approval UI state after page refresh.
|
||||
*
|
||||
* @param sessionId - The session ID to fetch pending approvals for
|
||||
* @param options.enabled - Whether to enable the query (default: true if sessionId provided)
|
||||
*/
|
||||
export function usePendingApprovals(sessionId: string | null, options?: { enabled?: boolean }) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.approvals.pending(sessionId || ''),
|
||||
queryFn: async () => {
|
||||
if (!sessionId) return { approvals: [] };
|
||||
const response = await client.api.approvals.$get({
|
||||
query: { sessionId },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch pending approvals');
|
||||
}
|
||||
return await response.json();
|
||||
},
|
||||
enabled: (options?.enabled ?? true) && !!sessionId,
|
||||
});
|
||||
}
|
||||
|
||||
// Export inferred types for consumers
|
||||
export type PendingApproval = NonNullable<
|
||||
ReturnType<typeof usePendingApprovals>['data']
|
||||
>['approvals'][number];
|
||||
Reference in New Issue
Block a user