@copilotkit/react-core 1.51.4 → 1.51.5-next.1
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/.attw.json +3 -0
- package/CHANGELOG.md +21 -0
- package/dist/index.cjs +4010 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1327 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +1327 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3944 -148
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +4075 -39
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +17 -0
- package/dist/v2/index.css +2 -3
- package/dist/v2/index.css.map +1 -1
- package/dist/v2/index.d.cts +2 -0
- package/dist/v2/index.d.mts +2 -0
- package/dist/v2/index.mjs +4 -5
- package/dist/v2/index.umd.js +24 -2
- package/package.json +22 -22
- package/src/components/copilot-provider/__tests__/copilotkit-error.test.tsx +3 -3
- package/src/hooks/__tests__/use-coagent-config.test.ts +23 -22
- package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +33 -35
- package/src/hooks/__tests__/use-coagent-state-render.test.tsx +19 -18
- package/src/hooks/__tests__/use-frontend-tool-available.test.tsx +72 -0
- package/src/hooks/__tests__/use-frontend-tool-remount.e2e.test.tsx +9 -7
- package/src/hooks/use-copilot-chat.ts +1 -1
- package/src/hooks/use-frontend-tool.ts +2 -1
- package/src/lib/copilot-task.ts +1 -1
- package/src/setupTests.ts +17 -16
- package/tsconfig.json +1 -1
- package/tsdown.config.ts +94 -0
- package/vitest.config.mjs +30 -0
- package/dist/chunk-2IDV5OHF.mjs +0 -11
- package/dist/chunk-2IDV5OHF.mjs.map +0 -1
- package/dist/chunk-2RSAYTXH.mjs +0 -137
- package/dist/chunk-2RSAYTXH.mjs.map +0 -1
- package/dist/chunk-36KQV2NA.mjs +0 -1
- package/dist/chunk-36KQV2NA.mjs.map +0 -1
- package/dist/chunk-3LZZ4RVM.mjs +0 -37
- package/dist/chunk-3LZZ4RVM.mjs.map +0 -1
- package/dist/chunk-4ZQYMC5F.mjs +0 -36
- package/dist/chunk-4ZQYMC5F.mjs.map +0 -1
- package/dist/chunk-6ABVYB2U.mjs +0 -95
- package/dist/chunk-6ABVYB2U.mjs.map +0 -1
- package/dist/chunk-6AWG5FWL.mjs +0 -102
- package/dist/chunk-6AWG5FWL.mjs.map +0 -1
- package/dist/chunk-6YOKPWQ7.mjs +0 -1
- package/dist/chunk-6YOKPWQ7.mjs.map +0 -1
- package/dist/chunk-7GIBHX6X.mjs +0 -195
- package/dist/chunk-7GIBHX6X.mjs.map +0 -1
- package/dist/chunk-7PJKPWMD.mjs +0 -112
- package/dist/chunk-7PJKPWMD.mjs.map +0 -1
- package/dist/chunk-7U3DNFBF.mjs +0 -20
- package/dist/chunk-7U3DNFBF.mjs.map +0 -1
- package/dist/chunk-A6NKSGH3.mjs +0 -1
- package/dist/chunk-A6NKSGH3.mjs.map +0 -1
- package/dist/chunk-AAGMWZCN.mjs +0 -439
- package/dist/chunk-AAGMWZCN.mjs.map +0 -1
- package/dist/chunk-C7HSVDHD.mjs +0 -116
- package/dist/chunk-C7HSVDHD.mjs.map +0 -1
- package/dist/chunk-CYDWEPFL.mjs +0 -1
- package/dist/chunk-CYDWEPFL.mjs.map +0 -1
- package/dist/chunk-CZT7JUIM.mjs +0 -153
- package/dist/chunk-CZT7JUIM.mjs.map +0 -1
- package/dist/chunk-DMLQZG75.mjs +0 -25
- package/dist/chunk-DMLQZG75.mjs.map +0 -1
- package/dist/chunk-FD6FGKYY.mjs +0 -1
- package/dist/chunk-FD6FGKYY.mjs.map +0 -1
- package/dist/chunk-G7SUZGGB.mjs +0 -126
- package/dist/chunk-G7SUZGGB.mjs.map +0 -1
- package/dist/chunk-GY3FQICF.mjs +0 -23
- package/dist/chunk-GY3FQICF.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-IHMMKEFG.mjs +0 -64
- package/dist/chunk-IHMMKEFG.mjs.map +0 -1
- package/dist/chunk-JD7BAH7U.mjs +0 -1
- package/dist/chunk-JD7BAH7U.mjs.map +0 -1
- package/dist/chunk-K5OXUXCG.mjs +0 -76
- package/dist/chunk-K5OXUXCG.mjs.map +0 -1
- package/dist/chunk-L7GPCF2V.mjs +0 -229
- package/dist/chunk-L7GPCF2V.mjs.map +0 -1
- package/dist/chunk-LD34IXVT.mjs +0 -86
- package/dist/chunk-LD34IXVT.mjs.map +0 -1
- package/dist/chunk-LNGBARXE.mjs +0 -86
- package/dist/chunk-LNGBARXE.mjs.map +0 -1
- package/dist/chunk-LRPWSPXG.mjs +0 -628
- package/dist/chunk-LRPWSPXG.mjs.map +0 -1
- package/dist/chunk-LUGEI4YQ.mjs +0 -1
- package/dist/chunk-LUGEI4YQ.mjs.map +0 -1
- package/dist/chunk-MBJ7OLYI.mjs +0 -58
- package/dist/chunk-MBJ7OLYI.mjs.map +0 -1
- package/dist/chunk-NB2FKV2V.mjs +0 -1
- package/dist/chunk-NB2FKV2V.mjs.map +0 -1
- package/dist/chunk-O7ARI5CV.mjs +0 -31
- package/dist/chunk-O7ARI5CV.mjs.map +0 -1
- package/dist/chunk-P6ZPE4XJ.mjs +0 -86
- package/dist/chunk-P6ZPE4XJ.mjs.map +0 -1
- package/dist/chunk-QXZTCGF4.mjs +0 -163
- package/dist/chunk-QXZTCGF4.mjs.map +0 -1
- package/dist/chunk-R2DP4APC.mjs +0 -125
- package/dist/chunk-R2DP4APC.mjs.map +0 -1
- package/dist/chunk-R7BV32X4.mjs +0 -146
- package/dist/chunk-R7BV32X4.mjs.map +0 -1
- package/dist/chunk-SBRCWA4S.mjs +0 -913
- package/dist/chunk-SBRCWA4S.mjs.map +0 -1
- package/dist/chunk-SK2XMJUD.mjs +0 -42
- package/dist/chunk-SK2XMJUD.mjs.map +0 -1
- package/dist/chunk-SKC7AJIV.mjs +0 -61
- package/dist/chunk-SKC7AJIV.mjs.map +0 -1
- package/dist/chunk-SLM6CLAH.mjs +0 -195
- package/dist/chunk-SLM6CLAH.mjs.map +0 -1
- package/dist/chunk-SPCZTZCY.mjs +0 -1
- package/dist/chunk-SPCZTZCY.mjs.map +0 -1
- package/dist/chunk-SYGQHN3H.mjs +0 -27
- package/dist/chunk-SYGQHN3H.mjs.map +0 -1
- package/dist/chunk-SYMT73HM.mjs +0 -43
- package/dist/chunk-SYMT73HM.mjs.map +0 -1
- package/dist/chunk-TFZXOEY4.mjs +0 -61
- package/dist/chunk-TFZXOEY4.mjs.map +0 -1
- package/dist/chunk-TPN7WC53.mjs +0 -33
- package/dist/chunk-TPN7WC53.mjs.map +0 -1
- package/dist/chunk-UA23VX5J.mjs +0 -65
- package/dist/chunk-UA23VX5J.mjs.map +0 -1
- package/dist/chunk-V42VL2JR.mjs +0 -136
- package/dist/chunk-V42VL2JR.mjs.map +0 -1
- package/dist/chunk-VZ4NSOFQ.mjs +0 -80
- package/dist/chunk-VZ4NSOFQ.mjs.map +0 -1
- package/dist/chunk-WRALJIW5.mjs +0 -79
- package/dist/chunk-WRALJIW5.mjs.map +0 -1
- package/dist/chunk-WV2EA7SX.mjs +0 -65
- package/dist/chunk-WV2EA7SX.mjs.map +0 -1
- package/dist/chunk-Z6JV2LRY.mjs +0 -37
- package/dist/chunk-Z6JV2LRY.mjs.map +0 -1
- package/dist/chunk-ZP2IMXFY.mjs +0 -316
- package/dist/chunk-ZP2IMXFY.mjs.map +0 -1
- package/dist/chunk-ZVF5Q6IH.mjs +0 -29
- package/dist/chunk-ZVF5Q6IH.mjs.map +0 -1
- package/dist/components/CopilotListeners.d.ts +0 -3
- package/dist/components/CopilotListeners.js +0 -110
- 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 -366
- 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 -180
- 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 -2348
- package/dist/components/copilot-provider/copilotkit.js.map +0 -1
- package/dist/components/copilot-provider/copilotkit.mjs +0 -33
- 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 -2348
- package/dist/components/copilot-provider/index.js.map +0 -1
- package/dist/components/copilot-provider/index.mjs +0 -32
- 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 -1387
- package/dist/components/dev-console/console-trigger.js.map +0 -1
- package/dist/components/dev-console/console-trigger.mjs +0 -249
- 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 -1156
- 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 -140
- 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 -507
- 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 -2348
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -33
- 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 -353
- 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 -251
- 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 -25
- package/dist/context/coagent-state-renders-context.js +0 -96
- 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 -167
- 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 -301
- 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 -64
- 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 -2190
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -93
- 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.helpers.d.ts +0 -92
- package/dist/hooks/use-coagent-state-render-bridge.helpers.js +0 -237
- package/dist/hooks/use-coagent-state-render-bridge.helpers.js.map +0 -1
- package/dist/hooks/use-coagent-state-render-bridge.helpers.mjs +0 -24
- package/dist/hooks/use-coagent-state-render-bridge.helpers.mjs.map +0 -1
- package/dist/hooks/use-coagent-state-render-bridge.js +0 -498
- package/dist/hooks/use-coagent-state-render-bridge.js.map +0 -1
- package/dist/hooks/use-coagent-state-render-bridge.mjs +0 -17
- package/dist/hooks/use-coagent-state-render-bridge.mjs.map +0 -1
- package/dist/hooks/use-coagent-state-render-registry.d.ts +0 -25
- package/dist/hooks/use-coagent-state-render-registry.js +0 -369
- package/dist/hooks/use-coagent-state-render-registry.js.map +0 -1
- package/dist/hooks/use-coagent-state-render-registry.mjs +0 -9
- package/dist/hooks/use-coagent-state-render-registry.mjs.map +0 -1
- package/dist/hooks/use-coagent-state-render.d.ts +0 -55
- package/dist/hooks/use-coagent-state-render.js +0 -268
- 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 -235
- 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 -302
- 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 -196
- 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 -477
- 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 -1410
- package/dist/hooks/use-copilot-chat-headless_c.js.map +0 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +0 -26
- 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 -1344
- package/dist/hooks/use-copilot-chat.js.map +0 -1
- package/dist/hooks/use-copilot-chat.mjs +0 -23
- 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 -1342
- package/dist/hooks/use-copilot-chat_internal.js.map +0 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +0 -24
- 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 -206
- 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 -312
- 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 -96
- 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 -107
- 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 -335
- 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 -216
- 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 -182
- 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 -94
- 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 -178
- 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 -4064
- package/dist/index.js.map +0 -1
- package/dist/lib/copilot-task.d.ts +0 -97
- package/dist/lib/copilot-task.js +0 -201
- package/dist/lib/copilot-task.js.map +0 -1
- package/dist/lib/copilot-task.mjs +0 -33
- package/dist/lib/copilot-task.mjs.map +0 -1
- package/dist/lib/index.d.ts +0 -11
- package/dist/lib/index.js +0 -203
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/index.mjs +0 -34
- 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 -31
- package/dist/setupTests.js.map +0 -1
- package/dist/setupTests.mjs +0 -29
- package/dist/setupTests.mjs.map +0 -1
- package/dist/test-helpers/copilot-context.d.ts +0 -14
- package/dist/test-helpers/copilot-context.js +0 -128
- package/dist/test-helpers/copilot-context.js.map +0 -1
- package/dist/test-helpers/copilot-context.mjs +0 -74
- package/dist/test-helpers/copilot-context.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 -55
- 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.d.ts +0 -2
- package/dist/v2/index.js +0 -27
- package/dist/v2/index.js.map +0 -1
- package/dist/v2/index.mjs.map +0 -1
- package/dist/v2/index.umd.js.map +0 -1
- package/jest.config.js +0 -26
- package/rollup.config.mjs +0 -92
- package/src/__mocks__/analytics-node.js +0 -9
- package/tsup.config.ts +0 -16
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1327 @@
|
|
|
1
|
+
import React$1, { ReactNode, RefObject, SetStateAction } from "react";
|
|
2
|
+
import { CopilotKitProviderProps, useAgent, useRenderToolCall as useRenderToolCall$1 } from "@copilotkitnext/react";
|
|
3
|
+
import { AIMessage, Action, CopilotCloudConfig, CopilotErrorHandler, CopilotKitError, FunctionCallHandler, MappedParameterTypes, Message, Parameter } from "@copilotkit/shared";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import { ActionInputAvailability, Agent, CopilotRuntimeClient, CopilotRuntimeClientOptions, ExtensionsInput, ForwardedParametersInput, LangGraphInterruptEvent, Message as Message$1 } from "@copilotkit/runtime-client-gql";
|
|
6
|
+
import { AbstractAgent } from "@ag-ui/client";
|
|
7
|
+
import { StaticSuggestionsConfig, Suggestion } from "@copilotkitnext/core";
|
|
8
|
+
|
|
9
|
+
//#region src/types/frontend-action.d.ts
|
|
10
|
+
interface InProgressState<T extends Parameter[] | [] = []> {
|
|
11
|
+
status: "inProgress";
|
|
12
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
13
|
+
result: undefined;
|
|
14
|
+
}
|
|
15
|
+
interface ExecutingState<T extends Parameter[] | [] = []> {
|
|
16
|
+
status: "executing";
|
|
17
|
+
args: MappedParameterTypes<T>;
|
|
18
|
+
result: undefined;
|
|
19
|
+
}
|
|
20
|
+
interface CompleteState<T extends Parameter[] | [] = []> {
|
|
21
|
+
status: "complete";
|
|
22
|
+
args: MappedParameterTypes<T>;
|
|
23
|
+
result: any;
|
|
24
|
+
}
|
|
25
|
+
interface InProgressStateNoArgs<T extends Parameter[] | [] = []> {
|
|
26
|
+
status: "inProgress";
|
|
27
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
28
|
+
result: undefined;
|
|
29
|
+
}
|
|
30
|
+
interface ExecutingStateNoArgs<T extends Parameter[] | [] = []> {
|
|
31
|
+
status: "executing";
|
|
32
|
+
args: MappedParameterTypes<T>;
|
|
33
|
+
result: undefined;
|
|
34
|
+
}
|
|
35
|
+
interface CompleteStateNoArgs<T extends Parameter[] | [] = []> {
|
|
36
|
+
status: "complete";
|
|
37
|
+
args: MappedParameterTypes<T>;
|
|
38
|
+
result: any;
|
|
39
|
+
}
|
|
40
|
+
interface InProgressStateWait<T extends Parameter[] | [] = []> {
|
|
41
|
+
status: "inProgress";
|
|
42
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
43
|
+
/** @deprecated use respond instead */
|
|
44
|
+
handler: undefined;
|
|
45
|
+
respond: undefined;
|
|
46
|
+
result: undefined;
|
|
47
|
+
}
|
|
48
|
+
interface ExecutingStateWait<T extends Parameter[] | [] = []> {
|
|
49
|
+
status: "executing";
|
|
50
|
+
args: MappedParameterTypes<T>;
|
|
51
|
+
/** @deprecated use respond instead */
|
|
52
|
+
handler: (result: any) => void;
|
|
53
|
+
respond: (result: any) => void;
|
|
54
|
+
result: undefined;
|
|
55
|
+
}
|
|
56
|
+
interface CompleteStateWait<T extends Parameter[] | [] = []> {
|
|
57
|
+
status: "complete";
|
|
58
|
+
args: MappedParameterTypes<T>;
|
|
59
|
+
/** @deprecated use respond instead */
|
|
60
|
+
handler: undefined;
|
|
61
|
+
respond: undefined;
|
|
62
|
+
result: any;
|
|
63
|
+
}
|
|
64
|
+
interface InProgressStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
65
|
+
status: "inProgress";
|
|
66
|
+
args: Partial<MappedParameterTypes<T>>;
|
|
67
|
+
/** @deprecated use respond instead */
|
|
68
|
+
handler: undefined;
|
|
69
|
+
respond: undefined;
|
|
70
|
+
result: undefined;
|
|
71
|
+
}
|
|
72
|
+
interface ExecutingStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
73
|
+
status: "executing";
|
|
74
|
+
args: MappedParameterTypes<T>;
|
|
75
|
+
/** @deprecated use respond instead */
|
|
76
|
+
handler: (result: any) => void;
|
|
77
|
+
respond: (result: any) => void;
|
|
78
|
+
result: undefined;
|
|
79
|
+
}
|
|
80
|
+
interface CompleteStateNoArgsWait<T extends Parameter[] | [] = []> {
|
|
81
|
+
status: "complete";
|
|
82
|
+
args: MappedParameterTypes<T>;
|
|
83
|
+
/** @deprecated use respond instead */
|
|
84
|
+
handler: undefined;
|
|
85
|
+
respond: undefined;
|
|
86
|
+
}
|
|
87
|
+
type ActionRenderProps<T extends Parameter[] | [] = []> = CompleteState<T> | ExecutingState<T> | InProgressState<T>;
|
|
88
|
+
type ActionRenderPropsNoArgs<T extends Parameter[] | [] = []> = CompleteStateNoArgs<T> | ExecutingStateNoArgs<T> | InProgressStateNoArgs<T>;
|
|
89
|
+
type ActionRenderPropsWait<T extends Parameter[] | [] = []> = CompleteStateWait<T> | ExecutingStateWait<T> | InProgressStateWait<T>;
|
|
90
|
+
type ActionRenderPropsNoArgsWait<T extends Parameter[] | [] = []> = CompleteStateNoArgsWait<T> | ExecutingStateNoArgsWait<T> | InProgressStateNoArgsWait<T>;
|
|
91
|
+
type CatchAllActionRenderProps<T extends Parameter[] | [] = []> = (CompleteState<T> & {
|
|
92
|
+
name: string;
|
|
93
|
+
}) | (ExecutingState<T> & {
|
|
94
|
+
name: string;
|
|
95
|
+
}) | (InProgressState<T> & {
|
|
96
|
+
name: string;
|
|
97
|
+
});
|
|
98
|
+
type FrontendActionAvailability = "disabled" | "enabled" | "remote" | "frontend";
|
|
99
|
+
type FrontendAction<T extends Parameter[] | [] = [], N extends string = string> = Action<T> & {
|
|
100
|
+
name: Exclude<N, "*">;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Use `available` instead.
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
available?: FrontendActionAvailability;
|
|
106
|
+
pairedAction?: string;
|
|
107
|
+
followUp?: boolean;
|
|
108
|
+
} & ({
|
|
109
|
+
render?: string | (T extends [] ? (props: ActionRenderPropsNoArgs<T>) => string | React$1.ReactElement : (props: ActionRenderProps<T>) => string | React$1.ReactElement); /** @deprecated use renderAndWaitForResponse instead */
|
|
110
|
+
renderAndWait?: never;
|
|
111
|
+
renderAndWaitForResponse?: never;
|
|
112
|
+
} | {
|
|
113
|
+
render?: never; /** @deprecated use renderAndWaitForResponse instead */
|
|
114
|
+
renderAndWait?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
|
|
115
|
+
renderAndWaitForResponse?: T extends [] ? (props: ActionRenderPropsNoArgsWait<T>) => React$1.ReactElement : (props: ActionRenderPropsWait<T>) => React$1.ReactElement;
|
|
116
|
+
handler?: never;
|
|
117
|
+
});
|
|
118
|
+
type CatchAllFrontendAction = {
|
|
119
|
+
name: "*";
|
|
120
|
+
render: (props: CatchAllActionRenderProps<any>) => React$1.ReactElement;
|
|
121
|
+
};
|
|
122
|
+
type RenderFunctionStatus = ActionRenderProps<any>["status"];
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/hooks/use-tree.d.ts
|
|
125
|
+
type TreeNodeId = string;
|
|
126
|
+
interface TreeNode {
|
|
127
|
+
id: TreeNodeId;
|
|
128
|
+
value: string;
|
|
129
|
+
children: TreeNode[];
|
|
130
|
+
parentId?: TreeNodeId;
|
|
131
|
+
categories: Set<string>;
|
|
132
|
+
}
|
|
133
|
+
type Tree = TreeNode[];
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/types/document-pointer.d.ts
|
|
136
|
+
interface DocumentPointer {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
sourceApplication: string;
|
|
140
|
+
iconImageUri: string;
|
|
141
|
+
getContents: () => string;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/types/system-message.d.ts
|
|
145
|
+
type SystemMessageFunction = (contextString: string, additionalInstructions?: string) => string;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/types/chat-suggestion-configuration.d.ts
|
|
148
|
+
interface CopilotChatSuggestionConfiguration {
|
|
149
|
+
/**
|
|
150
|
+
* A prompt or instructions for the GPT to generate suggestions.
|
|
151
|
+
*/
|
|
152
|
+
instructions: string;
|
|
153
|
+
/**
|
|
154
|
+
* The minimum number of suggestions to generate. Defaults to `1`.
|
|
155
|
+
* @default 1
|
|
156
|
+
*/
|
|
157
|
+
minSuggestions?: number;
|
|
158
|
+
/**
|
|
159
|
+
* The maximum number of suggestions to generate. Defaults to `3`.
|
|
160
|
+
* @default 1
|
|
161
|
+
*/
|
|
162
|
+
maxSuggestions?: number;
|
|
163
|
+
/**
|
|
164
|
+
* An optional class name to apply to the suggestions.
|
|
165
|
+
*/
|
|
166
|
+
className?: string;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/types/crew.d.ts
|
|
170
|
+
/**
|
|
171
|
+
* Status of a response or action that requires user input
|
|
172
|
+
*/
|
|
173
|
+
type CrewsResponseStatus = "inProgress" | "complete" | "executing";
|
|
174
|
+
/**
|
|
175
|
+
* Response data structure for the ResponseRenderer
|
|
176
|
+
*/
|
|
177
|
+
interface CrewsResponse {
|
|
178
|
+
/**
|
|
179
|
+
* Unique identifier for the response
|
|
180
|
+
*/
|
|
181
|
+
id: string;
|
|
182
|
+
/**
|
|
183
|
+
* The content of the response to display
|
|
184
|
+
*/
|
|
185
|
+
content: string;
|
|
186
|
+
/**
|
|
187
|
+
* Optional metadata for the response
|
|
188
|
+
*/
|
|
189
|
+
metadata?: Record<string, any>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Base state item interface for agent state items
|
|
193
|
+
*/
|
|
194
|
+
interface CrewsStateItem {
|
|
195
|
+
/**
|
|
196
|
+
* Unique identifier for the item
|
|
197
|
+
*/
|
|
198
|
+
id: string;
|
|
199
|
+
/**
|
|
200
|
+
* Timestamp when the item was created
|
|
201
|
+
*/
|
|
202
|
+
timestamp: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Tool execution state item
|
|
206
|
+
*/
|
|
207
|
+
interface CrewsToolStateItem extends CrewsStateItem {
|
|
208
|
+
/**
|
|
209
|
+
* Name of the tool that was executed
|
|
210
|
+
*/
|
|
211
|
+
tool: string;
|
|
212
|
+
/**
|
|
213
|
+
* Optional thought process for the tool execution
|
|
214
|
+
*/
|
|
215
|
+
thought?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Result of the tool execution
|
|
218
|
+
*/
|
|
219
|
+
result?: any;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Task state item
|
|
223
|
+
*/
|
|
224
|
+
interface CrewsTaskStateItem extends CrewsStateItem {
|
|
225
|
+
/**
|
|
226
|
+
* Name of the task
|
|
227
|
+
*/
|
|
228
|
+
name: string;
|
|
229
|
+
/**
|
|
230
|
+
* Description of the task
|
|
231
|
+
*/
|
|
232
|
+
description?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* AgentState containing information about steps and tasks
|
|
236
|
+
*/
|
|
237
|
+
interface CrewsAgentState {
|
|
238
|
+
/**
|
|
239
|
+
* Array of tool execution steps
|
|
240
|
+
*/
|
|
241
|
+
steps?: CrewsToolStateItem[];
|
|
242
|
+
/**
|
|
243
|
+
* Array of tasks
|
|
244
|
+
*/
|
|
245
|
+
tasks?: CrewsTaskStateItem[];
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/types/interrupt-action.d.ts
|
|
249
|
+
interface LangGraphInterruptRenderHandlerProps<TEventValue = any> {
|
|
250
|
+
event: LangGraphInterruptEvent<TEventValue>;
|
|
251
|
+
resolve: (resolution: string) => void;
|
|
252
|
+
}
|
|
253
|
+
interface LangGraphInterruptRenderProps<TEventValue = any> {
|
|
254
|
+
result: unknown;
|
|
255
|
+
event: LangGraphInterruptEvent<TEventValue>;
|
|
256
|
+
resolve: (resolution: string) => void;
|
|
257
|
+
}
|
|
258
|
+
interface LangGraphInterruptRender<TEventValue = any> {
|
|
259
|
+
id: string;
|
|
260
|
+
/**
|
|
261
|
+
* The handler function to handle the event.
|
|
262
|
+
*/
|
|
263
|
+
handler?: (props: LangGraphInterruptRenderHandlerProps<TEventValue>) => any | Promise<any>;
|
|
264
|
+
/**
|
|
265
|
+
* The render function to handle the event.
|
|
266
|
+
*/
|
|
267
|
+
render?: (props: LangGraphInterruptRenderProps<TEventValue>) => string | React.ReactElement;
|
|
268
|
+
/**
|
|
269
|
+
* Method that returns a boolean, indicating if the interrupt action should run
|
|
270
|
+
* Useful when using multiple interrupts
|
|
271
|
+
*/
|
|
272
|
+
enabled?: (args: {
|
|
273
|
+
eventValue: TEventValue;
|
|
274
|
+
agentMetadata: AgentSession;
|
|
275
|
+
}) => boolean;
|
|
276
|
+
}
|
|
277
|
+
type LangGraphInterruptAction = LangGraphInterruptRender & {
|
|
278
|
+
event?: LangGraphInterruptEvent;
|
|
279
|
+
};
|
|
280
|
+
type LangGraphInterruptActionSetterArgs = Partial<LangGraphInterruptRender> | null;
|
|
281
|
+
type LangGraphInterruptActionSetter = (action: LangGraphInterruptActionSetterArgs) => void;
|
|
282
|
+
interface QueuedInterruptEvent {
|
|
283
|
+
eventId: string;
|
|
284
|
+
threadId: string;
|
|
285
|
+
event: LangGraphInterruptEvent;
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/types/coagent-action.d.ts
|
|
289
|
+
type CoAgentStateRenderProps<T> = {
|
|
290
|
+
state: T;
|
|
291
|
+
nodeName: string;
|
|
292
|
+
status: "inProgress" | "complete";
|
|
293
|
+
};
|
|
294
|
+
type CoAgentStateRenderHandlerArguments<T> = {
|
|
295
|
+
nodeName: string;
|
|
296
|
+
state: T;
|
|
297
|
+
};
|
|
298
|
+
interface CoAgentStateRender<T = any> {
|
|
299
|
+
/**
|
|
300
|
+
* The name of the coagent.
|
|
301
|
+
*/
|
|
302
|
+
name: string;
|
|
303
|
+
/**
|
|
304
|
+
* The node name of the coagent.
|
|
305
|
+
*/
|
|
306
|
+
nodeName?: string;
|
|
307
|
+
/**
|
|
308
|
+
* The handler function to handle the state of the agent.
|
|
309
|
+
*/
|
|
310
|
+
handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* The render function to handle the state of the agent.
|
|
313
|
+
*/
|
|
314
|
+
render?: ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null) | string;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/types/coagent-state.d.ts
|
|
318
|
+
interface CoagentState {
|
|
319
|
+
name: string;
|
|
320
|
+
state: any;
|
|
321
|
+
running: boolean;
|
|
322
|
+
active: boolean;
|
|
323
|
+
threadId?: string;
|
|
324
|
+
config?: {
|
|
325
|
+
configurable?: Record<string, any>;
|
|
326
|
+
[key: string]: any;
|
|
327
|
+
};
|
|
328
|
+
nodeName?: string;
|
|
329
|
+
runId?: string;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/context/copilot-context.d.ts
|
|
333
|
+
/**
|
|
334
|
+
* Interface for the configuration of the Copilot API.
|
|
335
|
+
*/
|
|
336
|
+
interface CopilotApiConfig {
|
|
337
|
+
/**
|
|
338
|
+
* The public API key for Copilot Cloud.
|
|
339
|
+
*/
|
|
340
|
+
publicApiKey?: string;
|
|
341
|
+
/**
|
|
342
|
+
* The configuration for Copilot Cloud.
|
|
343
|
+
*/
|
|
344
|
+
cloud?: CopilotCloudConfig;
|
|
345
|
+
/**
|
|
346
|
+
* The endpoint for the chat API.
|
|
347
|
+
*/
|
|
348
|
+
chatApiEndpoint: string;
|
|
349
|
+
/**
|
|
350
|
+
* The endpoint for the Copilot transcribe audio service.
|
|
351
|
+
*/
|
|
352
|
+
transcribeAudioUrl?: string;
|
|
353
|
+
/**
|
|
354
|
+
* The endpoint for the Copilot text to speech service.
|
|
355
|
+
*/
|
|
356
|
+
textToSpeechUrl?: string;
|
|
357
|
+
/**
|
|
358
|
+
* additional headers to be sent with the request
|
|
359
|
+
* @default {}
|
|
360
|
+
* @example
|
|
361
|
+
* ```
|
|
362
|
+
* {
|
|
363
|
+
* 'Authorization': 'Bearer your_token_here'
|
|
364
|
+
* }
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
headers: Record<string, string>;
|
|
368
|
+
/**
|
|
369
|
+
* Custom properties to be sent with the request
|
|
370
|
+
* @default {}
|
|
371
|
+
* @example
|
|
372
|
+
* ```
|
|
373
|
+
* {
|
|
374
|
+
* 'user_id': 'user_id'
|
|
375
|
+
* }
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
properties?: Record<string, any>;
|
|
379
|
+
/**
|
|
380
|
+
* Indicates whether the user agent should send or receive cookies from the other domain
|
|
381
|
+
* in the case of cross-origin requests.
|
|
382
|
+
*/
|
|
383
|
+
credentials?: RequestCredentials;
|
|
384
|
+
/**
|
|
385
|
+
* Optional configuration for connecting to Model Context Protocol (MCP) servers.
|
|
386
|
+
* This is typically derived from the CopilotKitProps and used internally.
|
|
387
|
+
* @experimental
|
|
388
|
+
*/
|
|
389
|
+
mcpServers?: Array<{
|
|
390
|
+
endpoint: string;
|
|
391
|
+
apiKey?: string;
|
|
392
|
+
}>;
|
|
393
|
+
}
|
|
394
|
+
type InChatRenderFunction<TProps = ActionRenderProps<any> | CatchAllActionRenderProps<any>> = (props: TProps) => string | React$1.JSX.Element;
|
|
395
|
+
type CoagentInChatRenderFunction = (props: CoAgentStateRenderProps<any>) => string | React$1.JSX.Element | undefined | null;
|
|
396
|
+
interface ChatComponentsCache {
|
|
397
|
+
actions: Record<string, InChatRenderFunction | string>;
|
|
398
|
+
coAgentStateRenders: Record<string, CoagentInChatRenderFunction | string>;
|
|
399
|
+
}
|
|
400
|
+
interface AgentSession {
|
|
401
|
+
agentName: string;
|
|
402
|
+
threadId?: string;
|
|
403
|
+
nodeName?: string;
|
|
404
|
+
}
|
|
405
|
+
interface AuthState {
|
|
406
|
+
status: "authenticated" | "unauthenticated";
|
|
407
|
+
authHeaders: Record<string, string>;
|
|
408
|
+
userId?: string;
|
|
409
|
+
metadata?: Record<string, any>;
|
|
410
|
+
}
|
|
411
|
+
type ActionName = string;
|
|
412
|
+
interface CopilotContextParams {
|
|
413
|
+
actions: Record<string, FrontendAction<any>>;
|
|
414
|
+
setAction: (id: string, action: FrontendAction<any>) => void;
|
|
415
|
+
removeAction: (id: string) => void;
|
|
416
|
+
setRegisteredActions: (actionConfig: any) => string;
|
|
417
|
+
removeRegisteredAction: (actionKey: string) => void;
|
|
418
|
+
chatComponentsCache: React$1.RefObject<ChatComponentsCache>;
|
|
419
|
+
getFunctionCallHandler: (customEntryPoints?: Record<string, FrontendAction<any>>) => FunctionCallHandler;
|
|
420
|
+
addContext: (context: string, parentId?: string, categories?: string[]) => TreeNodeId;
|
|
421
|
+
removeContext: (id: TreeNodeId) => void;
|
|
422
|
+
getAllContext: () => Tree;
|
|
423
|
+
getContextString: (documents: DocumentPointer[], categories: string[]) => string;
|
|
424
|
+
addDocumentContext: (documentPointer: DocumentPointer, categories?: string[]) => TreeNodeId;
|
|
425
|
+
removeDocumentContext: (documentId: string) => void;
|
|
426
|
+
getDocumentsContext: (categories: string[]) => DocumentPointer[];
|
|
427
|
+
isLoading: boolean;
|
|
428
|
+
setIsLoading: React$1.Dispatch<React$1.SetStateAction<boolean>>;
|
|
429
|
+
chatSuggestionConfiguration: {
|
|
430
|
+
[key: string]: CopilotChatSuggestionConfiguration;
|
|
431
|
+
};
|
|
432
|
+
addChatSuggestionConfiguration: (id: string, suggestion: CopilotChatSuggestionConfiguration) => void;
|
|
433
|
+
removeChatSuggestionConfiguration: (id: string) => void;
|
|
434
|
+
chatInstructions: string;
|
|
435
|
+
setChatInstructions: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
436
|
+
additionalInstructions?: string[];
|
|
437
|
+
setAdditionalInstructions: React$1.Dispatch<React$1.SetStateAction<string[]>>;
|
|
438
|
+
copilotApiConfig: CopilotApiConfig;
|
|
439
|
+
showDevConsole: boolean;
|
|
440
|
+
coagentStates: Record<string, CoagentState>;
|
|
441
|
+
setCoagentStates: React$1.Dispatch<React$1.SetStateAction<Record<string, CoagentState>>>;
|
|
442
|
+
coagentStatesRef: React$1.RefObject<Record<string, CoagentState>>;
|
|
443
|
+
setCoagentStatesWithRef: (value: Record<string, CoagentState> | ((prev: Record<string, CoagentState>) => Record<string, CoagentState>)) => void;
|
|
444
|
+
agentSession: AgentSession | null;
|
|
445
|
+
setAgentSession: React$1.Dispatch<React$1.SetStateAction<AgentSession | null>>;
|
|
446
|
+
agentLock: string | null;
|
|
447
|
+
threadId: string;
|
|
448
|
+
setThreadId: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
449
|
+
runId: string | null;
|
|
450
|
+
setRunId: React$1.Dispatch<React$1.SetStateAction<string | null>>;
|
|
451
|
+
chatAbortControllerRef: React$1.MutableRefObject<AbortController | null>;
|
|
452
|
+
/**
|
|
453
|
+
* The forwarded parameters to use for the task.
|
|
454
|
+
*/
|
|
455
|
+
forwardedParameters?: Partial<Pick<ForwardedParametersInput, "temperature">>;
|
|
456
|
+
availableAgents: Agent[];
|
|
457
|
+
/**
|
|
458
|
+
* The auth states for the CopilotKit.
|
|
459
|
+
*/
|
|
460
|
+
authStates_c?: Record<ActionName, AuthState>;
|
|
461
|
+
setAuthStates_c?: React$1.Dispatch<React$1.SetStateAction<Record<ActionName, AuthState>>>;
|
|
462
|
+
/**
|
|
463
|
+
* The auth config for the CopilotKit.
|
|
464
|
+
*/
|
|
465
|
+
authConfig_c?: {
|
|
466
|
+
SignInComponent: React$1.ComponentType<{
|
|
467
|
+
onSignInComplete: (authState: AuthState) => void;
|
|
468
|
+
}>;
|
|
469
|
+
};
|
|
470
|
+
extensions: ExtensionsInput;
|
|
471
|
+
setExtensions: React$1.Dispatch<React$1.SetStateAction<ExtensionsInput>>;
|
|
472
|
+
interruptActions: Record<string, LangGraphInterruptRender>;
|
|
473
|
+
setInterruptAction: LangGraphInterruptActionSetter;
|
|
474
|
+
removeInterruptAction: (actionId: string) => void;
|
|
475
|
+
interruptEventQueue: Record<string, QueuedInterruptEvent[]>;
|
|
476
|
+
addInterruptEvent: (queuedEvent: QueuedInterruptEvent) => void;
|
|
477
|
+
resolveInterruptEvent: (threadId: string, eventId: string, response: string) => void;
|
|
478
|
+
/**
|
|
479
|
+
* Optional trace handler for comprehensive debugging and observability.
|
|
480
|
+
*/
|
|
481
|
+
onError: CopilotErrorHandler;
|
|
482
|
+
bannerError: CopilotKitError | null;
|
|
483
|
+
setBannerError: React$1.Dispatch<React$1.SetStateAction<CopilotKitError | null>>;
|
|
484
|
+
internalErrorHandlers: Record<string, CopilotErrorHandler>;
|
|
485
|
+
setInternalErrorHandler: (handler: Record<string, CopilotErrorHandler>) => void;
|
|
486
|
+
removeInternalErrorHandler: (id: string) => void;
|
|
487
|
+
}
|
|
488
|
+
declare const CopilotContext: React$1.Context<CopilotContextParams>;
|
|
489
|
+
declare function useCopilotContext(): CopilotContextParams;
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/components/copilot-provider/copilotkit-props.d.ts
|
|
492
|
+
/**
|
|
493
|
+
* Props for CopilotKit.
|
|
494
|
+
*/
|
|
495
|
+
/**
|
|
496
|
+
* We shouldn't need this `Omit` here, but using it because `CopilotKitProps`
|
|
497
|
+
* and `CopilotKitProviderProps` have non-identical `children` types
|
|
498
|
+
*
|
|
499
|
+
* TODO: Remove this `Omit` once this is resolved.
|
|
500
|
+
*/
|
|
501
|
+
interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children"> {
|
|
502
|
+
/**
|
|
503
|
+
* Your Copilot Cloud API key.
|
|
504
|
+
*
|
|
505
|
+
* Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
|
|
506
|
+
*/
|
|
507
|
+
publicApiKey?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Your public license key for accessing premium CopilotKit features.
|
|
510
|
+
*
|
|
511
|
+
* Don't have it yet? Go to https://cloud.copilotkit.ai and get one for free.
|
|
512
|
+
*/
|
|
513
|
+
publicLicenseKey?: string;
|
|
514
|
+
/**
|
|
515
|
+
* Restrict input to a specific topic.
|
|
516
|
+
* @deprecated Use `guardrails_c` instead to control input restrictions
|
|
517
|
+
*/
|
|
518
|
+
cloudRestrictToTopic?: {
|
|
519
|
+
validTopics?: string[];
|
|
520
|
+
invalidTopics?: string[];
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Restrict input to specific topics using guardrails.
|
|
524
|
+
* @remarks
|
|
525
|
+
*
|
|
526
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
527
|
+
*/
|
|
528
|
+
guardrails_c?: {
|
|
529
|
+
validTopics?: string[];
|
|
530
|
+
invalidTopics?: string[];
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* The endpoint for the Copilot Runtime instance. [Click here for more information](/concepts/copilot-runtime).
|
|
534
|
+
*/
|
|
535
|
+
runtimeUrl?: string;
|
|
536
|
+
/**
|
|
537
|
+
* The endpoint for the Copilot transcribe audio service.
|
|
538
|
+
*/
|
|
539
|
+
transcribeAudioUrl?: string;
|
|
540
|
+
/**
|
|
541
|
+
* The endpoint for the Copilot text to speech service.
|
|
542
|
+
*/
|
|
543
|
+
textToSpeechUrl?: string;
|
|
544
|
+
/**
|
|
545
|
+
* Additional headers to be sent with the request.
|
|
546
|
+
*
|
|
547
|
+
* For example:
|
|
548
|
+
* ```json
|
|
549
|
+
* {
|
|
550
|
+
* "Authorization": "Bearer X"
|
|
551
|
+
* }
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
headers?: Record<string, string>;
|
|
555
|
+
/**
|
|
556
|
+
* The children to be rendered within the CopilotKit.
|
|
557
|
+
*/
|
|
558
|
+
children: ReactNode;
|
|
559
|
+
/**
|
|
560
|
+
* Custom properties to be sent with the request.
|
|
561
|
+
* Can include threadMetadata for thread creation and authorization for LangGraph Platform authentication.
|
|
562
|
+
* For example:
|
|
563
|
+
* ```js
|
|
564
|
+
* {
|
|
565
|
+
* 'user_id': 'users_id',
|
|
566
|
+
* 'authorization': 'your-auth-token', // For LangGraph Platform authentication
|
|
567
|
+
* threadMetadata: {
|
|
568
|
+
* 'account_id': '123',
|
|
569
|
+
* 'user_type': 'premium'
|
|
570
|
+
* }
|
|
571
|
+
* }
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
* **Note**: The `authorization` property is automatically forwarded to LangGraph agents. See the [LangGraph Agent Authentication Guide](/coagents/shared/guides/langgraph-platform-authentication) for details.
|
|
575
|
+
*/
|
|
576
|
+
properties?: Record<string, any>;
|
|
577
|
+
/**
|
|
578
|
+
* Indicates whether the user agent should send or receive cookies from the other domain
|
|
579
|
+
* in the case of cross-origin requests.
|
|
580
|
+
*
|
|
581
|
+
* To enable HTTP-only cookie authentication, set `credentials="include"` and configure
|
|
582
|
+
* CORS on your runtime endpoint:
|
|
583
|
+
*
|
|
584
|
+
* ```tsx
|
|
585
|
+
* // Frontend (https://myapp.com)
|
|
586
|
+
* <CopilotKit runtimeUrl="https://api.myapp.com/copilotkit" credentials="include">
|
|
587
|
+
* {children}
|
|
588
|
+
* </CopilotKit>
|
|
589
|
+
*
|
|
590
|
+
* // Backend (https://api.myapp.com)
|
|
591
|
+
* copilotRuntimeNextJSAppRouterEndpoint({
|
|
592
|
+
* runtime,
|
|
593
|
+
* endpoint: "/copilotkit",
|
|
594
|
+
* cors: {
|
|
595
|
+
* origin: "https://myapp.com",
|
|
596
|
+
* credentials: true,
|
|
597
|
+
* },
|
|
598
|
+
* });
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
601
|
+
credentials?: RequestCredentials;
|
|
602
|
+
/**
|
|
603
|
+
* Whether to show the dev console.
|
|
604
|
+
*
|
|
605
|
+
* Set to `true` to show error banners and toasts, `false` to hide all error UI.
|
|
606
|
+
* Defaults to `false` for production safety.
|
|
607
|
+
*/
|
|
608
|
+
showDevConsole?: boolean;
|
|
609
|
+
/**
|
|
610
|
+
* The name of the agent to use.
|
|
611
|
+
*/
|
|
612
|
+
agent?: string;
|
|
613
|
+
/**
|
|
614
|
+
* The forwarded parameters to use for the task.
|
|
615
|
+
*/
|
|
616
|
+
forwardedParameters?: Pick<ForwardedParametersInput, "temperature">;
|
|
617
|
+
/**
|
|
618
|
+
* The auth config to use for the CopilotKit.
|
|
619
|
+
* @remarks
|
|
620
|
+
*
|
|
621
|
+
* This feature is only available when using CopilotKit's hosted cloud service. To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey. The feature allows restricting chat conversations to specific topics.
|
|
622
|
+
*/
|
|
623
|
+
authConfig_c?: {
|
|
624
|
+
SignInComponent: React.ComponentType<{
|
|
625
|
+
onSignInComplete: (authState: AuthState) => void;
|
|
626
|
+
}>;
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* The thread id to use for the CopilotKit.
|
|
630
|
+
*/
|
|
631
|
+
threadId?: string;
|
|
632
|
+
/**
|
|
633
|
+
* Optional error handler for comprehensive debugging and observability.
|
|
634
|
+
*
|
|
635
|
+
* **Requires publicApiKey**: Error handling only works when publicApiKey is provided.
|
|
636
|
+
* This is a premium Copilot Cloud feature.
|
|
637
|
+
*
|
|
638
|
+
* @param errorEvent - Structured error event with rich debugging context
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```typescript
|
|
642
|
+
* <CopilotKit
|
|
643
|
+
* publicApiKey="ck_pub_your_key"
|
|
644
|
+
* onError={(errorEvent) => {
|
|
645
|
+
* debugDashboard.capture(errorEvent);
|
|
646
|
+
* }}
|
|
647
|
+
* >
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
onError?: CopilotErrorHandler;
|
|
651
|
+
/**
|
|
652
|
+
* Enable or disable the CopilotKit Inspector, letting you inspect AG-UI events,
|
|
653
|
+
* view agent messages, check agent state, and visualize agent context. Defaults
|
|
654
|
+
* to enabled.
|
|
655
|
+
*/
|
|
656
|
+
enableInspector?: boolean;
|
|
657
|
+
}
|
|
658
|
+
//#endregion
|
|
659
|
+
//#region src/components/copilot-provider/copilotkit.d.ts
|
|
660
|
+
declare function CopilotKit({
|
|
661
|
+
children,
|
|
662
|
+
...props
|
|
663
|
+
}: CopilotKitProps): react_jsx_runtime0.JSX.Element;
|
|
664
|
+
declare const defaultCopilotContextCategories: string[];
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/context/copilot-messages-context.d.ts
|
|
667
|
+
interface CopilotMessagesContextParams {
|
|
668
|
+
messages: Message$1[];
|
|
669
|
+
setMessages: React$1.Dispatch<React$1.SetStateAction<Message$1[]>>;
|
|
670
|
+
suggestions: Suggestion[];
|
|
671
|
+
setSuggestions: React$1.Dispatch<React$1.SetStateAction<Suggestion[]>>;
|
|
672
|
+
}
|
|
673
|
+
declare const CopilotMessagesContext: React$1.Context<CopilotMessagesContextParams>;
|
|
674
|
+
declare function useCopilotMessagesContext(): CopilotMessagesContextParams;
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region src/context/coagent-state-renders-context.d.ts
|
|
677
|
+
interface StateRenderClaim {
|
|
678
|
+
stateRenderId: string;
|
|
679
|
+
stateSnapshot?: any;
|
|
680
|
+
runId?: string;
|
|
681
|
+
messageIndex?: number;
|
|
682
|
+
locked?: boolean;
|
|
683
|
+
}
|
|
684
|
+
type ClaimsRef = Record<string, StateRenderClaim>;
|
|
685
|
+
interface CoAgentStateRendersContextValue {
|
|
686
|
+
coAgentStateRenders: Record<string, CoAgentStateRender<any>>;
|
|
687
|
+
setCoAgentStateRender: (id: string, stateRender: CoAgentStateRender<any>) => void;
|
|
688
|
+
removeCoAgentStateRender: (id: string) => void;
|
|
689
|
+
claimsRef: RefObject<ClaimsRef>;
|
|
690
|
+
}
|
|
691
|
+
declare const CoAgentStateRendersContext: React$1.Context<CoAgentStateRendersContextValue | undefined>;
|
|
692
|
+
declare function CoAgentStateRendersProvider({
|
|
693
|
+
children
|
|
694
|
+
}: {
|
|
695
|
+
children: ReactNode;
|
|
696
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
697
|
+
declare function useCoAgentStateRenders(): CoAgentStateRendersContextValue;
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/context/threads-context.d.ts
|
|
700
|
+
interface ThreadsContextValue {
|
|
701
|
+
threadId: string;
|
|
702
|
+
setThreadId: (value: SetStateAction<string>) => void;
|
|
703
|
+
}
|
|
704
|
+
declare const ThreadsContext: React$1.Context<ThreadsContextValue | undefined>;
|
|
705
|
+
interface ThreadsProviderProps {
|
|
706
|
+
children: ReactNode;
|
|
707
|
+
threadId?: string;
|
|
708
|
+
}
|
|
709
|
+
declare function ThreadsProvider({
|
|
710
|
+
children,
|
|
711
|
+
threadId: explicitThreadId
|
|
712
|
+
}: ThreadsProviderProps): react_jsx_runtime0.JSX.Element;
|
|
713
|
+
declare function useThreads(): ThreadsContextValue;
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/hooks/use-copilot-chat_internal.d.ts
|
|
716
|
+
/**
|
|
717
|
+
* The type of suggestions to use in the chat.
|
|
718
|
+
*
|
|
719
|
+
* `auto` - Suggestions are generated automatically.
|
|
720
|
+
* `manual` - Suggestions are controlled programmatically.
|
|
721
|
+
* `SuggestionItem[]` - Static suggestions array.
|
|
722
|
+
*/
|
|
723
|
+
type ChatSuggestions = "auto" | "manual" | Omit<Suggestion, "isLoading">[];
|
|
724
|
+
interface AppendMessageOptions {
|
|
725
|
+
/**
|
|
726
|
+
* Whether to run the chat completion after appending the message. Defaults to `true`.
|
|
727
|
+
*/
|
|
728
|
+
followUp?: boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Whether to clear the suggestions after appending the message. Defaults to `true`.
|
|
731
|
+
*/
|
|
732
|
+
clearSuggestions?: boolean;
|
|
733
|
+
}
|
|
734
|
+
interface OnStopGenerationArguments {
|
|
735
|
+
/**
|
|
736
|
+
* The name of the currently executing agent.
|
|
737
|
+
*/
|
|
738
|
+
currentAgentName: string | undefined;
|
|
739
|
+
/**
|
|
740
|
+
* The messages in the chat.
|
|
741
|
+
*/
|
|
742
|
+
messages: Message[];
|
|
743
|
+
}
|
|
744
|
+
type OnReloadMessagesArguments = OnStopGenerationArguments & {
|
|
745
|
+
/**
|
|
746
|
+
* The message on which "regenerate" was pressed
|
|
747
|
+
*/
|
|
748
|
+
messageId: string;
|
|
749
|
+
};
|
|
750
|
+
type OnStopGeneration = (args: OnStopGenerationArguments) => void;
|
|
751
|
+
type OnReloadMessages = (args: OnReloadMessagesArguments) => void;
|
|
752
|
+
interface UseCopilotChatOptions {
|
|
753
|
+
/**
|
|
754
|
+
* A unique identifier for the chat. If not provided, a random one will be
|
|
755
|
+
* generated. When provided, the `useChat` hook with the same `id` will
|
|
756
|
+
* have shared states across components.
|
|
757
|
+
*/
|
|
758
|
+
id?: string;
|
|
759
|
+
/**
|
|
760
|
+
* HTTP headers to be sent with the API request.
|
|
761
|
+
*/
|
|
762
|
+
headers?: Record<string, string> | Headers;
|
|
763
|
+
/**
|
|
764
|
+
* Initial messages to populate the chat with.
|
|
765
|
+
*/
|
|
766
|
+
initialMessages?: Message[];
|
|
767
|
+
/**
|
|
768
|
+
* A function to generate the system message. Defaults to `defaultSystemMessage`.
|
|
769
|
+
*/
|
|
770
|
+
makeSystemMessage?: SystemMessageFunction;
|
|
771
|
+
/**
|
|
772
|
+
* Disables inclusion of CopilotKit’s default system message. When true, no system message is sent (this also suppresses any custom message from <code>makeSystemMessage</code>).
|
|
773
|
+
*/
|
|
774
|
+
disableSystemMessage?: boolean;
|
|
775
|
+
/**
|
|
776
|
+
* Controls the behavior of suggestions in the chat interface.
|
|
777
|
+
*
|
|
778
|
+
* `auto` (default) - Suggestions are generated automatically:
|
|
779
|
+
* - When the chat is first opened (empty state)
|
|
780
|
+
* - After each message exchange completes
|
|
781
|
+
* - Uses configuration from `useCopilotChatSuggestions` hooks
|
|
782
|
+
*
|
|
783
|
+
* `manual` - Suggestions are controlled programmatically:
|
|
784
|
+
* - Use `setSuggestions()` to set custom suggestions
|
|
785
|
+
* - Use `generateSuggestions()` to trigger AI generation
|
|
786
|
+
* - Access via `useCopilotChat` hook
|
|
787
|
+
*
|
|
788
|
+
* `SuggestionItem[]` - Static suggestions array:
|
|
789
|
+
* - Always shows the same suggestions
|
|
790
|
+
* - No AI generation involved
|
|
791
|
+
*/
|
|
792
|
+
suggestions?: ChatSuggestions;
|
|
793
|
+
onInProgress?: (isLoading: boolean) => void;
|
|
794
|
+
onSubmitMessage?: (messageContent: string) => Promise<void> | void;
|
|
795
|
+
onStopGeneration?: OnStopGeneration;
|
|
796
|
+
onReloadMessages?: OnReloadMessages;
|
|
797
|
+
}
|
|
798
|
+
interface MCPServerConfig {
|
|
799
|
+
endpoint: string;
|
|
800
|
+
apiKey?: string;
|
|
801
|
+
}
|
|
802
|
+
interface UseCopilotChatReturn$1 {
|
|
803
|
+
/**
|
|
804
|
+
* @deprecated use `messages` instead, this is an old non ag-ui version of the messages
|
|
805
|
+
* Array of messages currently visible in the chat interface
|
|
806
|
+
*
|
|
807
|
+
* This is the visible messages, not the raw messages from the runtime client.
|
|
808
|
+
*/
|
|
809
|
+
visibleMessages: Message$1[];
|
|
810
|
+
/**
|
|
811
|
+
* The messages that are currently in the chat in AG-UI format.
|
|
812
|
+
*/
|
|
813
|
+
messages: Message[];
|
|
814
|
+
/** @deprecated use `sendMessage` in `useCopilotChatHeadless_c` instead. This will be removed in a future major version. */
|
|
815
|
+
appendMessage: (message: Message$1, options?: AppendMessageOptions) => Promise<void>;
|
|
816
|
+
/**
|
|
817
|
+
* Send a new message to the chat
|
|
818
|
+
*
|
|
819
|
+
* ```tsx
|
|
820
|
+
* await sendMessage({
|
|
821
|
+
* id: "123",
|
|
822
|
+
* role: "user",
|
|
823
|
+
* content: "Hello, process this request",
|
|
824
|
+
* });
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
sendMessage: (message: Message, options?: AppendMessageOptions) => Promise<void>;
|
|
828
|
+
/**
|
|
829
|
+
* Replace all messages in the chat
|
|
830
|
+
*
|
|
831
|
+
* ```tsx
|
|
832
|
+
* setMessages([
|
|
833
|
+
* { id: "123", role: "user", content: "Hello, process this request" },
|
|
834
|
+
* { id: "456", role: "assistant", content: "Hello, I'm the assistant" },
|
|
835
|
+
* ]);
|
|
836
|
+
* ```
|
|
837
|
+
*
|
|
838
|
+
* **Deprecated** non-ag-ui version:
|
|
839
|
+
*
|
|
840
|
+
* ```tsx
|
|
841
|
+
* setMessages([
|
|
842
|
+
* new TextMessage({
|
|
843
|
+
* content: "Hello, process this request",
|
|
844
|
+
* role: gqlRole.User,
|
|
845
|
+
* }),
|
|
846
|
+
* new TextMessage({
|
|
847
|
+
* content: "Hello, I'm the assistant",
|
|
848
|
+
* role: gqlRole.Assistant,
|
|
849
|
+
* ]);
|
|
850
|
+
* ```
|
|
851
|
+
*
|
|
852
|
+
*/
|
|
853
|
+
setMessages: (messages: Message[] | Message$1[]) => void;
|
|
854
|
+
/**
|
|
855
|
+
* Remove a specific message by ID
|
|
856
|
+
*
|
|
857
|
+
* ```tsx
|
|
858
|
+
* deleteMessage("123");
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
861
|
+
deleteMessage: (messageId: string) => void;
|
|
862
|
+
/**
|
|
863
|
+
* Regenerate the response for a specific message
|
|
864
|
+
*
|
|
865
|
+
* ```tsx
|
|
866
|
+
* reloadMessages("123");
|
|
867
|
+
* ```
|
|
868
|
+
*/
|
|
869
|
+
reloadMessages: (messageId: string) => Promise<void>;
|
|
870
|
+
/**
|
|
871
|
+
* Stop the current message generation
|
|
872
|
+
*
|
|
873
|
+
* ```tsx
|
|
874
|
+
* if (isLoading) {
|
|
875
|
+
* stopGeneration();
|
|
876
|
+
* }
|
|
877
|
+
* ```
|
|
878
|
+
*/
|
|
879
|
+
stopGeneration: () => void;
|
|
880
|
+
/**
|
|
881
|
+
* Clear all messages and reset chat state
|
|
882
|
+
*
|
|
883
|
+
* ```tsx
|
|
884
|
+
* reset();
|
|
885
|
+
* console.log(messages); // []
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
reset: () => void;
|
|
889
|
+
/**
|
|
890
|
+
* Whether the chat is currently generating a response
|
|
891
|
+
*
|
|
892
|
+
* ```tsx
|
|
893
|
+
* if (isLoading) {
|
|
894
|
+
* console.log("Loading...");
|
|
895
|
+
* } else {
|
|
896
|
+
* console.log("Not loading");
|
|
897
|
+
* }
|
|
898
|
+
*/
|
|
899
|
+
isLoading: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Whether the chat agent is available to generate responses
|
|
902
|
+
*
|
|
903
|
+
* ```tsx
|
|
904
|
+
* if (isAvailable) {
|
|
905
|
+
* console.log("Loading...");
|
|
906
|
+
* } else {
|
|
907
|
+
* console.log("Not loading");
|
|
908
|
+
* }
|
|
909
|
+
*/
|
|
910
|
+
isAvailable: boolean;
|
|
911
|
+
/** Manually trigger chat completion (advanced usage) */
|
|
912
|
+
runChatCompletion: () => Promise<Message[]>;
|
|
913
|
+
/** MCP (Model Context Protocol) server configurations */
|
|
914
|
+
mcpServers: MCPServerConfig[];
|
|
915
|
+
/** Update MCP server configurations */
|
|
916
|
+
setMcpServers: (mcpServers: MCPServerConfig[]) => void;
|
|
917
|
+
/**
|
|
918
|
+
* Current suggestions array
|
|
919
|
+
* Use this to read the current suggestions or in conjunction with setSuggestions for manual control
|
|
920
|
+
*/
|
|
921
|
+
suggestions: Suggestion[];
|
|
922
|
+
/**
|
|
923
|
+
* Manually set suggestions
|
|
924
|
+
* Useful for manual mode or custom suggestion workflows
|
|
925
|
+
*/
|
|
926
|
+
setSuggestions: (suggestions: Omit<Suggestion, "isLoading">[]) => void;
|
|
927
|
+
/**
|
|
928
|
+
* Trigger AI-powered suggestion generation
|
|
929
|
+
* Uses configurations from useCopilotChatSuggestions hooks
|
|
930
|
+
* Respects global debouncing - only one generation can run at a time
|
|
931
|
+
*
|
|
932
|
+
* ```tsx
|
|
933
|
+
* generateSuggestions();
|
|
934
|
+
* console.log(suggestions); // [suggestion1, suggestion2, suggestion3]
|
|
935
|
+
* ```
|
|
936
|
+
*/
|
|
937
|
+
generateSuggestions: () => Promise<void>;
|
|
938
|
+
/**
|
|
939
|
+
* Clear all current suggestions
|
|
940
|
+
* Also resets suggestion generation state
|
|
941
|
+
*/
|
|
942
|
+
resetSuggestions: () => void;
|
|
943
|
+
/** Whether suggestions are currently being generated */
|
|
944
|
+
isLoadingSuggestions: boolean;
|
|
945
|
+
/** Interrupt content for human-in-the-loop workflows */
|
|
946
|
+
interrupt: string | React.ReactElement | null;
|
|
947
|
+
agent?: ReturnType<typeof useAgent>["agent"];
|
|
948
|
+
threadId?: string;
|
|
949
|
+
}
|
|
950
|
+
declare function useCopilotChatInternal({
|
|
951
|
+
suggestions,
|
|
952
|
+
onInProgress,
|
|
953
|
+
onSubmitMessage,
|
|
954
|
+
onStopGeneration,
|
|
955
|
+
onReloadMessages
|
|
956
|
+
}?: UseCopilotChatOptions): UseCopilotChatReturn$1;
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/hooks/use-copilot-chat.d.ts
|
|
959
|
+
type UseCopilotChatReturn = Omit<UseCopilotChatReturn$1, "messages" | "sendMessage" | "suggestions" | "setSuggestions" | "generateSuggestions" | "isLoadingSuggestions" | "resetSuggestions" | "interrupt" | "setMessages" | "deleteMessage">;
|
|
960
|
+
/**
|
|
961
|
+
* A lightweight React hook for headless chat interactions.
|
|
962
|
+
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
963
|
+
*
|
|
964
|
+
* **Open Source Friendly** - Works without requiring a `publicApiKey`.
|
|
965
|
+
*/
|
|
966
|
+
declare function useCopilotChat(options?: UseCopilotChatOptions): UseCopilotChatReturn;
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/hooks/use-copilot-chat-headless_c.d.ts
|
|
969
|
+
/**
|
|
970
|
+
* Enterprise React hook that provides complete chat functionality for fully custom UI implementations.
|
|
971
|
+
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
972
|
+
*
|
|
973
|
+
* **Requires a publicApiKey** - Sign up for free at https://cloud.copilotkit.ai/
|
|
974
|
+
*
|
|
975
|
+
* @param options - Configuration options for the chat
|
|
976
|
+
* @returns Complete chat interface with all enterprise features
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* ```tsx
|
|
980
|
+
* const { messages, sendMessage, suggestions, interrupt } = useCopilotChatHeadless_c();
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
declare function useCopilotChatHeadless_c(options?: UseCopilotChatOptions): UseCopilotChatReturn$1;
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/hooks/use-copilot-action.d.ts
|
|
986
|
+
/**
|
|
987
|
+
* useCopilotAction is a legacy hook maintained for backwards compatibility.
|
|
988
|
+
*
|
|
989
|
+
* To avoid violating React's Rules of Hooks (which prohibit conditional hook calls),
|
|
990
|
+
* we use a registration pattern:
|
|
991
|
+
* 1. This hook registers the action configuration with the CopilotContext
|
|
992
|
+
* 2. A renderer component in CopilotKit actually renders the appropriate hook wrapper
|
|
993
|
+
* 3. React properly manages hook state since components are rendered, not conditionally called
|
|
994
|
+
*
|
|
995
|
+
* This allows action types to change between renders without corrupting React's hook state.
|
|
996
|
+
*/
|
|
997
|
+
declare function useCopilotAction<const T extends Parameter[] | [] = []>(action: FrontendAction<T> | CatchAllFrontendAction, dependencies?: any[]): void;
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/hooks/use-coagent-state-render.d.ts
|
|
1000
|
+
/**
|
|
1001
|
+
* This hook is used to render agent state with custom UI components or text. This is particularly
|
|
1002
|
+
* useful for showing intermediate state or progress during Agentic Copilot operations.
|
|
1003
|
+
* To get started using rendering intermediate state through this hook, checkout the documentation.
|
|
1004
|
+
*
|
|
1005
|
+
* https://docs.copilotkit.ai/coagents/shared-state/predictive-state-updates
|
|
1006
|
+
*/
|
|
1007
|
+
declare function useCoAgentStateRender<T = any>(action: CoAgentStateRender<T>, dependencies?: any[]): void;
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region src/hooks/use-make-copilot-document-readable.d.ts
|
|
1010
|
+
/**
|
|
1011
|
+
* Makes a document readable by Copilot.
|
|
1012
|
+
* @param document The document to make readable.
|
|
1013
|
+
* @param categories The categories to associate with the document.
|
|
1014
|
+
* @param dependencies The dependencies to use for the effect.
|
|
1015
|
+
* @returns The id of the document.
|
|
1016
|
+
*/
|
|
1017
|
+
declare function useMakeCopilotDocumentReadable(document: DocumentPointer, categories?: string[], dependencies?: any[]): string | undefined;
|
|
1018
|
+
//#endregion
|
|
1019
|
+
//#region src/hooks/use-copilot-readable.d.ts
|
|
1020
|
+
/**
|
|
1021
|
+
* Options for the useCopilotReadable hook.
|
|
1022
|
+
*/
|
|
1023
|
+
interface UseCopilotReadableOptions {
|
|
1024
|
+
/**
|
|
1025
|
+
* The description of the information to be added to the Copilot context.
|
|
1026
|
+
*/
|
|
1027
|
+
description: string;
|
|
1028
|
+
/**
|
|
1029
|
+
* The value to be added to the Copilot context. Object values are automatically stringified.
|
|
1030
|
+
*/
|
|
1031
|
+
value: any;
|
|
1032
|
+
/**
|
|
1033
|
+
* The ID of the parent context, if any.
|
|
1034
|
+
*/
|
|
1035
|
+
parentId?: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* An array of categories to control which context are visible where. Particularly useful
|
|
1038
|
+
* with CopilotTextarea (see `useMakeAutosuggestionFunction`)
|
|
1039
|
+
*/
|
|
1040
|
+
categories?: string[];
|
|
1041
|
+
/**
|
|
1042
|
+
* Whether the context is available to the Copilot.
|
|
1043
|
+
*/
|
|
1044
|
+
available?: "enabled" | "disabled";
|
|
1045
|
+
/**
|
|
1046
|
+
* A custom conversion function to use to serialize the value to a string. If not provided, the value
|
|
1047
|
+
* will be serialized using `JSON.stringify`.
|
|
1048
|
+
*/
|
|
1049
|
+
convert?: (description: string, value: any) => string;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Adds the given information to the Copilot context to make it readable by Copilot.
|
|
1053
|
+
*/
|
|
1054
|
+
declare function useCopilotReadable({
|
|
1055
|
+
description,
|
|
1056
|
+
value,
|
|
1057
|
+
convert,
|
|
1058
|
+
available
|
|
1059
|
+
}: UseCopilotReadableOptions, dependencies?: any[]): string | undefined;
|
|
1060
|
+
//#endregion
|
|
1061
|
+
//#region src/hooks/use-coagent.d.ts
|
|
1062
|
+
interface UseCoagentOptionsBase {
|
|
1063
|
+
/**
|
|
1064
|
+
* The name of the agent being used.
|
|
1065
|
+
*/
|
|
1066
|
+
name: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* @deprecated - use "config.configurable"
|
|
1069
|
+
* Config to pass to a LangGraph Agent
|
|
1070
|
+
*/
|
|
1071
|
+
configurable?: Record<string, any>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Config to pass to a LangGraph Agent
|
|
1074
|
+
*/
|
|
1075
|
+
config?: {
|
|
1076
|
+
configurable?: Record<string, any>;
|
|
1077
|
+
[key: string]: any;
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
interface WithInternalStateManagementAndInitial<T> extends UseCoagentOptionsBase {
|
|
1081
|
+
/**
|
|
1082
|
+
* The initial state of the agent.
|
|
1083
|
+
*/
|
|
1084
|
+
initialState: T;
|
|
1085
|
+
}
|
|
1086
|
+
interface WithInternalStateManagement extends UseCoagentOptionsBase {
|
|
1087
|
+
/**
|
|
1088
|
+
* Optional initialState with default type any
|
|
1089
|
+
*/
|
|
1090
|
+
initialState?: any;
|
|
1091
|
+
}
|
|
1092
|
+
interface WithExternalStateManagement<T> extends UseCoagentOptionsBase {
|
|
1093
|
+
/**
|
|
1094
|
+
* The current state of the agent.
|
|
1095
|
+
*/
|
|
1096
|
+
state: T;
|
|
1097
|
+
/**
|
|
1098
|
+
* A function to update the state of the agent.
|
|
1099
|
+
*/
|
|
1100
|
+
setState: (newState: T | ((prevState: T | undefined) => T)) => void;
|
|
1101
|
+
}
|
|
1102
|
+
type UseCoagentOptions<T> = WithInternalStateManagementAndInitial<T> | WithInternalStateManagement | WithExternalStateManagement<T>;
|
|
1103
|
+
interface UseCoagentReturnType<T> {
|
|
1104
|
+
/**
|
|
1105
|
+
* The name of the agent being used.
|
|
1106
|
+
*/
|
|
1107
|
+
name: string;
|
|
1108
|
+
/**
|
|
1109
|
+
* The name of the current LangGraph node.
|
|
1110
|
+
*/
|
|
1111
|
+
nodeName?: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* The ID of the thread the agent is running in.
|
|
1114
|
+
*/
|
|
1115
|
+
threadId?: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* A boolean indicating if the agent is currently running.
|
|
1118
|
+
*/
|
|
1119
|
+
running: boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* The current state of the agent.
|
|
1122
|
+
*/
|
|
1123
|
+
state: T;
|
|
1124
|
+
/**
|
|
1125
|
+
* A function to update the state of the agent.
|
|
1126
|
+
*/
|
|
1127
|
+
setState: (newState: T | ((prevState: T | undefined) => T)) => void;
|
|
1128
|
+
/**
|
|
1129
|
+
* A function to start the agent.
|
|
1130
|
+
*/
|
|
1131
|
+
start: () => void;
|
|
1132
|
+
/**
|
|
1133
|
+
* A function to stop the agent.
|
|
1134
|
+
*/
|
|
1135
|
+
stop: () => void;
|
|
1136
|
+
/**
|
|
1137
|
+
* A function to re-run the agent. The hint function can be used to provide a hint to the agent
|
|
1138
|
+
* about why it is being re-run again.
|
|
1139
|
+
*/
|
|
1140
|
+
run: (...args: any[]) => Promise<any>;
|
|
1141
|
+
}
|
|
1142
|
+
interface HintFunctionParams {
|
|
1143
|
+
/**
|
|
1144
|
+
* The previous state of the agent.
|
|
1145
|
+
*/
|
|
1146
|
+
previousState: any;
|
|
1147
|
+
/**
|
|
1148
|
+
* The current state of the agent.
|
|
1149
|
+
*/
|
|
1150
|
+
currentState: any;
|
|
1151
|
+
}
|
|
1152
|
+
type HintFunction = (params: HintFunctionParams) => Message | undefined;
|
|
1153
|
+
/**
|
|
1154
|
+
* This hook is used to integrate an agent into your application. With its use, you can
|
|
1155
|
+
* render and update the state of the agent, allowing for a dynamic and interactive experience.
|
|
1156
|
+
* We call these shared state experiences "agentic copilots". To get started using agentic copilots, which
|
|
1157
|
+
* we refer to as CoAgents, checkout the documentation at https://docs.copilotkit.ai/coagents/quickstart/langgraph.
|
|
1158
|
+
*/
|
|
1159
|
+
declare function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentReturnType<T>;
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region src/hooks/use-copilot-runtime-client.d.ts
|
|
1162
|
+
interface CopilotRuntimeClientHookOptions extends CopilotRuntimeClientOptions {
|
|
1163
|
+
showDevConsole?: boolean;
|
|
1164
|
+
onError: CopilotErrorHandler;
|
|
1165
|
+
}
|
|
1166
|
+
declare const useCopilotRuntimeClient: (options: CopilotRuntimeClientHookOptions) => CopilotRuntimeClient;
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/hooks/use-copilot-authenticated-action.d.ts
|
|
1169
|
+
/**
|
|
1170
|
+
* Hook to create an authenticated action that requires user sign-in before execution.
|
|
1171
|
+
*
|
|
1172
|
+
* @remarks
|
|
1173
|
+
* This feature is only available when using CopilotKit's hosted cloud service.
|
|
1174
|
+
* To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey.
|
|
1175
|
+
*
|
|
1176
|
+
* @param action - The frontend action to be wrapped with authentication
|
|
1177
|
+
* @param dependencies - Optional array of dependencies that will trigger recreation of the action when changed
|
|
1178
|
+
*/
|
|
1179
|
+
declare function useCopilotAuthenticatedAction_c<T extends Parameter[]>(action: FrontendAction<T>, dependencies?: any[]): void;
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/hooks/use-langgraph-interrupt.d.ts
|
|
1182
|
+
declare function useLangGraphInterrupt<TEventValue = any>(action: Omit<LangGraphInterruptRender<TEventValue>, "id">, dependencies?: any[]): void;
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region src/hooks/use-langgraph-interrupt-render.d.ts
|
|
1185
|
+
declare function useLangGraphInterruptRender(agent: AbstractAgent): string | React$1.ReactElement | null;
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region src/hooks/use-copilot-additional-instructions.d.ts
|
|
1188
|
+
/**
|
|
1189
|
+
* Options for the useCopilotAdditionalInstructions hook.
|
|
1190
|
+
*/
|
|
1191
|
+
interface UseCopilotAdditionalInstructionsOptions {
|
|
1192
|
+
/**
|
|
1193
|
+
* The instructions to be added to the Copilot. Will be added to the instructions like so:
|
|
1194
|
+
*
|
|
1195
|
+
* ```txt
|
|
1196
|
+
* You are a helpful assistant.
|
|
1197
|
+
* Additionally, follow these instructions:
|
|
1198
|
+
* - Do not answer questions about the weather.
|
|
1199
|
+
* - Do not answer questions about the stock market.
|
|
1200
|
+
* ```
|
|
1201
|
+
*/
|
|
1202
|
+
instructions: string;
|
|
1203
|
+
/**
|
|
1204
|
+
* Whether the instructions are available to the Copilot.
|
|
1205
|
+
*/
|
|
1206
|
+
available?: "enabled" | "disabled";
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Adds the given instructions to the Copilot context.
|
|
1210
|
+
*/
|
|
1211
|
+
declare function useCopilotAdditionalInstructions({
|
|
1212
|
+
instructions,
|
|
1213
|
+
available
|
|
1214
|
+
}: UseCopilotAdditionalInstructionsOptions, dependencies?: any[]): void;
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region src/hooks/use-frontend-tool.d.ts
|
|
1217
|
+
type UseFrontendToolArgs<T extends Parameter[] | [] = []> = {
|
|
1218
|
+
available?: "disabled" | "enabled";
|
|
1219
|
+
} & Pick<FrontendAction<T>, "name" | "description" | "parameters" | "handler" | "followUp" | "render">;
|
|
1220
|
+
declare function useFrontendTool<const T extends Parameter[] = []>(tool: UseFrontendToolArgs<T>, dependencies?: any[]): void;
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region src/hooks/use-human-in-the-loop.d.ts
|
|
1223
|
+
type UseHumanInTheLoopArgs<T extends Parameter[] | [] = []> = {
|
|
1224
|
+
available?: "disabled" | "enabled";
|
|
1225
|
+
render: FrontendAction<T>["renderAndWaitForResponse"];
|
|
1226
|
+
followUp?: FrontendAction<T>["followUp"];
|
|
1227
|
+
} & Pick<FrontendAction<T>, "name" | "description" | "parameters">;
|
|
1228
|
+
declare function useHumanInTheLoop<const T extends Parameter[] | [] = []>(tool: UseHumanInTheLoopArgs<T>, dependencies?: any[]): void;
|
|
1229
|
+
//#endregion
|
|
1230
|
+
//#region src/hooks/use-render-tool-call.d.ts
|
|
1231
|
+
type UseRenderToolCallArgs<T extends Parameter[] | [] = []> = Pick<FrontendAction<T>, "name" | "description" | "parameters"> & {
|
|
1232
|
+
available?: "disabled" | "enabled";
|
|
1233
|
+
render: T extends [] ? (props: ActionRenderPropsNoArgs<T>) => React$1.ReactElement : (props: ActionRenderProps<T>) => React$1.ReactElement;
|
|
1234
|
+
};
|
|
1235
|
+
declare function useRenderToolCall<const T extends Parameter[] | [] = []>(tool: UseRenderToolCallArgs<T>, dependencies?: any[]): void;
|
|
1236
|
+
//#endregion
|
|
1237
|
+
//#region src/hooks/use-default-tool.d.ts
|
|
1238
|
+
declare function useDefaultTool(tool: Omit<CatchAllFrontendAction, "name">, dependencies?: any[]): void;
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region src/hooks/use-lazy-tool-renderer.d.ts
|
|
1241
|
+
declare function useLazyToolRenderer(): (message?: AIMessage, messages?: Message[]) => null | (() => ReturnType<ReturnType<typeof useRenderToolCall$1>> | null);
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region src/hooks/use-copilot-chat-suggestions.d.ts
|
|
1244
|
+
type StaticSuggestionInput = Omit<Suggestion, "isLoading"> & Partial<Pick<Suggestion, "isLoading">>;
|
|
1245
|
+
type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions"> & {
|
|
1246
|
+
suggestions: StaticSuggestionInput[];
|
|
1247
|
+
};
|
|
1248
|
+
type DynamicSuggestionsConfigInput = {
|
|
1249
|
+
/**
|
|
1250
|
+
* A prompt or instructions for the GPT to generate suggestions.
|
|
1251
|
+
*/
|
|
1252
|
+
instructions: string;
|
|
1253
|
+
/**
|
|
1254
|
+
* The minimum number of suggestions to generate. Defaults to `1`.
|
|
1255
|
+
* @default 1
|
|
1256
|
+
*/
|
|
1257
|
+
minSuggestions?: number;
|
|
1258
|
+
/**
|
|
1259
|
+
* The maximum number of suggestions to generate. Defaults to `3`.
|
|
1260
|
+
* @default 1
|
|
1261
|
+
*/
|
|
1262
|
+
maxSuggestions?: number;
|
|
1263
|
+
/**
|
|
1264
|
+
* Whether the suggestions are available. Defaults to `enabled`.
|
|
1265
|
+
* @default enabled
|
|
1266
|
+
*/
|
|
1267
|
+
available?: "enabled" | "disabled" | "always" | "before-first-message" | "after-first-message";
|
|
1268
|
+
/**
|
|
1269
|
+
* An optional class name to apply to the suggestions.
|
|
1270
|
+
*/
|
|
1271
|
+
className?: string;
|
|
1272
|
+
};
|
|
1273
|
+
type UseCopilotChatSuggestionsConfiguration = DynamicSuggestionsConfigInput | StaticSuggestionsConfigInput;
|
|
1274
|
+
declare function useCopilotChatSuggestions(config: UseCopilotChatSuggestionsConfiguration, dependencies?: any[]): void;
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/lib/copilot-task.d.ts
|
|
1277
|
+
interface CopilotTaskConfig {
|
|
1278
|
+
/**
|
|
1279
|
+
* The instructions to be given to the assistant.
|
|
1280
|
+
*/
|
|
1281
|
+
instructions: string;
|
|
1282
|
+
/**
|
|
1283
|
+
* An array of action definitions that can be called.
|
|
1284
|
+
*/
|
|
1285
|
+
actions?: FrontendAction<any>[];
|
|
1286
|
+
/**
|
|
1287
|
+
* Whether to include the copilot readable context in the task.
|
|
1288
|
+
*/
|
|
1289
|
+
includeCopilotReadable?: boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* Whether to include actions defined via useCopilotAction in the task.
|
|
1292
|
+
*/
|
|
1293
|
+
includeCopilotActions?: boolean;
|
|
1294
|
+
/**
|
|
1295
|
+
* The forwarded parameters to use for the task.
|
|
1296
|
+
*/
|
|
1297
|
+
forwardedParameters?: ForwardedParametersInput;
|
|
1298
|
+
}
|
|
1299
|
+
declare class CopilotTask<T = any> {
|
|
1300
|
+
private instructions;
|
|
1301
|
+
private actions;
|
|
1302
|
+
private includeCopilotReadable;
|
|
1303
|
+
private includeCopilotActions;
|
|
1304
|
+
private forwardedParameters?;
|
|
1305
|
+
constructor(config: CopilotTaskConfig);
|
|
1306
|
+
/**
|
|
1307
|
+
* Run the task.
|
|
1308
|
+
* @param context The CopilotContext to use for the task. Use `useCopilotContext` to obtain the current context.
|
|
1309
|
+
* @param data The data to use for the task.
|
|
1310
|
+
*/
|
|
1311
|
+
run(context: CopilotContextParams, data?: T): Promise<void>;
|
|
1312
|
+
}
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region src/utils/suggestions-constants.d.ts
|
|
1315
|
+
/**
|
|
1316
|
+
* Constants for suggestions retry logic
|
|
1317
|
+
*/
|
|
1318
|
+
declare const SUGGESTION_RETRY_CONFIG: {
|
|
1319
|
+
readonly MAX_RETRIES: 3;
|
|
1320
|
+
readonly COOLDOWN_MS: 5000;
|
|
1321
|
+
};
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region src/utils/dev-console.d.ts
|
|
1324
|
+
declare function shouldShowDevConsole(showDevConsole?: boolean): boolean;
|
|
1325
|
+
//#endregion
|
|
1326
|
+
export { type ActionRenderProps, type ActionRenderPropsNoArgs, type ActionRenderPropsNoArgsWait, type ActionRenderPropsWait, type CatchAllActionRenderProps, type CatchAllFrontendAction, type ChatSuggestions, CoAgentStateRendersContext, type CoAgentStateRendersContextValue, CoAgentStateRendersProvider, type CoagentInChatRenderFunction, type CopilotApiConfig, type CopilotChatSuggestionConfiguration, CopilotContext, type CopilotContextParams, CopilotKit, type CopilotKitProps, CopilotMessagesContext, type CopilotMessagesContextParams, CopilotTask, CopilotTaskConfig, CrewsAgentState, CrewsResponse, CrewsResponseStatus, CrewsStateItem, CrewsTaskStateItem, CrewsToolStateItem, type DocumentPointer, type FrontendAction, type FrontendActionAvailability, type HintFunction, LangGraphInterruptAction, LangGraphInterruptActionSetter, LangGraphInterruptActionSetterArgs, LangGraphInterruptRender, LangGraphInterruptRenderHandlerProps, LangGraphInterruptRenderProps, type OnReloadMessages, type OnStopGeneration, QueuedInterruptEvent, type RenderFunctionStatus, SUGGESTION_RETRY_CONFIG, type SystemMessageFunction, ThreadsContext, type ThreadsContextValue, ThreadsProvider, type ThreadsProviderProps, type Tree, type TreeNode, type UseCopilotChatOptions, type UseCopilotChatOptions as UseCopilotChatOptions_c, type UseCopilotChatReturn, type UseCopilotChatReturn$1 as UseCopilotChatReturn_c, type UseCopilotChatSuggestionsConfiguration, defaultCopilotContextCategories, shouldShowDevConsole, useCoAgent, useCoAgentStateRender, useCoAgentStateRenders, useCopilotAction, useCopilotAdditionalInstructions, useCopilotAuthenticatedAction_c, useCopilotChat, useCopilotChatHeadless_c, useCopilotChatInternal, useCopilotChatSuggestions, useCopilotContext, useCopilotMessagesContext, useCopilotReadable, useCopilotRuntimeClient, useDefaultTool, useFrontendTool, useHumanInTheLoop, useLangGraphInterrupt, useLangGraphInterruptRender, useLazyToolRenderer, useMakeCopilotDocumentReadable, useRenderToolCall, useThreads };
|
|
1327
|
+
//# sourceMappingURL=index.d.mts.map
|