- 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>
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
/**
|
|
* Approval Context
|
|
*
|
|
* Provides approval handling functionality via React Context.
|
|
* Wraps the approvalStore to provide a clean API for components.
|
|
*/
|
|
|
|
import { createContext, useContext, useCallback, type ReactNode } from 'react';
|
|
import { useApprovalStore } from '@/lib/stores/approvalStore';
|
|
import type { ApprovalRequest } from '@dexto/core';
|
|
|
|
// =============================================================================
|
|
// Types
|
|
// =============================================================================
|
|
|
|
interface ApprovalContextType {
|
|
/**
|
|
* Handle an incoming approval request (add to store)
|
|
*/
|
|
handleApprovalRequest: (request: ApprovalRequest) => void;
|
|
}
|
|
|
|
// =============================================================================
|
|
// Context
|
|
// =============================================================================
|
|
|
|
const ApprovalContext = createContext<ApprovalContextType | null>(null);
|
|
|
|
// =============================================================================
|
|
// Provider
|
|
// =============================================================================
|
|
|
|
interface ApprovalProviderProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function ApprovalProvider({ children }: ApprovalProviderProps) {
|
|
const addApproval = useApprovalStore((s) => s.addApproval);
|
|
|
|
const handleApprovalRequest = useCallback(
|
|
(request: ApprovalRequest) => {
|
|
addApproval(request);
|
|
},
|
|
[addApproval]
|
|
);
|
|
|
|
return (
|
|
<ApprovalContext.Provider value={{ handleApprovalRequest }}>
|
|
{children}
|
|
</ApprovalContext.Provider>
|
|
);
|
|
}
|
|
|
|
// =============================================================================
|
|
// Hook
|
|
// =============================================================================
|
|
|
|
/**
|
|
* Hook to access approval handling functions
|
|
*
|
|
* @throws Error if used outside ApprovalProvider
|
|
*/
|
|
export function useApproval(): ApprovalContextType {
|
|
const context = useContext(ApprovalContext);
|
|
|
|
if (!context) {
|
|
throw new Error('useApproval must be used within an ApprovalProvider');
|
|
}
|
|
|
|
return context;
|
|
}
|