Skip to content

Commit 372320b

Browse files
Alex HolmbergAlex Holmberg
authored andcommitted
feat(23-01): create CopilotKit provider wrapper
- CopilotKitWrapper component configures CopilotKit - Uses VITE_AGENT_URL env var for endpoint (default localhost:9090) - Ready to wrap app for AG-UI server connectivity
1 parent e8a9c89 commit 372320b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* CopilotKit Provider Wrapper
3+
*
4+
* Configures CopilotKit to connect to the syncable-cli AG-UI server.
5+
* The agent endpoint can be customized via VITE_AGENT_URL environment variable.
6+
*/
7+
import { CopilotKit } from "@copilotkit/react-core";
8+
import { ReactNode } from "react";
9+
10+
/**
11+
* AG-UI server endpoint.
12+
* Default: http://localhost:9090 (local development)
13+
* Override with VITE_AGENT_URL environment variable.
14+
*/
15+
const AGENT_URL = import.meta.env.VITE_AGENT_URL || "http://localhost:9090";
16+
17+
interface CopilotKitWrapperProps {
18+
children: ReactNode;
19+
}
20+
21+
/**
22+
* Wraps the application with CopilotKit provider configured for AG-UI server.
23+
*
24+
* Usage:
25+
* ```tsx
26+
* <CopilotKitWrapper>
27+
* <App />
28+
* </CopilotKitWrapper>
29+
* ```
30+
*/
31+
export function CopilotKitWrapper({ children }: CopilotKitWrapperProps) {
32+
return (
33+
<CopilotKit runtimeUrl={AGENT_URL}>
34+
{children}
35+
</CopilotKit>
36+
);
37+
}

0 commit comments

Comments
 (0)