@copilotkit/react-core 2.0.0-next.1 → 2.0.0-rc.0
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/LICENSE +21 -0
- package/README.md +18 -12
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts +954 -0
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +1 -0
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts +954 -0
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +1 -0
- package/dist/MarkdownSurfaces-C2XZISKn.cjs +3964 -0
- package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +1 -0
- package/dist/MarkdownSurfaces-ChSlVYOk.mjs +3655 -0
- package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +1 -0
- package/dist/context.cjs +144 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +166 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.mts +166 -0
- package/dist/context.d.mts.map +1 -0
- package/dist/context.mjs +136 -0
- package/dist/context.mjs.map +1 -0
- package/dist/generative-ui.cjs +8151 -0
- package/dist/generative-ui.cjs.map +1 -0
- package/dist/generative-ui.d.cts +4952 -0
- package/dist/generative-ui.d.cts.map +1 -0
- package/dist/generative-ui.d.mts +4952 -0
- package/dist/generative-ui.d.mts.map +1 -0
- package/dist/generative-ui.mjs +8137 -0
- package/dist/generative-ui.mjs.map +1 -0
- package/dist/headless.cjs +1927 -0
- package/dist/headless.cjs.map +1 -0
- package/dist/headless.d.cts +1117 -0
- package/dist/headless.d.cts.map +1 -0
- package/dist/headless.d.mts +1008 -0
- package/dist/headless.d.mts.map +1 -0
- package/dist/headless.mjs +1869 -0
- package/dist/headless.mjs.map +1 -0
- package/dist/index.cjs +15576 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.cts +3450 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3433 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +13927 -146
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +18856 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +124 -52
- package/CHANGELOG.md +0 -4210
- package/dist/chunk-2IDV5OHF.mjs +0 -11
- package/dist/chunk-2IDV5OHF.mjs.map +0 -1
- package/dist/chunk-36KQV2NA.mjs +0 -1
- package/dist/chunk-36KQV2NA.mjs.map +0 -1
- package/dist/chunk-3V5TOYKW.mjs +0 -120
- package/dist/chunk-3V5TOYKW.mjs.map +0 -1
- package/dist/chunk-4CEQJ2X6.mjs +0 -31
- package/dist/chunk-4CEQJ2X6.mjs.map +0 -1
- package/dist/chunk-4RRMC7L2.mjs +0 -32
- package/dist/chunk-4RRMC7L2.mjs.map +0 -1
- package/dist/chunk-4YZA2BZC.mjs +0 -551
- package/dist/chunk-4YZA2BZC.mjs.map +0 -1
- package/dist/chunk-53K6WNJG.mjs +0 -36
- package/dist/chunk-53K6WNJG.mjs.map +0 -1
- package/dist/chunk-6ESSSQ7Q.mjs +0 -134
- package/dist/chunk-6ESSSQ7Q.mjs.map +0 -1
- package/dist/chunk-6PUNP7CD.mjs +0 -102
- package/dist/chunk-6PUNP7CD.mjs.map +0 -1
- package/dist/chunk-6YOKPWQ7.mjs +0 -1
- package/dist/chunk-6YOKPWQ7.mjs.map +0 -1
- package/dist/chunk-6ZLPNY7X.mjs +0 -225
- package/dist/chunk-6ZLPNY7X.mjs.map +0 -1
- package/dist/chunk-7DTB7S5V.mjs +0 -83
- package/dist/chunk-7DTB7S5V.mjs.map +0 -1
- package/dist/chunk-7IBF6RBW.mjs +0 -23
- package/dist/chunk-7IBF6RBW.mjs.map +0 -1
- package/dist/chunk-A6NKSGH3.mjs +0 -1
- package/dist/chunk-A6NKSGH3.mjs.map +0 -1
- package/dist/chunk-ABWT4DRT.mjs +0 -24
- package/dist/chunk-ABWT4DRT.mjs.map +0 -1
- package/dist/chunk-AFNWX62Q.mjs +0 -110
- package/dist/chunk-AFNWX62Q.mjs.map +0 -1
- package/dist/chunk-BUSWSDYO.mjs +0 -17
- package/dist/chunk-BUSWSDYO.mjs.map +0 -1
- package/dist/chunk-CDUIA2WM.mjs +0 -60
- package/dist/chunk-CDUIA2WM.mjs.map +0 -1
- package/dist/chunk-CYDWEPFL.mjs +0 -1
- package/dist/chunk-CYDWEPFL.mjs.map +0 -1
- package/dist/chunk-DMLQZG75.mjs +0 -25
- package/dist/chunk-DMLQZG75.mjs.map +0 -1
- package/dist/chunk-E7SE25ZU.mjs +0 -59
- package/dist/chunk-E7SE25ZU.mjs.map +0 -1
- package/dist/chunk-EFL5OBKN.mjs +0 -310
- package/dist/chunk-EFL5OBKN.mjs.map +0 -1
- package/dist/chunk-F555TVE4.mjs +0 -33
- package/dist/chunk-F555TVE4.mjs.map +0 -1
- package/dist/chunk-FD6FGKYY.mjs +0 -1
- package/dist/chunk-FD6FGKYY.mjs.map +0 -1
- package/dist/chunk-FDOMAPJY.mjs +0 -59
- package/dist/chunk-FDOMAPJY.mjs.map +0 -1
- package/dist/chunk-FQFXYAV7.mjs +0 -86
- package/dist/chunk-FQFXYAV7.mjs.map +0 -1
- package/dist/chunk-GPEJNVE5.mjs +0 -80
- package/dist/chunk-GPEJNVE5.mjs.map +0 -1
- package/dist/chunk-HE22TZMF.mjs +0 -186
- package/dist/chunk-HE22TZMF.mjs.map +0 -1
- package/dist/chunk-I76HKHPJ.mjs +0 -32
- package/dist/chunk-I76HKHPJ.mjs.map +0 -1
- package/dist/chunk-ICIK2BSB.mjs +0 -17
- package/dist/chunk-ICIK2BSB.mjs.map +0 -1
- package/dist/chunk-JD7BAH7U.mjs +0 -1
- package/dist/chunk-JD7BAH7U.mjs.map +0 -1
- package/dist/chunk-LHERIF3L.mjs +0 -83
- package/dist/chunk-LHERIF3L.mjs.map +0 -1
- package/dist/chunk-LSHFN2Y5.mjs +0 -349
- package/dist/chunk-LSHFN2Y5.mjs.map +0 -1
- package/dist/chunk-LUGEI4YQ.mjs +0 -1
- package/dist/chunk-LUGEI4YQ.mjs.map +0 -1
- package/dist/chunk-NB2FKV2V.mjs +0 -1
- package/dist/chunk-NB2FKV2V.mjs.map +0 -1
- package/dist/chunk-NBK4KBLX.mjs +0 -54
- package/dist/chunk-NBK4KBLX.mjs.map +0 -1
- package/dist/chunk-O7ARI5CV.mjs +0 -31
- package/dist/chunk-O7ARI5CV.mjs.map +0 -1
- package/dist/chunk-PIF5KJYI.mjs +0 -103
- package/dist/chunk-PIF5KJYI.mjs.map +0 -1
- package/dist/chunk-PMAFHQ7P.mjs +0 -65
- package/dist/chunk-PMAFHQ7P.mjs.map +0 -1
- package/dist/chunk-QNUAXSDP.mjs +0 -166
- package/dist/chunk-QNUAXSDP.mjs.map +0 -1
- package/dist/chunk-RKTVJRK7.mjs +0 -143
- package/dist/chunk-RKTVJRK7.mjs.map +0 -1
- package/dist/chunk-SKC7AJIV.mjs +0 -61
- package/dist/chunk-SKC7AJIV.mjs.map +0 -1
- package/dist/chunk-SPCZTZCY.mjs +0 -1
- package/dist/chunk-SPCZTZCY.mjs.map +0 -1
- package/dist/chunk-VV56AVPB.mjs +0 -125
- package/dist/chunk-VV56AVPB.mjs.map +0 -1
- package/dist/chunk-WF65O6HX.mjs +0 -66
- package/dist/chunk-WF65O6HX.mjs.map +0 -1
- package/dist/chunk-XDFVCQD3.mjs +0 -27
- package/dist/chunk-XDFVCQD3.mjs.map +0 -1
- package/dist/chunk-YCG6SNAU.mjs +0 -759
- package/dist/chunk-YCG6SNAU.mjs.map +0 -1
- package/dist/chunk-YTQHRJUA.mjs +0 -86
- package/dist/chunk-YTQHRJUA.mjs.map +0 -1
- package/dist/chunk-YYN33GSG.mjs +0 -73
- package/dist/chunk-YYN33GSG.mjs.map +0 -1
- package/dist/chunk-Z6JV2LRY.mjs +0 -37
- package/dist/chunk-Z6JV2LRY.mjs.map +0 -1
- package/dist/chunk-ZVF5Q6IH.mjs +0 -29
- package/dist/chunk-ZVF5Q6IH.mjs.map +0 -1
- package/dist/chunk-ZYTXB6HH.mjs +0 -151
- package/dist/chunk-ZYTXB6HH.mjs.map +0 -1
- package/dist/components/CopilotListeners.d.ts +0 -3
- package/dist/components/CopilotListeners.js +0 -101
- package/dist/components/CopilotListeners.js.map +0 -1
- package/dist/components/CopilotListeners.mjs +0 -9
- package/dist/components/CopilotListeners.mjs.map +0 -1
- package/dist/components/copilot-provider/copilot-messages.d.ts +0 -24
- package/dist/components/copilot-provider/copilot-messages.js +0 -351
- package/dist/components/copilot-provider/copilot-messages.js.map +0 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +0 -16
- package/dist/components/copilot-provider/copilot-messages.mjs.map +0 -1
- package/dist/components/copilot-provider/copilotkit-props.d.ts +0 -160
- package/dist/components/copilot-provider/copilotkit-props.js +0 -19
- package/dist/components/copilot-provider/copilotkit-props.js.map +0 -1
- package/dist/components/copilot-provider/copilotkit-props.mjs +0 -1
- package/dist/components/copilot-provider/copilotkit-props.mjs.map +0 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +0 -19
- package/dist/components/copilot-provider/copilotkit.js +0 -1960
- package/dist/components/copilot-provider/copilotkit.js.map +0 -1
- package/dist/components/copilot-provider/copilotkit.mjs +0 -31
- package/dist/components/copilot-provider/copilotkit.mjs.map +0 -1
- package/dist/components/copilot-provider/index.d.ts +0 -14
- package/dist/components/copilot-provider/index.js +0 -1960
- package/dist/components/copilot-provider/index.js.map +0 -1
- package/dist/components/copilot-provider/index.mjs +0 -30
- package/dist/components/copilot-provider/index.mjs.map +0 -1
- package/dist/components/dev-console/console-trigger.d.ts +0 -8
- package/dist/components/dev-console/console-trigger.js +0 -1202
- package/dist/components/dev-console/console-trigger.js.map +0 -1
- package/dist/components/dev-console/console-trigger.mjs +0 -233
- package/dist/components/dev-console/console-trigger.mjs.map +0 -1
- package/dist/components/dev-console/developer-console-modal.d.ts +0 -10
- package/dist/components/dev-console/developer-console-modal.js +0 -987
- package/dist/components/dev-console/developer-console-modal.js.map +0 -1
- package/dist/components/dev-console/developer-console-modal.mjs +0 -12
- package/dist/components/dev-console/developer-console-modal.mjs.map +0 -1
- package/dist/components/dev-console/icons.d.ts +0 -9
- package/dist/components/dev-console/icons.js +0 -131
- package/dist/components/dev-console/icons.js.map +0 -1
- package/dist/components/dev-console/icons.mjs +0 -16
- package/dist/components/dev-console/icons.mjs.map +0 -1
- package/dist/components/error-boundary/error-boundary.d.ts +0 -31
- package/dist/components/error-boundary/error-boundary.js +0 -500
- package/dist/components/error-boundary/error-boundary.js.map +0 -1
- package/dist/components/error-boundary/error-boundary.mjs +0 -15
- package/dist/components/error-boundary/error-boundary.mjs.map +0 -1
- package/dist/components/error-boundary/error-utils.d.ts +0 -11
- package/dist/components/error-boundary/error-utils.js +0 -190
- package/dist/components/error-boundary/error-utils.js.map +0 -1
- package/dist/components/error-boundary/error-utils.mjs +0 -14
- package/dist/components/error-boundary/error-utils.mjs.map +0 -1
- package/dist/components/index.d.ts +0 -14
- package/dist/components/index.js +0 -1960
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -31
- package/dist/components/index.mjs.map +0 -1
- package/dist/components/toast/exclamation-mark-icon.d.ts +0 -9
- package/dist/components/toast/exclamation-mark-icon.js +0 -55
- package/dist/components/toast/exclamation-mark-icon.js.map +0 -1
- package/dist/components/toast/exclamation-mark-icon.mjs +0 -8
- package/dist/components/toast/exclamation-mark-icon.mjs.map +0 -1
- package/dist/components/toast/toast-provider.d.ts +0 -27
- package/dist/components/toast/toast-provider.js +0 -347
- package/dist/components/toast/toast-provider.js.map +0 -1
- package/dist/components/toast/toast-provider.mjs +0 -10
- package/dist/components/toast/toast-provider.mjs.map +0 -1
- package/dist/components/usage-banner.d.ts +0 -29
- package/dist/components/usage-banner.js +0 -247
- package/dist/components/usage-banner.js.map +0 -1
- package/dist/components/usage-banner.mjs +0 -12
- package/dist/components/usage-banner.mjs.map +0 -1
- package/dist/context/coagent-state-renders-context.d.ts +0 -24
- package/dist/context/coagent-state-renders-context.js +0 -91
- package/dist/context/coagent-state-renders-context.js.map +0 -1
- package/dist/context/coagent-state-renders-context.mjs +0 -12
- package/dist/context/coagent-state-renders-context.mjs.map +0 -1
- package/dist/context/copilot-context.d.ts +0 -10
- package/dist/context/copilot-context.js +0 -161
- package/dist/context/copilot-context.js.map +0 -1
- package/dist/context/copilot-context.mjs +0 -10
- package/dist/context/copilot-context.mjs.map +0 -1
- package/dist/context/copilot-messages-context.d.ts +0 -18
- package/dist/context/copilot-messages-context.js +0 -60
- package/dist/context/copilot-messages-context.js.map +0 -1
- package/dist/context/copilot-messages-context.mjs +0 -10
- package/dist/context/copilot-messages-context.mjs.map +0 -1
- package/dist/context/index.d.ts +0 -15
- package/dist/context/index.js +0 -285
- package/dist/context/index.js.map +0 -1
- package/dist/context/index.mjs +0 -33
- package/dist/context/index.mjs.map +0 -1
- package/dist/context/threads-context.d.ts +0 -16
- package/dist/context/threads-context.js +0 -59
- package/dist/context/threads-context.js.map +0 -1
- package/dist/context/threads-context.mjs +0 -12
- package/dist/context/threads-context.mjs.map +0 -1
- package/dist/copilot-context-ec77e921.d.ts +0 -209
- package/dist/hooks/index.d.ts +0 -33
- package/dist/hooks/index.js +0 -1774
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -91
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/hooks/use-agent-nodename.d.ts +0 -3
- package/dist/hooks/use-agent-nodename.js +0 -56
- package/dist/hooks/use-agent-nodename.js.map +0 -1
- package/dist/hooks/use-agent-nodename.mjs +0 -8
- package/dist/hooks/use-agent-nodename.mjs.map +0 -1
- package/dist/hooks/use-coagent-state-render-bridge.d.ts +0 -100
- package/dist/hooks/use-coagent-state-render-bridge.js +0 -214
- package/dist/hooks/use-coagent-state-render-bridge.js.map +0 -1
- package/dist/hooks/use-coagent-state-render-bridge.mjs +0 -15
- package/dist/hooks/use-coagent-state-render-bridge.mjs.map +0 -1
- package/dist/hooks/use-coagent-state-render.d.ts +0 -55
- package/dist/hooks/use-coagent-state-render.js +0 -255
- package/dist/hooks/use-coagent-state-render.js.map +0 -1
- package/dist/hooks/use-coagent-state-render.mjs +0 -11
- package/dist/hooks/use-coagent-state-render.mjs.map +0 -1
- package/dist/hooks/use-coagent.d.ts +0 -192
- package/dist/hooks/use-coagent.js +0 -233
- package/dist/hooks/use-coagent.js.map +0 -1
- package/dist/hooks/use-coagent.mjs +0 -9
- package/dist/hooks/use-coagent.mjs.map +0 -1
- package/dist/hooks/use-configure-chat-suggestions.d.ts +0 -36
- package/dist/hooks/use-configure-chat-suggestions.js +0 -79
- package/dist/hooks/use-configure-chat-suggestions.js.map +0 -1
- package/dist/hooks/use-configure-chat-suggestions.mjs +0 -47
- package/dist/hooks/use-configure-chat-suggestions.mjs.map +0 -1
- package/dist/hooks/use-copilot-action.d.ts +0 -103
- package/dist/hooks/use-copilot-action.js +0 -295
- package/dist/hooks/use-copilot-action.js.map +0 -1
- package/dist/hooks/use-copilot-action.mjs +0 -11
- package/dist/hooks/use-copilot-action.mjs.map +0 -1
- package/dist/hooks/use-copilot-additional-instructions.d.ts +0 -26
- package/dist/hooks/use-copilot-additional-instructions.js +0 -177
- package/dist/hooks/use-copilot-additional-instructions.js.map +0 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +0 -9
- package/dist/hooks/use-copilot-additional-instructions.mjs.map +0 -1
- package/dist/hooks/use-copilot-authenticated-action.d.ts +0 -18
- package/dist/hooks/use-copilot-authenticated-action.js +0 -462
- package/dist/hooks/use-copilot-authenticated-action.js.map +0 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +0 -13
- package/dist/hooks/use-copilot-authenticated-action.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat-headless_c.d.ts +0 -25
- package/dist/hooks/use-copilot-chat-headless_c.js +0 -1044
- package/dist/hooks/use-copilot-chat-headless_c.js.map +0 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +0 -24
- package/dist/hooks/use-copilot-chat-headless_c.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +0 -35
- package/dist/hooks/use-copilot-chat-suggestions.js +0 -60
- package/dist/hooks/use-copilot-chat-suggestions.js.map +0 -1
- package/dist/hooks/use-copilot-chat-suggestions.mjs +0 -8
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat.d.ts +0 -92
- package/dist/hooks/use-copilot-chat.js +0 -978
- package/dist/hooks/use-copilot-chat.js.map +0 -1
- package/dist/hooks/use-copilot-chat.mjs +0 -21
- package/dist/hooks/use-copilot-chat.mjs.map +0 -1
- package/dist/hooks/use-copilot-chat_internal.d.ts +0 -244
- package/dist/hooks/use-copilot-chat_internal.js +0 -976
- package/dist/hooks/use-copilot-chat_internal.js.map +0 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +0 -22
- package/dist/hooks/use-copilot-chat_internal.mjs.map +0 -1
- package/dist/hooks/use-copilot-readable.d.ts +0 -37
- package/dist/hooks/use-copilot-readable.js +0 -61
- package/dist/hooks/use-copilot-readable.js.map +0 -1
- package/dist/hooks/use-copilot-readable.mjs +0 -8
- package/dist/hooks/use-copilot-readable.mjs.map +0 -1
- package/dist/hooks/use-copilot-runtime-client.d.ts +0 -10
- package/dist/hooks/use-copilot-runtime-client.js +0 -203
- package/dist/hooks/use-copilot-runtime-client.js.map +0 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +0 -9
- package/dist/hooks/use-copilot-runtime-client.mjs.map +0 -1
- package/dist/hooks/use-default-tool.d.ts +0 -8
- package/dist/hooks/use-default-tool.js +0 -302
- package/dist/hooks/use-default-tool.js.map +0 -1
- package/dist/hooks/use-default-tool.mjs +0 -12
- package/dist/hooks/use-default-tool.mjs.map +0 -1
- package/dist/hooks/use-flat-category-store.d.ts +0 -9
- package/dist/hooks/use-flat-category-store.js +0 -93
- package/dist/hooks/use-flat-category-store.js.map +0 -1
- package/dist/hooks/use-flat-category-store.mjs +0 -8
- package/dist/hooks/use-flat-category-store.mjs.map +0 -1
- package/dist/hooks/use-frontend-tool.d.ts +0 -11
- package/dist/hooks/use-frontend-tool.js +0 -104
- package/dist/hooks/use-frontend-tool.js.map +0 -1
- package/dist/hooks/use-frontend-tool.mjs +0 -8
- package/dist/hooks/use-frontend-tool.mjs.map +0 -1
- package/dist/hooks/use-human-in-the-loop.d.ts +0 -13
- package/dist/hooks/use-human-in-the-loop.js +0 -122
- package/dist/hooks/use-human-in-the-loop.js.map +0 -1
- package/dist/hooks/use-human-in-the-loop.mjs +0 -8
- package/dist/hooks/use-human-in-the-loop.mjs.map +0 -1
- package/dist/hooks/use-langgraph-interrupt-render.d.ts +0 -6
- package/dist/hooks/use-langgraph-interrupt-render.js +0 -318
- package/dist/hooks/use-langgraph-interrupt-render.js.map +0 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +0 -14
- package/dist/hooks/use-langgraph-interrupt-render.mjs.map +0 -1
- package/dist/hooks/use-langgraph-interrupt.d.ts +0 -14
- package/dist/hooks/use-langgraph-interrupt.js +0 -201
- package/dist/hooks/use-langgraph-interrupt.js.map +0 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +0 -10
- package/dist/hooks/use-langgraph-interrupt.mjs.map +0 -1
- package/dist/hooks/use-lazy-tool-renderer.d.ts +0 -6
- package/dist/hooks/use-lazy-tool-renderer.js +0 -53
- package/dist/hooks/use-lazy-tool-renderer.js.map +0 -1
- package/dist/hooks/use-lazy-tool-renderer.mjs +0 -8
- package/dist/hooks/use-lazy-tool-renderer.mjs.map +0 -1
- package/dist/hooks/use-make-copilot-document-readable.d.ts +0 -12
- package/dist/hooks/use-make-copilot-document-readable.js +0 -176
- package/dist/hooks/use-make-copilot-document-readable.js.map +0 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +0 -9
- package/dist/hooks/use-make-copilot-document-readable.mjs.map +0 -1
- package/dist/hooks/use-render-tool-call.d.ts +0 -12
- package/dist/hooks/use-render-tool-call.js +0 -90
- package/dist/hooks/use-render-tool-call.js.map +0 -1
- package/dist/hooks/use-render-tool-call.mjs +0 -8
- package/dist/hooks/use-render-tool-call.mjs.map +0 -1
- package/dist/hooks/use-tree.d.ts +0 -19
- package/dist/hooks/use-tree.js +0 -175
- package/dist/hooks/use-tree.js.map +0 -1
- package/dist/hooks/use-tree.mjs +0 -8
- package/dist/hooks/use-tree.mjs.map +0 -1
- package/dist/index.d.ts +0 -43
- package/dist/index.js +0 -3528
- package/dist/index.js.map +0 -1
- package/dist/lib/copilot-task.d.ts +0 -97
- package/dist/lib/copilot-task.js +0 -194
- package/dist/lib/copilot-task.js.map +0 -1
- package/dist/lib/copilot-task.mjs +0 -31
- package/dist/lib/copilot-task.mjs.map +0 -1
- package/dist/lib/index.d.ts +0 -11
- package/dist/lib/index.js +0 -196
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/index.mjs +0 -32
- package/dist/lib/index.mjs.map +0 -1
- package/dist/lib/status-checker.d.ts +0 -17
- package/dist/lib/status-checker.js +0 -102
- package/dist/lib/status-checker.js.map +0 -1
- package/dist/lib/status-checker.mjs +0 -8
- package/dist/lib/status-checker.mjs.map +0 -1
- package/dist/setupTests.d.ts +0 -2
- package/dist/setupTests.js +0 -26
- package/dist/setupTests.js.map +0 -1
- package/dist/setupTests.mjs +0 -24
- package/dist/setupTests.mjs.map +0 -1
- package/dist/types/chat-suggestion-configuration.d.ts +0 -22
- package/dist/types/chat-suggestion-configuration.js +0 -19
- package/dist/types/chat-suggestion-configuration.js.map +0 -1
- package/dist/types/chat-suggestion-configuration.mjs +0 -1
- package/dist/types/chat-suggestion-configuration.mjs.map +0 -1
- package/dist/types/coagent-action.d.ts +0 -29
- package/dist/types/coagent-action.js +0 -19
- package/dist/types/coagent-action.js.map +0 -1
- package/dist/types/coagent-action.mjs +0 -1
- package/dist/types/coagent-action.mjs.map +0 -1
- package/dist/types/coagent-state.d.ts +0 -15
- package/dist/types/coagent-state.js +0 -19
- package/dist/types/coagent-state.js.map +0 -1
- package/dist/types/coagent-state.mjs +0 -1
- package/dist/types/coagent-state.mjs.map +0 -1
- package/dist/types/crew.d.ts +0 -79
- package/dist/types/crew.js +0 -19
- package/dist/types/crew.js.map +0 -1
- package/dist/types/crew.mjs +0 -2
- package/dist/types/crew.mjs.map +0 -1
- package/dist/types/document-pointer.d.ts +0 -9
- package/dist/types/document-pointer.js +0 -19
- package/dist/types/document-pointer.js.map +0 -1
- package/dist/types/document-pointer.mjs +0 -1
- package/dist/types/document-pointer.mjs.map +0 -1
- package/dist/types/frontend-action.d.ts +0 -127
- package/dist/types/frontend-action.js +0 -53
- package/dist/types/frontend-action.js.map +0 -1
- package/dist/types/frontend-action.mjs +0 -8
- package/dist/types/frontend-action.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -4
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/interrupt-action.d.ts +0 -10
- package/dist/types/interrupt-action.js +0 -19
- package/dist/types/interrupt-action.js.map +0 -1
- package/dist/types/interrupt-action.mjs +0 -2
- package/dist/types/interrupt-action.mjs.map +0 -1
- package/dist/types/system-message.d.ts +0 -3
- package/dist/types/system-message.js +0 -19
- package/dist/types/system-message.js.map +0 -1
- package/dist/types/system-message.mjs +0 -1
- package/dist/types/system-message.mjs.map +0 -1
- package/dist/utils/dev-console.d.ts +0 -3
- package/dist/utils/dev-console.js +0 -41
- package/dist/utils/dev-console.js.map +0 -1
- package/dist/utils/dev-console.mjs +0 -8
- package/dist/utils/dev-console.mjs.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -52
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/index.mjs +0 -13
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/suggestions-constants.d.ts +0 -9
- package/dist/utils/suggestions-constants.js +0 -35
- package/dist/utils/suggestions-constants.js.map +0 -1
- package/dist/utils/suggestions-constants.mjs +0 -8
- package/dist/utils/suggestions-constants.mjs.map +0 -1
- package/dist/utils/utils.d.ts +0 -2
- package/dist/utils/utils.js +0 -19
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/utils.mjs +0 -1
- package/dist/utils/utils.mjs.map +0 -1
- package/dist/v2/index.css +0 -4
- package/dist/v2/index.css.map +0 -1
- package/dist/v2/index.d.ts +0 -2
- package/dist/v2/index.js +0 -27
- package/dist/v2/index.js.map +0 -1
- package/dist/v2/index.mjs +0 -6
- package/dist/v2/index.mjs.map +0 -1
- package/jest.config.js +0 -25
- package/src/components/CopilotListeners.tsx +0 -81
- package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +0 -75
- package/src/components/copilot-provider/copilot-messages.tsx +0 -274
- package/src/components/copilot-provider/copilotkit-props.tsx +0 -169
- package/src/components/copilot-provider/copilotkit.tsx +0 -671
- package/src/components/copilot-provider/index.ts +0 -3
- package/src/components/dev-console/console-trigger.tsx +0 -254
- package/src/components/dev-console/developer-console-modal.tsx +0 -866
- package/src/components/dev-console/icons.tsx +0 -101
- package/src/components/error-boundary/error-boundary.tsx +0 -91
- package/src/components/error-boundary/error-utils.tsx +0 -100
- package/src/components/index.ts +0 -1
- package/src/components/toast/exclamation-mark-icon.tsx +0 -27
- package/src/components/toast/toast-provider.tsx +0 -363
- package/src/components/usage-banner.tsx +0 -259
- package/src/context/coagent-state-renders-context.tsx +0 -76
- package/src/context/copilot-context.tsx +0 -332
- package/src/context/copilot-messages-context.tsx +0 -35
- package/src/context/index.ts +0 -16
- package/src/context/threads-context.tsx +0 -41
- package/src/hooks/__tests__/use-coagent-config.test.ts +0 -351
- package/src/hooks/index.ts +0 -34
- package/src/hooks/use-agent-nodename.ts +0 -30
- package/src/hooks/use-coagent-state-render-bridge.tsx +0 -293
- package/src/hooks/use-coagent-state-render.ts +0 -152
- package/src/hooks/use-coagent.ts +0 -366
- package/src/hooks/use-configure-chat-suggestions.tsx +0 -86
- package/src/hooks/use-copilot-action.ts +0 -236
- package/src/hooks/use-copilot-additional-instructions.ts +0 -85
- package/src/hooks/use-copilot-authenticated-action.ts +0 -70
- package/src/hooks/use-copilot-chat-headless_c.ts +0 -258
- package/src/hooks/use-copilot-chat-suggestions.tsx +0 -124
- package/src/hooks/use-copilot-chat.ts +0 -130
- package/src/hooks/use-copilot-chat_internal.ts +0 -696
- package/src/hooks/use-copilot-readable.ts +0 -135
- package/src/hooks/use-copilot-runtime-client.ts +0 -164
- package/src/hooks/use-default-tool.ts +0 -7
- package/src/hooks/use-flat-category-store.ts +0 -105
- package/src/hooks/use-frontend-tool.ts +0 -96
- package/src/hooks/use-human-in-the-loop.ts +0 -122
- package/src/hooks/use-langgraph-interrupt-render.ts +0 -136
- package/src/hooks/use-langgraph-interrupt.ts +0 -36
- package/src/hooks/use-lazy-tool-renderer.tsx +0 -30
- package/src/hooks/use-make-copilot-document-readable.ts +0 -30
- package/src/hooks/use-render-tool-call.ts +0 -80
- package/src/hooks/use-tree.ts +0 -207
- package/src/index.tsx +0 -7
- package/src/lib/copilot-task.ts +0 -201
- package/src/lib/index.ts +0 -1
- package/src/lib/status-checker.ts +0 -64
- package/src/setupTests.ts +0 -26
- package/src/types/chat-suggestion-configuration.ts +0 -23
- package/src/types/coagent-action.ts +0 -31
- package/src/types/coagent-state.ts +0 -13
- package/src/types/crew.ts +0 -89
- package/src/types/document-pointer.ts +0 -7
- package/src/types/frontend-action.ts +0 -202
- package/src/types/index.ts +0 -17
- package/src/types/interrupt-action.ts +0 -43
- package/src/types/system-message.ts +0 -4
- package/src/utils/dev-console.ts +0 -19
- package/src/utils/index.ts +0 -2
- package/src/utils/suggestions-constants.ts +0 -8
- package/src/utils/utils.test.ts +0 -7
- package/src/utils/utils.ts +0 -8
- package/src/v2/index.css +0 -1
- package/src/v2/index.ts +0 -4
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -16
- package/typedoc.json +0 -4
|
@@ -1,1044 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
-
var __async = (__this, __arguments, generator) => {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
var fulfilled = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.next(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var rejected = (value) => {
|
|
68
|
-
try {
|
|
69
|
-
step(generator.throw(value));
|
|
70
|
-
} catch (e) {
|
|
71
|
-
reject(e);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// src/hooks/use-copilot-chat-headless_c.ts
|
|
80
|
-
var use_copilot_chat_headless_c_exports = {};
|
|
81
|
-
__export(use_copilot_chat_headless_c_exports, {
|
|
82
|
-
defaultSystemMessage: () => defaultSystemMessage,
|
|
83
|
-
useCopilotChatHeadless_c: () => useCopilotChatHeadless_c
|
|
84
|
-
});
|
|
85
|
-
module.exports = __toCommonJS(use_copilot_chat_headless_c_exports);
|
|
86
|
-
var import_react15 = require("react");
|
|
87
|
-
|
|
88
|
-
// src/context/copilot-context.tsx
|
|
89
|
-
var import_react = __toESM(require("react"));
|
|
90
|
-
var emptyCopilotContext = {
|
|
91
|
-
actions: {},
|
|
92
|
-
setAction: () => {
|
|
93
|
-
},
|
|
94
|
-
removeAction: () => {
|
|
95
|
-
},
|
|
96
|
-
setRegisteredActions: () => "",
|
|
97
|
-
removeRegisteredAction: () => {
|
|
98
|
-
},
|
|
99
|
-
chatComponentsCache: { current: { actions: {}, coAgentStateRenders: {} } },
|
|
100
|
-
getContextString: (documents, categories) => returnAndThrowInDebug(""),
|
|
101
|
-
addContext: () => "",
|
|
102
|
-
removeContext: () => {
|
|
103
|
-
},
|
|
104
|
-
getAllContext: () => [],
|
|
105
|
-
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
106
|
-
})),
|
|
107
|
-
isLoading: false,
|
|
108
|
-
setIsLoading: () => returnAndThrowInDebug(false),
|
|
109
|
-
chatInstructions: "",
|
|
110
|
-
setChatInstructions: () => returnAndThrowInDebug(""),
|
|
111
|
-
additionalInstructions: [],
|
|
112
|
-
setAdditionalInstructions: () => returnAndThrowInDebug([]),
|
|
113
|
-
getDocumentsContext: (categories) => returnAndThrowInDebug([]),
|
|
114
|
-
addDocumentContext: () => returnAndThrowInDebug(""),
|
|
115
|
-
removeDocumentContext: () => {
|
|
116
|
-
},
|
|
117
|
-
copilotApiConfig: new class {
|
|
118
|
-
get chatApiEndpoint() {
|
|
119
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
120
|
-
}
|
|
121
|
-
get headers() {
|
|
122
|
-
return {};
|
|
123
|
-
}
|
|
124
|
-
get body() {
|
|
125
|
-
return {};
|
|
126
|
-
}
|
|
127
|
-
}(),
|
|
128
|
-
chatSuggestionConfiguration: {},
|
|
129
|
-
addChatSuggestionConfiguration: () => {
|
|
130
|
-
},
|
|
131
|
-
removeChatSuggestionConfiguration: () => {
|
|
132
|
-
},
|
|
133
|
-
showDevConsole: false,
|
|
134
|
-
coagentStates: {},
|
|
135
|
-
setCoagentStates: () => {
|
|
136
|
-
},
|
|
137
|
-
coagentStatesRef: { current: {} },
|
|
138
|
-
setCoagentStatesWithRef: () => {
|
|
139
|
-
},
|
|
140
|
-
agentSession: null,
|
|
141
|
-
setAgentSession: () => {
|
|
142
|
-
},
|
|
143
|
-
forwardedParameters: {},
|
|
144
|
-
agentLock: null,
|
|
145
|
-
threadId: "",
|
|
146
|
-
setThreadId: () => {
|
|
147
|
-
},
|
|
148
|
-
runId: null,
|
|
149
|
-
setRunId: () => {
|
|
150
|
-
},
|
|
151
|
-
chatAbortControllerRef: { current: null },
|
|
152
|
-
availableAgents: [],
|
|
153
|
-
extensions: {},
|
|
154
|
-
setExtensions: () => {
|
|
155
|
-
},
|
|
156
|
-
interruptActions: {},
|
|
157
|
-
setInterruptAction: () => {
|
|
158
|
-
},
|
|
159
|
-
removeInterruptAction: () => {
|
|
160
|
-
},
|
|
161
|
-
interruptEventQueue: {},
|
|
162
|
-
addInterruptEvent: () => {
|
|
163
|
-
},
|
|
164
|
-
resolveInterruptEvent: () => {
|
|
165
|
-
},
|
|
166
|
-
onError: () => {
|
|
167
|
-
},
|
|
168
|
-
bannerError: null,
|
|
169
|
-
setBannerError: () => {
|
|
170
|
-
},
|
|
171
|
-
internalErrorHandlers: {},
|
|
172
|
-
setInternalErrorHandler: () => {
|
|
173
|
-
},
|
|
174
|
-
removeInternalErrorHandler: () => {
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
178
|
-
function useCopilotContext() {
|
|
179
|
-
const context = import_react.default.useContext(CopilotContext);
|
|
180
|
-
if (context === emptyCopilotContext) {
|
|
181
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
182
|
-
}
|
|
183
|
-
return context;
|
|
184
|
-
}
|
|
185
|
-
function returnAndThrowInDebug(_value) {
|
|
186
|
-
throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/hooks/use-copilot-chat_internal.ts
|
|
190
|
-
var import_react13 = require("react");
|
|
191
|
-
|
|
192
|
-
// src/components/error-boundary/error-utils.tsx
|
|
193
|
-
var import_react3 = require("react");
|
|
194
|
-
|
|
195
|
-
// src/components/toast/toast-provider.tsx
|
|
196
|
-
var import_react2 = require("react");
|
|
197
|
-
var import_shared = require("@copilotkit/shared");
|
|
198
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
199
|
-
var ToastContext = (0, import_react2.createContext)(void 0);
|
|
200
|
-
function useToast() {
|
|
201
|
-
const context = (0, import_react2.useContext)(ToastContext);
|
|
202
|
-
if (!context) {
|
|
203
|
-
throw new Error("useToast must be used within a ToastProvider");
|
|
204
|
-
}
|
|
205
|
-
return context;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/components/toast/exclamation-mark-icon.tsx
|
|
209
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
210
|
-
var ExclamationMarkIcon = ({
|
|
211
|
-
className,
|
|
212
|
-
style
|
|
213
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
214
|
-
"svg",
|
|
215
|
-
{
|
|
216
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
217
|
-
width: "24",
|
|
218
|
-
height: "24",
|
|
219
|
-
viewBox: "0 0 24 24",
|
|
220
|
-
fill: "none",
|
|
221
|
-
stroke: "currentColor",
|
|
222
|
-
strokeWidth: "2",
|
|
223
|
-
strokeLinecap: "round",
|
|
224
|
-
strokeLinejoin: "round",
|
|
225
|
-
className: `lucide lucide-circle-alert ${className ? className : ""}`,
|
|
226
|
-
style,
|
|
227
|
-
children: [
|
|
228
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
229
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
|
|
230
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
|
|
231
|
-
]
|
|
232
|
-
}
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
// src/components/error-boundary/error-utils.tsx
|
|
236
|
-
var import_react_markdown = __toESM(require("react-markdown"));
|
|
237
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
238
|
-
function ErrorToast({ errors }) {
|
|
239
|
-
const errorsToRender = errors.map((error, idx) => {
|
|
240
|
-
var _a, _b, _c;
|
|
241
|
-
const originalError = "extensions" in error ? (_a = error.extensions) == null ? void 0 : _a.originalError : {};
|
|
242
|
-
const message = (_b = originalError == null ? void 0 : originalError.message) != null ? _b : error.message;
|
|
243
|
-
const code = "extensions" in error ? (_c = error.extensions) == null ? void 0 : _c.code : null;
|
|
244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
245
|
-
"div",
|
|
246
|
-
{
|
|
247
|
-
style: {
|
|
248
|
-
marginTop: idx === 0 ? 0 : 10,
|
|
249
|
-
marginBottom: 14
|
|
250
|
-
},
|
|
251
|
-
children: [
|
|
252
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExclamationMarkIcon, { style: { marginBottom: 4 } }),
|
|
253
|
-
code && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
254
|
-
"div",
|
|
255
|
-
{
|
|
256
|
-
style: {
|
|
257
|
-
fontWeight: "600",
|
|
258
|
-
marginBottom: 4
|
|
259
|
-
},
|
|
260
|
-
children: [
|
|
261
|
-
"Copilot Runtime Error:",
|
|
262
|
-
" ",
|
|
263
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
|
|
264
|
-
]
|
|
265
|
-
}
|
|
266
|
-
),
|
|
267
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_markdown.default, { children: message })
|
|
268
|
-
]
|
|
269
|
-
},
|
|
270
|
-
idx
|
|
271
|
-
);
|
|
272
|
-
});
|
|
273
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
274
|
-
"div",
|
|
275
|
-
{
|
|
276
|
-
style: {
|
|
277
|
-
fontSize: "13px",
|
|
278
|
-
maxWidth: "600px"
|
|
279
|
-
},
|
|
280
|
-
children: [
|
|
281
|
-
errorsToRender,
|
|
282
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: "11px", opacity: 0.75 }, children: "NOTE: This error only displays during local development." })
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
function useErrorToast() {
|
|
288
|
-
const { addToast } = useToast();
|
|
289
|
-
return (0, import_react3.useCallback)(
|
|
290
|
-
(errors) => {
|
|
291
|
-
const errorId = errors.map((err) => {
|
|
292
|
-
var _a, _b;
|
|
293
|
-
const message = "extensions" in err ? ((_b = (_a = err.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message) || err.message : err.message;
|
|
294
|
-
const stack = err.stack || "";
|
|
295
|
-
return btoa(message + stack).slice(0, 32);
|
|
296
|
-
}).join("|");
|
|
297
|
-
addToast({
|
|
298
|
-
type: "error",
|
|
299
|
-
id: errorId,
|
|
300
|
-
// Toast libraries typically dedupe by id
|
|
301
|
-
message: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorToast, { errors })
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
[addToast]
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
function useAsyncCallback(callback, deps) {
|
|
308
|
-
const addErrorToast = useErrorToast();
|
|
309
|
-
return (0, import_react3.useCallback)((...args) => __async(this, null, function* () {
|
|
310
|
-
try {
|
|
311
|
-
return yield callback(...args);
|
|
312
|
-
} catch (error) {
|
|
313
|
-
console.error("Error in async callback:", error);
|
|
314
|
-
addErrorToast([error]);
|
|
315
|
-
throw error;
|
|
316
|
-
}
|
|
317
|
-
}), deps);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// src/hooks/use-copilot-chat_internal.ts
|
|
321
|
-
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
322
|
-
|
|
323
|
-
// src/context/coagent-state-renders-context.tsx
|
|
324
|
-
var import_react4 = require("react");
|
|
325
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
326
|
-
var CoAgentStateRendersContext = (0, import_react4.createContext)(
|
|
327
|
-
void 0
|
|
328
|
-
);
|
|
329
|
-
function useCoAgentStateRenders() {
|
|
330
|
-
const context = (0, import_react4.useContext)(CoAgentStateRendersContext);
|
|
331
|
-
if (!context) {
|
|
332
|
-
throw new Error("useCoAgentStateRenders must be used within CoAgentStateRendersProvider");
|
|
333
|
-
}
|
|
334
|
-
return context;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// src/hooks/use-langgraph-interrupt-render.ts
|
|
338
|
-
var import_react7 = __toESM(require("react"));
|
|
339
|
-
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
340
|
-
var import_shared2 = require("@copilotkit/shared");
|
|
341
|
-
|
|
342
|
-
// src/hooks/use-agent-nodename.ts
|
|
343
|
-
var import_react5 = require("react");
|
|
344
|
-
var import_react6 = require("@copilotkitnext/react");
|
|
345
|
-
function useAgentNodeName(agentName) {
|
|
346
|
-
const { agent } = (0, import_react6.useAgent)({ agentId: agentName });
|
|
347
|
-
const nodeNameRef = (0, import_react5.useRef)("start");
|
|
348
|
-
(0, import_react5.useEffect)(() => {
|
|
349
|
-
if (!agent)
|
|
350
|
-
return;
|
|
351
|
-
const subscriber = {
|
|
352
|
-
onStepStartedEvent: ({ event }) => {
|
|
353
|
-
nodeNameRef.current = event.stepName;
|
|
354
|
-
},
|
|
355
|
-
onRunStartedEvent: () => {
|
|
356
|
-
nodeNameRef.current = "start";
|
|
357
|
-
},
|
|
358
|
-
onRunFinishedEvent: () => {
|
|
359
|
-
nodeNameRef.current = "end";
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
const subscription = agent.subscribe(subscriber);
|
|
363
|
-
return () => {
|
|
364
|
-
subscription.unsubscribe();
|
|
365
|
-
};
|
|
366
|
-
}, [agent]);
|
|
367
|
-
return nodeNameRef.current;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// src/hooks/use-langgraph-interrupt-render.ts
|
|
371
|
-
var import_react8 = require("@copilotkitnext/react");
|
|
372
|
-
var InterruptRenderer = ({ event, result, render, resolve }) => {
|
|
373
|
-
return render({ event, result, resolve });
|
|
374
|
-
};
|
|
375
|
-
function useLangGraphInterruptRender(agent) {
|
|
376
|
-
var _a;
|
|
377
|
-
const {
|
|
378
|
-
interruptActions,
|
|
379
|
-
agentSession,
|
|
380
|
-
threadId,
|
|
381
|
-
interruptEventQueue,
|
|
382
|
-
addInterruptEvent,
|
|
383
|
-
resolveInterruptEvent
|
|
384
|
-
} = useCopilotContext();
|
|
385
|
-
const existingConfig = (0, import_react8.useCopilotChatConfiguration)();
|
|
386
|
-
const resolvedAgentId = (_a = existingConfig == null ? void 0 : existingConfig.agentId) != null ? _a : "default";
|
|
387
|
-
const nodeName = useAgentNodeName(resolvedAgentId);
|
|
388
|
-
(0, import_react7.useEffect)(() => {
|
|
389
|
-
if (!agent)
|
|
390
|
-
return;
|
|
391
|
-
let localInterrupt = null;
|
|
392
|
-
const subscriber = {
|
|
393
|
-
onCustomEvent: ({ event }) => {
|
|
394
|
-
if (event.name === "on_interrupt") {
|
|
395
|
-
const eventData = {
|
|
396
|
-
name: import_runtime_client_gql.MetaEventName.LangGraphInterruptEvent,
|
|
397
|
-
type: event.type,
|
|
398
|
-
value: (0, import_shared2.parseJson)(event.value, event.value)
|
|
399
|
-
};
|
|
400
|
-
const eventId = (0, import_shared2.dataToUUID)(eventData, "interruptEvents");
|
|
401
|
-
localInterrupt = {
|
|
402
|
-
eventId,
|
|
403
|
-
threadId,
|
|
404
|
-
event: eventData
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
onRunStartedEvent: () => {
|
|
409
|
-
localInterrupt = null;
|
|
410
|
-
},
|
|
411
|
-
onRunFinalized: () => {
|
|
412
|
-
if (localInterrupt) {
|
|
413
|
-
addInterruptEvent(localInterrupt);
|
|
414
|
-
localInterrupt = null;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
const { unsubscribe } = agent.subscribe(subscriber);
|
|
419
|
-
return () => {
|
|
420
|
-
unsubscribe();
|
|
421
|
-
};
|
|
422
|
-
}, [agent, threadId]);
|
|
423
|
-
const handleResolve = (0, import_react7.useCallback)(
|
|
424
|
-
(eventId, response) => {
|
|
425
|
-
agent == null ? void 0 : agent.runAgent({
|
|
426
|
-
forwardedProps: {
|
|
427
|
-
command: {
|
|
428
|
-
resume: response
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
resolveInterruptEvent(threadId, eventId, response != null ? response : "");
|
|
433
|
-
},
|
|
434
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
435
|
-
[agent, threadId]
|
|
436
|
-
);
|
|
437
|
-
return (0, import_react7.useMemo)(() => {
|
|
438
|
-
const eventQueue = interruptEventQueue[threadId] || [];
|
|
439
|
-
const currentQueuedEvent = eventQueue.find((qe) => !qe.event.response);
|
|
440
|
-
if (!currentQueuedEvent || !agentSession)
|
|
441
|
-
return null;
|
|
442
|
-
const allActions = Object.values(interruptActions);
|
|
443
|
-
const matchingAction = allActions.find((action) => {
|
|
444
|
-
if (!action.enabled)
|
|
445
|
-
return true;
|
|
446
|
-
return action.enabled({
|
|
447
|
-
eventValue: currentQueuedEvent.event.value,
|
|
448
|
-
agentMetadata: __spreadProps(__spreadValues({}, agentSession), {
|
|
449
|
-
nodeName
|
|
450
|
-
})
|
|
451
|
-
});
|
|
452
|
-
});
|
|
453
|
-
if (!matchingAction)
|
|
454
|
-
return null;
|
|
455
|
-
const { render, handler } = matchingAction;
|
|
456
|
-
const resolveInterrupt = (response) => {
|
|
457
|
-
handleResolve(currentQueuedEvent.eventId, response);
|
|
458
|
-
};
|
|
459
|
-
let result = null;
|
|
460
|
-
if (handler) {
|
|
461
|
-
result = handler({
|
|
462
|
-
event: currentQueuedEvent.event,
|
|
463
|
-
resolve: resolveInterrupt
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
if (!render)
|
|
467
|
-
return null;
|
|
468
|
-
return import_react7.default.createElement(InterruptRenderer, {
|
|
469
|
-
event: currentQueuedEvent.event,
|
|
470
|
-
result,
|
|
471
|
-
render,
|
|
472
|
-
resolve: resolveInterrupt
|
|
473
|
-
});
|
|
474
|
-
}, [interruptActions, interruptEventQueue, threadId, agentSession, handleResolve]);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// src/hooks/use-copilot-chat_internal.ts
|
|
478
|
-
var import_react14 = require("@copilotkitnext/react");
|
|
479
|
-
|
|
480
|
-
// src/hooks/use-lazy-tool-renderer.tsx
|
|
481
|
-
var import_react9 = require("@copilotkitnext/react");
|
|
482
|
-
var import_react10 = require("react");
|
|
483
|
-
function useLazyToolRenderer() {
|
|
484
|
-
const renderToolCall = (0, import_react9.useRenderToolCall)();
|
|
485
|
-
return (0, import_react10.useCallback)(
|
|
486
|
-
(message, messages) => {
|
|
487
|
-
var _a;
|
|
488
|
-
if (!((_a = message == null ? void 0 : message.toolCalls) == null ? void 0 : _a.length))
|
|
489
|
-
return null;
|
|
490
|
-
const toolCall = message.toolCalls[0];
|
|
491
|
-
if (!toolCall)
|
|
492
|
-
return null;
|
|
493
|
-
const toolMessage = messages == null ? void 0 : messages.find(
|
|
494
|
-
(m) => m.role === "tool" && m.toolCallId === toolCall.id
|
|
495
|
-
);
|
|
496
|
-
return () => renderToolCall({
|
|
497
|
-
toolCall,
|
|
498
|
-
toolMessage
|
|
499
|
-
});
|
|
500
|
-
},
|
|
501
|
-
[renderToolCall]
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// src/hooks/use-copilot-chat_internal.ts
|
|
506
|
-
var import_client = require("@ag-ui/client");
|
|
507
|
-
|
|
508
|
-
// src/hooks/use-coagent-state-render-bridge.tsx
|
|
509
|
-
var import_react11 = require("@copilotkitnext/react");
|
|
510
|
-
var import_react12 = require("react");
|
|
511
|
-
var import_shared3 = require("@copilotkit/shared");
|
|
512
|
-
function getStateWithoutConstantKeys(state) {
|
|
513
|
-
if (!state)
|
|
514
|
-
return {};
|
|
515
|
-
const _a = state, { messages, tools, copilotkit } = _a, stateWithoutConstantKeys = __objRest(_a, ["messages", "tools", "copilotkit"]);
|
|
516
|
-
return stateWithoutConstantKeys;
|
|
517
|
-
}
|
|
518
|
-
function areStatesEquals(a, b) {
|
|
519
|
-
if (a && !b || !a && b)
|
|
520
|
-
return false;
|
|
521
|
-
const _a = a, { messages, tools, copilotkit } = _a, aWithoutConstantKeys = __objRest(_a, ["messages", "tools", "copilotkit"]);
|
|
522
|
-
const _b = b, {
|
|
523
|
-
messages: bMessages,
|
|
524
|
-
tools: bTools,
|
|
525
|
-
copilotkit: bCopilotkit
|
|
526
|
-
} = _b, bWithoutConstantKeys = __objRest(_b, [
|
|
527
|
-
"messages",
|
|
528
|
-
"tools",
|
|
529
|
-
"copilotkit"
|
|
530
|
-
]);
|
|
531
|
-
return JSON.stringify(aWithoutConstantKeys) === JSON.stringify(bWithoutConstantKeys);
|
|
532
|
-
}
|
|
533
|
-
function useCoagentStateRenderBridge(agentId, props) {
|
|
534
|
-
var _a;
|
|
535
|
-
const { stateSnapshot, messageIndexInRun, message } = props;
|
|
536
|
-
const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
|
|
537
|
-
const { agent } = (0, import_react11.useAgent)({ agentId });
|
|
538
|
-
const [nodeName, setNodeName] = (0, import_react12.useState)(void 0);
|
|
539
|
-
const runId = (_a = props.runId) != null ? _a : message.runId;
|
|
540
|
-
const effectiveRunId = runId || "pending";
|
|
541
|
-
(0, import_react12.useEffect)(() => {
|
|
542
|
-
if (!agent)
|
|
543
|
-
return;
|
|
544
|
-
const subscriber = {
|
|
545
|
-
onStepStartedEvent: ({ event }) => {
|
|
546
|
-
if (event.stepName !== nodeName) {
|
|
547
|
-
setNodeName(event.stepName);
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
onStepFinishedEvent: ({ event }) => {
|
|
551
|
-
if (event.stepName === nodeName) {
|
|
552
|
-
setNodeName(void 0);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
const { unsubscribe } = agent.subscribe(subscriber);
|
|
557
|
-
return () => {
|
|
558
|
-
unsubscribe();
|
|
559
|
-
};
|
|
560
|
-
}, [agentId, nodeName]);
|
|
561
|
-
const getStateRender = (0, import_react12.useCallback)(
|
|
562
|
-
(messageId) => {
|
|
563
|
-
return Object.entries(coAgentStateRenders).find(([stateRenderId, stateRender]) => {
|
|
564
|
-
if (claimsRef.current[messageId]) {
|
|
565
|
-
return stateRenderId === claimsRef.current[messageId].stateRenderId;
|
|
566
|
-
}
|
|
567
|
-
const matchingAgentName = stateRender.name === agentId;
|
|
568
|
-
const matchesNodeContext = stateRender.nodeName ? stateRender.nodeName === nodeName : true;
|
|
569
|
-
return matchingAgentName && matchesNodeContext;
|
|
570
|
-
});
|
|
571
|
-
},
|
|
572
|
-
[coAgentStateRenders, nodeName, agentId]
|
|
573
|
-
);
|
|
574
|
-
const handleRenderRequest = ({
|
|
575
|
-
stateRenderId,
|
|
576
|
-
messageId,
|
|
577
|
-
runId: runId2,
|
|
578
|
-
stateSnapshot: renderSnapshot
|
|
579
|
-
}) => {
|
|
580
|
-
if (claimsRef.current[messageId]) {
|
|
581
|
-
const canRender = claimsRef.current[messageId].stateRenderId === stateRenderId;
|
|
582
|
-
if (canRender && runId2 && (!claimsRef.current[messageId].runId || claimsRef.current[messageId].runId === "pending")) {
|
|
583
|
-
claimsRef.current[messageId].runId = runId2;
|
|
584
|
-
}
|
|
585
|
-
return canRender;
|
|
586
|
-
}
|
|
587
|
-
const renderClaimedByOtherMessage = Object.values(claimsRef.current).find(
|
|
588
|
-
(c) => c.stateRenderId === stateRenderId && (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(c.stateSnapshot)) === (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(renderSnapshot))
|
|
589
|
-
);
|
|
590
|
-
if (renderClaimedByOtherMessage) {
|
|
591
|
-
if (renderSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, renderSnapshot)) {
|
|
592
|
-
claimsRef.current[messageId] = { stateRenderId, runId: runId2 };
|
|
593
|
-
return true;
|
|
594
|
-
}
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
if (!runId2) {
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
claimsRef.current[messageId] = { stateRenderId, runId: runId2 };
|
|
601
|
-
return true;
|
|
602
|
-
};
|
|
603
|
-
return (0, import_react12.useMemo)(() => {
|
|
604
|
-
var _a2, _b, _c;
|
|
605
|
-
if (messageIndexInRun !== 0) {
|
|
606
|
-
return null;
|
|
607
|
-
}
|
|
608
|
-
const [stateRenderId, stateRender] = (_a2 = getStateRender(message.id)) != null ? _a2 : [];
|
|
609
|
-
if (!stateRender || !stateRenderId) {
|
|
610
|
-
return null;
|
|
611
|
-
}
|
|
612
|
-
const snapshot = stateSnapshot ? (0, import_shared3.parseJson)(stateSnapshot, stateSnapshot) : agent == null ? void 0 : agent.state;
|
|
613
|
-
const canRender = handleRenderRequest({
|
|
614
|
-
stateRenderId,
|
|
615
|
-
messageId: message.id,
|
|
616
|
-
runId: effectiveRunId,
|
|
617
|
-
stateSnapshot: snapshot
|
|
618
|
-
});
|
|
619
|
-
if (!canRender) {
|
|
620
|
-
return null;
|
|
621
|
-
}
|
|
622
|
-
if (snapshot && !claimsRef.current[message.id].locked) {
|
|
623
|
-
if (stateSnapshot) {
|
|
624
|
-
claimsRef.current[message.id].stateSnapshot = snapshot;
|
|
625
|
-
claimsRef.current[message.id].locked = true;
|
|
626
|
-
} else {
|
|
627
|
-
claimsRef.current[message.id].stateSnapshot = snapshot;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
if (stateRender.handler) {
|
|
631
|
-
stateRender.handler({
|
|
632
|
-
state: stateSnapshot ? (0, import_shared3.parseJson)(stateSnapshot, stateSnapshot) : (_b = agent == null ? void 0 : agent.state) != null ? _b : {},
|
|
633
|
-
nodeName: nodeName != null ? nodeName : ""
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
if (stateRender.render) {
|
|
637
|
-
const status = (agent == null ? void 0 : agent.isRunning) ? "inProgress" : "complete";
|
|
638
|
-
if (typeof stateRender.render === "string")
|
|
639
|
-
return stateRender.render;
|
|
640
|
-
return stateRender.render({
|
|
641
|
-
status,
|
|
642
|
-
// Always use state from claim, to make sure the state does not seem "wiped" for a fraction of a second
|
|
643
|
-
state: (_c = claimsRef.current[message.id].stateSnapshot) != null ? _c : {},
|
|
644
|
-
nodeName: nodeName != null ? nodeName : ""
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
}, [
|
|
648
|
-
getStateRender,
|
|
649
|
-
stateSnapshot,
|
|
650
|
-
agent == null ? void 0 : agent.state,
|
|
651
|
-
agent == null ? void 0 : agent.isRunning,
|
|
652
|
-
nodeName,
|
|
653
|
-
effectiveRunId,
|
|
654
|
-
message.id,
|
|
655
|
-
messageIndexInRun
|
|
656
|
-
]);
|
|
657
|
-
}
|
|
658
|
-
function CoAgentStateRenderBridge(props) {
|
|
659
|
-
return useCoagentStateRenderBridge(props.agentId, props);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
// src/hooks/use-copilot-chat_internal.ts
|
|
663
|
-
function useCopilotChatInternal({
|
|
664
|
-
suggestions,
|
|
665
|
-
onInProgress,
|
|
666
|
-
onSubmitMessage,
|
|
667
|
-
onStopGeneration,
|
|
668
|
-
onReloadMessages
|
|
669
|
-
} = {}) {
|
|
670
|
-
var _a, _b, _c;
|
|
671
|
-
const { copilotkit } = (0, import_react14.useCopilotKit)();
|
|
672
|
-
const { threadId, agentSession } = useCopilotContext();
|
|
673
|
-
const existingConfig = (0, import_react14.useCopilotChatConfiguration)();
|
|
674
|
-
const [agentAvailable, setAgentAvailable] = (0, import_react13.useState)(false);
|
|
675
|
-
const resolvedAgentId = (_a = existingConfig == null ? void 0 : existingConfig.agentId) != null ? _a : "default";
|
|
676
|
-
const { agent } = (0, import_react14.useAgent)({ agentId: resolvedAgentId });
|
|
677
|
-
(0, import_react13.useEffect)(() => {
|
|
678
|
-
const connect = (agent2) => __async(this, null, function* () {
|
|
679
|
-
setAgentAvailable(false);
|
|
680
|
-
try {
|
|
681
|
-
yield copilotkit.connectAgent({ agent: agent2 });
|
|
682
|
-
setAgentAvailable(true);
|
|
683
|
-
} catch (error) {
|
|
684
|
-
if (error instanceof import_client.AGUIConnectNotImplementedError) {
|
|
685
|
-
} else {
|
|
686
|
-
throw error;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
if (agent && (existingConfig == null ? void 0 : existingConfig.threadId) && agent.threadId !== existingConfig.threadId) {
|
|
691
|
-
agent.threadId = existingConfig.threadId;
|
|
692
|
-
connect(agent);
|
|
693
|
-
}
|
|
694
|
-
return () => {
|
|
695
|
-
};
|
|
696
|
-
}, [existingConfig == null ? void 0 : existingConfig.threadId, agent, copilotkit, resolvedAgentId]);
|
|
697
|
-
(0, import_react13.useEffect)(() => {
|
|
698
|
-
onInProgress == null ? void 0 : onInProgress(Boolean(agent == null ? void 0 : agent.isRunning));
|
|
699
|
-
}, [agent == null ? void 0 : agent.isRunning, onInProgress]);
|
|
700
|
-
const interrupt = useLangGraphInterruptRender(agent);
|
|
701
|
-
const reset = () => {
|
|
702
|
-
agent == null ? void 0 : agent.setMessages([]);
|
|
703
|
-
agent == null ? void 0 : agent.setState(null);
|
|
704
|
-
};
|
|
705
|
-
const deleteMessage = (0, import_react13.useCallback)(
|
|
706
|
-
(messageId) => {
|
|
707
|
-
var _a2;
|
|
708
|
-
const filteredMessages = ((_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []).filter(
|
|
709
|
-
(message) => message.id !== messageId
|
|
710
|
-
);
|
|
711
|
-
agent == null ? void 0 : agent.setMessages(filteredMessages);
|
|
712
|
-
},
|
|
713
|
-
[agent == null ? void 0 : agent.setMessages, agent == null ? void 0 : agent.messages]
|
|
714
|
-
);
|
|
715
|
-
const latestDelete = useUpdatedRef(deleteMessage);
|
|
716
|
-
const latestDeleteFunc = (0, import_react13.useCallback)(
|
|
717
|
-
(messageId) => {
|
|
718
|
-
return latestDelete.current(messageId);
|
|
719
|
-
},
|
|
720
|
-
[latestDelete]
|
|
721
|
-
);
|
|
722
|
-
const currentSuggestions = (0, import_react14.useSuggestions)({ agentId: resolvedAgentId });
|
|
723
|
-
const reload = useAsyncCallback(
|
|
724
|
-
(reloadMessageId) => __async(this, null, function* () {
|
|
725
|
-
var _a2;
|
|
726
|
-
const messages = (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : [];
|
|
727
|
-
const isLoading = false;
|
|
728
|
-
if (isLoading || messages.length === 0) {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
const reloadMessageIndex = messages.findIndex((msg) => msg.id === reloadMessageId);
|
|
732
|
-
if (reloadMessageIndex === -1) {
|
|
733
|
-
console.warn(`Message with id ${reloadMessageId} not found`);
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
const reloadMessageRole = messages[reloadMessageIndex].role;
|
|
737
|
-
if (reloadMessageRole !== "assistant") {
|
|
738
|
-
console.warn(`Regenerate cannot be performed on ${reloadMessageRole} role`);
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
let historyCutoff = [messages[0]];
|
|
742
|
-
if (messages.length > 2 && reloadMessageIndex !== 0) {
|
|
743
|
-
const lastUserMessageBeforeRegenerate = messages.slice(0, reloadMessageIndex).reverse().find((msg) => msg.role === "user");
|
|
744
|
-
if (!lastUserMessageBeforeRegenerate) {
|
|
745
|
-
historyCutoff = [messages[0]];
|
|
746
|
-
} else {
|
|
747
|
-
const indexOfLastUserMessageBeforeRegenerate = messages.findIndex(
|
|
748
|
-
(msg) => msg.id === lastUserMessageBeforeRegenerate.id
|
|
749
|
-
);
|
|
750
|
-
historyCutoff = messages.slice(0, indexOfLastUserMessageBeforeRegenerate + 1);
|
|
751
|
-
}
|
|
752
|
-
} else if (messages.length > 2 && reloadMessageIndex === 0) {
|
|
753
|
-
historyCutoff = [messages[0], messages[1]];
|
|
754
|
-
}
|
|
755
|
-
agent == null ? void 0 : agent.setMessages(historyCutoff);
|
|
756
|
-
if (agent) {
|
|
757
|
-
copilotkit.runAgent({ agent });
|
|
758
|
-
}
|
|
759
|
-
return;
|
|
760
|
-
}),
|
|
761
|
-
[agent == null ? void 0 : agent.setMessages, copilotkit == null ? void 0 : copilotkit.runAgent]
|
|
762
|
-
);
|
|
763
|
-
const latestSendMessageFunc = useAsyncCallback(
|
|
764
|
-
(message, options) => __async(this, null, function* () {
|
|
765
|
-
var _a2;
|
|
766
|
-
if (!agent)
|
|
767
|
-
return;
|
|
768
|
-
const followUp = (_a2 = options == null ? void 0 : options.followUp) != null ? _a2 : true;
|
|
769
|
-
if (options == null ? void 0 : options.clearSuggestions) {
|
|
770
|
-
copilotkit.clearSuggestions(resolvedAgentId);
|
|
771
|
-
}
|
|
772
|
-
agent == null ? void 0 : agent.addMessage(message);
|
|
773
|
-
if (followUp) {
|
|
774
|
-
try {
|
|
775
|
-
yield copilotkit.runAgent({ agent });
|
|
776
|
-
} catch (error) {
|
|
777
|
-
console.error("CopilotChat: runAgent failed", error);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
if (onSubmitMessage) {
|
|
781
|
-
const content = typeof message.content === "string" ? message.content : message.content && "text" in message.content ? message.content.text : message.content && "filename" in message.content ? message.content.filename : "";
|
|
782
|
-
onSubmitMessage(content);
|
|
783
|
-
}
|
|
784
|
-
}),
|
|
785
|
-
[agent, copilotkit, resolvedAgentId, onSubmitMessage]
|
|
786
|
-
);
|
|
787
|
-
const latestAppendFunc = useAsyncCallback(
|
|
788
|
-
(message, options) => __async(this, null, function* () {
|
|
789
|
-
return latestSendMessageFunc((0, import_runtime_client_gql2.gqlToAGUI)([message])[0], options);
|
|
790
|
-
}),
|
|
791
|
-
[latestSendMessageFunc]
|
|
792
|
-
);
|
|
793
|
-
const latestSetMessagesFunc = (0, import_react13.useCallback)(
|
|
794
|
-
(messages) => {
|
|
795
|
-
var _a2, _b2;
|
|
796
|
-
if (messages.every((message) => message instanceof import_runtime_client_gql2.Message)) {
|
|
797
|
-
return (_a2 = agent == null ? void 0 : agent.setMessages) == null ? void 0 : _a2.call(agent, (0, import_runtime_client_gql2.gqlToAGUI)(messages));
|
|
798
|
-
}
|
|
799
|
-
return (_b2 = agent == null ? void 0 : agent.setMessages) == null ? void 0 : _b2.call(agent, messages);
|
|
800
|
-
},
|
|
801
|
-
[agent == null ? void 0 : agent.setMessages, agent]
|
|
802
|
-
);
|
|
803
|
-
const latestReload = useUpdatedRef(reload);
|
|
804
|
-
const latestReloadFunc = useAsyncCallback(
|
|
805
|
-
(messageId) => __async(this, null, function* () {
|
|
806
|
-
var _a2;
|
|
807
|
-
onReloadMessages == null ? void 0 : onReloadMessages({
|
|
808
|
-
messageId,
|
|
809
|
-
currentAgentName: agent == null ? void 0 : agent.agentId,
|
|
810
|
-
messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
|
|
811
|
-
});
|
|
812
|
-
return yield latestReload.current(messageId);
|
|
813
|
-
}),
|
|
814
|
-
[latestReload, agent, onReloadMessages]
|
|
815
|
-
);
|
|
816
|
-
const latestStopFunc = (0, import_react13.useCallback)(() => {
|
|
817
|
-
var _a2, _b2;
|
|
818
|
-
onStopGeneration == null ? void 0 : onStopGeneration({
|
|
819
|
-
currentAgentName: agent == null ? void 0 : agent.agentId,
|
|
820
|
-
messages: (_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []
|
|
821
|
-
});
|
|
822
|
-
return (_b2 = agent == null ? void 0 : agent.abortRun) == null ? void 0 : _b2.call(agent);
|
|
823
|
-
}, [onStopGeneration, agent]);
|
|
824
|
-
const latestReset = useUpdatedRef(reset);
|
|
825
|
-
const latestResetFunc = (0, import_react13.useCallback)(() => {
|
|
826
|
-
return latestReset.current();
|
|
827
|
-
}, [latestReset]);
|
|
828
|
-
const lazyToolRendered = useLazyToolRenderer();
|
|
829
|
-
const renderCustomMessage = (0, import_react14.useRenderCustomMessages)();
|
|
830
|
-
const legacyCustomMessageRenderer = useLegacyCoagentRenderer({
|
|
831
|
-
copilotkit,
|
|
832
|
-
agent,
|
|
833
|
-
agentId: resolvedAgentId,
|
|
834
|
-
threadId: (_b = existingConfig == null ? void 0 : existingConfig.threadId) != null ? _b : threadId
|
|
835
|
-
});
|
|
836
|
-
const allMessages = (_c = agent == null ? void 0 : agent.messages) != null ? _c : [];
|
|
837
|
-
const resolvedMessages = (0, import_react13.useMemo)(() => {
|
|
838
|
-
let processedMessages = allMessages.map((message) => {
|
|
839
|
-
if (message.role !== "assistant") {
|
|
840
|
-
return message;
|
|
841
|
-
}
|
|
842
|
-
const lazyRendered = lazyToolRendered(message, allMessages);
|
|
843
|
-
if (lazyRendered) {
|
|
844
|
-
const renderedGenUi = lazyRendered();
|
|
845
|
-
if (renderedGenUi) {
|
|
846
|
-
return __spreadProps(__spreadValues({}, message), { generativeUI: () => renderedGenUi });
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
const bridgeRenderer = legacyCustomMessageRenderer || renderCustomMessage ? () => {
|
|
850
|
-
const customRender = renderCustomMessage == null ? void 0 : renderCustomMessage({
|
|
851
|
-
message,
|
|
852
|
-
position: "before"
|
|
853
|
-
});
|
|
854
|
-
if (customRender) {
|
|
855
|
-
return customRender;
|
|
856
|
-
}
|
|
857
|
-
return legacyCustomMessageRenderer == null ? void 0 : legacyCustomMessageRenderer({ message, position: "before" });
|
|
858
|
-
} : null;
|
|
859
|
-
if (bridgeRenderer) {
|
|
860
|
-
return __spreadProps(__spreadValues({}, message), { generativeUI: bridgeRenderer });
|
|
861
|
-
}
|
|
862
|
-
return message;
|
|
863
|
-
});
|
|
864
|
-
const hasAssistantMessages = processedMessages.some((msg) => msg.role === "assistant");
|
|
865
|
-
return processedMessages;
|
|
866
|
-
}, [
|
|
867
|
-
agent == null ? void 0 : agent.messages,
|
|
868
|
-
lazyToolRendered,
|
|
869
|
-
allMessages,
|
|
870
|
-
renderCustomMessage,
|
|
871
|
-
// legacyCustomMessageRenderer,
|
|
872
|
-
resolvedAgentId
|
|
873
|
-
]);
|
|
874
|
-
const renderedSuggestions = (0, import_react13.useMemo)(() => {
|
|
875
|
-
if (Array.isArray(suggestions)) {
|
|
876
|
-
return {
|
|
877
|
-
suggestions: suggestions.map((s) => __spreadProps(__spreadValues({}, s), { isLoading: false })),
|
|
878
|
-
isLoading: false
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
return currentSuggestions;
|
|
882
|
-
}, [suggestions, currentSuggestions]);
|
|
883
|
-
return {
|
|
884
|
-
messages: resolvedMessages,
|
|
885
|
-
sendMessage: latestSendMessageFunc,
|
|
886
|
-
appendMessage: latestAppendFunc,
|
|
887
|
-
setMessages: latestSetMessagesFunc,
|
|
888
|
-
reloadMessages: latestReloadFunc,
|
|
889
|
-
stopGeneration: latestStopFunc,
|
|
890
|
-
reset: latestResetFunc,
|
|
891
|
-
deleteMessage: latestDeleteFunc,
|
|
892
|
-
isAvailable: agentAvailable,
|
|
893
|
-
isLoading: Boolean(agent == null ? void 0 : agent.isRunning),
|
|
894
|
-
// mcpServers,
|
|
895
|
-
// setMcpServers,
|
|
896
|
-
suggestions: renderedSuggestions.suggestions,
|
|
897
|
-
setSuggestions: (suggestions2) => copilotkit.addSuggestionsConfig({ suggestions: suggestions2 }),
|
|
898
|
-
generateSuggestions: () => __async(this, null, function* () {
|
|
899
|
-
return copilotkit.reloadSuggestions(resolvedAgentId);
|
|
900
|
-
}),
|
|
901
|
-
resetSuggestions: () => copilotkit.clearSuggestions(resolvedAgentId),
|
|
902
|
-
isLoadingSuggestions: renderedSuggestions.isLoading,
|
|
903
|
-
interrupt,
|
|
904
|
-
agent,
|
|
905
|
-
threadId
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
function useUpdatedRef(value) {
|
|
909
|
-
const ref = (0, import_react13.useRef)(value);
|
|
910
|
-
(0, import_react13.useEffect)(() => {
|
|
911
|
-
ref.current = value;
|
|
912
|
-
}, [value]);
|
|
913
|
-
return ref;
|
|
914
|
-
}
|
|
915
|
-
function useLegacyCoagentRenderer({
|
|
916
|
-
copilotkit,
|
|
917
|
-
agent,
|
|
918
|
-
agentId,
|
|
919
|
-
threadId
|
|
920
|
-
}) {
|
|
921
|
-
return (0, import_react13.useMemo)(() => {
|
|
922
|
-
if (!copilotkit || !agent) {
|
|
923
|
-
return null;
|
|
924
|
-
}
|
|
925
|
-
return ({ message, position }) => {
|
|
926
|
-
var _a;
|
|
927
|
-
const effectiveThreadId = (_a = threadId != null ? threadId : agent.threadId) != null ? _a : "default";
|
|
928
|
-
const existingRunId = copilotkit.getRunIdForMessage(agentId, effectiveThreadId, message.id);
|
|
929
|
-
const runId = existingRunId || `pending:${message.id}`;
|
|
930
|
-
const messageIndex = Math.max(
|
|
931
|
-
agent.messages.findIndex((msg) => msg.id === message.id),
|
|
932
|
-
0
|
|
933
|
-
);
|
|
934
|
-
const bridgeProps = {
|
|
935
|
-
message,
|
|
936
|
-
position,
|
|
937
|
-
runId,
|
|
938
|
-
messageIndex,
|
|
939
|
-
messageIndexInRun: 0,
|
|
940
|
-
numberOfMessagesInRun: 1,
|
|
941
|
-
agentId,
|
|
942
|
-
stateSnapshot: message.state
|
|
943
|
-
};
|
|
944
|
-
return (0, import_react13.createElement)(CoAgentStateRenderBridge, bridgeProps);
|
|
945
|
-
};
|
|
946
|
-
}, [agent, agentId, copilotkit, threadId]);
|
|
947
|
-
}
|
|
948
|
-
function defaultSystemMessage(contextString, additionalInstructions) {
|
|
949
|
-
return `
|
|
950
|
-
Please act as an efficient, competent, conscientious, and industrious professional assistant.
|
|
951
|
-
|
|
952
|
-
Help 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.
|
|
953
|
-
Always be polite and respectful, and prefer brevity over verbosity.
|
|
954
|
-
|
|
955
|
-
The user has provided you with the following context:
|
|
956
|
-
\`\`\`
|
|
957
|
-
${contextString}
|
|
958
|
-
\`\`\`
|
|
959
|
-
|
|
960
|
-
They have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.
|
|
961
|
-
|
|
962
|
-
Please assist them as best you can.
|
|
963
|
-
|
|
964
|
-
You 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.
|
|
965
|
-
|
|
966
|
-
If you would like to call a function, call it without saying anything else.
|
|
967
|
-
In case of a function error:
|
|
968
|
-
- If this error stems from incorrect function parameters or syntax, you may retry with corrected arguments.
|
|
969
|
-
- If the error's source is unclear or seems unrelated to your input, do not attempt further retries.
|
|
970
|
-
` + (additionalInstructions ? `
|
|
971
|
-
|
|
972
|
-
${additionalInstructions}` : "");
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
// src/hooks/use-copilot-chat-headless_c.ts
|
|
976
|
-
var import_shared4 = require("@copilotkit/shared");
|
|
977
|
-
var createNonFunctionalReturn = () => ({
|
|
978
|
-
visibleMessages: [],
|
|
979
|
-
messages: [],
|
|
980
|
-
sendMessage: () => __async(void 0, null, function* () {
|
|
981
|
-
}),
|
|
982
|
-
appendMessage: () => __async(void 0, null, function* () {
|
|
983
|
-
}),
|
|
984
|
-
setMessages: () => {
|
|
985
|
-
},
|
|
986
|
-
deleteMessage: () => {
|
|
987
|
-
},
|
|
988
|
-
reloadMessages: () => __async(void 0, null, function* () {
|
|
989
|
-
}),
|
|
990
|
-
stopGeneration: () => {
|
|
991
|
-
},
|
|
992
|
-
reset: () => {
|
|
993
|
-
},
|
|
994
|
-
isLoading: false,
|
|
995
|
-
isAvailable: false,
|
|
996
|
-
runChatCompletion: () => __async(void 0, null, function* () {
|
|
997
|
-
return [];
|
|
998
|
-
}),
|
|
999
|
-
mcpServers: [],
|
|
1000
|
-
setMcpServers: () => {
|
|
1001
|
-
},
|
|
1002
|
-
suggestions: [],
|
|
1003
|
-
setSuggestions: () => {
|
|
1004
|
-
},
|
|
1005
|
-
generateSuggestions: () => __async(void 0, null, function* () {
|
|
1006
|
-
}),
|
|
1007
|
-
resetSuggestions: () => {
|
|
1008
|
-
},
|
|
1009
|
-
isLoadingSuggestions: false,
|
|
1010
|
-
interrupt: null
|
|
1011
|
-
});
|
|
1012
|
-
function useCopilotChatHeadless_c(options = {}) {
|
|
1013
|
-
const { copilotApiConfig, setBannerError } = useCopilotContext();
|
|
1014
|
-
const hasPublicApiKey = Boolean(copilotApiConfig.publicApiKey);
|
|
1015
|
-
const internalResult = useCopilotChatInternal(options);
|
|
1016
|
-
(0, import_react15.useEffect)(() => {
|
|
1017
|
-
if (!hasPublicApiKey) {
|
|
1018
|
-
setBannerError(
|
|
1019
|
-
new import_shared4.CopilotKitError({
|
|
1020
|
-
message: (
|
|
1021
|
-
// add link to documentation here
|
|
1022
|
-
"You're using useCopilotChatHeadless_c, a premium-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key."
|
|
1023
|
-
),
|
|
1024
|
-
code: import_shared4.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
1025
|
-
severity: import_shared4.Severity.WARNING,
|
|
1026
|
-
visibility: import_shared4.ErrorVisibility.BANNER
|
|
1027
|
-
})
|
|
1028
|
-
);
|
|
1029
|
-
import_shared4.styledConsole.logCopilotKitPlatformMessage();
|
|
1030
|
-
} else {
|
|
1031
|
-
setBannerError(null);
|
|
1032
|
-
}
|
|
1033
|
-
}, [hasPublicApiKey]);
|
|
1034
|
-
if (hasPublicApiKey) {
|
|
1035
|
-
return internalResult;
|
|
1036
|
-
}
|
|
1037
|
-
return createNonFunctionalReturn();
|
|
1038
|
-
}
|
|
1039
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1040
|
-
0 && (module.exports = {
|
|
1041
|
-
defaultSystemMessage,
|
|
1042
|
-
useCopilotChatHeadless_c
|
|
1043
|
-
});
|
|
1044
|
-
//# sourceMappingURL=use-copilot-chat-headless_c.js.map
|