@copilotkitnext/react 0.0.3 → 0.0.4
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/package.json +3 -3
- package/.turbo/turbo-build$colon$css.log +0 -9
- package/.turbo/turbo-build.log +0 -30
- package/.turbo/turbo-check-types.log +0 -7
- package/.turbo/turbo-lint.log +0 -78
- package/.turbo/turbo-test.log +0 -79
- package/postcss.config.js +0 -7
- package/src/__tests__/setup.ts +0 -2
- package/src/components/chat/CopilotChat.tsx +0 -90
- package/src/components/chat/CopilotChatAssistantMessage.tsx +0 -478
- package/src/components/chat/CopilotChatAudioRecorder.tsx +0 -157
- package/src/components/chat/CopilotChatInput.tsx +0 -596
- package/src/components/chat/CopilotChatMessageView.tsx +0 -85
- package/src/components/chat/CopilotChatToolCallsView.tsx +0 -43
- package/src/components/chat/CopilotChatUserMessage.tsx +0 -337
- package/src/components/chat/CopilotChatView.tsx +0 -385
- package/src/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +0 -684
- package/src/components/chat/__tests__/CopilotChatInput.test.tsx +0 -531
- package/src/components/chat/__tests__/setup.ts +0 -1
- package/src/components/chat/index.ts +0 -35
- package/src/components/index.ts +0 -4
- package/src/components/ui/button.tsx +0 -123
- package/src/components/ui/dropdown-menu.tsx +0 -257
- package/src/components/ui/tooltip.tsx +0 -59
- package/src/hooks/index.ts +0 -6
- package/src/hooks/use-agent-context.tsx +0 -17
- package/src/hooks/use-agent.tsx +0 -48
- package/src/hooks/use-frontend-tool.tsx +0 -46
- package/src/hooks/use-human-in-the-loop.tsx +0 -76
- package/src/hooks/use-render-tool-call.tsx +0 -81
- package/src/index.ts +0 -4
- package/src/lib/__tests__/completePartialMarkdown.test.ts +0 -495
- package/src/lib/__tests__/renderSlot.test.tsx +0 -610
- package/src/lib/slots.tsx +0 -55
- package/src/lib/utils.ts +0 -6
- package/src/providers/CopilotChatConfigurationProvider.tsx +0 -81
- package/src/providers/CopilotKitProvider.tsx +0 -269
- package/src/providers/__tests__/CopilotKitProvider.test.tsx +0 -487
- package/src/providers/__tests__/CopilotKitProvider.wildcard.test.tsx +0 -261
- package/src/providers/index.ts +0 -14
- package/src/styles/globals.css +0 -302
- package/src/types/frontend-tool.ts +0 -8
- package/src/types/human-in-the-loop.ts +0 -33
- package/src/types/index.ts +0 -3
- package/src/types/react-tool-call-render.ts +0 -29
- package/tailwind.config.js +0 -9
- package/tsconfig.json +0 -23
- package/tsup.config.ts +0 -19
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { renderHook } from "@testing-library/react";
|
|
3
|
-
import { describe, it, expect, vi } from "vitest";
|
|
4
|
-
import { CopilotKitProvider, useCopilotKit } from "../CopilotKitProvider";
|
|
5
|
-
import { ReactFrontendTool } from "../../types/frontend-tool";
|
|
6
|
-
import { ReactHumanInTheLoop } from "../../types/human-in-the-loop";
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
|
|
9
|
-
describe("CopilotKitProvider - Wildcard Tool", () => {
|
|
10
|
-
describe("Wildcard Frontend Tool", () => {
|
|
11
|
-
it("should register wildcard frontend tool", () => {
|
|
12
|
-
const wildcardHandler = vi.fn();
|
|
13
|
-
const wildcardTool: ReactFrontendTool = {
|
|
14
|
-
name: "*",
|
|
15
|
-
description: "Fallback for undefined tools",
|
|
16
|
-
handler: wildcardHandler,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
20
|
-
wrapper: ({ children }) => (
|
|
21
|
-
<CopilotKitProvider frontendTools={[wildcardTool]}>
|
|
22
|
-
{children}
|
|
23
|
-
</CopilotKitProvider>
|
|
24
|
-
),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
expect(result.current.copilotkit.tools["*"]).toBeDefined();
|
|
28
|
-
expect(result.current.copilotkit.tools["*"]?.name).toBe("*");
|
|
29
|
-
expect(result.current.copilotkit.tools["*"]?.handler).toBe(wildcardHandler);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("should register wildcard alongside specific tools", () => {
|
|
33
|
-
const specificHandler = vi.fn();
|
|
34
|
-
const wildcardHandler = vi.fn();
|
|
35
|
-
|
|
36
|
-
const specificTool: ReactFrontendTool = {
|
|
37
|
-
name: "specific",
|
|
38
|
-
handler: specificHandler,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const wildcardTool: ReactFrontendTool = {
|
|
42
|
-
name: "*",
|
|
43
|
-
handler: wildcardHandler,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
47
|
-
wrapper: ({ children }) => (
|
|
48
|
-
<CopilotKitProvider frontendTools={[specificTool, wildcardTool]}>
|
|
49
|
-
{children}
|
|
50
|
-
</CopilotKitProvider>
|
|
51
|
-
),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
expect(result.current.copilotkit.tools["specific"]).toBeDefined();
|
|
55
|
-
expect(result.current.copilotkit.tools["*"]).toBeDefined();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("should register wildcard with render component", () => {
|
|
59
|
-
const WildcardRender: React.FC<any> = ({ args }) => (
|
|
60
|
-
<div>Unknown tool: {args.toolName}</div>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const wildcardTool: ReactFrontendTool = {
|
|
64
|
-
name: "*",
|
|
65
|
-
description: "Fallback with render",
|
|
66
|
-
parameters: z.object({
|
|
67
|
-
toolName: z.string(),
|
|
68
|
-
args: z.unknown(),
|
|
69
|
-
}),
|
|
70
|
-
render: WildcardRender,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
74
|
-
wrapper: ({ children }) => (
|
|
75
|
-
<CopilotKitProvider frontendTools={[wildcardTool]}>
|
|
76
|
-
{children}
|
|
77
|
-
</CopilotKitProvider>
|
|
78
|
-
),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const wildcardRender = result.current.renderToolCalls.find(rc => rc.name === "*");
|
|
82
|
-
expect(wildcardRender).toBeDefined();
|
|
83
|
-
expect(wildcardRender?.render).toBe(WildcardRender);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should support wildcard with agentId", () => {
|
|
87
|
-
const wildcardHandler = vi.fn();
|
|
88
|
-
const wildcardTool: ReactFrontendTool = {
|
|
89
|
-
name: "*",
|
|
90
|
-
handler: wildcardHandler,
|
|
91
|
-
agentId: "specificAgent",
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
95
|
-
wrapper: ({ children }) => (
|
|
96
|
-
<CopilotKitProvider frontendTools={[wildcardTool]}>
|
|
97
|
-
{children}
|
|
98
|
-
</CopilotKitProvider>
|
|
99
|
-
),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
expect(result.current.copilotkit.tools["*"]?.agentId).toBe("specificAgent");
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe("Wildcard Human-in-the-Loop", () => {
|
|
107
|
-
it("should register wildcard human-in-the-loop tool", () => {
|
|
108
|
-
const WildcardComponent: React.FC<any> = ({ args }) => (
|
|
109
|
-
<div>Unknown interaction: {args.toolName}</div>
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const wildcardHitl: ReactHumanInTheLoop = {
|
|
113
|
-
name: "*",
|
|
114
|
-
description: "Fallback interaction",
|
|
115
|
-
parameters: z.object({
|
|
116
|
-
toolName: z.string(),
|
|
117
|
-
args: z.unknown(),
|
|
118
|
-
}),
|
|
119
|
-
render: WildcardComponent,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
123
|
-
wrapper: ({ children }) => (
|
|
124
|
-
<CopilotKitProvider humanInTheLoop={[wildcardHitl]}>
|
|
125
|
-
{children}
|
|
126
|
-
</CopilotKitProvider>
|
|
127
|
-
),
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
expect(result.current.copilotkit.tools["*"]).toBeDefined();
|
|
131
|
-
const wildcardRender = result.current.renderToolCalls.find(rc => rc.name === "*");
|
|
132
|
-
expect(wildcardRender).toBeDefined();
|
|
133
|
-
expect(wildcardRender?.render).toBe(WildcardComponent);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it("should support wildcard human-in-the-loop with agentId", () => {
|
|
137
|
-
const WildcardComponent: React.FC<any> = () => <div>Wildcard</div>;
|
|
138
|
-
|
|
139
|
-
const wildcardHitl: ReactHumanInTheLoop = {
|
|
140
|
-
name: "*",
|
|
141
|
-
parameters: z.object({
|
|
142
|
-
toolName: z.string(),
|
|
143
|
-
args: z.unknown(),
|
|
144
|
-
}),
|
|
145
|
-
render: WildcardComponent,
|
|
146
|
-
agentId: "agent1",
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
150
|
-
wrapper: ({ children }) => (
|
|
151
|
-
<CopilotKitProvider humanInTheLoop={[wildcardHitl]}>
|
|
152
|
-
{children}
|
|
153
|
-
</CopilotKitProvider>
|
|
154
|
-
),
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
expect(result.current.copilotkit.tools["*"]?.agentId).toBe("agent1");
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
describe("Wildcard Render Tool Calls", () => {
|
|
162
|
-
it("should register wildcard in renderToolCalls", () => {
|
|
163
|
-
const WildcardRender: React.FC<any> = ({ args }) => (
|
|
164
|
-
<div>Fallback render</div>
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const renderToolCalls = [
|
|
168
|
-
{
|
|
169
|
-
name: "*",
|
|
170
|
-
args: z.object({
|
|
171
|
-
toolName: z.string(),
|
|
172
|
-
args: z.unknown(),
|
|
173
|
-
}),
|
|
174
|
-
render: WildcardRender,
|
|
175
|
-
},
|
|
176
|
-
];
|
|
177
|
-
|
|
178
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
179
|
-
wrapper: ({ children }) => (
|
|
180
|
-
<CopilotKitProvider renderToolCalls={renderToolCalls}>
|
|
181
|
-
{children}
|
|
182
|
-
</CopilotKitProvider>
|
|
183
|
-
),
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const wildcardRender = result.current.renderToolCalls.find(rc => rc.name === "*");
|
|
187
|
-
expect(wildcardRender).toBeDefined();
|
|
188
|
-
expect(wildcardRender?.render).toBe(WildcardRender);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it("should support wildcard render with agentId", () => {
|
|
192
|
-
const WildcardRender: React.FC<any> = () => <div>Agent wildcard</div>;
|
|
193
|
-
|
|
194
|
-
const renderToolCalls = [
|
|
195
|
-
{
|
|
196
|
-
name: "*",
|
|
197
|
-
args: z.object({
|
|
198
|
-
toolName: z.string(),
|
|
199
|
-
args: z.unknown(),
|
|
200
|
-
}),
|
|
201
|
-
render: WildcardRender,
|
|
202
|
-
agentId: "agent1",
|
|
203
|
-
},
|
|
204
|
-
];
|
|
205
|
-
|
|
206
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
207
|
-
wrapper: ({ children }) => (
|
|
208
|
-
<CopilotKitProvider renderToolCalls={renderToolCalls}>
|
|
209
|
-
{children}
|
|
210
|
-
</CopilotKitProvider>
|
|
211
|
-
),
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
const wildcardRender = result.current.renderToolCalls.find(rc => rc.name === "*");
|
|
215
|
-
expect(wildcardRender?.agentId).toBe("agent1");
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
describe("Combined wildcard and specific tools", () => {
|
|
220
|
-
it("should handle both wildcard and specific tools together", () => {
|
|
221
|
-
const SpecificRender: React.FC<any> = () => <div>Specific</div>;
|
|
222
|
-
const WildcardRender: React.FC<any> = () => <div>Wildcard</div>;
|
|
223
|
-
|
|
224
|
-
const frontendTools: ReactFrontendTool[] = [
|
|
225
|
-
{
|
|
226
|
-
name: "specificTool",
|
|
227
|
-
handler: vi.fn(),
|
|
228
|
-
parameters: z.object({ value: z.string() }),
|
|
229
|
-
render: SpecificRender,
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "*",
|
|
233
|
-
handler: vi.fn(),
|
|
234
|
-
parameters: z.object({
|
|
235
|
-
toolName: z.string(),
|
|
236
|
-
args: z.unknown(),
|
|
237
|
-
}),
|
|
238
|
-
render: WildcardRender,
|
|
239
|
-
},
|
|
240
|
-
];
|
|
241
|
-
|
|
242
|
-
const { result } = renderHook(() => useCopilotKit(), {
|
|
243
|
-
wrapper: ({ children }) => (
|
|
244
|
-
<CopilotKitProvider frontendTools={frontendTools}>
|
|
245
|
-
{children}
|
|
246
|
-
</CopilotKitProvider>
|
|
247
|
-
),
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// Both tools should be registered
|
|
251
|
-
expect(result.current.copilotkit.tools["specificTool"]).toBeDefined();
|
|
252
|
-
expect(result.current.copilotkit.tools["*"]).toBeDefined();
|
|
253
|
-
|
|
254
|
-
// Both renders should be registered
|
|
255
|
-
const specificToolRender = result.current.renderToolCalls.find(rc => rc.name === "specificTool");
|
|
256
|
-
const wildcardRender = result.current.renderToolCalls.find(rc => rc.name === "*");
|
|
257
|
-
expect(specificToolRender).toBeDefined();
|
|
258
|
-
expect(wildcardRender).toBeDefined();
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
});
|
package/src/providers/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
CopilotChatConfigurationProvider,
|
|
3
|
-
useCopilotChatConfiguration,
|
|
4
|
-
type CopilotChatLabels,
|
|
5
|
-
type CopilotChatConfigurationValue,
|
|
6
|
-
type CopilotChatConfigurationProviderProps,
|
|
7
|
-
} from "./CopilotChatConfigurationProvider";
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
CopilotKitProvider,
|
|
11
|
-
useCopilotKit,
|
|
12
|
-
type CopilotKitProviderProps,
|
|
13
|
-
type CopilotKitContextValue,
|
|
14
|
-
} from "./CopilotKitProvider";
|
package/src/styles/globals.css
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@plugin "@tailwindcss/typography";
|
|
3
|
-
@source "../../../apps/**/*.{ts,tsx}";
|
|
4
|
-
@source "../../../components/**/*.{ts,tsx}";
|
|
5
|
-
@source "../**/*.{ts,tsx}";
|
|
6
|
-
|
|
7
|
-
@import "tw-animate-css";
|
|
8
|
-
|
|
9
|
-
@custom-variant dark (&:is(.dark *));
|
|
10
|
-
|
|
11
|
-
:root {
|
|
12
|
-
--background: oklch(1 0 0);
|
|
13
|
-
--foreground: oklch(0.145 0 0);
|
|
14
|
-
--card: oklch(1 0 0);
|
|
15
|
-
--card-foreground: oklch(0.145 0 0);
|
|
16
|
-
--popover: oklch(1 0 0);
|
|
17
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
18
|
-
--primary: oklch(0.205 0 0);
|
|
19
|
-
--primary-foreground: oklch(0.985 0 0);
|
|
20
|
-
--secondary: oklch(0.97 0 0);
|
|
21
|
-
--secondary-foreground: oklch(0.205 0 0);
|
|
22
|
-
--muted: oklch(0.97 0 0);
|
|
23
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
24
|
-
--accent: oklch(0.97 0 0);
|
|
25
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
26
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
27
|
-
--destructive-foreground: oklch(0.577 0.245 27.325);
|
|
28
|
-
--border: oklch(0.922 0 0);
|
|
29
|
-
--input: oklch(0.922 0 0);
|
|
30
|
-
--ring: oklch(0.708 0 0);
|
|
31
|
-
--chart-1: oklch(0.646 0.222 41.116);
|
|
32
|
-
--chart-2: oklch(0.6 0.118 184.704);
|
|
33
|
-
--chart-3: oklch(0.398 0.07 227.392);
|
|
34
|
-
--chart-4: oklch(0.828 0.189 84.429);
|
|
35
|
-
--chart-5: oklch(0.769 0.188 70.08);
|
|
36
|
-
--radius: 0.625rem;
|
|
37
|
-
--sidebar: oklch(0.985 0 0);
|
|
38
|
-
--sidebar-foreground: oklch(0.145 0 0);
|
|
39
|
-
--sidebar-primary: oklch(0.205 0 0);
|
|
40
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
41
|
-
--sidebar-accent: oklch(0.97 0 0);
|
|
42
|
-
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
43
|
-
--sidebar-border: oklch(0.922 0 0);
|
|
44
|
-
--sidebar-ring: oklch(0.708 0 0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.dark {
|
|
48
|
-
--background: oklch(0.145 0 0);
|
|
49
|
-
--foreground: oklch(0.985 0 0);
|
|
50
|
-
--card: oklch(0.145 0 0);
|
|
51
|
-
--card-foreground: oklch(0.985 0 0);
|
|
52
|
-
--popover: oklch(0.145 0 0);
|
|
53
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
54
|
-
--primary: oklch(0.985 0 0);
|
|
55
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
56
|
-
--secondary: oklch(0.269 0 0);
|
|
57
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
58
|
-
--muted: oklch(0.269 0 0);
|
|
59
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
60
|
-
--accent: oklch(0.269 0 0);
|
|
61
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
62
|
-
--destructive: oklch(0.396 0.141 25.723);
|
|
63
|
-
--destructive-foreground: oklch(0.637 0.237 25.331);
|
|
64
|
-
--border: oklch(0.269 0 0);
|
|
65
|
-
--input: oklch(0.269 0 0);
|
|
66
|
-
--ring: oklch(0.556 0 0);
|
|
67
|
-
--chart-1: oklch(0.488 0.243 264.376);
|
|
68
|
-
--chart-2: oklch(0.696 0.17 162.48);
|
|
69
|
-
--chart-3: oklch(0.769 0.188 70.08);
|
|
70
|
-
--chart-4: oklch(0.627 0.265 303.9);
|
|
71
|
-
--chart-5: oklch(0.645 0.246 16.439);
|
|
72
|
-
--sidebar: oklch(0.205 0 0);
|
|
73
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
74
|
-
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
75
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
76
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
77
|
-
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
78
|
-
--sidebar-border: oklch(0.269 0 0);
|
|
79
|
-
--sidebar-ring: oklch(0.439 0 0);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@theme inline {
|
|
83
|
-
--color-background: var(--background);
|
|
84
|
-
--color-foreground: var(--foreground);
|
|
85
|
-
--color-card: var(--card);
|
|
86
|
-
--color-card-foreground: var(--card-foreground);
|
|
87
|
-
--color-popover: var(--popover);
|
|
88
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
89
|
-
--color-primary: var(--primary);
|
|
90
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
91
|
-
--color-secondary: var(--secondary);
|
|
92
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
93
|
-
--color-muted: var(--muted);
|
|
94
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
95
|
-
--color-accent: var(--accent);
|
|
96
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
97
|
-
--color-destructive: var(--destructive);
|
|
98
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
99
|
-
--color-border: var(--border);
|
|
100
|
-
--color-input: var(--input);
|
|
101
|
-
--color-ring: var(--ring);
|
|
102
|
-
--color-chart-1: var(--chart-1);
|
|
103
|
-
--color-chart-2: var(--chart-2);
|
|
104
|
-
--color-chart-3: var(--chart-3);
|
|
105
|
-
--color-chart-4: var(--chart-4);
|
|
106
|
-
--color-chart-5: var(--chart-5);
|
|
107
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
108
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
109
|
-
--radius-lg: var(--radius);
|
|
110
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
111
|
-
--color-sidebar: var(--sidebar);
|
|
112
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
113
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
114
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
115
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
116
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
117
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
118
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@theme {
|
|
122
|
-
--animate-pulse-cursor: pulse-cursor 0.9s cubic-bezier(0.4, 0, 0.2, 1)
|
|
123
|
-
infinite;
|
|
124
|
-
@keyframes pulse-cursor {
|
|
125
|
-
0%,
|
|
126
|
-
100% {
|
|
127
|
-
transform: scale(1);
|
|
128
|
-
opacity: 1;
|
|
129
|
-
}
|
|
130
|
-
50% {
|
|
131
|
-
transform: scale(1.5);
|
|
132
|
-
opacity: 0.8;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@layer base {
|
|
138
|
-
* {
|
|
139
|
-
@apply border-border outline-ring/50;
|
|
140
|
-
}
|
|
141
|
-
body {
|
|
142
|
-
@apply bg-background text-foreground;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
figure[data-rehype-pretty-code-figure] {
|
|
147
|
-
background-color: rgb(249, 249, 249);
|
|
148
|
-
margin-top: 8px;
|
|
149
|
-
margin-bottom: 0px;
|
|
150
|
-
margin-left: 0px;
|
|
151
|
-
margin-right: 0px;
|
|
152
|
-
@apply rounded-2xl;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
figure[data-rehype-pretty-code-figure] pre {
|
|
156
|
-
background-color: rgb(249, 249, 249);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
html .prose code,
|
|
160
|
-
html .prose code span {
|
|
161
|
-
color: var(--shiki-light) !important;
|
|
162
|
-
background-color: rgb(249, 249, 249) !important;
|
|
163
|
-
/* Optional, if you also want font styles */
|
|
164
|
-
font-style: var(--shiki-light-font-style) !important;
|
|
165
|
-
font-weight: var(--shiki-light-font-weight) !important;
|
|
166
|
-
text-decoration: var(--shiki-light-text-decoration) !important;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
html.dark figure[data-rehype-pretty-code-figure],
|
|
170
|
-
html.dark figure[data-rehype-pretty-code-figure] pre {
|
|
171
|
-
background-color: #171717;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
html.dark .prose code,
|
|
175
|
-
html.dark .prose code span {
|
|
176
|
-
color: var(--shiki-dark) !important;
|
|
177
|
-
background-color: #171717 !important;
|
|
178
|
-
font-style: var(--shiki-dark-font-style) !important;
|
|
179
|
-
font-weight: var(--shiki-dark-font-weight) !important;
|
|
180
|
-
text-decoration: var(--shiki-dark-text-decoration) !important;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.prose {
|
|
184
|
-
-webkit-font-smoothing: antialiased;
|
|
185
|
-
-moz-osx-font-smoothing: grayscale;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.prose
|
|
189
|
-
:where(code):not(
|
|
190
|
-
:where([class~="not-prose"], [class~="not-prose"] *)
|
|
191
|
-
)::before {
|
|
192
|
-
content: none;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.prose
|
|
196
|
-
:where(code):not(
|
|
197
|
-
:where([class~="not-prose"], [class~="not-prose"] *)
|
|
198
|
-
)::after {
|
|
199
|
-
content: none;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
|
|
203
|
-
font-weight: 400;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.prose h1 {
|
|
207
|
-
margin-block-end: 8px;
|
|
208
|
-
margin-bottom: 8px;
|
|
209
|
-
font-size: 24px;
|
|
210
|
-
font-weight: 600;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.prose h2 {
|
|
214
|
-
margin-block-end: 4px;
|
|
215
|
-
margin-block-start: 16px;
|
|
216
|
-
margin-top: 16px;
|
|
217
|
-
margin-bottom: 4px;
|
|
218
|
-
font-size: 20px;
|
|
219
|
-
font-weight: 600;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.prose h3 {
|
|
223
|
-
margin-block-end: 4px;
|
|
224
|
-
margin-block-start: 16px;
|
|
225
|
-
margin-top: 16px;
|
|
226
|
-
margin-bottom: 4px;
|
|
227
|
-
font-size: 18px;
|
|
228
|
-
font-weight: 600;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.prose p {
|
|
232
|
-
margin-block-start: 8px;
|
|
233
|
-
margin-block-end: 4px;
|
|
234
|
-
margin-top: 4px;
|
|
235
|
-
margin-bottom: 8px;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.prose a {
|
|
239
|
-
color: #2964aa;
|
|
240
|
-
text-decoration: none;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.prose a:hover {
|
|
244
|
-
color: #749ac8;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.prose
|
|
248
|
-
:where(blockquote p:first-of-type):not(
|
|
249
|
-
:where([class~="not-prose"], [class~="not-prose"] *)
|
|
250
|
-
)::before {
|
|
251
|
-
content: none;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.prose blockquote {
|
|
255
|
-
font-style: normal;
|
|
256
|
-
font-weight: 400;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.prose input[type="checkbox"] {
|
|
260
|
-
appearance: none;
|
|
261
|
-
background-color: #fff;
|
|
262
|
-
background-origin: border-box;
|
|
263
|
-
border-color: #9b9b9b;
|
|
264
|
-
border-width: 1px;
|
|
265
|
-
color: #004f99;
|
|
266
|
-
display: inline-block;
|
|
267
|
-
flex-shrink: 0;
|
|
268
|
-
height: 1rem;
|
|
269
|
-
padding: 0;
|
|
270
|
-
-webkit-print-color-adjust: exact;
|
|
271
|
-
print-color-adjust: exact;
|
|
272
|
-
-webkit-user-select: none;
|
|
273
|
-
user-select: none;
|
|
274
|
-
vertical-align: middle;
|
|
275
|
-
width: 1rem;
|
|
276
|
-
border-radius: 2px;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.prose input[type="checkbox"]:checked {
|
|
280
|
-
background-color: #004f99;
|
|
281
|
-
border-color: #004f99;
|
|
282
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");
|
|
283
|
-
background-position: center;
|
|
284
|
-
background-repeat: no-repeat;
|
|
285
|
-
background-size: 100% 100%;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.prose em {
|
|
289
|
-
@apply text-foreground;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.prose hr {
|
|
293
|
-
margin-block-start: 0px;
|
|
294
|
-
margin-block-end: 0px;
|
|
295
|
-
margin-top: 28px;
|
|
296
|
-
margin-bottom: 28px;
|
|
297
|
-
color: rgb(13, 13, 13);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.prose td {
|
|
301
|
-
@apply text-foreground;
|
|
302
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FrontendTool } from "@copilotkitnext/core";
|
|
2
|
-
import { ReactToolCallRender } from "./react-tool-call-render";
|
|
3
|
-
|
|
4
|
-
export type ReactFrontendTool<
|
|
5
|
-
T extends Record<string, unknown> = Record<string, unknown>,
|
|
6
|
-
> = FrontendTool<T> & {
|
|
7
|
-
render?: ReactToolCallRender<T>["render"];
|
|
8
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { FrontendTool, ToolCallStatus } from "@copilotkitnext/core";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
export type ReactHumanInTheLoop<
|
|
5
|
-
T extends Record<string, unknown> = Record<string, unknown>,
|
|
6
|
-
> = Omit<FrontendTool<T>, "handler"> & {
|
|
7
|
-
render: React.ComponentType<
|
|
8
|
-
| {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
args: Partial<T>;
|
|
12
|
-
status: ToolCallStatus.InProgress;
|
|
13
|
-
result: undefined;
|
|
14
|
-
respond: undefined;
|
|
15
|
-
}
|
|
16
|
-
| {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
args: T;
|
|
20
|
-
status: ToolCallStatus.Executing;
|
|
21
|
-
result: undefined;
|
|
22
|
-
respond: (result: unknown) => Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
| {
|
|
25
|
-
name: string;
|
|
26
|
-
description: string;
|
|
27
|
-
args: T;
|
|
28
|
-
status: ToolCallStatus.Complete;
|
|
29
|
-
result: string;
|
|
30
|
-
respond: undefined;
|
|
31
|
-
}
|
|
32
|
-
>;
|
|
33
|
-
};
|
package/src/types/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { ToolCallStatus } from "@copilotkitnext/core";
|
|
3
|
-
|
|
4
|
-
export interface ReactToolCallRender<T> {
|
|
5
|
-
name: string;
|
|
6
|
-
args: z.ZodSchema<T>;
|
|
7
|
-
/**
|
|
8
|
-
* Optional agent ID to constrain this tool render to a specific agent.
|
|
9
|
-
* If specified, this render will only be used for the specified agent.
|
|
10
|
-
*/
|
|
11
|
-
agentId?: string;
|
|
12
|
-
render: React.ComponentType<
|
|
13
|
-
| {
|
|
14
|
-
args: Partial<T>;
|
|
15
|
-
status: ToolCallStatus.InProgress;
|
|
16
|
-
result: undefined;
|
|
17
|
-
}
|
|
18
|
-
| {
|
|
19
|
-
args: T;
|
|
20
|
-
status: ToolCallStatus.Executing;
|
|
21
|
-
result: undefined;
|
|
22
|
-
}
|
|
23
|
-
| {
|
|
24
|
-
args: T;
|
|
25
|
-
status: ToolCallStatus.Complete;
|
|
26
|
-
result: string;
|
|
27
|
-
}
|
|
28
|
-
>;
|
|
29
|
-
}
|
package/tailwind.config.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "@copilotkitnext/typescript-config/react-library.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"baseUrl": ".",
|
|
8
|
-
"paths": {
|
|
9
|
-
"@/*": ["./src/*"],
|
|
10
|
-
"@copilotkitnext/core": [
|
|
11
|
-
"../core/dist/index.d.ts",
|
|
12
|
-
"../core/src/index.ts"
|
|
13
|
-
],
|
|
14
|
-
"@copilotkitnext/shared": [
|
|
15
|
-
"../shared/dist/index.d.ts",
|
|
16
|
-
"../shared/src/index.ts"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"types": ["vitest/globals"]
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*"],
|
|
22
|
-
"exclude": ["dist", "node_modules"]
|
|
23
|
-
}
|