Skip to content

Commit fc74be5

Browse files
authored
0.0.40 (#632)
1 parent 5b90d3d commit fc74be5

File tree

129 files changed

+10462
-2054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+10462
-2054
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ node_modules
1313
.vscode
1414

1515
**/mastra.db*
16+
17+
.pnpm-store
18+
19+
**/.poetry-cache

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pnpm dev
1919
# Run linting
2020
pnpm lint
2121

22+
2223
# Run type checking
2324
pnpm check-types
2425

apps/dojo/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"run-everything": "./scripts/prep-dojo-everything.js && ./scripts/run-dojo-everything.js"
1313
},
1414
"dependencies": {
15+
"@a2a-js/sdk": "0.2.5",
16+
"@ag-ui/a2a": "workspace:*",
1517
"@ag-ui/a2a-middleware": "workspace:*",
1618
"@ag-ui/adk": "workspace:*",
1719
"@ag-ui/agno": "workspace:*",
@@ -20,17 +22,20 @@
2022
"@ag-ui/llamaindex": "workspace:*",
2123
"@ag-ui/mastra": "workspace:*",
2224
"@ag-ui/middleware-starter": "workspace:*",
23-
"@ag-ui/spring-ai": "workspace:*",
2425
"@ag-ui/pydantic-ai": "workspace:*",
2526
"@ag-ui/server-starter": "workspace:*",
2627
"@ag-ui/server-starter-all-features": "workspace:*",
28+
"@ag-ui/spring-ai": "workspace:*",
2729
"@ag-ui/vercel-ai-sdk": "workspace:*",
2830
"@ai-sdk/openai": "^2.0.42",
2931
"@copilotkit/react-core": "1.10.6",
3032
"@copilotkit/react-ui": "1.10.6",
3133
"@copilotkit/runtime": "1.10.6",
3234
"@copilotkit/runtime-client-gql": "1.10.6",
3335
"@copilotkit/shared": "1.10.6",
36+
"@copilotkitnext/react": "0.0.19-alpha.0",
37+
"@copilotkitnext/runtime": "0.0.19-alpha.0",
38+
"@copilotkitnext/agent": "0.0.19-alpha.0",
3439
"@mastra/client-js": "^0.15.2",
3540
"@mastra/core": "^0.20.2",
3641
"@mastra/dynamodb": "^0.15.6",
@@ -58,6 +63,7 @@
5863
"diff": "^7.0.0",
5964
"embla-carousel-react": "^8.6.0",
6065
"fast-json-patch": "^3.1.1",
66+
"hono": "^4.10.3",
6167
"lucide-react": "^0.477.0",
6268
"markdown-it": "^14.1.0",
6369
"markdown-it-ins": "^4.0.0",

apps/dojo/src/agents.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import getEnvVars from "./env";
1616
import { mastra } from "./mastra";
1717
import { PydanticAIAgent } from "@ag-ui/pydantic-ai";
1818
import { ADKAgent } from "@ag-ui/adk";
19-
import { SpringAiAgent } from '@ag-ui/spring-ai';
19+
import { SpringAiAgent } from "@ag-ui/spring-ai";
2020
import { HttpAgent } from "@ag-ui/client";
2121
import { A2AMiddlewareAgent } from "@ag-ui/a2a-middleware";
22+
import { A2AAgent } from "@ag-ui/a2a";
23+
import { A2AClient } from "@a2a-js/sdk/client";
2224

2325
const envVars = getEnvVars();
2426
export const agentsIntegrations: AgentIntegrationConfig[] = [
@@ -81,7 +83,9 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
8183
backend_tool_rendering: new ADKAgent({
8284
url: `${envVars.adkMiddlewareUrl}/backend_tool_rendering`,
8385
}),
84-
shared_state: new ADKAgent({ url: `${envVars.adkMiddlewareUrl}/adk-shared-state-agent` }),
86+
shared_state: new ADKAgent({
87+
url: `${envVars.adkMiddlewareUrl}/adk-shared-state-agent`,
88+
}),
8589
// predictive_state_updates: new ADKAgent({ url: `${envVars.adkMiddlewareUrl}/adk-predictive-state-agent` }),
8690
};
8791
},
@@ -273,26 +277,26 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
273277
},
274278
},
275279
{
276-
id: 'spring-ai',
280+
id: "spring-ai",
277281
agents: async () => {
278282
return {
279283
agentic_chat: new SpringAiAgent({
280-
url: `${envVars.springAiUrl}/agentic_chat/agui`
284+
url: `${envVars.springAiUrl}/agentic_chat/agui`,
281285
}),
282286
shared_state: new SpringAiAgent({
283-
url: `${envVars.springAiUrl}/shared_state/agui`
287+
url: `${envVars.springAiUrl}/shared_state/agui`,
284288
}),
285289
tool_based_generative_ui: new SpringAiAgent({
286-
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`
290+
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`,
287291
}),
288292
human_in_the_loop: new SpringAiAgent({
289-
url: `${envVars.springAiUrl}/human_in_the_loop/agui`
293+
url: `${envVars.springAiUrl}/human_in_the_loop/agui`,
290294
}),
291295
agentic_generative_ui: new SpringAiAgent({
292-
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`
293-
})
294-
}
295-
}
296+
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`,
297+
}),
298+
};
299+
},
296300
},
297301
{
298302
id: "llama-index",
@@ -341,6 +345,19 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
341345
};
342346
},
343347
},
348+
{
349+
id: "a2a-basic",
350+
agents: async () => {
351+
const a2aClient = new A2AClient(envVars.a2aUrl);
352+
return {
353+
agentic_chat: new A2AAgent({
354+
description: "Direct A2A agent",
355+
a2aClient,
356+
debug: process.env.NODE_ENV !== "production",
357+
}),
358+
};
359+
},
360+
},
344361
{
345362
id: "a2a",
346363
agents: async () => {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"use client";
2+
3+
import React from "react";
4+
import "@copilotkitnext/react/styles.css";
5+
import { CopilotChat, CopilotKitProvider } from "@copilotkitnext/react";
6+
7+
export const dynamic = "force-dynamic";
8+
9+
interface PageProps {
10+
params: Promise<{
11+
integrationId: string;
12+
}>;
13+
}
14+
15+
export default function Page({ params }: PageProps) {
16+
const { integrationId } = React.use(params);
17+
18+
return (
19+
<CopilotKitProvider
20+
runtimeUrl={`/api/copilotkitnext/${integrationId}`}
21+
showDevConsole="auto"
22+
>
23+
<main
24+
className="flex min-h-screen flex-1 flex-col overflow-hidden"
25+
style={{ minHeight: "100dvh" }}
26+
>
27+
<Chat threadId={`${integrationId}-vnext_chat`} />
28+
</main>
29+
</CopilotKitProvider>
30+
);
31+
}
32+
33+
function Chat({ threadId }: { threadId: string }) {
34+
return (
35+
<div className="flex flex-1 flex-col overflow-hidden">
36+
<CopilotChat style={{ flex: 1, minHeight: "100%" }} threadId={threadId} />
37+
</div>
38+
);
39+
}

apps/dojo/src/app/api/copilotkit/[integrationId]/route.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ import {
33
ExperimentalEmptyAdapter,
44
copilotRuntimeNextJSAppRouterEndpoint,
55
} from "@copilotkit/runtime";
6-
import { agentsIntegrations } from "@/agents";
7-
86
import { NextRequest } from "next/server";
97

8+
import { agentsIntegrations } from "@/agents";
9+
1010
export async function POST(request: NextRequest) {
1111
const integrationId = request.url.split("/").pop();
1212

1313
const integration = agentsIntegrations.find((i) => i.id === integrationId);
1414
if (!integration) {
1515
return new Response("Integration not found", { status: 404 });
1616
}
17+
1718
const agents = await integration.agents();
1819
const runtime = new CopilotRuntime({
1920
// @ts-ignore for now
@@ -27,3 +28,4 @@ export async function POST(request: NextRequest) {
2728

2829
return handleRequest(request);
2930
}
31+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {
2+
CopilotRuntime,
3+
InMemoryAgentRunner,
4+
createCopilotEndpoint,
5+
} from "@copilotkitnext/runtime";
6+
import { handle } from "hono/vercel";
7+
8+
const runtime = new CopilotRuntime({
9+
agents: {
10+
default: null as any,
11+
},
12+
runner: new InMemoryAgentRunner(),
13+
});
14+
15+
const app = createCopilotEndpoint({
16+
runtime,
17+
basePath: "/api/copilotkit",
18+
});
19+
20+
export const GET = handle(app);
21+
export const POST = handle(app);
22+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import {
2+
CopilotRuntime,
3+
InMemoryAgentRunner,
4+
createCopilotEndpoint,
5+
} from "@copilotkitnext/runtime";
6+
import { handle } from "hono/vercel";
7+
import type { NextRequest } from "next/server";
8+
import { BasicAgent } from "@copilotkitnext/agent";
9+
import type { AbstractAgent } from "@ag-ui/client";
10+
11+
type RouteParams = {
12+
params: Promise<{
13+
integrationId: string;
14+
slug?: string[];
15+
}>;
16+
};
17+
18+
const handlerCache = new Map<string, ReturnType<typeof handle>>();
19+
20+
function getHandler(integrationId: string) {
21+
const cached = handlerCache.get(integrationId);
22+
if (cached) {
23+
return cached;
24+
}
25+
26+
const defaultAgent = new BasicAgent({
27+
model: "openai/gpt-4o",
28+
}) as unknown as AbstractAgent; // Cast until upstream marks run() public.
29+
30+
const runtime = new CopilotRuntime({
31+
agents: {
32+
default: defaultAgent,
33+
},
34+
runner: new InMemoryAgentRunner(),
35+
});
36+
37+
const app = createCopilotEndpoint({
38+
runtime,
39+
basePath: `/api/copilotkitnext/${integrationId}`,
40+
});
41+
42+
const handler = handle(app);
43+
handlerCache.set(integrationId, handler);
44+
return handler;
45+
}
46+
47+
export async function GET(request: NextRequest, context: RouteParams) {
48+
const { integrationId } = await context.params;
49+
const handler = getHandler(integrationId);
50+
return handler(request);
51+
}
52+
53+
export async function POST(request: NextRequest, context: RouteParams) {
54+
const { integrationId } = await context.params;
55+
const handler = getHandler(integrationId);
56+
return handler(request);
57+
}

apps/dojo/src/config.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ export const featureConfig: FeatureConfig[] = [
3232
createFeatureConfig({
3333
id: "human_in_the_loop",
3434
name: "Human in the loop",
35-
description: "Plan a task together and direct the Copilot to take the right steps",
35+
description:
36+
"Plan a task together and direct the Copilot to take the right steps",
3637
tags: ["HITL", "Interactivity"],
3738
}),
3839
createFeatureConfig({
3940
id: "agentic_generative_ui",
4041
name: "Agentic Generative UI",
41-
description: "Assign a long running task to your Copilot and see how it performs!",
42+
description:
43+
"Assign a long running task to your Copilot and see how it performs!",
4244
tags: ["Generative ui (agent)", "Long running task"],
4345
}),
4446
createFeatureConfig({
@@ -56,7 +58,8 @@ export const featureConfig: FeatureConfig[] = [
5658
createFeatureConfig({
5759
id: "predictive_state_updates",
5860
name: "Predictive State Updates",
59-
description: "Use collaboration to edit a document in real time with your Copilot",
61+
description:
62+
"Use collaboration to edit a document in real time with your Copilot",
6063
tags: ["State", "Streaming", "Tools"],
6164
}),
6265
createFeatureConfig({
@@ -68,7 +71,8 @@ export const featureConfig: FeatureConfig[] = [
6871
createFeatureConfig({
6972
id: "subgraphs",
7073
name: "Subgraphs",
71-
description: "Have your tasks performed by multiple agents, working together",
74+
description:
75+
"Have your tasks performed by multiple agents, working together",
7276
tags: ["Chat", "Multi-agent architecture", "Streaming", "Subgraphs"],
7377
}),
7478
createFeatureConfig({
@@ -77,6 +81,12 @@ export const featureConfig: FeatureConfig[] = [
7781
description: "Chat with your Copilot and call frontend tools",
7882
tags: ["Chat", "Tools", "Streaming"],
7983
}),
84+
createFeatureConfig({
85+
id: "vnext_chat",
86+
name: "VNext Chat",
87+
description: "Chat based on CopilotKit vnext",
88+
tags: ["Chat", "VNext", "Streaming"],
89+
}),
8090
];
8191

8292
export default featureConfig;

apps/dojo/src/env.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type envVars = {
1111
crewAiUrl: string;
1212
pydanticAIUrl: string;
1313
adkMiddlewareUrl: string;
14+
a2aUrl: string;
1415
a2aMiddlewareBuildingsManagementUrl: string;
1516
a2aMiddlewareFinanceUrl: string;
1617
a2aMiddlewareItUrl: string;
@@ -40,10 +41,11 @@ export default function getEnvVars(): envVars {
4041
pydanticAIUrl: process.env.PYDANTIC_AI_URL || 'http://localhost:9000',
4142
adkMiddlewareUrl: process.env.ADK_MIDDLEWARE_URL || 'http://localhost:8000',
4243
springAiUrl: process.env.SPRING_AI_URL || 'http://localhost:8080',
44+
a2aUrl: process.env.A2A_URL || 'http://localhost:10002',
4345
a2aMiddlewareBuildingsManagementUrl: process.env.A2A_MIDDLEWARE_BUILDINGS_MANAGEMENT_URL || 'http://localhost:9001',
4446
a2aMiddlewareFinanceUrl: process.env.A2A_MIDDLEWARE_FINANCE_URL || 'http://localhost:9002',
4547
a2aMiddlewareItUrl: process.env.A2A_MIDDLEWARE_IT_URL || 'http://localhost:9003',
4648
a2aMiddlewareOrchestratorUrl: process.env.A2A_MIDDLEWARE_ORCHESTRATOR_URL || 'http://localhost:9000',
4749
customDomainTitle: customDomainTitle,
4850
}
49-
}
51+
}

0 commit comments

Comments
 (0)