@copilotkit/react-core 1.63.2 → 1.64.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.
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-DDVfoiRM.cjs');
4
+ const require_copilotkit = require('./copilotkit-DiLTL1ZM.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-CN2JVeH3.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-D_Ao1X-u.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
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
 
3
3
  (function(global, factory) {
4
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@copilotkit/core'), require('@ag-ui/client'), require('tailwind-merge'), require('@copilotkit/shared'), require('react/jsx-runtime'), require('zod'), require('@lit-labs/react'), require('@copilotkit/a2ui-renderer'), require('zod-to-json-schema'), require('react-dom'), require('react-markdown'), require('@copilotkit/runtime-client-gql')) :
5
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@copilotkit/core', '@ag-ui/client', 'tailwind-merge', '@copilotkit/shared', 'react/jsx-runtime', 'zod', '@lit-labs/react', '@copilotkit/a2ui-renderer', 'zod-to-json-schema', 'react-dom', 'react-markdown', '@copilotkit/runtime-client-gql'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactCore = {}), global.React,global.CopilotKitCore,global.AgUIClient,global.tailwind_merge,global.CopilotKitShared,global.ReactJsxRuntime,global.Zod,global._lit_labs_react,global.CopilotKitA2UIRenderer,global.zod_to_json_schema,global.ReactDOM,global.ReactMarkdown,global.CopilotKitRuntimeClientGQL));
7
- })(this, function(exports, react, _copilotkit_core, _ag_ui_client, tailwind_merge, _copilotkit_shared, react_jsx_runtime, zod, _lit_labs_react, _copilotkit_a2ui_renderer, zod_to_json_schema, react_dom, react_markdown, _copilotkit_runtime_client_gql) {
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@copilotkit/core'), require('@ag-ui/client'), require('@copilotkit/shared'), require('react/jsx-runtime'), require('zod'), require('@lit-labs/react'), require('@copilotkit/a2ui-renderer'), require('zod-to-json-schema'), require('react-dom'), require('react-markdown'), require('@copilotkit/runtime-client-gql')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@copilotkit/core', '@ag-ui/client', '@copilotkit/shared', 'react/jsx-runtime', 'zod', '@lit-labs/react', '@copilotkit/a2ui-renderer', 'zod-to-json-schema', 'react-dom', 'react-markdown', '@copilotkit/runtime-client-gql'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactCore = {}), global.React,global.CopilotKitCore,global.AgUIClient,global.CopilotKitShared,global.ReactJsxRuntime,global.Zod,global._lit_labs_react,global.CopilotKitA2UIRenderer,global.zod_to_json_schema,global.ReactDOM,global.ReactMarkdown,global.CopilotKitRuntimeClientGQL));
7
+ })(this, function(exports, react, _copilotkit_core, _ag_ui_client, _copilotkit_shared, react_jsx_runtime, zod, _lit_labs_react, _copilotkit_a2ui_renderer, zod_to_json_schema, react_dom, react_markdown, _copilotkit_runtime_client_gql) {
8
8
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
9
9
  //#region \0rolldown/runtime.js
10
10
  var __create = Object.create;
@@ -36,7 +36,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
36
  react = __toESM(react);
37
37
  react_markdown = __toESM(react_markdown);
38
38
 
39
- //#region src/v2/lib/slots.tsx
39
+ //#region src/v2/lib/shallow-stable-ref.ts
40
40
  /**
41
41
  * Shallow equality comparison for objects.
42
42
  */
@@ -76,49 +76,6 @@ react_markdown = __toESM(react_markdown);
76
76
  ref.current = value;
77
77
  return ref.current;
78
78
  }
79
- /**
80
- * Check if a value is a React component type (function, class, forwardRef, memo, etc.)
81
- */
82
- function isReactComponentType(value) {
83
- if (typeof value === "function") return true;
84
- if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
85
- return false;
86
- }
87
- /**
88
- * Internal function to render a slot value as a React element (non-memoized).
89
- */
90
- function renderSlotElement(slot, DefaultComponent, props) {
91
- if (typeof slot === "string") {
92
- const existingClassName = props.className;
93
- return react.default.createElement(DefaultComponent, {
94
- ...props,
95
- className: (0, tailwind_merge.twMerge)(existingClassName, slot)
96
- });
97
- }
98
- if (isReactComponentType(slot)) return react.default.createElement(slot, props);
99
- if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
100
- ...props,
101
- ...slot
102
- });
103
- return react.default.createElement(DefaultComponent, props);
104
- }
105
- /**
106
- * Internal memoized wrapper component for renderSlot.
107
- * Uses forwardRef to support ref forwarding.
108
- */
109
- const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
110
- const { $slot, $component, ...rest } = props;
111
- return renderSlotElement($slot, $component, ref !== null ? {
112
- ...rest,
113
- ref
114
- } : rest);
115
- }), (prev, next) => {
116
- if (prev.$slot !== next.$slot) return false;
117
- if (prev.$component !== next.$component) return false;
118
- const { $slot: _ps, $component: _pc, ...prevRest } = prev;
119
- const { $slot: _ns, $component: _nc, ...nextRest } = next;
120
- return shallowEqual(prevRest, nextRest);
121
- });
122
79
 
123
80
  //#endregion
124
81
  //#region src/v2/providers/CopilotChatConfigurationProvider.tsx
@@ -2906,17 +2863,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2906
2863
  const status = copilotkit.runtimeConnectionStatus;
2907
2864
  if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
2908
2865
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
2909
- if (cached) {
2910
- copilotkit.applyHeadersToAgent(cached);
2911
- return {
2912
- agent: cached,
2913
- isReady: false
2914
- };
2915
- }
2866
+ if (cached) return {
2867
+ agent: cached,
2868
+ isReady: false
2869
+ };
2916
2870
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
2917
2871
  runtimeUrl: copilotkit.runtimeUrl,
2918
2872
  agentId: resolvedAgentId,
2919
2873
  transport: copilotkit.runtimeTransport,
2874
+ credentials: copilotkit.credentials,
2920
2875
  runtimeMode: "pending"
2921
2876
  });
2922
2877
  copilotkit.applyHeadersToAgent(provisional);
@@ -2928,17 +2883,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2928
2883
  }
2929
2884
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
2930
2885
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
2931
- if (cached) {
2932
- copilotkit.applyHeadersToAgent(cached);
2933
- return {
2934
- agent: cached,
2935
- isReady: false
2936
- };
2937
- }
2886
+ if (cached) return {
2887
+ agent: cached,
2888
+ isReady: false
2889
+ };
2938
2890
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
2939
2891
  runtimeUrl: copilotkit.runtimeUrl,
2940
2892
  agentId: resolvedAgentId,
2941
2893
  transport: copilotkit.runtimeTransport,
2894
+ credentials: copilotkit.credentials,
2942
2895
  runtimeMode: "pending"
2943
2896
  });
2944
2897
  copilotkit.applyHeadersToAgent(provisional);
@@ -2957,6 +2910,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2957
2910
  copilotkit.runtimeConnectionStatus,
2958
2911
  copilotkit.runtimeUrl,
2959
2912
  copilotkit.runtimeTransport,
2913
+ copilotkit.credentials,
2960
2914
  JSON.stringify(copilotkit.headers)
2961
2915
  ]);
2962
2916
  (0, react.useEffect)(() => {
@@ -2996,7 +2950,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2996
2950
  ]);
2997
2951
  (0, react.useEffect)(() => {
2998
2952
  if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
2999
- }, [agent, JSON.stringify(copilotkit.headers)]);
2953
+ if (agent instanceof _copilotkit_core.ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
2954
+ }, [
2955
+ agent,
2956
+ JSON.stringify(copilotkit.headers),
2957
+ copilotkit.credentials
2958
+ ]);
3000
2959
  const configThreadId = chatConfig?.threadId;
3001
2960
  const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
3002
2961
  (0, react.useEffect)(() => {