@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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3433 @@
|
|
|
1
|
+
import { a as useMarkdownRenderer, c as ReactActivityMessageRenderer, i as MarkdownRendererProvider, l as GenerativeUIConfig, n as MarkdownRenderer, r as MarkdownRendererProps, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps } from "./MarkdownRendererContext-CRKFzsEB.mjs";
|
|
2
|
+
import { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreAddAgentParams, CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, CopilotKitCoreConfig as CopilotKitCoreConfig$1, CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, CopilotKitCoreGetToolParams, CopilotKitCoreRegisterProxiedAgentParams, CopilotKitCoreRegisterProxiedAgentResult, CopilotKitCoreRunAgentParams, CopilotKitCoreRunToolParams, CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscriber as CopilotKitCoreSubscriber$1, CopilotKitCoreSubscription, CopilotKitCoreSubscription as CopilotKitCoreSubscription$1, CopilotKitHeaderResolutionError, CopilotKitHeadersSource, CopilotKitHeadersSource as CopilotKitHeadersSource$1, CopilotKitMessageFilter, CopilotKitMessageFilter as CopilotKitMessageFilter$1, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, DynamicSuggestionsConfig as DynamicSuggestionsConfig$1, Effect, EmptyActionConfig, FrontendTool, FrontendTool as FrontendTool$1, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, IntelligenceRuntimeInfo, JsonValue, LearningConfig, LearningConfig as LearningConfig$1, LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, MarkdownToken, MarkdownTokenList, Memory, Memory as Memory$1, MemoryChanges, MemoryChanges as MemoryChanges$1, MemoryError, MemoryErrorCategory, MemoryErrorCode, MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryRealtimeStatus as MemoryRealtimeStatus$1, MemoryScope, NewMemory, NewMemory as NewMemory$1, NonDispatchingEffect, NonDispatchingEffectOptions, OpenThreadRegistration, ParseMarkdownOptions, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, RuntimeLicenseStatus, RuntimeMode, ScopedContext, ScopedProperties, Selector, StartResult, StateManager, StaticSuggestionsConfig, StaticSuggestionsConfig as StaticSuggestionsConfig$1, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, Suggestion as Suggestion$1, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, Tokens, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseMarkdown, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults } from "@copilotkit/core";
|
|
3
|
+
import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, AGUIEvent, AGUIEventByType, AGUIEventOf, AGUI_METADATA_KEY, AbstractAgent, AbstractAgent as AbstractAgent$1, ActivityDeltaEvent, ActivityDeltaEventProps, ActivityMessage, ActivitySnapshotEvent, ActivitySnapshotEventProps, AddOperation, AgentCapabilities, AgentConfig, AgentDebugConfig, AgentStateMutation, AgentSubscriber, AgentSubscriberParams, AssistantMessage, Attributable, AudioInputContent, AudioInputPart, AudioPart, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, BaseEvent, BaseEventFields, BaseEventProps, BaseMessage, CompatibilityBoundary, ContentPart, Context, CopyOperation, CustomEvent, CustomEventProps, DataSource, DebugLogger, DebugLoggerInput, DeveloperMessage, DocumentInputContent, DocumentInputPart, DocumentPart, Event, EventPayloadOf, EventType, ExecutionCapabilities, FileSource, FilterToolCallsMiddleware, FunctionCall, FunctionMiddleware, HttpAgent, HttpAgentConfig, HttpAgentFetchFn, HumanInTheLoopCapabilities, IdentityCapabilities, ImageInputContent, ImageInputPart, ImagePart, InputContent, InputContentDataSource, InputContentPart, InputContentSource, InputContentUrlSource, Interrupt, JsonPatch, JsonPatchOperation, JsonPointer, Message, MessagesSnapshotEvent, MessagesSnapshotEventProps, Metadata, Middleware, MiddlewareFunction, MoveOperation, MultiAgentCapabilities, MultimodalCapabilities, MultimodalInputCapabilities, MultimodalOutputCapabilities, OutputCapabilities, PROTOCOL_VERSION, PartSource, RawEvent, RawEventProps, ReasoningCapabilities, ReasoningEncryptedValueEvent, ReasoningEncryptedValueEventProps, ReasoningEncryptedValueSubtype, ReasoningEndEvent, ReasoningEndEventProps, ReasoningMessage, ReasoningMessageChunkEvent, ReasoningMessageChunkEventProps, ReasoningMessageContentEvent, ReasoningMessageContentEventProps, ReasoningMessageEndEvent, ReasoningMessageEndEventProps, ReasoningMessageStartEvent, ReasoningMessageStartEventProps, ReasoningStartEvent, ReasoningStartEventProps, RemoveOperation, ReplaceOperation, ResolvedAgentDebugConfig, ResumeEntry, ResumeStatus, Role, RunAgentInput, RunAgentParameters, RunAgentResult, RunAgentResult as RunAgentResult$1, RunErrorEvent, RunErrorEventProps, RunFinishedCancelledOutcome, RunFinishedEvent, RunFinishedEventProps, RunFinishedInterruptOutcome, RunFinishedOutcome, RunFinishedSuccessOutcome, RunStartedEvent, RunStartedEventProps, State, StateCapabilities, StateDeltaEvent, StateDeltaEventProps, StateSnapshotEvent, StateSnapshotEventProps, StepFinishedEvent, StepFinishedEventProps, StepStartedEvent, StepStartedEventProps, SubagentErrorEvent, SubagentErrorEventProps, SubagentFinishedEvent, SubagentFinishedEventProps, SubagentFinishedOutcome, SubagentFinishedSuccessOutcome, SubagentFinishedSuspendedOutcome, SubagentInfo, SubagentRunId, SubagentStartedEvent, SubagentStartedEventProps, SystemMessage, TestOperation, TextInputContent, TextMessageChunkEvent, TextMessageChunkEventProps, TextMessageContentEvent, TextMessageContentEventProps, TextMessageEndEvent, TextMessageEndEventProps, TextMessageRole, TextMessageStartEvent, TextMessageStartEventProps, TextPart, TokenUsage, Tool, ToolCall, ToolCallArgsEvent, ToolCallArgsEventProps, ToolCallChunkEvent, ToolCallChunkEventProps, ToolCallEndEvent, ToolCallEndEventProps, ToolCallResultEvent, ToolCallResultEventProps, ToolCallStartEvent, ToolCallStartEventProps, ToolMessage, ToolsCapabilities, TransportCapabilities, UnrecognizedEvent, UrlSource, UserMessage, VideoInputContent, VideoInputPart, VideoPart, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
|
|
4
|
+
import { ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, BaseEventSchema, BaseMessageSchema, ContentPartSchema, ContextSchema, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FunctionCallSchema, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, PartSourceSchema, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UrlSourceSchema, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema } from "@ag-ui/core/schemas";
|
|
5
|
+
import * as react from "react";
|
|
6
|
+
import React$1, { ComponentType, ReactNode } from "react";
|
|
7
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
import { Attachment, Attachment as Attachment$1, AttachmentModality, AttachmentsConfig, AttachmentsConfig as AttachmentsConfig$1, DebugConfig, InferSchemaOutput, InputContentSource as InputContentSource$1, StandardSchemaV1 } from "@copilotkit/shared";
|
|
9
|
+
import { ActivityMessage as ActivityMessage$1, AgentCapabilities as AgentCapabilities$1, AssistantMessage as AssistantMessage$1, Message as Message$1, ReasoningMessage as ReasoningMessage$1, ToolCall as ToolCall$1, ToolMessage as ToolMessage$1, UserMessage as UserMessage$1 } from "@ag-ui/core";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { MCPAppsActivityContent, MCPAppsActivityContent as MCPAppsActivityContent$1, MCPAppsActivityContentSchema, MCPAppsActivityType, ɵMcpFollowUpHost, ɵrunMcpFollowUp } from "@copilotkit/mcp-apps-renderer/activity";
|
|
12
|
+
import { Theme, Theme as A2UITheme, defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
|
|
13
|
+
import { Anchor as InspectorAnchor } from "@copilotkit/web-inspector";
|
|
14
|
+
import { CopilotKitContextValue, useCopilotKit, useLicenseContext } from "@copilotkit/react-core/context";
|
|
15
|
+
|
|
16
|
+
//#region src/components/chat/BasicMarkdownRenderer.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Dependency-light built-in markdown renderer (basic GFM). Walks the
|
|
19
|
+
* framework-agnostic token tree from `@copilotkit/core` into React elements.
|
|
20
|
+
* No syntax highlighting, no math, no table/image action buttons — plug in a
|
|
21
|
+
* custom renderer via `CopilotKitProvider markdownRenderer={...}` for those.
|
|
22
|
+
*/
|
|
23
|
+
declare function BasicMarkdownRenderer({
|
|
24
|
+
content,
|
|
25
|
+
className
|
|
26
|
+
}: MarkdownRendererProps): react_jsx_runtime0.JSX.Element | null;
|
|
27
|
+
declare namespace BasicMarkdownRenderer {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/chat/StreamingMarkdownDefaultRenderer.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* react-core's built-in default markdown renderer — a thin adapter over
|
|
34
|
+
* `@copilotkit/markdown-renderer`'s streaming renderer. Maps the pluggable
|
|
35
|
+
* renderer contract (`{ content, isStreaming, className }`) onto the streaming
|
|
36
|
+
* renderer for streaming-safe incremental rendering + per-token animation.
|
|
37
|
+
* Still overridable via the slot/provider pluggable interface.
|
|
38
|
+
*/
|
|
39
|
+
declare function StreamingMarkdownDefaultRenderer({
|
|
40
|
+
content,
|
|
41
|
+
isStreaming,
|
|
42
|
+
className,
|
|
43
|
+
nodeRenderers,
|
|
44
|
+
caret,
|
|
45
|
+
options,
|
|
46
|
+
onLinkClick,
|
|
47
|
+
onCitationClick
|
|
48
|
+
}: MarkdownRendererProps & DefaultMarkdownRendererProps): react_jsx_runtime0.JSX.Element | null;
|
|
49
|
+
declare namespace StreamingMarkdownDefaultRenderer {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/components/chat/CopilotChatAudioRecorder.d.ts
|
|
54
|
+
/** Finite-state machine for every recorder implementation */
|
|
55
|
+
type AudioRecorderState = "idle" | "recording" | "processing";
|
|
56
|
+
/** Error subclass so callers can `instanceof`-guard recorder failures */
|
|
57
|
+
declare class AudioRecorderError extends Error {
|
|
58
|
+
constructor(message: string);
|
|
59
|
+
}
|
|
60
|
+
interface AudioRecorderRef {
|
|
61
|
+
state: AudioRecorderState;
|
|
62
|
+
start: () => Promise<void>;
|
|
63
|
+
stop: () => Promise<Blob>;
|
|
64
|
+
dispose: () => void;
|
|
65
|
+
}
|
|
66
|
+
declare const CopilotChatAudioRecorder: react.ForwardRefExoticComponent<react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<AudioRecorderRef>>;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/providers/CopilotChatConfigurationProvider.d.ts
|
|
69
|
+
declare const CopilotChatDefaultLabels: {
|
|
70
|
+
chatInputPlaceholder: string;
|
|
71
|
+
chatInputToolbarStartTranscribeButtonLabel: string;
|
|
72
|
+
chatInputToolbarCancelTranscribeButtonLabel: string;
|
|
73
|
+
chatInputToolbarFinishTranscribeButtonLabel: string;
|
|
74
|
+
chatInputToolbarAddButtonLabel: string;
|
|
75
|
+
chatInputToolbarToolsButtonLabel: string;
|
|
76
|
+
chatInputToolbarSendButtonLabel: string;
|
|
77
|
+
chatInputToolbarStopButtonLabel: string;
|
|
78
|
+
assistantMessageToolbarCopyCodeLabel: string;
|
|
79
|
+
assistantMessageToolbarCopyCodeCopiedLabel: string;
|
|
80
|
+
assistantMessageToolbarCopyMessageLabel: string;
|
|
81
|
+
assistantMessageToolbarInspectorLabel: string;
|
|
82
|
+
assistantMessageToolbarInspectorDescription: string;
|
|
83
|
+
assistantMessageToolbarInspectorLocalOnlyLabel: string;
|
|
84
|
+
assistantMessageToolbarInspectorLocalOnlyDescription: string;
|
|
85
|
+
assistantMessageToolbarInspectorTitle: string;
|
|
86
|
+
assistantMessageToolbarInspectorHideLabel: string;
|
|
87
|
+
assistantMessageToolbarInspectorHideDescription: string;
|
|
88
|
+
assistantMessageToolbarThumbsUpLabel: string;
|
|
89
|
+
assistantMessageToolbarThumbsDownLabel: string;
|
|
90
|
+
assistantMessageFeedbackCommentPlaceholder: string;
|
|
91
|
+
assistantMessageFeedbackCommentSubmitLabel: string;
|
|
92
|
+
assistantMessageToolbarReadAloudLabel: string;
|
|
93
|
+
assistantMessageToolbarRegenerateLabel: string;
|
|
94
|
+
userMessageToolbarCopyMessageLabel: string;
|
|
95
|
+
userMessageToolbarEditMessageLabel: string;
|
|
96
|
+
userMessageToolbarPreviousBranchLabel: string;
|
|
97
|
+
userMessageToolbarNextBranchLabel: string;
|
|
98
|
+
chatDisclaimerText: string;
|
|
99
|
+
chatToggleOpenLabel: string;
|
|
100
|
+
chatToggleCloseLabel: string;
|
|
101
|
+
chatScrollToBottomLabel: string;
|
|
102
|
+
modalHeaderTitle: string;
|
|
103
|
+
welcomeMessageText: string;
|
|
104
|
+
reasoningMessageThinkingLabel: string;
|
|
105
|
+
chatInputSlashMenuLabel: string;
|
|
106
|
+
chatInputSlashMenuEmptyText: string;
|
|
107
|
+
attachmentRemoveButtonLabel: string;
|
|
108
|
+
attachmentPlayVideoButtonLabel: string;
|
|
109
|
+
attachmentPreviewCloseButtonLabel: string;
|
|
110
|
+
modalHeaderCloseButtonLabel: string;
|
|
111
|
+
modalHeaderThreadsButtonLabel: string;
|
|
112
|
+
sidebarLabel: string;
|
|
113
|
+
};
|
|
114
|
+
type CopilotChatLabels = typeof CopilotChatDefaultLabels;
|
|
115
|
+
interface CopilotChatConfigurationValue {
|
|
116
|
+
labels: CopilotChatLabels;
|
|
117
|
+
agentId: string;
|
|
118
|
+
threadId: string;
|
|
119
|
+
isModalOpen: boolean;
|
|
120
|
+
setModalOpen: (open: boolean) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the thread-list drawer is open. A sibling boolean to `isModalOpen`
|
|
123
|
+
* (deliberately NOT folded into a tri-state enum): on desktop the chat modal
|
|
124
|
+
* and the drawer coexist, so two independent booleans are required.
|
|
125
|
+
*/
|
|
126
|
+
drawerOpen: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Toggles the drawer open state. On mobile viewports (`<768px`) opening the
|
|
129
|
+
* drawer closes the chat modal (mutual exclusion); on desktop there is no
|
|
130
|
+
* constraint.
|
|
131
|
+
*/
|
|
132
|
+
setDrawerOpen: (open: boolean) => void;
|
|
133
|
+
/**
|
|
134
|
+
* True once a `<CopilotThreadsDrawer>` wrapper has registered itself with this chat
|
|
135
|
+
* configuration. The header thread-list launcher renders ONLY when this is
|
|
136
|
+
* set, so chats with no drawer stay byte-for-byte unchanged.
|
|
137
|
+
*/
|
|
138
|
+
drawerRegistered: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Called by the drawer wrapper on mount to announce its presence (and flip
|
|
141
|
+
* `drawerRegistered`). Returns a cleanup function that de-registers the
|
|
142
|
+
* drawer on unmount.
|
|
143
|
+
*
|
|
144
|
+
* @returns A cleanup callback that reverses the registration.
|
|
145
|
+
*/
|
|
146
|
+
registerDrawer: () => () => void;
|
|
147
|
+
/**
|
|
148
|
+
* Internal: registers the modal-close setter of the provider that actually
|
|
149
|
+
* owns the rendered modal (a descendant that supplied `isModalDefaultOpen`),
|
|
150
|
+
* so the drawer's mobile mutual-exclusion — owned by the top-most provider —
|
|
151
|
+
* closes the modal that is genuinely on screen rather than the top-most
|
|
152
|
+
* provider's own (possibly unrendered) modal state.
|
|
153
|
+
*
|
|
154
|
+
* @param closeModal - A setter the drawer may call to close the rendered modal.
|
|
155
|
+
* @returns A cleanup callback that de-registers the closer.
|
|
156
|
+
*/
|
|
157
|
+
ɵregisterModalCloser: (closeModal: (open: boolean) => void) => () => void;
|
|
158
|
+
hasExplicitThreadId: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Imperatively sets the active thread for this chat configuration.
|
|
161
|
+
*
|
|
162
|
+
* Use this to drive the rendered thread without a host callback — e.g. a
|
|
163
|
+
* `<CopilotThreadsDrawer>` selecting a thread row sets it explicitly so the chat
|
|
164
|
+
* connects to that backend thread.
|
|
165
|
+
*
|
|
166
|
+
* Guarded like the top-level `<CopilotKit>` provider's `setThreadId`: when
|
|
167
|
+
* the consumer controls the threadId via the `threadId` prop on this
|
|
168
|
+
* provider, this is a no-op (a warning is logged) so a prop-controlled
|
|
169
|
+
* threadId is never silently overridden.
|
|
170
|
+
*
|
|
171
|
+
* @param threadId - The thread id to make active.
|
|
172
|
+
* @param options.explicit - Whether the thread is a caller choice. Defaults
|
|
173
|
+
* to `true` (a picked thread). Pass `false` to set a non-explicit thread
|
|
174
|
+
* so the welcome screen shows (see {@link startNewThread}).
|
|
175
|
+
*/
|
|
176
|
+
setActiveThreadId: (threadId: string, options?: {
|
|
177
|
+
explicit?: boolean;
|
|
178
|
+
}) => void;
|
|
179
|
+
/**
|
|
180
|
+
* Resets the active thread to a fresh, non-explicit client-side thread: a
|
|
181
|
+
* newly minted UUID with `hasExplicitThreadId=false`, so the welcome screen
|
|
182
|
+
* shows. Pairs with the core `startNewThread()` to clear the conversation
|
|
183
|
+
* with no host wiring.
|
|
184
|
+
*
|
|
185
|
+
* Guarded identically to {@link setActiveThreadId}: a no-op when the
|
|
186
|
+
* threadId is prop-controlled.
|
|
187
|
+
*/
|
|
188
|
+
startNewThread: () => void;
|
|
189
|
+
}
|
|
190
|
+
interface CopilotChatConfigurationProviderProps {
|
|
191
|
+
children: ReactNode;
|
|
192
|
+
labels?: Partial<CopilotChatLabels>;
|
|
193
|
+
agentId?: string;
|
|
194
|
+
threadId?: string;
|
|
195
|
+
hasExplicitThreadId?: boolean;
|
|
196
|
+
isModalDefaultOpen?: boolean;
|
|
197
|
+
}
|
|
198
|
+
declare const CopilotChatConfigurationProvider: React$1.FC<CopilotChatConfigurationProviderProps>;
|
|
199
|
+
declare const useCopilotChatConfiguration: () => CopilotChatConfigurationValue | null;
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/lib/slots.d.ts
|
|
202
|
+
/** Existing union (unchanged) */
|
|
203
|
+
type SlotValue<C extends React$1.ComponentType<any>> = C | string | Partial<React$1.ComponentProps<C>>;
|
|
204
|
+
/** Utility: concrete React elements for every slot */
|
|
205
|
+
type SlotElements<S> = { [K in keyof S]: React$1.ReactElement };
|
|
206
|
+
type WithSlots<S extends Record<string, React$1.ComponentType<any>>, Rest = {}> = { [K in keyof S]?: SlotValue<S[K]> } & {
|
|
207
|
+
children?: (props: SlotElements<S> & Rest) => React$1.ReactNode;
|
|
208
|
+
} & Omit<Rest, "children">;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/chat/CopilotChatInput.d.ts
|
|
211
|
+
type CopilotChatInputMode = "input" | "transcribe" | "processing";
|
|
212
|
+
type ToolsMenuItem = {
|
|
213
|
+
label: string;
|
|
214
|
+
} & ({
|
|
215
|
+
action: () => void;
|
|
216
|
+
items?: never;
|
|
217
|
+
} | {
|
|
218
|
+
action?: never;
|
|
219
|
+
items: (ToolsMenuItem | "-")[];
|
|
220
|
+
});
|
|
221
|
+
type CopilotChatInputSlots = {
|
|
222
|
+
textArea: typeof CopilotChatInput.TextArea;
|
|
223
|
+
sendButton: typeof CopilotChatInput.SendButton;
|
|
224
|
+
startTranscribeButton: typeof CopilotChatInput.StartTranscribeButton;
|
|
225
|
+
cancelTranscribeButton: typeof CopilotChatInput.CancelTranscribeButton;
|
|
226
|
+
finishTranscribeButton: typeof CopilotChatInput.FinishTranscribeButton;
|
|
227
|
+
addMenuButton: typeof CopilotChatInput.AddMenuButton;
|
|
228
|
+
audioRecorder: typeof CopilotChatAudioRecorder;
|
|
229
|
+
disclaimer: typeof CopilotChatInput.Disclaimer;
|
|
230
|
+
};
|
|
231
|
+
type CopilotChatInputRestProps = {
|
|
232
|
+
mode?: CopilotChatInputMode;
|
|
233
|
+
toolsMenu?: (ToolsMenuItem | "-")[];
|
|
234
|
+
autoFocus?: boolean;
|
|
235
|
+
onSubmitMessage?: (value: string) => void;
|
|
236
|
+
onStop?: () => void;
|
|
237
|
+
isRunning?: boolean;
|
|
238
|
+
onStartTranscribe?: () => void;
|
|
239
|
+
onCancelTranscribe?: () => void;
|
|
240
|
+
onFinishTranscribe?: () => void;
|
|
241
|
+
onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
|
|
242
|
+
onAddFile?: () => void;
|
|
243
|
+
value?: string;
|
|
244
|
+
onChange?: (value: string) => void; /** Positioning mode for the input container. Default: 'static' */
|
|
245
|
+
positioning?: "static" | "absolute"; /** Keyboard height in pixels for mobile keyboard handling */
|
|
246
|
+
keyboardHeight?: number; /** Ref for the outer positioning container */
|
|
247
|
+
containerRef?: React$1.Ref<HTMLDivElement>; /** Whether to show the disclaimer. Default: true for absolute positioning, false for static */
|
|
248
|
+
showDisclaimer?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Set to `true` when the input sits at the bottom of its container as a
|
|
251
|
+
* flex-last-child (visible position is driven by layout, not CSS
|
|
252
|
+
* positioning). Triggers reservation of bottom space for the fixed
|
|
253
|
+
* CopilotKit license banner via the
|
|
254
|
+
* `--copilotkit-license-banner-offset` CSS var so the two don't overlap.
|
|
255
|
+
*
|
|
256
|
+
* Not needed when `positioning === "absolute"`; that mode already pins the
|
|
257
|
+
* input to the bottom and picks up the same reservation automatically.
|
|
258
|
+
* Leave unset (default `false`) for inputs rendered mid-layout such as the
|
|
259
|
+
* welcome screen, where the banner offset would push the input off-center.
|
|
260
|
+
*/
|
|
261
|
+
bottomAnchored?: boolean;
|
|
262
|
+
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "onChange">;
|
|
263
|
+
type CopilotChatInputBaseProps = WithSlots<CopilotChatInputSlots, CopilotChatInputRestProps>;
|
|
264
|
+
type CopilotChatInputChildrenArgs = CopilotChatInputBaseProps extends {
|
|
265
|
+
children?: infer C;
|
|
266
|
+
} ? C extends ((props: infer P) => React$1.ReactNode) ? P : never : never;
|
|
267
|
+
type CopilotChatInputProps = Omit<CopilotChatInputBaseProps, "children"> & {
|
|
268
|
+
children?: (props: CopilotChatInputChildrenArgs) => React$1.ReactNode;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* The chat composer: a text area with the add-menu, voice and send/stop
|
|
272
|
+
* buttons, and a slash-command menu that lists `toolsMenu` items once the text
|
|
273
|
+
* starts with "/".
|
|
274
|
+
*/
|
|
275
|
+
declare function CopilotChatInput({
|
|
276
|
+
mode,
|
|
277
|
+
onSubmitMessage,
|
|
278
|
+
onStop,
|
|
279
|
+
isRunning,
|
|
280
|
+
onStartTranscribe,
|
|
281
|
+
onCancelTranscribe,
|
|
282
|
+
onFinishTranscribe,
|
|
283
|
+
onFinishTranscribeWithAudio,
|
|
284
|
+
onAddFile,
|
|
285
|
+
onChange,
|
|
286
|
+
value,
|
|
287
|
+
toolsMenu,
|
|
288
|
+
autoFocus,
|
|
289
|
+
positioning,
|
|
290
|
+
keyboardHeight,
|
|
291
|
+
containerRef,
|
|
292
|
+
showDisclaimer,
|
|
293
|
+
bottomAnchored,
|
|
294
|
+
textArea,
|
|
295
|
+
sendButton,
|
|
296
|
+
startTranscribeButton,
|
|
297
|
+
cancelTranscribeButton,
|
|
298
|
+
finishTranscribeButton,
|
|
299
|
+
addMenuButton,
|
|
300
|
+
audioRecorder,
|
|
301
|
+
disclaimer,
|
|
302
|
+
children,
|
|
303
|
+
className,
|
|
304
|
+
...props
|
|
305
|
+
}: CopilotChatInputProps): react_jsx_runtime0.JSX.Element;
|
|
306
|
+
declare namespace CopilotChatInput {
|
|
307
|
+
/**
|
|
308
|
+
* The icon-only send button. Its accessible name is
|
|
309
|
+
* `labels.chatInputToolbarSendButtonLabel` unless an `aria-label` is passed;
|
|
310
|
+
* the input passes `labels.chatInputToolbarStopButtonLabel` while the button
|
|
311
|
+
* stops a run.
|
|
312
|
+
*/
|
|
313
|
+
const SendButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
314
|
+
/**
|
|
315
|
+
* An icon-only toolbar button. `labels[labelKey]` is both its accessible
|
|
316
|
+
* name and its tooltip text.
|
|
317
|
+
*/
|
|
318
|
+
const ToolbarButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
319
|
+
icon: React$1.ReactNode;
|
|
320
|
+
labelKey: keyof CopilotChatLabels;
|
|
321
|
+
defaultClassName?: string;
|
|
322
|
+
}>;
|
|
323
|
+
const StartTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
324
|
+
const CancelTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
325
|
+
const FinishTranscribeButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
326
|
+
/**
|
|
327
|
+
* The "+" button that opens the attachment and tools menu. Its accessible
|
|
328
|
+
* name and tooltip come from `labels.chatInputToolbarAddButtonLabel`.
|
|
329
|
+
*/
|
|
330
|
+
const AddMenuButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
331
|
+
toolsMenu?: (ToolsMenuItem | "-")[];
|
|
332
|
+
onAddFile?: () => void;
|
|
333
|
+
}>;
|
|
334
|
+
type TextAreaProps = React$1.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
335
|
+
const TextArea: React$1.ForwardRefExoticComponent<TextAreaProps & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
336
|
+
const AudioRecorder: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<AudioRecorderRef>>;
|
|
337
|
+
const Disclaimer: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/components/chat/tool-call-layout.d.ts
|
|
341
|
+
/**
|
|
342
|
+
* How the chat shows tool calls.
|
|
343
|
+
*
|
|
344
|
+
* - `"grouped"` (default): calls made in a row share one card, collapsed to a
|
|
345
|
+
* summary ("Used 3 tools") that opens to a row per call.
|
|
346
|
+
* - `"line"`: the same grouping as a quiet line of text, like the reasoning
|
|
347
|
+
* message's "Thought for 4 seconds".
|
|
348
|
+
* - `"stacked"`: the latest call on top of a stack of the earlier ones; click
|
|
349
|
+
* to fan the stack out into its cards.
|
|
350
|
+
* - `"turn"`: the agent works in the open (narration, then a row per call),
|
|
351
|
+
* and when the reply is done everything before it folds into "Worked for 9s".
|
|
352
|
+
* - `"separate"`: every call gets its own card, as before grouping existed.
|
|
353
|
+
*
|
|
354
|
+
* Only calls drawn by a renderer that opts into grouping (`group: true`) are
|
|
355
|
+
* grouped; CopilotKit's built-in card from `useDefaultRenderTool()` does. Any
|
|
356
|
+
* other call always shows on its own and splits the group around it.
|
|
357
|
+
*/
|
|
358
|
+
type CopilotChatToolCallDisplay = "grouped" | "line" | "stacked" | "turn" | "separate";
|
|
359
|
+
/** One tool call and, once it has finished, the message carrying its result. */
|
|
360
|
+
interface ToolCallEntry {
|
|
361
|
+
toolCall: ToolCall$1;
|
|
362
|
+
toolMessage?: ToolMessage$1;
|
|
363
|
+
}
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/components/chat/CopilotChatToolCallGroup.d.ts
|
|
366
|
+
type CopilotChatToolCallGroupAppearance = "card" | "line" | "stack";
|
|
367
|
+
interface CopilotChatToolCallGroupProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
368
|
+
/** The calls in the group, in order. */
|
|
369
|
+
calls: ToolCallEntry[];
|
|
370
|
+
/** Renders one call through the registered renderers. */
|
|
371
|
+
renderCall: (call: ToolCallEntry) => React$1.ReactNode;
|
|
372
|
+
/**
|
|
373
|
+
* - `"card"` (default): one card with a summary header and a row per call.
|
|
374
|
+
* - `"line"`: a quiet line of text that opens to a list of rows.
|
|
375
|
+
* - `"stack"`: the latest call on a stack of the earlier ones.
|
|
376
|
+
*/
|
|
377
|
+
appearance?: CopilotChatToolCallGroupAppearance;
|
|
378
|
+
/** The agent is running and nothing follows the group, so more calls may join it. */
|
|
379
|
+
isActive?: boolean;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Tool calls made in a row, collapsed into one summary. While a call runs the
|
|
383
|
+
* summary names it ("Running read_file src/app.ts"); once they're all done it
|
|
384
|
+
* reads "Used 3 tools" and opens to the calls.
|
|
385
|
+
*
|
|
386
|
+
* Each call is drawn by its registered renderer. CopilotKit's built-in card
|
|
387
|
+
* (`useDefaultRenderTool`) draws a compact row inside the card and line
|
|
388
|
+
* appearances and an open stack; a custom wildcard renderer draws whatever it
|
|
389
|
+
* draws.
|
|
390
|
+
*/
|
|
391
|
+
declare function CopilotChatToolCallGroup({
|
|
392
|
+
calls,
|
|
393
|
+
renderCall,
|
|
394
|
+
appearance,
|
|
395
|
+
isActive,
|
|
396
|
+
className,
|
|
397
|
+
...props
|
|
398
|
+
}: CopilotChatToolCallGroupProps): react_jsx_runtime0.JSX.Element | null;
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/components/chat/CopilotChatToolCallsView.d.ts
|
|
401
|
+
type CopilotChatToolCallsViewProps = {
|
|
402
|
+
message: AssistantMessage$1;
|
|
403
|
+
messages?: Message$1[];
|
|
404
|
+
/**
|
|
405
|
+
* How to show the calls (see `CopilotChatToolCallDisplay`). Inside a message
|
|
406
|
+
* view it follows the view's `toolCallDisplay`; on its own it defaults to
|
|
407
|
+
* `"grouped"`.
|
|
408
|
+
*/
|
|
409
|
+
display?: CopilotChatToolCallDisplay;
|
|
410
|
+
/**
|
|
411
|
+
* Draws a group of calls made in a row: a component, a class name for the
|
|
412
|
+
* default group, or props for it (e.g. `{ appearance: "line" }`).
|
|
413
|
+
*/
|
|
414
|
+
group?: SlotValue<typeof CopilotChatToolCallGroup>;
|
|
415
|
+
};
|
|
416
|
+
declare function CopilotChatToolCallsView({
|
|
417
|
+
message,
|
|
418
|
+
messages,
|
|
419
|
+
display: displayProp,
|
|
420
|
+
group
|
|
421
|
+
}: CopilotChatToolCallsViewProps): react_jsx_runtime0.JSX.Element | null;
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/components/chat/CopilotChatAssistantMessage.d.ts
|
|
424
|
+
type CopilotChatFeedbackMessage = AssistantMessage$1 & {
|
|
425
|
+
rawEvent?: unknown;
|
|
426
|
+
};
|
|
427
|
+
type CopilotChatAssistantMessageProps = WithSlots<{
|
|
428
|
+
markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
|
|
429
|
+
toolbar: typeof CopilotChatAssistantMessage.Toolbar;
|
|
430
|
+
copyButton: typeof CopilotChatAssistantMessage.CopyButton;
|
|
431
|
+
inspectorButton: typeof CopilotChatAssistantMessage.InspectorButton;
|
|
432
|
+
thumbsUpButton: typeof CopilotChatAssistantMessage.ThumbsUpButton;
|
|
433
|
+
thumbsDownButton: typeof CopilotChatAssistantMessage.ThumbsDownButton;
|
|
434
|
+
readAloudButton: typeof CopilotChatAssistantMessage.ReadAloudButton;
|
|
435
|
+
regenerateButton: typeof CopilotChatAssistantMessage.RegenerateButton;
|
|
436
|
+
toolCallsView: typeof CopilotChatToolCallsView;
|
|
437
|
+
}, {
|
|
438
|
+
onThumbsUp?: (message: CopilotChatFeedbackMessage) => void;
|
|
439
|
+
onThumbsDown?: (message: CopilotChatFeedbackMessage) => void;
|
|
440
|
+
onReadAloud?: (message: AssistantMessage$1) => void;
|
|
441
|
+
onRegenerate?: (message: AssistantMessage$1) => void;
|
|
442
|
+
message: AssistantMessage$1;
|
|
443
|
+
messages?: Message$1[];
|
|
444
|
+
isRunning?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* Whether this is the last message the chat renders. The message view
|
|
447
|
+
* passes it, because the rendered list can differ from `messages` when
|
|
448
|
+
* `transformMessages` drops, replaces or reorders messages. Defaults to
|
|
449
|
+
* comparing against the last entry of `messages`.
|
|
450
|
+
*/
|
|
451
|
+
isLatest?: boolean;
|
|
452
|
+
additionalToolbarItems?: React$1.ReactNode;
|
|
453
|
+
toolbarVisible?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* The comment field of a reply rating, inside the popover next to the
|
|
456
|
+
* chosen thumb. Shown only while Automatic Learning records ratings; it
|
|
457
|
+
* renders after `children`, so a `children` layout does not place it.
|
|
458
|
+
*/
|
|
459
|
+
feedbackComment?: SlotValue<typeof CopilotChatAssistantMessage.FeedbackComment>;
|
|
460
|
+
} & React$1.HTMLAttributes<HTMLDivElement>>;
|
|
461
|
+
declare function CopilotChatAssistantMessage({
|
|
462
|
+
message,
|
|
463
|
+
messages,
|
|
464
|
+
isRunning,
|
|
465
|
+
isLatest,
|
|
466
|
+
onThumbsUp,
|
|
467
|
+
onThumbsDown,
|
|
468
|
+
onReadAloud,
|
|
469
|
+
onRegenerate,
|
|
470
|
+
additionalToolbarItems,
|
|
471
|
+
toolbarVisible,
|
|
472
|
+
markdownRenderer,
|
|
473
|
+
toolbar,
|
|
474
|
+
copyButton,
|
|
475
|
+
inspectorButton,
|
|
476
|
+
thumbsUpButton,
|
|
477
|
+
thumbsDownButton,
|
|
478
|
+
readAloudButton,
|
|
479
|
+
regenerateButton,
|
|
480
|
+
feedbackComment: feedbackCommentSlot,
|
|
481
|
+
toolCallsView,
|
|
482
|
+
children,
|
|
483
|
+
className,
|
|
484
|
+
...props
|
|
485
|
+
}: CopilotChatAssistantMessageProps): react_jsx_runtime0.JSX.Element;
|
|
486
|
+
declare namespace CopilotChatAssistantMessage {
|
|
487
|
+
const MarkdownRenderer: React$1.FC<MarkdownRendererProps & DefaultMarkdownRendererProps & {
|
|
488
|
+
/** Id of the rendered message. The markdown transport finds its fences by it. */messageId?: string;
|
|
489
|
+
}>;
|
|
490
|
+
const Toolbar: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
491
|
+
const ToolbarButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
492
|
+
title: string;
|
|
493
|
+
tooltip?: React$1.ReactNode;
|
|
494
|
+
tooltipClassName?: string;
|
|
495
|
+
children: React$1.ReactNode;
|
|
496
|
+
}>;
|
|
497
|
+
const CopyButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
498
|
+
const InspectorButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
499
|
+
const ThumbsUpButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
500
|
+
const ThumbsDownButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
501
|
+
/**
|
|
502
|
+
* The comment field of a rating, shown in a popover next to the chosen
|
|
503
|
+
* thumb. Enter saves; Send appears once the text differs from the saved
|
|
504
|
+
* comment. The popover marks itself `data-copilotkit-ignore`, so Learning
|
|
505
|
+
* records the saved comment but not the typing; outside it, mark the
|
|
506
|
+
* field yourself.
|
|
507
|
+
*/
|
|
508
|
+
const FeedbackComment: React$1.FC<{
|
|
509
|
+
value: string; /** The comment already saved. */
|
|
510
|
+
savedComment: string;
|
|
511
|
+
inputRef?: React$1.Ref<HTMLInputElement>;
|
|
512
|
+
onChange: (value: string) => void;
|
|
513
|
+
onSubmit: () => void;
|
|
514
|
+
onEditingChange?: (editing: boolean) => void;
|
|
515
|
+
/**
|
|
516
|
+
* Focus left the form for `next`, or for no focusable element when null.
|
|
517
|
+
* Not called when the window loses focus.
|
|
518
|
+
*/
|
|
519
|
+
onLeave?: (next: Element | null) => void;
|
|
520
|
+
className?: string;
|
|
521
|
+
}>;
|
|
522
|
+
const ReadAloudButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
523
|
+
const RegenerateButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
524
|
+
}
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/components/chat/CopilotChatUserMessage.d.ts
|
|
527
|
+
interface CopilotChatUserMessageOnEditMessageProps {
|
|
528
|
+
message: UserMessage$1;
|
|
529
|
+
}
|
|
530
|
+
interface CopilotChatUserMessageOnSwitchToBranchProps {
|
|
531
|
+
message: UserMessage$1;
|
|
532
|
+
branchIndex: number;
|
|
533
|
+
numberOfBranches: number;
|
|
534
|
+
}
|
|
535
|
+
type CopilotChatUserMessageProps = WithSlots<{
|
|
536
|
+
messageRenderer: typeof CopilotChatUserMessage.MessageRenderer;
|
|
537
|
+
toolbar: typeof CopilotChatUserMessage.Toolbar;
|
|
538
|
+
copyButton: typeof CopilotChatUserMessage.CopyButton;
|
|
539
|
+
editButton: typeof CopilotChatUserMessage.EditButton;
|
|
540
|
+
branchNavigation: typeof CopilotChatUserMessage.BranchNavigation;
|
|
541
|
+
}, {
|
|
542
|
+
onEditMessage?: (props: CopilotChatUserMessageOnEditMessageProps) => void;
|
|
543
|
+
onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
|
|
544
|
+
message: UserMessage$1;
|
|
545
|
+
branchIndex?: number;
|
|
546
|
+
numberOfBranches?: number;
|
|
547
|
+
additionalToolbarItems?: React.ReactNode;
|
|
548
|
+
} & React.HTMLAttributes<HTMLDivElement>>;
|
|
549
|
+
declare function CopilotChatUserMessage({
|
|
550
|
+
message,
|
|
551
|
+
onEditMessage,
|
|
552
|
+
branchIndex,
|
|
553
|
+
numberOfBranches,
|
|
554
|
+
onSwitchToBranch,
|
|
555
|
+
additionalToolbarItems,
|
|
556
|
+
messageRenderer,
|
|
557
|
+
toolbar,
|
|
558
|
+
copyButton,
|
|
559
|
+
editButton,
|
|
560
|
+
branchNavigation,
|
|
561
|
+
children,
|
|
562
|
+
className,
|
|
563
|
+
...props
|
|
564
|
+
}: CopilotChatUserMessageProps): react_jsx_runtime0.JSX.Element;
|
|
565
|
+
declare namespace CopilotChatUserMessage {
|
|
566
|
+
const Container: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>>;
|
|
567
|
+
const MessageRenderer: React.FC<{
|
|
568
|
+
content: string;
|
|
569
|
+
className?: string;
|
|
570
|
+
}>;
|
|
571
|
+
const Toolbar: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
572
|
+
const ToolbarButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
573
|
+
title: string;
|
|
574
|
+
children: React.ReactNode;
|
|
575
|
+
}>;
|
|
576
|
+
const CopyButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
577
|
+
copied?: boolean;
|
|
578
|
+
}>;
|
|
579
|
+
const EditButton: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
580
|
+
/**
|
|
581
|
+
* Previous/next buttons and an "n/m" counter for switching between branches
|
|
582
|
+
* of a user message. Renders only with more than one branch and an
|
|
583
|
+
* `onSwitchToBranch` handler. The buttons are named by
|
|
584
|
+
* `labels.userMessageToolbarPreviousBranchLabel` and
|
|
585
|
+
* `labels.userMessageToolbarNextBranchLabel`.
|
|
586
|
+
*/
|
|
587
|
+
const BranchNavigation: React.FC<React.HTMLAttributes<HTMLDivElement> & {
|
|
588
|
+
currentBranch?: number;
|
|
589
|
+
numberOfBranches?: number;
|
|
590
|
+
onSwitchToBranch?: (props: CopilotChatUserMessageOnSwitchToBranchProps) => void;
|
|
591
|
+
message: UserMessage$1;
|
|
592
|
+
}>;
|
|
593
|
+
}
|
|
594
|
+
//#endregion
|
|
595
|
+
//#region src/components/chat/CopilotChatReasoningMessage.d.ts
|
|
596
|
+
type CopilotChatReasoningMessageProps = WithSlots<{
|
|
597
|
+
header: typeof CopilotChatReasoningMessage.Header;
|
|
598
|
+
contentView: typeof CopilotChatReasoningMessage.Content;
|
|
599
|
+
toggle: typeof CopilotChatReasoningMessage.Toggle;
|
|
600
|
+
}, {
|
|
601
|
+
message: ReasoningMessage$1;
|
|
602
|
+
messages?: Message$1[];
|
|
603
|
+
isRunning?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Whether this is the last message the chat renders. The message view
|
|
606
|
+
* passes it, because the rendered list can differ from `messages` when
|
|
607
|
+
* `transformMessages` drops, replaces or reorders messages. Defaults to
|
|
608
|
+
* comparing against the last entry of `messages`.
|
|
609
|
+
*/
|
|
610
|
+
isLatest?: boolean;
|
|
611
|
+
} & React.HTMLAttributes<HTMLDivElement>>;
|
|
612
|
+
/**
|
|
613
|
+
* A reasoning message as a collapsible block. While the model reasons it is
|
|
614
|
+
* open and the header shows `labels.reasoningMessageThinkingLabel`; when
|
|
615
|
+
* streaming ends it collapses and the header reads "Thought for …". The
|
|
616
|
+
* `header` slot also receives `elapsedSeconds`.
|
|
617
|
+
*/
|
|
618
|
+
declare function CopilotChatReasoningMessage({
|
|
619
|
+
message,
|
|
620
|
+
messages,
|
|
621
|
+
isRunning,
|
|
622
|
+
isLatest: isLatestProp,
|
|
623
|
+
header,
|
|
624
|
+
contentView,
|
|
625
|
+
toggle,
|
|
626
|
+
children,
|
|
627
|
+
className,
|
|
628
|
+
...props
|
|
629
|
+
}: CopilotChatReasoningMessageProps): react_jsx_runtime0.JSX.Element;
|
|
630
|
+
declare namespace CopilotChatReasoningMessage {
|
|
631
|
+
const Header: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
632
|
+
isOpen?: boolean;
|
|
633
|
+
label?: string;
|
|
634
|
+
hasContent?: boolean;
|
|
635
|
+
isStreaming?: boolean;
|
|
636
|
+
/**
|
|
637
|
+
* Seconds spent reasoning so far, updated every second while streaming.
|
|
638
|
+
* The default label formats it in English ("Thought for 12 seconds");
|
|
639
|
+
* a custom header can use it to build a localized label.
|
|
640
|
+
*/
|
|
641
|
+
elapsedSeconds?: number;
|
|
642
|
+
}>;
|
|
643
|
+
const Content: React.FC<React.HTMLAttributes<HTMLDivElement> & {
|
|
644
|
+
isStreaming?: boolean;
|
|
645
|
+
hasContent?: boolean;
|
|
646
|
+
}>;
|
|
647
|
+
const Toggle: React.FC<React.HTMLAttributes<HTMLDivElement> & {
|
|
648
|
+
isOpen?: boolean;
|
|
649
|
+
}>;
|
|
650
|
+
}
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/components/chat/CopilotChatSuggestionPill.d.ts
|
|
653
|
+
interface CopilotChatSuggestionPillProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
654
|
+
/** Optional icon to render on the left side when not loading. */
|
|
655
|
+
icon?: React$1.ReactNode;
|
|
656
|
+
/** Whether the pill should display a loading spinner. */
|
|
657
|
+
isLoading?: boolean;
|
|
658
|
+
}
|
|
659
|
+
declare const CopilotChatSuggestionPill: React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/components/chat/CopilotChatSuggestionView.d.ts
|
|
662
|
+
declare const DefaultContainer: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
663
|
+
type CopilotChatSuggestionViewProps = WithSlots<{
|
|
664
|
+
container: typeof DefaultContainer;
|
|
665
|
+
suggestion: typeof CopilotChatSuggestionPill;
|
|
666
|
+
}, {
|
|
667
|
+
suggestions: Suggestion$1[];
|
|
668
|
+
onSelectSuggestion?: (suggestion: Suggestion$1, index: number) => void;
|
|
669
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
670
|
+
} & React$1.HTMLAttributes<HTMLDivElement>>;
|
|
671
|
+
declare const CopilotChatSuggestionView: React$1.ForwardRefExoticComponent<{
|
|
672
|
+
container?: SlotValue<React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>> | undefined;
|
|
673
|
+
suggestion?: SlotValue<React$1.ForwardRefExoticComponent<CopilotChatSuggestionPillProps & React$1.RefAttributes<HTMLButtonElement>>> | undefined;
|
|
674
|
+
} & {
|
|
675
|
+
children?: ((props: {
|
|
676
|
+
container: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
677
|
+
suggestion: React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
678
|
+
} & {
|
|
679
|
+
suggestions: Suggestion$1[];
|
|
680
|
+
onSelectSuggestion?: (suggestion: Suggestion$1, index: number) => void;
|
|
681
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
682
|
+
} & React$1.HTMLAttributes<HTMLDivElement>) => React$1.ReactNode) | undefined;
|
|
683
|
+
} & Omit<{
|
|
684
|
+
suggestions: Suggestion$1[];
|
|
685
|
+
onSelectSuggestion?: (suggestion: Suggestion$1, index: number) => void;
|
|
686
|
+
loadingIndexes?: ReadonlyArray<number>;
|
|
687
|
+
} & React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
688
|
+
//#endregion
|
|
689
|
+
//#region src/components/chat/CopilotChatWorkSummary.d.ts
|
|
690
|
+
interface CopilotChatWorkSummaryProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
691
|
+
/** The agent is still working on this reply. */
|
|
692
|
+
isWorking: boolean;
|
|
693
|
+
/** Whether the work (narration and tool calls) is showing. */
|
|
694
|
+
isOpen: boolean;
|
|
695
|
+
/** The tool calls the reply made. */
|
|
696
|
+
calls: ToolCallEntry[];
|
|
697
|
+
/**
|
|
698
|
+
* How long the agent has worked on the reply, in ms, summed over its runs
|
|
699
|
+
* so time spent waiting between them doesn't count. Only known for replies
|
|
700
|
+
* this client watched start; without it the summary shows the tool count.
|
|
701
|
+
*/
|
|
702
|
+
elapsedMs?: number;
|
|
703
|
+
/** When the current run started (epoch ms), while the agent is working. */
|
|
704
|
+
workingSince?: number;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* The line at the top of a reply in the `"turn"` tool-call display. While the
|
|
708
|
+
* agent works it reads "Working 4s"; once the reply is done it reads "Worked
|
|
709
|
+
* for 9s · 7 tools" and toggles the work it folded away.
|
|
710
|
+
*/
|
|
711
|
+
declare function CopilotChatWorkSummary({
|
|
712
|
+
isWorking,
|
|
713
|
+
isOpen,
|
|
714
|
+
calls,
|
|
715
|
+
elapsedMs,
|
|
716
|
+
workingSince,
|
|
717
|
+
className,
|
|
718
|
+
...props
|
|
719
|
+
}: CopilotChatWorkSummaryProps): react_jsx_runtime0.JSX.Element;
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/components/intelligence-indicator/IntelligenceIndicatorView.d.ts
|
|
722
|
+
/** Lifecycle state the brain hands the face. */
|
|
723
|
+
type IntelligenceIndicatorStatus = "in-progress" | "finished";
|
|
724
|
+
interface IntelligenceIndicatorViewProps extends React$1.HTMLAttributes<HTMLSpanElement> {
|
|
725
|
+
/** The assistant message this indicator is attached to. */
|
|
726
|
+
message: Message$1;
|
|
727
|
+
/**
|
|
728
|
+
* Whether the intelligence work is still running (`in-progress`) or
|
|
729
|
+
* has settled (`finished`). Drives the icon morph and chrome
|
|
730
|
+
* fade-out via the `data-status` attribute on the wrapper.
|
|
731
|
+
*/
|
|
732
|
+
status: IntelligenceIndicatorStatus;
|
|
733
|
+
/** The visible label, e.g. "Using CopilotKit Intelligence". */
|
|
734
|
+
label: string;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* The presentational "CopilotKit Intelligence" face — the default
|
|
738
|
+
* rendered by the {@link IntelligenceIndicator} brain and the default
|
|
739
|
+
* value for the `intelligenceIndicator` slot.
|
|
740
|
+
*
|
|
741
|
+
* Layout: a glassmorphism pill (the `__chrome` layer) wrapping an icon
|
|
742
|
+
* and a label. The icon is two overlaid SVG paths — a spinner arc and a
|
|
743
|
+
* checkmark — whose geometry lives in each path's `d` ATTRIBUTE so it
|
|
744
|
+
* renders in every browser (the CSS `d:` property is Chrome-only).
|
|
745
|
+
*
|
|
746
|
+
* Two states, driven by the `data-status` attribute (see globals.css
|
|
747
|
+
* for the exact timing):
|
|
748
|
+
* 1. **In-progress.** The arc spins (CSS rotation) inside the pill and
|
|
749
|
+
* the checkmark is hidden. Label + icon are a saturated purple.
|
|
750
|
+
* 2. **Finished.** The arc fades out mid-spin while the checkmark draws
|
|
751
|
+
* itself in upright (animated `stroke-dashoffset`); the pill chrome
|
|
752
|
+
* fades away; and the label + icon settle from purple to a neutral
|
|
753
|
+
* gray, with the label slanting slightly (a `transform: skewX`
|
|
754
|
+
* faux-italic, so it interpolates with the color instead of snapping
|
|
755
|
+
* and never reflows). The result reads as quiet "history metadata"
|
|
756
|
+
* rather than an active spinner. The label text itself never changes
|
|
757
|
+
* — the static check plus the color/slant shift carry the "done"
|
|
758
|
+
* meaning, so no wording change is needed.
|
|
759
|
+
*
|
|
760
|
+
* All motion is gated behind `prefers-reduced-motion` (globals.css):
|
|
761
|
+
* when reduced motion is requested the arc does not spin and the two
|
|
762
|
+
* states swap instantly, without transitions.
|
|
763
|
+
*
|
|
764
|
+
* Customize via the `intelligenceIndicator` slot on `CopilotChat`:
|
|
765
|
+
* a className string restyles the wrapper, a props object tweaks
|
|
766
|
+
* the default (`{ label }`), and a component replaces it entirely
|
|
767
|
+
* with full control over visuals and timing.
|
|
768
|
+
*/
|
|
769
|
+
declare function IntelligenceIndicatorView({
|
|
770
|
+
message,
|
|
771
|
+
status,
|
|
772
|
+
label,
|
|
773
|
+
className,
|
|
774
|
+
...rest
|
|
775
|
+
}: IntelligenceIndicatorViewProps): React$1.ReactElement;
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/components/intelligence-indicator/IntelligenceIndicator.d.ts
|
|
778
|
+
interface IntelligenceIndicatorProps {
|
|
779
|
+
/** The message this indicator is attached to. */
|
|
780
|
+
message: Message$1;
|
|
781
|
+
/**
|
|
782
|
+
* Agent id whose run state the indicator tracks. Pass through from
|
|
783
|
+
* the surrounding chat configuration; mounting from
|
|
784
|
+
* `CopilotChatMessageView` resolves this automatically.
|
|
785
|
+
*/
|
|
786
|
+
agentId: string;
|
|
787
|
+
/**
|
|
788
|
+
* Optional override for the visible label. Defaults to
|
|
789
|
+
* "CopilotKit Intelligence".
|
|
790
|
+
*/
|
|
791
|
+
label?: string;
|
|
792
|
+
/**
|
|
793
|
+
* Slot override for the presentational face. A className string, a
|
|
794
|
+
* props object, or a full replacement component — see
|
|
795
|
+
* {@link IntelligenceIndicatorView}. Forwarded from the
|
|
796
|
+
* `intelligenceIndicator` slot on `CopilotChat`.
|
|
797
|
+
*/
|
|
798
|
+
intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Stable turn id for the messages that precede the first user message (a turn
|
|
802
|
+
* with no opening user message of its own). Used as the React key so the
|
|
803
|
+
* indicator for that turn never collides with a real user-message id.
|
|
804
|
+
*/
|
|
805
|
+
declare const INTELLIGENCE_TURN_HEAD = "__cpk_turn_head__";
|
|
806
|
+
/**
|
|
807
|
+
* Map each Intelligence-using turn to its anchor message — the FIRST bash-using
|
|
808
|
+
* assistant message of the turn — and a stable turn id (the id of the user
|
|
809
|
+
* message that opened the turn, or {@link INTELLIGENCE_TURN_HEAD} for the
|
|
810
|
+
* pre-first-user turn). Returns `Map<anchorMessageId, turnId>`.
|
|
811
|
+
*
|
|
812
|
+
* Anchoring to the FIRST (not last) bash-using message keeps the indicator
|
|
813
|
+
* fixed in place for the whole turn: later bash steps don't reposition it, so
|
|
814
|
+
* the spinner never abruptly jumps mid-turn (bug 1). `CopilotChatMessageView`
|
|
815
|
+
* emits exactly one `IntelligenceIndicator` per entry, keyed by the turn id and
|
|
816
|
+
* positioned at the anchor; the per-turn key also lets every past turn keep its
|
|
817
|
+
* own indicator in scroll-back.
|
|
818
|
+
*
|
|
819
|
+
* `visibleMessages` is what actually renders, when that differs from
|
|
820
|
+
* `messages` (the chat's `transformMessages`). Turns are still read from the
|
|
821
|
+
* full list, so hiding a user message does not merge its turn into the one
|
|
822
|
+
* before it, and anchors are only chosen among visible messages. A message the
|
|
823
|
+
* transform built itself joins the turn of the visible message before it.
|
|
824
|
+
*/
|
|
825
|
+
declare function getIntelligenceTurnAnchors(messages: readonly Message$1[], visibleMessages?: readonly Message$1[]): Map<string, string>;
|
|
826
|
+
/**
|
|
827
|
+
* The "Using CopilotKit Intelligence" indicator brain. Auto-mounted by
|
|
828
|
+
* `CopilotChatMessageView` — once per Intelligence-using turn, at that
|
|
829
|
+
* turn's anchor message and keyed by the turn id (see
|
|
830
|
+
* {@link getIntelligenceTurnAnchors}). Callers do not register this
|
|
831
|
+
* themselves. It owns the run subscription and the phase machine and
|
|
832
|
+
* renders its swappable face via the `intelligenceIndicator` slot.
|
|
833
|
+
*
|
|
834
|
+
* Placement (which message anchors the turn) is decided by the view, so
|
|
835
|
+
* this component does not self-gate its own placement; it only derives
|
|
836
|
+
* in-progress/finished for the turn it was mounted on.
|
|
837
|
+
*
|
|
838
|
+
* Render gates (all must hold):
|
|
839
|
+
* 1. `copilotkit.intelligence !== undefined`
|
|
840
|
+
* 2. The (anchor) message is an assistant message with at least one
|
|
841
|
+
* tool call whose name matches {@link DEFAULT_TOOL_PATTERNS}.
|
|
842
|
+
* 3. The phase machine is past `hidden`.
|
|
843
|
+
*
|
|
844
|
+
* Because the view keys each indicator by its turn id, the instance moves
|
|
845
|
+
* with the anchor across a hand-off (no remount, no spinner restart), and
|
|
846
|
+
* every prior Intelligence-using turn keeps its own persistent indicator
|
|
847
|
+
* in chat history.
|
|
848
|
+
*
|
|
849
|
+
* Phase machine (per-instance, all timers local):
|
|
850
|
+
* - Starts in `hidden`, unless the message mounts onto an
|
|
851
|
+
* already-completed turn (no pending work, agent stopped or a
|
|
852
|
+
* real follow-up already present), in which case the lazy
|
|
853
|
+
* `useState` initializer starts directly in `finished`. This is
|
|
854
|
+
* what avoids a "hidden flash" on history replay.
|
|
855
|
+
* - `hidden → spinner` once a matching tool call has been pending
|
|
856
|
+
* (no `tool`-role result with a matching `toolCallId`) for
|
|
857
|
+
* {@link PENDING_THRESHOLD_MS}. Replay flashes (tool call + result
|
|
858
|
+
* in the same tick) never cross this threshold.
|
|
859
|
+
* - `hidden → finished` if after the grace window the turn is
|
|
860
|
+
* already complete (no pending work AND
|
|
861
|
+
* `sawRealFollowup || !agent.isRunning`). Handles very fast tools
|
|
862
|
+
* whose result lands within the grace window.
|
|
863
|
+
* - `spinner → finished` as soon as EITHER `agent.isRunning` flips
|
|
864
|
+
* false OR a non-tool-call-like message appears later in
|
|
865
|
+
* `agent.messages` (i.e. the agent produced a "real" follow-up —
|
|
866
|
+
* prose answer or a new user turn).
|
|
867
|
+
* - `finished` is terminal: the indicator settles into its
|
|
868
|
+
* persistent tag form and stays mounted.
|
|
869
|
+
*/
|
|
870
|
+
declare function IntelligenceIndicator(props: IntelligenceIndicatorProps): React$1.ReactElement | null;
|
|
871
|
+
//#endregion
|
|
872
|
+
//#region src/components/chat/CopilotChatMessageView.d.ts
|
|
873
|
+
/** What the view passes the wrapper of a message group. */
|
|
874
|
+
interface MessageGroupWrapperProps<S = unknown> {
|
|
875
|
+
/** The group's key, as returned by `groupMessages`. */
|
|
876
|
+
groupKey: string;
|
|
877
|
+
/** The messages in the group, in order. */
|
|
878
|
+
messages: Message$1[];
|
|
879
|
+
/** The default rendering of the group's messages. */
|
|
880
|
+
children: React$1.ReactNode;
|
|
881
|
+
/**
|
|
882
|
+
* State the view keeps for this group, keyed by `groupKey`. It survives the
|
|
883
|
+
* row leaving the window and the wrapper remounting, is dropped once the key
|
|
884
|
+
* no longer appears, and is cleared when the thread changes. `undefined`
|
|
885
|
+
* until first set.
|
|
886
|
+
*/
|
|
887
|
+
state: S | undefined;
|
|
888
|
+
setState: (next: S) => void;
|
|
889
|
+
}
|
|
890
|
+
/** Several messages rendered as one row, inside an app-provided wrapper. */
|
|
891
|
+
interface MessageGroup<S = unknown> {
|
|
892
|
+
type: "group";
|
|
893
|
+
/**
|
|
894
|
+
* Identifies the group across renders: its React key and the key its state
|
|
895
|
+
* is held under. Keep it stable while the thread streams, e.g. the id of the
|
|
896
|
+
* group's first message.
|
|
897
|
+
*/
|
|
898
|
+
key: string;
|
|
899
|
+
messages: Message$1[];
|
|
900
|
+
/**
|
|
901
|
+
* Define it once at module level. A component created inside
|
|
902
|
+
* `groupMessages` is a new type on every call and remounts each time.
|
|
903
|
+
*/
|
|
904
|
+
wrapper: React$1.ComponentType<MessageGroupWrapperProps<S>>;
|
|
905
|
+
}
|
|
906
|
+
/** One row of the message list: a single message, or a group of them. */
|
|
907
|
+
type MessageRow = {
|
|
908
|
+
type: "message";
|
|
909
|
+
message: Message$1;
|
|
910
|
+
} | MessageGroup;
|
|
911
|
+
/** A row holding a single message, rendered as it would be ungrouped. */
|
|
912
|
+
declare function messageRow(message: Message$1): MessageRow;
|
|
913
|
+
/** A row holding a group of messages, rendered inside `wrapper`. */
|
|
914
|
+
declare function messageGroup<S>(group: Omit<MessageGroup<S>, "type">): MessageRow;
|
|
915
|
+
type CopilotChatMessageViewProps = Omit<WithSlots<{
|
|
916
|
+
assistantMessage: typeof CopilotChatAssistantMessage;
|
|
917
|
+
userMessage: typeof CopilotChatUserMessage;
|
|
918
|
+
reasoningMessage: typeof CopilotChatReasoningMessage;
|
|
919
|
+
cursor: typeof CopilotChatMessageView.Cursor;
|
|
920
|
+
intelligenceIndicator: typeof IntelligenceIndicatorView; /** The "Working… / Worked for 9s" line of the `"turn"` tool-call display. */
|
|
921
|
+
workSummary: typeof CopilotChatWorkSummary;
|
|
922
|
+
}, {
|
|
923
|
+
isRunning?: boolean;
|
|
924
|
+
messages?: Message$1[];
|
|
925
|
+
/**
|
|
926
|
+
* Reshapes the message list before it renders: drop, replace or reorder
|
|
927
|
+
* messages with the whole list in view. Receives the list after duplicate
|
|
928
|
+
* ids are merged. Row keys, virtualization and rendering all work off
|
|
929
|
+
* the returned list, so a dropped message takes no row.
|
|
930
|
+
*
|
|
931
|
+
* Tool-call cards still look up their results in the full list, so
|
|
932
|
+
* hiding tool-result messages here does not strip results from them.
|
|
933
|
+
*
|
|
934
|
+
* Memoized on the input list and this function — pass a stable function
|
|
935
|
+
* (e.g. `useCallback`) or it reruns on every render.
|
|
936
|
+
*/
|
|
937
|
+
transformMessages?: (messages: Message$1[]) => Message$1[];
|
|
938
|
+
/**
|
|
939
|
+
* Splits the message list into rows. Return `messageRow(message)` for a
|
|
940
|
+
* message that renders on its own, and `messageGroup({ key, messages,
|
|
941
|
+
* wrapper })` for messages that render together inside `wrapper` — a
|
|
942
|
+
* collapsible block of tool calls, say. Receives the list after
|
|
943
|
+
* `transformMessages`. Each row is one virtualized row.
|
|
944
|
+
*
|
|
945
|
+
* Return each message in at most one row. Tool-call cards still find
|
|
946
|
+
* their results in the full list.
|
|
947
|
+
*
|
|
948
|
+
* Memoized on its input and this function — pass a stable function.
|
|
949
|
+
*/
|
|
950
|
+
groupMessages?: (messages: Message$1[]) => MessageRow[];
|
|
951
|
+
/**
|
|
952
|
+
* Whether reply thumbs record ratings for Automatic Learning once a
|
|
953
|
+
* Trajectory has started. Defaults to `true`; set `false` to keep the
|
|
954
|
+
* thumbs to your own `onThumbsUp` / `onThumbsDown` handlers and slots.
|
|
955
|
+
*/
|
|
956
|
+
messageFeedback?: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* How tool calls show. Defaults to `"grouped"`: calls made in a row
|
|
959
|
+
* share one card that opens to a row per call. `"line"` and `"stacked"`
|
|
960
|
+
* group them too; `"turn"` folds a reply's whole working phase into
|
|
961
|
+
* "Worked for 9s" once it's done; `"separate"` gives every call its own
|
|
962
|
+
* card. Calls with a renderer of their own always show on their own.
|
|
963
|
+
*/
|
|
964
|
+
toolCallDisplay?: CopilotChatToolCallDisplay;
|
|
965
|
+
} & React$1.HTMLAttributes<HTMLDivElement>>, "children"> & {
|
|
966
|
+
children?: (props: {
|
|
967
|
+
isRunning: boolean;
|
|
968
|
+
messages: Message$1[];
|
|
969
|
+
messageElements: React$1.ReactElement[];
|
|
970
|
+
interruptElement: React$1.ReactElement | null;
|
|
971
|
+
}) => React$1.ReactElement;
|
|
972
|
+
};
|
|
973
|
+
declare function CopilotChatMessageView({
|
|
974
|
+
messages,
|
|
975
|
+
assistantMessage,
|
|
976
|
+
userMessage,
|
|
977
|
+
reasoningMessage,
|
|
978
|
+
cursor,
|
|
979
|
+
intelligenceIndicator,
|
|
980
|
+
workSummary,
|
|
981
|
+
isRunning,
|
|
982
|
+
transformMessages,
|
|
983
|
+
groupMessages,
|
|
984
|
+
messageFeedback,
|
|
985
|
+
toolCallDisplay,
|
|
986
|
+
children,
|
|
987
|
+
className,
|
|
988
|
+
...props
|
|
989
|
+
}: CopilotChatMessageViewProps): react_jsx_runtime0.JSX.Element;
|
|
990
|
+
declare namespace CopilotChatMessageView {
|
|
991
|
+
var Cursor: ({
|
|
992
|
+
className,
|
|
993
|
+
...props
|
|
994
|
+
}: React$1.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime0.JSX.Element;
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/components/chat/normalize-auto-scroll.d.ts
|
|
998
|
+
type AutoScrollMode = "pin-to-bottom" | "pin-to-send" | "none";
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/components/chat/CopilotChatView.d.ts
|
|
1001
|
+
type WelcomeScreenProps = WithSlots<{
|
|
1002
|
+
welcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
1003
|
+
}, {
|
|
1004
|
+
input: React$1.ReactElement;
|
|
1005
|
+
suggestionView: React$1.ReactElement;
|
|
1006
|
+
} & React$1.HTMLAttributes<HTMLDivElement>>;
|
|
1007
|
+
type CopilotChatViewProps = WithSlots<{
|
|
1008
|
+
messageView: typeof CopilotChatMessageView;
|
|
1009
|
+
scrollView: typeof CopilotChatView.ScrollView;
|
|
1010
|
+
input: React$1.ComponentType<CopilotChatInputProps>;
|
|
1011
|
+
suggestionView: typeof CopilotChatSuggestionView;
|
|
1012
|
+
}, {
|
|
1013
|
+
messages?: Message$1[];
|
|
1014
|
+
autoScroll?: AutoScrollMode | boolean;
|
|
1015
|
+
isRunning?: boolean;
|
|
1016
|
+
suggestions?: Suggestion$1[];
|
|
1017
|
+
suggestionLoadingIndexes?: ReadonlyArray<number>;
|
|
1018
|
+
onSelectSuggestion?: (suggestion: Suggestion$1, index: number) => void;
|
|
1019
|
+
welcomeScreen?: SlotValue<React$1.FC<WelcomeScreenProps>> | boolean;
|
|
1020
|
+
onSubmitMessage?: (value: string) => void;
|
|
1021
|
+
onStop?: () => void;
|
|
1022
|
+
inputMode?: CopilotChatInputMode;
|
|
1023
|
+
inputValue?: string;
|
|
1024
|
+
onInputChange?: (value: string) => void;
|
|
1025
|
+
onStartTranscribe?: () => void;
|
|
1026
|
+
onCancelTranscribe?: () => void;
|
|
1027
|
+
onFinishTranscribe?: () => void;
|
|
1028
|
+
onFinishTranscribeWithAudio?: (audioBlob: Blob) => Promise<void>;
|
|
1029
|
+
attachments?: Attachment$1[];
|
|
1030
|
+
onRemoveAttachment?: (id: string) => void;
|
|
1031
|
+
onAddFile?: () => void;
|
|
1032
|
+
dragOver?: boolean;
|
|
1033
|
+
onDragOver?: (e: React$1.DragEvent) => void;
|
|
1034
|
+
onDragLeave?: (e: React$1.DragEvent) => void;
|
|
1035
|
+
onDrop?: (e: React$1.DragEvent) => void;
|
|
1036
|
+
/**
|
|
1037
|
+
* When `true`, suppresses the welcome screen while a thread's initial
|
|
1038
|
+
* connect is in flight. Prevents the "How can I help you today?" flash
|
|
1039
|
+
* that would otherwise appear between mounting an empty agent instance
|
|
1040
|
+
* and the bootstrap messages arriving from /connect.
|
|
1041
|
+
*/
|
|
1042
|
+
isConnecting?: boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* When `true`, the caller has explicitly picked a thread (via `threadId`
|
|
1045
|
+
* prop or `CopilotChatConfigurationProvider`). Suppresses the welcome
|
|
1046
|
+
* screen unconditionally — a caller-managed thread targets a specific
|
|
1047
|
+
* conversation and should render its messages (or an empty panel during
|
|
1048
|
+
* connect) rather than a generic "start a new chat" greeting.
|
|
1049
|
+
*/
|
|
1050
|
+
hasExplicitThreadId?: boolean;
|
|
1051
|
+
/**
|
|
1052
|
+
* @deprecated Use the `input` slot's `disclaimer` prop instead:
|
|
1053
|
+
* ```tsx
|
|
1054
|
+
* <CopilotChat input={{ disclaimer: MyDisclaimer }} />
|
|
1055
|
+
* ```
|
|
1056
|
+
*/
|
|
1057
|
+
disclaimer?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Slot for the "Using CopilotKit Intelligence" indicator. Pass-through
|
|
1060
|
+
* to `CopilotChatMessageView`'s `intelligenceIndicator` slot — accepts a
|
|
1061
|
+
* className string, a props object, or a replacement component.
|
|
1062
|
+
*/
|
|
1063
|
+
intelligenceIndicator?: SlotValue<typeof IntelligenceIndicatorView>;
|
|
1064
|
+
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "inputMode">>;
|
|
1065
|
+
declare function CopilotChatView({
|
|
1066
|
+
messageView,
|
|
1067
|
+
input,
|
|
1068
|
+
scrollView,
|
|
1069
|
+
suggestionView,
|
|
1070
|
+
welcomeScreen,
|
|
1071
|
+
messages,
|
|
1072
|
+
autoScroll,
|
|
1073
|
+
isRunning,
|
|
1074
|
+
suggestions,
|
|
1075
|
+
suggestionLoadingIndexes,
|
|
1076
|
+
onSelectSuggestion,
|
|
1077
|
+
onSubmitMessage,
|
|
1078
|
+
onStop,
|
|
1079
|
+
inputMode,
|
|
1080
|
+
inputValue,
|
|
1081
|
+
onInputChange,
|
|
1082
|
+
onStartTranscribe,
|
|
1083
|
+
onCancelTranscribe,
|
|
1084
|
+
onFinishTranscribe,
|
|
1085
|
+
onFinishTranscribeWithAudio,
|
|
1086
|
+
attachments,
|
|
1087
|
+
onRemoveAttachment,
|
|
1088
|
+
onAddFile,
|
|
1089
|
+
dragOver,
|
|
1090
|
+
onDragOver,
|
|
1091
|
+
onDragLeave,
|
|
1092
|
+
onDrop,
|
|
1093
|
+
isConnecting,
|
|
1094
|
+
hasExplicitThreadId,
|
|
1095
|
+
disclaimer,
|
|
1096
|
+
intelligenceIndicator,
|
|
1097
|
+
children,
|
|
1098
|
+
className,
|
|
1099
|
+
...props
|
|
1100
|
+
}: CopilotChatViewProps): react_jsx_runtime0.JSX.Element;
|
|
1101
|
+
declare namespace CopilotChatView {
|
|
1102
|
+
const ScrollView: React$1.FC<React$1.HTMLAttributes<HTMLDivElement> & {
|
|
1103
|
+
autoScroll?: AutoScrollMode | boolean;
|
|
1104
|
+
scrollThreadId?: string;
|
|
1105
|
+
scrollToBottomButton?: SlotValue<React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
1106
|
+
feather?: SlotValue<React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>>;
|
|
1107
|
+
inputContainerHeight?: number;
|
|
1108
|
+
isResizing?: boolean;
|
|
1109
|
+
}>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Scrolls the message list to the latest message. Shown while the user is
|
|
1112
|
+
* scrolled up; its accessible name is `labels.chatScrollToBottomLabel`.
|
|
1113
|
+
*/
|
|
1114
|
+
const ScrollToBottomButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
1115
|
+
const Feather: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
1116
|
+
const WelcomeMessage: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
1117
|
+
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
|
|
1118
|
+
}
|
|
1119
|
+
//#endregion
|
|
1120
|
+
//#region src/components/chat/CopilotChat.d.ts
|
|
1121
|
+
type CopilotChatProps = Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "onSelectSuggestion" | "attachments" | "onRemoveAttachment" | "onAddFile" | "dragOver" | "onDragOver" | "onDragLeave" | "onDrop"> & {
|
|
1122
|
+
agentId?: string;
|
|
1123
|
+
threadId?: string;
|
|
1124
|
+
labels?: Partial<CopilotChatLabels>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Enable Inspector message shortcuts for this chat (enabled by default).
|
|
1127
|
+
* An explicit CopilotKit provider enableInspector value takes priority.
|
|
1128
|
+
* Shortcuts only appear in local development while Inspector is visible.
|
|
1129
|
+
*/
|
|
1130
|
+
inspectorTools?: boolean; /** Accepts a className, partial props, or any component with CopilotChatView props — static namespace members are not required. */
|
|
1131
|
+
chatView?: SlotValue<React$1.ComponentType<CopilotChatViewProps>>;
|
|
1132
|
+
isModalDefaultOpen?: boolean; /** Enable multimodal file attachments (images, audio, video, documents). */
|
|
1133
|
+
attachments?: AttachmentsConfig$1;
|
|
1134
|
+
/**
|
|
1135
|
+
* Error handler scoped to this chat's agent. Fires in addition to the
|
|
1136
|
+
* provider-level onError (does not suppress it). Receives only errors
|
|
1137
|
+
* whose context.agentId matches this chat's agent.
|
|
1138
|
+
*/
|
|
1139
|
+
onError?: (event: {
|
|
1140
|
+
error: Error;
|
|
1141
|
+
code: CopilotKitCoreErrorCode$1;
|
|
1142
|
+
context: Record<string, any>;
|
|
1143
|
+
}) => void | Promise<void>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Throttle interval (in milliseconds) for re-renders triggered by message
|
|
1146
|
+
* change notifications. Overrides the provider-level `defaultThrottleMs`
|
|
1147
|
+
* for this chat instance. Forwarded to the internal `useAgent()` hook,
|
|
1148
|
+
* which resolves the effective throttle value.
|
|
1149
|
+
*
|
|
1150
|
+
* @default undefined — inherits from provider `defaultThrottleMs`;
|
|
1151
|
+
* if that is also unset, re-renders are unthrottled. Note: passing
|
|
1152
|
+
* `throttleMs={0}` explicitly disables throttling for this instance
|
|
1153
|
+
* even when the provider specifies a non-zero `defaultThrottleMs`.
|
|
1154
|
+
*/
|
|
1155
|
+
throttleMs?: number;
|
|
1156
|
+
/**
|
|
1157
|
+
* Experimental. Wrapper for generative UI surfaces rendered in this chat.
|
|
1158
|
+
* Receives `{ surfaceId, isStreaming, error, children }`.
|
|
1159
|
+
*/
|
|
1160
|
+
generativeUISurface?: React$1.ComponentType<GenerativeUIChatSurfaceProps>;
|
|
1161
|
+
};
|
|
1162
|
+
declare function CopilotChat({
|
|
1163
|
+
agentId,
|
|
1164
|
+
threadId,
|
|
1165
|
+
labels,
|
|
1166
|
+
inspectorTools,
|
|
1167
|
+
chatView,
|
|
1168
|
+
isModalDefaultOpen,
|
|
1169
|
+
attachments: attachmentsConfig,
|
|
1170
|
+
onError,
|
|
1171
|
+
throttleMs,
|
|
1172
|
+
generativeUISurface,
|
|
1173
|
+
...props
|
|
1174
|
+
}: CopilotChatProps): react_jsx_runtime0.JSX.Element;
|
|
1175
|
+
declare namespace CopilotChat {
|
|
1176
|
+
const View: typeof CopilotChatView;
|
|
1177
|
+
}
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region src/components/chat/CopilotChatToggleButton.d.ts
|
|
1180
|
+
declare const DefaultOpenIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
|
|
1181
|
+
declare const DefaultCloseIcon: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
|
|
1182
|
+
interface CopilotChatToggleButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
1183
|
+
/** Optional slot override for the chat (closed) icon. */
|
|
1184
|
+
openIcon?: SlotValue<typeof DefaultOpenIcon>;
|
|
1185
|
+
/** Optional slot override for the close icon. */
|
|
1186
|
+
closeIcon?: SlotValue<typeof DefaultCloseIcon>;
|
|
1187
|
+
}
|
|
1188
|
+
declare const CopilotChatToggleButton: React$1.ForwardRefExoticComponent<CopilotChatToggleButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
1189
|
+
//#endregion
|
|
1190
|
+
//#region src/components/chat/CopilotModalHeader.d.ts
|
|
1191
|
+
type HeaderSlots = {
|
|
1192
|
+
titleContent: typeof CopilotModalHeader.Title;
|
|
1193
|
+
closeButton: typeof CopilotModalHeader.CloseButton;
|
|
1194
|
+
drawerLauncher: typeof CopilotModalHeader.DrawerLauncher;
|
|
1195
|
+
};
|
|
1196
|
+
type HeaderRestProps = {
|
|
1197
|
+
title?: string;
|
|
1198
|
+
} & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children">;
|
|
1199
|
+
/**
|
|
1200
|
+
* Payload handed to the optional `children` render function. `drawerLauncher`
|
|
1201
|
+
* is nullable because the launcher is rendered only when a drawer has
|
|
1202
|
+
* registered — when none is present, custom layouts receive `null` and can omit
|
|
1203
|
+
* the launcher slot entirely.
|
|
1204
|
+
*/
|
|
1205
|
+
type HeaderChildrenPayload = {
|
|
1206
|
+
titleContent: React$1.ReactElement;
|
|
1207
|
+
closeButton: React$1.ReactElement;
|
|
1208
|
+
drawerLauncher: React$1.ReactElement | null;
|
|
1209
|
+
title?: string;
|
|
1210
|
+
} & Omit<HeaderRestProps, "title">;
|
|
1211
|
+
type CopilotModalHeaderProps = Omit<WithSlots<HeaderSlots, HeaderRestProps>, "children"> & {
|
|
1212
|
+
children?: (props: HeaderChildrenPayload) => React$1.ReactNode;
|
|
1213
|
+
};
|
|
1214
|
+
declare function CopilotModalHeader({
|
|
1215
|
+
title,
|
|
1216
|
+
titleContent,
|
|
1217
|
+
closeButton,
|
|
1218
|
+
drawerLauncher,
|
|
1219
|
+
children,
|
|
1220
|
+
className,
|
|
1221
|
+
...rest
|
|
1222
|
+
}: CopilotModalHeaderProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null | undefined;
|
|
1223
|
+
declare namespace CopilotModalHeader {
|
|
1224
|
+
var displayName: string;
|
|
1225
|
+
}
|
|
1226
|
+
declare namespace CopilotModalHeader {
|
|
1227
|
+
const Title: React$1.FC<React$1.HTMLAttributes<HTMLDivElement>>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Closes the popup or sidebar. Its accessible name is
|
|
1230
|
+
* `labels.modalHeaderCloseButtonLabel`.
|
|
1231
|
+
*/
|
|
1232
|
+
const CloseButton: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
1233
|
+
/**
|
|
1234
|
+
* The thread-list launcher button. Rendered in the header ONLY when a
|
|
1235
|
+
* `<CopilotThreadsDrawer>` wrapper has registered with the chat configuration; it
|
|
1236
|
+
* toggles the drawer open state. The stable `data-testid` is the focus-return
|
|
1237
|
+
* target for the drawer wrapper on cancel/back/backdrop/Escape.
|
|
1238
|
+
*/
|
|
1239
|
+
const DrawerLauncher: React$1.FC<React$1.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
1240
|
+
}
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/components/chat/CopilotSidebarView.d.ts
|
|
1243
|
+
type CopilotSidebarViewProps = CopilotChatViewProps & {
|
|
1244
|
+
/** Accepts a className, partial props, or any component with CopilotModalHeader props — static namespace members are not required. */header?: SlotValue<React$1.ComponentType<CopilotModalHeaderProps>>;
|
|
1245
|
+
toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
|
|
1246
|
+
width?: number | string;
|
|
1247
|
+
defaultOpen?: boolean;
|
|
1248
|
+
position?: "left" | "right";
|
|
1249
|
+
};
|
|
1250
|
+
/**
|
|
1251
|
+
* The chat in a side panel: a `complementary` region named by
|
|
1252
|
+
* `labels.sidebarLabel`, with a header, the chat view and a toggle button.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function CopilotSidebarView({
|
|
1255
|
+
header,
|
|
1256
|
+
toggleButton,
|
|
1257
|
+
width,
|
|
1258
|
+
defaultOpen,
|
|
1259
|
+
position,
|
|
1260
|
+
...props
|
|
1261
|
+
}: CopilotSidebarViewProps): react_jsx_runtime0.JSX.Element;
|
|
1262
|
+
declare namespace CopilotSidebarView {
|
|
1263
|
+
var displayName: string;
|
|
1264
|
+
}
|
|
1265
|
+
declare namespace CopilotSidebarView {
|
|
1266
|
+
/**
|
|
1267
|
+
* Sidebar-specific welcome screen layout:
|
|
1268
|
+
* - Suggestions at the top
|
|
1269
|
+
* - Welcome message in the middle
|
|
1270
|
+
* - Input fixed at the bottom (like normal chat)
|
|
1271
|
+
*/
|
|
1272
|
+
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
|
|
1273
|
+
}
|
|
1274
|
+
//#endregion
|
|
1275
|
+
//#region src/components/chat/CopilotPopupView.d.ts
|
|
1276
|
+
type CopilotPopupViewProps = CopilotChatViewProps & {
|
|
1277
|
+
/** Accepts a className, partial props, or any component with CopilotModalHeader props — static namespace members are not required. */header?: SlotValue<React$1.ComponentType<CopilotModalHeaderProps>>;
|
|
1278
|
+
toggleButton?: SlotValue<typeof CopilotChatToggleButton>;
|
|
1279
|
+
width?: number | string;
|
|
1280
|
+
height?: number | string;
|
|
1281
|
+
clickOutsideToClose?: boolean;
|
|
1282
|
+
defaultOpen?: boolean;
|
|
1283
|
+
};
|
|
1284
|
+
declare function CopilotPopupView({
|
|
1285
|
+
header,
|
|
1286
|
+
toggleButton,
|
|
1287
|
+
width,
|
|
1288
|
+
height,
|
|
1289
|
+
clickOutsideToClose,
|
|
1290
|
+
defaultOpen,
|
|
1291
|
+
className,
|
|
1292
|
+
...restProps
|
|
1293
|
+
}: CopilotPopupViewProps): react_jsx_runtime0.JSX.Element;
|
|
1294
|
+
declare namespace CopilotPopupView {
|
|
1295
|
+
var displayName: string;
|
|
1296
|
+
}
|
|
1297
|
+
declare namespace CopilotPopupView {
|
|
1298
|
+
/**
|
|
1299
|
+
* Popup-specific welcome screen layout:
|
|
1300
|
+
* - Welcome message centered vertically
|
|
1301
|
+
* - Suggestions just above input
|
|
1302
|
+
* - Input fixed at the bottom
|
|
1303
|
+
*/
|
|
1304
|
+
const WelcomeScreen: React$1.FC<WelcomeScreenProps>;
|
|
1305
|
+
}
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/components/chat/CopilotSidebar.d.ts
|
|
1308
|
+
type CopilotSidebarProps = Omit<CopilotChatProps, "chatView"> & {
|
|
1309
|
+
header?: CopilotSidebarViewProps["header"];
|
|
1310
|
+
toggleButton?: CopilotSidebarViewProps["toggleButton"];
|
|
1311
|
+
defaultOpen?: boolean;
|
|
1312
|
+
/**
|
|
1313
|
+
* Controlled open state. When supplied, the host owns whether the sidebar is
|
|
1314
|
+
* open: the sidebar renders this value and never changes it on its own.
|
|
1315
|
+
* Pair it with `onOpenChange` to react to the toggle button. Omit it (and use
|
|
1316
|
+
* `defaultOpen`) to let the sidebar manage its own state.
|
|
1317
|
+
*/
|
|
1318
|
+
open?: boolean;
|
|
1319
|
+
/**
|
|
1320
|
+
* Called with the requested state whenever the sidebar asks to open or close
|
|
1321
|
+
* (the toggle button, or the thread drawer on mobile). In controlled mode
|
|
1322
|
+
* nothing moves until the host updates `open`.
|
|
1323
|
+
*/
|
|
1324
|
+
onOpenChange?: (open: boolean) => void;
|
|
1325
|
+
width?: number | string;
|
|
1326
|
+
position?: CopilotSidebarViewProps["position"];
|
|
1327
|
+
};
|
|
1328
|
+
declare function CopilotSidebar({
|
|
1329
|
+
header,
|
|
1330
|
+
toggleButton,
|
|
1331
|
+
defaultOpen,
|
|
1332
|
+
open,
|
|
1333
|
+
onOpenChange,
|
|
1334
|
+
width,
|
|
1335
|
+
position,
|
|
1336
|
+
...chatProps
|
|
1337
|
+
}: CopilotSidebarProps): react_jsx_runtime0.JSX.Element;
|
|
1338
|
+
declare namespace CopilotSidebar {
|
|
1339
|
+
var displayName: string;
|
|
1340
|
+
}
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region src/components/chat/CopilotPopup.d.ts
|
|
1343
|
+
type CopilotPopupProps = Omit<CopilotChatProps, "chatView"> & {
|
|
1344
|
+
header?: CopilotPopupViewProps["header"];
|
|
1345
|
+
toggleButton?: CopilotPopupViewProps["toggleButton"];
|
|
1346
|
+
defaultOpen?: boolean;
|
|
1347
|
+
/**
|
|
1348
|
+
* Controlled open state. When supplied, the host owns whether the popup is
|
|
1349
|
+
* open: the popup renders this value and never changes it on its own. Pair it
|
|
1350
|
+
* with `onOpenChange` to react to the toggle button and to click-outside.
|
|
1351
|
+
* Omit it (and use `defaultOpen`) to let the popup manage its own state.
|
|
1352
|
+
*/
|
|
1353
|
+
open?: boolean;
|
|
1354
|
+
/**
|
|
1355
|
+
* Called with the requested state whenever the popup asks to open or close
|
|
1356
|
+
* (the toggle button, click-outside, or the thread drawer on mobile). In
|
|
1357
|
+
* controlled mode nothing moves until the host updates `open`.
|
|
1358
|
+
*/
|
|
1359
|
+
onOpenChange?: (open: boolean) => void;
|
|
1360
|
+
width?: CopilotPopupViewProps["width"];
|
|
1361
|
+
height?: CopilotPopupViewProps["height"];
|
|
1362
|
+
clickOutsideToClose?: CopilotPopupViewProps["clickOutsideToClose"];
|
|
1363
|
+
};
|
|
1364
|
+
declare function CopilotPopup({
|
|
1365
|
+
header,
|
|
1366
|
+
toggleButton,
|
|
1367
|
+
defaultOpen,
|
|
1368
|
+
open,
|
|
1369
|
+
onOpenChange,
|
|
1370
|
+
width,
|
|
1371
|
+
height,
|
|
1372
|
+
clickOutsideToClose,
|
|
1373
|
+
...chatProps
|
|
1374
|
+
}: CopilotPopupProps): react_jsx_runtime0.JSX.Element;
|
|
1375
|
+
declare namespace CopilotPopup {
|
|
1376
|
+
var displayName: string;
|
|
1377
|
+
}
|
|
1378
|
+
//#endregion
|
|
1379
|
+
//#region src/hooks/use-threads.d.ts
|
|
1380
|
+
/**
|
|
1381
|
+
* A conversation thread managed by CopilotKit Intelligence.
|
|
1382
|
+
*
|
|
1383
|
+
* Each thread has a unique `id`, an optional human-readable `name`, and
|
|
1384
|
+
* timestamp fields tracking creation and update times.
|
|
1385
|
+
*/
|
|
1386
|
+
interface Thread {
|
|
1387
|
+
id: string;
|
|
1388
|
+
agentId: string;
|
|
1389
|
+
name: string | null;
|
|
1390
|
+
archived: boolean;
|
|
1391
|
+
createdAt: string;
|
|
1392
|
+
updatedAt: string;
|
|
1393
|
+
/**
|
|
1394
|
+
* ISO-8601 timestamp of the most recent agent run on this thread. Absent
|
|
1395
|
+
* when the thread has never been run. Prefer this over `updatedAt` for
|
|
1396
|
+
* user-facing "last activity" displays — it is not bumped by metadata-only
|
|
1397
|
+
* actions like rename or archive.
|
|
1398
|
+
*/
|
|
1399
|
+
lastRunAt?: string;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Configuration for the {@link useThreads} hook.
|
|
1403
|
+
*
|
|
1404
|
+
* Thread operations are scoped to the runtime-authenticated user and the
|
|
1405
|
+
* provided agent on CopilotKit Intelligence.
|
|
1406
|
+
*/
|
|
1407
|
+
interface UseThreadsInput {
|
|
1408
|
+
/** The ID of the agent whose threads to list and manage. */
|
|
1409
|
+
agentId: string;
|
|
1410
|
+
/** When `true`, archived threads are included in the list. Defaults to `false`. */
|
|
1411
|
+
includeArchived?: boolean;
|
|
1412
|
+
/** Maximum number of threads to fetch per page. When set, enables cursor-based pagination. */
|
|
1413
|
+
limit?: number;
|
|
1414
|
+
/**
|
|
1415
|
+
* When `false`, the hook stays inert: no runtime context is dispatched, so
|
|
1416
|
+
* NO thread-list fetch or realtime subscription is issued. Used by gated
|
|
1417
|
+
* surfaces (e.g. an unlicensed `<CopilotThreadsDrawer>`) that must not touch the
|
|
1418
|
+
* network until the gate opens. Defaults to `true`.
|
|
1419
|
+
*
|
|
1420
|
+
* Flipping `enabled` back to `true` resumes normal fetching on the next
|
|
1421
|
+
* effect run; mutations are likewise short-circuited while disabled.
|
|
1422
|
+
*/
|
|
1423
|
+
enabled?: boolean;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Return value of the {@link useThreads} hook.
|
|
1427
|
+
*
|
|
1428
|
+
* The `threads` array is kept in sync with the platform via a realtime
|
|
1429
|
+
* WebSocket subscription (when available) and is sorted most-recently-updated
|
|
1430
|
+
* first. Mutations reject with an `Error` if the platform request fails.
|
|
1431
|
+
*/
|
|
1432
|
+
interface UseThreadsResult {
|
|
1433
|
+
/**
|
|
1434
|
+
* Threads for the current user/agent pair, sorted by most recently
|
|
1435
|
+
* updated first. Updated in realtime when the platform pushes metadata
|
|
1436
|
+
* events. Includes archived threads only when `includeArchived` is set.
|
|
1437
|
+
*/
|
|
1438
|
+
threads: Thread[];
|
|
1439
|
+
/**
|
|
1440
|
+
* `true` while the initial thread list is being fetched from the platform.
|
|
1441
|
+
* Subsequent realtime updates do not re-enter the loading state.
|
|
1442
|
+
*/
|
|
1443
|
+
isLoading: boolean;
|
|
1444
|
+
/**
|
|
1445
|
+
* The most recent error from fetching threads or executing a mutation,
|
|
1446
|
+
* or `null` when there is no error. Reset to `null` on the next
|
|
1447
|
+
* successful fetch.
|
|
1448
|
+
*
|
|
1449
|
+
* This channel folds together developer/config errors (missing runtime URL,
|
|
1450
|
+
* runtime without thread endpoints) and genuine list-load/mutation failures.
|
|
1451
|
+
* End-user surfaces that must not leak config errors should prefer
|
|
1452
|
+
* {@link listError}, which excludes the config/runtime-setup errors.
|
|
1453
|
+
*/
|
|
1454
|
+
error: Error | null;
|
|
1455
|
+
/**
|
|
1456
|
+
* The most recent genuine list-load or mutation error from the platform, or
|
|
1457
|
+
* `null`. Unlike {@link error}, this EXCLUDES developer/config errors (a
|
|
1458
|
+
* missing runtime URL, or a runtime that does not advertise thread
|
|
1459
|
+
* endpoints), so an end-user surface can render it directly without leaking
|
|
1460
|
+
* a developer-facing configuration message into the UI.
|
|
1461
|
+
*/
|
|
1462
|
+
listError: Error | null;
|
|
1463
|
+
/**
|
|
1464
|
+
* The error from the most recent FAILED next-page (fetch-more) load, or
|
|
1465
|
+
* `null`. Tracked separately from {@link listError} so a paginated-load
|
|
1466
|
+
* failure surfaces an inline "couldn't load more" affordance while the
|
|
1467
|
+
* already-loaded list stays visible. Cleared when a fetch-more is retried or
|
|
1468
|
+
* succeeds.
|
|
1469
|
+
*/
|
|
1470
|
+
fetchMoreError: Error | null;
|
|
1471
|
+
/**
|
|
1472
|
+
* `true` when there are more threads available to fetch via
|
|
1473
|
+
* {@link fetchMoreThreads}. Only meaningful when `limit` is set.
|
|
1474
|
+
*/
|
|
1475
|
+
hasMoreThreads: boolean;
|
|
1476
|
+
/**
|
|
1477
|
+
* `true` while a subsequent page of threads is being fetched.
|
|
1478
|
+
*/
|
|
1479
|
+
isFetchingMoreThreads: boolean;
|
|
1480
|
+
/**
|
|
1481
|
+
* `true` while at least one thread mutation (rename, archive, unarchive,
|
|
1482
|
+
* delete) is awaiting a server response. Mutations apply optimistically, so
|
|
1483
|
+
* this is primarily useful for disabling controls or showing a subtle
|
|
1484
|
+
* in-flight indicator.
|
|
1485
|
+
*/
|
|
1486
|
+
isMutating: boolean;
|
|
1487
|
+
/**
|
|
1488
|
+
* Fetch the next page of threads. No-op when {@link hasMoreThreads} is
|
|
1489
|
+
* `false` or a fetch is already in progress.
|
|
1490
|
+
*/
|
|
1491
|
+
fetchMoreThreads: () => void;
|
|
1492
|
+
/**
|
|
1493
|
+
* Re-fetch the thread list from the platform without clearing the current
|
|
1494
|
+
* list. Backs the drawer's error-state Retry and the Active/All filter
|
|
1495
|
+
* refetch. No-op until the runtime is connected.
|
|
1496
|
+
*/
|
|
1497
|
+
refetchThreads: () => void;
|
|
1498
|
+
/**
|
|
1499
|
+
* Reset to a fresh, non-explicit client-side thread so the welcome screen
|
|
1500
|
+
* shows. Lazy creation: no row appears in {@link threads} until the new
|
|
1501
|
+
* thread's first run persists server-side.
|
|
1502
|
+
*/
|
|
1503
|
+
startNewThread: () => void;
|
|
1504
|
+
/**
|
|
1505
|
+
* Rename a thread on the platform.
|
|
1506
|
+
* Resolves when the server confirms the update; rejects on failure.
|
|
1507
|
+
*/
|
|
1508
|
+
renameThread: (threadId: string, name: string) => Promise<void>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Archive a thread on the platform.
|
|
1511
|
+
* Archived threads are excluded from subsequent list results.
|
|
1512
|
+
* Resolves when the server confirms the update; rejects on failure.
|
|
1513
|
+
*/
|
|
1514
|
+
archiveThread: (threadId: string) => Promise<void>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Restore a previously archived thread on the platform.
|
|
1517
|
+
* The thread re-appears in default (non-archived) list results.
|
|
1518
|
+
* Resolves when the server confirms the update; rejects on failure.
|
|
1519
|
+
*/
|
|
1520
|
+
unarchiveThread: (threadId: string) => Promise<void>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Permanently delete a thread from the platform.
|
|
1523
|
+
* This is irreversible. Resolves when the server confirms deletion;
|
|
1524
|
+
* rejects on failure.
|
|
1525
|
+
*/
|
|
1526
|
+
deleteThread: (threadId: string) => Promise<void>;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* React hook for listing and managing CopilotKit Intelligence threads.
|
|
1530
|
+
*
|
|
1531
|
+
* On mount the hook fetches the thread list for the runtime-authenticated user
|
|
1532
|
+
* and the given `agentId`. When CopilotKit Intelligence exposes a WebSocket
|
|
1533
|
+
* URL, it also opens a realtime subscription so the `threads` array stays
|
|
1534
|
+
* current without polling — thread creates, renames, archives, and deletes
|
|
1535
|
+
* from any client are reflected immediately.
|
|
1536
|
+
*
|
|
1537
|
+
* Mutation methods (`renameThread`, `archiveThread`, `unarchiveThread`,
|
|
1538
|
+
* `deleteThread`) return promises that resolve once the platform confirms the
|
|
1539
|
+
* operation and reject with an `Error` on failure.
|
|
1540
|
+
*
|
|
1541
|
+
* @param input - Agent identifier and optional list controls.
|
|
1542
|
+
* @returns Thread list state and stable mutation callbacks.
|
|
1543
|
+
*
|
|
1544
|
+
* @example
|
|
1545
|
+
* ```tsx
|
|
1546
|
+
* import { useThreads } from "@copilotkit/react-core";
|
|
1547
|
+
*
|
|
1548
|
+
* function ThreadList() {
|
|
1549
|
+
* const { threads, isLoading, renameThread, deleteThread } = useThreads({
|
|
1550
|
+
* agentId: "agent-1",
|
|
1551
|
+
* });
|
|
1552
|
+
*
|
|
1553
|
+
* if (isLoading) return <p>Loading…</p>;
|
|
1554
|
+
*
|
|
1555
|
+
* return (
|
|
1556
|
+
* <ul>
|
|
1557
|
+
* {threads.map((t) => (
|
|
1558
|
+
* <li key={t.id}>
|
|
1559
|
+
* {t.name ?? "Untitled"}
|
|
1560
|
+
* <button onClick={() => renameThread(t.id, "New name")}>Rename</button>
|
|
1561
|
+
* <button onClick={() => deleteThread(t.id)}>Delete</button>
|
|
1562
|
+
* </li>
|
|
1563
|
+
* ))}
|
|
1564
|
+
* </ul>
|
|
1565
|
+
* );
|
|
1566
|
+
* }
|
|
1567
|
+
* ```
|
|
1568
|
+
*/
|
|
1569
|
+
declare function useThreads({
|
|
1570
|
+
agentId,
|
|
1571
|
+
includeArchived,
|
|
1572
|
+
limit,
|
|
1573
|
+
enabled
|
|
1574
|
+
}: UseThreadsInput): UseThreadsResult;
|
|
1575
|
+
//#endregion
|
|
1576
|
+
//#region src/components/chat/CopilotThreadsDrawer.d.ts
|
|
1577
|
+
/**
|
|
1578
|
+
* Per-row content render function. Receives a thread and returns the React
|
|
1579
|
+
* node to project into the element's `slot="row:{id}"`. Returning `null`
|
|
1580
|
+
* (or omitting the prop) falls back to the element's built-in row name.
|
|
1581
|
+
*/
|
|
1582
|
+
type CopilotThreadsDrawerRowRenderer = (thread: Thread) => React$1.ReactNode;
|
|
1583
|
+
/**
|
|
1584
|
+
* Props for {@link CopilotThreadsDrawer}.
|
|
1585
|
+
*
|
|
1586
|
+
* The drawer is a thin controller around the framework-agnostic
|
|
1587
|
+
* `<copilotkit-threads-drawer>` custom element. It feeds the element domain data
|
|
1588
|
+
* (threads/loading/error from {@link useThreads}, the active thread from the
|
|
1589
|
+
* chat configuration) and routes the element's outbound DOM events back into
|
|
1590
|
+
* core thread operations and chat-configuration changes.
|
|
1591
|
+
*/
|
|
1592
|
+
interface CopilotThreadsDrawerProps {
|
|
1593
|
+
/**
|
|
1594
|
+
* The agent whose threads to list and manage. Defaults to the agent of the
|
|
1595
|
+
* surrounding chat configuration, or the platform default when none is set.
|
|
1596
|
+
*/
|
|
1597
|
+
agentId?: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* Optional escape-hatch called when the user picks a thread row. The wrapper
|
|
1600
|
+
* additionally focuses the chat input. When omitted, the wrapper drives the
|
|
1601
|
+
* surrounding chat configuration directly (`setActiveThreadId`), so a bare
|
|
1602
|
+
* `<CopilotThreadsDrawer>` switches the rendered thread with no host wiring. Provide
|
|
1603
|
+
* this only to take control of the active thread yourself (e.g. a v1
|
|
1604
|
+
* `setThreadId`); when provided it is preferred over the provider.
|
|
1605
|
+
*/
|
|
1606
|
+
onThreadSelect?: (threadId: string) => void;
|
|
1607
|
+
/**
|
|
1608
|
+
* Optional escape-hatch called when the user starts a new thread (the
|
|
1609
|
+
* element's "+ New" button). The wrapper always resets the core thread store
|
|
1610
|
+
* to a fresh, non-explicit client-side thread (`startNewThread`). When this
|
|
1611
|
+
* is omitted, the wrapper also resets the surrounding chat configuration to a
|
|
1612
|
+
* fresh non-explicit thread (`startNewThread`) so the welcome screen shows
|
|
1613
|
+
* with no host wiring. Provide this only to clear your own active thread;
|
|
1614
|
+
* when provided it is preferred over the provider.
|
|
1615
|
+
*/
|
|
1616
|
+
onNewThread?: () => void;
|
|
1617
|
+
/** Called when the Upgrade CTA is clicked. */
|
|
1618
|
+
onLicensed?: () => void;
|
|
1619
|
+
/**
|
|
1620
|
+
* Destination the locked view's Upgrade CTA opens in a new tab. Defaults to
|
|
1621
|
+
* the element's built-in CopilotKit Intelligence docs URL when omitted. Set
|
|
1622
|
+
* to an empty string to suppress the default navigation and handle the click
|
|
1623
|
+
* yourself via `onLicensed`.
|
|
1624
|
+
*/
|
|
1625
|
+
licenseUrl?: string;
|
|
1626
|
+
/**
|
|
1627
|
+
* Optional per-row content. Rendered as light-DOM children with
|
|
1628
|
+
* `slot="row:{id}"` so the element projects them in place of the default
|
|
1629
|
+
* row name. Return `null` for a given row to keep the element's default.
|
|
1630
|
+
*/
|
|
1631
|
+
renderRow?: CopilotThreadsDrawerRowRenderer;
|
|
1632
|
+
/**
|
|
1633
|
+
* Accessible + default-header label for the drawer region. Sets the custom
|
|
1634
|
+
* element's `aria-label` and the default header text (shown when no
|
|
1635
|
+
* `slot="header"` content is projected). Defaults to the element's built-in
|
|
1636
|
+
* `"Threads"` when omitted.
|
|
1637
|
+
*/
|
|
1638
|
+
label?: string;
|
|
1639
|
+
/**
|
|
1640
|
+
* Heading for the "Recent Conversations" section above the thread list. Sets
|
|
1641
|
+
* the custom element's `recent-label` attribute. Defaults to the element's
|
|
1642
|
+
* built-in `"Recent Conversations"` when omitted.
|
|
1643
|
+
*/
|
|
1644
|
+
recentLabel?: string;
|
|
1645
|
+
/**
|
|
1646
|
+
* Whether the drawer offers a collapse toggle. Sets the custom element's
|
|
1647
|
+
* `collapsible` PROPERTY. When `false`, the drawer has no collapse toggle and
|
|
1648
|
+
* is always expanded. Defaults to the element's built-in `true` when omitted.
|
|
1649
|
+
*/
|
|
1650
|
+
collapsible?: boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* Called when the drawer's collapsed state changes (via the element's collapse
|
|
1653
|
+
* toggle), with the new collapsed state. Mirrors the element's
|
|
1654
|
+
* `collapse-change` event.
|
|
1655
|
+
*/
|
|
1656
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
1657
|
+
/**
|
|
1658
|
+
* Page size for thread pagination. When set, threads are fetched in pages of
|
|
1659
|
+
* this size and the drawer shows a "Load more" control while more remain.
|
|
1660
|
+
* When omitted, the full list loads at once and no pagination control shows.
|
|
1661
|
+
*/
|
|
1662
|
+
limit?: number;
|
|
1663
|
+
/**
|
|
1664
|
+
* `data-testid` set on the underlying custom element (handy in tests and for
|
|
1665
|
+
* targeting from a host page). Defaults to `"copilot-threads-drawer"`.
|
|
1666
|
+
*/
|
|
1667
|
+
"data-testid"?: string;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* React wrapper for the shadow-DOM `<copilotkit-threads-drawer>` threads drawer.
|
|
1671
|
+
*
|
|
1672
|
+
* Responsibilities:
|
|
1673
|
+
* - Registers the custom element on the client (SSR-safe; nothing renders
|
|
1674
|
+
* during prerender to avoid hydration mismatch).
|
|
1675
|
+
* - Feeds the element domain data: `threads`, `loading`, `error`,
|
|
1676
|
+
* `activeThreadId`, `licensed`, fetch-more state.
|
|
1677
|
+
* - Routes the element's outbound events to core thread operations
|
|
1678
|
+
* ({@link useThreads}) and chat-configuration changes.
|
|
1679
|
+
* - Registers with the surrounding chat configuration so the header
|
|
1680
|
+
* thread-list launcher appears, and binds the element `open` state to the
|
|
1681
|
+
* configuration's `drawerOpen`.
|
|
1682
|
+
*
|
|
1683
|
+
* Intelligence gating is two-pronged: the locked view shows when the runtime
|
|
1684
|
+
* reports no active entitlement OR the `threads` feature is unavailable. While
|
|
1685
|
+
* unavailable, the thread fetch is skipped entirely so the drawer issues no
|
|
1686
|
+
* network requests.
|
|
1687
|
+
*
|
|
1688
|
+
* Thread switching needs no host wiring: when `onThreadSelect`/`onNewThread`
|
|
1689
|
+
* are omitted, the wrapper drives the surrounding chat configuration directly
|
|
1690
|
+
* ({@link CopilotChatConfigurationValue.setActiveThreadId} /
|
|
1691
|
+
* {@link CopilotChatConfigurationValue.startNewThread}), so a bare drawer
|
|
1692
|
+
* connects to the picked thread and shows the welcome screen on "+ New". Pass
|
|
1693
|
+
* the callbacks only to take control yourself.
|
|
1694
|
+
*
|
|
1695
|
+
* @example
|
|
1696
|
+
* ```tsx
|
|
1697
|
+
* // Callback-free: the drawer drives the chat configuration itself.
|
|
1698
|
+
* <CopilotKitProvider runtimeUrl="/api/copilotkit">
|
|
1699
|
+
* <CopilotChat />
|
|
1700
|
+
* <CopilotThreadsDrawer />
|
|
1701
|
+
* </CopilotKitProvider>
|
|
1702
|
+
* ```
|
|
1703
|
+
*/
|
|
1704
|
+
declare function CopilotThreadsDrawer({
|
|
1705
|
+
agentId,
|
|
1706
|
+
onThreadSelect,
|
|
1707
|
+
onNewThread,
|
|
1708
|
+
onLicensed,
|
|
1709
|
+
licenseUrl,
|
|
1710
|
+
renderRow,
|
|
1711
|
+
label,
|
|
1712
|
+
recentLabel,
|
|
1713
|
+
collapsible,
|
|
1714
|
+
onCollapseChange,
|
|
1715
|
+
limit,
|
|
1716
|
+
"data-testid": dataTestId
|
|
1717
|
+
}: CopilotThreadsDrawerProps): React$1.ReactElement | null;
|
|
1718
|
+
declare namespace CopilotThreadsDrawer {
|
|
1719
|
+
var displayName: string;
|
|
1720
|
+
}
|
|
1721
|
+
//#endregion
|
|
1722
|
+
//#region src/components/chat/CopilotChatAttachmentQueue.d.ts
|
|
1723
|
+
interface CopilotChatAttachmentQueueProps {
|
|
1724
|
+
attachments: Attachment$1[];
|
|
1725
|
+
onRemoveAttachment: (id: string) => void;
|
|
1726
|
+
className?: string;
|
|
1727
|
+
}
|
|
1728
|
+
/**
|
|
1729
|
+
* The attachments queued in the composer, each with a preview and a remove
|
|
1730
|
+
* button named by `labels.attachmentRemoveButtonLabel`.
|
|
1731
|
+
*/
|
|
1732
|
+
declare const CopilotChatAttachmentQueue: React$1.FC<CopilotChatAttachmentQueueProps>;
|
|
1733
|
+
//#endregion
|
|
1734
|
+
//#region src/components/chat/CopilotChatAttachmentRenderer.d.ts
|
|
1735
|
+
interface CopilotChatAttachmentRendererProps {
|
|
1736
|
+
type: "image" | "audio" | "video" | "document";
|
|
1737
|
+
source: InputContentSource$1;
|
|
1738
|
+
filename?: string;
|
|
1739
|
+
className?: string;
|
|
1740
|
+
}
|
|
1741
|
+
declare const CopilotChatAttachmentRenderer: React$1.FC<CopilotChatAttachmentRendererProps>;
|
|
1742
|
+
//#endregion
|
|
1743
|
+
//#region src/components/WildcardToolCallRender.d.ts
|
|
1744
|
+
/**
|
|
1745
|
+
* Catch-all (`"*"`) tool-call renderer that shows CopilotKit's default
|
|
1746
|
+
* tool-call card for any tool without a dedicated renderer.
|
|
1747
|
+
*/
|
|
1748
|
+
declare const WildcardToolCallRender: ReactToolCallRenderer<any>;
|
|
1749
|
+
//#endregion
|
|
1750
|
+
//#region src/components/CopilotKitInspectorContext.d.ts
|
|
1751
|
+
type CopilotKitInspectorOpenRequest = {
|
|
1752
|
+
messageId: string;
|
|
1753
|
+
threadId?: string;
|
|
1754
|
+
agentId?: string;
|
|
1755
|
+
};
|
|
1756
|
+
//#endregion
|
|
1757
|
+
//#region src/components/CopilotKitInspector.d.ts
|
|
1758
|
+
interface CopilotKitInspectorProps {
|
|
1759
|
+
core?: CopilotKitCore$1 | null;
|
|
1760
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
1761
|
+
openRequest?: CopilotKitInspectorOpenRequest | null;
|
|
1762
|
+
}
|
|
1763
|
+
declare const CopilotKitInspector: react.FC<CopilotKitInspectorProps>;
|
|
1764
|
+
//#endregion
|
|
1765
|
+
//#region src/components/MCPAppsActivityRenderer.d.ts
|
|
1766
|
+
/**
|
|
1767
|
+
* Props for the activity renderer component
|
|
1768
|
+
*/
|
|
1769
|
+
interface MCPAppsActivityRendererProps {
|
|
1770
|
+
activityType: string;
|
|
1771
|
+
content: MCPAppsActivityContent$1;
|
|
1772
|
+
message: unknown;
|
|
1773
|
+
agent: AbstractAgent$1 | undefined;
|
|
1774
|
+
/**
|
|
1775
|
+
* Restore `allow-same-origin` on the sandbox. Unsafe: the widget runs with
|
|
1776
|
+
* the host page's origin. Set via `mcpApps.allowSameOriginFallback` on
|
|
1777
|
+
* `CopilotKitProvider`.
|
|
1778
|
+
*/
|
|
1779
|
+
allowSameOriginFallback?: boolean;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* MCP Apps Extension Activity Renderer
|
|
1783
|
+
*
|
|
1784
|
+
* Renders MCP Apps UI in a sandboxed iframe with full protocol support.
|
|
1785
|
+
* Fetches resource content on-demand via proxied MCP requests. The React shell
|
|
1786
|
+
* owns the iframe; `bindMcpApp` owns the protocol.
|
|
1787
|
+
*/
|
|
1788
|
+
declare const MCPAppsActivityRenderer: React$1.FC<MCPAppsActivityRendererProps>;
|
|
1789
|
+
//#endregion
|
|
1790
|
+
//#region src/components/OpenGenerativeUIRenderer.d.ts
|
|
1791
|
+
declare const OpenGenerativeUIActivityType = "open-generative-ui";
|
|
1792
|
+
declare const OpenGenerativeUIContentSchema: z.ZodObject<{
|
|
1793
|
+
initialHeight: z.ZodOptional<z.ZodNumber>;
|
|
1794
|
+
generating: z.ZodOptional<z.ZodBoolean>;
|
|
1795
|
+
css: z.ZodOptional<z.ZodString>;
|
|
1796
|
+
cssComplete: z.ZodOptional<z.ZodBoolean>;
|
|
1797
|
+
html: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1798
|
+
htmlComplete: z.ZodOptional<z.ZodBoolean>;
|
|
1799
|
+
jsFunctions: z.ZodOptional<z.ZodString>;
|
|
1800
|
+
jsFunctionsComplete: z.ZodOptional<z.ZodBoolean>;
|
|
1801
|
+
jsExpressions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1802
|
+
jsExpressionsComplete: z.ZodOptional<z.ZodBoolean>;
|
|
1803
|
+
}, "strip", z.ZodTypeAny, {
|
|
1804
|
+
html?: string[] | undefined;
|
|
1805
|
+
initialHeight?: number | undefined;
|
|
1806
|
+
generating?: boolean | undefined;
|
|
1807
|
+
css?: string | undefined;
|
|
1808
|
+
cssComplete?: boolean | undefined;
|
|
1809
|
+
htmlComplete?: boolean | undefined;
|
|
1810
|
+
jsFunctions?: string | undefined;
|
|
1811
|
+
jsFunctionsComplete?: boolean | undefined;
|
|
1812
|
+
jsExpressions?: string[] | undefined;
|
|
1813
|
+
jsExpressionsComplete?: boolean | undefined;
|
|
1814
|
+
}, {
|
|
1815
|
+
html?: string[] | undefined;
|
|
1816
|
+
initialHeight?: number | undefined;
|
|
1817
|
+
generating?: boolean | undefined;
|
|
1818
|
+
css?: string | undefined;
|
|
1819
|
+
cssComplete?: boolean | undefined;
|
|
1820
|
+
htmlComplete?: boolean | undefined;
|
|
1821
|
+
jsFunctions?: string | undefined;
|
|
1822
|
+
jsFunctionsComplete?: boolean | undefined;
|
|
1823
|
+
jsExpressions?: string[] | undefined;
|
|
1824
|
+
jsExpressionsComplete?: boolean | undefined;
|
|
1825
|
+
}>;
|
|
1826
|
+
type OpenGenerativeUIContent = z.infer<typeof OpenGenerativeUIContentSchema>;
|
|
1827
|
+
/**
|
|
1828
|
+
* Schema for the generateSandboxedUi tool call arguments.
|
|
1829
|
+
* Used by the frontend tool renderer to display placeholder messages.
|
|
1830
|
+
*/
|
|
1831
|
+
declare const GenerateSandboxedUiArgsSchema: z.ZodObject<{
|
|
1832
|
+
initialHeight: z.ZodOptional<z.ZodNumber>;
|
|
1833
|
+
placeholderMessages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1834
|
+
css: z.ZodOptional<z.ZodString>;
|
|
1835
|
+
html: z.ZodOptional<z.ZodString>;
|
|
1836
|
+
jsFunctions: z.ZodOptional<z.ZodString>;
|
|
1837
|
+
jsExpressions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1838
|
+
}, "strip", z.ZodTypeAny, {
|
|
1839
|
+
html?: string | undefined;
|
|
1840
|
+
initialHeight?: number | undefined;
|
|
1841
|
+
css?: string | undefined;
|
|
1842
|
+
jsFunctions?: string | undefined;
|
|
1843
|
+
jsExpressions?: string[] | undefined;
|
|
1844
|
+
placeholderMessages?: string[] | undefined;
|
|
1845
|
+
}, {
|
|
1846
|
+
html?: string | undefined;
|
|
1847
|
+
initialHeight?: number | undefined;
|
|
1848
|
+
css?: string | undefined;
|
|
1849
|
+
jsFunctions?: string | undefined;
|
|
1850
|
+
jsExpressions?: string[] | undefined;
|
|
1851
|
+
placeholderMessages?: string[] | undefined;
|
|
1852
|
+
}>;
|
|
1853
|
+
type GenerateSandboxedUiArgs = z.infer<typeof GenerateSandboxedUiArgsSchema>;
|
|
1854
|
+
interface OpenGenerativeUIActivityRendererProps {
|
|
1855
|
+
activityType: string;
|
|
1856
|
+
content: OpenGenerativeUIContent;
|
|
1857
|
+
message: unknown;
|
|
1858
|
+
agent: unknown;
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Outer wrapper — absorbs every parent re-render but only forwards
|
|
1862
|
+
* throttled content snapshots to the memoized inner component.
|
|
1863
|
+
*/
|
|
1864
|
+
declare const OpenGenerativeUIActivityRenderer: React$1.FC<OpenGenerativeUIActivityRendererProps>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Frontend tool renderer for generateSandboxedUi.
|
|
1867
|
+
* Displays placeholder messages while the UI is being generated.
|
|
1868
|
+
*/
|
|
1869
|
+
declare const OpenGenerativeUIToolRenderer: React$1.FC<{
|
|
1870
|
+
name: string;
|
|
1871
|
+
args: Partial<GenerateSandboxedUiArgs>;
|
|
1872
|
+
status: ToolCallStatus$1.InProgress;
|
|
1873
|
+
result: undefined;
|
|
1874
|
+
} | {
|
|
1875
|
+
name: string;
|
|
1876
|
+
args: GenerateSandboxedUiArgs;
|
|
1877
|
+
status: ToolCallStatus$1.Executing;
|
|
1878
|
+
result: undefined;
|
|
1879
|
+
} | {
|
|
1880
|
+
name: string;
|
|
1881
|
+
args: GenerateSandboxedUiArgs;
|
|
1882
|
+
status: ToolCallStatus$1.Complete;
|
|
1883
|
+
result: string;
|
|
1884
|
+
}>;
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region src/types/react-tool-call-renderer.d.ts
|
|
1887
|
+
interface ReactToolCallRenderer<T = unknown> {
|
|
1888
|
+
name: string;
|
|
1889
|
+
/**
|
|
1890
|
+
* Schema describing the tool arguments. Optional — renderers registered for
|
|
1891
|
+
* tools without parameters (e.g. HITL confirm dialogs) have no schema.
|
|
1892
|
+
*/
|
|
1893
|
+
args?: StandardSchemaV1<any, T>;
|
|
1894
|
+
/**
|
|
1895
|
+
* Optional agent ID to constrain this tool renderer to a specific agent.
|
|
1896
|
+
* If specified, this renderer will only be used for the specified agent.
|
|
1897
|
+
*/
|
|
1898
|
+
agentId?: string;
|
|
1899
|
+
/**
|
|
1900
|
+
* Whether calls this renderer draws join the chat's tool-call groups (see
|
|
1901
|
+
* `toolCallDisplay` on `CopilotChatMessageView`). CopilotKit's built-in card
|
|
1902
|
+
* sets it; a renderer that leaves it unset always shows its calls on their
|
|
1903
|
+
* own, since the chat can't tell what it draws (it may even draw nothing).
|
|
1904
|
+
*/
|
|
1905
|
+
group?: boolean;
|
|
1906
|
+
render: React.ComponentType<{
|
|
1907
|
+
name: string;
|
|
1908
|
+
toolCallId: string;
|
|
1909
|
+
args: Partial<T>;
|
|
1910
|
+
status: ToolCallStatus$1.InProgress;
|
|
1911
|
+
result: undefined;
|
|
1912
|
+
} | {
|
|
1913
|
+
name: string;
|
|
1914
|
+
toolCallId: string;
|
|
1915
|
+
args: T;
|
|
1916
|
+
status: ToolCallStatus$1.Executing;
|
|
1917
|
+
result: undefined;
|
|
1918
|
+
} | {
|
|
1919
|
+
name: string;
|
|
1920
|
+
toolCallId: string;
|
|
1921
|
+
args: T;
|
|
1922
|
+
status: ToolCallStatus$1.Complete;
|
|
1923
|
+
result: string;
|
|
1924
|
+
}>;
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region src/hooks/use-render-tool-call.d.ts
|
|
1928
|
+
interface UseRenderToolCallProps {
|
|
1929
|
+
toolCall: ToolCall$1;
|
|
1930
|
+
toolMessage?: ToolMessage$1;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Hook that returns a function to render tool calls based on the render functions
|
|
1934
|
+
* defined in CopilotKitProvider.
|
|
1935
|
+
*
|
|
1936
|
+
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
1937
|
+
*/
|
|
1938
|
+
declare function useRenderToolCall(): ({
|
|
1939
|
+
toolCall,
|
|
1940
|
+
toolMessage
|
|
1941
|
+
}: UseRenderToolCallProps) => React$1.ReactElement | null;
|
|
1942
|
+
//#endregion
|
|
1943
|
+
//#region src/types/react-custom-message-renderer.d.ts
|
|
1944
|
+
type ReactCustomMessageRendererPosition = "before" | "after";
|
|
1945
|
+
interface ReactCustomMessageRenderer {
|
|
1946
|
+
agentId?: string;
|
|
1947
|
+
render: React.ComponentType<{
|
|
1948
|
+
message: Message$1;
|
|
1949
|
+
position: ReactCustomMessageRendererPosition;
|
|
1950
|
+
runId: string;
|
|
1951
|
+
messageIndex: number;
|
|
1952
|
+
messageIndexInRun: number;
|
|
1953
|
+
numberOfMessagesInRun: number;
|
|
1954
|
+
agentId: string;
|
|
1955
|
+
stateSnapshot: any;
|
|
1956
|
+
}> | null;
|
|
1957
|
+
}
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region src/hooks/use-render-custom-messages.d.ts
|
|
1960
|
+
interface UseRenderCustomMessagesParams {
|
|
1961
|
+
message: Message$1;
|
|
1962
|
+
position: ReactCustomMessageRendererPosition;
|
|
1963
|
+
}
|
|
1964
|
+
declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime0.JSX.Element | null) | null;
|
|
1965
|
+
//#endregion
|
|
1966
|
+
//#region src/types/frontend-tool.d.ts
|
|
1967
|
+
type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool$1<T> & {
|
|
1968
|
+
render?: ReactToolCallRenderer<T>["render"];
|
|
1969
|
+
};
|
|
1970
|
+
//#endregion
|
|
1971
|
+
//#region src/types/human-in-the-loop.d.ts
|
|
1972
|
+
type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool$1<T>, "handler"> & {
|
|
1973
|
+
/**
|
|
1974
|
+
* Render the human-in-the-loop UI for this tool call.
|
|
1975
|
+
*
|
|
1976
|
+
* Beyond the tool call's `args`/`status`/`result`, the render props carry
|
|
1977
|
+
* attribution:
|
|
1978
|
+
* - `toolCallId` — the AG-UI tool call id, unique per interrupt. It is the
|
|
1979
|
+
* stable key for correlating this interrupt with runtime (sub)agent
|
|
1980
|
+
* attribution — e.g. the `agentId` reported by `onToolExecutionStart`, or
|
|
1981
|
+
* per-run attribution stamped on the event stream — so the UI can label
|
|
1982
|
+
* the interrupt with the agent that actually raised it.
|
|
1983
|
+
* - `agentId` — the agent this tool was *registered* to (the tool's own
|
|
1984
|
+
* `agentId`), or `undefined` for an unscoped tool. This is the static
|
|
1985
|
+
* registration scope; it is NOT necessarily the runtime (sub)agent that
|
|
1986
|
+
* raised the interrupt. For runtime attribution, correlate `toolCallId`
|
|
1987
|
+
* with the event-stream/`onToolExecutionStart` agent id.
|
|
1988
|
+
*/
|
|
1989
|
+
render: React$1.ComponentType<{
|
|
1990
|
+
name: string;
|
|
1991
|
+
description: string;
|
|
1992
|
+
toolCallId: string;
|
|
1993
|
+
agentId?: string;
|
|
1994
|
+
args: Partial<T>;
|
|
1995
|
+
status: ToolCallStatus$1.InProgress;
|
|
1996
|
+
result: undefined;
|
|
1997
|
+
respond: undefined;
|
|
1998
|
+
} | {
|
|
1999
|
+
name: string;
|
|
2000
|
+
description: string;
|
|
2001
|
+
toolCallId: string;
|
|
2002
|
+
agentId?: string;
|
|
2003
|
+
args: T;
|
|
2004
|
+
status: ToolCallStatus$1.Executing;
|
|
2005
|
+
result: undefined;
|
|
2006
|
+
respond: (result: unknown) => Promise<void>;
|
|
2007
|
+
} | {
|
|
2008
|
+
name: string;
|
|
2009
|
+
description: string;
|
|
2010
|
+
toolCallId: string;
|
|
2011
|
+
agentId?: string;
|
|
2012
|
+
args: T;
|
|
2013
|
+
status: ToolCallStatus$1.Complete;
|
|
2014
|
+
result: string;
|
|
2015
|
+
respond: undefined;
|
|
2016
|
+
}>;
|
|
2017
|
+
};
|
|
2018
|
+
//#endregion
|
|
2019
|
+
//#region src/types/defineToolCallRenderer.d.ts
|
|
2020
|
+
/**
|
|
2021
|
+
* Helper to define a type-safe tool call renderer entry.
|
|
2022
|
+
* - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
|
|
2023
|
+
* - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).
|
|
2024
|
+
* - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
|
|
2025
|
+
* - For wildcard tools (name: "*"), args is optional and defaults to z.any()
|
|
2026
|
+
*/
|
|
2027
|
+
type RenderProps<T> = {
|
|
2028
|
+
name: string;
|
|
2029
|
+
toolCallId: string;
|
|
2030
|
+
args: Partial<T>;
|
|
2031
|
+
status: ToolCallStatus$1.InProgress;
|
|
2032
|
+
result: undefined;
|
|
2033
|
+
} | {
|
|
2034
|
+
name: string;
|
|
2035
|
+
toolCallId: string;
|
|
2036
|
+
args: T;
|
|
2037
|
+
status: ToolCallStatus$1.Executing;
|
|
2038
|
+
result: undefined;
|
|
2039
|
+
} | {
|
|
2040
|
+
name: string;
|
|
2041
|
+
toolCallId: string;
|
|
2042
|
+
args: T;
|
|
2043
|
+
status: ToolCallStatus$1.Complete;
|
|
2044
|
+
result: string;
|
|
2045
|
+
};
|
|
2046
|
+
declare function defineToolCallRenderer(def: {
|
|
2047
|
+
name: "*";
|
|
2048
|
+
render: (props: RenderProps<any>) => React$1.ReactElement | null;
|
|
2049
|
+
agentId?: string;
|
|
2050
|
+
group?: boolean;
|
|
2051
|
+
}): ReactToolCallRenderer<any>;
|
|
2052
|
+
declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
2053
|
+
name: string;
|
|
2054
|
+
args: S;
|
|
2055
|
+
render: (props: RenderProps<InferSchemaOutput<S>>) => React$1.ReactElement | null;
|
|
2056
|
+
agentId?: string;
|
|
2057
|
+
group?: boolean;
|
|
2058
|
+
}): ReactToolCallRenderer<InferSchemaOutput<S>>;
|
|
2059
|
+
//#endregion
|
|
2060
|
+
//#region src/types/interrupt.d.ts
|
|
2061
|
+
/** Name of the legacy custom event agents emit to signal an interrupt. */
|
|
2062
|
+
declare const INTERRUPT_EVENT_NAME = "on_interrupt";
|
|
2063
|
+
/** Legacy custom-event interrupt payload (agent emits a custom `on_interrupt` event). */
|
|
2064
|
+
interface InterruptEvent<TValue = unknown> {
|
|
2065
|
+
name: string;
|
|
2066
|
+
value: TValue;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Resolve the agent with user input for an interrupt.
|
|
2070
|
+
*
|
|
2071
|
+
* - Standard interrupts: records `{ status: "resolved", payload }` for the target
|
|
2072
|
+
* interrupt (defaults to the primary one). Resumes once every open interrupt is
|
|
2073
|
+
* addressed; returns the resume run result, or `void` while still awaiting others.
|
|
2074
|
+
* - Legacy interrupts: resumes immediately via `command.resume = payload`.
|
|
2075
|
+
*/
|
|
2076
|
+
type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult$1 | void>;
|
|
2077
|
+
/**
|
|
2078
|
+
* Cancel an interrupt.
|
|
2079
|
+
*
|
|
2080
|
+
* - Standard interrupts: records `{ status: "cancelled" }` for the target interrupt
|
|
2081
|
+
* (defaults to the primary one), then resumes once all are addressed.
|
|
2082
|
+
* - Legacy interrupts: dismisses the pending interrupt without resuming.
|
|
2083
|
+
*/
|
|
2084
|
+
type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult$1 | void>;
|
|
2085
|
+
interface InterruptHandlerProps<TValue = unknown> {
|
|
2086
|
+
/**
|
|
2087
|
+
* Legacy event shape (`{ name, value }`). Always present for back-compat: for
|
|
2088
|
+
* standard interrupts, `value` is the primary `Interrupt` and `name` is `"on_interrupt"`.
|
|
2089
|
+
* Prefer `interrupt` / `interrupts` for standard interrupts.
|
|
2090
|
+
*/
|
|
2091
|
+
event: InterruptEvent<TValue>;
|
|
2092
|
+
/** Primary standard interrupt (`interrupts[0]`), or `null` for legacy interrupts. */
|
|
2093
|
+
interrupt: Interrupt | null;
|
|
2094
|
+
/** All open standard interrupts (empty array for legacy interrupts). */
|
|
2095
|
+
interrupts: Interrupt[];
|
|
2096
|
+
resolve: InterruptResolveFn;
|
|
2097
|
+
cancel: InterruptCancelFn;
|
|
2098
|
+
}
|
|
2099
|
+
interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
|
|
2100
|
+
event: InterruptEvent<TValue>;
|
|
2101
|
+
interrupt: Interrupt | null;
|
|
2102
|
+
interrupts: Interrupt[];
|
|
2103
|
+
result: TResult;
|
|
2104
|
+
resolve: InterruptResolveFn;
|
|
2105
|
+
cancel: InterruptCancelFn;
|
|
2106
|
+
}
|
|
2107
|
+
//#endregion
|
|
2108
|
+
//#region src/types/sandbox-function.d.ts
|
|
2109
|
+
type SandboxFunction<TParams extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
2110
|
+
name: string;
|
|
2111
|
+
description: string;
|
|
2112
|
+
parameters: TParams;
|
|
2113
|
+
handler: (args: any) => Promise<unknown>;
|
|
2114
|
+
};
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region src/hooks/use-render-activity-message.d.ts
|
|
2117
|
+
declare function useRenderActivityMessage(): {
|
|
2118
|
+
renderActivityMessage: (message: ActivityMessage$1) => React.ReactElement | null;
|
|
2119
|
+
findRenderer: (activityType: string) => ReactActivityMessageRenderer<unknown> | null;
|
|
2120
|
+
};
|
|
2121
|
+
//#endregion
|
|
2122
|
+
//#region src/hooks/use-frontend-tool.d.ts
|
|
2123
|
+
declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
|
|
2124
|
+
//#endregion
|
|
2125
|
+
//#region src/hooks/use-frontend-tools.d.ts
|
|
2126
|
+
/**
|
|
2127
|
+
* Register a list of frontend tools whose length can change between renders.
|
|
2128
|
+
*
|
|
2129
|
+
* `useFrontendTool` registers exactly one tool per call, so it cannot be called
|
|
2130
|
+
* in a loop over a runtime-length list without breaking the rules of hooks.
|
|
2131
|
+
* This hook runs a single effect over the whole array instead, which makes it
|
|
2132
|
+
* safe to build the list from state, props, or a server response.
|
|
2133
|
+
*
|
|
2134
|
+
* Tools are keyed by `name` plus `agentId`, the same as `useFrontendTool`. A
|
|
2135
|
+
* tool that disappears from the array is unregistered on the next render, and
|
|
2136
|
+
* every tool is unregistered on unmount. Renderers stay registered after
|
|
2137
|
+
* unmount so past tool calls still render in the chat history.
|
|
2138
|
+
*
|
|
2139
|
+
* @param tools - The tools to register. May be empty and may change length.
|
|
2140
|
+
* @param deps - Extra dependencies that force re-registration, compared by
|
|
2141
|
+
* identity like the second argument of `useEffect`. Use this when a handler
|
|
2142
|
+
* closes over a value that is not part of the tool definition. Keep the array
|
|
2143
|
+
* a constant length across renders.
|
|
2144
|
+
*
|
|
2145
|
+
* @example
|
|
2146
|
+
* Register one tool per item in application state:
|
|
2147
|
+
* ```tsx
|
|
2148
|
+
* const [reports, setReports] = useState<Report[]>([]);
|
|
2149
|
+
*
|
|
2150
|
+
* useFrontendTools(
|
|
2151
|
+
* reports.map((report) => ({
|
|
2152
|
+
* name: `open_${report.id}`,
|
|
2153
|
+
* description: `Open the ${report.title} report`,
|
|
2154
|
+
* handler: async () => navigate(`/reports/${report.id}`),
|
|
2155
|
+
* })),
|
|
2156
|
+
* [navigate],
|
|
2157
|
+
* );
|
|
2158
|
+
* ```
|
|
2159
|
+
*
|
|
2160
|
+
* @example
|
|
2161
|
+
* Register tools described by the backend:
|
|
2162
|
+
* ```tsx
|
|
2163
|
+
* const { data } = useQuery(fetchToolDescriptors);
|
|
2164
|
+
*
|
|
2165
|
+
* useFrontendTools(
|
|
2166
|
+
* (data ?? []).map((descriptor) => ({
|
|
2167
|
+
* name: descriptor.name,
|
|
2168
|
+
* description: descriptor.description,
|
|
2169
|
+
* parameters: z.object({ query: z.string() }),
|
|
2170
|
+
* handler: async ({ query }) => runDescriptor(descriptor.id, query),
|
|
2171
|
+
* })),
|
|
2172
|
+
* );
|
|
2173
|
+
* ```
|
|
2174
|
+
*/
|
|
2175
|
+
declare function useFrontendTools(tools: ReadonlyArray<ReactFrontendTool<any>> | undefined, deps?: ReadonlyArray<unknown>): void;
|
|
2176
|
+
//#endregion
|
|
2177
|
+
//#region src/hooks/use-component.d.ts
|
|
2178
|
+
type InferRenderProps<T> = T extends StandardSchemaV1 ? InferSchemaOutput<T> : any;
|
|
2179
|
+
/**
|
|
2180
|
+
* Registers a React component as a frontend tool renderer in chat.
|
|
2181
|
+
*
|
|
2182
|
+
* This hook is a convenience wrapper around `useFrontendTool` that:
|
|
2183
|
+
* - builds a model-facing tool description,
|
|
2184
|
+
* - forwards optional schema parameters (any Standard Schema V1 compatible library),
|
|
2185
|
+
* - renders your component with tool call parameters.
|
|
2186
|
+
*
|
|
2187
|
+
* Use this when you want to display a typed visual component for a tool call
|
|
2188
|
+
* without manually wiring a full frontend tool object.
|
|
2189
|
+
*
|
|
2190
|
+
* When `parameters` is provided, render props are inferred from the schema.
|
|
2191
|
+
* When omitted, the render component may accept any props.
|
|
2192
|
+
*
|
|
2193
|
+
* @typeParam TSchema - Schema describing tool parameters, or `undefined` when no schema is given.
|
|
2194
|
+
* @param config - Tool registration config.
|
|
2195
|
+
* @param deps - Optional dependencies to refresh registration (same semantics as `useEffect`).
|
|
2196
|
+
*
|
|
2197
|
+
* @example
|
|
2198
|
+
* ```tsx
|
|
2199
|
+
* // Without parameters — render accepts any props
|
|
2200
|
+
* useComponent({
|
|
2201
|
+
* name: "showGreeting",
|
|
2202
|
+
* render: ({ message }: { message: string }) => <div>{message}</div>,
|
|
2203
|
+
* });
|
|
2204
|
+
* ```
|
|
2205
|
+
*
|
|
2206
|
+
* @example
|
|
2207
|
+
* ```tsx
|
|
2208
|
+
* // With parameters — render props inferred from schema
|
|
2209
|
+
* useComponent({
|
|
2210
|
+
* name: "showWeatherCard",
|
|
2211
|
+
* parameters: z.object({ city: z.string() }),
|
|
2212
|
+
* render: ({ city }) => <div>{city}</div>,
|
|
2213
|
+
* });
|
|
2214
|
+
* ```
|
|
2215
|
+
*
|
|
2216
|
+
* @example
|
|
2217
|
+
* ```tsx
|
|
2218
|
+
* useComponent(
|
|
2219
|
+
* {
|
|
2220
|
+
* name: "renderProfile",
|
|
2221
|
+
* parameters: z.object({ userId: z.string() }),
|
|
2222
|
+
* render: ProfileCard,
|
|
2223
|
+
* agentId: "support-agent",
|
|
2224
|
+
* },
|
|
2225
|
+
* [selectedAgentId],
|
|
2226
|
+
* );
|
|
2227
|
+
* ```
|
|
2228
|
+
*/
|
|
2229
|
+
declare function useComponent<TSchema extends StandardSchemaV1<any, Record<string, unknown>> | undefined = undefined>(config: {
|
|
2230
|
+
name: string;
|
|
2231
|
+
description?: string;
|
|
2232
|
+
parameters?: TSchema;
|
|
2233
|
+
render: ComponentType<NoInfer<InferRenderProps<TSchema>>>;
|
|
2234
|
+
agentId?: string;
|
|
2235
|
+
followUp?: boolean;
|
|
2236
|
+
}, deps?: ReadonlyArray<unknown>): void;
|
|
2237
|
+
//#endregion
|
|
2238
|
+
//#region src/hooks/use-render-tool.d.ts
|
|
2239
|
+
interface RenderToolInProgressProps<S extends StandardSchemaV1> {
|
|
2240
|
+
name: string;
|
|
2241
|
+
toolCallId: string;
|
|
2242
|
+
parameters: Partial<InferSchemaOutput<S>>;
|
|
2243
|
+
status: "inProgress";
|
|
2244
|
+
result: undefined;
|
|
2245
|
+
}
|
|
2246
|
+
interface RenderToolExecutingProps<S extends StandardSchemaV1> {
|
|
2247
|
+
name: string;
|
|
2248
|
+
toolCallId: string;
|
|
2249
|
+
parameters: InferSchemaOutput<S>;
|
|
2250
|
+
status: "executing";
|
|
2251
|
+
result: undefined;
|
|
2252
|
+
}
|
|
2253
|
+
interface RenderToolCompleteProps<S extends StandardSchemaV1> {
|
|
2254
|
+
name: string;
|
|
2255
|
+
toolCallId: string;
|
|
2256
|
+
parameters: InferSchemaOutput<S>;
|
|
2257
|
+
status: "complete";
|
|
2258
|
+
result: string;
|
|
2259
|
+
}
|
|
2260
|
+
type RenderToolProps<S extends StandardSchemaV1> = RenderToolInProgressProps<S> | RenderToolExecutingProps<S> | RenderToolCompleteProps<S>;
|
|
2261
|
+
/**
|
|
2262
|
+
* Registers a wildcard (`"*"`) renderer for tool calls.
|
|
2263
|
+
*
|
|
2264
|
+
* The wildcard renderer is used as a fallback when no exact name-matched
|
|
2265
|
+
* renderer is registered for a tool call.
|
|
2266
|
+
*
|
|
2267
|
+
* @param config - Wildcard renderer configuration.
|
|
2268
|
+
* @param deps - Optional dependencies to refresh registration.
|
|
2269
|
+
*
|
|
2270
|
+
* @example
|
|
2271
|
+
* ```tsx
|
|
2272
|
+
* useRenderTool(
|
|
2273
|
+
* {
|
|
2274
|
+
* name: "*",
|
|
2275
|
+
* render: ({ name, status }) => (
|
|
2276
|
+
* <div>
|
|
2277
|
+
* {status === "complete" ? "✓" : "⏳"} {name}
|
|
2278
|
+
* </div>
|
|
2279
|
+
* ),
|
|
2280
|
+
* },
|
|
2281
|
+
* [],
|
|
2282
|
+
* );
|
|
2283
|
+
* ```
|
|
2284
|
+
*/
|
|
2285
|
+
declare function useRenderTool(config: {
|
|
2286
|
+
name: "*";
|
|
2287
|
+
render: (props: any) => React.ReactElement | null;
|
|
2288
|
+
agentId?: string; /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */
|
|
2289
|
+
group?: boolean;
|
|
2290
|
+
}, deps?: ReadonlyArray<unknown>): void;
|
|
2291
|
+
/**
|
|
2292
|
+
* Registers a name-scoped renderer for tool calls.
|
|
2293
|
+
*
|
|
2294
|
+
* The provided `parameters` schema defines the typed shape of `props.parameters`
|
|
2295
|
+
* in `render` for `executing` and `complete` states. Accepts any Standard Schema V1
|
|
2296
|
+
* compatible library (Zod, Valibot, ArkType, etc.).
|
|
2297
|
+
*
|
|
2298
|
+
* @typeParam S - Schema type describing tool call parameters.
|
|
2299
|
+
* @param config - Named renderer configuration.
|
|
2300
|
+
* @param deps - Optional dependencies to refresh registration.
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* ```tsx
|
|
2304
|
+
* useRenderTool(
|
|
2305
|
+
* {
|
|
2306
|
+
* name: "searchDocs",
|
|
2307
|
+
* parameters: z.object({ query: z.string() }),
|
|
2308
|
+
* render: ({ status, parameters, result }) => {
|
|
2309
|
+
* if (status === "inProgress") return <div>Preparing...</div>;
|
|
2310
|
+
* if (status === "executing") return <div>Searching {parameters.query}</div>;
|
|
2311
|
+
* return <div>{result}</div>;
|
|
2312
|
+
* },
|
|
2313
|
+
* },
|
|
2314
|
+
* [],
|
|
2315
|
+
* );
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
declare function useRenderTool<S extends StandardSchemaV1>(config: {
|
|
2319
|
+
name: string;
|
|
2320
|
+
parameters: S;
|
|
2321
|
+
render: (props: RenderToolProps<S>) => React.ReactElement | null;
|
|
2322
|
+
agentId?: string; /** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */
|
|
2323
|
+
group?: boolean;
|
|
2324
|
+
}, deps?: ReadonlyArray<unknown>): void;
|
|
2325
|
+
//#endregion
|
|
2326
|
+
//#region src/hooks/use-default-render-tool.d.ts
|
|
2327
|
+
type DefaultRenderProps = {
|
|
2328
|
+
/** The name of the tool being called. */name: string; /** The id of the tool call being rendered. */
|
|
2329
|
+
toolCallId: string; /** The parsed parameters passed to the tool call. */
|
|
2330
|
+
parameters: unknown; /** Current execution status of the tool call. */
|
|
2331
|
+
status: "inProgress" | "executing" | "complete"; /** The tool call result string, available only when `status` is `"complete"`. */
|
|
2332
|
+
result: string | undefined;
|
|
2333
|
+
};
|
|
2334
|
+
/**
|
|
2335
|
+
* Registers a wildcard (`"*"`) tool-call renderer via `useRenderTool`.
|
|
2336
|
+
*
|
|
2337
|
+
* - Call with no config to use CopilotKit's built-in default tool-call card.
|
|
2338
|
+
* - Pass `config.render` to replace the default UI with your own fallback renderer.
|
|
2339
|
+
*
|
|
2340
|
+
* This is useful when you want a generic renderer for tools that do not have a
|
|
2341
|
+
* dedicated `useRenderTool({ name: "..." })` registration.
|
|
2342
|
+
*
|
|
2343
|
+
* @param config - Optional custom wildcard render function.
|
|
2344
|
+
* @param deps - Optional dependencies to refresh registration.
|
|
2345
|
+
*
|
|
2346
|
+
* @example
|
|
2347
|
+
* ```tsx
|
|
2348
|
+
* useDefaultRenderTool();
|
|
2349
|
+
* ```
|
|
2350
|
+
*
|
|
2351
|
+
* @example
|
|
2352
|
+
* ```tsx
|
|
2353
|
+
* useDefaultRenderTool({
|
|
2354
|
+
* render: ({ name, status }) => <div>{name}: {status}</div>,
|
|
2355
|
+
* });
|
|
2356
|
+
* ```
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* ```tsx
|
|
2360
|
+
* useDefaultRenderTool(
|
|
2361
|
+
* {
|
|
2362
|
+
* render: ({ name, result }) => (
|
|
2363
|
+
* <ToolEventRow title={name} payload={result} compact={compactMode} />
|
|
2364
|
+
* ),
|
|
2365
|
+
* },
|
|
2366
|
+
* [compactMode],
|
|
2367
|
+
* );
|
|
2368
|
+
* ```
|
|
2369
|
+
*/
|
|
2370
|
+
declare function useDefaultRenderTool(config?: {
|
|
2371
|
+
render?: (props: DefaultRenderProps) => React$1.ReactElement | null;
|
|
2372
|
+
/**
|
|
2373
|
+
* Let the chat group calls your `render` draws, like it groups the
|
|
2374
|
+
* built-in card's (see `toolCallDisplay` on `CopilotChatMessageView`).
|
|
2375
|
+
* Off by default for a custom `render`, since it may draw nothing.
|
|
2376
|
+
*/
|
|
2377
|
+
group?: boolean;
|
|
2378
|
+
}, deps?: ReadonlyArray<unknown>): void;
|
|
2379
|
+
//#endregion
|
|
2380
|
+
//#region src/hooks/use-human-in-the-loop.d.ts
|
|
2381
|
+
declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
|
|
2382
|
+
//#endregion
|
|
2383
|
+
//#region src/hooks/use-agent.d.ts
|
|
2384
|
+
declare enum UseAgentUpdate {
|
|
2385
|
+
OnMessagesChanged = "OnMessagesChanged",
|
|
2386
|
+
OnStateChanged = "OnStateChanged",
|
|
2387
|
+
OnRunStatusChanged = "OnRunStatusChanged"
|
|
2388
|
+
}
|
|
2389
|
+
interface UseAgentPropsBase {
|
|
2390
|
+
updates?: UseAgentUpdate[];
|
|
2391
|
+
/**
|
|
2392
|
+
* Throttle interval (in milliseconds) for re-renders triggered by
|
|
2393
|
+
* `onMessagesChanged` and `onStateChanged` notifications. Useful to reduce
|
|
2394
|
+
* re-render frequency during high-frequency streaming updates.
|
|
2395
|
+
*
|
|
2396
|
+
* Uses a leading+trailing pattern with a shared window — first update
|
|
2397
|
+
* fires immediately, subsequent updates within the window are coalesced,
|
|
2398
|
+
* and a trailing timer ensures the most recent update fires after the
|
|
2399
|
+
* window expires. See `CopilotKitCore.subscribeToAgentWithOptions` in `@copilotkit/core`
|
|
2400
|
+
* for details.
|
|
2401
|
+
*
|
|
2402
|
+
* Resolved as: `throttleMs ?? provider defaultThrottleMs ?? 0`.
|
|
2403
|
+
* Passing `throttleMs={0}` explicitly disables throttling even when the
|
|
2404
|
+
* provider specifies a non-zero `defaultThrottleMs`.
|
|
2405
|
+
*
|
|
2406
|
+
* Run lifecycle callbacks (`onRunInitialized`, `onRunFinalized`,
|
|
2407
|
+
* `onRunFailed`, `onRunErrorEvent`) always fire immediately.
|
|
2408
|
+
*
|
|
2409
|
+
* @default undefined
|
|
2410
|
+
* When unset, inherits from the provider's `defaultThrottleMs`;
|
|
2411
|
+
* if that is also unset, the effective value is `0` (no throttle).
|
|
2412
|
+
*/
|
|
2413
|
+
throttleMs?: number;
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Thread-scoped variant. `agentId`, `runtimeAgentId`, and `threadId` are a
|
|
2417
|
+
* matched set: together they give this hook a *private* agent — registered
|
|
2418
|
+
* under the local `agentId`, routing outbound to `runtimeAgentId` — that is
|
|
2419
|
+
* safe to pin a thread onto. None of the three is meaningful without the other
|
|
2420
|
+
* two, so all are required here.
|
|
2421
|
+
*/
|
|
2422
|
+
interface UseAgentThreadScopedProps {
|
|
2423
|
+
/**
|
|
2424
|
+
* The name to register this hook's proxied agent under.
|
|
2425
|
+
*
|
|
2426
|
+
* Required, and must not already be taken. The usual fallbacks (the chat
|
|
2427
|
+
* configuration's agentId, then `DEFAULT_AGENT_ID`) name agents that already
|
|
2428
|
+
* exist, and registering over one either throws `already registered` or
|
|
2429
|
+
* silently shadows it, depending on whether runtime discovery has landed — so
|
|
2430
|
+
* the caller has to name it.
|
|
2431
|
+
*/
|
|
2432
|
+
agentId: string;
|
|
2433
|
+
/**
|
|
2434
|
+
* Thread to scope the agent's run to. Written onto the underlying agent, so
|
|
2435
|
+
* `/agent/run`, `/agent/connect`, and `/agent/stop` address this thread.
|
|
2436
|
+
*
|
|
2437
|
+
* REQUIRES `runtimeAgentId`. A runtime agent registered under a given id is a
|
|
2438
|
+
* singleton, so writing a per-hook threadId directly onto it would let two
|
|
2439
|
+
* `useAgent` calls that share an `agentId` clobber each other's thread.
|
|
2440
|
+
* Passing a distinct local `agentId` plus the `runtimeAgentId` it routes to
|
|
2441
|
+
* gives this hook a private proxied agent to pin the thread onto instead of a
|
|
2442
|
+
* shared one.
|
|
2443
|
+
*/
|
|
2444
|
+
threadId: string;
|
|
2445
|
+
/**
|
|
2446
|
+
* The id of the runtime agent to route outbound requests to, while this hook
|
|
2447
|
+
* exposes a distinct local `agentId`. Registers a proxied agent via
|
|
2448
|
+
* `CopilotKitCore.registerProxiedAgent`, letting several frontend agents
|
|
2449
|
+
* (e.g. one per open thread) mount against a single runtime agent without a
|
|
2450
|
+
* shared-singleton collision.
|
|
2451
|
+
*
|
|
2452
|
+
* When set, `agentId` is the *local* registry id (must not collide with an
|
|
2453
|
+
* existing local or runtime-discovered agent) and `runtimeAgentId` is the
|
|
2454
|
+
* runtime agent the proxy addresses on `/agent/run` etc.
|
|
2455
|
+
*
|
|
2456
|
+
* REQUIRES `threadId`. Registering a private agent is only worth doing to
|
|
2457
|
+
* scope a thread to it; without a `threadId` the private agent would take its
|
|
2458
|
+
* thread from the chat configuration, which is what binding to the shared
|
|
2459
|
+
* agent via `agentId` alone already does — just with an extra registration
|
|
2460
|
+
* and a local id to keep unique.
|
|
2461
|
+
*/
|
|
2462
|
+
runtimeAgentId: string;
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Default variant: neither `threadId` nor `runtimeAgentId`. The hook binds to
|
|
2466
|
+
* the shared agent registered under `agentId` and leaves its threadId to the
|
|
2467
|
+
* chat configuration (or to the agent's own auto-minted UUID).
|
|
2468
|
+
*
|
|
2469
|
+
* Both props are typed `undefined` here rather than omitted so that supplying
|
|
2470
|
+
* either one on its own fails to match *both* branches — that is the
|
|
2471
|
+
* type-level enforcement of the all-or-nothing rule.
|
|
2472
|
+
*/
|
|
2473
|
+
interface UseAgentUnscopedProps {
|
|
2474
|
+
/**
|
|
2475
|
+
* Agent to bind to. Resolution precedence: this property, then the surrounding
|
|
2476
|
+
* chat configuration's agentId, then the global default.
|
|
2477
|
+
*/
|
|
2478
|
+
agentId?: string;
|
|
2479
|
+
/** Requires `runtimeAgentId`. See {@link UseAgentThreadScopedProps.threadId}. */
|
|
2480
|
+
threadId?: undefined;
|
|
2481
|
+
/** Requires `threadId`. See {@link UseAgentThreadScopedProps.runtimeAgentId}. */
|
|
2482
|
+
runtimeAgentId?: undefined;
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Props for {@link useAgent}.
|
|
2486
|
+
*
|
|
2487
|
+
* There are exactly two valid shapes, and the type admits nothing in between:
|
|
2488
|
+
*
|
|
2489
|
+
* - **Bind to an agent** — `useAgent()`, `useAgent({ agentId })`. The shared
|
|
2490
|
+
* instance from the registry; the thread comes from the chat configuration.
|
|
2491
|
+
* - **Bind a private agent to a thread** —
|
|
2492
|
+
* `useAgent({ agentId, runtimeAgentId, threadId })`. All three required.
|
|
2493
|
+
*
|
|
2494
|
+
* So `useAgent({ agentId, threadId })`, `useAgent({ agentId, runtimeAgentId })`,
|
|
2495
|
+
* and `useAgent({ runtimeAgentId, threadId })` are all compile errors. Each
|
|
2496
|
+
* partial combination is either unsafe (a thread scoped onto a shared singleton)
|
|
2497
|
+
* or pointless (a private agent with no thread, or one registered over an id
|
|
2498
|
+
* that already belongs to a real agent).
|
|
2499
|
+
*/
|
|
2500
|
+
type UseAgentProps = UseAgentPropsBase & (UseAgentThreadScopedProps | UseAgentUnscopedProps);
|
|
2501
|
+
declare function useAgent({
|
|
2502
|
+
agentId,
|
|
2503
|
+
threadId,
|
|
2504
|
+
runtimeAgentId,
|
|
2505
|
+
updates,
|
|
2506
|
+
throttleMs
|
|
2507
|
+
}?: UseAgentProps): {
|
|
2508
|
+
agent: AbstractAgent$1;
|
|
2509
|
+
/**
|
|
2510
|
+
* Whether `agent` is the real, runtime-synced (or locally-registered) agent
|
|
2511
|
+
* rather than a provisional stand-in returned while the runtime is still
|
|
2512
|
+
* connecting (or in an error state).
|
|
2513
|
+
*
|
|
2514
|
+
* `agent` is always a fully-constructed `AbstractAgent`, so calling
|
|
2515
|
+
* `agent.subscribe(...)`, `agent.setState(...)`, etc. is always safe. But
|
|
2516
|
+
* while `isReady` is `false` the instance is a placeholder that will be
|
|
2517
|
+
* swapped for the real agent once the runtime `/info` sync resolves, at
|
|
2518
|
+
* which point `agent` changes reference and dependent effects re-run.
|
|
2519
|
+
* Guard on `isReady` when you only want to act against the real agent —
|
|
2520
|
+
* e.g. subscribing to run-lifecycle events you don't want to miss during
|
|
2521
|
+
* the provisional window (#5000).
|
|
2522
|
+
*/
|
|
2523
|
+
isReady: boolean;
|
|
2524
|
+
};
|
|
2525
|
+
//#endregion
|
|
2526
|
+
//#region src/hooks/use-capabilities.d.ts
|
|
2527
|
+
/**
|
|
2528
|
+
* Returns the capabilities declared by the given agent (or the agent resolved
|
|
2529
|
+
* from the surrounding chat configuration, falling back to the default agent).
|
|
2530
|
+
* Capabilities are populated from the runtime `/info` response at connection
|
|
2531
|
+
* time. The hook reads them synchronously from the agent instance — there is
|
|
2532
|
+
* no separate loading state, but the value will be `undefined` until the
|
|
2533
|
+
* runtime handshake completes.
|
|
2534
|
+
*
|
|
2535
|
+
* @param agentId - Optional agent ID. If omitted, inherits the surrounding
|
|
2536
|
+
* chat configuration's agent, falling back to the default agent.
|
|
2537
|
+
* @returns The agent's capabilities, or `undefined` if the agent doesn't
|
|
2538
|
+
* declare capabilities.
|
|
2539
|
+
*/
|
|
2540
|
+
declare function useCapabilities(agentId?: string): AgentCapabilities$1 | undefined;
|
|
2541
|
+
//#endregion
|
|
2542
|
+
//#region src/hooks/use-agent-context.d.ts
|
|
2543
|
+
/**
|
|
2544
|
+
* Represents any value that can be serialized to JSON.
|
|
2545
|
+
*/
|
|
2546
|
+
type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
|
|
2547
|
+
[key: string]: JsonSerializable;
|
|
2548
|
+
};
|
|
2549
|
+
/**
|
|
2550
|
+
* Context configuration for useAgentContext.
|
|
2551
|
+
* Accepts any JSON-serializable value which will be converted to a string.
|
|
2552
|
+
*/
|
|
2553
|
+
interface AgentContextInput {
|
|
2554
|
+
/** A human-readable description of what this context represents */
|
|
2555
|
+
description: string;
|
|
2556
|
+
/** The context value - will be converted to a JSON string if not already a string */
|
|
2557
|
+
value: JsonSerializable;
|
|
2558
|
+
}
|
|
2559
|
+
declare function useAgentContext(context: AgentContextInput): void;
|
|
2560
|
+
//#endregion
|
|
2561
|
+
//#region src/hooks/use-suggestions.d.ts
|
|
2562
|
+
interface UseSuggestionsOptions {
|
|
2563
|
+
agentId?: string;
|
|
2564
|
+
}
|
|
2565
|
+
interface UseSuggestionsResult {
|
|
2566
|
+
suggestions: Suggestion$1[];
|
|
2567
|
+
reloadSuggestions: () => void;
|
|
2568
|
+
clearSuggestions: () => void;
|
|
2569
|
+
isLoading: boolean;
|
|
2570
|
+
}
|
|
2571
|
+
declare function useSuggestions({
|
|
2572
|
+
agentId
|
|
2573
|
+
}?: UseSuggestionsOptions): UseSuggestionsResult;
|
|
2574
|
+
//#endregion
|
|
2575
|
+
//#region src/hooks/use-configure-suggestions.d.ts
|
|
2576
|
+
type StaticSuggestionInput = Omit<Suggestion$1, "isLoading"> & Partial<Pick<Suggestion$1, "isLoading">>;
|
|
2577
|
+
type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig$1, "suggestions"> & {
|
|
2578
|
+
suggestions: StaticSuggestionInput[];
|
|
2579
|
+
};
|
|
2580
|
+
type SuggestionsConfigInput = DynamicSuggestionsConfig$1 | StaticSuggestionsConfigInput;
|
|
2581
|
+
declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
|
|
2582
|
+
//#endregion
|
|
2583
|
+
//#region src/hooks/use-interrupt.d.ts
|
|
2584
|
+
type InterruptHandlerFn<TValue, TResult> = (props: InterruptHandlerProps<TValue>) => TResult | PromiseLike<TResult>;
|
|
2585
|
+
type InterruptResultFromHandler<THandler> = THandler extends ((...args: never[]) => infer TResult) ? TResult extends PromiseLike<infer TResolved> ? TResolved | null : TResult | null : null;
|
|
2586
|
+
type InterruptResult<TValue, TResult> = InterruptResultFromHandler<InterruptHandlerFn<TValue, TResult>>;
|
|
2587
|
+
type InterruptRenderInChat = boolean | undefined;
|
|
2588
|
+
type UseInterruptReturn<TRenderInChat extends InterruptRenderInChat> = TRenderInChat extends false ? React$1.ReactElement | null : TRenderInChat extends true | undefined ? void : React$1.ReactElement | null | void;
|
|
2589
|
+
/** Recognize thenables returned by interrupt preprocessing handlers. */
|
|
2590
|
+
/**
|
|
2591
|
+
* Configuration options for `useInterrupt`.
|
|
2592
|
+
*/
|
|
2593
|
+
interface UseInterruptConfigBase<TValue = unknown, TResult = never> {
|
|
2594
|
+
/**
|
|
2595
|
+
* Render function for the interrupt UI.
|
|
2596
|
+
*
|
|
2597
|
+
* Receives both the standard `interrupt`/`interrupts` and the legacy `event`.
|
|
2598
|
+
* Call `resolve(payload)` to resume with user input, or `cancel()` to cancel.
|
|
2599
|
+
*/
|
|
2600
|
+
render: (props: InterruptRenderProps<TValue, InterruptResult<TValue, TResult>>) => React$1.ReactElement;
|
|
2601
|
+
/**
|
|
2602
|
+
* Optional pre-render handler invoked when an interrupt is received.
|
|
2603
|
+
* Return a sync or async value to expose as `result` in `render`.
|
|
2604
|
+
* Rejecting/throwing falls back to `result = null`.
|
|
2605
|
+
*/
|
|
2606
|
+
handler?: InterruptHandlerFn<TValue, TResult>;
|
|
2607
|
+
/**
|
|
2608
|
+
* Optional predicate to filter which interrupts this hook handles.
|
|
2609
|
+
* Receives the legacy-compatible event (for standard interrupts, `value` is
|
|
2610
|
+
* the primary `Interrupt`). Return `false` to ignore.
|
|
2611
|
+
*/
|
|
2612
|
+
enabled?: (event: InterruptEvent<TValue>) => boolean;
|
|
2613
|
+
/** Optional agent id. Defaults to the current configured chat agent. */
|
|
2614
|
+
agentId?: string;
|
|
2615
|
+
}
|
|
2616
|
+
type UseInterruptConfig<TValue = unknown, TResult = never, TRenderInChat extends InterruptRenderInChat = undefined> = UseInterruptConfigBase<TValue, TResult> & {
|
|
2617
|
+
/** When true (default), the interrupt UI renders inside `<CopilotChat>` automatically. */renderInChat?: TRenderInChat;
|
|
2618
|
+
};
|
|
2619
|
+
/**
|
|
2620
|
+
* Handles agent interrupts with optional filtering, preprocessing, and resume behavior.
|
|
2621
|
+
*
|
|
2622
|
+
* Supports both the AG-UI standard interrupt flow (`RUN_FINISHED` with
|
|
2623
|
+
* `outcome.type === "interrupt"`) and the legacy custom-event flow
|
|
2624
|
+
* (`on_interrupt`). For standard interrupts, `render` receives `interrupt`
|
|
2625
|
+
* (the primary one) and `interrupts` (the full open set); call `resolve(payload)`
|
|
2626
|
+
* to resume or `cancel()` to cancel. Resuming addresses the targeted interrupt
|
|
2627
|
+
* and, once every open interrupt is addressed, submits a single spec `resume`
|
|
2628
|
+
* array via `copilotkit.runAgent`.
|
|
2629
|
+
*
|
|
2630
|
+
* - `renderInChat: true` (default): the element is published into `<CopilotChat>`; returns `void`.
|
|
2631
|
+
* - `renderInChat: false`: the hook returns the interrupt element for manual placement.
|
|
2632
|
+
*
|
|
2633
|
+
* @example
|
|
2634
|
+
* ```tsx
|
|
2635
|
+
* useInterrupt({
|
|
2636
|
+
* render: ({ interrupt, resolve, cancel }) => (
|
|
2637
|
+
* <div>
|
|
2638
|
+
* <p>{interrupt?.message}</p>
|
|
2639
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
2640
|
+
* <button onClick={() => cancel()}>Cancel</button>
|
|
2641
|
+
* </div>
|
|
2642
|
+
* ),
|
|
2643
|
+
* });
|
|
2644
|
+
* ```
|
|
2645
|
+
*/
|
|
2646
|
+
declare function useInterrupt<TResult = never, TRenderInChat extends InterruptRenderInChat = undefined>(config: UseInterruptConfig<any, TResult, TRenderInChat>): UseInterruptReturn<TRenderInChat>;
|
|
2647
|
+
//#endregion
|
|
2648
|
+
//#region src/hooks/use-memories.d.ts
|
|
2649
|
+
/**
|
|
2650
|
+
* Return value of the {@link useMemories} hook.
|
|
2651
|
+
*
|
|
2652
|
+
* The `memories` array is the server-authoritative list for the current user.
|
|
2653
|
+
* It is hydrated from a REST snapshot and kept current by realtime
|
|
2654
|
+
* `memory_metadata` deltas from the store's own channel. Mutations resolve
|
|
2655
|
+
* once the platform confirms the operation and reject with an `Error` on
|
|
2656
|
+
* failure.
|
|
2657
|
+
*/
|
|
2658
|
+
interface UseMemoriesResult {
|
|
2659
|
+
/**
|
|
2660
|
+
* Memories for the current user, newest first. Updated in realtime when
|
|
2661
|
+
* the platform pushes `memory_metadata` events.
|
|
2662
|
+
*/
|
|
2663
|
+
memories: Memory$1[];
|
|
2664
|
+
/**
|
|
2665
|
+
* `true` while the initial memory snapshot is being fetched. Subsequent
|
|
2666
|
+
* realtime updates do not re-enter the loading state.
|
|
2667
|
+
*/
|
|
2668
|
+
isLoading: boolean;
|
|
2669
|
+
/**
|
|
2670
|
+
* The most recent error from fetching memories or executing a mutation, or
|
|
2671
|
+
* `null` when there is no error. Cleared on the next fetch attempt, on a
|
|
2672
|
+
* successful fetch, when the runtime context changes, and on a successful
|
|
2673
|
+
* mutation (a failed mutation replaces it with that mutation's error).
|
|
2674
|
+
*/
|
|
2675
|
+
error: Error | null;
|
|
2676
|
+
/**
|
|
2677
|
+
* `true` when the platform memory routes are available. Set to `false`
|
|
2678
|
+
* after a 404 or 501, indicating memory is not supported by the current
|
|
2679
|
+
* runtime configuration.
|
|
2680
|
+
*/
|
|
2681
|
+
isAvailable: boolean;
|
|
2682
|
+
/**
|
|
2683
|
+
* Health of the realtime connection that streams live `memory_metadata`
|
|
2684
|
+
* deltas. Distinct from `isAvailable`/`error` (which describe the REST list
|
|
2685
|
+
* route): `"connecting"` while the socket opens/joins, `"connected"` once
|
|
2686
|
+
* live deltas are flowing, and `"unavailable"` once the socket permanently
|
|
2687
|
+
* gives up — at which point the list is a frozen snapshot. Lets the UI drop a
|
|
2688
|
+
* "live" indicator instead of showing it over stale data.
|
|
2689
|
+
*/
|
|
2690
|
+
realtimeStatus: MemoryRealtimeStatus$1;
|
|
2691
|
+
/**
|
|
2692
|
+
* Re-fetch the memory snapshot from the platform. Resolves once the re-pull
|
|
2693
|
+
* settles; rejects if it fails or the store is torn down mid-flight.
|
|
2694
|
+
*/
|
|
2695
|
+
refresh: () => Promise<void>;
|
|
2696
|
+
/**
|
|
2697
|
+
* Create a memory. Resolves to the stored memory (server-authoritative);
|
|
2698
|
+
* rejects on failure.
|
|
2699
|
+
*/
|
|
2700
|
+
addMemory: (input: NewMemory$1) => Promise<Memory$1>;
|
|
2701
|
+
/**
|
|
2702
|
+
* Supersede a memory: the old memory is retired and a new one is created.
|
|
2703
|
+
* Resolves to the new memory (its `id` differs from `id`); rejects on
|
|
2704
|
+
* failure.
|
|
2705
|
+
*
|
|
2706
|
+
* Supersede is a FULL replacement, not a partial patch: `changes` is the
|
|
2707
|
+
* complete definition of the new memory. You must re-supply `content` and
|
|
2708
|
+
* `kind`, and an omitted `sourceThreadIds` resets the new memory's source
|
|
2709
|
+
* threads to empty — it does not preserve the prior memory's value.
|
|
2710
|
+
*/
|
|
2711
|
+
updateMemory: (id: string, changes: MemoryChanges$1) => Promise<Memory$1>;
|
|
2712
|
+
/**
|
|
2713
|
+
* Retire a memory (non-lossy delete). Resolves when the server confirms;
|
|
2714
|
+
* rejects on failure.
|
|
2715
|
+
*/
|
|
2716
|
+
removeMemory: (id: string) => Promise<void>;
|
|
2717
|
+
}
|
|
2718
|
+
/**
|
|
2719
|
+
* React hook for listing and managing platform memories.
|
|
2720
|
+
*
|
|
2721
|
+
* Reads the memory store owned and wired by `CopilotKitCore`. On mount the
|
|
2722
|
+
* hook exposes the live list plus stable `addMemory` / `updateMemory` /
|
|
2723
|
+
* `removeMemory` / `refresh` callbacks. Mutations are server-authoritative:
|
|
2724
|
+
* each resolves once the platform confirms the operation and rejects with an
|
|
2725
|
+
* `Error` on failure.
|
|
2726
|
+
*
|
|
2727
|
+
* Realtime updates are automatic: the core's memory store opens its own
|
|
2728
|
+
* `user_meta:memories:<joinCode>` channel and applies `memory_metadata` deltas
|
|
2729
|
+
* to the list. You can still call `refresh()` to re-pull the REST snapshot on
|
|
2730
|
+
* demand.
|
|
2731
|
+
*
|
|
2732
|
+
* @returns Memory list state and stable mutation callbacks.
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
* ```tsx
|
|
2736
|
+
* import { useMemories } from "@copilotkit/react-core";
|
|
2737
|
+
*
|
|
2738
|
+
* function MemoryList() {
|
|
2739
|
+
* const { memories, isLoading, isAvailable, addMemory, removeMemory } =
|
|
2740
|
+
* useMemories();
|
|
2741
|
+
*
|
|
2742
|
+
* if (!isAvailable) return null;
|
|
2743
|
+
* if (isLoading) return <p>Loading…</p>;
|
|
2744
|
+
*
|
|
2745
|
+
* return (
|
|
2746
|
+
* <ul>
|
|
2747
|
+
* {memories.map((m) => (
|
|
2748
|
+
* <li key={m.id}>
|
|
2749
|
+
* {m.content}
|
|
2750
|
+
* <button onClick={() => removeMemory(m.id)}>Delete</button>
|
|
2751
|
+
* </li>
|
|
2752
|
+
* ))}
|
|
2753
|
+
* </ul>
|
|
2754
|
+
* );
|
|
2755
|
+
* }
|
|
2756
|
+
* ```
|
|
2757
|
+
*/
|
|
2758
|
+
declare function useMemories(): UseMemoriesResult;
|
|
2759
|
+
//#endregion
|
|
2760
|
+
//#region src/hooks/use-learn-from-user-action.d.ts
|
|
2761
|
+
/**
|
|
2762
|
+
* Input to {@link UseLearnFromUserActionRecorder}, the function returned
|
|
2763
|
+
* by {@link useLearnFromUserAction}. Captures a single UI interaction that
|
|
2764
|
+
* CopilotKit Intelligence's auto-curated knowledge base loop will distill
|
|
2765
|
+
* into the team's `/project` notes.
|
|
2766
|
+
*/
|
|
2767
|
+
interface LearnFromUserActionInput {
|
|
2768
|
+
/** Thread the action is associated with. May be unknown to the platform. */
|
|
2769
|
+
threadId: string;
|
|
2770
|
+
/** Short, agent-readable summary of what the user did. Optional. */
|
|
2771
|
+
title?: string | null;
|
|
2772
|
+
/** Optional longer explanation. */
|
|
2773
|
+
description?: string | null;
|
|
2774
|
+
/** Free-form, JSON-serializable snapshot describing the action. Optional. */
|
|
2775
|
+
data?: unknown;
|
|
2776
|
+
/** ISO-8601 client-asserted timestamp. Defaults to server NOW() when absent. */
|
|
2777
|
+
occurredAt?: string;
|
|
2778
|
+
/**
|
|
2779
|
+
* Caller-supplied idempotency key. When omitted, `recordAnnotation` generates a
|
|
2780
|
+
* fresh UUID per call so retries collapse to the original row at the
|
|
2781
|
+
* platform. Supply your own to keep a single semantic event idempotent
|
|
2782
|
+
* across calls (e.g. a React re-render or a manual retry button).
|
|
2783
|
+
*/
|
|
2784
|
+
clientEventId?: string;
|
|
2785
|
+
}
|
|
2786
|
+
/** Outcome returned by the recorder function. */
|
|
2787
|
+
interface LearnFromUserActionResult {
|
|
2788
|
+
/** Platform-assigned id of the user-action row. */
|
|
2789
|
+
id: string;
|
|
2790
|
+
/** True when the platform recognized this `clientEventId` as a retry. */
|
|
2791
|
+
duplicate: boolean;
|
|
2792
|
+
}
|
|
2793
|
+
/** Recorder function returned by {@link useLearnFromUserAction}. */
|
|
2794
|
+
type UseLearnFromUserActionRecorder = (input: LearnFromUserActionInput) => Promise<LearnFromUserActionResult>;
|
|
2795
|
+
/**
|
|
2796
|
+
* Record a user UI interaction in CopilotKit Intelligence's user-actions
|
|
2797
|
+
* stream. The platform's auto-curated knowledge base agent reads these
|
|
2798
|
+
* (alongside finished agent runs) and writes free-form Obsidian-flavored
|
|
2799
|
+
* markdown to `/project`, where any agent in the same project can later
|
|
2800
|
+
* read it via the `copilotkit_knowledge_base_shell` MCP tool.
|
|
2801
|
+
*
|
|
2802
|
+
* The hook returns a stable function. Calling it issues a request to the
|
|
2803
|
+
* customer's CopilotKit runtime (`POST ${runtimeUrl}/annotate`), which
|
|
2804
|
+
* resolves the Intel user from the BFF's auth and forwards to the
|
|
2805
|
+
* platform — the Intel API key never reaches the browser.
|
|
2806
|
+
*
|
|
2807
|
+
* If `clientEventId` is omitted `recordAnnotation` generates a UUID per call,
|
|
2808
|
+
* so a naive double-call (e.g. React 18 strict-mode double-mount, or a retry
|
|
2809
|
+
* after a network blip on a fresh Promise) is naturally safe. Supply your
|
|
2810
|
+
* own key when a single semantic event must remain idempotent across
|
|
2811
|
+
* multiple `learnFromUserAction(...)` calls.
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
* ```tsx
|
|
2815
|
+
* import { useLearnFromUserAction } from "@copilotkit/react-core";
|
|
2816
|
+
*
|
|
2817
|
+
* function SettingsPage({ threadId }) {
|
|
2818
|
+
* const learnFromUserAction = useLearnFromUserAction();
|
|
2819
|
+
*
|
|
2820
|
+
* const onRename = (oldName: string, newName: string) => {
|
|
2821
|
+
* void learnFromUserAction({
|
|
2822
|
+
* threadId,
|
|
2823
|
+
* title: "Renamed project",
|
|
2824
|
+
* data: { previous: { name: oldName }, next: { name: newName } },
|
|
2825
|
+
* });
|
|
2826
|
+
* };
|
|
2827
|
+
* }
|
|
2828
|
+
* ```
|
|
2829
|
+
*/
|
|
2830
|
+
declare function useLearnFromUserAction(): UseLearnFromUserActionRecorder;
|
|
2831
|
+
//#endregion
|
|
2832
|
+
//#region src/hooks/use-learn-from-user-action-in-current-thread.d.ts
|
|
2833
|
+
/**
|
|
2834
|
+
* Input to {@link UseLearnFromUserActionInCurrentThreadRecorder} — same as
|
|
2835
|
+
* {@link LearnFromUserActionInput} minus `threadId`, which is sourced from
|
|
2836
|
+
* the surrounding `<CopilotChatConfigurationProvider>` at call time.
|
|
2837
|
+
*/
|
|
2838
|
+
type LearnFromUserActionInCurrentThreadInput = Omit<LearnFromUserActionInput, "threadId">;
|
|
2839
|
+
/** Recorder function returned by {@link useLearnFromUserActionInCurrentThread}. */
|
|
2840
|
+
type UseLearnFromUserActionInCurrentThreadRecorder = (input: LearnFromUserActionInCurrentThreadInput) => Promise<LearnFromUserActionResult>;
|
|
2841
|
+
/**
|
|
2842
|
+
* Record a user UI interaction against the **current chat's** thread. The
|
|
2843
|
+
* `threadId` is sourced from the surrounding
|
|
2844
|
+
* `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
|
|
2845
|
+
* `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
|
|
2846
|
+
* subtree don't need to thread an id through manually.
|
|
2847
|
+
*
|
|
2848
|
+
* Throws on **call** (not on mount) when there is no chat-config provider
|
|
2849
|
+
* in scope — matches the "throw on call when runtimeUrl is missing"
|
|
2850
|
+
* behavior of {@link useLearnFromUserAction}. Mounting the hook in a branch
|
|
2851
|
+
* that never fires is harmless.
|
|
2852
|
+
*
|
|
2853
|
+
* The recorder does NOT accept a `threadId` override. If you need to
|
|
2854
|
+
* record against an explicit thread, use {@link useLearnFromUserAction}
|
|
2855
|
+
* directly — two hooks, two crisp contracts, no mode confusion.
|
|
2856
|
+
*
|
|
2857
|
+
* This hook always uses `config.threadId`, regardless of whether the
|
|
2858
|
+
* surrounding chat config minted it internally or received one from
|
|
2859
|
+
* the caller. Auto-minted threads simply mean the action lands under
|
|
2860
|
+
* a thread the platform never saw — the writer agent still distills
|
|
2861
|
+
* user-action-only threads (it does not require the thread to exist
|
|
2862
|
+
* in `cpki.threads`), so the loop keeps learning.
|
|
2863
|
+
*
|
|
2864
|
+
* @example
|
|
2865
|
+
* ```tsx
|
|
2866
|
+
* import { useLearnFromUserActionInCurrentThread } from "@copilotkit/react-core";
|
|
2867
|
+
*
|
|
2868
|
+
* function SettingsPanel() {
|
|
2869
|
+
* const learnFromUserAction = useLearnFromUserActionInCurrentThread();
|
|
2870
|
+
*
|
|
2871
|
+
* const onRename = (oldName: string, newName: string) => {
|
|
2872
|
+
* void learnFromUserAction({
|
|
2873
|
+
* title: "Renamed project",
|
|
2874
|
+
* data: { previous: { name: oldName }, next: { name: newName } },
|
|
2875
|
+
* });
|
|
2876
|
+
* };
|
|
2877
|
+
*
|
|
2878
|
+
* // ...
|
|
2879
|
+
* }
|
|
2880
|
+
* ```
|
|
2881
|
+
*/
|
|
2882
|
+
declare function useLearnFromUserActionInCurrentThread(): UseLearnFromUserActionInCurrentThreadRecorder;
|
|
2883
|
+
//#endregion
|
|
2884
|
+
//#region src/hooks/use-attachments.d.ts
|
|
2885
|
+
interface UseAttachmentsProps {
|
|
2886
|
+
config?: AttachmentsConfig$1;
|
|
2887
|
+
}
|
|
2888
|
+
interface UseAttachmentsReturn {
|
|
2889
|
+
/** Currently selected attachments (uploading + ready). */
|
|
2890
|
+
attachments: Attachment$1[];
|
|
2891
|
+
/** Whether attachments are enabled. */
|
|
2892
|
+
enabled: boolean;
|
|
2893
|
+
/** Whether the user is dragging a file over the drop zone. */
|
|
2894
|
+
dragOver: boolean;
|
|
2895
|
+
/** Ref for the hidden file input element. */
|
|
2896
|
+
fileInputRef: React$1.RefObject<HTMLInputElement | null>;
|
|
2897
|
+
/** Ref for the container element (used for scoped paste handling). */
|
|
2898
|
+
containerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
2899
|
+
/** Process an array of files (validate, upload, add to state). */
|
|
2900
|
+
processFiles: (files: File[]) => Promise<void>;
|
|
2901
|
+
/** Handler for `<input type="file" onChange>`. */
|
|
2902
|
+
handleFileUpload: (e: React$1.ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
2903
|
+
/** Handler for `onDragOver` on the drop zone. */
|
|
2904
|
+
handleDragOver: (e: React$1.DragEvent) => void;
|
|
2905
|
+
/** Handler for `onDragLeave` on the drop zone. */
|
|
2906
|
+
handleDragLeave: (e: React$1.DragEvent) => void;
|
|
2907
|
+
/** Handler for `onDrop` on the drop zone. */
|
|
2908
|
+
handleDrop: (e: React$1.DragEvent) => Promise<void>;
|
|
2909
|
+
/** Remove an attachment by ID. */
|
|
2910
|
+
removeAttachment: (id: string) => void;
|
|
2911
|
+
/**
|
|
2912
|
+
* Consume ready attachments and clear the queue.
|
|
2913
|
+
* Returns the attachments that were ready; resets the file input.
|
|
2914
|
+
* No-ops if the queue is already empty (no state update triggered).
|
|
2915
|
+
*/
|
|
2916
|
+
consumeAttachments: () => Attachment$1[];
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Hook that manages file attachment state — uploads, drag-and-drop, paste,
|
|
2920
|
+
* and lifecycle. All returned callbacks are referentially stable across
|
|
2921
|
+
* renders (via useCallback) to avoid destabilizing downstream memoization.
|
|
2922
|
+
*/
|
|
2923
|
+
declare function useAttachments({
|
|
2924
|
+
config
|
|
2925
|
+
}: UseAttachmentsProps): UseAttachmentsReturn;
|
|
2926
|
+
//#endregion
|
|
2927
|
+
//#region src/hooks/use-learning-containers.d.ts
|
|
2928
|
+
/**
|
|
2929
|
+
* Arguments for {@link useLearningContainers}.
|
|
2930
|
+
*
|
|
2931
|
+
* @deprecated This interface supports only the legacy plural-container
|
|
2932
|
+
* annotation. Configure `getLearningContainerId` on `CopilotKitIntelligence`
|
|
2933
|
+
* for new Intelligence runtimes.
|
|
2934
|
+
*/
|
|
2935
|
+
interface UseLearningContainersArgs {
|
|
2936
|
+
/** Thread to apply the learning-container selection to. */
|
|
2937
|
+
threadId: string;
|
|
2938
|
+
/**
|
|
2939
|
+
* The ordered list of learning container identifiers to activate for this
|
|
2940
|
+
* thread. Defaults to `["project"]` on the backend when absent.
|
|
2941
|
+
*/
|
|
2942
|
+
learningContainers: readonly string[];
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* Legacy compatibility hook that keeps a thread's plural learning-container
|
|
2946
|
+
* annotation in sync by emitting
|
|
2947
|
+
* `set_learning_containers` annotations via the CopilotKit runtime annotate
|
|
2948
|
+
* endpoint (`POST ${runtimeUrl}/annotate`).
|
|
2949
|
+
*
|
|
2950
|
+
* **Emit rules:**
|
|
2951
|
+
* - On mount with `["project"]` (the backend default) → does NOT emit.
|
|
2952
|
+
* Absence of an annotation equals the default, so the round-trip is skipped.
|
|
2953
|
+
* - On mount with any other value → emits immediately.
|
|
2954
|
+
* - On any subsequent content change (including a switch back to
|
|
2955
|
+
* `["project"]`) → emits (a deliberate switch is always recorded).
|
|
2956
|
+
* - On unmount or threadId change → emits a reset to `["project"]`
|
|
2957
|
+
* so the backend is left in a clean state for the next consumer.
|
|
2958
|
+
* Changing `learningContainers` within the same thread does NOT reset the
|
|
2959
|
+
* thread; only the new value is emitted.
|
|
2960
|
+
*
|
|
2961
|
+
* Content-equality is evaluated via `JSON.stringify` so a fresh array literal
|
|
2962
|
+
* with the same items does NOT trigger a redundant emit.
|
|
2963
|
+
*
|
|
2964
|
+
* If `runtimeUrl` is absent, all emits are silently skipped.
|
|
2965
|
+
*
|
|
2966
|
+
* @example
|
|
2967
|
+
* ```tsx
|
|
2968
|
+
* function ThreadPane({ threadId, userScope }: Props) {
|
|
2969
|
+
* useLearningContainers({
|
|
2970
|
+
* threadId,
|
|
2971
|
+
* learningContainers: [userScope],
|
|
2972
|
+
* });
|
|
2973
|
+
* // ...
|
|
2974
|
+
* }
|
|
2975
|
+
* ```
|
|
2976
|
+
*
|
|
2977
|
+
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
2978
|
+
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
2979
|
+
* Intelligence runtimes.
|
|
2980
|
+
*/
|
|
2981
|
+
declare function useLearningContainers({
|
|
2982
|
+
threadId,
|
|
2983
|
+
learningContainers
|
|
2984
|
+
}: UseLearningContainersArgs): void;
|
|
2985
|
+
//#endregion
|
|
2986
|
+
//#region src/hooks/use-learning-containers-in-current-thread.d.ts
|
|
2987
|
+
/**
|
|
2988
|
+
* Arguments for {@link useLearningContainersInCurrentThread}.
|
|
2989
|
+
* Same as {@link UseLearningContainersArgs} minus `threadId`, which is
|
|
2990
|
+
* sourced from the surrounding `<CopilotChatConfigurationProvider>` at
|
|
2991
|
+
* render time.
|
|
2992
|
+
*
|
|
2993
|
+
* @deprecated This type supports only the legacy plural-container annotation.
|
|
2994
|
+
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
2995
|
+
* Intelligence runtimes.
|
|
2996
|
+
*/
|
|
2997
|
+
type UseLearningContainersInCurrentThreadArgs = Omit<UseLearningContainersArgs, "threadId">;
|
|
2998
|
+
/**
|
|
2999
|
+
* Legacy compatibility hook that keeps the **current chat thread's** plural
|
|
3000
|
+
* learning-container annotation in sync. The `threadId` is sourced from the surrounding
|
|
3001
|
+
* `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
|
|
3002
|
+
* `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
|
|
3003
|
+
* subtree don't need to thread an id through manually.
|
|
3004
|
+
*
|
|
3005
|
+
* **Throws on render** when there is no chat-config provider in scope or
|
|
3006
|
+
* when the provider does not yet have an active `threadId`. Mount the hook
|
|
3007
|
+
* inside a subtree that is guaranteed to have a thread context.
|
|
3008
|
+
*
|
|
3009
|
+
* If you need to manage an explicit thread, use {@link useLearningContainers}
|
|
3010
|
+
* directly — two hooks, two crisp contracts, no mode confusion.
|
|
3011
|
+
*
|
|
3012
|
+
* @throws When no `CopilotChatConfigurationProvider` is in scope or when the
|
|
3013
|
+
* active `threadId` is absent/empty.
|
|
3014
|
+
*
|
|
3015
|
+
* @example
|
|
3016
|
+
* ```tsx
|
|
3017
|
+
* function ThreadPanel({ scope }: Props) {
|
|
3018
|
+
* useLearningContainersInCurrentThread({
|
|
3019
|
+
* learningContainers: [scope],
|
|
3020
|
+
* });
|
|
3021
|
+
* // ...
|
|
3022
|
+
* }
|
|
3023
|
+
* ```
|
|
3024
|
+
*
|
|
3025
|
+
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
3026
|
+
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
3027
|
+
* Intelligence runtimes.
|
|
3028
|
+
*/
|
|
3029
|
+
declare function useLearningContainersInCurrentThread({
|
|
3030
|
+
learningContainers
|
|
3031
|
+
}: UseLearningContainersInCurrentThreadArgs): void;
|
|
3032
|
+
//#endregion
|
|
3033
|
+
//#region src/a2ui/A2UIRecoveryStates.d.ts
|
|
3034
|
+
/**
|
|
3035
|
+
* Shared pre-paint lifecycle states for the A2UI surface renderer (OSS-162).
|
|
3036
|
+
*
|
|
3037
|
+
* The A2UI middleware drives the WHOLE generative-UI lifecycle on a single
|
|
3038
|
+
* `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
|
|
3039
|
+
* below swap IN PLACE and the painted surface ultimately replaces them:
|
|
3040
|
+
*
|
|
3041
|
+
* building → animated skeleton + "Building interface" (+ optional ~N tokens)
|
|
3042
|
+
* retrying → same skeleton; once perceptible, the sub-label becomes
|
|
3043
|
+
* "Retrying generation… (N/M attempts)" (threshold-gated so a fast
|
|
3044
|
+
* transient retry never flashes), with debug detail per debugExposure
|
|
3045
|
+
* failed → a clean hard-failure card (replacing the skeleton), developer
|
|
3046
|
+
* detail tucked into an expander gated by debugExposure
|
|
3047
|
+
* painted → the surface renderer owns the UI (these states render nothing)
|
|
3048
|
+
*
|
|
3049
|
+
* Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to surface
|
|
3050
|
+
* (`debugExposure`) are client concerns; the server can override `debugExposure`
|
|
3051
|
+
* by stamping it onto the activity content (it wins over the client option).
|
|
3052
|
+
*/
|
|
3053
|
+
type A2UIRecoveryRendererOptions = {
|
|
3054
|
+
/** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */showAfterMs?: number; /** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
|
|
3055
|
+
showAfterAttempts?: number; /** How much retry/debug detail to surface. Default "collapsed". */
|
|
3056
|
+
debugExposure?: "hidden" | "collapsed" | "verbose";
|
|
3057
|
+
};
|
|
3058
|
+
//#endregion
|
|
3059
|
+
//#region src/providers/CopilotKitProvider.d.ts
|
|
3060
|
+
interface CopilotKitProviderProps {
|
|
3061
|
+
children: ReactNode;
|
|
3062
|
+
runtimeUrl?: string;
|
|
3063
|
+
/**
|
|
3064
|
+
* Headers sent with every request. A record, or a sync or async builder
|
|
3065
|
+
* that runs when each request is sent. An inline arrow is fine. The builder
|
|
3066
|
+
* should be cheap; cache tokens in it (Clerk's `getToken()` already does).
|
|
3067
|
+
*/
|
|
3068
|
+
headers?: CopilotKitHeadersSource$1;
|
|
3069
|
+
/**
|
|
3070
|
+
* Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies in cross-origin requests).
|
|
3071
|
+
*/
|
|
3072
|
+
credentials?: RequestCredentials;
|
|
3073
|
+
/**
|
|
3074
|
+
* Rewrites the message list sent to runtime agents on every run.
|
|
3075
|
+
*
|
|
3076
|
+
* CopilotKit sends the whole thread each time. When your agent already
|
|
3077
|
+
* stores the conversation, most of that payload is waste, and an agent that
|
|
3078
|
+
* merges the inbound list with its own store can show the model every turn
|
|
3079
|
+
* twice. Return the messages to send:
|
|
3080
|
+
*
|
|
3081
|
+
* ```tsx
|
|
3082
|
+
* <CopilotKit
|
|
3083
|
+
* runtimeUrl="/api/copilotkit"
|
|
3084
|
+
* messageFilter={(messages) => messages.slice(-1)}
|
|
3085
|
+
* />
|
|
3086
|
+
* ```
|
|
3087
|
+
*
|
|
3088
|
+
* The filter changes the request body only. The transcript the UI renders is
|
|
3089
|
+
* untouched. Broken tool-call pairs are repaired before the request is sent,
|
|
3090
|
+
* so a filter this blunt cannot strand a tool result mid-HITL.
|
|
3091
|
+
*
|
|
3092
|
+
* Agents reached through your CopilotRuntime honor this. An agent your app
|
|
3093
|
+
* passes in directly does not, and neither Intelligence runs nor suggestion
|
|
3094
|
+
* runs are ever filtered.
|
|
3095
|
+
*
|
|
3096
|
+
* Prefer a stable reference (`useCallback`). An inline arrow re-registers the
|
|
3097
|
+
* filter on every render, which is harmless but needless.
|
|
3098
|
+
*/
|
|
3099
|
+
messageFilter?: CopilotKitMessageFilter$1;
|
|
3100
|
+
/** Your CopilotKit public license key. */
|
|
3101
|
+
publicApiKey?: string;
|
|
3102
|
+
/** Your public license key for accessing CopilotKit Intelligence features. */
|
|
3103
|
+
publicLicenseKey?: string;
|
|
3104
|
+
/**
|
|
3105
|
+
* Signed license token for offline verification of CopilotKit Intelligence features.
|
|
3106
|
+
* Obtain from https://dashboard.operations.copilotkit.ai.
|
|
3107
|
+
*/
|
|
3108
|
+
licenseToken?: string;
|
|
3109
|
+
properties?: Record<string, unknown>;
|
|
3110
|
+
/**
|
|
3111
|
+
* The id of the agent every `<CopilotChat>` under this provider talks to,
|
|
3112
|
+
* unless a chat names its own with the `agentId` prop.
|
|
3113
|
+
*
|
|
3114
|
+
* This is the v2 replacement for the v1 `<CopilotKit agent="...">` prop. Set
|
|
3115
|
+
* it here and you never need the v1 compatibility provider just to name an
|
|
3116
|
+
* agent. Defaults to `"default"`.
|
|
3117
|
+
*/
|
|
3118
|
+
agentId?: string;
|
|
3119
|
+
useSingleEndpoint?: boolean;
|
|
3120
|
+
agents__unsafe_dev_only?: Record<string, AbstractAgent$1>;
|
|
3121
|
+
selfManagedAgents?: Record<string, AbstractAgent$1>;
|
|
3122
|
+
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
3123
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
3124
|
+
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
3125
|
+
/**
|
|
3126
|
+
* Global markdown renderer used by assistant/reasoning messages. Overrides the
|
|
3127
|
+
* built-in basic renderer. A per-message `markdownRenderer` slot still wins
|
|
3128
|
+
* over this. Plug in your own (e.g. a streamdown wrapper) to restore rich
|
|
3129
|
+
* rendering — CopilotKit ships only the basic renderer.
|
|
3130
|
+
*/
|
|
3131
|
+
markdownRenderer?: MarkdownRenderer;
|
|
3132
|
+
frontendTools?: ReactFrontendTool[];
|
|
3133
|
+
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
3134
|
+
/**
|
|
3135
|
+
* Configuration for OpenGenerativeUI — sandboxed UI generated by the LLM.
|
|
3136
|
+
*
|
|
3137
|
+
* @example
|
|
3138
|
+
* ```tsx
|
|
3139
|
+
* <CopilotKit
|
|
3140
|
+
* runtimeUrl="/api/copilotkit"
|
|
3141
|
+
* openGenerativeUI={{
|
|
3142
|
+
* sandboxFunctions: [{ name: "addToCart", description: "…", parameters: schema, handler: fn }],
|
|
3143
|
+
* }}
|
|
3144
|
+
* >
|
|
3145
|
+
* ```
|
|
3146
|
+
*/
|
|
3147
|
+
openGenerativeUI?: {
|
|
3148
|
+
/**
|
|
3149
|
+
* Functions made available inside sandboxed iframes.
|
|
3150
|
+
* Each function is described to the LLM via agent context and exposed
|
|
3151
|
+
* via websandbox's `localApi`.
|
|
3152
|
+
*
|
|
3153
|
+
* Inside the iframe, call them with:
|
|
3154
|
+
* ```js
|
|
3155
|
+
* await Websandbox.connection.remote.<functionName>(args)
|
|
3156
|
+
* ```
|
|
3157
|
+
*/
|
|
3158
|
+
sandboxFunctions?: SandboxFunction[];
|
|
3159
|
+
/**
|
|
3160
|
+
* Design guidelines injected as agent context for the `generateSandboxedUi` tool.
|
|
3161
|
+
* Override this to control the visual style of generated UIs.
|
|
3162
|
+
*
|
|
3163
|
+
* A sensible default is provided if omitted.
|
|
3164
|
+
*/
|
|
3165
|
+
designSkill?: string;
|
|
3166
|
+
};
|
|
3167
|
+
/**
|
|
3168
|
+
* @deprecated This prop no longer controls the Inspector. Use
|
|
3169
|
+
* `enableInspector` instead.
|
|
3170
|
+
*/
|
|
3171
|
+
showDevConsole?: boolean | "auto";
|
|
3172
|
+
/**
|
|
3173
|
+
* Disable the CopilotKit Inspector in development.
|
|
3174
|
+
* The Inspector is enabled by default in development browser builds on
|
|
3175
|
+
* localhost/loopback. It is always disabled on remote hosts, in production,
|
|
3176
|
+
* and during server rendering. Temporary Inspector hides also hide its
|
|
3177
|
+
* message shortcuts.
|
|
3178
|
+
* An explicit value takes priority over CopilotChat's inspectorTools prop.
|
|
3179
|
+
*/
|
|
3180
|
+
enableInspector?: boolean;
|
|
3181
|
+
/**
|
|
3182
|
+
* Whether to automatically mount the Intelligence indicator in chat.
|
|
3183
|
+
*
|
|
3184
|
+
* @default true
|
|
3185
|
+
*/
|
|
3186
|
+
showIntelligenceIndicator?: boolean;
|
|
3187
|
+
/**
|
|
3188
|
+
* Error handler called when CopilotKit encounters an error.
|
|
3189
|
+
* Fires for all error types (runtime connection failures, agent errors, tool errors).
|
|
3190
|
+
*/
|
|
3191
|
+
onError?: (event: {
|
|
3192
|
+
error: Error;
|
|
3193
|
+
code: CopilotKitCoreErrorCode$1;
|
|
3194
|
+
context: Record<string, any>;
|
|
3195
|
+
}) => void | Promise<void>;
|
|
3196
|
+
/**
|
|
3197
|
+
* Configuration for the A2UI (Agent-to-UI) renderer.
|
|
3198
|
+
* The built-in A2UI renderer is activated automatically when the runtime reports
|
|
3199
|
+
* that `a2ui` is configured in `CopilotRuntime`. This prop is optional and only
|
|
3200
|
+
* needed if you want to override the default theme.
|
|
3201
|
+
*
|
|
3202
|
+
* @example
|
|
3203
|
+
* ```tsx
|
|
3204
|
+
* <CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme: myCustomTheme }}>
|
|
3205
|
+
* {children}
|
|
3206
|
+
* </CopilotKit>
|
|
3207
|
+
* ```
|
|
3208
|
+
*/
|
|
3209
|
+
a2ui?: {
|
|
3210
|
+
/**
|
|
3211
|
+
* Override the default A2UI viewer theme.
|
|
3212
|
+
* When omitted, the built-in `viewerTheme` from `@copilotkit/a2ui-renderer` is used.
|
|
3213
|
+
*/
|
|
3214
|
+
theme?: Theme;
|
|
3215
|
+
/**
|
|
3216
|
+
* Optional component catalog to pass to the A2UI renderer.
|
|
3217
|
+
* When omitted, the default basicCatalog is used.
|
|
3218
|
+
*/
|
|
3219
|
+
catalog?: any;
|
|
3220
|
+
/**
|
|
3221
|
+
* Optional custom loading component shown while an A2UI surface is generating.
|
|
3222
|
+
* When omitted, a default animated skeleton is shown.
|
|
3223
|
+
*/
|
|
3224
|
+
loadingComponent?: React$1.ComponentType;
|
|
3225
|
+
/**
|
|
3226
|
+
* When true (the default), the full component schemas from the catalog are
|
|
3227
|
+
* sent as agent context so the agent knows what components and props are
|
|
3228
|
+
* available. The A2UI middleware can overwrite this with a server-side
|
|
3229
|
+
* schema if configured.
|
|
3230
|
+
*
|
|
3231
|
+
* When false, the agent context still describes the catalog, but only by its
|
|
3232
|
+
* catalog ID and the names of its custom components, without their JSON
|
|
3233
|
+
* schemas. The component schema entry and the A2UI generation and design
|
|
3234
|
+
* guidelines are not sent. With the CopilotKit LangGraph middleware's
|
|
3235
|
+
* injected A2UI tool, the A2UI subagent then gets the component names only;
|
|
3236
|
+
* a host can still give it a composition guide through the middleware's
|
|
3237
|
+
* guidelines (`a2uiParams.guidelines.compositionGuide` in TypeScript,
|
|
3238
|
+
* `a2ui_params["guidelines"]["composition_guide"]` in Python).
|
|
3239
|
+
*/
|
|
3240
|
+
includeSchema?: boolean;
|
|
3241
|
+
/**
|
|
3242
|
+
* Options for the A2UI error-recovery status UI (OSS-162): how long before
|
|
3243
|
+
* the transient "Retrying…" hint appears, after how many attempts, and how
|
|
3244
|
+
* much retry/debug detail to surface. When omitted, sane defaults apply.
|
|
3245
|
+
*/
|
|
3246
|
+
recovery?: A2UIRecoveryRendererOptions;
|
|
3247
|
+
};
|
|
3248
|
+
/**
|
|
3249
|
+
* Experimental. Native generative UI: `generativeUI={{ ui }}`, where `ui`
|
|
3250
|
+
* comes from `createGenerativeUI`. The agent renders your React components
|
|
3251
|
+
* into chat or into `<GenerativeUISurface id>` mounts. Props that match
|
|
3252
|
+
* the declared state and events that match the declared functions are
|
|
3253
|
+
* bound by the library, and the model does not see them.
|
|
3254
|
+
*/
|
|
3255
|
+
generativeUI?: GenerativeUIConfig;
|
|
3256
|
+
/**
|
|
3257
|
+
* Configuration for the built-in MCP Apps renderer.
|
|
3258
|
+
*
|
|
3259
|
+
* @example
|
|
3260
|
+
* ```tsx
|
|
3261
|
+
* <CopilotKit runtimeUrl="/api/copilotkit" mcpApps={{ allowSameOriginFallback: true }}>
|
|
3262
|
+
* {children}
|
|
3263
|
+
* </CopilotKit>
|
|
3264
|
+
* ```
|
|
3265
|
+
*/
|
|
3266
|
+
mcpApps?: {
|
|
3267
|
+
/**
|
|
3268
|
+
* Restore `allow-same-origin` on the MCP App sandbox. Default `false`.
|
|
3269
|
+
*
|
|
3270
|
+
* **Unsafe.** The widget then runs with your page's origin: it can read
|
|
3271
|
+
* your cookies, storage and DOM, and call your APIs as the signed-in user.
|
|
3272
|
+
* Only set it for widgets you wrote and trust that need `localStorage`,
|
|
3273
|
+
* `IndexedDB` or cookies. By default widgets get an opaque origin.
|
|
3274
|
+
*/
|
|
3275
|
+
allowSameOriginFallback?: boolean;
|
|
3276
|
+
};
|
|
3277
|
+
/**
|
|
3278
|
+
* Default throttle interval (in milliseconds) for `useAgent` re-renders
|
|
3279
|
+
* triggered by `OnMessagesChanged` notifications. This value is used as
|
|
3280
|
+
* a fallback when neither the `useAgent()` hook nor `<CopilotChat>` /
|
|
3281
|
+
* `<CopilotSidebar>` / `<CopilotPopup>` specify an explicit `throttleMs`.
|
|
3282
|
+
*
|
|
3283
|
+
* @default undefined (components/hooks without an explicit throttleMs will be unthrottled)
|
|
3284
|
+
*/
|
|
3285
|
+
defaultThrottleMs?: number;
|
|
3286
|
+
/**
|
|
3287
|
+
* Enable debug logging for the client-side event pipeline.
|
|
3288
|
+
*/
|
|
3289
|
+
debug?: DebugConfig;
|
|
3290
|
+
/**
|
|
3291
|
+
* Turns on interaction capture (`@copilotkit/learning`). `learning` (short
|
|
3292
|
+
* for `learning={true}`) records with the default options; pass an object
|
|
3293
|
+
* for options. `false` or omitting the prop turns capture off and cancels
|
|
3294
|
+
* startup. Without a sink, Core authenticates with the runtime and sends
|
|
3295
|
+
* browser events to Intelligence; a custom sink keeps the standalone
|
|
3296
|
+
* collector behavior. Updated settings apply to the next Trajectory.
|
|
3297
|
+
*
|
|
3298
|
+
* Capture starts after mount. Set `trajectoryId` to use your own ID;
|
|
3299
|
+
* otherwise the provider generates one. The generated ID stays the same
|
|
3300
|
+
* across rerenders, reconnects and option changes; turning capture off,
|
|
3301
|
+
* setting `autoStart: false` or supplying a `trajectoryId` ends it, and the
|
|
3302
|
+
* next generated Trajectory gets a new ID. Read the active ID from
|
|
3303
|
+
* `copilotkit.trajectoryId`.
|
|
3304
|
+
*
|
|
3305
|
+
* Set `autoStart: false` to start capture yourself with `startTrajectory()`.
|
|
3306
|
+
* Capture stops on unmount, including manually started Trajectories.
|
|
3307
|
+
*
|
|
3308
|
+
* @example
|
|
3309
|
+
* <CopilotKitProvider runtimeUrl="/api/copilotkit" learning>
|
|
3310
|
+
*/
|
|
3311
|
+
learning?: boolean | LearningProp;
|
|
3312
|
+
}
|
|
3313
|
+
type LearningProp = LearningConfig$1 & {
|
|
3314
|
+
/**
|
|
3315
|
+
* Starts a Trajectory after mount. Defaults to `true`; set `false` to call
|
|
3316
|
+
* `startTrajectory()` yourself.
|
|
3317
|
+
*/
|
|
3318
|
+
autoStart?: boolean;
|
|
3319
|
+
trajectoryId?: string;
|
|
3320
|
+
/**
|
|
3321
|
+
* Used only by explicit custom sinks. Authenticated capture warns and ignores
|
|
3322
|
+
* this option; assign Learning Spaces on the server with
|
|
3323
|
+
* `getTrajectoryLearningContainerIds` on `CopilotKitIntelligence`.
|
|
3324
|
+
*/
|
|
3325
|
+
learningContainerIds?: string[];
|
|
3326
|
+
};
|
|
3327
|
+
/** Provide a shared core instance and synchronize runtime, tool, and UI configuration. */
|
|
3328
|
+
declare const CopilotKitProvider: React$1.FC<CopilotKitProviderProps>;
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/providers/SandboxFunctionsContext.d.ts
|
|
3331
|
+
declare const SandboxFunctionsContext: react.Context<readonly SandboxFunction[]>;
|
|
3332
|
+
declare function useSandboxFunctions(): readonly SandboxFunction[];
|
|
3333
|
+
//#endregion
|
|
3334
|
+
//#region src/lib/react-core.d.ts
|
|
3335
|
+
interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig$1 {
|
|
3336
|
+
renderToolCalls?: ReactToolCallRenderer<any>[];
|
|
3337
|
+
renderActivityMessages?: ReactActivityMessageRenderer<any>[];
|
|
3338
|
+
renderCustomMessages?: ReactCustomMessageRenderer[];
|
|
3339
|
+
}
|
|
3340
|
+
interface CopilotKitCoreReactSubscriber extends CopilotKitCoreSubscriber$1 {
|
|
3341
|
+
onRenderToolCallsChanged?: (event: {
|
|
3342
|
+
copilotkit: CopilotKitCore$1;
|
|
3343
|
+
renderToolCalls: ReactToolCallRenderer<any>[];
|
|
3344
|
+
}) => void | Promise<void>;
|
|
3345
|
+
onInterruptElementChanged?: (event: {
|
|
3346
|
+
copilotkit: CopilotKitCore$1;
|
|
3347
|
+
interruptElement: React$1.ReactElement | null;
|
|
3348
|
+
}) => void | Promise<void>;
|
|
3349
|
+
}
|
|
3350
|
+
declare class CopilotKitCoreReact extends CopilotKitCore$1 {
|
|
3351
|
+
private _renderToolCalls;
|
|
3352
|
+
private _hookRenderToolCalls;
|
|
3353
|
+
private _cachedMergedRenderToolCalls;
|
|
3354
|
+
private _renderCustomMessages;
|
|
3355
|
+
private _renderActivityMessages;
|
|
3356
|
+
private _interruptElement;
|
|
3357
|
+
constructor(config: CopilotKitCoreReactConfig);
|
|
3358
|
+
get renderCustomMessages(): Readonly<ReactCustomMessageRenderer[]>;
|
|
3359
|
+
get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
|
|
3360
|
+
get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
|
|
3361
|
+
setRenderActivityMessages(renderers: ReactActivityMessageRenderer<any>[]): void;
|
|
3362
|
+
setRenderCustomMessages(renderers: ReactCustomMessageRenderer[]): void;
|
|
3363
|
+
setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
|
|
3364
|
+
addHookRenderToolCall(entry: ReactToolCallRenderer<any>): void;
|
|
3365
|
+
removeHookRenderToolCall(name: string, agentId?: string): void;
|
|
3366
|
+
private _notifyRenderToolCallsChanged;
|
|
3367
|
+
get interruptElement(): React$1.ReactElement | null;
|
|
3368
|
+
setInterruptElement(element: React$1.ReactElement | null): void;
|
|
3369
|
+
subscribe(subscriber: CopilotKitCoreReactSubscriber): CopilotKitCoreSubscription$1;
|
|
3370
|
+
/**
|
|
3371
|
+
* Wait for pending React state updates before the follow-up agent run.
|
|
3372
|
+
*
|
|
3373
|
+
* When a frontend tool handler calls setState(), React 18 batches the update
|
|
3374
|
+
* and schedules a commit via its internal scheduler (MessageChannel). The
|
|
3375
|
+
* useAgentContext hook registers context via useLayoutEffect, which runs
|
|
3376
|
+
* synchronously after React commits that batch.
|
|
3377
|
+
*
|
|
3378
|
+
* Awaiting a zero-delay timeout yields to the macrotask queue. React's
|
|
3379
|
+
* MessageChannel task runs first, committing the pending state and running
|
|
3380
|
+
* useLayoutEffect (which updates the context store). The follow-up runAgent
|
|
3381
|
+
* call then reads fresh context.
|
|
3382
|
+
*/
|
|
3383
|
+
waitForPendingFrameworkUpdates(): Promise<void>;
|
|
3384
|
+
}
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region src/a2ui/A2UIMessageRenderer.d.ts
|
|
3387
|
+
/**
|
|
3388
|
+
* User action with dataContextPath, as dispatched by A2UI components.
|
|
3389
|
+
*/
|
|
3390
|
+
type A2UIUserAction = {
|
|
3391
|
+
name: string;
|
|
3392
|
+
sourceComponentId: string;
|
|
3393
|
+
surfaceId: string;
|
|
3394
|
+
timestamp: string;
|
|
3395
|
+
context?: Record<string, unknown>;
|
|
3396
|
+
dataContextPath?: string;
|
|
3397
|
+
};
|
|
3398
|
+
/**
|
|
3399
|
+
* Intercept an A2UI user action before it reaches the agent.
|
|
3400
|
+
*
|
|
3401
|
+
* Called with the dispatched action and a `forward` helper that runs the agent
|
|
3402
|
+
* with the (optionally modified) action. The return value drives the default
|
|
3403
|
+
* forwarding:
|
|
3404
|
+
* - return `null` → the app handled it client-side (e.g. a `navigate` event);
|
|
3405
|
+
* the action is NOT forwarded to the agent.
|
|
3406
|
+
* - return an `A2UIUserAction` → that (possibly modified) action is forwarded.
|
|
3407
|
+
* - return `undefined` / `void` → the original action is forwarded unchanged.
|
|
3408
|
+
*
|
|
3409
|
+
* `forward` is provided for advanced cases where you want to do async work and
|
|
3410
|
+
* forward manually; if you call it yourself, return `null` to suppress the
|
|
3411
|
+
* default forward and avoid running the agent twice.
|
|
3412
|
+
*/
|
|
3413
|
+
type A2UIActionInterceptor = (action: A2UIUserAction, forward: (action?: A2UIUserAction) => Promise<void>) => void | A2UIUserAction | null | Promise<void | A2UIUserAction | null>;
|
|
3414
|
+
type A2UIMessageRendererOptions = {
|
|
3415
|
+
theme: Theme; /** Optional component catalog to pass to A2UIProvider */
|
|
3416
|
+
catalog?: any; /** Optional custom loading component shown while the A2UI surface is building. */
|
|
3417
|
+
loadingComponent?: React.ComponentType;
|
|
3418
|
+
/**
|
|
3419
|
+
* Pre-paint recovery/loading UX options (OSS-162): timing before the
|
|
3420
|
+
* "Retrying…" sub-label appears + how much retry/debug detail to surface.
|
|
3421
|
+
*/
|
|
3422
|
+
recovery?: A2UIRecoveryRendererOptions;
|
|
3423
|
+
/**
|
|
3424
|
+
* Intercept actions before they reach the agent. Lets an app handle an action
|
|
3425
|
+
* client-side (e.g. `navigate`) instead of forwarding every action. See
|
|
3426
|
+
* {@link A2UIActionInterceptor}.
|
|
3427
|
+
*/
|
|
3428
|
+
onAction?: A2UIActionInterceptor;
|
|
3429
|
+
};
|
|
3430
|
+
declare function createA2UIMessageRenderer(options: A2UIMessageRendererOptions): ReactActivityMessageRenderer<any>;
|
|
3431
|
+
//#endregion
|
|
3432
|
+
export { type A2UIActionInterceptor, type A2UIMarkdownOperation, type A2UIMessageRendererOptions, type A2UIRecoveryRendererOptions, type A2UITheme, type A2UIUserAction, A2UI_FENCE_LANGUAGE, ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, type AGUIEvent, type AGUIEventByType, type AGUIEventOf, AGUI_METADATA_KEY, AbstractAgent, type ActionConfig, type ActionCreator, type ActionFromCreator, type ActionFromCreators, type ActionGroupConfig, type ActionGroupResult, type ActivityDeltaEvent, type ActivityDeltaEventProps, ActivityDeltaEventSchema, type ActivityMessage, ActivityMessageSchema, type ActivitySnapshotEvent, type ActivitySnapshotEventProps, ActivitySnapshotEventSchema, type AddOperation, AddOperationSchema, type AgentCapabilities, AgentCapabilitiesSchema, type AgentConfig, type AgentContextInput, type AgentDebugConfig, AgentRegistry, type AgentStateMutation, type AgentSubscriber, type AgentSubscriberParams, AgentThreadLockedError, type AnyAction, type AssistantMessage, AssistantMessageSchema, type Attachment, type AttachmentModality, type AttachmentsConfig, type Attributable, AttributableSchema, type AudioInputContent, AudioInputContentSchema, type AudioInputPart, AudioInputPartSchema, type AudioPart, AudioPartSchema, AudioRecorderError, type AudioRecorderState, type AutoScrollMode, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, type BaseEvent, type BaseEventFields, type BaseEventProps, BaseEventSchema, type BaseMessage, BaseMessageSchema, BasicMarkdownRenderer, type ChildIdsOf, type ChildWalkOptions, CompatibilityBoundary, type ContentPart, ContentPartSchema, type Context, ContextSchema, ContextStore, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, type CopilotChatFeedbackMessage, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatReasoningMessage, type CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, type CopilotChatSuggestionPillProps, CopilotChatSuggestionView, type CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, type CopilotChatToggleButtonProps, type CopilotChatToolCallDisplay, CopilotChatToolCallGroup, type CopilotChatToolCallGroupAppearance, type CopilotChatToolCallGroupProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, CopilotChatWorkSummary, type CopilotChatWorkSummaryProps, type CopilotKitContextValue, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreCatalogComponent, type CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, type CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, type CopilotKitCoreFriendsAccess, type CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, type CopilotKitCoreRegisterProxiedAgentParams, type CopilotKitCoreRegisterProxiedAgentResult, type CopilotKitCoreRunAgentParams, type CopilotKitCoreRunToolParams, type CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, type CopilotKitCoreStopAgentParams, type CopilotKitCoreSubscriber, type CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, type CopilotKitHeadersSource, CopilotKitInspector, CopilotKitInspectorProps, type CopilotKitMessageFilter, CopilotKitProvider, type CopilotKitProviderProps, CopilotModalHeader, type CopilotModalHeaderProps, CopilotPopup, type CopilotPopupProps, CopilotPopupView, type CopilotPopupViewProps, type CopilotRuntimeTransport, CopilotSidebar, type CopilotSidebarProps, CopilotSidebarView, type CopilotSidebarViewProps, CopilotThreadsDrawer, type CopilotThreadsDrawerProps, type CopilotThreadsDrawerRowRenderer, type CopyOperation, CopyOperationSchema, type CustomEvent, type CustomEventProps, CustomEventSchema, type DataSource, DataSourceSchema, DebugLogger, type DebugLoggerInput, DefaultMarkdownRendererProps, type DeveloperMessage, DeveloperMessageSchema, type DispatchingEffect, type DispatchingEffectOptions, type DocumentInputContent, DocumentInputContentSchema, type DocumentInputPart, DocumentInputPartSchema, type DocumentPart, DocumentPartSchema, type DynamicSuggestionsConfig, type Effect, type EmptyActionConfig, type Event, type EventPayloadOf, EventSchema, EventSchemas, EventType, EventTypeSchema, type ExecutionCapabilities, ExecutionCapabilitiesSchema, type FileSource, FileSourceSchema, FilterToolCallsMiddleware, type FrontendTool, type FrontendToolHandlerContext, type FrontendToolReconnectBehavior, type FunctionCall, FunctionCallSchema, FunctionMiddleware, GenerateSandboxedUiArgs, GenerateSandboxedUiArgsSchema, HttpAgent, type HttpAgentConfig, type HttpAgentFetchFn, type HumanInTheLoopCapabilities, HumanInTheLoopCapabilitiesSchema, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, INTELLIGENCE_TURN_HEAD, INTERRUPT_EVENT_NAME, type IdentityCapabilities, IdentityCapabilitiesSchema, type ImageInputContent, ImageInputContentSchema, type ImageInputPart, ImageInputPartSchema, type ImagePart, ImagePartSchema, type InputContent, type InputContentDataSource, InputContentDataSourceSchema, type InputContentPart, InputContentSchema, type InputContentSource, InputContentSourceSchema, type InputContentUrlSource, InputContentUrlSourceSchema, type InspectorActiveThreadPayload, type InspectorAnchor, type InspectorMetadataV1, type InspectorStopViewingPayload, type InspectorViewThreadPayload, type InspectorViewThreadResultPayload, IntelligenceAgent, type IntelligenceAgentConfig, IntelligenceIndicator, type IntelligenceIndicatorProps, type IntelligenceIndicatorStatus, IntelligenceIndicatorView, type IntelligenceIndicatorViewProps, type IntelligenceRuntimeInfo, type Interrupt, InterruptCancelFn, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, InterruptResolveFn, InterruptSchema, type JsonPatch, type JsonPatchOperation, JsonPatchOperationSchema, JsonPatchSchema, type JsonPointer, JsonPointerSchema, type JsonSerializable, type JsonValue, type LearnFromUserActionInCurrentThreadInput, type LearnFromUserActionInput, type LearnFromUserActionResult, type LearningConfig, type LegacyLearningConfig, type MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, MEMORY_ERROR_REGISTRY, MarkdownRenderer, MarkdownRendererProps, MarkdownRendererProvider, type MarkdownSegment, type MarkdownToken, type MarkdownTokenList, type Memory, type MemoryChanges, MemoryError, type MemoryErrorCategory, type MemoryErrorCode, type MemoryErrorRegistryEntry, type MemoryKind, type MemoryRealtimeStatus, type MemoryScope, type Message, type MessageGroup, type MessageGroupWrapperProps, type MessageRow, MessageSchema, type MessagesSnapshotEvent, type MessagesSnapshotEventProps, MessagesSnapshotEventSchema, type Metadata, MetadataSchema, Middleware, type MiddlewareFunction, type MoveOperation, MoveOperationSchema, type MultiAgentCapabilities, MultiAgentCapabilitiesSchema, type MultimodalCapabilities, MultimodalCapabilitiesSchema, type MultimodalInputCapabilities, MultimodalInputCapabilitiesSchema, type MultimodalOutputCapabilities, MultimodalOutputCapabilitiesSchema, type NewMemory, type NonDispatchingEffect, type NonDispatchingEffectOptions, OpenGenerativeUIActivityRenderer, OpenGenerativeUIActivityType, OpenGenerativeUIContent, OpenGenerativeUIContentSchema, OpenGenerativeUIToolRenderer, type OpenThreadRegistration, OptionalMetadataSchema, type OutputCapabilities, OutputCapabilitiesSchema, PROTOCOL_VERSION, type ParseMarkdownOptions, type PartSource, PartSourceSchema, type PropsActionConfig, ProxiedCopilotRuntimeAgent, type ProxiedCopilotRuntimeAgentConfig, type RawEvent, type RawEventProps, RawEventSchema, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, type ReasoningCapabilities, ReasoningCapabilitiesSchema, type ReasoningEncryptedValueEvent, type ReasoningEncryptedValueEventProps, ReasoningEncryptedValueEventSchema, type ReasoningEncryptedValueSubtype, ReasoningEncryptedValueSubtypeSchema, type ReasoningEndEvent, type ReasoningEndEventProps, ReasoningEndEventSchema, type ReasoningMessage, type ReasoningMessageChunkEvent, type ReasoningMessageChunkEventProps, ReasoningMessageChunkEventSchema, type ReasoningMessageContentEvent, type ReasoningMessageContentEventProps, ReasoningMessageContentEventSchema, type ReasoningMessageEndEvent, type ReasoningMessageEndEventProps, ReasoningMessageEndEventSchema, ReasoningMessageSchema, type ReasoningMessageStartEvent, type ReasoningMessageStartEventProps, ReasoningMessageStartEventSchema, type ReasoningStartEvent, type ReasoningStartEventProps, ReasoningStartEventSchema, type Reducer, type RemoveOperation, RemoveOperationSchema, type ReplaceOperation, ReplaceOperationSchema, type ResolvedAgentDebugConfig, type ResumeEntry, ResumeEntrySchema, type ResumeStatus, type Role, RoleSchema, type RunAgentInput, RunAgentInputSchema, type RunAgentParameters, type RunAgentResult, type RunCompletionAware, type RunErrorEvent, type RunErrorEventProps, RunErrorEventSchema, type RunFinishedCancelledOutcome, RunFinishedCancelledOutcomeSchema, type RunFinishedEvent, type RunFinishedEventProps, RunFinishedEventSchema, type RunFinishedInterruptOutcome, RunFinishedInterruptOutcomeSchema, type RunFinishedOutcome, RunFinishedOutcomeSchema, type RunFinishedSuccessOutcome, RunFinishedSuccessOutcomeSchema, RunHandler, type RunStartedEvent, type RunStartedEventProps, RunStartedEventSchema, type RuntimeLicenseStatus, type RuntimeMode, SandboxFunction, SandboxFunctionsContext, type ScopedContext, type ScopedProperties, type Selector, type StartResult, type State, type StateCapabilities, StateCapabilitiesSchema, type StateDeltaEvent, type StateDeltaEventProps, StateDeltaEventSchema, StateManager, StateSchema, type StateSnapshotEvent, type StateSnapshotEventProps, StateSnapshotEventSchema, type StaticSuggestionsConfig, type StepFinishedEvent, type StepFinishedEventProps, StepFinishedEventSchema, type StepStartedEvent, type StepStartedEventProps, StepStartedEventSchema, type Store, type StoreLifecycleAction, StreamingMarkdownDefaultRenderer, type SubagentErrorEvent, type SubagentErrorEventProps, SubagentErrorEventSchema, type SubagentFinishedEvent, type SubagentFinishedEventProps, SubagentFinishedEventSchema, type SubagentFinishedOutcome, SubagentFinishedOutcomeSchema, type SubagentFinishedSuccessOutcome, SubagentFinishedSuccessOutcomeSchema, type SubagentFinishedSuspendedOutcome, SubagentFinishedSuspendedOutcomeSchema, type SubagentInfo, SubagentInfoSchema, type SubagentRunId, SubagentRunIdSchema, type SubagentStartedEvent, type SubagentStartedEventProps, SubagentStartedEventSchema, type SubscribeToAgentOptions, type SubscribeToAgentSubscriber, type Suggestion, type SuggestionAvailability, SuggestionEngine, type SuggestionsConfig, type SurfaceSegment, type SystemMessage, SystemMessageSchema, type TestOperation, TestOperationSchema, type TextInputContent, TextInputContentSchema, type TextMessageChunkEvent, type TextMessageChunkEventProps, TextMessageChunkEventSchema, type TextMessageContentEvent, type TextMessageContentEventProps, TextMessageContentEventSchema, type TextMessageEndEvent, type TextMessageEndEventProps, TextMessageEndEventSchema, type TextMessageRole, TextMessageRoleSchema, type TextMessageStartEvent, type TextMessageStartEventProps, TextMessageStartEventSchema, type TextPart, TextPartSchema, type Thread, type ThreadEndpointRuntimeInfo, type ThreadRunActivityNotification, type TokenUsage, TokenUsageSchema, type Tokens, type Tool, type ToolCall, type ToolCallArgsEvent, type ToolCallArgsEventProps, ToolCallArgsEventSchema, type ToolCallChunkEvent, type ToolCallChunkEventProps, ToolCallChunkEventSchema, type ToolCallEndEvent, type ToolCallEndEventProps, ToolCallEndEventSchema, type ToolCallEntry, type ToolCallResultEvent, type ToolCallResultEventProps, ToolCallResultEventSchema, ToolCallSchema, type ToolCallStartEvent, type ToolCallStartEventProps, ToolCallStartEventSchema, ToolCallStatus, type ToolMessage, ToolMessageSchema, ToolSchema, type ToolsCapabilities, ToolsCapabilitiesSchema, type ToolsMenuItem, type TrajectoryStartOptions, type TransportCapabilities, TransportCapabilitiesSchema, type UnrecognizedEvent, type UrlSource, UrlSourceSchema, UseAgentUpdate, type UseAttachmentsProps, type UseAttachmentsReturn, type UseInterruptConfig, type UseLearnFromUserActionInCurrentThreadRecorder, type UseLearnFromUserActionRecorder, type UseLearningContainersArgs, type UseLearningContainersInCurrentThreadArgs, type UseMemoriesResult, type UseThreadsInput, type UseThreadsResult, type UserMessage, UserMessageSchema, type VideoInputContent, VideoInputContentSchema, type VideoInputPart, VideoInputPartSchema, type VideoPart, VideoPartSchema, type WebMCPModelContext, WebMCPRegistry, type WebMCPToolAnnotations, type WebMCPToolConfig, WildcardToolCallRender, a2uiDefaultTheme, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, classifySurfaceCards, compactEvents, completePartialMarkdown, contentHasMedia, contentToText, convertToLegacyEvents, createA2UIMessageRenderer, createActionGroup, createDebugLogger, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, defaultApplyEvents, defineToolCallRenderer, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, enforceEvents, enforceOutgoingInput, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getIntelligenceTurnAnchors, getMarkdownOperationSurfaceId, getRunOutcome, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInterruptExpired, isRecognizedEvent, isRunCompletionAware, mergeMetadata, messageGroup, messageRow, ofType, omitOptionalNulls, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseMarkdown, parseProtoStream, parseSSEStream, parseToolArguments, prepareSurfaceOperations, props, randomUUID, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, segmentSurfaceProse, select, splitA2UIMarkdown, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useFrontendTools, useHumanInTheLoop, useInterrupt, useLearnFromUserAction, useLearnFromUserActionInCurrentThread, useLearningContainers, useLearningContainersInCurrentThread, useLicenseContext, useMarkdownRenderer, useMemories, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads, verifyEvents, withAuthoritativeActivityTypes, ɵCOPILOTKIT_FEATURES, type ɵCopilotKitFeature, type ɵGenerativeUIDebugFunction, type ɵGenerativeUIDebugPromptSection, type ɵGenerativeUIDebugRun, type ɵGenerativeUIDebugSnapshot, type ɵGenerativeUIDebugSource, type ɵGenerativeUIDebugSurface, type ɵInterruptDecision, type ɵInterruptEvent, ɵInterruptState, type ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, type ɵMcpFollowUpHost, type ɵMemoryEnvironment, type ɵMemoryMetadataEvent, type ɵMemoryRuntimeContext, type ɵMemoryState, type ɵMemoryStore, type ɵPendingInterrupt, type ɵPhoenixChannelLike, type ɵPhoenixChannelOptions, type ɵPhoenixChannelSession, type ɵPhoenixJoinOutcome, type ɵPhoenixPushLike, type ɵPhoenixSocketLike, type ɵPhoenixSocketOptions, type ɵPhoenixSocketSession, type ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, type ɵThread, type ɵThreadEnvironment, type ɵThreadMetadataEvent, type ɵThreadRuntimeContext, type ɵThreadSelectors, type ɵThreadStore, ɵclearAgentInterruptState, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵrunMcpFollowUp, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
|
|
3433
|
+
//# sourceMappingURL=index.d.mts.map
|