From 6bf098f480ec721ddc7b5c0cde26f7627a1c28ff Mon Sep 17 00:00:00 2001 From: Harsh Batheja Date: Mon, 30 Mar 2026 02:59:45 +0530 Subject: [PATCH] fix: start terminal WebSocket servers in `ao dashboard` dev mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ao dashboard` only spawned `next dev`, missing the terminal and direct-terminal WebSocket servers. This meant the live terminal in the dashboard never connected — the same bug that `ao start` didn't have because it uses `pnpm run dev` (which runs all three via concurrently). Detect dev mode (monorepo has `server/` dir) and use `pnpm run dev` instead of bare `next dev`, matching the behavior of `ao start`. --- packages/cli/src/commands/dashboard.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/commands/dashboard.ts b/packages/cli/src/commands/dashboard.ts index cd61ef62a..8f494c77d 100644 --- a/packages/cli/src/commands/dashboard.ts +++ b/packages/cli/src/commands/dashboard.ts @@ -1,4 +1,6 @@ import { spawn } from "node:child_process"; +import { existsSync } from "node:fs"; +import { resolve } from "node:path"; import chalk from "chalk"; import type { Command } from "commander"; import { loadConfig } from "@composio/ao-core"; @@ -58,11 +60,21 @@ export function registerDashboard(program: Command): void { config.directTerminalPort, ); - const child = spawn("npx", ["next", "dev", "-p", String(port)], { - cwd: webDir, - stdio: ["inherit", "inherit", "pipe"], - env, - }); + // In dev mode (monorepo), use `pnpm run dev` which starts Next.js AND + // the terminal WebSocket servers via concurrently. Without the WS servers, + // the live terminal in the dashboard won't work. + const isDevMode = existsSync(resolve(webDir, "server")); + const child = isDevMode + ? spawn("pnpm", ["run", "dev"], { + cwd: webDir, + stdio: ["inherit", "inherit", "pipe"], + env, + }) + : spawn("npx", ["next", "dev", "-p", String(port)], { + cwd: webDir, + stdio: ["inherit", "inherit", "pipe"], + env, + }); const stderrChunks: string[] = [];