@copilotkit/react-core 1.70.0 → 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.
Files changed (37) hide show
  1. package/dist/{copilotkit-CbZGwElm.d.mts → copilotkit--Jyzm6hS.d.mts} +50 -20
  2. package/dist/copilotkit--Jyzm6hS.d.mts.map +1 -0
  3. package/dist/{copilotkit-B7aFKfQR.mjs → copilotkit-B1jSvZeb.mjs} +395 -291
  4. package/dist/copilotkit-B1jSvZeb.mjs.map +1 -0
  5. package/dist/{copilotkit-BuzP0VeG.d.cts → copilotkit-BLYaCGcz.d.cts} +50 -20
  6. package/dist/copilotkit-BLYaCGcz.d.cts.map +1 -0
  7. package/dist/{copilotkit-BE76j111.cjs → copilotkit-DcFo270Y.cjs} +395 -291
  8. package/dist/copilotkit-DcFo270Y.cjs.map +1 -0
  9. package/dist/index.cjs +5 -4
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +2 -2
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +5 -4
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +198 -207
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/headless.cjs +58 -1
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.mjs +59 -2
  22. package/dist/v2/headless.mjs.map +1 -1
  23. package/dist/v2/index.cjs +1 -1
  24. package/dist/v2/index.css +1 -1
  25. package/dist/v2/index.d.cts +1 -1
  26. package/dist/v2/index.d.mts +1 -1
  27. package/dist/v2/index.mjs +1 -1
  28. package/dist/v2/index.umd.js +395 -291
  29. package/dist/v2/index.umd.js.map +1 -1
  30. package/package.json +11 -8
  31. package/skills/react-core/SKILL.md +1 -1
  32. package/skills/react-core/references/attachments.md +20 -0
  33. package/skills/react-core/references/threads.md +1 -1
  34. package/dist/copilotkit-B7aFKfQR.mjs.map +0 -1
  35. package/dist/copilotkit-BE76j111.cjs.map +0 -1
  36. package/dist/copilotkit-BuzP0VeG.d.cts.map +0 -1
  37. package/dist/copilotkit-CbZGwElm.d.mts.map +0 -1
@@ -281,6 +281,62 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
281
281
  const useCopilotChatConfiguration = () => {
282
282
  return (0, react.useContext)(CopilotChatConfiguration);
283
283
  };
284
+ /**
285
+ * Reports modal open/close requests to the host, and — when `open` is
286
+ * supplied — makes the modal state of an already-established chat
287
+ * configuration **controlled** for the subtree it wraps.
288
+ *
289
+ * This is deliberately a scope component rather than another mode inside
290
+ * {@link CopilotChatConfigurationProvider}. The provider resolves modal state
291
+ * across a nested chain (own state, parent sync, drawer mutual-exclusion, the
292
+ * modal-closer registry); a controlled branch inside that resolution would add
293
+ * a fourth interacting mode. Overriding the context for the subtree instead
294
+ * leaves every one of those paths untouched:
295
+ *
296
+ * - `isModalOpen` is replaced with the host's `open`, so the rendered surface
297
+ * follows the prop from the very first frame (no open-then-close flash).
298
+ * - `setModalOpen` still calls the underlying setter, so the existing
299
+ * parent-sync and drawer mutual-exclusion side effects continue to run, and
300
+ * *then* reports the request through `onOpenChange`.
301
+ * - The wrapped setter is registered as the modal closer, so the drawer's
302
+ * mobile mutual-exclusion reaches the host instead of silently flipping
303
+ * state that nothing displays.
304
+ *
305
+ * A host that supplies `open` and ignores `onOpenChange` gets a modal pinned
306
+ * to `open`, which is the standard controlled-component contract. A host that
307
+ * supplies only `onOpenChange` is notified while the modal keeps managing
308
+ * itself.
309
+ *
310
+ * Renders `children` unchanged when no chat configuration is in scope.
311
+ */
312
+ const ControlledModalOpenScope = ({ children, open, onOpenChange }) => {
313
+ const parentConfig = (0, react.useContext)(CopilotChatConfiguration);
314
+ const parentSetModalOpen = parentConfig?.setModalOpen;
315
+ const registerModalCloser = parentConfig?.ɵregisterModalCloser;
316
+ const setModalOpen = (0, react.useCallback)((next) => {
317
+ parentSetModalOpen?.(next);
318
+ onOpenChange?.(next);
319
+ }, [parentSetModalOpen, onOpenChange]);
320
+ (0, react.useEffect)(() => {
321
+ if (!registerModalCloser) return;
322
+ return registerModalCloser(setModalOpen);
323
+ }, [registerModalCloser, setModalOpen]);
324
+ const configurationValue = (0, react.useMemo)(() => parentConfig ? {
325
+ ...parentConfig,
326
+ isModalOpen: open ?? parentConfig.isModalOpen,
327
+ setModalOpen
328
+ } : null, [
329
+ parentConfig,
330
+ open,
331
+ setModalOpen
332
+ ]);
333
+ if (!configurationValue) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
334
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatConfiguration.Provider, {
335
+ value: configurationValue,
336
+ children
337
+ });
338
+ };
339
+ ControlledModalOpenScope.displayName = "ControlledModalOpenScope";
284
340
 
285
341
  //#endregion
286
342
  //#region src/v2/hooks/use-agent.tsx
@@ -507,7 +563,8 @@ function useFrontendTool(tool, deps) {
507
563
  tool.name,
508
564
  tool.available,
509
565
  copilotkit,
510
- JSON.stringify(extraDeps)
566
+ JSON.stringify(extraDeps),
567
+ JSON.stringify(tool.webmcp ?? null)
511
568
  ]);
512
569
  }
513
570