@copilotkit/react-core 1.69.3 → 1.70.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.
Files changed (37) hide show
  1. package/dist/{copilotkit-CrNUgJiq.d.cts → copilotkit-CtF2clxZ.d.cts} +50 -23
  2. package/dist/copilotkit-CtF2clxZ.d.cts.map +1 -0
  3. package/dist/{copilotkit-BPeh62mW.cjs → copilotkit-CxLT6zFx.cjs} +214 -230
  4. package/dist/copilotkit-CxLT6zFx.cjs.map +1 -0
  5. package/dist/{copilotkit-JdHy0xdu.mjs → copilotkit-DiUK2Bhq.mjs} +209 -231
  6. package/dist/copilotkit-DiUK2Bhq.mjs.map +1 -0
  7. package/dist/{copilotkit-DgO31tBq.d.mts → copilotkit-DsWuxPUQ.d.mts} +50 -23
  8. package/dist/copilotkit-DsWuxPUQ.d.mts.map +1 -0
  9. package/dist/index.cjs +97 -24
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +18 -3
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +18 -3
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +97 -24
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +275 -239
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/headless.cjs +16 -8
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.d.cts.map +1 -1
  22. package/dist/v2/headless.d.mts.map +1 -1
  23. package/dist/v2/headless.mjs +16 -8
  24. package/dist/v2/headless.mjs.map +1 -1
  25. package/dist/v2/index.cjs +2 -1
  26. package/dist/v2/index.d.cts +2 -2
  27. package/dist/v2/index.d.mts +2 -2
  28. package/dist/v2/index.mjs +2 -2
  29. package/dist/v2/index.umd.js +208 -229
  30. package/dist/v2/index.umd.js.map +1 -1
  31. package/package.json +13 -10
  32. package/skills/react-core/SKILL.md +1 -1
  33. package/skills/react-core/references/threads.md +1 -1
  34. package/dist/copilotkit-BPeh62mW.cjs.map +0 -1
  35. package/dist/copilotkit-CrNUgJiq.d.cts.map +0 -1
  36. package/dist/copilotkit-DgO31tBq.d.mts.map +0 -1
  37. package/dist/copilotkit-JdHy0xdu.mjs.map +0 -1
@@ -484,7 +484,7 @@ const EMPTY_DEPS$1 = [];
484
484
  function useFrontendTool(tool, deps) {
485
485
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
486
486
  const extraDeps = deps ?? EMPTY_DEPS$1;
487
- (0, react.useEffect)(() => {
487
+ (0, react.useLayoutEffect)(() => {
488
488
  const name = tool.name;
489
489
  if (copilotkit.getTool({
490
490
  toolName: name,
@@ -507,7 +507,8 @@ function useFrontendTool(tool, deps) {
507
507
  tool.name,
508
508
  tool.available,
509
509
  copilotkit,
510
- JSON.stringify(extraDeps)
510
+ JSON.stringify(extraDeps),
511
+ JSON.stringify(tool.webmcp ?? null)
511
512
  ]);
512
513
  }
513
514
 
@@ -581,6 +582,8 @@ function useComponent(config, deps) {
581
582
 
582
583
  //#endregion
583
584
  //#region src/v2/hooks/use-human-in-the-loop.tsx
585
+ /** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
586
+ const WILDCARD_TOOL_NAME = "*";
584
587
  function useHumanInTheLoop(tool, deps) {
585
588
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
586
589
  const resolvePromiseRef = (0, react.useRef)(null);
@@ -616,10 +619,11 @@ function useHumanInTheLoop(tool, deps) {
616
619
  }, []);
617
620
  const RenderComponent = (0, react.useCallback)((props) => {
618
621
  const ToolComponent = tool.render;
622
+ const name = tool.name === WILDCARD_TOOL_NAME ? props.name : tool.name;
619
623
  if (props.status === _copilotkit_core.ToolCallStatus.InProgress) {
620
624
  const enhancedProps = {
621
625
  ...props,
622
- name: tool.name,
626
+ name,
623
627
  description: tool.description || "",
624
628
  agentId: tool.agentId,
625
629
  respond: void 0
@@ -628,7 +632,7 @@ function useHumanInTheLoop(tool, deps) {
628
632
  } else if (props.status === _copilotkit_core.ToolCallStatus.Executing) {
629
633
  const enhancedProps = {
630
634
  ...props,
631
- name: tool.name,
635
+ name,
632
636
  description: tool.description || "",
633
637
  agentId: tool.agentId,
634
638
  respond
@@ -637,7 +641,7 @@ function useHumanInTheLoop(tool, deps) {
637
641
  } else if (props.status === _copilotkit_core.ToolCallStatus.Complete) {
638
642
  const enhancedProps = {
639
643
  ...props,
640
- name: tool.name,
644
+ name,
641
645
  description: tool.description || "",
642
646
  agentId: tool.agentId,
643
647
  respond: void 0
@@ -657,7 +661,7 @@ function useHumanInTheLoop(tool, deps) {
657
661
  handler,
658
662
  render: RenderComponent
659
663
  }, deps);
660
- (0, react.useEffect)(() => {
664
+ (0, react.useLayoutEffect)(() => {
661
665
  return () => {
662
666
  copilotkit.removeHookRenderToolCall(tool.name, tool.agentId);
663
667
  };
@@ -669,8 +673,12 @@ function useHumanInTheLoop(tool, deps) {
669
673
  }
670
674
 
671
675
  //#endregion
672
- //#region src/v2/hooks/use-interrupt.tsx
676
+ //#region src/v2/types/interrupt.ts
677
+ /** Name of the legacy custom event agents emit to signal an interrupt. */
673
678
  const INTERRUPT_EVENT_NAME = "on_interrupt";
679
+
680
+ //#endregion
681
+ //#region src/v2/hooks/use-interrupt.tsx
674
682
  function isPromiseLike(value) {
675
683
  return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
676
684
  }
@@ -1244,7 +1252,7 @@ function useThreadStoreSelector(store, selector) {
1244
1252
  */
1245
1253
  function useThreads({ agentId, includeArchived, limit, enabled = true }) {
1246
1254
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
1247
- const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: globalThis.fetch }));
1255
+ const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: copilotkit.ɵruntimeFetch }));
1248
1256
  const coreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreads);
1249
1257
  const threads = (0, react.useMemo)(() => coreThreads.map(({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({
1250
1258
  id,