@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.
- package/dist/{copilotkit-CBbSvze0.d.cts → copilotkit-BK9CVq9A.d.cts} +2 -1
- package/dist/{copilotkit-CBbSvze0.d.cts.map → copilotkit-BK9CVq9A.d.cts.map} +1 -1
- package/dist/{copilotkit-3XTEoVQO.mjs → copilotkit-CC8DjOiC.mjs} +3 -2
- package/dist/copilotkit-CC8DjOiC.mjs.map +1 -0
- package/dist/{copilotkit-Dnj9pi4m.cjs → copilotkit-CtXcs1ea.cjs} +3 -2
- package/dist/copilotkit-CtXcs1ea.cjs.map +1 -0
- package/dist/{copilotkit-BCJ2yvV6.d.mts → copilotkit-WlmeVijs.d.mts} +2 -1
- package/dist/{copilotkit-BCJ2yvV6.d.mts.map → copilotkit-WlmeVijs.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/v2/headless.cjs +110 -3
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +142 -2
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +142 -1
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +108 -4
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +2 -1
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +28 -0
- package/src/v2/headless.ts +23 -1
- package/src/v2/hooks/__tests__/use-component.test.tsx +4 -1
- package/src/v2/hooks/use-component.tsx +2 -0
- package/dist/copilotkit-3XTEoVQO.mjs.map +0 -1
- 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.
|
|
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/
|
|
85
|
-
"@copilotkit/
|
|
86
|
-
"@copilotkit/
|
|
87
|
-
"@copilotkit/
|
|
88
|
-
"@copilotkit/
|
|
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);
|
package/src/v2/headless.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
);
|