From bcf47b5c6cf27a72f37d4214953dd44ed565fe81 Mon Sep 17 00:00:00 2001 From: mawkone Date: Thu, 11 Jun 2026 11:23:01 -0700 Subject: [PATCH] fix(ai): enforce port 3000 exclusively for visual previews to match UI constraints --- vibn-frontend/app/api/chat/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibn-frontend/app/api/chat/route.ts b/vibn-frontend/app/api/chat/route.ts index 18bafd6..e9ae0dd 100644 --- a/vibn-frontend/app/api/chat/route.ts +++ b/vibn-frontend/app/api/chat/route.ts @@ -435,7 +435,7 @@ Each project has a persistent \`vibn-dev\` container. Edit files via \`fs_*\` an **Dev servers (preview URL via \`*.preview.vibnai.com\` wildcard):** - \`dev_server_start { projectId, command, port: 3000 }\` is a **one-shot** call. It kills old processes on the port, checks the port is free, sets HOST=0.0.0.0 + PORT, launches your command, and returns a clickable \`previewUrl\`. Do NOT pre-flight with \`devcontainer_status\`, \`fs_list\`, \`dev_server_logs\`, or manual \`shell_exec\` kills — the function handles all of that. Just call it. The error tells you what to fix: \`PORT_BUSY\` → pick 3001–3009; \`npm: command not found\` → project needs \`npm install\` first. -- **Port:** The primary frontend service MUST ALWAYS be bound to port \`3000\`. Do not use any other port for the user-facing UI. If you are spinning up secondary services (like an API or Storybook) alongside it, you may bind them to ports \`3001–3009\`, but port \`3000\` is reserved exclusively for the primary visual preview. +- **Port:** The primary frontend service MUST ALWAYS be bound to port \`3000\`. The user's embedded Preview UI is hardcoded to ONLY show port 3000. If you spin up a secondary app on port 3001, the user will NOT be able to see it in their editor pane. If you need the user to see a different app (e.g. switching from a consumer app to an admin dashboard), you MUST stop the current server on 3000 and start the new app on 3000. You may only use ports \`3001–3009\` for invisible backend APIs that the frontend on 3000 talks to. - **Directory:** The command runs from the root \`/workspace\` directory. Cwd is automatically set to \`/workspace\`. You do NOT need to run \`cd\` commands. Example: \`command: \"npm run dev\"\`. - \`dev_server_stop\` / \`dev_server_list\` / \`dev_server_logs\` — use only AFTER a failed start, and only to diagnose the error the function returned. Never on success.