@copilotkit/react-core 1.63.3-canary.rc-1 → 1.64.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/v2/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-rYTwMndy.cjs');
4
+ const require_copilotkit = require('../copilotkit-DiLTL1ZM.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
 
package/dist/v2/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-DL0LvmwQ.mjs";
3
+ import { $ as useCapabilities, A as CopilotChatMessageView, At as CopilotChatConfigurationProvider, B as CopilotChatAssistantMessage_default, C as CopilotModalHeader, Ct as CopilotKitInspector, D as CopilotChat, Dt as CopilotChatInput_default, E as DefaultOpenIcon, Et as CopilotKitCoreReact, F as CopilotChatSuggestionView, G as useLearnFromUserActionInCurrentThread, H as useLearningContainersInCurrentThread, I as CopilotChatSuggestionPill, J as useThreads, K as useLearnFromUserAction, L as CopilotChatReasoningMessage_default, M as IntelligenceIndicator, N as getIntelligenceTurnAnchors, O as CopilotChatView_default, Ot as AudioRecorderError, P as IntelligenceIndicatorView, Q as useAgentContext, R as CopilotChatUserMessage_default, S as CopilotSidebarView, St as ɵrunMcpFollowUp, T as DefaultCloseIcon, Tt as useCopilotKit, U as useLearningContainers, V as CopilotChatToolCallsView, W as useAttachments, X as useConfigureSuggestions, Y as useInterrupt, Z as useSuggestions, _ as WildcardToolCallRender, _t as SandboxFunctionsContext, at as useComponent, b as CopilotSidebar, bt as MCPAppsActivityRenderer, ct as useRenderCustomMessages, dt as createA2UIMessageRenderer, et as UseAgentUpdate, ft as GenerateSandboxedUiArgsSchema, gt as OpenGenerativeUIToolRenderer, ht as OpenGenerativeUIContentSchema, it as useRenderTool, j as INTELLIGENCE_TURN_HEAD, jt as useCopilotChatConfiguration, k as CopilotChatAttachmentQueue, kt as CopilotChatAudioRecorder, lt as CopilotKitProvider, mt as OpenGenerativeUIActivityType, nt as useHumanInTheLoop, ot as useFrontendTool, pt as OpenGenerativeUIActivityRenderer, q as useMemories, rt as useDefaultRenderTool, st as useRenderActivityMessage, t as CopilotKit, tt as useAgent, ut as defineToolCallRenderer, v as CopilotThreadsDrawer, vt as useSandboxFunctions, w as CopilotChatToggleButton, wt as useRenderToolCall, x as CopilotPopupView, xt as MCPAppsActivityType, y as CopilotPopup, yt as MCPAppsActivityContentSchema, z as CopilotChatAttachmentRenderer } from "../copilotkit-D_Ao1X-u.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -4428,17 +4428,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4428
4428
  const status = copilotkit.runtimeConnectionStatus;
4429
4429
  if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
4430
4430
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4431
- if (cached) {
4432
- copilotkit.applyHeadersToAgent(cached);
4433
- return {
4434
- agent: cached,
4435
- isReady: false
4436
- };
4437
- }
4431
+ if (cached) return {
4432
+ agent: cached,
4433
+ isReady: false
4434
+ };
4438
4435
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4439
4436
  runtimeUrl: copilotkit.runtimeUrl,
4440
4437
  agentId: resolvedAgentId,
4441
4438
  transport: copilotkit.runtimeTransport,
4439
+ credentials: copilotkit.credentials,
4442
4440
  runtimeMode: "pending"
4443
4441
  });
4444
4442
  copilotkit.applyHeadersToAgent(provisional);
@@ -4450,17 +4448,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4450
4448
  }
4451
4449
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
4452
4450
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4453
- if (cached) {
4454
- copilotkit.applyHeadersToAgent(cached);
4455
- return {
4456
- agent: cached,
4457
- isReady: false
4458
- };
4459
- }
4451
+ if (cached) return {
4452
+ agent: cached,
4453
+ isReady: false
4454
+ };
4460
4455
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4461
4456
  runtimeUrl: copilotkit.runtimeUrl,
4462
4457
  agentId: resolvedAgentId,
4463
4458
  transport: copilotkit.runtimeTransport,
4459
+ credentials: copilotkit.credentials,
4464
4460
  runtimeMode: "pending"
4465
4461
  });
4466
4462
  copilotkit.applyHeadersToAgent(provisional);
@@ -4479,6 +4475,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4479
4475
  copilotkit.runtimeConnectionStatus,
4480
4476
  copilotkit.runtimeUrl,
4481
4477
  copilotkit.runtimeTransport,
4478
+ copilotkit.credentials,
4482
4479
  JSON.stringify(copilotkit.headers)
4483
4480
  ]);
4484
4481
  (0, react.useEffect)(() => {
@@ -4518,7 +4515,12 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4518
4515
  ]);
4519
4516
  (0, react.useEffect)(() => {
4520
4517
  if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
4521
- }, [agent, JSON.stringify(copilotkit.headers)]);
4518
+ if (agent instanceof _copilotkit_core.ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
4519
+ }, [
4520
+ agent,
4521
+ JSON.stringify(copilotkit.headers),
4522
+ copilotkit.credentials
4523
+ ]);
4522
4524
  const configThreadId = chatConfig?.threadId;
4523
4525
  const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
4524
4526
  (0, react.useEffect)(() => {
@@ -9081,27 +9083,35 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
9081
9083
 
9082
9084
  //#endregion
9083
9085
  //#region src/v2/components/chat/CopilotPopup.tsx
9086
+ const PopupShellPropsContext = react.default.createContext({});
9087
+ const PopupViewOverride = (viewProps) => {
9088
+ const { header: viewHeader, toggleButton: viewToggleButton, width: viewWidth, height: viewHeight, clickOutsideToClose: viewClickOutsideToClose, defaultOpen: viewDefaultOpen, ...restProps } = viewProps;
9089
+ const shell = (0, react.useContext)(PopupShellPropsContext);
9090
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotPopupView_default, {
9091
+ ...restProps,
9092
+ header: shell.header ?? viewHeader,
9093
+ toggleButton: shell.toggleButton ?? viewToggleButton,
9094
+ width: shell.width ?? viewWidth,
9095
+ height: shell.height ?? viewHeight,
9096
+ clickOutsideToClose: shell.clickOutsideToClose ?? viewClickOutsideToClose,
9097
+ defaultOpen: shell.defaultOpen ?? viewDefaultOpen
9098
+ });
9099
+ };
9100
+ const PopupViewOverrideWithStatics = Object.assign(PopupViewOverride, CopilotChatView_default);
9084
9101
  function CopilotPopup({ header, toggleButton, defaultOpen, width, height, clickOutsideToClose, ...chatProps }) {
9085
9102
  const { checkFeature } = useLicenseContext();
9086
9103
  const isPopupLicensed = checkFeature("popup");
9087
9104
  (0, react.useEffect)(() => {
9088
9105
  if (!isPopupLicensed) console.warn("[CopilotKit] Warning: \"popup\" feature is not licensed. Visit copilotkit.ai/pricing");
9089
9106
  }, [isPopupLicensed]);
9090
- const PopupViewOverride = (0, react.useMemo)(() => {
9091
- const Component = (viewProps) => {
9092
- const { header: viewHeader, toggleButton: viewToggleButton, width: viewWidth, height: viewHeight, clickOutsideToClose: viewClickOutsideToClose, defaultOpen: viewDefaultOpen, ...restProps } = viewProps;
9093
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotPopupView_default, {
9094
- ...restProps,
9095
- header: header ?? viewHeader,
9096
- toggleButton: toggleButton ?? viewToggleButton,
9097
- width: width ?? viewWidth,
9098
- height: height ?? viewHeight,
9099
- clickOutsideToClose: clickOutsideToClose ?? viewClickOutsideToClose,
9100
- defaultOpen: defaultOpen ?? viewDefaultOpen
9101
- });
9102
- };
9103
- return Object.assign(Component, CopilotChatView_default);
9104
- }, [
9107
+ const shellProps = (0, react.useMemo)(() => ({
9108
+ header,
9109
+ toggleButton,
9110
+ width,
9111
+ height,
9112
+ clickOutsideToClose,
9113
+ defaultOpen
9114
+ }), [
9105
9115
  clickOutsideToClose,
9106
9116
  header,
9107
9117
  toggleButton,
@@ -9109,11 +9119,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
9109
9119
  width,
9110
9120
  defaultOpen
9111
9121
  ]);
9112
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!isPopupLicensed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineFeatureWarning, { featureName: "Popup" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
9113
- welcomeScreen: CopilotPopupView_default.WelcomeScreen,
9114
- ...chatProps,
9115
- isModalDefaultOpen: defaultOpen,
9116
- chatView: PopupViewOverride
9122
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!isPopupLicensed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineFeatureWarning, { featureName: "Popup" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopupShellPropsContext.Provider, {
9123
+ value: shellProps,
9124
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
9125
+ welcomeScreen: CopilotPopupView_default.WelcomeScreen,
9126
+ ...chatProps,
9127
+ isModalDefaultOpen: defaultOpen,
9128
+ chatView: PopupViewOverrideWithStatics
9129
+ })
9117
9130
  })] });
9118
9131
  }
9119
9132
  CopilotPopup.displayName = "CopilotPopup";