@copilotkit/react-core 1.10.6-next.0 → 1.10.6-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunk-6GPVUMBU.mjs +13 -0
  3. package/dist/chunk-6GPVUMBU.mjs.map +1 -0
  4. package/dist/{chunk-TSH4IP44.mjs → chunk-774NTLIU.mjs} +2 -2
  5. package/dist/chunk-774NTLIU.mjs.map +1 -0
  6. package/dist/chunk-AKR2SSUJ.mjs +22 -0
  7. package/dist/chunk-AKR2SSUJ.mjs.map +1 -0
  8. package/dist/{chunk-JH5AMI6B.mjs → chunk-CQGHSMOM.mjs} +2 -2
  9. package/dist/{chunk-EON7C3TF.mjs → chunk-CXXRFRCY.mjs} +2 -2
  10. package/dist/chunk-DZTU6PGS.mjs +1 -0
  11. package/dist/chunk-EVVO67QO.mjs +25 -0
  12. package/dist/chunk-EVVO67QO.mjs.map +1 -0
  13. package/dist/{chunk-P5VXUNHA.mjs → chunk-JMALWN4Z.mjs} +2 -2
  14. package/dist/{chunk-3TQAH3WJ.mjs → chunk-KPCLYTU3.mjs} +7 -7
  15. package/dist/chunk-MQYWH4E6.mjs +17 -0
  16. package/dist/chunk-MQYWH4E6.mjs.map +1 -0
  17. package/dist/{chunk-SVRPN33M.mjs → chunk-N3Q6EUTG.mjs} +2 -2
  18. package/dist/{chunk-MAP5DCLU.mjs → chunk-Z6SYWW3S.mjs} +2 -2
  19. package/dist/components/copilot-provider/copilotkit.mjs +4 -4
  20. package/dist/components/copilot-provider/index.mjs +4 -4
  21. package/dist/components/index.mjs +4 -4
  22. package/dist/hooks/index.d.ts +4 -0
  23. package/dist/hooks/index.js +42 -2
  24. package/dist/hooks/index.js.map +1 -1
  25. package/dist/hooks/index.mjs +30 -14
  26. package/dist/hooks/use-coagent.js.map +1 -1
  27. package/dist/hooks/use-coagent.mjs +6 -6
  28. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  29. package/dist/hooks/use-copilot-chat-headless_c.mjs +6 -6
  30. package/dist/hooks/use-copilot-chat.js.map +1 -1
  31. package/dist/hooks/use-copilot-chat.mjs +6 -6
  32. package/dist/hooks/use-copilot-chat_internal.d.ts +1 -1
  33. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  34. package/dist/hooks/use-copilot-chat_internal.mjs +5 -5
  35. package/dist/hooks/use-default-tool.d.ts +8 -0
  36. package/dist/hooks/use-default-tool.js +435 -0
  37. package/dist/hooks/use-default-tool.js.map +1 -0
  38. package/dist/hooks/use-default-tool.mjs +13 -0
  39. package/dist/hooks/use-default-tool.mjs.map +1 -0
  40. package/dist/hooks/use-frontend-tool.d.ts +11 -0
  41. package/dist/hooks/use-frontend-tool.js +432 -0
  42. package/dist/hooks/use-frontend-tool.js.map +1 -0
  43. package/dist/hooks/use-frontend-tool.mjs +13 -0
  44. package/dist/hooks/use-frontend-tool.mjs.map +1 -0
  45. package/dist/hooks/use-human-in-the-loop.d.ts +12 -0
  46. package/dist/hooks/use-human-in-the-loop.js +454 -0
  47. package/dist/hooks/use-human-in-the-loop.js.map +1 -0
  48. package/dist/hooks/use-human-in-the-loop.mjs +13 -0
  49. package/dist/hooks/use-human-in-the-loop.mjs.map +1 -0
  50. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  51. package/dist/hooks/use-langgraph-interrupt.mjs +6 -6
  52. package/dist/hooks/use-render-tool-call.d.ts +11 -0
  53. package/dist/hooks/use-render-tool-call.js +440 -0
  54. package/dist/hooks/use-render-tool-call.js.map +1 -0
  55. package/dist/hooks/use-render-tool-call.mjs +13 -0
  56. package/dist/hooks/use-render-tool-call.mjs.map +1 -0
  57. package/dist/index.d.ts +4 -0
  58. package/dist/index.js +42 -2
  59. package/dist/index.js.map +1 -1
  60. package/dist/index.mjs +34 -18
  61. package/dist/lib/copilot-task.mjs +5 -5
  62. package/dist/lib/index.mjs +5 -5
  63. package/dist/utils/extract.mjs +4 -4
  64. package/dist/utils/index.mjs +6 -6
  65. package/dist/utils/suggestions.mjs +4 -4
  66. package/package.json +3 -3
  67. package/src/hooks/index.ts +4 -0
  68. package/src/hooks/use-copilot-chat_internal.ts +1 -1
  69. package/src/hooks/use-default-tool.ts +7 -0
  70. package/src/hooks/use-frontend-tool.ts +18 -0
  71. package/src/hooks/use-human-in-the-loop.ts +24 -0
  72. package/src/hooks/use-render-tool-call.ts +20 -0
  73. package/dist/chunk-KDAZGZ24.mjs +0 -1
  74. package/dist/chunk-TSH4IP44.mjs.map +0 -1
  75. /package/dist/{chunk-JH5AMI6B.mjs.map → chunk-CQGHSMOM.mjs.map} +0 -0
  76. /package/dist/{chunk-EON7C3TF.mjs.map → chunk-CXXRFRCY.mjs.map} +0 -0
  77. /package/dist/{chunk-KDAZGZ24.mjs.map → chunk-DZTU6PGS.mjs.map} +0 -0
  78. /package/dist/{chunk-P5VXUNHA.mjs.map → chunk-JMALWN4Z.mjs.map} +0 -0
  79. /package/dist/{chunk-3TQAH3WJ.mjs.map → chunk-KPCLYTU3.mjs.map} +0 -0
  80. /package/dist/{chunk-SVRPN33M.mjs.map → chunk-N3Q6EUTG.mjs.map} +0 -0
  81. /package/dist/{chunk-MAP5DCLU.mjs.map → chunk-Z6SYWW3S.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # ui
2
2
 
3
+ ## 1.10.6-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ac64bf: - fix: allow disabling actions in the new action hooks
8
+ - @copilotkit/runtime-client-gql@1.10.6-next.2
9
+ - @copilotkit/shared@1.10.6-next.2
10
+
11
+ ## 1.10.6-next.1
12
+
13
+ ### Patch Changes
14
+
15
+ - c9e499f: - feat: create targeted convenience wrappers around copilot action
16
+ - @copilotkit/runtime-client-gql@1.10.6-next.1
17
+ - @copilotkit/shared@1.10.6-next.1
18
+
3
19
  ## 1.10.6-next.0
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ import {
2
+ useCopilotAction
3
+ } from "./chunk-T3376SZS.mjs";
4
+
5
+ // src/hooks/use-frontend-tool.ts
6
+ function useFrontendTool(tool, dependencies) {
7
+ useCopilotAction(tool, dependencies);
8
+ }
9
+
10
+ export {
11
+ useFrontendTool
12
+ };
13
+ //# sourceMappingURL=chunk-6GPVUMBU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-frontend-tool.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction } from \"../types/frontend-action\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | \"enabled\";\n} & Pick<\n FrontendAction<T>,\n \"name\" | \"description\" | \"parameters\" | \"handler\" | \"followUp\" | \"render\"\n>;\n\nexport function useFrontendTool<const T extends Parameter[] | [] = []>(\n tool: UseToolCallArgs<T>,\n dependencies?: any[],\n) {\n // Use the existing useCopilotAction hook\n useCopilotAction<T>(tool, dependencies);\n}\n"],"mappings":";;;;;AAWO,SAAS,gBACd,MACA,cACA;AAEA,mBAAoB,MAAM,YAAY;AACxC;","names":[]}
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  defaultCopilotContextCategories,
9
9
  reloadSuggestions
10
- } from "./chunk-3TQAH3WJ.mjs";
10
+ } from "./chunk-KPCLYTU3.mjs";
11
11
  import {
12
12
  useAsyncCallback
13
13
  } from "./chunk-N4WEHORG.mjs";
@@ -329,4 +329,4 @@ export {
329
329
  useCopilotChat,
330
330
  defaultSystemMessage
331
331
  };
332
- //# sourceMappingURL=chunk-TSH4IP44.mjs.map
332
+ //# sourceMappingURL=chunk-774NTLIU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-copilot-chat_internal.ts"],"sourcesContent":["import { useRef, useEffect, useCallback, useState, useMemo } from \"react\";\nimport { AgentSession, useCopilotContext, CopilotContextParams } from \"../context/copilot-context\";\nimport { useCopilotMessagesContext, CopilotMessagesContextParams } from \"../context\";\nimport { SystemMessageFunction } from \"../types\";\nimport { useChat, AppendMessageOptions } from \"./use-chat\";\nimport { defaultCopilotContextCategories } from \"../components\";\nimport { CoAgentStateRenderHandlerArguments } from \"@copilotkit/shared\";\nimport { useAsyncCallback } from \"../components/error-boundary/error-utils\";\nimport { reloadSuggestions as generateSuggestions } from \"../utils\";\nimport type { SuggestionItem } from \"../utils\";\n\nimport { Message } from \"@copilotkit/shared\";\nimport {\n Role as gqlRole,\n TextMessage,\n aguiToGQL,\n gqlToAGUI,\n Message as DeprecatedGqlMessage,\n} from \"@copilotkit/runtime-client-gql\";\nimport { useLangGraphInterruptRender } from \"./use-langgraph-interrupt-render\";\n\nexport interface UseCopilotChatOptions {\n /**\n * A unique identifier for the chat. If not provided, a random one will be\n * generated. When provided, the `useChat` hook with the same `id` will\n * have shared states across components.\n */\n id?: string;\n\n /**\n * HTTP headers to be sent with the API request.\n */\n headers?: Record<string, string> | Headers;\n\n /**\n * Initial messages to populate the chat with.\n */\n initialMessages?: Message[];\n\n /**\n * A function to generate the system message. Defaults to `defaultSystemMessage`.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).\n */\n disableSystemMessage?: boolean;\n}\n\nexport interface MCPServerConfig {\n endpoint: string;\n apiKey?: string;\n}\n\nexport interface UseCopilotChatReturn {\n /**\n * @deprecated use `messages` instead, this is an old non ag-ui version of the messages\n * Array of messages currently visible in the chat interface\n *\n * This is the visible messages, not the raw messages from the runtime client.\n */\n visibleMessages: DeprecatedGqlMessage[];\n\n /**\n * The messages that are currently in the chat in AG-UI format.\n */\n messages: Message[];\n\n /** @deprecated use `sendMessage` in `useCopilotChatHeadless_c` instead. This will be removed in a future major version. */\n appendMessage: (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Send a new message to the chat\n *\n * ```tsx\n * await sendMessage({\n * id: \"123\",\n * role: \"user\",\n * content: \"Hello, process this request\",\n * });\n * ```\n */\n sendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;\n\n /**\n * Replace all messages in the chat\n *\n * ```tsx\n * setMessages([\n * { id: \"123\", role: \"user\", content: \"Hello, process this request\" },\n * { id: \"456\", role: \"assistant\", content: \"Hello, I'm the assistant\" },\n * ]);\n * ```\n *\n * **Deprecated** non-ag-ui version:\n *\n * ```tsx\n * setMessages([\n * new TextMessage({\n * content: \"Hello, process this request\",\n * role: gqlRole.User,\n * }),\n * new TextMessage({\n * content: \"Hello, I'm the assistant\",\n * role: gqlRole.Assistant,\n * ]);\n * ```\n *\n */\n setMessages: (messages: Message[] | DeprecatedGqlMessage[]) => void;\n\n /**\n * Remove a specific message by ID\n *\n * ```tsx\n * deleteMessage(\"123\");\n * ```\n */\n deleteMessage: (messageId: string) => void;\n\n /**\n * Regenerate the response for a specific message\n *\n * ```tsx\n * reloadMessages(\"123\");\n * ```\n */\n reloadMessages: (messageId: string) => Promise<void>;\n\n /**\n * Stop the current message generation\n *\n * ```tsx\n * if (isLoading) {\n * stopGeneration();\n * }\n * ```\n */\n stopGeneration: () => void;\n\n /**\n * Clear all messages and reset chat state\n *\n * ```tsx\n * reset();\n * console.log(messages); // []\n * ```\n */\n reset: () => void;\n\n /**\n * Whether the chat is currently generating a response\n *\n * ```tsx\n * if (isLoading) {\n * console.log(\"Loading...\");\n * } else {\n * console.log(\"Not loading\");\n * }\n */\n isLoading: boolean;\n\n /** Manually trigger chat completion (advanced usage) */\n runChatCompletion: () => Promise<Message[]>;\n\n /** MCP (Model Context Protocol) server configurations */\n mcpServers: MCPServerConfig[];\n\n /** Update MCP server configurations */\n setMcpServers: (mcpServers: MCPServerConfig[]) => void;\n\n /**\n * Current suggestions array\n * Use this to read the current suggestions or in conjunction with setSuggestions for manual control\n */\n suggestions: SuggestionItem[];\n\n /**\n * Manually set suggestions\n * Useful for manual mode or custom suggestion workflows\n */\n setSuggestions: (suggestions: SuggestionItem[]) => void;\n\n /**\n * Trigger AI-powered suggestion generation\n * Uses configurations from useCopilotChatSuggestions hooks\n * Respects global debouncing - only one generation can run at a time\n *\n * ```tsx\n * generateSuggestions();\n * console.log(suggestions); // [suggestion1, suggestion2, suggestion3]\n * ```\n */\n generateSuggestions: () => Promise<void>;\n\n /**\n * Clear all current suggestions\n * Also resets suggestion generation state\n */\n resetSuggestions: () => void;\n\n /** Whether suggestions are currently being generated */\n isLoadingSuggestions: boolean;\n\n /** Interrupt content for human-in-the-loop workflows */\n interrupt: string | React.ReactElement | null;\n}\n\nlet globalSuggestionPromise: Promise<void> | null = null;\n\nexport function useCopilotChat(options: UseCopilotChatOptions = {}): UseCopilotChatReturn {\n const makeSystemMessage = options.makeSystemMessage ?? defaultSystemMessage;\n const {\n getContextString,\n getFunctionCallHandler,\n copilotApiConfig,\n isLoading,\n setIsLoading,\n chatInstructions,\n actions,\n coagentStatesRef,\n setCoagentStatesWithRef,\n coAgentStateRenders,\n agentSession,\n setAgentSession,\n forwardedParameters,\n agentLock,\n threadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n extensions,\n setExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n chatSuggestionConfiguration,\n\n runtimeClient,\n } = useCopilotContext();\n const { messages, setMessages, suggestions, setSuggestions } = useCopilotMessagesContext();\n\n // Simple state for MCP servers (keep for interface compatibility)\n const [mcpServers, setLocalMcpServers] = useState<MCPServerConfig[]>([]);\n\n // Basic suggestion state for programmatic control\n const suggestionsAbortControllerRef = useRef<AbortController | null>(null);\n const isLoadingSuggestionsRef = useRef<boolean>(false);\n\n const abortSuggestions = useCallback(\n (clear: boolean = true) => {\n suggestionsAbortControllerRef.current?.abort(\"suggestions aborted by user\");\n suggestionsAbortControllerRef.current = null;\n if (clear) {\n setSuggestions([]);\n }\n },\n [setSuggestions],\n );\n\n // Memoize context with stable dependencies only\n const stableContext = useMemo(() => {\n return {\n actions,\n copilotApiConfig,\n chatSuggestionConfiguration,\n messages,\n setMessages,\n getContextString,\n runtimeClient,\n };\n }, [\n JSON.stringify(Object.keys(actions)),\n copilotApiConfig.chatApiEndpoint,\n messages.length,\n Object.keys(chatSuggestionConfiguration).length,\n ]);\n\n // Programmatic suggestion generation function\n const generateSuggestionsFunc = useCallback(async () => {\n // If a global suggestion is running, ignore this call\n if (globalSuggestionPromise) {\n return globalSuggestionPromise;\n }\n\n globalSuggestionPromise = (async () => {\n try {\n abortSuggestions();\n isLoadingSuggestionsRef.current = true;\n suggestionsAbortControllerRef.current = new AbortController();\n\n setSuggestions([]);\n\n await generateSuggestions(\n stableContext as CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration,\n setSuggestions,\n suggestionsAbortControllerRef,\n );\n } catch (error) {\n // Re-throw to allow caller to handle the error\n throw error;\n } finally {\n isLoadingSuggestionsRef.current = false;\n globalSuggestionPromise = null;\n }\n })();\n\n return globalSuggestionPromise;\n }, [stableContext, chatSuggestionConfiguration, setSuggestions, abortSuggestions]);\n\n const resetSuggestions = useCallback(() => {\n setSuggestions([]);\n }, [setSuggestions]);\n\n // MCP servers logic\n useEffect(() => {\n if (mcpServers.length > 0) {\n const serversCopy = [...mcpServers];\n copilotApiConfig.mcpServers = serversCopy;\n if (!copilotApiConfig.properties) {\n copilotApiConfig.properties = {};\n }\n copilotApiConfig.properties.mcpServers = serversCopy;\n }\n }, [mcpServers, copilotApiConfig]);\n\n const setMcpServers = useCallback((servers: MCPServerConfig[]) => {\n setLocalMcpServers(servers);\n }, []);\n\n // Move these function declarations above the useChat call\n const onCoAgentStateRender = useAsyncCallback(\n async (args: CoAgentStateRenderHandlerArguments) => {\n const { name, nodeName, state } = args;\n let action = Object.values(coAgentStateRenders).find(\n (action) => action.name === name && action.nodeName === nodeName,\n );\n if (!action) {\n action = Object.values(coAgentStateRenders).find(\n (action) => action.name === name && !action.nodeName,\n );\n }\n if (action) {\n await action.handler?.({ state, nodeName });\n }\n },\n [coAgentStateRenders],\n );\n\n const makeSystemMessageCallback = useCallback(() => {\n const systemMessageMaker = makeSystemMessage || defaultSystemMessage;\n // this always gets the latest context string\n const contextString = getContextString([], defaultCopilotContextCategories); // TODO: make the context categories configurable\n\n return new TextMessage({\n content: systemMessageMaker(contextString, chatInstructions),\n role: gqlRole.System,\n });\n }, [getContextString, makeSystemMessage, chatInstructions]);\n\n const deleteMessage = useCallback(\n (messageId: string) => {\n setMessages((prev) => prev.filter((message) => message.id !== messageId));\n },\n [setMessages],\n );\n\n // Get chat helpers with updated config\n const { append, reload, stop, runChatCompletion } = useChat({\n ...options,\n actions: Object.values(actions),\n copilotConfig: copilotApiConfig,\n initialMessages: aguiToGQL(options.initialMessages || []),\n onFunctionCall: getFunctionCallHandler(),\n onCoAgentStateRender,\n messages,\n setMessages,\n makeSystemMessageCallback,\n isLoading,\n setIsLoading,\n coagentStatesRef,\n setCoagentStatesWithRef,\n agentSession,\n setAgentSession,\n forwardedParameters,\n threadId,\n setThreadId,\n runId,\n setRunId,\n chatAbortControllerRef,\n agentLock,\n extensions,\n setExtensions,\n langGraphInterruptAction,\n setLangGraphInterruptAction,\n disableSystemMessage: options.disableSystemMessage,\n });\n\n const latestAppend = useUpdatedRef(append);\n const latestAppendFunc = useAsyncCallback(\n async (message: DeprecatedGqlMessage, options?: AppendMessageOptions) => {\n abortSuggestions(options?.clearSuggestions);\n return await latestAppend.current(message, options);\n },\n [latestAppend],\n );\n\n const latestSendMessageFunc = useAsyncCallback(\n async (message: Message, options?: AppendMessageOptions) => {\n abortSuggestions(options?.clearSuggestions);\n return await latestAppend.current(aguiToGQL([message])[0] as DeprecatedGqlMessage, options);\n },\n [latestAppend],\n );\n\n const latestReload = useUpdatedRef(reload);\n const latestReloadFunc = useAsyncCallback(\n async (messageId: string) => {\n return await latestReload.current(messageId);\n },\n [latestReload],\n );\n\n const latestStop = useUpdatedRef(stop);\n const latestStopFunc = useCallback(() => {\n return latestStop.current();\n }, [latestStop]);\n\n const latestDelete = useUpdatedRef(deleteMessage);\n const latestDeleteFunc = useCallback(\n (messageId: string) => {\n return latestDelete.current(messageId);\n },\n [latestDelete],\n );\n\n const latestSetMessages = useUpdatedRef(setMessages);\n const latestSetMessagesFunc = useCallback(\n (messages: Message[] | DeprecatedGqlMessage[]) => {\n if (messages.every((message) => message instanceof DeprecatedGqlMessage)) {\n return latestSetMessages.current(messages as DeprecatedGqlMessage[]);\n }\n return latestSetMessages.current(aguiToGQL(messages));\n },\n [latestSetMessages],\n );\n\n const latestRunChatCompletion = useUpdatedRef(runChatCompletion);\n const latestRunChatCompletionFunc = useAsyncCallback(async () => {\n return await latestRunChatCompletion.current!();\n }, [latestRunChatCompletion]);\n\n const reset = useCallback(() => {\n latestStopFunc();\n setMessages([]);\n setRunId(null);\n setCoagentStatesWithRef({});\n let initialAgentSession: AgentSession | null = null;\n if (agentLock) {\n initialAgentSession = {\n agentName: agentLock,\n };\n }\n setAgentSession(initialAgentSession);\n // Reset suggestions when chat is reset\n resetSuggestions();\n }, [\n latestStopFunc,\n setMessages,\n setThreadId,\n setCoagentStatesWithRef,\n setAgentSession,\n agentLock,\n resetSuggestions,\n ]);\n\n const latestReset = useUpdatedRef(reset);\n const latestResetFunc = useCallback(() => {\n return latestReset.current();\n }, [latestReset]);\n\n const interrupt = useLangGraphInterruptRender();\n\n return {\n visibleMessages: messages,\n messages: gqlToAGUI(messages, actions, coAgentStateRenders),\n sendMessage: latestSendMessageFunc,\n appendMessage: latestAppendFunc,\n setMessages: latestSetMessagesFunc,\n reloadMessages: latestReloadFunc,\n stopGeneration: latestStopFunc,\n reset: latestResetFunc,\n deleteMessage: latestDeleteFunc,\n runChatCompletion: latestRunChatCompletionFunc,\n isLoading,\n mcpServers,\n setMcpServers,\n suggestions,\n setSuggestions,\n generateSuggestions: generateSuggestionsFunc,\n resetSuggestions,\n isLoadingSuggestions: isLoadingSuggestionsRef.current,\n interrupt,\n };\n}\n\n// store `value` in a ref and update\n// it whenever it changes.\nfunction useUpdatedRef<T>(value: T) {\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n}\n\nexport function defaultSystemMessage(\n contextString: string,\n additionalInstructions?: string,\n): string {\n return (\n `\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\\`\\`\\`\n${contextString}\n\\`\\`\\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.\n\nPlease assist them as best you can.\n\nYou can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.\n\nIf you would like to call a function, call it without saying anything else.\nIn case of a function error:\n- If this error stems from incorrect function parameters or syntax, you may retry with corrected arguments.\n- If the error's source is unclear or seems unrelated to your input, do not attempt further retries.\n` + (additionalInstructions ? `\\n\\n${additionalInstructions}` : \"\")\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,WAAW,aAAa,UAAU,eAAe;AAYlE;AAAA,EACE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,OACN;AA+LP,IAAI,0BAAgD;AAE7C,SAAS,eAAe,UAAiC,CAAC,GAAyB;AAnN1F;AAoNE,QAAM,qBAAoB,aAAQ,sBAAR,YAA6B;AACvD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EACF,IAA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L,iBAAiB;AAAA,IACjB,UAAU,UAAU,UAAU,SAAS,mBAAmB;AAAA,IAC1D,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA,IACA,sBAAsB,wBAAwB;AAAA,IAC9C;AAAA,EACF;AACF;AAIA,SAAS,cAAiB,OAAU;AAClC,QAAM,MAAM,OAAO,KAAK;AAExB,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;AAEO,SAAS,qBACd,eACA,wBACQ;AACR,SACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAaG,yBAAyB;AAAA;AAAA,EAAO,2BAA2B;AAEhE;","names":["_a","action","options","messages"]}
@@ -0,0 +1,22 @@
1
+ import {
2
+ useCopilotAction
3
+ } from "./chunk-T3376SZS.mjs";
4
+ import {
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "./chunk-SKC7AJIV.mjs";
8
+
9
+ // src/hooks/use-render-tool-call.ts
10
+ function useRenderToolCall(tool, dependencies) {
11
+ useCopilotAction(
12
+ __spreadProps(__spreadValues({}, tool), {
13
+ available: tool.available === "disabled" ? tool.available : "frontend"
14
+ }),
15
+ dependencies
16
+ );
17
+ }
18
+
19
+ export {
20
+ useRenderToolCall
21
+ };
22
+ //# sourceMappingURL=chunk-AKR2SSUJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-render-tool-call.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { FrontendAction, FrontendActionAvailability } from \"../types\";\nimport { Parameter } from \"@copilotkit/shared\";\n\ntype UseToolCallArgs<T extends Parameter[] | [] = []> = {\n available?: \"disabled\" | \"enabled\";\n} & Pick<FrontendAction<T>, \"name\" | \"description\" | \"parameters\" | \"render\">;\n\nexport function useRenderToolCall<const T extends Parameter[] | [] = []>(\n tool: UseToolCallArgs<T>,\n dependencies?: any[],\n) {\n useCopilotAction<T>(\n {\n ...tool,\n available: tool.available === \"disabled\" ? tool.available : \"frontend\",\n },\n dependencies,\n );\n}\n"],"mappings":";;;;;;;;;AAQO,SAAS,kBACd,MACA,cACA;AACA;AAAA,IACE,iCACK,OADL;AAAA,MAEE,WAAW,KAAK,cAAc,aAAa,KAAK,YAAY;AAAA,IAC9D;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4CEQJ2X6.mjs";
4
4
  import {
5
5
  defaultCopilotContextCategories
6
- } from "./chunk-3TQAH3WJ.mjs";
6
+ } from "./chunk-KPCLYTU3.mjs";
7
7
  import {
8
8
  __async,
9
9
  __spreadValues
@@ -117,4 +117,4 @@ ${instructions}
117
117
  export {
118
118
  CopilotTask
119
119
  };
120
- //# sourceMappingURL=chunk-JH5AMI6B.mjs.map
120
+ //# sourceMappingURL=chunk-CQGHSMOM.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChat
3
- } from "./chunk-TSH4IP44.mjs";
3
+ } from "./chunk-774NTLIU.mjs";
4
4
  import {
5
5
  useCopilotContext
6
6
  } from "./chunk-EUX2P2E7.mjs";
@@ -82,4 +82,4 @@ function useCopilotChatHeadless_c(options = {}) {
82
82
  export {
83
83
  useCopilotChatHeadless_c
84
84
  };
85
- //# sourceMappingURL=chunk-EON7C3TF.mjs.map
85
+ //# sourceMappingURL=chunk-CXXRFRCY.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-DZTU6PGS.mjs.map
@@ -0,0 +1,25 @@
1
+ import {
2
+ useCopilotAction
3
+ } from "./chunk-T3376SZS.mjs";
4
+ import {
5
+ __objRest,
6
+ __spreadProps,
7
+ __spreadValues
8
+ } from "./chunk-SKC7AJIV.mjs";
9
+
10
+ // src/hooks/use-human-in-the-loop.ts
11
+ function useHumanInTheLoop(tool, dependencies) {
12
+ const _a = tool, { render } = _a, toolRest = __objRest(_a, ["render"]);
13
+ useCopilotAction(
14
+ __spreadProps(__spreadValues({}, toolRest), {
15
+ available: tool.available === "disabled" ? tool.available : "remote",
16
+ renderAndWaitForResponse: render
17
+ }),
18
+ dependencies
19
+ );
20
+ }
21
+
22
+ export {
23
+ useHumanInTheLoop
24
+ };
25
+ //# sourceMappingURL=chunk-EVVO67QO.mjs.map
@@ -0,0 +1 @@
1
+ {"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":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChat
3
- } from "./chunk-TSH4IP44.mjs";
3
+ } from "./chunk-774NTLIU.mjs";
4
4
  import {
5
5
  useMessagesTap
6
6
  } from "./chunk-C6IANC2R.mjs";
@@ -236,4 +236,4 @@ export {
236
236
  stopAgent,
237
237
  runAgent
238
238
  };
239
- //# sourceMappingURL=chunk-P5VXUNHA.mjs.map
239
+ //# sourceMappingURL=chunk-JMALWN4Z.mjs.map
@@ -1,3 +1,7 @@
1
+ import {
2
+ CopilotMessages,
3
+ MessagesTapProvider
4
+ } from "./chunk-C6IANC2R.mjs";
1
5
  import {
2
6
  CopilotErrorBoundary
3
7
  } from "./chunk-N4VN2B5S.mjs";
@@ -5,15 +9,11 @@ import {
5
9
  ConsoleTrigger
6
10
  } from "./chunk-DXEQPN43.mjs";
7
11
  import {
8
- CopilotMessages,
9
- MessagesTapProvider
10
- } from "./chunk-C6IANC2R.mjs";
12
+ use_tree_default
13
+ } from "./chunk-RKTVJRK7.mjs";
11
14
  import {
12
15
  use_flat_category_store_default
13
16
  } from "./chunk-5FHSUKQL.mjs";
14
- import {
15
- use_tree_default
16
- } from "./chunk-RKTVJRK7.mjs";
17
17
  import {
18
18
  useCopilotRuntimeClient
19
19
  } from "./chunk-Q3MCVRO3.mjs";
@@ -801,4 +801,4 @@ export {
801
801
  CopilotKitInternal,
802
802
  defaultCopilotContextCategories
803
803
  };
804
- //# sourceMappingURL=chunk-3TQAH3WJ.mjs.map
804
+ //# sourceMappingURL=chunk-KPCLYTU3.mjs.map
@@ -0,0 +1,17 @@
1
+ import {
2
+ useCopilotAction
3
+ } from "./chunk-T3376SZS.mjs";
4
+ import {
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "./chunk-SKC7AJIV.mjs";
8
+
9
+ // src/hooks/use-default-tool.ts
10
+ function useDefaultTool(tool, dependencies) {
11
+ useCopilotAction(__spreadProps(__spreadValues({}, tool), { name: "*" }), dependencies);
12
+ }
13
+
14
+ export {
15
+ useDefaultTool
16
+ };
17
+ //# sourceMappingURL=chunk-MQYWH4E6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-default-tool.ts"],"sourcesContent":["import { useCopilotAction } from \"./use-copilot-action\";\nimport { CatchAllFrontendAction } from \"../types/frontend-action\";\n\nexport function useDefaultTool(tool: Omit<CatchAllFrontendAction, \"name\">, dependencies?: any[]) {\n // Use the existing useCopilotAction hook\n useCopilotAction({ ...tool, name: \"*\" } satisfies CatchAllFrontendAction, dependencies);\n}\n"],"mappings":";;;;;;;;;AAGO,SAAS,eAAe,MAA4C,cAAsB;AAE/F,mBAAiB,iCAAK,OAAL,EAAW,MAAM,IAAI,IAAoC,YAAY;AACxF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChat
3
- } from "./chunk-TSH4IP44.mjs";
3
+ } from "./chunk-774NTLIU.mjs";
4
4
 
5
5
  // src/hooks/use-copilot-chat.ts
6
6
  function useCopilotChat2(options = {}) {
@@ -31,4 +31,4 @@ function useCopilotChat2(options = {}) {
31
31
  export {
32
32
  useCopilotChat2 as useCopilotChat
33
33
  };
34
- //# sourceMappingURL=chunk-SVRPN33M.mjs.map
34
+ //# sourceMappingURL=chunk-N3Q6EUTG.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCopilotChat
3
- } from "./chunk-TSH4IP44.mjs";
3
+ } from "./chunk-774NTLIU.mjs";
4
4
  import {
5
5
  useToast
6
6
  } from "./chunk-EFL5OBKN.mjs";
@@ -68,4 +68,4 @@ function useLangGraphInterrupt(action, dependencies) {
68
68
  export {
69
69
  useLangGraphInterrupt
70
70
  };
71
- //# sourceMappingURL=chunk-MAP5DCLU.mjs.map
71
+ //# sourceMappingURL=chunk-Z6SYWW3S.mjs.map
@@ -2,16 +2,16 @@ import {
2
2
  CopilotKit,
3
3
  CopilotKitInternal,
4
4
  defaultCopilotContextCategories
5
- } from "../../chunk-3TQAH3WJ.mjs";
5
+ } from "../../chunk-KPCLYTU3.mjs";
6
+ import "../../chunk-C6IANC2R.mjs";
6
7
  import "../../chunk-N4VN2B5S.mjs";
8
+ import "../../chunk-2IDV5OHF.mjs";
7
9
  import "../../chunk-DXEQPN43.mjs";
8
10
  import "../../chunk-OKCYPO4I.mjs";
9
11
  import "../../chunk-PIF5KJYI.mjs";
10
- import "../../chunk-C6IANC2R.mjs";
11
- import "../../chunk-2IDV5OHF.mjs";
12
+ import "../../chunk-RKTVJRK7.mjs";
12
13
  import "../../chunk-PMAFHQ7P.mjs";
13
14
  import "../../chunk-5FHSUKQL.mjs";
14
- import "../../chunk-RKTVJRK7.mjs";
15
15
  import "../../chunk-Q3MCVRO3.mjs";
16
16
  import "../../chunk-ICIK2BSB.mjs";
17
17
  import "../../chunk-N4WEHORG.mjs";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  CopilotKit,
3
3
  defaultCopilotContextCategories
4
- } from "../../chunk-3TQAH3WJ.mjs";
4
+ } from "../../chunk-KPCLYTU3.mjs";
5
+ import "../../chunk-C6IANC2R.mjs";
5
6
  import "../../chunk-N4VN2B5S.mjs";
7
+ import "../../chunk-2IDV5OHF.mjs";
6
8
  import "../../chunk-DXEQPN43.mjs";
7
9
  import "../../chunk-OKCYPO4I.mjs";
8
10
  import "../../chunk-PIF5KJYI.mjs";
9
- import "../../chunk-C6IANC2R.mjs";
10
- import "../../chunk-2IDV5OHF.mjs";
11
+ import "../../chunk-RKTVJRK7.mjs";
11
12
  import "../../chunk-PMAFHQ7P.mjs";
12
13
  import "../../chunk-5FHSUKQL.mjs";
13
- import "../../chunk-RKTVJRK7.mjs";
14
14
  import "../../chunk-Q3MCVRO3.mjs";
15
15
  import "../../chunk-ICIK2BSB.mjs";
16
16
  import "../../chunk-N4WEHORG.mjs";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  CopilotKit,
3
3
  defaultCopilotContextCategories
4
- } from "../chunk-3TQAH3WJ.mjs";
4
+ } from "../chunk-KPCLYTU3.mjs";
5
+ import "../chunk-C6IANC2R.mjs";
5
6
  import "../chunk-N4VN2B5S.mjs";
7
+ import "../chunk-2IDV5OHF.mjs";
6
8
  import "../chunk-DXEQPN43.mjs";
7
9
  import "../chunk-OKCYPO4I.mjs";
8
10
  import "../chunk-PIF5KJYI.mjs";
9
- import "../chunk-C6IANC2R.mjs";
10
- import "../chunk-2IDV5OHF.mjs";
11
+ import "../chunk-RKTVJRK7.mjs";
11
12
  import "../chunk-PMAFHQ7P.mjs";
12
13
  import "../chunk-5FHSUKQL.mjs";
13
- import "../chunk-RKTVJRK7.mjs";
14
14
  import "../chunk-Q3MCVRO3.mjs";
15
15
  import "../chunk-ICIK2BSB.mjs";
16
16
  import "../chunk-N4WEHORG.mjs";
@@ -13,6 +13,10 @@ export { useLangGraphInterrupt } from './use-langgraph-interrupt.js';
13
13
  export { useLangGraphInterruptRender } from './use-langgraph-interrupt-render.js';
14
14
  export { useCopilotAdditionalInstructions } from './use-copilot-additional-instructions.js';
15
15
  export { Tree, TreeNode } from './use-tree.js';
16
+ export { useFrontendTool } from './use-frontend-tool.js';
17
+ export { useHumanInTheLoop } from './use-human-in-the-loop.js';
18
+ export { useRenderToolCall } from './use-render-tool-call.js';
19
+ export { useDefaultTool } from './use-default-tool.js';
16
20
  import '../types/system-message.js';
17
21
  import '@copilotkit/runtime-client-gql';
18
22
  import '@copilotkit/shared';
@@ -92,9 +92,13 @@ __export(hooks_exports, {
92
92
  useCopilotChatInternal: () => useCopilotChat,
93
93
  useCopilotReadable: () => useCopilotReadable,
94
94
  useCopilotRuntimeClient: () => useCopilotRuntimeClient,
95
+ useDefaultTool: () => useDefaultTool,
96
+ useFrontendTool: () => useFrontendTool,
97
+ useHumanInTheLoop: () => useHumanInTheLoop,
95
98
  useLangGraphInterrupt: () => useLangGraphInterrupt,
96
99
  useLangGraphInterruptRender: () => useLangGraphInterruptRender,
97
- useMakeCopilotDocumentReadable: () => useMakeCopilotDocumentReadable
100
+ useMakeCopilotDocumentReadable: () => useMakeCopilotDocumentReadable,
101
+ useRenderToolCall: () => useRenderToolCall
98
102
  });
99
103
  module.exports = __toCommonJS(hooks_exports);
100
104
 
@@ -2469,6 +2473,38 @@ function useCopilotAdditionalInstructions({ instructions, available = "enabled"
2469
2473
  };
2470
2474
  }, [available, instructions, setAdditionalInstructions, ...dependencies || []]);
2471
2475
  }
2476
+
2477
+ // src/hooks/use-frontend-tool.ts
2478
+ function useFrontendTool(tool, dependencies) {
2479
+ useCopilotAction(tool, dependencies);
2480
+ }
2481
+
2482
+ // src/hooks/use-human-in-the-loop.ts
2483
+ function useHumanInTheLoop(tool, dependencies) {
2484
+ const _a = tool, { render } = _a, toolRest = __objRest(_a, ["render"]);
2485
+ useCopilotAction(
2486
+ __spreadProps(__spreadValues({}, toolRest), {
2487
+ available: tool.available === "disabled" ? tool.available : "remote",
2488
+ renderAndWaitForResponse: render
2489
+ }),
2490
+ dependencies
2491
+ );
2492
+ }
2493
+
2494
+ // src/hooks/use-render-tool-call.ts
2495
+ function useRenderToolCall(tool, dependencies) {
2496
+ useCopilotAction(
2497
+ __spreadProps(__spreadValues({}, tool), {
2498
+ available: tool.available === "disabled" ? tool.available : "frontend"
2499
+ }),
2500
+ dependencies
2501
+ );
2502
+ }
2503
+
2504
+ // src/hooks/use-default-tool.ts
2505
+ function useDefaultTool(tool, dependencies) {
2506
+ useCopilotAction(__spreadProps(__spreadValues({}, tool), { name: "*" }), dependencies);
2507
+ }
2472
2508
  // Annotate the CommonJS export names for ESM import in node:
2473
2509
  0 && (module.exports = {
2474
2510
  runAgent,
@@ -2484,8 +2520,12 @@ function useCopilotAdditionalInstructions({ instructions, available = "enabled"
2484
2520
  useCopilotChatInternal,
2485
2521
  useCopilotReadable,
2486
2522
  useCopilotRuntimeClient,
2523
+ useDefaultTool,
2524
+ useFrontendTool,
2525
+ useHumanInTheLoop,
2487
2526
  useLangGraphInterrupt,
2488
2527
  useLangGraphInterruptRender,
2489
- useMakeCopilotDocumentReadable
2528
+ useMakeCopilotDocumentReadable,
2529
+ useRenderToolCall
2490
2530
  });
2491
2531
  //# sourceMappingURL=index.js.map