@copilotkit/react-core 1.59.5 → 1.60.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/dist/{copilotkit-CFfEVdV4.cjs → copilotkit-BTHcCAVQ.cjs} +93 -78
- package/dist/copilotkit-BTHcCAVQ.cjs.map +1 -0
- package/dist/{copilotkit-Ctvinul7.d.cts → copilotkit-C9ptuh-b.d.cts} +32 -70
- package/dist/copilotkit-C9ptuh-b.d.cts.map +1 -0
- package/dist/{copilotkit-DEGlMWM0.mjs → copilotkit-CV519nFv.mjs} +94 -79
- package/dist/copilotkit-CV519nFv.mjs.map +1 -0
- package/dist/{copilotkit-DqDT5RLa.d.mts → copilotkit-DvbI8G0d.d.mts} +32 -70
- package/dist/copilotkit-DvbI8G0d.d.mts.map +1 -0
- package/dist/index.cjs +11 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -12
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +47 -54
- package/dist/index.umd.js.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 +92 -77
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +5 -5
- package/skills/react-core/references/chat-components.md +20 -12
- package/skills/react-core/references/client-side-tools.md +1 -1
- package/skills/react-core/references/custom-message-renderers.md +8 -11
- package/skills/react-core/references/debug-mode.md +15 -15
- package/skills/react-core/references/provider-setup.md +45 -52
- package/skills/react-core/references/rendering-activity-messages.md +6 -12
- package/dist/copilotkit-CFfEVdV4.cjs.map +0 -1
- package/dist/copilotkit-Ctvinul7.d.cts.map +0 -1
- package/dist/copilotkit-DEGlMWM0.mjs.map +0 -1
- package/dist/copilotkit-DqDT5RLa.d.mts.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -773,7 +773,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
773
773
|
severity: "warning",
|
|
774
774
|
message: `Your CopilotKit license expires in ${graceRemaining} day${graceRemaining !== 1 ? "s" : ""}. Please renew.`,
|
|
775
775
|
actionLabel: "Renew",
|
|
776
|
-
actionUrl: "https://
|
|
776
|
+
actionUrl: "https://dashboard.operations.copilotkit.ai",
|
|
777
777
|
onDismiss
|
|
778
778
|
});
|
|
779
779
|
case "expired": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
@@ -2312,67 +2312,61 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2312
2312
|
return null;
|
|
2313
2313
|
}
|
|
2314
2314
|
|
|
2315
|
-
//#endregion
|
|
2316
|
-
//#region src/v2/hooks/use-agent-context.tsx
|
|
2317
|
-
function useAgentContext(context) {
|
|
2318
|
-
const { description, value } = context;
|
|
2319
|
-
const { copilotkit } = useCopilotKit();
|
|
2320
|
-
const stringValue = (0, react.useMemo)(() => {
|
|
2321
|
-
if (typeof value === "string") return value;
|
|
2322
|
-
return JSON.stringify(value);
|
|
2323
|
-
}, [value]);
|
|
2324
|
-
(0, react.useLayoutEffect)(() => {
|
|
2325
|
-
if (!copilotkit) return;
|
|
2326
|
-
const id = copilotkit.addContext({
|
|
2327
|
-
description,
|
|
2328
|
-
value: stringValue
|
|
2329
|
-
});
|
|
2330
|
-
return () => {
|
|
2331
|
-
copilotkit.removeContext(id);
|
|
2332
|
-
};
|
|
2333
|
-
}, [
|
|
2334
|
-
description,
|
|
2335
|
-
stringValue,
|
|
2336
|
-
copilotkit
|
|
2337
|
-
]);
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
2315
|
//#endregion
|
|
2341
2316
|
//#region src/v2/a2ui/A2UICatalogContext.tsx
|
|
2342
2317
|
/**
|
|
2343
2318
|
* Renders agent context describing the available A2UI catalog and custom components.
|
|
2344
2319
|
* Only mount this component when A2UI is enabled.
|
|
2345
2320
|
*
|
|
2321
|
+
* The entries are scoped to the agents the runtime applies A2UI to
|
|
2322
|
+
* (`copilotkit.a2uiAgents`, #5369), so agents outside that list don't receive
|
|
2323
|
+
* the catalog/schema/guidelines payload on their runs.
|
|
2324
|
+
*
|
|
2346
2325
|
* When `includeSchema` is true, the full component schemas (JSON Schema) are also
|
|
2347
2326
|
* sent as context using the same description key as the A2UI middleware, so the
|
|
2348
2327
|
* middleware can optionally overwrite it with a server-side schema.
|
|
2349
2328
|
*/
|
|
2350
2329
|
function A2UICatalogContext({ catalog, includeSchema }) {
|
|
2351
|
-
useAgentContext({
|
|
2352
|
-
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
2353
|
-
value: (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog)
|
|
2354
|
-
});
|
|
2355
2330
|
const { copilotkit } = useCopilotKit();
|
|
2331
|
+
const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog), [catalog]);
|
|
2356
2332
|
const schemaValue = (0, react.useMemo)(() => includeSchema !== false ? JSON.stringify((0, _copilotkit_a2ui_renderer.extractCatalogComponentSchemas)(catalog)) : null, [catalog, includeSchema]);
|
|
2333
|
+
const a2uiAgentsKey = copilotkit?.a2uiAgents?.join(",");
|
|
2357
2334
|
(0, react.useLayoutEffect)(() => {
|
|
2358
|
-
if (!copilotkit
|
|
2335
|
+
if (!copilotkit) return;
|
|
2336
|
+
const agentIds = copilotkit.a2uiAgents;
|
|
2337
|
+
const scope = agentIds ? { agentIds } : {};
|
|
2359
2338
|
const ids = [];
|
|
2360
2339
|
ids.push(copilotkit.addContext({
|
|
2361
|
-
description:
|
|
2362
|
-
value:
|
|
2363
|
-
|
|
2364
|
-
ids.push(copilotkit.addContext({
|
|
2365
|
-
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
2366
|
-
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES
|
|
2367
|
-
}));
|
|
2368
|
-
ids.push(copilotkit.addContext({
|
|
2369
|
-
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
2370
|
-
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES
|
|
2340
|
+
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
2341
|
+
value: capabilitiesValue,
|
|
2342
|
+
...scope
|
|
2371
2343
|
}));
|
|
2344
|
+
if (schemaValue) {
|
|
2345
|
+
ids.push(copilotkit.addContext({
|
|
2346
|
+
description: _copilotkit_a2ui_renderer.A2UI_SCHEMA_CONTEXT_DESCRIPTION,
|
|
2347
|
+
value: schemaValue,
|
|
2348
|
+
...scope
|
|
2349
|
+
}));
|
|
2350
|
+
ids.push(copilotkit.addContext({
|
|
2351
|
+
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
2352
|
+
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES,
|
|
2353
|
+
...scope
|
|
2354
|
+
}));
|
|
2355
|
+
ids.push(copilotkit.addContext({
|
|
2356
|
+
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
2357
|
+
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES,
|
|
2358
|
+
...scope
|
|
2359
|
+
}));
|
|
2360
|
+
}
|
|
2372
2361
|
return () => {
|
|
2373
2362
|
for (const id of ids) copilotkit.removeContext(id);
|
|
2374
2363
|
};
|
|
2375
|
-
}, [
|
|
2364
|
+
}, [
|
|
2365
|
+
copilotkit,
|
|
2366
|
+
capabilitiesValue,
|
|
2367
|
+
schemaValue,
|
|
2368
|
+
a2uiAgentsKey
|
|
2369
|
+
]);
|
|
2376
2370
|
return null;
|
|
2377
2371
|
}
|
|
2378
2372
|
|
|
@@ -4332,7 +4326,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4332
4326
|
} };
|
|
4333
4327
|
case _copilotkit_shared.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR: return { primary: {
|
|
4334
4328
|
label: "Upgrade",
|
|
4335
|
-
onClick: () => window.open("https://
|
|
4329
|
+
onClick: () => window.open("https://dashboard.operations.copilotkit.ai", "_blank", "noopener,noreferrer")
|
|
4336
4330
|
} };
|
|
4337
4331
|
default: return;
|
|
4338
4332
|
}
|
|
@@ -5895,9 +5889,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5895
5889
|
* `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
|
|
5896
5890
|
*
|
|
5897
5891
|
* <Callout title="This is a premium-only feature">
|
|
5898
|
-
*
|
|
5892
|
+
* Read more about <a href="/premium/overview">premium features</a>.
|
|
5899
5893
|
*
|
|
5900
|
-
* Usage is generous
|
|
5894
|
+
* Usage is generous and **free** to get started.
|
|
5901
5895
|
* </Callout>
|
|
5902
5896
|
*
|
|
5903
5897
|
* ## Key Features
|
|
@@ -5920,7 +5914,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5920
5914
|
*
|
|
5921
5915
|
* export function App() {
|
|
5922
5916
|
* return (
|
|
5923
|
-
* <CopilotKit
|
|
5917
|
+
* <CopilotKit runtimeUrl="/api/copilotkit">
|
|
5924
5918
|
* <YourComponent />
|
|
5925
5919
|
* </CopilotKit>
|
|
5926
5920
|
* );
|
|
@@ -6077,8 +6071,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6077
6071
|
* Enterprise React hook that provides complete chat functionality for fully custom UI implementations.
|
|
6078
6072
|
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
6079
6073
|
*
|
|
6080
|
-
* **Requires a publicApiKey** - Sign up for free at https://cloud.copilotkit.ai/
|
|
6081
|
-
*
|
|
6082
6074
|
* @param options - Configuration options for the chat
|
|
6083
6075
|
* @returns Complete chat interface with all enterprise features
|
|
6084
6076
|
*
|
|
@@ -6703,7 +6695,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6703
6695
|
/**
|
|
6704
6696
|
* <Callout type="info">
|
|
6705
6697
|
* Usage of this hook assumes some additional setup in your application, for more information
|
|
6706
|
-
* on that see the CoAgents <span className="text-blue-500">[getting started guide](/
|
|
6698
|
+
* on that see the CoAgents <span className="text-blue-500">[getting started guide](/langgraph-python/quickstart)</span>.
|
|
6707
6699
|
* </Callout>
|
|
6708
6700
|
* <Frame className="my-12">
|
|
6709
6701
|
* <img
|
|
@@ -6737,18 +6729,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6737
6729
|
*
|
|
6738
6730
|
* ```
|
|
6739
6731
|
*
|
|
6740
|
-
* `useCoAgent`
|
|
6732
|
+
* In CopilotKit v2, `useCoAgent` is a thin compatibility wrapper over the v2
|
|
6733
|
+
* [`useAgent`](/reference/hooks/useAgent) hook. It returns an object with the
|
|
6734
|
+
* following properties:
|
|
6741
6735
|
*
|
|
6742
6736
|
* ```tsx
|
|
6743
6737
|
* const {
|
|
6744
6738
|
* name, // The name of the agent currently being used.
|
|
6745
6739
|
* nodeName, // The name of the current LangGraph node.
|
|
6740
|
+
* threadId, // The ID of the thread the agent is running in.
|
|
6746
6741
|
* state, // The current state of the agent.
|
|
6747
6742
|
* setState, // A function to update the state of the agent.
|
|
6748
6743
|
* running, // A boolean indicating if the agent is currently running.
|
|
6749
6744
|
* start, // A function to start the agent.
|
|
6750
6745
|
* stop, // A function to stop the agent.
|
|
6751
|
-
* run, // A function to re-run the agent.
|
|
6746
|
+
* run, // A function to (re-)run the agent. Maps to the v2 agent's `runAgent()`.
|
|
6752
6747
|
* } = agent;
|
|
6753
6748
|
* ```
|
|
6754
6749
|
*
|
|
@@ -7011,9 +7006,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
7011
7006
|
/**
|
|
7012
7007
|
* Hook to create an authenticated action that requires user sign-in before execution.
|
|
7013
7008
|
*
|
|
7014
|
-
* @
|
|
7015
|
-
* This feature is only available when using CopilotKit's hosted cloud service.
|
|
7016
|
-
* To use this feature, sign up at https://cloud.copilotkit.ai to get your publicApiKey.
|
|
7009
|
+
* @internal Defunct — retained for backward compatibility.
|
|
7017
7010
|
*
|
|
7018
7011
|
* @param action - The frontend action to be wrapped with authentication
|
|
7019
7012
|
* @param dependencies - Optional array of dependencies that will trigger recreation of the action when changed
|