@copilotkit/react-core 1.69.0 → 1.69.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{copilotkit-DOMr3DRO.cjs → copilotkit-Ba7qwYt3.cjs} +174 -45
- package/dist/copilotkit-Ba7qwYt3.cjs.map +1 -0
- package/dist/{copilotkit-ykQW_VJZ.mjs → copilotkit-BmW2sFH6.mjs} +175 -46
- package/dist/copilotkit-BmW2sFH6.mjs.map +1 -0
- package/dist/{copilotkit-DYM5ChMS.d.cts → copilotkit-CF1Pm2VG.d.cts} +23 -22
- package/dist/copilotkit-CF1Pm2VG.d.cts.map +1 -0
- package/dist/{copilotkit-pkDPhwkR.d.mts → copilotkit-TdM-5onZ.d.mts} +23 -22
- package/dist/copilotkit-TdM-5onZ.d.mts.map +1 -0
- package/dist/index.cjs +119 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +904 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +904 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +119 -75
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +139 -95
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +2 -2
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +4 -4
- package/dist/v2/headless.d.mts +4 -4
- package/dist/v2/headless.mjs +2 -2
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +171 -42
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +1 -1
- package/skills/react-core/references/provider-setup.md +1 -1
- package/skills/react-core/references/threads.md +2 -2
- package/dist/copilotkit-DOMr3DRO.cjs.map +0 -1
- package/dist/copilotkit-DYM5ChMS.d.cts.map +0 -1
- package/dist/copilotkit-pkDPhwkR.d.mts.map +0 -1
- package/dist/copilotkit-ykQW_VJZ.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -2426,7 +2426,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2426
2426
|
const hasLocalAgents = mergedAgents && Object.keys(mergedAgents).length > 0;
|
|
2427
2427
|
const hasSelfManagedAgents = Object.keys(selfManagedAgents).length > 0;
|
|
2428
2428
|
(0, react.useEffect)(() => {
|
|
2429
|
-
if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence
|
|
2429
|
+
if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence tier. Provide a `publicLicenseKey` for production use — contact the CopilotKit team about licensing.");
|
|
2430
2430
|
}, [hasSelfManagedAgents, resolvedPublicKey]);
|
|
2431
2431
|
const headers = typeof headersProp === "function" ? headersProp() : headersProp;
|
|
2432
2432
|
const mergedHeaders = (0, react.useMemo)(() => {
|
|
@@ -3590,7 +3590,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3590
3590
|
}
|
|
3591
3591
|
|
|
3592
3592
|
//#endregion
|
|
3593
|
-
//#region src/context/copilot-context.tsx
|
|
3593
|
+
//#region src/v1-deprecated/context/copilot-context.tsx
|
|
3594
3594
|
const emptyCopilotContext$1 = {
|
|
3595
3595
|
actions: {},
|
|
3596
3596
|
setAction: () => {},
|
|
@@ -3670,7 +3670,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3670
3670
|
}
|
|
3671
3671
|
|
|
3672
3672
|
//#endregion
|
|
3673
|
-
//#region src/hooks/use-tree.ts
|
|
3673
|
+
//#region src/v1-deprecated/hooks/use-tree.ts
|
|
3674
3674
|
const removeNode = (nodes, id) => {
|
|
3675
3675
|
return nodes.reduce((result, node) => {
|
|
3676
3676
|
if (node.id !== id) {
|
|
@@ -3783,7 +3783,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3783
3783
|
}
|
|
3784
3784
|
|
|
3785
3785
|
//#endregion
|
|
3786
|
-
//#region src/hooks/use-flat-category-store.ts
|
|
3786
|
+
//#region src/v1-deprecated/hooks/use-flat-category-store.ts
|
|
3787
3787
|
const useFlatCategoryStore = () => {
|
|
3788
3788
|
const [elements, dispatch] = (0, react.useReducer)(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
|
|
3789
3789
|
return {
|
|
@@ -3841,7 +3841,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3841
3841
|
}
|
|
3842
3842
|
|
|
3843
3843
|
//#endregion
|
|
3844
|
-
//#region src/context/copilot-messages-context.tsx
|
|
3844
|
+
//#region src/v1-deprecated/context/copilot-messages-context.tsx
|
|
3845
3845
|
const emptyCopilotContext = {
|
|
3846
3846
|
messages: [],
|
|
3847
3847
|
setMessages: () => [],
|
|
@@ -3856,7 +3856,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3856
3856
|
}
|
|
3857
3857
|
|
|
3858
3858
|
//#endregion
|
|
3859
|
-
//#region src/components/toast/toast-provider.tsx
|
|
3859
|
+
//#region src/v1-deprecated/components/toast/toast-provider.tsx
|
|
3860
3860
|
const ToastContext = (0, react.createContext)(void 0);
|
|
3861
3861
|
function getErrorSeverity(error) {
|
|
3862
3862
|
if (error.severity) switch (error.severity) {
|
|
@@ -4163,7 +4163,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4163
4163
|
}
|
|
4164
4164
|
|
|
4165
4165
|
//#endregion
|
|
4166
|
-
//#region src/utils/dev-console.ts
|
|
4166
|
+
//#region src/v1-deprecated/utils/dev-console.ts
|
|
4167
4167
|
function isLocalhost() {
|
|
4168
4168
|
if (typeof window === "undefined") return false;
|
|
4169
4169
|
return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
|
|
@@ -4174,7 +4174,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4174
4174
|
}
|
|
4175
4175
|
|
|
4176
4176
|
//#endregion
|
|
4177
|
-
//#region src/components/copilot-provider/copilot-messages.tsx
|
|
4177
|
+
//#region src/v1-deprecated/components/copilot-provider/copilot-messages.tsx
|
|
4178
4178
|
/**
|
|
4179
4179
|
* An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
|
|
4180
4180
|
*/
|
|
@@ -4324,7 +4324,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4324
4324
|
}
|
|
4325
4325
|
|
|
4326
4326
|
//#endregion
|
|
4327
|
-
//#region src/components/usage-banner.tsx
|
|
4327
|
+
//#region src/v1-deprecated/components/usage-banner.tsx
|
|
4328
4328
|
function UsageBanner({ severity = _copilotkit_shared.Severity.CRITICAL, message = "", onClose, actions }) {
|
|
4329
4329
|
if (!message || !severity) return null;
|
|
4330
4330
|
const theme = {
|
|
@@ -4521,7 +4521,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4521
4521
|
};
|
|
4522
4522
|
|
|
4523
4523
|
//#endregion
|
|
4524
|
-
//#region src/utils/suggestions-constants.ts
|
|
4524
|
+
//#region src/v1-deprecated/utils/suggestions-constants.ts
|
|
4525
4525
|
/**
|
|
4526
4526
|
* Constants for suggestions retry logic
|
|
4527
4527
|
*/
|
|
@@ -4531,7 +4531,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4531
4531
|
};
|
|
4532
4532
|
|
|
4533
4533
|
//#endregion
|
|
4534
|
-
//#region src/lib/status-checker.ts
|
|
4534
|
+
//#region src/v1-deprecated/lib/status-checker.ts
|
|
4535
4535
|
const STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
|
|
4536
4536
|
var StatusChecker = class {
|
|
4537
4537
|
constructor() {
|
|
@@ -4553,7 +4553,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4553
4553
|
this.lastResponse = response;
|
|
4554
4554
|
onUpdate?.(response);
|
|
4555
4555
|
return response;
|
|
4556
|
-
} catch
|
|
4556
|
+
} catch {
|
|
4557
4557
|
return null;
|
|
4558
4558
|
}
|
|
4559
4559
|
};
|
|
@@ -4579,7 +4579,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4579
4579
|
};
|
|
4580
4580
|
|
|
4581
4581
|
//#endregion
|
|
4582
|
-
//#region src/components/toast/exclamation-mark-icon.tsx
|
|
4582
|
+
//#region src/v1-deprecated/components/toast/exclamation-mark-icon.tsx
|
|
4583
4583
|
const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
4584
4584
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4585
4585
|
width: "24",
|
|
@@ -4614,7 +4614,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4614
4614
|
});
|
|
4615
4615
|
|
|
4616
4616
|
//#endregion
|
|
4617
|
-
//#region src/components/error-boundary/error-utils.tsx
|
|
4617
|
+
//#region src/v1-deprecated/components/error-boundary/error-utils.tsx
|
|
4618
4618
|
function ErrorToast({ errors }) {
|
|
4619
4619
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4620
4620
|
style: {
|
|
@@ -4688,7 +4688,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4688
4688
|
}
|
|
4689
4689
|
|
|
4690
4690
|
//#endregion
|
|
4691
|
-
//#region src/components/error-boundary/error-boundary.tsx
|
|
4691
|
+
//#region src/v1-deprecated/components/error-boundary/error-boundary.tsx
|
|
4692
4692
|
const statusChecker = new StatusChecker();
|
|
4693
4693
|
var CopilotErrorBoundary = class extends react.default.Component {
|
|
4694
4694
|
constructor(props) {
|
|
@@ -4729,7 +4729,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4729
4729
|
};
|
|
4730
4730
|
|
|
4731
4731
|
//#endregion
|
|
4732
|
-
//#region src/context/coagent-state-renders-context.tsx
|
|
4732
|
+
//#region src/v1-deprecated/context/coagent-state-renders-context.tsx
|
|
4733
4733
|
const CoAgentStateRendersContext = (0, react.createContext)(void 0);
|
|
4734
4734
|
function CoAgentStateRendersProvider({ children }) {
|
|
4735
4735
|
const [coAgentStateRenders, setCoAgentStateRenders] = (0, react.useState)({});
|
|
@@ -4764,7 +4764,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4764
4764
|
}
|
|
4765
4765
|
|
|
4766
4766
|
//#endregion
|
|
4767
|
-
//#region src/context/threads-context.tsx
|
|
4767
|
+
//#region src/v1-deprecated/context/threads-context.tsx
|
|
4768
4768
|
const ThreadsContext = (0, react.createContext)(void 0);
|
|
4769
4769
|
function ThreadsProvider({ children, threadId: explicitThreadId }) {
|
|
4770
4770
|
const [internalThreadId, setInternalThreadId] = (0, react.useState)(() => (0, _copilotkit_shared.randomUUID)());
|
|
@@ -4791,7 +4791,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4791
4791
|
}
|
|
4792
4792
|
|
|
4793
4793
|
//#endregion
|
|
4794
|
-
//#region src/hooks/use-coagent-state-render-bridge.helpers.ts
|
|
4794
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.helpers.ts
|
|
4795
4795
|
let RenderStatus = /* @__PURE__ */ function(RenderStatus) {
|
|
4796
4796
|
RenderStatus["InProgress"] = "inProgress";
|
|
4797
4797
|
RenderStatus["Complete"] = "complete";
|
|
@@ -4956,7 +4956,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4956
4956
|
}
|
|
4957
4957
|
|
|
4958
4958
|
//#endregion
|
|
4959
|
-
//#region src/hooks/use-coagent-state-render-registry.ts
|
|
4959
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-registry.ts
|
|
4960
4960
|
const LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
|
|
4961
4961
|
const LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
|
|
4962
4962
|
function getClaimsStore(claimsRef) {
|
|
@@ -5078,7 +5078,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5078
5078
|
}
|
|
5079
5079
|
|
|
5080
5080
|
//#endregion
|
|
5081
|
-
//#region src/hooks/use-coagent-state-render-bridge.tsx
|
|
5081
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.tsx
|
|
5082
5082
|
function useCoagentStateRenderBridge(agentId, props) {
|
|
5083
5083
|
const { stateSnapshot, message } = props;
|
|
5084
5084
|
const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
|
|
@@ -5162,7 +5162,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5162
5162
|
}
|
|
5163
5163
|
|
|
5164
5164
|
//#endregion
|
|
5165
|
-
//#region src/components/CopilotListeners.tsx
|
|
5165
|
+
//#region src/v1-deprecated/components/CopilotListeners.tsx
|
|
5166
5166
|
const usePredictStateSubscription = (agent) => {
|
|
5167
5167
|
const predictStateToolsRef = (0, react.useRef)([]);
|
|
5168
5168
|
const getSubscriber = (0, react.useCallback)((agent) => ({
|
|
@@ -5232,7 +5232,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5232
5232
|
}
|
|
5233
5233
|
|
|
5234
5234
|
//#endregion
|
|
5235
|
-
//#region src/components/copilot-provider/copilotkit.tsx
|
|
5235
|
+
//#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
|
|
5236
5236
|
function CopilotKit({ children, ...props }) {
|
|
5237
5237
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
5238
5238
|
const showInspector = shouldShowDevConsole(props.enableInspector);
|
|
@@ -5730,7 +5730,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5730
5730
|
}
|
|
5731
5731
|
|
|
5732
5732
|
//#endregion
|
|
5733
|
-
//#region src/hooks/use-lazy-tool-renderer.tsx
|
|
5733
|
+
//#region src/v1-deprecated/hooks/use-lazy-tool-renderer.tsx
|
|
5734
5734
|
function useLazyToolRenderer() {
|
|
5735
5735
|
const renderToolCall = useRenderToolCall$1();
|
|
5736
5736
|
return (0, react.useCallback)((message, messages) => {
|
|
@@ -5746,7 +5746,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5746
5746
|
}
|
|
5747
5747
|
|
|
5748
5748
|
//#endregion
|
|
5749
|
-
//#region src/hooks/use-copilot-chat_internal.ts
|
|
5749
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat_internal.ts
|
|
5750
5750
|
function useCopilotChatInternal({ suggestions, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages } = {}) {
|
|
5751
5751
|
const { copilotkit } = useCopilotKit();
|
|
5752
5752
|
const { threadId, agentSession } = useCopilotContext();
|
|
@@ -6047,7 +6047,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6047
6047
|
}
|
|
6048
6048
|
|
|
6049
6049
|
//#endregion
|
|
6050
|
-
//#region src/hooks/use-copilot-chat.ts
|
|
6050
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat.ts
|
|
6051
6051
|
/**
|
|
6052
6052
|
* A lightweight React hook for headless chat interactions.
|
|
6053
6053
|
* Perfect for programmatic messaging, background operations, and custom UI implementations.
|
|
@@ -6071,12 +6071,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6071
6071
|
}
|
|
6072
6072
|
|
|
6073
6073
|
//#endregion
|
|
6074
|
-
//#region src/hooks/use-copilot-chat-headless_c.ts
|
|
6074
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-headless_c.ts
|
|
6075
6075
|
/**
|
|
6076
6076
|
* `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
|
|
6077
6077
|
*
|
|
6078
|
-
* <Callout title="This is
|
|
6079
|
-
* Read more about <a href="/premium/overview">
|
|
6078
|
+
* <Callout title="This is a CopilotKit Intelligence feature">
|
|
6079
|
+
* Read more about <a href="/premium/overview">CopilotKit Intelligence</a>.
|
|
6080
6080
|
*
|
|
6081
6081
|
* Usage is generous and **free** to get started.
|
|
6082
6082
|
* </Callout>
|
|
@@ -6255,11 +6255,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6255
6255
|
interrupt: null
|
|
6256
6256
|
});
|
|
6257
6257
|
/**
|
|
6258
|
-
*
|
|
6258
|
+
* CopilotKit Intelligence React hook that provides complete chat functionality for fully custom UI implementations.
|
|
6259
6259
|
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
6260
6260
|
*
|
|
6261
6261
|
* @param options - Configuration options for the chat
|
|
6262
|
-
* @returns Complete chat interface with all
|
|
6262
|
+
* @returns Complete chat interface with all CopilotKit Intelligence features
|
|
6263
6263
|
*
|
|
6264
6264
|
* @example
|
|
6265
6265
|
* ```tsx
|
|
@@ -6273,7 +6273,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6273
6273
|
(0, react.useEffect)(() => {
|
|
6274
6274
|
if (!hasPublicApiKey) {
|
|
6275
6275
|
setBannerError(new _copilotkit_shared.CopilotKitError({
|
|
6276
|
-
message: "You're using useCopilotChatHeadless_c,
|
|
6276
|
+
message: "You're using useCopilotChatHeadless_c, a CopilotKit Intelligence feature that offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",
|
|
6277
6277
|
code: _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
6278
6278
|
severity: _copilotkit_shared.Severity.WARNING,
|
|
6279
6279
|
visibility: _copilotkit_shared.ErrorVisibility.BANNER
|
|
@@ -6286,7 +6286,26 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6286
6286
|
}
|
|
6287
6287
|
|
|
6288
6288
|
//#endregion
|
|
6289
|
-
//#region src/hooks/use-frontend-tool.ts
|
|
6289
|
+
//#region src/v1-deprecated/hooks/use-frontend-tool.ts
|
|
6290
|
+
/**
|
|
6291
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useFrontendTool` from `@copilotkit/react-core/v2` instead.
|
|
6292
|
+
*
|
|
6293
|
+
* ```tsx
|
|
6294
|
+
* import { useFrontendTool } from "@copilotkit/react-core/v2";
|
|
6295
|
+
* import { z } from "zod";
|
|
6296
|
+
*
|
|
6297
|
+
* function MyComponent() {
|
|
6298
|
+
* useFrontendTool({
|
|
6299
|
+
* name: "myTool",
|
|
6300
|
+
* description: "Run my tool",
|
|
6301
|
+
* parameters: z.object({}),
|
|
6302
|
+
* handler: async () => "done",
|
|
6303
|
+
* });
|
|
6304
|
+
* return null;
|
|
6305
|
+
* }
|
|
6306
|
+
* ```
|
|
6307
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useFrontendTool
|
|
6308
|
+
*/
|
|
6290
6309
|
function useFrontendTool(tool, dependencies) {
|
|
6291
6310
|
const { name, description, parameters, render, followUp, available } = tool;
|
|
6292
6311
|
const zodParameters = (0, _copilotkit_shared.getZodParameters)(parameters);
|
|
@@ -6324,7 +6343,27 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6324
6343
|
}
|
|
6325
6344
|
|
|
6326
6345
|
//#endregion
|
|
6327
|
-
//#region src/hooks/use-render-tool-call.ts
|
|
6346
|
+
//#region src/v1-deprecated/hooks/use-render-tool-call.ts
|
|
6347
|
+
/**
|
|
6348
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useRenderTool` from `@copilotkit/react-core/v2` instead.
|
|
6349
|
+
*
|
|
6350
|
+
* ```tsx
|
|
6351
|
+
* import { useRenderTool } from "@copilotkit/react-core/v2";
|
|
6352
|
+
* import { z } from "zod";
|
|
6353
|
+
*
|
|
6354
|
+
* function StatusTool() {
|
|
6355
|
+
* useRenderTool({
|
|
6356
|
+
* name: "showStatus",
|
|
6357
|
+
* parameters: z.object({}),
|
|
6358
|
+
* render: ({ status, result }) => (
|
|
6359
|
+
* <div>{status === "complete" ? result : "Running..."}</div>
|
|
6360
|
+
* ),
|
|
6361
|
+
* });
|
|
6362
|
+
* return null;
|
|
6363
|
+
* }
|
|
6364
|
+
* ```
|
|
6365
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useRenderTool
|
|
6366
|
+
*/
|
|
6328
6367
|
function useRenderToolCall(tool, dependencies) {
|
|
6329
6368
|
const { copilotkit } = useCopilotKit();
|
|
6330
6369
|
const hasAddedRef = (0, react.useRef)(false);
|
|
@@ -6364,7 +6403,28 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6364
6403
|
}
|
|
6365
6404
|
|
|
6366
6405
|
//#endregion
|
|
6367
|
-
//#region src/hooks/use-human-in-the-loop.ts
|
|
6406
|
+
//#region src/v1-deprecated/hooks/use-human-in-the-loop.ts
|
|
6407
|
+
/**
|
|
6408
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useHumanInTheLoop` from `@copilotkit/react-core/v2` instead.
|
|
6409
|
+
*
|
|
6410
|
+
* ```tsx
|
|
6411
|
+
* import { useHumanInTheLoop } from "@copilotkit/react-core/v2";
|
|
6412
|
+
* import { z } from "zod";
|
|
6413
|
+
*
|
|
6414
|
+
* function Confirmation() {
|
|
6415
|
+
* useHumanInTheLoop({
|
|
6416
|
+
* name: "confirmAction",
|
|
6417
|
+
* description: "Ask the user to confirm",
|
|
6418
|
+
* parameters: z.object({}),
|
|
6419
|
+
* render: ({ respond }) => (
|
|
6420
|
+
* <button onClick={() => respond?.(true)}>Confirm</button>
|
|
6421
|
+
* ),
|
|
6422
|
+
* });
|
|
6423
|
+
* return null;
|
|
6424
|
+
* }
|
|
6425
|
+
* ```
|
|
6426
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useHumanInTheLoop
|
|
6427
|
+
*/
|
|
6368
6428
|
function useHumanInTheLoop(tool, dependencies) {
|
|
6369
6429
|
const { render, ...toolRest } = tool;
|
|
6370
6430
|
const { name, description, parameters, followUp } = toolRest;
|
|
@@ -6416,7 +6476,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6416
6476
|
}
|
|
6417
6477
|
|
|
6418
6478
|
//#endregion
|
|
6419
|
-
//#region src/hooks/use-copilot-action.ts
|
|
6479
|
+
//#region src/v1-deprecated/hooks/use-copilot-action.ts
|
|
6420
6480
|
/**
|
|
6421
6481
|
* Example usage of useCopilotAction with complex parameters:
|
|
6422
6482
|
*
|
|
@@ -6615,7 +6675,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6615
6675
|
}
|
|
6616
6676
|
|
|
6617
6677
|
//#endregion
|
|
6618
|
-
//#region src/hooks/use-coagent-state-render.ts
|
|
6678
|
+
//#region src/v1-deprecated/hooks/use-coagent-state-render.ts
|
|
6619
6679
|
/**
|
|
6620
6680
|
* The useCoAgentStateRender hook allows you to render UI or text based components on a Agentic Copilot's state in the chat.
|
|
6621
6681
|
* This is particularly useful for showing intermediate state or progress during Agentic Copilot operations.
|
|
@@ -6723,7 +6783,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6723
6783
|
}
|
|
6724
6784
|
|
|
6725
6785
|
//#endregion
|
|
6726
|
-
//#region src/hooks/use-make-copilot-document-readable.ts
|
|
6786
|
+
//#region src/v1-deprecated/hooks/use-make-copilot-document-readable.ts
|
|
6727
6787
|
/**
|
|
6728
6788
|
* Makes a document readable by Copilot.
|
|
6729
6789
|
* @param document The document to make readable.
|
|
@@ -6749,7 +6809,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6749
6809
|
}
|
|
6750
6810
|
|
|
6751
6811
|
//#endregion
|
|
6752
|
-
//#region src/hooks/use-copilot-readable.ts
|
|
6812
|
+
//#region src/v1-deprecated/hooks/use-copilot-readable.ts
|
|
6753
6813
|
/**
|
|
6754
6814
|
* `useCopilotReadable` is a React hook that provides app-state and other information
|
|
6755
6815
|
* to the Copilot.
|
|
@@ -6820,6 +6880,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6820
6880
|
*/
|
|
6821
6881
|
/**
|
|
6822
6882
|
* Adds the given information to the Copilot context to make it readable by Copilot.
|
|
6883
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useAgentContext` from `@copilotkit/react-core/v2` instead.
|
|
6884
|
+
*
|
|
6885
|
+
* ```tsx
|
|
6886
|
+
* import { useAgentContext } from "@copilotkit/react-core/v2";
|
|
6887
|
+
*
|
|
6888
|
+
* function UserContext() {
|
|
6889
|
+
* useAgentContext({
|
|
6890
|
+
* description: "The current user",
|
|
6891
|
+
* value: { name: "Ada" },
|
|
6892
|
+
* });
|
|
6893
|
+
* return null;
|
|
6894
|
+
* }
|
|
6895
|
+
* ```
|
|
6896
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useAgentContext
|
|
6823
6897
|
*/
|
|
6824
6898
|
function useCopilotReadable({ description, value, convert, available = "enabled" }, dependencies) {
|
|
6825
6899
|
const { copilotkit } = useCopilotKit();
|
|
@@ -6848,7 +6922,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6848
6922
|
}
|
|
6849
6923
|
|
|
6850
6924
|
//#endregion
|
|
6851
|
-
//#region src/hooks/use-agent-nodename.ts
|
|
6925
|
+
//#region src/v1-deprecated/hooks/use-agent-nodename.ts
|
|
6852
6926
|
/**
|
|
6853
6927
|
* Tracks the node the agent is currently executing.
|
|
6854
6928
|
*
|
|
@@ -6883,7 +6957,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6883
6957
|
}
|
|
6884
6958
|
|
|
6885
6959
|
//#endregion
|
|
6886
|
-
//#region src/hooks/use-coagent.ts
|
|
6960
|
+
//#region src/v1-deprecated/hooks/use-coagent.ts
|
|
6887
6961
|
/**
|
|
6888
6962
|
* <Callout type="info">
|
|
6889
6963
|
* Usage of this hook assumes some additional setup in your application, for more information
|
|
@@ -7091,7 +7165,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7091
7165
|
};
|
|
7092
7166
|
|
|
7093
7167
|
//#endregion
|
|
7094
|
-
//#region src/hooks/use-copilot-runtime-client.ts
|
|
7168
|
+
//#region src/v1-deprecated/hooks/use-copilot-runtime-client.ts
|
|
7095
7169
|
const useCopilotRuntimeClient = (options) => {
|
|
7096
7170
|
const { setBannerError } = useToast();
|
|
7097
7171
|
const { showDevConsole, onError, ...runtimeOptions } = options;
|
|
@@ -7194,7 +7268,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7194
7268
|
}
|
|
7195
7269
|
|
|
7196
7270
|
//#endregion
|
|
7197
|
-
//#region src/hooks/use-copilot-authenticated-action.ts
|
|
7271
|
+
//#region src/v1-deprecated/hooks/use-copilot-authenticated-action.ts
|
|
7198
7272
|
/**
|
|
7199
7273
|
* Hook to create an authenticated action that requires user sign-in before execution.
|
|
7200
7274
|
*
|
|
@@ -7237,7 +7311,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7237
7311
|
}
|
|
7238
7312
|
|
|
7239
7313
|
//#endregion
|
|
7240
|
-
//#region src/hooks/use-langgraph-interrupt.ts
|
|
7314
|
+
//#region src/v1-deprecated/hooks/use-langgraph-interrupt.ts
|
|
7241
7315
|
/**
|
|
7242
7316
|
* Transforms a v2 InterruptEvent into the v1 LangGraphInterruptEvent shape
|
|
7243
7317
|
* expected by existing useLangGraphInterrupt callbacks.
|
|
@@ -7250,6 +7324,23 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7250
7324
|
value
|
|
7251
7325
|
};
|
|
7252
7326
|
}
|
|
7327
|
+
/**
|
|
7328
|
+
* @deprecated The v1 SDK is deprecated. Use v2 instead. Use `useInterrupt` from `@copilotkit/react-core/v2` instead.
|
|
7329
|
+
*
|
|
7330
|
+
* ```tsx
|
|
7331
|
+
* import { useInterrupt } from "@copilotkit/react-core/v2";
|
|
7332
|
+
*
|
|
7333
|
+
* function ApprovalInterrupt() {
|
|
7334
|
+
* useInterrupt({
|
|
7335
|
+
* render: ({ resolve }) => (
|
|
7336
|
+
* <button onClick={() => resolve({ approved: true })}>Approve</button>
|
|
7337
|
+
* ),
|
|
7338
|
+
* });
|
|
7339
|
+
* return null;
|
|
7340
|
+
* }
|
|
7341
|
+
* ```
|
|
7342
|
+
* See https://docs.copilotkit.ai/reference/v2/hooks/useInterrupt
|
|
7343
|
+
*/
|
|
7253
7344
|
function useLangGraphInterrupt(action, _dependencies) {
|
|
7254
7345
|
const actionRef = (0, react.useRef)(action);
|
|
7255
7346
|
actionRef.current = action;
|
|
@@ -7297,7 +7388,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7297
7388
|
}
|
|
7298
7389
|
|
|
7299
7390
|
//#endregion
|
|
7300
|
-
//#region src/hooks/use-copilot-additional-instructions.ts
|
|
7391
|
+
//#region src/v1-deprecated/hooks/use-copilot-additional-instructions.ts
|
|
7301
7392
|
/**
|
|
7302
7393
|
* `useCopilotAdditionalInstructions` is a React hook that provides additional instructions
|
|
7303
7394
|
* to the Copilot.
|
|
@@ -7356,7 +7447,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7356
7447
|
}
|
|
7357
7448
|
|
|
7358
7449
|
//#endregion
|
|
7359
|
-
//#region src/hooks/use-default-tool.ts
|
|
7450
|
+
//#region src/v1-deprecated/hooks/use-default-tool.ts
|
|
7360
7451
|
function useDefaultTool(tool, dependencies) {
|
|
7361
7452
|
useCopilotAction({
|
|
7362
7453
|
...tool,
|
|
@@ -7365,7 +7456,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7365
7456
|
}
|
|
7366
7457
|
|
|
7367
7458
|
//#endregion
|
|
7368
|
-
//#region src/hooks/use-copilot-chat-suggestions.tsx
|
|
7459
|
+
//#region src/v1-deprecated/hooks/use-copilot-chat-suggestions.tsx
|
|
7369
7460
|
/**
|
|
7370
7461
|
* <Callout type="warning">
|
|
7371
7462
|
* useCopilotChatSuggestions is experimental. The interface is not final and
|
|
@@ -7437,7 +7528,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7437
7528
|
}
|
|
7438
7529
|
|
|
7439
7530
|
//#endregion
|
|
7440
|
-
//#region src/types/frontend-action.ts
|
|
7531
|
+
//#region src/v1-deprecated/types/frontend-action.ts
|
|
7441
7532
|
function processActionsForRuntimeRequest(actions) {
|
|
7442
7533
|
return actions.filter((action) => action.available !== _copilotkit_runtime_client_gql.ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*" && action.available != "frontend" && !action.pairedAction).map((action) => {
|
|
7443
7534
|
let available = _copilotkit_runtime_client_gql.ActionInputAvailability.Enabled;
|
|
@@ -7454,54 +7545,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7454
7545
|
}
|
|
7455
7546
|
|
|
7456
7547
|
//#endregion
|
|
7457
|
-
//#region src/lib/copilot-task.ts
|
|
7458
|
-
/**
|
|
7459
|
-
* This class is used to execute one-off tasks, for example on button press. It can use the context available via [useCopilotReadable](/reference/v1/hooks/useCopilotReadable) and the actions provided by [useCopilotAction](/reference/v1/hooks/useCopilotAction), or you can provide your own context and actions.
|
|
7460
|
-
*
|
|
7461
|
-
* ## Example
|
|
7462
|
-
* In the simplest case, use CopilotTask in the context of your app by giving it instructions on what to do.
|
|
7463
|
-
*
|
|
7464
|
-
* ```tsx
|
|
7465
|
-
* import { CopilotTask, useCopilotContext } from "@copilotkit/react-core";
|
|
7466
|
-
*
|
|
7467
|
-
* export function MyComponent() {
|
|
7468
|
-
* const context = useCopilotContext();
|
|
7469
|
-
*
|
|
7470
|
-
* const task = new CopilotTask({
|
|
7471
|
-
* instructions: "Set a random message",
|
|
7472
|
-
* actions: [
|
|
7473
|
-
* {
|
|
7474
|
-
* name: "setMessage",
|
|
7475
|
-
* description: "Set the message.",
|
|
7476
|
-
* argumentAnnotations: [
|
|
7477
|
-
* {
|
|
7478
|
-
* name: "message",
|
|
7479
|
-
* type: "string",
|
|
7480
|
-
* description:
|
|
7481
|
-
* "A message to display.",
|
|
7482
|
-
* required: true,
|
|
7483
|
-
* },
|
|
7484
|
-
* ],
|
|
7485
|
-
* }
|
|
7486
|
-
* ]
|
|
7487
|
-
* });
|
|
7488
|
-
*
|
|
7489
|
-
* const executeTask = async () => {
|
|
7490
|
-
* await task.run(context, action);
|
|
7491
|
-
* }
|
|
7492
|
-
*
|
|
7493
|
-
* return (
|
|
7494
|
-
* <>
|
|
7495
|
-
* <button onClick={executeTask}>
|
|
7496
|
-
* Execute task
|
|
7497
|
-
* </button>
|
|
7498
|
-
* </>
|
|
7499
|
-
* )
|
|
7500
|
-
* }
|
|
7501
|
-
* ```
|
|
7502
|
-
*
|
|
7503
|
-
* Have a look at the [Presentation Example App](https://github.com/CopilotKit/CopilotKit/blob/main/examples/v1/next-openai/src/app/presentation/page.tsx) for a more complete example.
|
|
7504
|
-
*/
|
|
7548
|
+
//#region src/v1-deprecated/lib/copilot-task.ts
|
|
7505
7549
|
var CopilotTask = class {
|
|
7506
7550
|
constructor(config) {
|
|
7507
7551
|
this.instructions = config.instructions;
|