@copilotkitnext/react 0.0.22-alpha.4 → 0.0.22-alpha.5
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.
- package/dist/index.d.mts +635 -46
- package/dist/index.d.ts +635 -46
- package/dist/index.js +325 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4286 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-32YJ5VJ4.mjs +0 -157
- package/dist/chunk-32YJ5VJ4.mjs.map +0 -1
- package/dist/chunk-36HFWACS.mjs +0 -1
- package/dist/chunk-36HFWACS.mjs.map +0 -1
- package/dist/chunk-46BZRXWT.mjs +0 -16
- package/dist/chunk-46BZRXWT.mjs.map +0 -1
- package/dist/chunk-4UDBR75C.mjs +0 -106
- package/dist/chunk-4UDBR75C.mjs.map +0 -1
- package/dist/chunk-4XJK5IVQ.mjs +0 -83
- package/dist/chunk-4XJK5IVQ.mjs.map +0 -1
- package/dist/chunk-5JNWVLQI.mjs +0 -72
- package/dist/chunk-5JNWVLQI.mjs.map +0 -1
- package/dist/chunk-5SC3CO5Q.mjs +0 -69
- package/dist/chunk-5SC3CO5Q.mjs.map +0 -1
- package/dist/chunk-6VUKDHOD.mjs +0 -1
- package/dist/chunk-6VUKDHOD.mjs.map +0 -1
- package/dist/chunk-7HM7CU5A.mjs +0 -122
- package/dist/chunk-7HM7CU5A.mjs.map +0 -1
- package/dist/chunk-AEFM73CL.mjs +0 -32
- package/dist/chunk-AEFM73CL.mjs.map +0 -1
- package/dist/chunk-AI3Z3CHN.mjs +0 -97
- package/dist/chunk-AI3Z3CHN.mjs.map +0 -1
- package/dist/chunk-AXFRCGH6.mjs +0 -107
- package/dist/chunk-AXFRCGH6.mjs.map +0 -1
- package/dist/chunk-BNT754Z2.mjs +0 -185
- package/dist/chunk-BNT754Z2.mjs.map +0 -1
- package/dist/chunk-BT6C5OPU.mjs +0 -278
- package/dist/chunk-BT6C5OPU.mjs.map +0 -1
- package/dist/chunk-CDSO65ZY.mjs +0 -157
- package/dist/chunk-CDSO65ZY.mjs.map +0 -1
- package/dist/chunk-CGLGXQAU.mjs +0 -78
- package/dist/chunk-CGLGXQAU.mjs.map +0 -1
- package/dist/chunk-DVUQO72Z.mjs +0 -1
- package/dist/chunk-DVUQO72Z.mjs.map +0 -1
- package/dist/chunk-E56GYBP3.mjs +0 -101
- package/dist/chunk-E56GYBP3.mjs.map +0 -1
- package/dist/chunk-ETWJDCGE.mjs +0 -1
- package/dist/chunk-ETWJDCGE.mjs.map +0 -1
- package/dist/chunk-FIBK3DYE.mjs +0 -26
- package/dist/chunk-FIBK3DYE.mjs.map +0 -1
- package/dist/chunk-FVURPXQK.mjs +0 -45
- package/dist/chunk-FVURPXQK.mjs.map +0 -1
- package/dist/chunk-FZR2XQKR.mjs +0 -44
- package/dist/chunk-FZR2XQKR.mjs.map +0 -1
- package/dist/chunk-GK4NXPLC.mjs +0 -60
- package/dist/chunk-GK4NXPLC.mjs.map +0 -1
- package/dist/chunk-IA4CLXDM.mjs +0 -76
- package/dist/chunk-IA4CLXDM.mjs.map +0 -1
- package/dist/chunk-IICUCI5S.mjs +0 -43
- package/dist/chunk-IICUCI5S.mjs.map +0 -1
- package/dist/chunk-JLVGSNAO.mjs +0 -311
- package/dist/chunk-JLVGSNAO.mjs.map +0 -1
- package/dist/chunk-JWOIINVV.mjs +0 -237
- package/dist/chunk-JWOIINVV.mjs.map +0 -1
- package/dist/chunk-KCVDFZJX.mjs +0 -873
- package/dist/chunk-KCVDFZJX.mjs.map +0 -1
- package/dist/chunk-KPRUSQ3K.mjs +0 -1
- package/dist/chunk-KPRUSQ3K.mjs.map +0 -1
- package/dist/chunk-MWC5OV7Z.mjs +0 -1
- package/dist/chunk-MWC5OV7Z.mjs.map +0 -1
- package/dist/chunk-N5EP5OD5.mjs +0 -1
- package/dist/chunk-N5EP5OD5.mjs.map +0 -1
- package/dist/chunk-N5HC66HU.mjs +0 -311
- package/dist/chunk-N5HC66HU.mjs.map +0 -1
- package/dist/chunk-NB2GZAKG.mjs +0 -131
- package/dist/chunk-NB2GZAKG.mjs.map +0 -1
- package/dist/chunk-NB4DFAZH.mjs +0 -185
- package/dist/chunk-NB4DFAZH.mjs.map +0 -1
- package/dist/chunk-NNAYEAP2.mjs +0 -49
- package/dist/chunk-NNAYEAP2.mjs.map +0 -1
- package/dist/chunk-NNPKBGD6.mjs +0 -37
- package/dist/chunk-NNPKBGD6.mjs.map +0 -1
- package/dist/chunk-OMPVTGXH.mjs +0 -122
- package/dist/chunk-OMPVTGXH.mjs.map +0 -1
- package/dist/chunk-R5OLAA3L.mjs +0 -135
- package/dist/chunk-R5OLAA3L.mjs.map +0 -1
- package/dist/chunk-RF2CGPHQ.mjs +0 -215
- package/dist/chunk-RF2CGPHQ.mjs.map +0 -1
- package/dist/chunk-RGD2L3Z4.mjs +0 -96
- package/dist/chunk-RGD2L3Z4.mjs.map +0 -1
- package/dist/chunk-RK5P2LG6.mjs +0 -57
- package/dist/chunk-RK5P2LG6.mjs.map +0 -1
- package/dist/chunk-RRXDJCXI.mjs +0 -60
- package/dist/chunk-RRXDJCXI.mjs.map +0 -1
- package/dist/chunk-SPDE34WC.mjs +0 -283
- package/dist/chunk-SPDE34WC.mjs.map +0 -1
- package/dist/chunk-TAUOEJH2.mjs +0 -120
- package/dist/chunk-TAUOEJH2.mjs.map +0 -1
- package/dist/chunk-TBE7ZI5G.mjs +0 -45
- package/dist/chunk-TBE7ZI5G.mjs.map +0 -1
- package/dist/chunk-UOX5D73C.mjs +0 -22
- package/dist/chunk-UOX5D73C.mjs.map +0 -1
- package/dist/chunk-US4KNAAV.mjs +0 -1
- package/dist/chunk-US4KNAAV.mjs.map +0 -1
- package/dist/chunk-UZB3CTOY.mjs +0 -873
- package/dist/chunk-UZB3CTOY.mjs.map +0 -1
- package/dist/chunk-VBI6JXPC.mjs +0 -1
- package/dist/chunk-VBI6JXPC.mjs.map +0 -1
- package/dist/chunk-VVAXSF3M.mjs +0 -61
- package/dist/chunk-VVAXSF3M.mjs.map +0 -1
- package/dist/chunk-XO4IRKSC.mjs +0 -11
- package/dist/chunk-XO4IRKSC.mjs.map +0 -1
- package/dist/chunk-XU5CEPYQ.mjs +0 -75
- package/dist/chunk-XU5CEPYQ.mjs.map +0 -1
- package/dist/chunk-YPH4BHOY.mjs +0 -39
- package/dist/chunk-YPH4BHOY.mjs.map +0 -1
- package/dist/chunk-YZUPVMHC.mjs +0 -1
- package/dist/chunk-YZUPVMHC.mjs.map +0 -1
- package/dist/components/CopilotKitInspector.d.mts +0 -13
- package/dist/components/CopilotKitInspector.d.ts +0 -13
- package/dist/components/CopilotKitInspector.js +0 -69
- package/dist/components/CopilotKitInspector.js.map +0 -1
- package/dist/components/CopilotKitInspector.mjs +0 -7
- package/dist/components/CopilotKitInspector.mjs.map +0 -1
- package/dist/components/WildcardToolCallRender.d.mts +0 -7
- package/dist/components/WildcardToolCallRender.d.ts +0 -7
- package/dist/components/WildcardToolCallRender.js +0 -106
- package/dist/components/WildcardToolCallRender.js.map +0 -1
- package/dist/components/WildcardToolCallRender.mjs +0 -8
- package/dist/components/WildcardToolCallRender.mjs.map +0 -1
- package/dist/components/chat/CopilotChat.d.mts +0 -30
- package/dist/components/chat/CopilotChat.d.ts +0 -30
- package/dist/components/chat/CopilotChat.js +0 -2934
- package/dist/components/chat/CopilotChat.js.map +0 -1
- package/dist/components/chat/CopilotChat.mjs +0 -37
- package/dist/components/chat/CopilotChat.mjs.map +0 -1
- package/dist/components/chat/CopilotChatAssistantMessage.d.mts +0 -45
- package/dist/components/chat/CopilotChatAssistantMessage.d.ts +0 -45
- package/dist/components/chat/CopilotChatAssistantMessage.js +0 -735
- package/dist/components/chat/CopilotChatAssistantMessage.js.map +0 -1
- package/dist/components/chat/CopilotChatAssistantMessage.mjs +0 -29
- package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +0 -1
- package/dist/components/chat/CopilotChatAudioRecorder.d.mts +0 -11
- package/dist/components/chat/CopilotChatAudioRecorder.d.ts +0 -11
- package/dist/components/chat/CopilotChatAudioRecorder.js +0 -131
- package/dist/components/chat/CopilotChatAudioRecorder.js.map +0 -1
- package/dist/components/chat/CopilotChatAudioRecorder.mjs +0 -9
- package/dist/components/chat/CopilotChatAudioRecorder.mjs.map +0 -1
- package/dist/components/chat/CopilotChatInput.d.mts +0 -67
- package/dist/components/chat/CopilotChatInput.d.ts +0 -67
- package/dist/components/chat/CopilotChatInput.js +0 -1305
- package/dist/components/chat/CopilotChatInput.js.map +0 -1
- package/dist/components/chat/CopilotChatInput.mjs +0 -16
- package/dist/components/chat/CopilotChatInput.mjs.map +0 -1
- package/dist/components/chat/CopilotChatMessageView.d.mts +0 -29
- package/dist/components/chat/CopilotChatMessageView.d.ts +0 -29
- package/dist/components/chat/CopilotChatMessageView.js +0 -1164
- package/dist/components/chat/CopilotChatMessageView.js.map +0 -1
- package/dist/components/chat/CopilotChatMessageView.mjs +0 -31
- package/dist/components/chat/CopilotChatMessageView.mjs.map +0 -1
- package/dist/components/chat/CopilotChatSuggestionPill.d.mts +0 -11
- package/dist/components/chat/CopilotChatSuggestionPill.d.ts +0 -11
- package/dist/components/chat/CopilotChatSuggestionPill.js +0 -76
- package/dist/components/chat/CopilotChatSuggestionPill.js.map +0 -1
- package/dist/components/chat/CopilotChatSuggestionPill.mjs +0 -10
- package/dist/components/chat/CopilotChatSuggestionPill.mjs.map +0 -1
- package/dist/components/chat/CopilotChatSuggestionView.d.mts +0 -33
- package/dist/components/chat/CopilotChatSuggestionView.d.ts +0 -33
- package/dist/components/chat/CopilotChatSuggestionView.js +0 -179
- package/dist/components/chat/CopilotChatSuggestionView.js.map +0 -1
- package/dist/components/chat/CopilotChatSuggestionView.mjs +0 -12
- package/dist/components/chat/CopilotChatSuggestionView.mjs.map +0 -1
- package/dist/components/chat/CopilotChatToggleButton.d.mts +0 -14
- package/dist/components/chat/CopilotChatToggleButton.d.ts +0 -14
- package/dist/components/chat/CopilotChatToggleButton.js +0 -222
- package/dist/components/chat/CopilotChatToggleButton.js.map +0 -1
- package/dist/components/chat/CopilotChatToggleButton.mjs +0 -16
- package/dist/components/chat/CopilotChatToggleButton.mjs.map +0 -1
- package/dist/components/chat/CopilotChatToolCallsView.d.mts +0 -10
- package/dist/components/chat/CopilotChatToolCallsView.d.ts +0 -10
- package/dist/components/chat/CopilotChatToolCallsView.js +0 -264
- package/dist/components/chat/CopilotChatToolCallsView.js.map +0 -1
- package/dist/components/chat/CopilotChatToolCallsView.mjs +0 -24
- package/dist/components/chat/CopilotChatToolCallsView.mjs.map +0 -1
- package/dist/components/chat/CopilotChatUserMessage.d.mts +0 -52
- package/dist/components/chat/CopilotChatUserMessage.d.ts +0 -52
- package/dist/components/chat/CopilotChatUserMessage.js +0 -523
- package/dist/components/chat/CopilotChatUserMessage.js.map +0 -1
- package/dist/components/chat/CopilotChatUserMessage.mjs +0 -14
- package/dist/components/chat/CopilotChatUserMessage.mjs.map +0 -1
- package/dist/components/chat/CopilotChatView.d.mts +0 -54
- package/dist/components/chat/CopilotChatView.d.ts +0 -54
- package/dist/components/chat/CopilotChatView.js +0 -2640
- package/dist/components/chat/CopilotChatView.js.map +0 -1
- package/dist/components/chat/CopilotChatView.mjs +0 -38
- package/dist/components/chat/CopilotChatView.mjs.map +0 -1
- package/dist/components/chat/CopilotModalHeader.d.mts +0 -22
- package/dist/components/chat/CopilotModalHeader.d.ts +0 -22
- package/dist/components/chat/CopilotModalHeader.js +0 -186
- package/dist/components/chat/CopilotModalHeader.js.map +0 -1
- package/dist/components/chat/CopilotModalHeader.mjs +0 -12
- package/dist/components/chat/CopilotModalHeader.mjs.map +0 -1
- package/dist/components/chat/CopilotPopup.d.mts +0 -33
- package/dist/components/chat/CopilotPopup.d.ts +0 -33
- package/dist/components/chat/CopilotPopup.js +0 -3343
- package/dist/components/chat/CopilotPopup.js.map +0 -1
- package/dist/components/chat/CopilotPopup.mjs +0 -43
- package/dist/components/chat/CopilotPopup.mjs.map +0 -1
- package/dist/components/chat/CopilotPopupView.d.mts +0 -30
- package/dist/components/chat/CopilotPopupView.d.ts +0 -30
- package/dist/components/chat/CopilotPopupView.js +0 -3003
- package/dist/components/chat/CopilotPopupView.js.map +0 -1
- package/dist/components/chat/CopilotPopupView.mjs +0 -41
- package/dist/components/chat/CopilotPopupView.mjs.map +0 -1
- package/dist/components/chat/CopilotSidebar.d.mts +0 -31
- package/dist/components/chat/CopilotSidebar.d.ts +0 -31
- package/dist/components/chat/CopilotSidebar.js +0 -3266
- package/dist/components/chat/CopilotSidebar.js.map +0 -1
- package/dist/components/chat/CopilotSidebar.mjs +0 -43
- package/dist/components/chat/CopilotSidebar.mjs.map +0 -1
- package/dist/components/chat/CopilotSidebarView.d.mts +0 -28
- package/dist/components/chat/CopilotSidebarView.d.ts +0 -28
- package/dist/components/chat/CopilotSidebarView.js +0 -2941
- package/dist/components/chat/CopilotSidebarView.js.map +0 -1
- package/dist/components/chat/CopilotSidebarView.mjs +0 -41
- package/dist/components/chat/CopilotSidebarView.mjs.map +0 -1
- package/dist/components/chat/index.d.mts +0 -23
- package/dist/components/chat/index.d.ts +0 -23
- package/dist/components/chat/index.js +0 -3503
- package/dist/components/chat/index.js.map +0 -1
- package/dist/components/chat/index.mjs +0 -95
- package/dist/components/chat/index.mjs.map +0 -1
- package/dist/components/index.d.mts +0 -29
- package/dist/components/index.d.ts +0 -29
- package/dist/components/index.js +0 -3583
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -104
- package/dist/components/index.mjs.map +0 -1
- package/dist/components/ui/button.d.mts +0 -14
- package/dist/components/ui/button.d.ts +0 -14
- package/dist/components/ui/button.js +0 -150
- package/dist/components/ui/button.js.map +0 -1
- package/dist/components/ui/button.mjs +0 -10
- package/dist/components/ui/button.mjs.map +0 -1
- package/dist/components/ui/dropdown-menu.d.mts +0 -28
- package/dist/components/ui/dropdown-menu.d.ts +0 -28
- package/dist/components/ui/dropdown-menu.js +0 -291
- package/dist/components/ui/dropdown-menu.js.map +0 -1
- package/dist/components/ui/dropdown-menu.mjs +0 -37
- package/dist/components/ui/dropdown-menu.mjs.map +0 -1
- package/dist/components/ui/tooltip.d.mts +0 -10
- package/dist/components/ui/tooltip.d.ts +0 -10
- package/dist/components/ui/tooltip.js +0 -103
- package/dist/components/ui/tooltip.js.map +0 -1
- package/dist/components/ui/tooltip.mjs +0 -14
- package/dist/components/ui/tooltip.mjs.map +0 -1
- package/dist/hooks/index.d.mts +0 -19
- package/dist/hooks/index.d.ts +0 -19
- package/dist/hooks/index.js +0 -691
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -45
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/hooks/use-agent-context.d.mts +0 -5
- package/dist/hooks/use-agent-context.d.ts +0 -5
- package/dist/hooks/use-agent-context.js +0 -116
- package/dist/hooks/use-agent-context.js.map +0 -1
- package/dist/hooks/use-agent-context.mjs +0 -10
- package/dist/hooks/use-agent-context.mjs.map +0 -1
- package/dist/hooks/use-agent.d.mts +0 -16
- package/dist/hooks/use-agent.d.ts +0 -16
- package/dist/hooks/use-agent.js +0 -171
- package/dist/hooks/use-agent.js.map +0 -1
- package/dist/hooks/use-agent.mjs +0 -12
- package/dist/hooks/use-agent.mjs.map +0 -1
- package/dist/hooks/use-configure-suggestions.d.mts +0 -13
- package/dist/hooks/use-configure-suggestions.d.ts +0 -13
- package/dist/hooks/use-configure-suggestions.js +0 -232
- package/dist/hooks/use-configure-suggestions.js.map +0 -1
- package/dist/hooks/use-configure-suggestions.mjs +0 -11
- package/dist/hooks/use-configure-suggestions.mjs.map +0 -1
- package/dist/hooks/use-frontend-tool.d.mts +0 -8
- package/dist/hooks/use-frontend-tool.d.ts +0 -8
- package/dist/hooks/use-frontend-tool.js +0 -137
- package/dist/hooks/use-frontend-tool.js.map +0 -1
- package/dist/hooks/use-frontend-tool.mjs +0 -10
- package/dist/hooks/use-frontend-tool.mjs.map +0 -1
- package/dist/hooks/use-human-in-the-loop.d.mts +0 -7
- package/dist/hooks/use-human-in-the-loop.d.ts +0 -7
- package/dist/hooks/use-human-in-the-loop.js +0 -206
- package/dist/hooks/use-human-in-the-loop.js.map +0 -1
- package/dist/hooks/use-human-in-the-loop.mjs +0 -11
- package/dist/hooks/use-human-in-the-loop.mjs.map +0 -1
- package/dist/hooks/use-keyboard-height.d.mts +0 -15
- package/dist/hooks/use-keyboard-height.d.ts +0 -15
- package/dist/hooks/use-keyboard-height.js +0 -68
- package/dist/hooks/use-keyboard-height.js.map +0 -1
- package/dist/hooks/use-keyboard-height.mjs +0 -7
- package/dist/hooks/use-keyboard-height.mjs.map +0 -1
- package/dist/hooks/use-render-activity-message.d.mts +0 -5
- package/dist/hooks/use-render-activity-message.d.ts +0 -5
- package/dist/hooks/use-render-activity-message.js +0 -158
- package/dist/hooks/use-render-activity-message.js.map +0 -1
- package/dist/hooks/use-render-activity-message.mjs +0 -12
- package/dist/hooks/use-render-activity-message.mjs.map +0 -1
- package/dist/hooks/use-render-custom-messages.d.mts +0 -11
- package/dist/hooks/use-render-custom-messages.d.ts +0 -11
- package/dist/hooks/use-render-custom-messages.js +0 -170
- package/dist/hooks/use-render-custom-messages.js.map +0 -1
- package/dist/hooks/use-render-custom-messages.mjs +0 -12
- package/dist/hooks/use-render-custom-messages.mjs.map +0 -1
- package/dist/hooks/use-render-tool-call.d.mts +0 -16
- package/dist/hooks/use-render-tool-call.d.ts +0 -16
- package/dist/hooks/use-render-tool-call.js +0 -208
- package/dist/hooks/use-render-tool-call.js.map +0 -1
- package/dist/hooks/use-render-tool-call.mjs +0 -11
- package/dist/hooks/use-render-tool-call.mjs.map +0 -1
- package/dist/hooks/use-suggestions.d.mts +0 -14
- package/dist/hooks/use-suggestions.d.ts +0 -14
- package/dist/hooks/use-suggestions.js +0 -176
- package/dist/hooks/use-suggestions.js.map +0 -1
- package/dist/hooks/use-suggestions.mjs +0 -11
- package/dist/hooks/use-suggestions.mjs.map +0 -1
- package/dist/lib/react-core.d.mts +0 -33
- package/dist/lib/react-core.d.ts +0 -33
- package/dist/lib/react-core.js +0 -73
- package/dist/lib/react-core.js.map +0 -1
- package/dist/lib/react-core.mjs +0 -7
- package/dist/lib/react-core.mjs.map +0 -1
- package/dist/lib/slots.d.mts +0 -16
- package/dist/lib/slots.d.ts +0 -16
- package/dist/lib/slots.js +0 -60
- package/dist/lib/slots.js.map +0 -1
- package/dist/lib/slots.mjs +0 -7
- package/dist/lib/slots.mjs.map +0 -1
- package/dist/lib/utils.d.mts +0 -5
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/utils.js +0 -35
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/utils.mjs +0 -7
- package/dist/lib/utils.mjs.map +0 -1
- package/dist/providers/CopilotChatConfigurationProvider.d.mts +0 -43
- package/dist/providers/CopilotChatConfigurationProvider.d.ts +0 -43
- package/dist/providers/CopilotChatConfigurationProvider.js +0 -109
- package/dist/providers/CopilotChatConfigurationProvider.js.map +0 -1
- package/dist/providers/CopilotChatConfigurationProvider.mjs +0 -11
- package/dist/providers/CopilotChatConfigurationProvider.mjs.map +0 -1
- package/dist/providers/CopilotKitProvider.d.mts +0 -33
- package/dist/providers/CopilotKitProvider.d.ts +0 -33
- package/dist/providers/CopilotKitProvider.js +0 -314
- package/dist/providers/CopilotKitProvider.js.map +0 -1
- package/dist/providers/CopilotKitProvider.mjs +0 -12
- package/dist/providers/CopilotKitProvider.mjs.map +0 -1
- package/dist/providers/index.d.mts +0 -13
- package/dist/providers/index.d.ts +0 -13
- package/dist/providers/index.js +0 -396
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/index.mjs +0 -18
- package/dist/providers/index.mjs.map +0 -1
- package/dist/types/defineToolCallRenderer.d.mts +0 -41
- package/dist/types/defineToolCallRenderer.d.ts +0 -41
- package/dist/types/defineToolCallRenderer.js +0 -40
- package/dist/types/defineToolCallRenderer.js.map +0 -1
- package/dist/types/defineToolCallRenderer.mjs +0 -7
- package/dist/types/defineToolCallRenderer.mjs.map +0 -1
- package/dist/types/frontend-tool.d.mts +0 -9
- package/dist/types/frontend-tool.d.ts +0 -9
- package/dist/types/frontend-tool.js +0 -19
- package/dist/types/frontend-tool.js.map +0 -1
- package/dist/types/frontend-tool.mjs +0 -2
- package/dist/types/frontend-tool.mjs.map +0 -1
- package/dist/types/human-in-the-loop.d.mts +0 -29
- package/dist/types/human-in-the-loop.d.ts +0 -29
- package/dist/types/human-in-the-loop.js +0 -19
- package/dist/types/human-in-the-loop.js.map +0 -1
- package/dist/types/human-in-the-loop.mjs +0 -2
- package/dist/types/human-in-the-loop.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -11
- package/dist/types/index.d.ts +0 -11
- package/dist/types/index.js +0 -42
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -13
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/react-activity-message-renderer.d.mts +0 -29
- package/dist/types/react-activity-message-renderer.d.ts +0 -29
- package/dist/types/react-activity-message-renderer.js +0 -19
- package/dist/types/react-activity-message-renderer.js.map +0 -1
- package/dist/types/react-activity-message-renderer.mjs +0 -2
- package/dist/types/react-activity-message-renderer.mjs.map +0 -1
- package/dist/types/react-custom-message-renderer.d.mts +0 -18
- package/dist/types/react-custom-message-renderer.d.ts +0 -18
- package/dist/types/react-custom-message-renderer.js +0 -19
- package/dist/types/react-custom-message-renderer.js.map +0 -1
- package/dist/types/react-custom-message-renderer.mjs +0 -2
- package/dist/types/react-custom-message-renderer.mjs.map +0 -1
- package/dist/types/react-tool-call-renderer.d.mts +0 -30
- package/dist/types/react-tool-call-renderer.d.ts +0 -30
- package/dist/types/react-tool-call-renderer.js +0 -19
- package/dist/types/react-tool-call-renderer.js.map +0 -1
- package/dist/types/react-tool-call-renderer.mjs +0 -2
- package/dist/types/react-tool-call-renderer.mjs.map +0 -1
package/dist/hooks/index.js
DELETED
|
@@ -1,691 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/hooks/index.ts
|
|
31
|
-
var hooks_exports = {};
|
|
32
|
-
__export(hooks_exports, {
|
|
33
|
-
useAgent: () => useAgent,
|
|
34
|
-
useAgentContext: () => useAgentContext,
|
|
35
|
-
useConfigureSuggestions: () => useConfigureSuggestions,
|
|
36
|
-
useFrontendTool: () => useFrontendTool,
|
|
37
|
-
useHumanInTheLoop: () => useHumanInTheLoop,
|
|
38
|
-
useRenderActivityMessage: () => useRenderActivityMessage,
|
|
39
|
-
useRenderCustomMessages: () => useRenderCustomMessages,
|
|
40
|
-
useRenderToolCall: () => useRenderToolCall,
|
|
41
|
-
useSuggestions: () => useSuggestions
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
44
|
-
|
|
45
|
-
// src/hooks/use-render-tool-call.tsx
|
|
46
|
-
var import_react4 = require("react");
|
|
47
|
-
var import_core2 = require("@copilotkitnext/core");
|
|
48
|
-
|
|
49
|
-
// src/providers/CopilotKitProvider.tsx
|
|
50
|
-
var import_react2 = require("react");
|
|
51
|
-
var import_zod = require("zod");
|
|
52
|
-
|
|
53
|
-
// src/lib/react-core.ts
|
|
54
|
-
var import_core = require("@copilotkitnext/core");
|
|
55
|
-
|
|
56
|
-
// src/components/CopilotKitInspector.tsx
|
|
57
|
-
var React = __toESM(require("react"));
|
|
58
|
-
var import_react = require("@lit-labs/react");
|
|
59
|
-
var import_web_inspector = require("@copilotkitnext/web-inspector");
|
|
60
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
|
-
(0, import_web_inspector.defineWebInspector)();
|
|
62
|
-
var CopilotKitInspectorBase = (0, import_react.createComponent)({
|
|
63
|
-
tagName: import_web_inspector.WEB_INSPECTOR_TAG,
|
|
64
|
-
elementClass: import_web_inspector.WebInspectorElement,
|
|
65
|
-
react: React
|
|
66
|
-
});
|
|
67
|
-
var CopilotKitInspector = React.forwardRef(
|
|
68
|
-
({ core, ...rest }, ref) => {
|
|
69
|
-
const innerRef = React.useRef(null);
|
|
70
|
-
React.useImperativeHandle(ref, () => innerRef.current, []);
|
|
71
|
-
React.useEffect(() => {
|
|
72
|
-
if (innerRef.current) {
|
|
73
|
-
innerRef.current.core = core ?? null;
|
|
74
|
-
}
|
|
75
|
-
}, [core]);
|
|
76
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
-
CopilotKitInspectorBase,
|
|
78
|
-
{
|
|
79
|
-
...rest,
|
|
80
|
-
ref: innerRef
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
CopilotKitInspector.displayName = "CopilotKitInspector";
|
|
86
|
-
|
|
87
|
-
// src/providers/CopilotKitProvider.tsx
|
|
88
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
89
|
-
var CopilotKitContext = (0, import_react2.createContext)({
|
|
90
|
-
copilotkit: null
|
|
91
|
-
});
|
|
92
|
-
var useCopilotKit = () => {
|
|
93
|
-
const context = (0, import_react2.useContext)(CopilotKitContext);
|
|
94
|
-
const [, forceUpdate] = (0, import_react2.useReducer)((x) => x + 1, 0);
|
|
95
|
-
if (!context) {
|
|
96
|
-
throw new Error("useCopilotKit must be used within CopilotKitProvider");
|
|
97
|
-
}
|
|
98
|
-
(0, import_react2.useEffect)(() => {
|
|
99
|
-
const unsubscribe = context.copilotkit.subscribe({
|
|
100
|
-
onRuntimeConnectionStatusChanged: () => {
|
|
101
|
-
forceUpdate();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return () => {
|
|
105
|
-
unsubscribe();
|
|
106
|
-
};
|
|
107
|
-
}, []);
|
|
108
|
-
return context;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// src/providers/CopilotChatConfigurationProvider.tsx
|
|
112
|
-
var import_react3 = require("react");
|
|
113
|
-
var import_shared = require("@copilotkitnext/shared");
|
|
114
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
115
|
-
var CopilotChatConfiguration = (0, import_react3.createContext)(null);
|
|
116
|
-
var useCopilotChatConfiguration = () => {
|
|
117
|
-
const configuration = (0, import_react3.useContext)(CopilotChatConfiguration);
|
|
118
|
-
return configuration;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// src/hooks/use-render-tool-call.tsx
|
|
122
|
-
var import_shared2 = require("@copilotkitnext/shared");
|
|
123
|
-
var import_shared3 = require("@copilotkitnext/shared");
|
|
124
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
125
|
-
function useRenderToolCall() {
|
|
126
|
-
const { copilotkit } = useCopilotKit();
|
|
127
|
-
const config = useCopilotChatConfiguration();
|
|
128
|
-
const agentId = config?.agentId ?? import_shared2.DEFAULT_AGENT_ID;
|
|
129
|
-
const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react4.useState)(() => /* @__PURE__ */ new Set());
|
|
130
|
-
const renderToolCalls = (0, import_react4.useSyncExternalStore)(
|
|
131
|
-
(callback) => {
|
|
132
|
-
return copilotkit.subscribe({
|
|
133
|
-
onRenderToolCallsChanged: callback
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
() => copilotkit.renderToolCalls,
|
|
137
|
-
() => copilotkit.renderToolCalls
|
|
138
|
-
);
|
|
139
|
-
(0, import_react4.useEffect)(() => {
|
|
140
|
-
const unsubscribe = copilotkit.subscribe({
|
|
141
|
-
onToolExecutionStart: ({ toolCallId }) => {
|
|
142
|
-
setExecutingToolCallIds((prev) => {
|
|
143
|
-
if (prev.has(toolCallId)) return prev;
|
|
144
|
-
const next = new Set(prev);
|
|
145
|
-
next.add(toolCallId);
|
|
146
|
-
return next;
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
onToolExecutionEnd: ({ toolCallId }) => {
|
|
150
|
-
setExecutingToolCallIds((prev) => {
|
|
151
|
-
if (!prev.has(toolCallId)) return prev;
|
|
152
|
-
const next = new Set(prev);
|
|
153
|
-
next.delete(toolCallId);
|
|
154
|
-
return next;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return () => unsubscribe();
|
|
159
|
-
}, [copilotkit]);
|
|
160
|
-
const renderToolCall = (0, import_react4.useCallback)(
|
|
161
|
-
({
|
|
162
|
-
toolCall,
|
|
163
|
-
toolMessage
|
|
164
|
-
}) => {
|
|
165
|
-
const exactMatches = renderToolCalls.filter(
|
|
166
|
-
(rc) => rc.name === toolCall.function.name
|
|
167
|
-
);
|
|
168
|
-
const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
|
|
169
|
-
if (!renderConfig) {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
const RenderComponent = renderConfig.render;
|
|
173
|
-
const args = (0, import_shared3.partialJSONParse)(toolCall.function.arguments);
|
|
174
|
-
const toolName = toolCall.function.name;
|
|
175
|
-
if (toolMessage) {
|
|
176
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
177
|
-
RenderComponent,
|
|
178
|
-
{
|
|
179
|
-
name: toolName,
|
|
180
|
-
args,
|
|
181
|
-
status: import_core2.ToolCallStatus.Complete,
|
|
182
|
-
result: toolMessage.content
|
|
183
|
-
},
|
|
184
|
-
toolCall.id
|
|
185
|
-
);
|
|
186
|
-
} else if (executingToolCallIds.has(toolCall.id)) {
|
|
187
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
188
|
-
RenderComponent,
|
|
189
|
-
{
|
|
190
|
-
name: toolName,
|
|
191
|
-
args,
|
|
192
|
-
status: import_core2.ToolCallStatus.Executing,
|
|
193
|
-
result: void 0
|
|
194
|
-
},
|
|
195
|
-
toolCall.id
|
|
196
|
-
);
|
|
197
|
-
} else {
|
|
198
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
199
|
-
RenderComponent,
|
|
200
|
-
{
|
|
201
|
-
name: toolName,
|
|
202
|
-
args,
|
|
203
|
-
status: import_core2.ToolCallStatus.InProgress,
|
|
204
|
-
result: void 0
|
|
205
|
-
},
|
|
206
|
-
toolCall.id
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
[renderToolCalls, executingToolCallIds, agentId]
|
|
211
|
-
);
|
|
212
|
-
return renderToolCall;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// src/hooks/use-render-custom-messages.tsx
|
|
216
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
217
|
-
function useRenderCustomMessages() {
|
|
218
|
-
const { copilotkit } = useCopilotKit();
|
|
219
|
-
const config = useCopilotChatConfiguration();
|
|
220
|
-
if (!config) {
|
|
221
|
-
return null;
|
|
222
|
-
}
|
|
223
|
-
const { agentId, threadId } = config;
|
|
224
|
-
const customMessageRenderers = copilotkit.renderCustomMessages.filter((renderer) => renderer.agentId === void 0 || renderer.agentId === agentId).sort((a, b) => {
|
|
225
|
-
const aHasAgent = a.agentId !== void 0;
|
|
226
|
-
const bHasAgent = b.agentId !== void 0;
|
|
227
|
-
if (aHasAgent === bHasAgent) return 0;
|
|
228
|
-
return aHasAgent ? -1 : 1;
|
|
229
|
-
});
|
|
230
|
-
return function(params) {
|
|
231
|
-
if (!customMessageRenderers.length) {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
const { message, position } = params;
|
|
235
|
-
const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
|
|
236
|
-
const agent = copilotkit.getAgent(agentId);
|
|
237
|
-
if (!agent) {
|
|
238
|
-
throw new Error("Agent not found");
|
|
239
|
-
}
|
|
240
|
-
const messagesIdsInRun = agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === runId).map((msg) => msg.id);
|
|
241
|
-
const messageIndex = agent.messages.findIndex((msg) => msg.id === message.id) ?? 0;
|
|
242
|
-
const messageIndexInRun = Math.min(messagesIdsInRun.indexOf(message.id), 0);
|
|
243
|
-
const numberOfMessagesInRun = messagesIdsInRun.length;
|
|
244
|
-
const stateSnapshot = copilotkit.getStateByRun(agentId, threadId, runId);
|
|
245
|
-
let result = null;
|
|
246
|
-
for (const renderer of customMessageRenderers) {
|
|
247
|
-
if (!renderer.render) {
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
const Component = renderer.render;
|
|
251
|
-
result = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
252
|
-
Component,
|
|
253
|
-
{
|
|
254
|
-
message,
|
|
255
|
-
position,
|
|
256
|
-
runId,
|
|
257
|
-
messageIndex,
|
|
258
|
-
messageIndexInRun,
|
|
259
|
-
numberOfMessagesInRun,
|
|
260
|
-
agentId,
|
|
261
|
-
stateSnapshot
|
|
262
|
-
},
|
|
263
|
-
`${runId}-${message.id}-${position}`
|
|
264
|
-
);
|
|
265
|
-
if (result) {
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return result;
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// src/hooks/use-render-activity-message.tsx
|
|
274
|
-
var import_shared4 = require("@copilotkitnext/shared");
|
|
275
|
-
var import_react5 = require("react");
|
|
276
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
277
|
-
function useRenderActivityMessage() {
|
|
278
|
-
const { copilotkit } = useCopilotKit();
|
|
279
|
-
const config = useCopilotChatConfiguration();
|
|
280
|
-
const agentId = config?.agentId ?? import_shared4.DEFAULT_AGENT_ID;
|
|
281
|
-
const renderers = copilotkit.renderActivityMessages;
|
|
282
|
-
return (0, import_react5.useCallback)(
|
|
283
|
-
(message) => {
|
|
284
|
-
if (!renderers.length) {
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
const matches = renderers.filter(
|
|
288
|
-
(renderer2) => renderer2.activityType === message.activityType
|
|
289
|
-
);
|
|
290
|
-
const renderer = matches.find((candidate) => candidate.agentId === agentId) ?? matches.find((candidate) => candidate.agentId === void 0) ?? renderers.find((candidate) => candidate.activityType === "*");
|
|
291
|
-
if (!renderer) {
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
const parseResult = renderer.content.safeParse(message.content);
|
|
295
|
-
if (!parseResult.success) {
|
|
296
|
-
console.warn(
|
|
297
|
-
`Failed to parse content for activity message '${message.activityType}':`,
|
|
298
|
-
parseResult.error
|
|
299
|
-
);
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
const Component = renderer.render;
|
|
303
|
-
const agent = copilotkit.getAgent(agentId);
|
|
304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
305
|
-
Component,
|
|
306
|
-
{
|
|
307
|
-
activityType: message.activityType,
|
|
308
|
-
content: parseResult.data,
|
|
309
|
-
message,
|
|
310
|
-
agent
|
|
311
|
-
},
|
|
312
|
-
message.id
|
|
313
|
-
);
|
|
314
|
-
},
|
|
315
|
-
[agentId, copilotkit, renderers]
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// src/hooks/use-frontend-tool.tsx
|
|
320
|
-
var import_react6 = require("react");
|
|
321
|
-
function useFrontendTool(tool) {
|
|
322
|
-
const { copilotkit } = useCopilotKit();
|
|
323
|
-
(0, import_react6.useEffect)(() => {
|
|
324
|
-
const name = tool.name;
|
|
325
|
-
if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {
|
|
326
|
-
console.warn(
|
|
327
|
-
`Tool '${name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`
|
|
328
|
-
);
|
|
329
|
-
copilotkit.removeTool(name, tool.agentId);
|
|
330
|
-
}
|
|
331
|
-
copilotkit.addTool(tool);
|
|
332
|
-
if (tool.render) {
|
|
333
|
-
const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
|
|
334
|
-
const currentRenderToolCalls = copilotkit.renderToolCalls;
|
|
335
|
-
const mergedMap = /* @__PURE__ */ new Map();
|
|
336
|
-
for (const rc of currentRenderToolCalls) {
|
|
337
|
-
mergedMap.set(keyOf(rc), rc);
|
|
338
|
-
}
|
|
339
|
-
const newEntry = {
|
|
340
|
-
name,
|
|
341
|
-
args: tool.parameters,
|
|
342
|
-
agentId: tool.agentId,
|
|
343
|
-
render: tool.render
|
|
344
|
-
};
|
|
345
|
-
mergedMap.set(keyOf(newEntry), newEntry);
|
|
346
|
-
copilotkit.setRenderToolCalls(Array.from(mergedMap.values()));
|
|
347
|
-
}
|
|
348
|
-
return () => {
|
|
349
|
-
copilotkit.removeTool(name, tool.agentId);
|
|
350
|
-
};
|
|
351
|
-
}, [tool.name, copilotkit]);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// src/hooks/use-human-in-the-loop.tsx
|
|
355
|
-
var import_react7 = require("react");
|
|
356
|
-
var import_react8 = __toESM(require("react"));
|
|
357
|
-
function useHumanInTheLoop(tool) {
|
|
358
|
-
const { copilotkit } = useCopilotKit();
|
|
359
|
-
const resolvePromiseRef = (0, import_react7.useRef)(null);
|
|
360
|
-
const respond = (0, import_react7.useCallback)(async (result) => {
|
|
361
|
-
if (resolvePromiseRef.current) {
|
|
362
|
-
resolvePromiseRef.current(result);
|
|
363
|
-
resolvePromiseRef.current = null;
|
|
364
|
-
}
|
|
365
|
-
}, []);
|
|
366
|
-
const handler = (0, import_react7.useCallback)(async () => {
|
|
367
|
-
return new Promise((resolve) => {
|
|
368
|
-
resolvePromiseRef.current = resolve;
|
|
369
|
-
});
|
|
370
|
-
}, []);
|
|
371
|
-
const RenderComponent = (0, import_react7.useCallback)(
|
|
372
|
-
(props) => {
|
|
373
|
-
const ToolComponent = tool.render;
|
|
374
|
-
if (props.status === "inProgress") {
|
|
375
|
-
const enhancedProps = {
|
|
376
|
-
...props,
|
|
377
|
-
name: tool.name,
|
|
378
|
-
description: tool.description || "",
|
|
379
|
-
respond: void 0
|
|
380
|
-
};
|
|
381
|
-
return import_react8.default.createElement(ToolComponent, enhancedProps);
|
|
382
|
-
} else if (props.status === "executing") {
|
|
383
|
-
const enhancedProps = {
|
|
384
|
-
...props,
|
|
385
|
-
name: tool.name,
|
|
386
|
-
description: tool.description || "",
|
|
387
|
-
respond
|
|
388
|
-
};
|
|
389
|
-
return import_react8.default.createElement(ToolComponent, enhancedProps);
|
|
390
|
-
} else if (props.status === "complete") {
|
|
391
|
-
const enhancedProps = {
|
|
392
|
-
...props,
|
|
393
|
-
name: tool.name,
|
|
394
|
-
description: tool.description || "",
|
|
395
|
-
respond: void 0
|
|
396
|
-
};
|
|
397
|
-
return import_react8.default.createElement(ToolComponent, enhancedProps);
|
|
398
|
-
}
|
|
399
|
-
return import_react8.default.createElement(ToolComponent, props);
|
|
400
|
-
},
|
|
401
|
-
[tool.render, tool.name, tool.description, respond]
|
|
402
|
-
);
|
|
403
|
-
const frontendTool = {
|
|
404
|
-
...tool,
|
|
405
|
-
handler,
|
|
406
|
-
render: RenderComponent
|
|
407
|
-
};
|
|
408
|
-
useFrontendTool(frontendTool);
|
|
409
|
-
(0, import_react7.useEffect)(() => {
|
|
410
|
-
return () => {
|
|
411
|
-
const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
|
|
412
|
-
const currentRenderToolCalls = copilotkit.renderToolCalls;
|
|
413
|
-
const filtered = currentRenderToolCalls.filter(
|
|
414
|
-
(rc) => keyOf(rc) !== keyOf({ name: tool.name, agentId: tool.agentId })
|
|
415
|
-
);
|
|
416
|
-
copilotkit.setRenderToolCalls(filtered);
|
|
417
|
-
};
|
|
418
|
-
}, [copilotkit, tool.name, tool.agentId]);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// src/hooks/use-agent.tsx
|
|
422
|
-
var import_react9 = require("react");
|
|
423
|
-
var import_shared5 = require("@copilotkitnext/shared");
|
|
424
|
-
var ALL_UPDATES = [
|
|
425
|
-
"OnMessagesChanged" /* OnMessagesChanged */,
|
|
426
|
-
"OnStateChanged" /* OnStateChanged */,
|
|
427
|
-
"OnRunStatusChanged" /* OnRunStatusChanged */
|
|
428
|
-
];
|
|
429
|
-
function useAgent({ agentId, updates } = {}) {
|
|
430
|
-
agentId ??= import_shared5.DEFAULT_AGENT_ID;
|
|
431
|
-
const { copilotkit } = useCopilotKit();
|
|
432
|
-
const [, forceUpdate] = (0, import_react9.useReducer)((x) => x + 1, 0);
|
|
433
|
-
const updateFlags = (0, import_react9.useMemo)(
|
|
434
|
-
() => updates ?? ALL_UPDATES,
|
|
435
|
-
[JSON.stringify(updates)]
|
|
436
|
-
);
|
|
437
|
-
const agent = (0, import_react9.useMemo)(() => {
|
|
438
|
-
return copilotkit.getAgent(agentId);
|
|
439
|
-
}, [
|
|
440
|
-
agentId,
|
|
441
|
-
copilotkit.agents,
|
|
442
|
-
copilotkit.runtimeConnectionStatus,
|
|
443
|
-
copilotkit
|
|
444
|
-
]);
|
|
445
|
-
(0, import_react9.useEffect)(() => {
|
|
446
|
-
if (!agent) {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
if (updateFlags.length === 0) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
const handlers = {};
|
|
453
|
-
if (updateFlags.includes("OnMessagesChanged" /* OnMessagesChanged */)) {
|
|
454
|
-
handlers.onMessagesChanged = () => {
|
|
455
|
-
forceUpdate();
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
if (updateFlags.includes("OnStateChanged" /* OnStateChanged */)) {
|
|
459
|
-
handlers.onStateChanged = () => {
|
|
460
|
-
forceUpdate();
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
if (updateFlags.includes("OnRunStatusChanged" /* OnRunStatusChanged */)) {
|
|
464
|
-
handlers.onRunInitialized = () => {
|
|
465
|
-
forceUpdate();
|
|
466
|
-
};
|
|
467
|
-
handlers.onRunFinalized = () => {
|
|
468
|
-
forceUpdate();
|
|
469
|
-
};
|
|
470
|
-
handlers.onRunFailed = () => {
|
|
471
|
-
forceUpdate();
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
const subscription = agent.subscribe(handlers);
|
|
475
|
-
return () => subscription.unsubscribe();
|
|
476
|
-
}, [agent, forceUpdate, JSON.stringify(updateFlags)]);
|
|
477
|
-
return {
|
|
478
|
-
agent
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// src/hooks/use-agent-context.tsx
|
|
483
|
-
var import_react10 = require("react");
|
|
484
|
-
function useAgentContext(context) {
|
|
485
|
-
const { description, value } = context;
|
|
486
|
-
const { copilotkit } = useCopilotKit();
|
|
487
|
-
(0, import_react10.useEffect)(() => {
|
|
488
|
-
if (!copilotkit) return;
|
|
489
|
-
const id = copilotkit.addContext(context);
|
|
490
|
-
return () => {
|
|
491
|
-
copilotkit.removeContext(id);
|
|
492
|
-
};
|
|
493
|
-
}, [description, value, copilotkit]);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// src/hooks/use-suggestions.tsx
|
|
497
|
-
var import_react11 = require("react");
|
|
498
|
-
var import_shared6 = require("@copilotkitnext/shared");
|
|
499
|
-
function useSuggestions({ agentId } = {}) {
|
|
500
|
-
const { copilotkit } = useCopilotKit();
|
|
501
|
-
const config = useCopilotChatConfiguration();
|
|
502
|
-
const resolvedAgentId = (0, import_react11.useMemo)(() => agentId ?? config?.agentId ?? import_shared6.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
|
|
503
|
-
const [suggestions, setSuggestions] = (0, import_react11.useState)(() => {
|
|
504
|
-
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
505
|
-
return result.suggestions;
|
|
506
|
-
});
|
|
507
|
-
const [isLoading, setIsLoading] = (0, import_react11.useState)(() => {
|
|
508
|
-
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
509
|
-
return result.isLoading;
|
|
510
|
-
});
|
|
511
|
-
(0, import_react11.useEffect)(() => {
|
|
512
|
-
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
513
|
-
setSuggestions(result.suggestions);
|
|
514
|
-
setIsLoading(result.isLoading);
|
|
515
|
-
}, [copilotkit, resolvedAgentId]);
|
|
516
|
-
(0, import_react11.useEffect)(() => {
|
|
517
|
-
const unsubscribe = copilotkit.subscribe({
|
|
518
|
-
onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
|
|
519
|
-
if (changedAgentId !== resolvedAgentId) {
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
setSuggestions(suggestions2);
|
|
523
|
-
},
|
|
524
|
-
onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {
|
|
525
|
-
if (changedAgentId !== resolvedAgentId) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
setIsLoading(true);
|
|
529
|
-
},
|
|
530
|
-
onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {
|
|
531
|
-
if (changedAgentId !== resolvedAgentId) {
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
setIsLoading(false);
|
|
535
|
-
},
|
|
536
|
-
onSuggestionsConfigChanged: () => {
|
|
537
|
-
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
538
|
-
setSuggestions(result.suggestions);
|
|
539
|
-
setIsLoading(result.isLoading);
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
return () => {
|
|
543
|
-
unsubscribe();
|
|
544
|
-
};
|
|
545
|
-
}, [copilotkit, resolvedAgentId]);
|
|
546
|
-
const reloadSuggestions = (0, import_react11.useCallback)(() => {
|
|
547
|
-
copilotkit.reloadSuggestions(resolvedAgentId);
|
|
548
|
-
}, [copilotkit, resolvedAgentId]);
|
|
549
|
-
const clearSuggestions = (0, import_react11.useCallback)(() => {
|
|
550
|
-
copilotkit.clearSuggestions(resolvedAgentId);
|
|
551
|
-
}, [copilotkit, resolvedAgentId]);
|
|
552
|
-
return {
|
|
553
|
-
suggestions,
|
|
554
|
-
reloadSuggestions,
|
|
555
|
-
clearSuggestions,
|
|
556
|
-
isLoading
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// src/hooks/use-configure-suggestions.tsx
|
|
561
|
-
var import_react12 = require("react");
|
|
562
|
-
var import_shared7 = require("@copilotkitnext/shared");
|
|
563
|
-
var EMPTY_DEPS = [];
|
|
564
|
-
function useConfigureSuggestions(config, options) {
|
|
565
|
-
const { copilotkit } = useCopilotKit();
|
|
566
|
-
const chatConfig = useCopilotChatConfiguration();
|
|
567
|
-
const extraDeps = options?.deps ?? EMPTY_DEPS;
|
|
568
|
-
const resolvedConsumerAgentId = (0, import_react12.useMemo)(() => chatConfig?.agentId ?? import_shared7.DEFAULT_AGENT_ID, [chatConfig?.agentId]);
|
|
569
|
-
const rawConsumerAgentId = (0, import_react12.useMemo)(() => config ? config.consumerAgentId : void 0, [config]);
|
|
570
|
-
const normalizationCacheRef = (0, import_react12.useRef)({
|
|
571
|
-
serialized: null,
|
|
572
|
-
config: null
|
|
573
|
-
});
|
|
574
|
-
const { normalizedConfig, serializedConfig } = (0, import_react12.useMemo)(() => {
|
|
575
|
-
if (!config) {
|
|
576
|
-
normalizationCacheRef.current = { serialized: null, config: null };
|
|
577
|
-
return { normalizedConfig: null, serializedConfig: null };
|
|
578
|
-
}
|
|
579
|
-
if (config.available === "disabled") {
|
|
580
|
-
normalizationCacheRef.current = { serialized: null, config: null };
|
|
581
|
-
return { normalizedConfig: null, serializedConfig: null };
|
|
582
|
-
}
|
|
583
|
-
let built;
|
|
584
|
-
if (isDynamicConfig(config)) {
|
|
585
|
-
built = {
|
|
586
|
-
...config
|
|
587
|
-
};
|
|
588
|
-
} else {
|
|
589
|
-
const normalizedSuggestions = normalizeStaticSuggestions(config.suggestions);
|
|
590
|
-
const baseConfig = {
|
|
591
|
-
...config,
|
|
592
|
-
suggestions: normalizedSuggestions
|
|
593
|
-
};
|
|
594
|
-
built = baseConfig;
|
|
595
|
-
}
|
|
596
|
-
const serialized = JSON.stringify(built);
|
|
597
|
-
const cache = normalizationCacheRef.current;
|
|
598
|
-
if (cache.serialized === serialized && cache.config) {
|
|
599
|
-
return { normalizedConfig: cache.config, serializedConfig: serialized };
|
|
600
|
-
}
|
|
601
|
-
normalizationCacheRef.current = { serialized, config: built };
|
|
602
|
-
return { normalizedConfig: built, serializedConfig: serialized };
|
|
603
|
-
}, [config, resolvedConsumerAgentId, ...extraDeps]);
|
|
604
|
-
const latestConfigRef = (0, import_react12.useRef)(null);
|
|
605
|
-
latestConfigRef.current = normalizedConfig;
|
|
606
|
-
const previousSerializedConfigRef = (0, import_react12.useRef)(null);
|
|
607
|
-
const targetAgentId = (0, import_react12.useMemo)(() => {
|
|
608
|
-
if (!normalizedConfig) {
|
|
609
|
-
return resolvedConsumerAgentId;
|
|
610
|
-
}
|
|
611
|
-
const consumer = normalizedConfig.consumerAgentId;
|
|
612
|
-
if (!consumer || consumer === "*") {
|
|
613
|
-
return resolvedConsumerAgentId;
|
|
614
|
-
}
|
|
615
|
-
return consumer;
|
|
616
|
-
}, [normalizedConfig, resolvedConsumerAgentId]);
|
|
617
|
-
const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
|
|
618
|
-
const requestReload = (0, import_react12.useCallback)(() => {
|
|
619
|
-
if (!normalizedConfig) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
if (isGlobalConfig) {
|
|
623
|
-
const agents = Object.values(copilotkit.agents ?? {});
|
|
624
|
-
for (const entry of agents) {
|
|
625
|
-
const agentId = entry.agentId;
|
|
626
|
-
if (!agentId) {
|
|
627
|
-
continue;
|
|
628
|
-
}
|
|
629
|
-
if (!entry.isRunning) {
|
|
630
|
-
copilotkit.reloadSuggestions(agentId);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
if (!targetAgentId) {
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
copilotkit.reloadSuggestions(targetAgentId);
|
|
639
|
-
}, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
|
|
640
|
-
(0, import_react12.useEffect)(() => {
|
|
641
|
-
if (!serializedConfig || !latestConfigRef.current) {
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
const id = copilotkit.addSuggestionsConfig(latestConfigRef.current);
|
|
645
|
-
requestReload();
|
|
646
|
-
return () => {
|
|
647
|
-
copilotkit.removeSuggestionsConfig(id);
|
|
648
|
-
};
|
|
649
|
-
}, [copilotkit, serializedConfig, requestReload]);
|
|
650
|
-
(0, import_react12.useEffect)(() => {
|
|
651
|
-
if (!normalizedConfig) {
|
|
652
|
-
previousSerializedConfigRef.current = null;
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
if (serializedConfig && previousSerializedConfigRef.current === serializedConfig) {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
if (serializedConfig) {
|
|
659
|
-
previousSerializedConfigRef.current = serializedConfig;
|
|
660
|
-
}
|
|
661
|
-
requestReload();
|
|
662
|
-
}, [normalizedConfig, requestReload, serializedConfig]);
|
|
663
|
-
(0, import_react12.useEffect)(() => {
|
|
664
|
-
if (!normalizedConfig || extraDeps.length === 0) {
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
requestReload();
|
|
668
|
-
}, [extraDeps.length, normalizedConfig, requestReload, ...extraDeps]);
|
|
669
|
-
}
|
|
670
|
-
function isDynamicConfig(config) {
|
|
671
|
-
return "instructions" in config;
|
|
672
|
-
}
|
|
673
|
-
function normalizeStaticSuggestions(suggestions) {
|
|
674
|
-
return suggestions.map((suggestion) => ({
|
|
675
|
-
...suggestion,
|
|
676
|
-
isLoading: suggestion.isLoading ?? false
|
|
677
|
-
}));
|
|
678
|
-
}
|
|
679
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
680
|
-
0 && (module.exports = {
|
|
681
|
-
useAgent,
|
|
682
|
-
useAgentContext,
|
|
683
|
-
useConfigureSuggestions,
|
|
684
|
-
useFrontendTool,
|
|
685
|
-
useHumanInTheLoop,
|
|
686
|
-
useRenderActivityMessage,
|
|
687
|
-
useRenderCustomMessages,
|
|
688
|
-
useRenderToolCall,
|
|
689
|
-
useSuggestions
|
|
690
|
-
});
|
|
691
|
-
//# sourceMappingURL=index.js.map
|