@copilotkit/react-core 1.57.1-canary.1778272612 → 1.57.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 (33) hide show
  1. package/dist/{copilotkit-CBbSvze0.d.cts → copilotkit-BK9CVq9A.d.cts} +2 -1
  2. package/dist/{copilotkit-CBbSvze0.d.cts.map → copilotkit-BK9CVq9A.d.cts.map} +1 -1
  3. package/dist/{copilotkit-3XTEoVQO.mjs → copilotkit-CC8DjOiC.mjs} +3 -2
  4. package/dist/copilotkit-CC8DjOiC.mjs.map +1 -0
  5. package/dist/{copilotkit-Dnj9pi4m.cjs → copilotkit-CtXcs1ea.cjs} +3 -2
  6. package/dist/copilotkit-CtXcs1ea.cjs.map +1 -0
  7. package/dist/{copilotkit-BCJ2yvV6.d.mts → copilotkit-WlmeVijs.d.mts} +2 -1
  8. package/dist/{copilotkit-BCJ2yvV6.d.mts.map → copilotkit-WlmeVijs.d.mts.map} +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/v2/headless.cjs +110 -3
  14. package/dist/v2/headless.cjs.map +1 -1
  15. package/dist/v2/headless.d.cts +142 -2
  16. package/dist/v2/headless.d.cts.map +1 -1
  17. package/dist/v2/headless.d.mts +142 -1
  18. package/dist/v2/headless.d.mts.map +1 -1
  19. package/dist/v2/headless.mjs +108 -4
  20. package/dist/v2/headless.mjs.map +1 -1
  21. package/dist/v2/index.cjs +1 -1
  22. package/dist/v2/index.d.cts +1 -1
  23. package/dist/v2/index.d.mts +1 -1
  24. package/dist/v2/index.mjs +1 -1
  25. package/dist/v2/index.umd.js +2 -1
  26. package/dist/v2/index.umd.js.map +1 -1
  27. package/package.json +6 -6
  28. package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +28 -0
  29. package/src/v2/headless.ts +23 -1
  30. package/src/v2/hooks/__tests__/use-component.test.tsx +4 -1
  31. package/src/v2/hooks/use-component.tsx +2 -0
  32. package/dist/copilotkit-3XTEoVQO.mjs.map +0 -1
  33. package/dist/copilotkit-Dnj9pi4m.cjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-core",
3
- "version": "1.57.1-canary.1778272612",
3
+ "version": "1.57.2",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -81,11 +81,11 @@
81
81
  "untruncate-json": "^0.0.1",
82
82
  "use-stick-to-bottom": "^1.1.1",
83
83
  "zod-to-json-schema": "^3.24.5",
84
- "@copilotkit/a2ui-renderer": "1.57.1-canary.1778272612",
85
- "@copilotkit/runtime-client-gql": "1.57.1-canary.1778272612",
86
- "@copilotkit/core": "1.57.1-canary.1778272612",
87
- "@copilotkit/shared": "1.57.1-canary.1778272612",
88
- "@copilotkit/web-inspector": "1.57.1-canary.1778272612"
84
+ "@copilotkit/core": "1.57.2",
85
+ "@copilotkit/shared": "1.57.2",
86
+ "@copilotkit/web-inspector": "1.57.2",
87
+ "@copilotkit/runtime-client-gql": "1.57.2",
88
+ "@copilotkit/a2ui-renderer": "1.57.2"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@tailwindcss/cli": "^4.1.11",
@@ -115,6 +115,34 @@ describe("CopilotChat perf — re-render regression", () => {
115
115
  renderCounts.clear();
116
116
  });
117
117
 
118
+ // TanStack Virtual schedules rAF callbacks for measurement. On Node 20 the
119
+ // jsdom timing is different — draining a fixed number of rAF rounds is not
120
+ // enough because the observer keeps scheduling new callbacks. When
121
+ // @testing-library/react's auto-cleanup unmounts the component AFTER our
122
+ // afterEach, any pending rAF fires against a torn-down window (null) and
123
+ // throws: TypeError: Cannot read properties of null ('requestAnimationFrame').
124
+ //
125
+ // Fix: after draining what we can, replace rAF with a no-op so any callback
126
+ // scheduled during (or after) RTL cleanup is silently swallowed. Restore the
127
+ // real rAF at the start of the next test via beforeEach.
128
+ const realRAF = globalThis.requestAnimationFrame;
129
+
130
+ afterEach(async () => {
131
+ // Best-effort drain of already-queued rAF callbacks.
132
+ await act(async () => {
133
+ await new Promise<void>((r) => realRAF(() => r()));
134
+ await new Promise<void>((r) => realRAF(() => r()));
135
+ });
136
+ // Neuter rAF so callbacks scheduled during RTL cleanup are harmless.
137
+ globalThis.requestAnimationFrame = ((_cb: FrameRequestCallback) =>
138
+ 0) as typeof requestAnimationFrame;
139
+ });
140
+
141
+ beforeEach(() => {
142
+ // Restore real rAF for the upcoming test.
143
+ globalThis.requestAnimationFrame = realRAF;
144
+ });
145
+
118
146
  it("completed messages do not re-render when a new message is added", async () => {
119
147
  const agent = new MockStepwiseAgent();
120
148
  renderWithSpy(agent);
@@ -26,7 +26,13 @@ export { useAgent, type UseAgentUpdate } from "./hooks/use-agent";
26
26
  export { useFrontendTool } from "./hooks/use-frontend-tool";
27
27
  export { useComponent } from "./hooks/use-component";
28
28
  export { useHumanInTheLoop } from "./hooks/use-human-in-the-loop";
29
- export { useInterrupt, type UseInterruptConfig } from "./hooks/use-interrupt";
29
+ export {
30
+ useInterrupt,
31
+ type UseInterruptConfig,
32
+ type InterruptEvent,
33
+ type InterruptHandlerProps,
34
+ type InterruptRenderProps,
35
+ } from "./hooks/use-interrupt";
30
36
  export { useSuggestions } from "./hooks/use-suggestions";
31
37
  export { useConfigureSuggestions } from "./hooks/use-configure-suggestions";
32
38
  export {
@@ -40,3 +46,19 @@ export {
40
46
  type UseThreadsInput,
41
47
  type UseThreadsResult,
42
48
  } from "./hooks/use-threads";
49
+
50
+ export {
51
+ useRenderTool,
52
+ type RenderToolProps,
53
+ type RenderToolInProgressProps,
54
+ type RenderToolExecutingProps,
55
+ type RenderToolCompleteProps,
56
+ } from "./hooks/use-render-tool";
57
+ export { defineToolCallRenderer } from "./types/defineToolCallRenderer";
58
+
59
+ // Platform-agnostic types
60
+ export type { ReactFrontendTool } from "./types/frontend-tool";
61
+ export type { ReactHumanInTheLoop } from "./types/human-in-the-loop";
62
+
63
+ // Platform-agnostic capability introspection
64
+ export { useCapabilities } from "./hooks/use-capabilities";
@@ -45,7 +45,7 @@ describe("useComponent", () => {
45
45
  );
46
46
  });
47
47
 
48
- it("appends custom description and forwards parameters, agentId, and deps", () => {
48
+ it("appends custom description and forwards parameters, agentId, deps, and followUp", () => {
49
49
  const weatherSchema = z.object({
50
50
  city: z.string(),
51
51
  unit: z.enum(["c", "f"]),
@@ -65,6 +65,7 @@ describe("useComponent", () => {
65
65
  parameters: weatherSchema,
66
66
  render: DemoComponent,
67
67
  agentId: "weather-agent",
68
+ followUp: false,
68
69
  },
69
70
  deps,
70
71
  );
@@ -79,6 +80,7 @@ describe("useComponent", () => {
79
80
  description: string;
80
81
  parameters: typeof weatherSchema;
81
82
  agentId?: string;
83
+ followUp?: boolean;
82
84
  },
83
85
  ReadonlyArray<unknown>,
84
86
  ];
@@ -91,6 +93,7 @@ describe("useComponent", () => {
91
93
  );
92
94
  expect(toolConfig.parameters).toBe(weatherSchema);
93
95
  expect(toolConfig.agentId).toBe("weather-agent");
96
+ expect(toolConfig.followUp).toBe(false);
94
97
  expect(forwardedDeps).toBe(deps);
95
98
  });
96
99
 
@@ -65,6 +65,7 @@ export function useComponent<
65
65
  parameters?: TSchema;
66
66
  render: ComponentType<NoInfer<InferRenderProps<TSchema>>>;
67
67
  agentId?: string;
68
+ followUp?: boolean;
68
69
  },
69
70
  deps?: ReadonlyArray<unknown>,
70
71
  ): void {
@@ -83,6 +84,7 @@ export function useComponent<
83
84
  return <Component {...(args as InferRenderProps<TSchema>)} />;
84
85
  },
85
86
  agentId: config.agentId,
87
+ followUp: config.followUp,
86
88
  },
87
89
  deps,
88
90
  );