@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.
@@ -4443,17 +4443,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4443
4443
  const status = copilotkit.runtimeConnectionStatus;
4444
4444
  if (isRuntimeConfigured && (status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Disconnected || status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connecting)) {
4445
4445
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4446
- if (cached) {
4447
- copilotkit.applyHeadersToAgent(cached);
4448
- return {
4449
- agent: cached,
4450
- isReady: false
4451
- };
4452
- }
4446
+ if (cached) return {
4447
+ agent: cached,
4448
+ isReady: false
4449
+ };
4453
4450
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4454
4451
  runtimeUrl: copilotkit.runtimeUrl,
4455
4452
  agentId: resolvedAgentId,
4456
4453
  transport: copilotkit.runtimeTransport,
4454
+ credentials: copilotkit.credentials,
4457
4455
  runtimeMode: "pending"
4458
4456
  });
4459
4457
  copilotkit.applyHeadersToAgent(provisional);
@@ -4465,17 +4463,15 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4465
4463
  }
4466
4464
  if (isRuntimeConfigured && status === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Error) {
4467
4465
  const cached = provisionalAgentCache.current.get(resolvedAgentId);
4468
- if (cached) {
4469
- copilotkit.applyHeadersToAgent(cached);
4470
- return {
4471
- agent: cached,
4472
- isReady: false
4473
- };
4474
- }
4466
+ if (cached) return {
4467
+ agent: cached,
4468
+ isReady: false
4469
+ };
4475
4470
  const provisional = new _copilotkit_core.ProxiedCopilotRuntimeAgent({
4476
4471
  runtimeUrl: copilotkit.runtimeUrl,
4477
4472
  agentId: resolvedAgentId,
4478
4473
  transport: copilotkit.runtimeTransport,
4474
+ credentials: copilotkit.credentials,
4479
4475
  runtimeMode: "pending"
4480
4476
  });
4481
4477
  copilotkit.applyHeadersToAgent(provisional);
@@ -4494,6 +4490,7 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4494
4490
  copilotkit.runtimeConnectionStatus,
4495
4491
  copilotkit.runtimeUrl,
4496
4492
  copilotkit.runtimeTransport,
4493
+ copilotkit.credentials,
4497
4494
  JSON.stringify(copilotkit.headers)
4498
4495
  ]);
4499
4496
  (0, react.useEffect)(() => {
@@ -4533,7 +4530,12 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
4533
4530
  ]);
4534
4531
  (0, react.useEffect)(() => {
4535
4532
  if (agent instanceof _ag_ui_client.HttpAgent) copilotkit.applyHeadersToAgent(agent);
4536
- }, [agent, JSON.stringify(copilotkit.headers)]);
4533
+ if (agent instanceof _copilotkit_core.ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
4534
+ }, [
4535
+ agent,
4536
+ JSON.stringify(copilotkit.headers),
4537
+ copilotkit.credentials
4538
+ ]);
4537
4539
  const configThreadId = chatConfig?.threadId;
4538
4540
  const configHasExplicitThreadId = chatConfig?.hasExplicitThreadId;
4539
4541
  (0, react.useEffect)(() => {
@@ -9096,27 +9098,35 @@ CopilotSidebar.displayName = "CopilotSidebar";
9096
9098
 
9097
9099
  //#endregion
9098
9100
  //#region src/v2/components/chat/CopilotPopup.tsx
9101
+ const PopupShellPropsContext = react.default.createContext({});
9102
+ const PopupViewOverride = (viewProps) => {
9103
+ const { header: viewHeader, toggleButton: viewToggleButton, width: viewWidth, height: viewHeight, clickOutsideToClose: viewClickOutsideToClose, defaultOpen: viewDefaultOpen, ...restProps } = viewProps;
9104
+ const shell = (0, react.useContext)(PopupShellPropsContext);
9105
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotPopupView_default, {
9106
+ ...restProps,
9107
+ header: shell.header ?? viewHeader,
9108
+ toggleButton: shell.toggleButton ?? viewToggleButton,
9109
+ width: shell.width ?? viewWidth,
9110
+ height: shell.height ?? viewHeight,
9111
+ clickOutsideToClose: shell.clickOutsideToClose ?? viewClickOutsideToClose,
9112
+ defaultOpen: shell.defaultOpen ?? viewDefaultOpen
9113
+ });
9114
+ };
9115
+ const PopupViewOverrideWithStatics = Object.assign(PopupViewOverride, CopilotChatView_default);
9099
9116
  function CopilotPopup({ header, toggleButton, defaultOpen, width, height, clickOutsideToClose, ...chatProps }) {
9100
9117
  const { checkFeature } = useLicenseContext();
9101
9118
  const isPopupLicensed = checkFeature("popup");
9102
9119
  (0, react.useEffect)(() => {
9103
9120
  if (!isPopupLicensed) console.warn("[CopilotKit] Warning: \"popup\" feature is not licensed. Visit copilotkit.ai/pricing");
9104
9121
  }, [isPopupLicensed]);
9105
- const PopupViewOverride = (0, react.useMemo)(() => {
9106
- const Component = (viewProps) => {
9107
- const { header: viewHeader, toggleButton: viewToggleButton, width: viewWidth, height: viewHeight, clickOutsideToClose: viewClickOutsideToClose, defaultOpen: viewDefaultOpen, ...restProps } = viewProps;
9108
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotPopupView_default, {
9109
- ...restProps,
9110
- header: header ?? viewHeader,
9111
- toggleButton: toggleButton ?? viewToggleButton,
9112
- width: width ?? viewWidth,
9113
- height: height ?? viewHeight,
9114
- clickOutsideToClose: clickOutsideToClose ?? viewClickOutsideToClose,
9115
- defaultOpen: defaultOpen ?? viewDefaultOpen
9116
- });
9117
- };
9118
- return Object.assign(Component, CopilotChatView_default);
9119
- }, [
9122
+ const shellProps = (0, react.useMemo)(() => ({
9123
+ header,
9124
+ toggleButton,
9125
+ width,
9126
+ height,
9127
+ clickOutsideToClose,
9128
+ defaultOpen
9129
+ }), [
9120
9130
  clickOutsideToClose,
9121
9131
  header,
9122
9132
  toggleButton,
@@ -9124,11 +9134,14 @@ function CopilotPopup({ header, toggleButton, defaultOpen, width, height, clickO
9124
9134
  width,
9125
9135
  defaultOpen
9126
9136
  ]);
9127
- 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, {
9128
- welcomeScreen: CopilotPopupView_default.WelcomeScreen,
9129
- ...chatProps,
9130
- isModalDefaultOpen: defaultOpen,
9131
- chatView: PopupViewOverride
9137
+ 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, {
9138
+ value: shellProps,
9139
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChat, {
9140
+ welcomeScreen: CopilotPopupView_default.WelcomeScreen,
9141
+ ...chatProps,
9142
+ isModalDefaultOpen: defaultOpen,
9143
+ chatView: PopupViewOverrideWithStatics
9144
+ })
9132
9145
  })] });
9133
9146
  }
9134
9147
  CopilotPopup.displayName = "CopilotPopup";
@@ -12176,4 +12189,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
12176
12189
  return ɵrunMcpFollowUp;
12177
12190
  }
12178
12191
  });
12179
- //# sourceMappingURL=copilotkit-rYTwMndy.cjs.map
12192
+ //# sourceMappingURL=copilotkit-DiLTL1ZM.cjs.map