Skip to content

Commit 5566c31

Browse files
committed
refactor: Move Cloudflare integration to new repo structure
Adapts feat/cloudflare-integration to the new repository layout: - Move typescript-sdk/integrations/cloudflare → integrations/cloudflare/typescript - Move typescript-sdk/apps/dojo → apps/dojo - Update package.json repository directory path - Add workspace dependencies (@ag-ui/core, @ag-ui/client) All files relocated, dependencies updated, build passing ✅
1 parent 60599e7 commit 5566c31

30 files changed

+6519
-241
lines changed

apps/dojo/scripts/prep-dojo-everything.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,58 +44,57 @@ Examples:
4444
}
4545

4646
const gitRoot = execSync("git rev-parse --show-toplevel", { encoding: "utf-8" }).trim();
47-
const integrationsRoot = path.join(gitRoot, "integrations");
48-
const middlewaresRoot = path.join(gitRoot, "middlewares");
47+
const integrationsRoot = path.join(gitRoot, "typescript-sdk", "integrations");
4948

5049
// Define all prep targets keyed by a stable id
5150
const ALL_TARGETS = {
5251
"server-starter": {
5352
command: "poetry install",
5453
name: "Server Starter",
55-
cwd: path.join(integrationsRoot, "server-starter/python/examples"),
54+
cwd: path.join(integrationsRoot, "server-starter/server/python"),
5655
},
5756
"server-starter-all": {
5857
command: "poetry install",
5958
name: "Server AF",
60-
cwd: path.join(integrationsRoot, "server-starter-all-features/python/examples"),
59+
cwd: path.join(integrationsRoot, "server-starter-all-features/server/python"),
6160
},
6261
agno: {
6362
command: "uv sync",
6463
name: "Agno",
65-
cwd: path.join(integrationsRoot, "agno/python/examples"),
64+
cwd: path.join(integrationsRoot, "agno/examples"),
6665
},
6766
"crew-ai": {
6867
command: "poetry install",
6968
name: "CrewAI",
70-
cwd: path.join(integrationsRoot, "crew-ai/python"),
69+
cwd: path.join(integrationsRoot, "crewai/python"),
7170
},
7271
"langgraph-fastapi": {
7372
command: "poetry install",
7473
name: "LG FastAPI",
75-
cwd: path.join(integrationsRoot, "langgraph/python/examples"),
74+
cwd: path.join(integrationsRoot, "langgraph/examples/python"),
7675
env: {
7776
POETRY_VIRTUALENVS_IN_PROJECT: "false",
7877
},
7978
},
8079
"langgraph-platform-typescript": {
8180
command: "pnpm install",
8281
name: "LG Platform TS",
83-
cwd: path.join(integrationsRoot, "langgraph/typescript/examples"),
82+
cwd: path.join(integrationsRoot, "langgraph/examples/typescript/"),
8483
},
8584
"llama-index": {
8685
command: "uv sync",
8786
name: "Llama Index",
88-
cwd: path.join(integrationsRoot, "llama-index/python/examples"),
87+
cwd: path.join(integrationsRoot, "llamaindex/server-py"),
8988
},
9089
mastra: {
9190
command: "pnpm install --no-frozen-lockfile",
9291
name: "Mastra",
93-
cwd: path.join(integrationsRoot, "mastra/typescript/examples"),
92+
cwd: path.join(integrationsRoot, "mastra/example"),
9493
},
9594
"pydantic-ai": {
9695
command: "uv sync",
9796
name: "Pydantic AI",
98-
cwd: path.join(integrationsRoot, "pydantic-ai/python/examples"),
97+
cwd: path.join(integrationsRoot, "pydantic-ai/examples"),
9998
},
10099
"adk-middleware": {
101100
command: "uv sync",
@@ -105,12 +104,17 @@ const ALL_TARGETS = {
105104
"a2a-middleware": {
106105
command: "uv sync",
107106
name: "A2A Middleware",
108-
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
107+
cwd: path.join(integrationsRoot, "a2a-middleware/examples"),
108+
},
109+
cloudflare: {
110+
command: "pnpm install --no-frozen-lockfile",
111+
name: "Cloudflare",
112+
cwd: path.join(integrationsRoot, "cloudflare/examples/server"),
109113
},
110114
dojo: {
111115
command: "pnpm install --no-frozen-lockfile && pnpm build --filter=demo-viewer...",
112116
name: "Dojo",
113-
cwd: gitRoot,
117+
cwd: path.join(gitRoot, "typescript-sdk"),
114118
},
115119
};
116120

apps/dojo/scripts/run-dojo-everything.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,38 @@ Examples:
4343
}
4444

4545
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
46-
const integrationsRoot = path.join(gitRoot, 'integrations');
47-
const middlewaresRoot = path.join(gitRoot, 'middlewares');
46+
const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations');
4847

4948
// Define all runnable services keyed by a stable id
5049
const ALL_SERVICES = {
5150
'server-starter': [{
5251
command: 'poetry run dev',
5352
name: 'Server Starter',
54-
cwd: path.join(integrationsRoot, 'server-starter/python/examples'),
53+
cwd: path.join(integrationsRoot, 'server-starter/server/python'),
5554
env: { PORT: 8000 },
5655
}],
5756
'server-starter-all': [{
5857
command: 'poetry run dev',
5958
name: 'Server AF',
60-
cwd: path.join(integrationsRoot, 'server-starter-all-features/python/examples'),
59+
cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'),
6160
env: { PORT: 8001 },
6261
}],
6362
'agno': [{
6463
command: 'uv run dev',
6564
name: 'Agno',
66-
cwd: path.join(integrationsRoot, 'agno/python/examples'),
65+
cwd: path.join(integrationsRoot, 'agno/examples'),
6766
env: { PORT: 8002 },
6867
}],
6968
'crew-ai': [{
7069
command: 'poetry run dev',
7170
name: 'CrewAI',
72-
cwd: path.join(integrationsRoot, 'crew-ai/python'),
71+
cwd: path.join(integrationsRoot, 'crewai/python'),
7372
env: { PORT: 8003 },
7473
}],
7574
'langgraph-fastapi': [{
7675
command: 'poetry run dev',
7776
name: 'LG FastAPI',
78-
cwd: path.join(integrationsRoot, 'langgraph/python/examples'),
77+
cwd: path.join(integrationsRoot, 'langgraph/examples/python'),
7978
env: {
8079
PORT: 8004,
8180
POETRY_VIRTUALENVS_IN_PROJECT: 'false',
@@ -84,31 +83,31 @@ const ALL_SERVICES = {
8483
'langgraph-platform-python': [{
8584
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --host 127.0.0.1 --port 8005',
8685
name: 'LG Platform Py',
87-
cwd: path.join(integrationsRoot, 'langgraph/python/examples'),
86+
cwd: path.join(integrationsRoot, 'langgraph/examples/python'),
8887
env: { PORT: 8005 },
8988
}],
9089
'langgraph-platform-typescript': [{
9190
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --host 127.0.0.1 --port 8006',
9291
name: 'LG Platform TS',
93-
cwd: path.join(integrationsRoot, 'langgraph/typescript/examples'),
92+
cwd: path.join(integrationsRoot, 'langgraph/examples/typescript/'),
9493
env: { PORT: 8006 },
9594
}],
9695
'llama-index': [{
9796
command: 'uv run dev',
9897
name: 'Llama Index',
99-
cwd: path.join(integrationsRoot, 'llama-index/python/examples'),
98+
cwd: path.join(integrationsRoot, 'llamaindex/server-py'),
10099
env: { PORT: 8007 },
101100
}],
102101
'mastra': [{
103102
command: 'npm run dev',
104103
name: 'Mastra',
105-
cwd: path.join(integrationsRoot, 'mastra/typescript/examples'),
104+
cwd: path.join(integrationsRoot, 'mastra/example'),
106105
env: { PORT: 8008 },
107106
}],
108107
'pydantic-ai': [{
109108
command: 'uv run dev',
110109
name: 'Pydantic AI',
111-
cwd: path.join(integrationsRoot, 'pydantic-ai/python/examples'),
110+
cwd: path.join(integrationsRoot, 'pydantic-ai/examples'),
112111
env: { PORT: 8009 },
113112
}],
114113
'adk-middleware': [{
@@ -120,31 +119,37 @@ const ALL_SERVICES = {
120119
'a2a-middleware': [{
121120
command: 'uv run buildings_management.py',
122121
name: 'A2A Middleware: Buildings Management',
123-
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
122+
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
124123
env: { PORT: 8011 },
125124
},
126125
{
127126
command: 'uv run finance.py',
128127
name: 'A2A Middleware: Finance',
129-
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
128+
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
130129
env: { PORT: 8012 },
131130
},
132131
{
133132
command: 'uv run it.py',
134133
name: 'A2A Middleware: IT',
135-
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
134+
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
136135
env: { PORT: 8013 },
137136
},
138137
{
139138
command: 'uv run orchestrator.py',
140139
name: 'A2A Middleware: Orchestrator',
141-
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
140+
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
142141
env: { PORT: 8014 },
143142
}],
143+
'cloudflare': [{
144+
command: 'pnpm start',
145+
name: 'Cloudflare',
146+
cwd: path.join(integrationsRoot, 'cloudflare/examples/server'),
147+
env: { PORT: 4114, HOST: '0.0.0.0' },
148+
}],
144149
'dojo': [{
145150
command: 'pnpm run start',
146151
name: 'Dojo',
147-
cwd: path.join(gitRoot, 'apps/dojo'),
152+
cwd: path.join(gitRoot, 'typescript-sdk/apps/dojo'),
148153
env: {
149154
PORT: 9999,
150155
SERVER_STARTER_URL: 'http://localhost:8000',
@@ -162,6 +167,7 @@ const ALL_SERVICES = {
162167
A2A_MIDDLEWARE_FINANCE_URL: 'http://localhost:8012',
163168
A2A_MIDDLEWARE_IT_URL: 'http://localhost:8013',
164169
A2A_MIDDLEWARE_ORCHESTRATOR_URL: 'http://localhost:8014',
170+
CLOUDFLARE_URL: 'http://localhost:4114',
165171
NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE: 'cpkdojo.local___CopilotKit Feature Viewer',
166172
},
167173
}],

apps/dojo/src/agents.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ 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 { CloudflareHttpAgent } from "@ag-ui/cloudflare";
2223

2324
const envVars = getEnvVars();
2425
export const agentsIntegrations: AgentIntegrationConfig[] = [
@@ -273,26 +274,26 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
273274
},
274275
},
275276
{
276-
id: 'spring-ai',
277+
id: "spring-ai",
277278
agents: async () => {
278279
return {
279280
agentic_chat: new SpringAiAgent({
280-
url: `${envVars.springAiUrl}/agentic_chat/agui`
281+
url: `${envVars.springAiUrl}/agentic_chat/agui`,
281282
}),
282283
shared_state: new SpringAiAgent({
283-
url: `${envVars.springAiUrl}/shared_state/agui`
284+
url: `${envVars.springAiUrl}/shared_state/agui`,
284285
}),
285286
tool_based_generative_ui: new SpringAiAgent({
286-
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`
287+
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`,
287288
}),
288289
human_in_the_loop: new SpringAiAgent({
289-
url: `${envVars.springAiUrl}/human_in_the_loop/agui`
290+
url: `${envVars.springAiUrl}/human_in_the_loop/agui`,
290291
}),
291292
agentic_generative_ui: new SpringAiAgent({
292-
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`
293-
})
294-
}
295-
}
293+
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`,
294+
}),
295+
};
296+
},
296297
},
297298
{
298299
id: "llama-index",
@@ -341,6 +342,16 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
341342
};
342343
},
343344
},
345+
{
346+
id: "cloudflare",
347+
agents: async () => {
348+
return {
349+
agentic_chat: new CloudflareHttpAgent({
350+
url: `${envVars.cloudflareUrl}/agentic_chat`,
351+
}),
352+
};
353+
},
354+
},
344355
{
345356
id: "a2a",
346357
agents: async () => {

apps/dojo/src/env.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,40 @@ type envVars = {
1515
a2aMiddlewareFinanceUrl: string;
1616
a2aMiddlewareItUrl: string;
1717
a2aMiddlewareOrchestratorUrl: string;
18+
cloudflareUrl: string;
1819
customDomainTitle: Record<string, string>;
19-
}
20+
};
2021

2122
export default function getEnvVars(): envVars {
2223
const customDomainTitle: Record<string, string> = {};
2324
if (process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE) {
24-
const [domain, title] = process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE.split('___');
25+
const [domain, title] = process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE.split("___");
2526
if (domain && title) {
2627
customDomainTitle[domain] = title;
2728
}
2829
}
2930

3031
return {
31-
serverStarterUrl: process.env.SERVER_STARTER_URL || 'http://localhost:8000',
32-
serverStarterAllFeaturesUrl: process.env.SERVER_STARTER_ALL_FEATURES_URL || 'http://localhost:8000',
33-
mastraUrl: process.env.MASTRA_URL || 'http://localhost:4111',
34-
langgraphPythonUrl: process.env.LANGGRAPH_PYTHON_URL || 'http://localhost:2024',
35-
langgraphFastApiUrl: process.env.LANGGRAPH_FAST_API_URL || 'http://localhost:8000',
36-
langgraphTypescriptUrl: process.env.LANGGRAPH_TYPESCRIPT_URL || 'http://localhost:2024',
37-
agnoUrl: process.env.AGNO_URL || 'http://localhost:9001',
38-
llamaIndexUrl: process.env.LLAMA_INDEX_URL || 'http://localhost:9000',
39-
crewAiUrl: process.env.CREW_AI_URL || 'http://localhost:9002',
40-
pydanticAIUrl: process.env.PYDANTIC_AI_URL || 'http://localhost:9000',
41-
adkMiddlewareUrl: process.env.ADK_MIDDLEWARE_URL || 'http://localhost:8000',
42-
springAiUrl: process.env.SPRING_AI_URL || 'http://localhost:8080',
43-
a2aMiddlewareBuildingsManagementUrl: process.env.A2A_MIDDLEWARE_BUILDINGS_MANAGEMENT_URL || 'http://localhost:9001',
44-
a2aMiddlewareFinanceUrl: process.env.A2A_MIDDLEWARE_FINANCE_URL || 'http://localhost:9002',
45-
a2aMiddlewareItUrl: process.env.A2A_MIDDLEWARE_IT_URL || 'http://localhost:9003',
46-
a2aMiddlewareOrchestratorUrl: process.env.A2A_MIDDLEWARE_ORCHESTRATOR_URL || 'http://localhost:9000',
32+
serverStarterUrl: process.env.SERVER_STARTER_URL || "http://localhost:8000",
33+
serverStarterAllFeaturesUrl:
34+
process.env.SERVER_STARTER_ALL_FEATURES_URL || "http://localhost:8000",
35+
mastraUrl: process.env.MASTRA_URL || "http://localhost:4111",
36+
langgraphPythonUrl: process.env.LANGGRAPH_PYTHON_URL || "http://localhost:2024",
37+
langgraphFastApiUrl: process.env.LANGGRAPH_FAST_API_URL || "http://localhost:8000",
38+
langgraphTypescriptUrl: process.env.LANGGRAPH_TYPESCRIPT_URL || "http://localhost:2024",
39+
agnoUrl: process.env.AGNO_URL || "http://localhost:9001",
40+
llamaIndexUrl: process.env.LLAMA_INDEX_URL || "http://localhost:9000",
41+
crewAiUrl: process.env.CREW_AI_URL || "http://localhost:9002",
42+
pydanticAIUrl: process.env.PYDANTIC_AI_URL || "http://localhost:9000",
43+
adkMiddlewareUrl: process.env.ADK_MIDDLEWARE_URL || "http://localhost:8000",
44+
springAiUrl: process.env.SPRING_AI_URL || "http://localhost:8080",
45+
a2aMiddlewareBuildingsManagementUrl:
46+
process.env.A2A_MIDDLEWARE_BUILDINGS_MANAGEMENT_URL || "http://localhost:9001",
47+
a2aMiddlewareFinanceUrl: process.env.A2A_MIDDLEWARE_FINANCE_URL || "http://localhost:9002",
48+
a2aMiddlewareItUrl: process.env.A2A_MIDDLEWARE_IT_URL || "http://localhost:9003",
49+
a2aMiddlewareOrchestratorUrl:
50+
process.env.A2A_MIDDLEWARE_ORCHESTRATOR_URL || "http://localhost:9000",
51+
cloudflareUrl: process.env.CLOUDFLARE_URL || "http://localhost:4114",
4752
customDomainTitle: customDomainTitle,
48-
}
49-
}
53+
};
54+
}

apps/dojo/src/menu.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
6060
],
6161
},
6262
{
63-
id: 'spring-ai',
64-
name: 'Spring AI',
63+
id: "spring-ai",
64+
name: "Spring AI",
6565
features: [
66-
'agentic_chat',
67-
'shared_state',
68-
'tool_based_generative_ui',
69-
'human_in_the_loop',
70-
'agentic_generative_ui'
71-
]
66+
"agentic_chat",
67+
"shared_state",
68+
"tool_based_generative_ui",
69+
"human_in_the_loop",
70+
"agentic_generative_ui",
71+
],
7272
},
7373
{
7474
id: "pydantic-ai",
@@ -155,6 +155,11 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
155155
"tool_based_generative_ui",
156156
],
157157
},
158+
{
159+
id: "cloudflare",
160+
name: "Cloudflare",
161+
features: ["agentic_chat"],
162+
},
158163
{
159164
id: "a2a",
160165
name: "A2A",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
src/
2+
examples/
3+
tsconfig.json
4+
tsup.config.ts
5+
jest.config.js
6+
*.test.ts
7+
*.spec.ts
8+
__tests__/

0 commit comments

Comments
 (0)