Skip to content

Commit 0b40d4d

Browse files
committed
feat: Add Cloudflare to dojo configuration
Adds Cloudflare integration to dojo scripts and configuration: Scripts: - prep-dojo-everything.js: Add cloudflare prep target - run-dojo-everything.js: Add cloudflare service + CLOUDFLARE_URL env Configuration: - agents.ts: Add CloudflareHttpAgent for agentic_chat - env.ts: Add cloudflareUrl (default: localhost:4114) - menu.ts: Add Cloudflare to sidebar menu Only Cloudflare entries added - no changes to other integrations
1 parent 5566c31 commit 0b40d4d

File tree

5 files changed

+86
-87
lines changed

5 files changed

+86
-87
lines changed

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

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

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

4950
// Define all prep targets keyed by a stable id
5051
const ALL_TARGETS = {
5152
"server-starter": {
5253
command: "poetry install",
5354
name: "Server Starter",
54-
cwd: path.join(integrationsRoot, "server-starter/server/python"),
55+
cwd: path.join(integrationsRoot, "server-starter/python/examples"),
5556
},
5657
"server-starter-all": {
5758
command: "poetry install",
5859
name: "Server AF",
59-
cwd: path.join(integrationsRoot, "server-starter-all-features/server/python"),
60+
cwd: path.join(integrationsRoot, "server-starter-all-features/python/examples"),
6061
},
6162
agno: {
6263
command: "uv sync",
6364
name: "Agno",
64-
cwd: path.join(integrationsRoot, "agno/examples"),
65+
cwd: path.join(integrationsRoot, "agno/python/examples"),
6566
},
6667
"crew-ai": {
6768
command: "poetry install",
6869
name: "CrewAI",
69-
cwd: path.join(integrationsRoot, "crewai/python"),
70+
cwd: path.join(integrationsRoot, "crew-ai/python"),
7071
},
7172
"langgraph-fastapi": {
7273
command: "poetry install",
7374
name: "LG FastAPI",
74-
cwd: path.join(integrationsRoot, "langgraph/examples/python"),
75+
cwd: path.join(integrationsRoot, "langgraph/python/examples"),
7576
env: {
7677
POETRY_VIRTUALENVS_IN_PROJECT: "false",
7778
},
7879
},
7980
"langgraph-platform-typescript": {
8081
command: "pnpm install",
8182
name: "LG Platform TS",
82-
cwd: path.join(integrationsRoot, "langgraph/examples/typescript/"),
83+
cwd: path.join(integrationsRoot, "langgraph/typescript/examples"),
8384
},
8485
"llama-index": {
8586
command: "uv sync",
8687
name: "Llama Index",
87-
cwd: path.join(integrationsRoot, "llamaindex/server-py"),
88+
cwd: path.join(integrationsRoot, "llama-index/python/examples"),
8889
},
8990
mastra: {
9091
command: "pnpm install --no-frozen-lockfile",
9192
name: "Mastra",
92-
cwd: path.join(integrationsRoot, "mastra/example"),
93+
cwd: path.join(integrationsRoot, "mastra/typescript/examples"),
9394
},
9495
"pydantic-ai": {
9596
command: "uv sync",
9697
name: "Pydantic AI",
97-
cwd: path.join(integrationsRoot, "pydantic-ai/examples"),
98+
cwd: path.join(integrationsRoot, "pydantic-ai/python/examples"),
9899
},
99100
"adk-middleware": {
100101
command: "uv sync",
@@ -104,17 +105,17 @@ const ALL_TARGETS = {
104105
"a2a-middleware": {
105106
command: "uv sync",
106107
name: "A2A Middleware",
107-
cwd: path.join(integrationsRoot, "a2a-middleware/examples"),
108+
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
108109
},
109110
cloudflare: {
110-
command: "pnpm install --no-frozen-lockfile",
111-
name: "Cloudflare",
112-
cwd: path.join(integrationsRoot, "cloudflare/examples/server"),
111+
command: 'pnpm install --no-frozen-lockfile',
112+
name: 'Cloudflare',
113+
cwd: path.join(integrationsRoot, 'cloudflare/typescript/examples')
113114
},
114115
dojo: {
115116
command: "pnpm install --no-frozen-lockfile && pnpm build --filter=demo-viewer...",
116117
name: "Dojo",
117-
cwd: path.join(gitRoot, "typescript-sdk"),
118+
cwd: gitRoot,
118119
},
119120
};
120121

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

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

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

4849
// Define all runnable services keyed by a stable id
4950
const ALL_SERVICES = {
5051
'server-starter': [{
5152
command: 'poetry run dev',
5253
name: 'Server Starter',
53-
cwd: path.join(integrationsRoot, 'server-starter/server/python'),
54+
cwd: path.join(integrationsRoot, 'server-starter/python/examples'),
5455
env: { PORT: 8000 },
5556
}],
5657
'server-starter-all': [{
5758
command: 'poetry run dev',
5859
name: 'Server AF',
59-
cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'),
60+
cwd: path.join(integrationsRoot, 'server-starter-all-features/python/examples'),
6061
env: { PORT: 8001 },
6162
}],
6263
'agno': [{
6364
command: 'uv run dev',
6465
name: 'Agno',
65-
cwd: path.join(integrationsRoot, 'agno/examples'),
66+
cwd: path.join(integrationsRoot, 'agno/python/examples'),
6667
env: { PORT: 8002 },
6768
}],
6869
'crew-ai': [{
6970
command: 'poetry run dev',
7071
name: 'CrewAI',
71-
cwd: path.join(integrationsRoot, 'crewai/python'),
72+
cwd: path.join(integrationsRoot, 'crew-ai/python'),
7273
env: { PORT: 8003 },
7374
}],
7475
'langgraph-fastapi': [{
7576
command: 'poetry run dev',
7677
name: 'LG FastAPI',
77-
cwd: path.join(integrationsRoot, 'langgraph/examples/python'),
78+
cwd: path.join(integrationsRoot, 'langgraph/python/examples'),
7879
env: {
7980
PORT: 8004,
8081
POETRY_VIRTUALENVS_IN_PROJECT: 'false',
@@ -83,31 +84,31 @@ const ALL_SERVICES = {
8384
'langgraph-platform-python': [{
8485
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --host 127.0.0.1 --port 8005',
8586
name: 'LG Platform Py',
86-
cwd: path.join(integrationsRoot, 'langgraph/examples/python'),
87+
cwd: path.join(integrationsRoot, 'langgraph/python/examples'),
8788
env: { PORT: 8005 },
8889
}],
8990
'langgraph-platform-typescript': [{
9091
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --host 127.0.0.1 --port 8006',
9192
name: 'LG Platform TS',
92-
cwd: path.join(integrationsRoot, 'langgraph/examples/typescript/'),
93+
cwd: path.join(integrationsRoot, 'langgraph/typescript/examples'),
9394
env: { PORT: 8006 },
9495
}],
9596
'llama-index': [{
9697
command: 'uv run dev',
9798
name: 'Llama Index',
98-
cwd: path.join(integrationsRoot, 'llamaindex/server-py'),
99+
cwd: path.join(integrationsRoot, 'llama-index/python/examples'),
99100
env: { PORT: 8007 },
100101
}],
101102
'mastra': [{
102103
command: 'npm run dev',
103104
name: 'Mastra',
104-
cwd: path.join(integrationsRoot, 'mastra/example'),
105+
cwd: path.join(integrationsRoot, 'mastra/typescript/examples'),
105106
env: { PORT: 8008 },
106107
}],
107108
'pydantic-ai': [{
108109
command: 'uv run dev',
109110
name: 'Pydantic AI',
110-
cwd: path.join(integrationsRoot, 'pydantic-ai/examples'),
111+
cwd: path.join(integrationsRoot, 'pydantic-ai/python/examples'),
111112
env: { PORT: 8009 },
112113
}],
113114
'adk-middleware': [{
@@ -119,37 +120,37 @@ const ALL_SERVICES = {
119120
'a2a-middleware': [{
120121
command: 'uv run buildings_management.py',
121122
name: 'A2A Middleware: Buildings Management',
122-
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
123+
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
123124
env: { PORT: 8011 },
124125
},
125126
{
126127
command: 'uv run finance.py',
127128
name: 'A2A Middleware: Finance',
128-
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
129+
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
129130
env: { PORT: 8012 },
130131
},
131132
{
132133
command: 'uv run it.py',
133134
name: 'A2A Middleware: IT',
134-
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
135+
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
135136
env: { PORT: 8013 },
136137
},
137138
{
138139
command: 'uv run orchestrator.py',
139140
name: 'A2A Middleware: Orchestrator',
140-
cwd: path.join(integrationsRoot, 'a2a-middleware/examples'),
141+
cwd: path.join(middlewaresRoot, "a2a-middleware/examples"),
141142
env: { PORT: 8014 },
142143
}],
143-
'cloudflare': [{
144+
cloudflare: [{
144145
command: 'pnpm start',
145146
name: 'Cloudflare',
146-
cwd: path.join(integrationsRoot, 'cloudflare/examples/server'),
147-
env: { PORT: 4114, HOST: '0.0.0.0' },
147+
cwd: path.join(integrationsRoot, 'cloudflare/typescript/examples'),
148+
env: { PORT: 4114, HOST: '0.0.0.0' }
148149
}],
149150
'dojo': [{
150151
command: 'pnpm run start',
151152
name: 'Dojo',
152-
cwd: path.join(gitRoot, 'typescript-sdk/apps/dojo'),
153+
cwd: path.join(gitRoot, 'apps/dojo'),
153154
env: {
154155
PORT: 9999,
155156
SERVER_STARTER_URL: 'http://localhost:8000',
@@ -162,12 +163,12 @@ const ALL_SERVICES = {
162163
LLAMA_INDEX_URL: 'http://localhost:8007',
163164
MASTRA_URL: 'http://localhost:8008',
164165
PYDANTIC_AI_URL: 'http://localhost:8009',
166+
CLOUDFLARE_URL: 'http://localhost:4114',
165167
ADK_MIDDLEWARE_URL: 'http://localhost:8010',
166168
A2A_MIDDLEWARE_BUILDINGS_MANAGEMENT_URL: 'http://localhost:8011',
167169
A2A_MIDDLEWARE_FINANCE_URL: 'http://localhost:8012',
168170
A2A_MIDDLEWARE_IT_URL: 'http://localhost:8013',
169171
A2A_MIDDLEWARE_ORCHESTRATOR_URL: 'http://localhost:8014',
170-
CLOUDFLARE_URL: 'http://localhost:4114',
171172
NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE: 'cpkdojo.local___CopilotKit Feature Viewer',
172173
},
173174
}],

apps/dojo/src/agents.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ 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";
2222
import { CloudflareHttpAgent } from "@ag-ui/cloudflare";
@@ -274,26 +274,26 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
274274
},
275275
},
276276
{
277-
id: "spring-ai",
277+
id: 'spring-ai',
278278
agents: async () => {
279279
return {
280280
agentic_chat: new SpringAiAgent({
281-
url: `${envVars.springAiUrl}/agentic_chat/agui`,
281+
url: `${envVars.springAiUrl}/agentic_chat/agui`
282282
}),
283283
shared_state: new SpringAiAgent({
284-
url: `${envVars.springAiUrl}/shared_state/agui`,
284+
url: `${envVars.springAiUrl}/shared_state/agui`
285285
}),
286286
tool_based_generative_ui: new SpringAiAgent({
287-
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`,
287+
url: `${envVars.springAiUrl}/tool_based_generative_ui/agui`
288288
}),
289289
human_in_the_loop: new SpringAiAgent({
290-
url: `${envVars.springAiUrl}/human_in_the_loop/agui`,
290+
url: `${envVars.springAiUrl}/human_in_the_loop/agui`
291291
}),
292292
agentic_generative_ui: new SpringAiAgent({
293-
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`,
294-
}),
295-
};
296-
},
293+
url: `${envVars.springAiUrl}/agentic_generative_ui/agui`
294+
})
295+
}
296+
}
297297
},
298298
{
299299
id: "llama-index",
@@ -342,16 +342,6 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
342342
};
343343
},
344344
},
345-
{
346-
id: "cloudflare",
347-
agents: async () => {
348-
return {
349-
agentic_chat: new CloudflareHttpAgent({
350-
url: `${envVars.cloudflareUrl}/agentic_chat`,
351-
}),
352-
};
353-
},
354-
},
355345
{
356346
id: "a2a",
357347
agents: async () => {
@@ -386,4 +376,14 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
386376
};
387377
},
388378
},
379+
{
380+
id: "cloudflare",
381+
agents: async () => {
382+
return {
383+
agentic_chat: new CloudflareHttpAgent({
384+
url: `${envVars.cloudflareUrl}/agentic_chat`,
385+
}),
386+
};
387+
},
388+
},
389389
];

apps/dojo/src/env.ts

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,35 @@ type envVars = {
1717
a2aMiddlewareOrchestratorUrl: string;
1818
cloudflareUrl: string;
1919
customDomainTitle: Record<string, string>;
20-
};
20+
}
2121

2222
export default function getEnvVars(): envVars {
2323
const customDomainTitle: Record<string, string> = {};
2424
if (process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE) {
25-
const [domain, title] = process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE.split("___");
25+
const [domain, title] = process.env.NEXT_PUBLIC_CUSTOM_DOMAIN_TITLE.split('___');
2626
if (domain && title) {
2727
customDomainTitle[domain] = title;
2828
}
2929
}
3030

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

apps/dojo/src/menu.ts

Lines changed: 8 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",

0 commit comments

Comments
 (0)