@copilotkit/react-core 1.70.1 → 1.70.2

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-CxLT6zFx.cjs');
4
+ const require_copilotkit = require('./copilotkit-DcFo270Y.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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { $n as LangGraphInterruptAction, Cr as CatchAllFrontendAction, Er as RenderFunctionStatus, Jn as CopilotApiConfig, Qn as CoAgentStateRender, Sr as CatchAllActionRenderPropsWait, Tr as FrontendActionAvailability, X as useAgent, Xn as CopilotContextParams, Yn as CopilotContext, Zn as useCopilotContext, _r as ActionRenderProps, ar as QueuedInterruptEvent, br as ActionRenderPropsWait, bt as useRenderToolCall$1, cr as CrewsResponseStatus, dr as CrewsToolStateItem, er as LangGraphInterruptActionSetter, fr as CopilotChatSuggestionConfiguration, gr as TreeNode, hr as Tree, ir as LangGraphInterruptRenderProps, lr as CrewsStateItem, mr as DocumentPointer, n as defaultCopilotContextCategories, nr as LangGraphInterruptRender, or as CrewsAgentState, pr as SystemMessageFunction, qn as CoagentInChatRenderFunction, r as CopilotKitProps, rr as LangGraphInterruptRenderHandlerProps, sr as CrewsResponse, t as CopilotKit, tr as LangGraphInterruptActionSetterArgs, ur as CrewsTaskStateItem, vr as ActionRenderPropsNoArgs, wr as FrontendAction, xr as CatchAllActionRenderProps, yr as ActionRenderPropsNoArgsWait } from "./copilotkit-CtF2clxZ.cjs";
1
+ import { $n as LangGraphInterruptAction, Cr as CatchAllFrontendAction, Er as RenderFunctionStatus, Jn as CopilotApiConfig, Qn as CoAgentStateRender, Sr as CatchAllActionRenderPropsWait, Tr as FrontendActionAvailability, X as useAgent, Xn as CopilotContextParams, Yn as CopilotContext, Zn as useCopilotContext, _r as ActionRenderProps, ar as QueuedInterruptEvent, br as ActionRenderPropsWait, bt as useRenderToolCall$1, cr as CrewsResponseStatus, dr as CrewsToolStateItem, er as LangGraphInterruptActionSetter, fr as CopilotChatSuggestionConfiguration, gr as TreeNode, hr as Tree, ir as LangGraphInterruptRenderProps, lr as CrewsStateItem, mr as DocumentPointer, n as defaultCopilotContextCategories, nr as LangGraphInterruptRender, or as CrewsAgentState, pr as SystemMessageFunction, qn as CoagentInChatRenderFunction, r as CopilotKitProps, rr as LangGraphInterruptRenderHandlerProps, sr as CrewsResponse, t as CopilotKit, tr as LangGraphInterruptActionSetterArgs, ur as CrewsTaskStateItem, vr as ActionRenderPropsNoArgs, wr as FrontendAction, xr as CatchAllActionRenderProps, yr as ActionRenderPropsNoArgsWait } from "./copilotkit-BLYaCGcz.cjs";
2
2
  import "./v2/index.cjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { CopilotRuntimeClient, CopilotRuntimeClientOptions, ForwardedParametersInput, Message } from "@copilotkit/runtime-client-gql";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $n as LangGraphInterruptAction, Cr as CatchAllFrontendAction, Er as RenderFunctionStatus, Jn as CopilotApiConfig, Qn as CoAgentStateRender, Sr as CatchAllActionRenderPropsWait, Tr as FrontendActionAvailability, X as useAgent, Xn as CopilotContextParams, Yn as CopilotContext, Zn as useCopilotContext, _r as ActionRenderProps, ar as QueuedInterruptEvent, br as ActionRenderPropsWait, bt as useRenderToolCall$1, cr as CrewsResponseStatus, dr as CrewsToolStateItem, er as LangGraphInterruptActionSetter, fr as CopilotChatSuggestionConfiguration, gr as TreeNode, hr as Tree, ir as LangGraphInterruptRenderProps, lr as CrewsStateItem, mr as DocumentPointer, n as defaultCopilotContextCategories, nr as LangGraphInterruptRender, or as CrewsAgentState, pr as SystemMessageFunction, qn as CoagentInChatRenderFunction, r as CopilotKitProps, rr as LangGraphInterruptRenderHandlerProps, sr as CrewsResponse, t as CopilotKit, tr as LangGraphInterruptActionSetterArgs, ur as CrewsTaskStateItem, vr as ActionRenderPropsNoArgs, wr as FrontendAction, xr as CatchAllActionRenderProps, yr as ActionRenderPropsNoArgsWait } from "./copilotkit-DsWuxPUQ.mjs";
1
+ import { $n as LangGraphInterruptAction, Cr as CatchAllFrontendAction, Er as RenderFunctionStatus, Jn as CopilotApiConfig, Qn as CoAgentStateRender, Sr as CatchAllActionRenderPropsWait, Tr as FrontendActionAvailability, X as useAgent, Xn as CopilotContextParams, Yn as CopilotContext, Zn as useCopilotContext, _r as ActionRenderProps, ar as QueuedInterruptEvent, br as ActionRenderPropsWait, bt as useRenderToolCall$1, cr as CrewsResponseStatus, dr as CrewsToolStateItem, er as LangGraphInterruptActionSetter, fr as CopilotChatSuggestionConfiguration, gr as TreeNode, hr as Tree, ir as LangGraphInterruptRenderProps, lr as CrewsStateItem, mr as DocumentPointer, n as defaultCopilotContextCategories, nr as LangGraphInterruptRender, or as CrewsAgentState, pr as SystemMessageFunction, qn as CoagentInChatRenderFunction, r as CopilotKitProps, rr as LangGraphInterruptRenderHandlerProps, sr as CrewsResponse, t as CopilotKit, tr as LangGraphInterruptActionSetterArgs, ur as CrewsTaskStateItem, vr as ActionRenderPropsNoArgs, wr as FrontendAction, xr as CatchAllActionRenderProps, yr as ActionRenderPropsNoArgsWait } from "./copilotkit--Jyzm6hS.mjs";
2
2
  import "./v2/index.mjs";
3
3
  import React, { ReactNode, RefObject, SetStateAction } from "react";
4
4
  import { StaticSuggestionsConfig, Suggestion } from "@copilotkit/core";
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Nt as useCopilotChatConfiguration, Ot as useRenderToolCall$1, Q as useSuggestions, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, dt as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, lt as useRenderCustomMessages, m as useCopilotMessagesContext, mt as defineToolCallRenderer, n as defaultCopilotContextCategories, nt as useAgent, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, rt as useHumanInTheLoop$1, s as CoAgentStateRendersContext, st as useFrontendTool$1, t as CopilotKit, u as useAsyncCallback } from "./copilotkit-DiUK2Bhq.mjs";
3
+ import { Nt as useCopilotChatConfiguration, Ot as useRenderToolCall$1, Q as useSuggestions, X as INTERRUPT_EVENT_NAME, Y as useInterrupt, Z as useConfigureSuggestions, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, dt as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, l as useCoAgentStateRenders, lt as useRenderCustomMessages, m as useCopilotMessagesContext, mt as defineToolCallRenderer, n as defaultCopilotContextCategories, nt as useAgent, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, rt as useHumanInTheLoop$1, s as CoAgentStateRendersContext, st as useFrontendTool$1, t as CopilotKit, u as useAsyncCallback } from "./copilotkit-B1jSvZeb.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
@@ -282,6 +282,62 @@ react_markdown = __toESM(react_markdown);
282
282
  const useCopilotChatConfiguration = () => {
283
283
  return (0, react.useContext)(CopilotChatConfiguration);
284
284
  };
285
+ /**
286
+ * Reports modal open/close requests to the host, and — when `open` is
287
+ * supplied — makes the modal state of an already-established chat
288
+ * configuration **controlled** for the subtree it wraps.
289
+ *
290
+ * This is deliberately a scope component rather than another mode inside
291
+ * {@link CopilotChatConfigurationProvider}. The provider resolves modal state
292
+ * across a nested chain (own state, parent sync, drawer mutual-exclusion, the
293
+ * modal-closer registry); a controlled branch inside that resolution would add
294
+ * a fourth interacting mode. Overriding the context for the subtree instead
295
+ * leaves every one of those paths untouched:
296
+ *
297
+ * - `isModalOpen` is replaced with the host's `open`, so the rendered surface
298
+ * follows the prop from the very first frame (no open-then-close flash).
299
+ * - `setModalOpen` still calls the underlying setter, so the existing
300
+ * parent-sync and drawer mutual-exclusion side effects continue to run, and
301
+ * *then* reports the request through `onOpenChange`.
302
+ * - The wrapped setter is registered as the modal closer, so the drawer's
303
+ * mobile mutual-exclusion reaches the host instead of silently flipping
304
+ * state that nothing displays.
305
+ *
306
+ * A host that supplies `open` and ignores `onOpenChange` gets a modal pinned
307
+ * to `open`, which is the standard controlled-component contract. A host that
308
+ * supplies only `onOpenChange` is notified while the modal keeps managing
309
+ * itself.
310
+ *
311
+ * Renders `children` unchanged when no chat configuration is in scope.
312
+ */
313
+ const ControlledModalOpenScope = ({ children, open, onOpenChange }) => {
314
+ const parentConfig = (0, react.useContext)(CopilotChatConfiguration);
315
+ const parentSetModalOpen = parentConfig?.setModalOpen;
316
+ const registerModalCloser = parentConfig?.ɵregisterModalCloser;
317
+ const setModalOpen = (0, react.useCallback)((next) => {
318
+ parentSetModalOpen?.(next);
319
+ onOpenChange?.(next);
320
+ }, [parentSetModalOpen, onOpenChange]);
321
+ (0, react.useEffect)(() => {
322
+ if (!registerModalCloser) return;
323
+ return registerModalCloser(setModalOpen);
324
+ }, [registerModalCloser, setModalOpen]);
325
+ const configurationValue = (0, react.useMemo)(() => parentConfig ? {
326
+ ...parentConfig,
327
+ isModalOpen: open ?? parentConfig.isModalOpen,
328
+ setModalOpen
329
+ } : null, [
330
+ parentConfig,
331
+ open,
332
+ setModalOpen
333
+ ]);
334
+ if (!configurationValue) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
335
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatConfiguration.Provider, {
336
+ value: configurationValue,
337
+ children
338
+ });
339
+ };
340
+ ControlledModalOpenScope.displayName = "ControlledModalOpenScope";
285
341
 
286
342
  //#endregion
287
343
  //#region src/v2/lib/react-core.ts