@copilotkit/react-core 1.59.5-canary.1781104893 → 1.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{copilotkit-CWGR3Ict.cjs → copilotkit-BTHcCAVQ.cjs} +68 -103
  2. package/dist/copilotkit-BTHcCAVQ.cjs.map +1 -0
  3. package/dist/{copilotkit-CD3EqiJ4.d.cts → copilotkit-C9ptuh-b.d.cts} +9 -35
  4. package/dist/{copilotkit-B83H_vWJ.d.mts.map → copilotkit-C9ptuh-b.d.cts.map} +1 -1
  5. package/dist/{copilotkit-DBOofUYQ.mjs → copilotkit-CV519nFv.mjs} +69 -104
  6. package/dist/copilotkit-CV519nFv.mjs.map +1 -0
  7. package/dist/{copilotkit-B83H_vWJ.d.mts → copilotkit-DvbI8G0d.d.mts} +9 -35
  8. package/dist/{copilotkit-CD3EqiJ4.d.cts.map → copilotkit-DvbI8G0d.d.mts.map} +1 -1
  9. package/dist/index.cjs +5 -9
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +2 -6
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +2 -6
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +5 -9
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +39 -49
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/index.cjs +1 -1
  20. package/dist/v2/index.d.cts +1 -1
  21. package/dist/v2/index.d.mts +1 -1
  22. package/dist/v2/index.mjs +1 -1
  23. package/dist/v2/index.umd.js +67 -102
  24. package/dist/v2/index.umd.js.map +1 -1
  25. package/package.json +6 -6
  26. package/skills/react-core/SKILL.md +5 -5
  27. package/skills/react-core/references/chat-components.md +2 -1
  28. package/skills/react-core/references/client-side-tools.md +1 -1
  29. package/skills/react-core/references/custom-message-renderers.md +8 -11
  30. package/skills/react-core/references/debug-mode.md +15 -15
  31. package/skills/react-core/references/provider-setup.md +45 -52
  32. package/skills/react-core/references/rendering-activity-messages.md +6 -12
  33. package/dist/copilotkit-CWGR3Ict.cjs.map +0 -1
  34. package/dist/copilotkit-DBOofUYQ.mjs.map +0 -1
package/dist/index.umd.js CHANGED
@@ -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 || !schemaValue) return;
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: _copilotkit_a2ui_renderer.A2UI_SCHEMA_CONTEXT_DESCRIPTION,
2362
- value: schemaValue
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
- }, [copilotkit, schemaValue]);
2364
+ }, [
2365
+ copilotkit,
2366
+ capabilitiesValue,
2367
+ schemaValue,
2368
+ a2uiAgentsKey
2369
+ ]);
2376
2370
  return null;
2377
2371
  }
2378
2372
 
@@ -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
- * Sign up for free on [Copilot Cloud](https://dashboard.operations.copilotkit.ai) to get your public license key or read more about <a href="/premium/overview">premium features</a>.
5892
+ * Read more about <a href="/premium/overview">premium features</a>.
5899
5893
  *
5900
- * Usage is generous, **free** to get started, and works with **either self-hosted or Copilot Cloud** environments.
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 publicApiKey="your-free-public-license-key">
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://dashboard.operations.copilotkit.ai/
6081
- *
6082
6074
  * @param options - Configuration options for the chat
6083
6075
  * @returns Complete chat interface with all enterprise features
6084
6076
  *
@@ -7014,9 +7006,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
7014
7006
  /**
7015
7007
  * Hook to create an authenticated action that requires user sign-in before execution.
7016
7008
  *
7017
- * @remarks
7018
- * This feature is only available when using CopilotKit's hosted cloud service.
7019
- * To use this feature, sign up at https://dashboard.operations.copilotkit.ai to get your publicApiKey.
7009
+ * @internal Defunct — retained for backward compatibility.
7020
7010
  *
7021
7011
  * @param action - The frontend action to be wrapped with authentication
7022
7012
  * @param dependencies - Optional array of dependencies that will trigger recreation of the action when changed