Skip to content

Commit 7dd37fe

Browse files
committed
Add scripts for running dojo for e2e
1 parent 6157b97 commit 7dd37fe

File tree

6 files changed

+544
-430
lines changed

6 files changed

+544
-430
lines changed

typescript-sdk/apps/dojo/next.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const withMDX = createMDX({
1616

1717
const nextConfig: NextConfig = {
1818
/* config options here */
19-
output: "standalone",
2019
// Configure pageExtensions to include md and mdx
2120
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
2221
webpack: (config, { isServer }) => {

typescript-sdk/apps/dojo/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@
8383
"@types/node": "^20",
8484
"@types/react": "^19",
8585
"@types/react-dom": "^19",
86+
"concurrently": "^9.2.0",
8687
"eslint": "^9",
8788
"eslint-config-next": "15.2.1",
8889
"tailwindcss": "^4",
8990
"tsx": "^4.7.0",
90-
"typescript": "^5"
91+
"typescript": "^5",
92+
"wait-port": "^1.1.0"
9193
}
9294
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env node
2+
const fs = require('fs');
3+
const { execSync } = require('child_process');
4+
const path = require('path');
5+
6+
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
7+
const dojoDir = path.join(gitRoot, 'typescript-sdk/apps/dojo');
8+
9+
function linkCopilotKit() {
10+
const pkgPath = path.join(dojoDir, 'package.json');
11+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
12+
const packages = Object.keys(pkg.dependencies).filter(pkg => pkg.startsWith('@copilotkit/'));
13+
14+
success = true;
15+
packages.forEach(pkg => {
16+
console.log(`Linking ${pkg}`);
17+
try {
18+
execSync(`pnpm link ${pkg}`, {cwd: dojoDir});
19+
console.log(`Linked ${pkg}`);
20+
} catch (e) {
21+
console.error(`Error linking ${pkg}: ${e}`);
22+
success = false;
23+
}
24+
25+
});
26+
27+
if (!success) {
28+
process.exit(1);
29+
}
30+
31+
}
32+
33+
linkCopilotKit();
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env node
2+
3+
const { execSync } = require('child_process');
4+
const path = require('path');
5+
const concurrently = require('concurrently');
6+
7+
// Parse command line arguments
8+
const args = process.argv.slice(2);
9+
const showHelp = args.includes('--help') || args.includes('-h');
10+
const dryRun = args.includes('--dry-run');
11+
12+
if (showHelp) {
13+
console.log(`
14+
Usage: node prep-dojo-everything.js [options]
15+
16+
Options:
17+
--dry-run Show what would be installed without actually running
18+
--help, -h Show this help message
19+
20+
Examples:
21+
node prep-dojo-everything.js
22+
node prep-dojo-everything.js --dry-run
23+
`);
24+
process.exit(0);
25+
}
26+
27+
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
28+
const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations');
29+
30+
31+
32+
// Server Starter
33+
const serverStarter = {
34+
command: 'poetry install',
35+
name: 'Server Starter',
36+
cwd: path.join(integrationsRoot, 'server-starter/server/python'),
37+
}
38+
39+
// Server Starter All Features
40+
const serverStarterAllFeatures = {
41+
command: 'poetry install',
42+
name: 'Server AF',
43+
cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'),
44+
}
45+
46+
// Agno
47+
const agno = {
48+
command: 'uv venv --allow-existing && uv pip install -r requirements.txt',
49+
name: 'Agno',
50+
cwd: path.join(integrationsRoot, 'agno/examples'),
51+
}
52+
53+
// CrewAI
54+
const crewai = {
55+
command: 'poetry install',
56+
name: 'CrewAI',
57+
cwd: path.join(integrationsRoot, 'crewai/python'),
58+
}
59+
60+
// Langgraph (FastAPI)
61+
const langgraphFastapi = {
62+
command: 'poetry install',
63+
name: 'LG FastAPI',
64+
cwd: path.join(integrationsRoot, 'langgraph/python/ag_ui_langgraph/examples'),
65+
}
66+
67+
// Langgraph (Platorm {typescript})
68+
const langgraphPlatformTypescript = {
69+
command: 'pnpm install',
70+
name: 'LG Platform TS',
71+
cwd: path.join(integrationsRoot, 'langgraph/examples/typescript/'),
72+
}
73+
74+
// Llama Index
75+
const llamaIndex = {
76+
command: 'uv sync',
77+
name: 'Llama Index',
78+
cwd: path.join(integrationsRoot, 'llamaindex/server-py'),
79+
}
80+
81+
// Mastra
82+
const mastra = {
83+
command: 'npm install',
84+
name: 'Mastra',
85+
cwd: path.join(integrationsRoot, 'mastra/example'),
86+
}
87+
88+
// Pydantic AI
89+
const pydanticAi = {
90+
command: 'uv sync',
91+
name: 'Pydantic AI',
92+
cwd: path.join(integrationsRoot, 'pydantic-ai/examples'),
93+
}
94+
95+
// THE ACTUAL DOJO
96+
const dojo = {
97+
command: 'pnpm install && pnpm build --filter=demo-viewer...',
98+
name: 'Dojo',
99+
cwd: path.join(gitRoot, 'typescript-sdk'),
100+
}
101+
102+
function printDryRunServices(procs) {
103+
console.log('Dry run - would install dependencies for the following services:');
104+
procs.forEach(proc => {
105+
console.log(` - ${proc.name} (${proc.cwd})`);
106+
console.log(` Command: ${proc.command}`);
107+
console.log('');
108+
});
109+
process.exit(0);
110+
}
111+
112+
async function main() {
113+
const procs = [
114+
serverStarter,
115+
serverStarterAllFeatures,
116+
agno,
117+
crewai,
118+
// langgraphFastapi, // Disabled until build fixes
119+
langgraphPlatformTypescript,
120+
llamaIndex,
121+
mastra,
122+
pydanticAi,
123+
dojo
124+
];
125+
126+
if (dryRun) {
127+
printDryRunServices(procs);
128+
}
129+
130+
const {result} = concurrently(procs);
131+
132+
result.then(() => process.exit(0)).catch((err) => {
133+
console.error(err);
134+
process.exit(1);
135+
});
136+
}
137+
138+
main();
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
#!/usr/bin/env node
2+
3+
const { execSync } = require('child_process');
4+
const path = require('path');
5+
const concurrently = require('concurrently');
6+
7+
// Parse command line arguments
8+
const args = process.argv.slice(2);
9+
const showHelp = args.includes('--help') || args.includes('-h');
10+
const dryRun = args.includes('--dry-run');
11+
12+
if (showHelp) {
13+
console.log(`
14+
Usage: node run-dojo-everything.js [options]
15+
16+
Options:
17+
--dry-run Show what would be started without actually running
18+
--help, -h Show this help message
19+
20+
Examples:
21+
node run-dojo-everything.js
22+
node run-dojo-everything.js --dry-run
23+
`);
24+
process.exit(0);
25+
}
26+
27+
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
28+
const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations');
29+
30+
// Server Starter
31+
const serverStarter = {
32+
command: 'poetry run dev',
33+
name: 'Server Starter',
34+
cwd: path.join(integrationsRoot, 'server-starter/server/python'),
35+
env: {PORT: 8000},
36+
}
37+
38+
// Server Starter All Features
39+
const serverStarterAllFeatures = {
40+
command: 'poetry run dev',
41+
name: 'Server AF',
42+
cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'),
43+
env: {PORT: 8001},
44+
}
45+
46+
// Agno
47+
const agno = {
48+
command: 'uv run agent.py',
49+
name: 'Agno',
50+
cwd: path.join(integrationsRoot, 'agno/examples'),
51+
env: {PORT: 8002},
52+
}
53+
54+
// CrewAI
55+
const crewai = {
56+
command: 'poetry run dev',
57+
name: 'CrewAI',
58+
cwd: path.join(integrationsRoot, 'crewai/python'),
59+
env: {PORT: 8003},
60+
}
61+
62+
// Langgraph (FastAPI)
63+
const langgraphFastapi = {
64+
command: 'poetry run dev',
65+
name: 'LG FastAPI',
66+
cwd: path.join(integrationsRoot, 'langgraph/python/ag_ui_langgraph/examples'),
67+
env: {PORT: 8004},
68+
}
69+
70+
// Langgraph (Platform {python})
71+
const langgraphPlatformPython = {
72+
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --port 8005',
73+
name: 'LG Platform Py',
74+
cwd: path.join(integrationsRoot, 'langgraph/examples/python'),
75+
env: {PORT: 8005},
76+
}
77+
78+
// Langgraph (Platform {typescript})
79+
const langgraphPlatformTypescript = {
80+
command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --port 8006',
81+
name: 'LG Platform TS',
82+
cwd: path.join(integrationsRoot, 'langgraph/examples/typescript/'),
83+
env: {PORT: 8006},
84+
}
85+
86+
// Llama Index
87+
const llamaIndex = {
88+
command: 'uv run dev',
89+
name: 'Llama Index',
90+
cwd: path.join(integrationsRoot, 'llamaindex/server-py'),
91+
env: {PORT: 8007},
92+
}
93+
94+
// Mastra
95+
const mastra = {
96+
command: 'npm run dev',
97+
name: 'Mastra',
98+
cwd: path.join(integrationsRoot, 'mastra/example'),
99+
env: {PORT: 8008},
100+
}
101+
102+
// Pydantic AI
103+
const pydanticAi = {
104+
command: 'uv run dev',
105+
name: 'Pydantic AI',
106+
cwd: path.join(integrationsRoot, 'pydantic-ai/examples'),
107+
env: {PORT: 8009},
108+
}
109+
110+
// THE ACTUAL DOJO
111+
const dojo = {
112+
command: 'pnpm run start',
113+
name: 'Dojo',
114+
cwd: path.join(gitRoot, 'typescript-sdk/apps/dojo'),
115+
env: {
116+
PORT: 9999,
117+
SERVER_STARTER_URL: 'http://localhost:8000',
118+
SERVER_STARTER_ALL_FEATURES_URL: 'http://localhost:8001',
119+
AGNO_URL: 'http://localhost:8002',
120+
CREW_AI_URL: 'http://localhost:8003',
121+
LANGGRAPH_FAST_API_URL: 'http://localhost:8004',
122+
// TODO: Move this to run 2 platforms for testing.
123+
LANGGRAPH_URL: 'http://localhost:8005',
124+
// LANGGRAPH_PLATFORM_PYTHON_URL: 'http://localhost:8005',
125+
// LANGGRAPH_PLATFORM_TYPESCRIPT_URL: 'http://localhost:8006',
126+
LLAMA_INDEX_URL: 'http://localhost:8007',
127+
MASTRA_URL: 'http://localhost:8008',
128+
PYDANTIC_AI_URL: 'http://localhost:8009',
129+
}
130+
}
131+
132+
const procs = [
133+
serverStarter,
134+
serverStarterAllFeatures,
135+
agno,
136+
crewai,
137+
// langgraphFastapi, // Disabled until it runs
138+
langgraphPlatformPython,
139+
// TODO: Also run the typescript version of langgraph.
140+
langgraphPlatformTypescript,
141+
llamaIndex,
142+
mastra,
143+
pydanticAi,
144+
dojo
145+
];
146+
147+
function printDryRunServices(procs) {
148+
console.log('Dry run - would start the following services:');
149+
procs.forEach(proc => {
150+
console.log(` - ${proc.name} (${proc.cwd})`);
151+
console.log(` Command: ${proc.command}`);
152+
console.log(` Environment variables:`);
153+
if (proc.env) {
154+
Object.entries(proc.env).forEach(([key, value]) => {
155+
console.log(` ${key}: ${value}`);
156+
});
157+
} else {
158+
console.log(' No environment variables specified.');
159+
}
160+
console.log('');
161+
});
162+
process.exit(0);
163+
}
164+
165+
async function main() {
166+
if (dryRun) {
167+
printDryRunServices(procs);
168+
}
169+
170+
console.log('Starting services: ', procs.map(p => p.name).join(', '));
171+
172+
const {result} = concurrently(procs, {killOthersOn: ['failure', 'success']});
173+
174+
result.then(() => process.exit(0)).catch((err) => {
175+
console.error(err);
176+
process.exit(1);
177+
});
178+
}
179+
180+
main();

0 commit comments

Comments
 (0)