mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 18:36:23 +02:00
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.
19 lines
515 B
TypeScript
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 };
|
|
}
|