SurfSense/surfsense_web/lib/hitl/use-hitl-decision.ts
Anish Sarkar 1c9c496e01 feat: implement MCP Tool Trust methods for managing trusted tools
Added methods to trust and untrust tools in the MCP connector's "Always Allow" list, allowing for streamlined tool usage without HITL approval. This enhancement supports better management of trusted tools within the application.
2026-04-13 20:21:46 +05:30

19 lines
515 B
TypeScript

/**
* Shared hook for dispatching HITL decisions.
*
* All tool-ui components that handle approve/reject/edit should use this
* instead of manually constructing `CustomEvent("hitl-decision", ...)`.
*/
import { useCallback } from "react";
import type { HitlDecision } from "./types";
export function useHitlDecision() {
const dispatch = useCallback((decisions: HitlDecision[]) => {
window.dispatchEvent(
new CustomEvent("hitl-decision", { detail: { decisions } }),
);
}, []);
return { dispatch };
}