{"version":3,"sources":["../src/hooks/use-human-in-the-loop.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction } from \"../types\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n  available?: \"disabled\" | \"enabled\";\n  render: FrontendAction<T>[\"renderAndWaitForResponse\"];\n} & Pick<FrontendAction<T>, \"name\" | \"description\" | \"parameters\">;\n\nexport function useHumanInTheLoop<const T extends Parameter[] | [] = []>(\n  tool: UseToolCallArgs<T>,\n  dependencies?: any[],\n) {\n  const { render, ...toolRest } = tool;\n\n  useCopilotAction(\n    {\n      ...toolRest,\n      available: tool.available === \"disabled\" ? tool.available : \"remote\",\n      renderAndWaitForResponse: render,\n    },\n    dependencies,\n  );\n}\n"],"mappings":";;;;;;;;;;AASO,SAAS,kBACd,MACA,cACA;AACA,QAAgC,WAAxB,SAbV,IAakC,IAAb,qBAAa,IAAb,CAAX;AAER;AAAA,IACE,iCACK,WADL;AAAA,MAEE,WAAW,KAAK,cAAc,aAAa,KAAK,YAAY;AAAA,MAC5D,0BAA0B;AAAA,IAC5B;AAAA,IACA;AAAA,EACF;AACF;","names":[]}