@copilotkit/react-core 1.64.2-canary.1785346263 → 1.64.2-canary.parallel1

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/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('./copilotkit-BrNiD3wI.cjs');
4
+ const require_copilotkit = require('./copilotkit-2v7ami2b.cjs');
5
5
  let react = require("react");
6
6
  react = require_copilotkit.__toESM(react);
7
7
  let _copilotkit_core = require("@copilotkit/core");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Tt as useCopilotKit, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useRenderCustomMessages, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, jt as useCopilotChatConfiguration, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useHumanInTheLoop$1, o as useThreads, ot as useFrontendTool$1, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, tt as useAgent, u as useAsyncCallback, ut as defineToolCallRenderer, wt as useRenderToolCall$1 } from "./copilotkit-BrZGzZw6.mjs";
3
+ import { Tt as useCopilotKit, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, ct as useRenderCustomMessages, d as shouldShowDevConsole, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, jt as useCopilotChatConfiguration, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useHumanInTheLoop$1, o as useThreads, ot as useFrontendTool$1, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, tt as useAgent, u as useAsyncCallback, ut as defineToolCallRenderer, wt as useRenderToolCall$1 } from "./copilotkit-DnlgZWST.mjs";
4
4
  import React, { Fragment, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
5
5
  import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
6
6
  import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
package/dist/index.umd.js CHANGED
@@ -2324,6 +2324,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2324
2324
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
2325
2325
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
2326
2326
  const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = (0, react.useState)(false);
2327
+ const [catalogToggleVersion, setCatalogToggleVersion] = (0, react.useState)(0);
2327
2328
  const openGenUIActive = runtimeOpenGenUIEnabled || !!openGenerativeUI;
2328
2329
  const a2uiCatalogProvided = !!a2ui?.catalog;
2329
2330
  const a2uiActive = runtimeA2UIEnabled || a2uiCatalogProvided;
@@ -2346,6 +2347,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2346
2347
  });
2347
2348
  const renderCustomMessagesList = useStableArrayProp(renderCustomMessages, "renderCustomMessages must be a stable array.");
2348
2349
  const renderActivityMessagesList = useStableArrayProp(renderActivityMessages, "renderActivityMessages must be a stable array.");
2350
+ const copilotkitRef = (0, react.useRef)(null);
2351
+ const rawCatalog = a2ui?.catalog;
2352
+ const filteredCatalog = (0, react.useMemo)(() => {
2353
+ if (!rawCatalog) return rawCatalog;
2354
+ if (!(rawCatalog instanceof _copilotkit_a2ui_renderer.Catalog)) return rawCatalog;
2355
+ const core = copilotkitRef.current;
2356
+ return (0, _copilotkit_a2ui_renderer.filterCatalog)(rawCatalog, (name) => core ? core.isCatalogComponentEnabled(name) : true);
2357
+ }, [rawCatalog, catalogToggleVersion]);
2349
2358
  const builtInActivityRenderers = (0, react.useMemo)(() => {
2350
2359
  const renderers = [{
2351
2360
  activityType: MCPAppsActivityType,
@@ -2359,7 +2368,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2359
2368
  });
2360
2369
  if (a2uiActive) renderers.unshift(createA2UIMessageRenderer({
2361
2370
  theme: a2ui?.theme ?? _copilotkit_a2ui_renderer.viewerTheme,
2362
- catalog: a2ui?.catalog,
2371
+ catalog: filteredCatalog,
2363
2372
  loadingComponent: a2ui?.loadingComponent,
2364
2373
  recovery: a2ui?.recovery
2365
2374
  }));
@@ -2367,7 +2376,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2367
2376
  }, [
2368
2377
  a2uiActive,
2369
2378
  openGenUIActive,
2370
- a2ui
2379
+ a2ui,
2380
+ filteredCatalog
2371
2381
  ]);
2372
2382
  const allActivityRenderers = (0, react.useMemo)(() => {
2373
2383
  return [...renderActivityMessagesList, ...builtInActivityRenderers];
@@ -2472,7 +2482,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2472
2482
  builtInFrontendTools,
2473
2483
  processedHumanInTheLoopTools
2474
2484
  ]);
2475
- const copilotkitRef = (0, react.useRef)(null);
2476
2485
  if (copilotkitRef.current === null) {
2477
2486
  copilotkitRef.current = new CopilotKitCoreReact({
2478
2487
  runtimeUrl: chatApiEndpoint,
@@ -2491,6 +2500,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2491
2500
  if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
2492
2501
  }
2493
2502
  const copilotkit = copilotkitRef.current;
2503
+ (0, react.useEffect)(() => {
2504
+ if (!rawCatalog) return;
2505
+ if (!(rawCatalog instanceof _copilotkit_a2ui_renderer.Catalog)) return;
2506
+ const components = Array.from(rawCatalog.components.values()).map((comp) => ({
2507
+ name: comp.name,
2508
+ description: void 0,
2509
+ schema: comp.schema
2510
+ }));
2511
+ copilotkit.setCatalogComponents(components);
2512
+ const subscription = copilotkit.subscribe({ onCatalogComponentsChanged: () => {
2513
+ setCatalogToggleVersion((v) => v + 1);
2514
+ } });
2515
+ return () => subscription.unsubscribe();
2516
+ }, [copilotkit, rawCatalog]);
2494
2517
  (0, react.useEffect)(() => {
2495
2518
  const syncRuntimeInfo = () => {
2496
2519
  setRuntimeA2UIEnabled(copilotkit.a2uiEnabled);
@@ -2646,7 +2669,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2646
2669
  children: [
2647
2670
  a2uiActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIBuiltInToolCallRenderer, {}),
2648
2671
  a2uiActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UICatalogContext, {
2649
- catalog: a2ui?.catalog,
2672
+ catalog: filteredCatalog,
2650
2673
  includeSchema: a2ui?.includeSchema
2651
2674
  }),
2652
2675
  children,