dev3000 0.0.116 → 0.0.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/cdp-monitor.d.ts +1 -0
  2. package/dist/cdp-monitor.d.ts.map +1 -1
  3. package/dist/cdp-monitor.js +11 -2
  4. package/dist/cdp-monitor.js.map +1 -1
  5. package/dist/dev-environment.d.ts.map +1 -1
  6. package/dist/dev-environment.js +45 -4
  7. package/dist/dev-environment.js.map +1 -1
  8. package/mcp-server/.next/BUILD_ID +1 -1
  9. package/mcp-server/.next/build-manifest.json +2 -2
  10. package/mcp-server/.next/fallback-build-manifest.json +2 -2
  11. package/mcp-server/.next/prerender-manifest.json +3 -3
  12. package/mcp-server/.next/server/app/.well-known/workflow/v1/step/route.js +1 -1
  13. package/mcp-server/.next/server/app/.well-known/workflow/v1/step/route.js.nft.json +1 -1
  14. package/mcp-server/.next/server/app/_global-error.html +2 -2
  15. package/mcp-server/.next/server/app/_global-error.rsc +1 -1
  16. package/mcp-server/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  17. package/mcp-server/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  18. package/mcp-server/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  19. package/mcp-server/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  20. package/mcp-server/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/mcp-server/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/mcp-server/.next/server/app/_not-found.html +1 -1
  23. package/mcp-server/.next/server/app/_not-found.rsc +2 -2
  24. package/mcp-server/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  25. package/mcp-server/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  26. package/mcp-server/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  27. package/mcp-server/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/mcp-server/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  29. package/mcp-server/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  30. package/mcp-server/.next/server/app/api/cloud/fix-workflow/route.js +1 -1
  31. package/mcp-server/.next/server/app/api/cloud/fix-workflow/route.js.nft.json +1 -1
  32. package/mcp-server/.next/server/app/api/cloud/start-fix/route.js +1 -1
  33. package/mcp-server/.next/server/app/api/cloud/start-fix/route.js.nft.json +1 -1
  34. package/mcp-server/.next/server/app/api/jank/[session]/route.js +1 -1
  35. package/mcp-server/.next/server/app/api/jank/[session]/route.js.nft.json +1 -1
  36. package/mcp-server/.next/server/app/auth/error/page_client-reference-manifest.js +1 -1
  37. package/mcp-server/.next/server/app/auth/error.html +1 -1
  38. package/mcp-server/.next/server/app/auth/error.rsc +2 -2
  39. package/mcp-server/.next/server/app/auth/error.segments/_full.segment.rsc +2 -2
  40. package/mcp-server/.next/server/app/auth/error.segments/_head.segment.rsc +1 -1
  41. package/mcp-server/.next/server/app/auth/error.segments/_index.segment.rsc +2 -2
  42. package/mcp-server/.next/server/app/auth/error.segments/_tree.segment.rsc +2 -2
  43. package/mcp-server/.next/server/app/auth/error.segments/auth/error/__PAGE__.segment.rsc +1 -1
  44. package/mcp-server/.next/server/app/auth/error.segments/auth/error.segment.rsc +1 -1
  45. package/mcp-server/.next/server/app/auth/error.segments/auth.segment.rsc +1 -1
  46. package/mcp-server/.next/server/app/index.html +1 -1
  47. package/mcp-server/.next/server/app/index.rsc +2 -2
  48. package/mcp-server/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  49. package/mcp-server/.next/server/app/index.segments/_full.segment.rsc +2 -2
  50. package/mcp-server/.next/server/app/index.segments/_head.segment.rsc +1 -1
  51. package/mcp-server/.next/server/app/index.segments/_index.segment.rsc +2 -2
  52. package/mcp-server/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  53. package/mcp-server/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  54. package/mcp-server/.next/server/app/mcp/route.js +1 -1
  55. package/mcp-server/.next/server/app/mcp/route.js.nft.json +1 -1
  56. package/mcp-server/.next/server/app/page_client-reference-manifest.js +1 -1
  57. package/mcp-server/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  58. package/mcp-server/.next/server/app/video/[session]/page_client-reference-manifest.js +1 -1
  59. package/mcp-server/.next/server/app/workflows/[id]/report/page.js +1 -1
  60. package/mcp-server/.next/server/app/workflows/[id]/report/page.js.nft.json +1 -1
  61. package/mcp-server/.next/server/app/workflows/[id]/report/page_client-reference-manifest.js +1 -1
  62. package/mcp-server/.next/server/app/workflows/new/page_client-reference-manifest.js +1 -1
  63. package/mcp-server/.next/server/app/workflows/page_client-reference-manifest.js +1 -1
  64. package/mcp-server/.next/server/chunks/{[root-of-the-server]__ec6a1335._.js → [root-of-the-server]__1095b0eb._.js} +2 -2
  65. package/mcp-server/.next/server/chunks/[root-of-the-server]__1095b0eb._.js.map +1 -0
  66. package/mcp-server/.next/server/chunks/[root-of-the-server]__157de66b._.js +3 -3
  67. package/mcp-server/.next/server/chunks/[root-of-the-server]__157de66b._.js.map +1 -1
  68. package/mcp-server/.next/server/chunks/[root-of-the-server]__18ce35ee._.js +3 -0
  69. package/mcp-server/.next/server/chunks/[root-of-the-server]__18ce35ee._.js.map +1 -0
  70. package/mcp-server/.next/server/chunks/{[root-of-the-server]__2920484d._.js → [root-of-the-server]__29c39fca._.js} +2 -2
  71. package/mcp-server/.next/server/chunks/{[root-of-the-server]__2920484d._.js.map → [root-of-the-server]__29c39fca._.js.map} +1 -1
  72. package/mcp-server/.next/server/chunks/[root-of-the-server]__55642730._.js +3 -0
  73. package/mcp-server/.next/server/chunks/[root-of-the-server]__55642730._.js.map +1 -0
  74. package/mcp-server/.next/server/chunks/[root-of-the-server]__730a8fd0._.js +1 -1
  75. package/mcp-server/.next/server/chunks/[root-of-the-server]__730a8fd0._.js.map +1 -1
  76. package/mcp-server/.next/server/chunks/{[root-of-the-server]__ece7a7f7._.js → [root-of-the-server]__951b3108._.js} +2 -2
  77. package/mcp-server/.next/server/chunks/{[root-of-the-server]__bcb77a22._.js → [root-of-the-server]__fd11bb92._.js} +2 -2
  78. package/mcp-server/.next/server/chunks/bee4f_next_dist_esm_build_templates_app-route_1ece9366.js +34 -4
  79. package/mcp-server/.next/server/chunks/bee4f_next_dist_esm_build_templates_app-route_1ece9366.js.map +1 -1
  80. package/mcp-server/.next/server/chunks/mcp-server_app_api_cloud_fix-workflow_steps_ts_b65f3271._.js +19 -19
  81. package/mcp-server/.next/server/chunks/mcp-server_app_api_cloud_fix-workflow_steps_ts_b65f3271._.js.map +1 -1
  82. package/mcp-server/.next/server/chunks/mcp-server_lib_workflow-storage_ts_30ca7761._.js +3 -0
  83. package/mcp-server/.next/server/chunks/mcp-server_lib_workflow-storage_ts_30ca7761._.js.map +1 -0
  84. package/mcp-server/.next/server/chunks/ssr/{[root-of-the-server]__bb161645._.js → [root-of-the-server]__34cc4876._.js} +2 -2
  85. package/mcp-server/.next/server/chunks/ssr/_cd4dc25e._.js.map +1 -1
  86. package/mcp-server/.next/server/chunks/ssr/mcp-server_app_workflows_new_new-workflow-client_tsx_1312c046._.js +1 -1
  87. package/mcp-server/.next/server/chunks/ssr/mcp-server_app_workflows_new_new-workflow-client_tsx_1312c046._.js.map +1 -1
  88. package/mcp-server/.next/server/server-reference-manifest.js +1 -1
  89. package/mcp-server/.next/server/server-reference-manifest.json +1 -1
  90. package/mcp-server/.next/static/chunks/{93db5737a327ab0c.js → 7b9a23e7f572d8a7.js} +1 -1
  91. package/mcp-server/.next/static/chunks/98585d170d82e3e8.css +1 -0
  92. package/mcp-server/app/api/cloud/fix-workflow/steps.ts +35 -4
  93. package/mcp-server/app/api/cloud/fix-workflow/workflow.ts +53 -1
  94. package/mcp-server/app/api/cloud/start-fix/route.ts +11 -2
  95. package/mcp-server/app/api/workflows/route.ts +36 -14
  96. package/mcp-server/app/workflows/new-workflow-modal.tsx +90 -23
  97. package/package.json +1 -1
  98. package/mcp-server/.next/server/chunks/[root-of-the-server]__c1681338._.js +0 -3
  99. package/mcp-server/.next/server/chunks/[root-of-the-server]__c1681338._.js.map +0 -1
  100. package/mcp-server/.next/server/chunks/[root-of-the-server]__ec6a1335._.js.map +0 -1
  101. package/mcp-server/.next/static/chunks/000849a6a897f531.css +0 -1
  102. /package/mcp-server/.next/server/chunks/{[root-of-the-server]__ece7a7f7._.js.map → [root-of-the-server]__951b3108._.js.map} +0 -0
  103. /package/mcp-server/.next/server/chunks/{[root-of-the-server]__bcb77a22._.js.map → [root-of-the-server]__fd11bb92._.js.map} +0 -0
  104. /package/mcp-server/.next/server/chunks/ssr/{[root-of-the-server]__bb161645._.js.map → [root-of-the-server]__34cc4876._.js.map} +0 -0
  105. /package/mcp-server/.next/static/{G5taiQ-Jp0B_MdvkQuoIT → GVm-012A2JbRg9oviNAqV}/_buildManifest.js +0 -0
  106. /package/mcp-server/.next/static/{G5taiQ-Jp0B_MdvkQuoIT → GVm-012A2JbRg9oviNAqV}/_clientMiddlewareManifest.json +0 -0
  107. /package/mcp-server/.next/static/{G5taiQ-Jp0B_MdvkQuoIT → GVm-012A2JbRg9oviNAqV}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mcp-server/app/api/cloud/fix-workflow/steps.ts"],"sourcesContent":["/**\n * Step functions for fix-workflow\n * Separated into their own module to avoid workflow bundler issues\n */ /**__internal_workflows{\"steps\":{\"app/api/cloud/fix-workflow/steps.ts\":{\"analyzeLogsWithAgent\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//analyzeLogsWithAgent\"},\"cleanupSandbox\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//cleanupSandbox\"},\"createD3kSandbox\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//createD3kSandbox\"},\"createGitHubPR\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//createGitHubPR\"},\"fetchRealLogs\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//fetchRealLogs\"},\"uploadToBlob\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//uploadToBlob\"}}}}*/;\n/**\n * Step 0: Create d3k sandbox with MCP tools pre-configured\n * Also captures a \"before\" screenshot of the app\n */ export async function createD3kSandbox(repoUrl, branch, projectName, vercelToken, vercelOidcToken) {\n console.log(`[Step 0] Creating d3k sandbox for ${projectName}...`);\n console.log(`[Step 0] Repository: ${repoUrl}`);\n console.log(`[Step 0] Branch: ${branch}`);\n // Log available token types\n console.log(`[Step 0] VERCEL_OIDC_TOKEN from env: ${!!process.env.VERCEL_OIDC_TOKEN}`);\n console.log(`[Step 0] VERCEL_OIDC_TOKEN passed as param: ${!!vercelOidcToken}`);\n console.log(`[Step 0] VERCEL_TOKEN available: ${!!process.env.VERCEL_TOKEN}`);\n console.log(`[Step 0] User access token provided: ${!!vercelToken}`);\n // Set VERCEL_OIDC_TOKEN if passed from workflow context\n // This is necessary because workflow steps don't automatically inherit environment variables\n if (vercelOidcToken && !process.env.VERCEL_OIDC_TOKEN) {\n process.env.VERCEL_OIDC_TOKEN = vercelOidcToken;\n console.log(`[Step 0] Set VERCEL_OIDC_TOKEN from workflow context`);\n }\n const sandboxResult = await createD3kSandboxUtil({\n repoUrl,\n branch,\n projectDir: \"\",\n packageManager: \"pnpm\",\n debug: true\n });\n console.log(`[Step 0] Sandbox created successfully`);\n console.log(`[Step 0] Dev URL: ${sandboxResult.devUrl}`);\n console.log(`[Step 0] MCP URL: ${sandboxResult.mcpUrl}`);\n // Get the chromium path for screenshots\n console.log(`[Step 0] Getting Chromium path for screenshots...`);\n let chromiumPath = \"/tmp/chromium\";\n try {\n const chromiumResult = await runSandboxCommand(sandboxResult.sandbox, \"node\", [\n \"-e\",\n \"require('@sparticuz/chromium').executablePath().then(p => console.log(p))\"\n ]);\n if (chromiumResult.exitCode === 0 && chromiumResult.stdout.trim()) {\n chromiumPath = chromiumResult.stdout.trim();\n console.log(`[Step 0] Chromium path: ${chromiumPath}`);\n }\n } catch {\n console.log(`[Step 0] Could not get chromium path, using default: ${chromiumPath}`);\n }\n // CRITICAL DIAGNOSTIC: Test Chrome with EXACT d3k command\n // d3k uses: --user-data-dir, no --remote-debugging-address, loading page, etc.\n console.log(`[Step 0] ===== CHROMIUM CDP TEST (d3k exact command) =====`);\n try {\n const chromeTestScript = `\n exec 2>&1\n echo \"=== Chromium CDP Test (d3k exact command) ===\"\n echo \"Chromium path: ${chromiumPath}\"\n echo \"\"\n\n # Create user-data-dir like d3k does\n USER_DATA_DIR=\"/tmp/d3k-test-profile\"\n mkdir -p \"$USER_DATA_DIR\"\n echo \"1. Created user-data-dir: $USER_DATA_DIR\"\n\n # Create loading page like d3k does\n LOADING_DIR=\"/tmp/dev3000-loading\"\n mkdir -p \"$LOADING_DIR\"\n cat > \"$LOADING_DIR/loading.html\" << 'LOADINGHTML'\n<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body><h1>Loading dev3000...</h1></body>\n</html>\nLOADINGHTML\n echo \"2. Created loading page: $LOADING_DIR/loading.html\"\n echo \"\"\n\n # Use EXACT d3k command (from cdp-monitor.ts)\n # Note: d3k does NOT use --remote-debugging-address\n echo \"3. Starting Chrome with d3k's exact args...\"\n echo \" Command: ${chromiumPath} --remote-debugging-port=9222 --user-data-dir=$USER_DATA_DIR --no-first-run --no-default-browser-check --disable-component-extensions-with-background-pages --disable-background-networking --disable-sync --metrics-recording-only --disable-default-apps --disable-session-crashed-bubble --disable-restore-session-state --headless=new --no-sandbox --disable-setuid-sandbox --disable-gpu --disable-dev-shm-usage file://$LOADING_DIR/loading.html\"\n\n timeout 15 \"${chromiumPath}\" \\\\\n --remote-debugging-port=9222 \\\\\n --user-data-dir=\"$USER_DATA_DIR\" \\\\\n --no-first-run \\\\\n --no-default-browser-check \\\\\n --disable-component-extensions-with-background-pages \\\\\n --disable-background-networking \\\\\n --disable-sync \\\\\n --metrics-recording-only \\\\\n --disable-default-apps \\\\\n --disable-session-crashed-bubble \\\\\n --disable-restore-session-state \\\\\n --headless=new \\\\\n --no-sandbox \\\\\n --disable-setuid-sandbox \\\\\n --disable-gpu \\\\\n --disable-dev-shm-usage \\\\\n \"file://$LOADING_DIR/loading.html\" &\n PID=$!\n echo \" Chrome PID: $PID\"\n sleep 3\n echo \"\"\n\n echo \"4. Checking if Chrome is still running...\"\n if ps -p $PID > /dev/null 2>&1; then\n echo \" Chrome is RUNNING after 3s\"\n echo \"\"\n echo \"5. Trying CDP (note: d3k doesn't use --remote-debugging-address)...\"\n echo \" Trying 127.0.0.1...\"\n curl -s --max-time 5 http://127.0.0.1:9222/json/version 2>&1 || echo \" 127.0.0.1 failed\"\n echo \"\"\n echo \" Trying localhost...\"\n curl -s --max-time 5 http://localhost:9222/json/version 2>&1 || echo \" localhost failed\"\n echo \"\"\n echo \"6. Checking what's listening on 9222...\"\n ss -tlnp 2>/dev/null | grep 9222 || netstat -tlnp 2>/dev/null | grep 9222 || echo \" Could not check listening ports\"\n echo \"\"\n echo \"7. Killing test Chrome...\"\n kill $PID 2>/dev/null\n else\n echo \" Chrome DIED within 3s\"\n wait $PID 2>/dev/null\n EXIT_CODE=$?\n echo \" Exit code: $EXIT_CODE\"\n echo \"\"\n echo \" Checking for crash logs...\"\n ls -la \"$USER_DATA_DIR\" 2>&1 | head -10 || echo \" No user-data-dir\"\n fi\n echo \"\"\n echo \"=== End d3k exact command test ===\"\n `;\n const chromeTest = await runSandboxCommand(sandboxResult.sandbox, \"bash\", [\n \"-c\",\n chromeTestScript\n ]);\n console.log(`[Step 0] d3k Chrome test (exit ${chromeTest.exitCode}):\\n${chromeTest.stdout || \"(no output)\"}`);\n if (chromeTest.stderr) console.log(`[Step 0] d3k Chrome test stderr: ${chromeTest.stderr}`);\n } catch (error) {\n console.log(`[Step 0] d3k Chrome test error: ${error instanceof Error ? error.message : String(error)}`);\n }\n console.log(`[Step 0] ===== END d3k EXACT COMMAND TEST =====`);\n // Capture \"BEFORE\" screenshot - this shows the app before any fixes\n console.log(`[Step 0] Capturing BEFORE screenshot...`);\n let beforeScreenshotUrl = null;\n try {\n const beforeBase64 = await captureScreenshotInSandbox(sandboxResult.sandbox, \"http://localhost:3000\", chromiumPath, \"before\");\n if (beforeBase64) {\n beforeScreenshotUrl = await uploadScreenshot(beforeBase64, \"before\", projectName);\n }\n } catch (error) {\n console.log(`[Step 0] Before screenshot failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n // Now capture CLS and errors using MCP from INSIDE the sandbox\n console.log(`[Step 0] Capturing CLS metrics from inside sandbox...`);\n let clsData = null;\n let mcpError = null;\n try {\n // Call fix_my_app MCP tool via curl from inside the sandbox\n // This avoids network isolation issues - we're calling localhost:3684 from within the sandbox\n const mcpCommand = `curl -s -X POST http://localhost:3684/mcp -H \"Content-Type: application/json\" -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"fix_my_app\",\"arguments\":{\"mode\":\"snapshot\",\"focusArea\":\"performance\",\"returnRawData\":true}}}'`;\n console.log(`[Step 0] Executing MCP command inside sandbox...`);\n console.log(`[Step 0] MCP command: ${mcpCommand.substring(0, 200)}...`);\n let stdout = \"\";\n let stderr = \"\";\n let exitCode = -1;\n try {\n const result = await runSandboxCommand(sandboxResult.sandbox, \"bash\", [\n \"-c\",\n mcpCommand\n ]);\n stdout = result.stdout;\n stderr = result.stderr;\n exitCode = result.exitCode;\n console.log(`[Step 0] MCP command exit code: ${exitCode}`);\n console.log(`[Step 0] MCP stdout length: ${stdout.length} bytes`);\n if (stderr) {\n console.log(`[Step 0] MCP stderr: ${stderr.substring(0, 500)}`);\n }\n } catch (runCommandError) {\n const errorMsg = runCommandError instanceof Error ? runCommandError.message : String(runCommandError);\n console.log(`[Step 0] sandbox.runCommand threw: ${errorMsg}`);\n mcpError = `sandbox.runCommand failed: ${errorMsg}`;\n }\n if (exitCode === 0 && stdout) {\n try {\n const mcpResponse = JSON.parse(stdout);\n if (mcpResponse.result?.content) {\n // Extract the actual data from MCP response\n const contentArray = mcpResponse.result.content;\n for (const item of contentArray){\n if (item.type === \"text\" && item.text) {\n // Try to parse the text as JSON if it contains structured data\n try {\n clsData = JSON.parse(item.text);\n console.log(`[Step 0] Successfully parsed CLS data`);\n break;\n } catch {\n // If not JSON, treat as plain text\n clsData = {\n rawOutput: item.text\n };\n }\n }\n }\n }\n console.log(`[Step 0] CLS data captured:`, JSON.stringify(clsData).substring(0, 500));\n } catch (parseError) {\n mcpError = `Failed to parse MCP response: ${parseError instanceof Error ? parseError.message : String(parseError)}`;\n console.log(`[Step 0] ${mcpError}`);\n console.log(`[Step 0] Raw stdout: ${stdout.substring(0, 1000)}`);\n }\n } else if (exitCode !== 0 && !mcpError) {\n mcpError = `MCP command failed with exit code ${exitCode}`;\n console.log(`[Step 0] ${mcpError}`);\n if (stderr) {\n console.log(`[Step 0] stderr: ${stderr}`);\n }\n }\n } catch (error) {\n mcpError = `MCP execution error: ${error instanceof Error ? error.message : String(error)}`;\n console.log(`[Step 0] ${mcpError}`);\n }\n // Dump all sandbox logs before returning for debugging\n console.log(`[Step 0] === Dumping sandbox logs before returning ===`);\n try {\n const logsResult = await runSandboxCommand(sandboxResult.sandbox, \"sh\", [\n \"-c\",\n 'for log in /home/vercel-sandbox/.d3k/logs/*.log; do [ -f \"$log\" ] && echo \"=== $log ===\" && tail -100 \"$log\" || true; done 2>/dev/null || echo \"No log files found\"'\n ]);\n console.log(logsResult.stdout);\n } catch (logsError) {\n console.log(`[Step 0] Failed to dump logs: ${logsError instanceof Error ? logsError.message : String(logsError)}`);\n }\n console.log(`[Step 0] === End sandbox log dump ===`);\n // Capture git diff from sandbox - this shows any changes made by d3k\n console.log(`[Step 0] Capturing git diff from sandbox...`);\n let gitDiff = null;\n try {\n const diffResult = await runSandboxCommand(sandboxResult.sandbox, \"sh\", [\n \"-c\",\n \"cd /vercel/sandbox && git diff --no-color 2>/dev/null || echo 'No git diff available'\"\n ]);\n if (diffResult.exitCode === 0 && diffResult.stdout.trim() && diffResult.stdout.trim() !== \"No git diff available\") {\n gitDiff = diffResult.stdout.trim();\n console.log(`[Step 0] Git diff captured (${gitDiff.length} chars)`);\n console.log(`[Step 0] Git diff preview:\\n${gitDiff.substring(0, 500)}...`);\n } else {\n console.log(`[Step 0] No git changes detected in sandbox`);\n }\n } catch (diffError) {\n console.log(`[Step 0] Failed to capture git diff: ${diffError instanceof Error ? diffError.message : String(diffError)}`);\n }\n // Note: We cannot return the cleanup function or sandbox object as they're not serializable\n // Sandbox cleanup will happen automatically when the sandbox times out\n return {\n mcpUrl: sandboxResult.mcpUrl,\n devUrl: sandboxResult.devUrl,\n bypassToken: sandboxResult.bypassToken,\n clsData,\n mcpError,\n beforeScreenshotUrl,\n chromiumPath,\n gitDiff\n };\n}\n/**\n * Step 1: Use browser automation to capture real errors\n * Uses d3k MCP server in sandbox (if available) or AI Gateway for browser automation\n */ export async function fetchRealLogs(mcpUrlOrDevUrl, bypassToken, sandboxDevUrl, clsData, mcpError, beforeScreenshotUrlFromStep0) {\n // If we already have CLS data from Step 0, use it along with the screenshot\n if (clsData) {\n console.log(\"[Step 1] Using CLS data captured in Step 0\");\n if (beforeScreenshotUrlFromStep0) {\n console.log(`[Step 1] Before screenshot from Step 0: ${beforeScreenshotUrlFromStep0}`);\n }\n return {\n logAnalysis: JSON.stringify(clsData, null, 2),\n beforeScreenshotUrl: beforeScreenshotUrlFromStep0 || null\n };\n }\n // If there was an MCP error in Step 0, log it\n if (mcpError) {\n console.log(`[Step 1] Note: MCP error from Step 0: ${mcpError}`);\n }\n // Determine if we're using sandbox MCP or direct dev URL\n const isSandbox = !!sandboxDevUrl;\n const devUrl = sandboxDevUrl || mcpUrlOrDevUrl;\n const mcpUrl = isSandbox ? mcpUrlOrDevUrl : null;\n console.log(`[Step 1] Fetching logs from: ${devUrl}`);\n console.log(`[Step 1] Using sandbox: ${isSandbox ? \"yes\" : \"no\"}`);\n if (mcpUrl) {\n console.log(`[Step 1] MCP URL: ${mcpUrl}`);\n }\n console.log(`[Step 1] Bypass token: ${bypassToken ? \"provided\" : \"not provided\"}`);\n try {\n // Construct URL with bypass token if provided\n const urlWithBypass = bypassToken ? `${devUrl}?x-vercel-protection-bypass=${bypassToken}` : devUrl;\n console.log(`[Step 1] Final URL: ${urlWithBypass.replace(bypassToken || \"\", \"***\")}`);\n if (isSandbox && mcpUrl) {\n // Use d3k MCP server in sandbox - capture CLS metrics and errors\n console.log(\"[Step 1] Using d3k MCP server to capture CLS metrics and errors...\");\n // First, validate MCP server access and list available tools\n // Use a 30-second timeout to avoid hanging the entire workflow\n console.log(\"[Step 1] Validating d3k MCP server access...\");\n const validationController = new AbortController();\n const validationTimeout = setTimeout(()=>validationController.abort(), 30000);\n try {\n const toolsResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/list\"\n }),\n signal: validationController.signal\n });\n clearTimeout(validationTimeout);\n if (toolsResponse.ok) {\n const toolsText = await toolsResponse.text();\n try {\n // Parse SSE response format: \"event: message\\ndata: {...}\\n\\n\"\n let toolsData = null;\n const lines = toolsText.split(\"\\n\");\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n try {\n toolsData = JSON.parse(line.substring(6));\n break;\n } catch {\n // Continue to next line\n }\n }\n }\n // Fallback: try parsing the whole response as JSON (non-SSE format)\n if (!toolsData) {\n toolsData = JSON.parse(toolsText);\n }\n const toolNames = toolsData.result?.tools?.map((t)=>t.name) || [];\n console.log(`[Step 1] ✅ d3k MCP server accessible`);\n console.log(`[Step 1] Available tools (${toolNames.length}): ${toolNames.join(\", \")}`);\n // Check for expected chrome-devtools and nextjs-dev tools\n const hasChrome = toolNames.some((name)=>name.includes(\"chrome-devtools\"));\n const hasNextjs = toolNames.some((name)=>name.includes(\"nextjs\"));\n const hasFixMyApp = toolNames.includes(\"fix_my_app\");\n console.log(`[Step 1] Chrome DevTools MCP: ${hasChrome ? \"✅\" : \"❌\"}`);\n console.log(`[Step 1] Next.js DevTools MCP: ${hasNextjs ? \"✅\" : \"❌\"}`);\n console.log(`[Step 1] fix_my_app tool: ${hasFixMyApp ? \"✅\" : \"❌\"}`);\n } catch {\n console.log(`[Step 1] MCP server responded but couldn't parse tools list: ${toolsText.substring(0, 200)}`);\n }\n } else {\n console.log(`[Step 1] ⚠️ MCP server not accessible: ${toolsResponse.status}`);\n }\n } catch (error) {\n clearTimeout(validationTimeout);\n const errorMsg = error instanceof Error ? error.message : String(error);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] ⚠️ Failed to validate MCP server: ${isTimeout ? \"Timed out after 30s\" : errorMsg}`);\n }\n // Navigate to the app to generate logs (with 30s timeout)\n console.log(\"[Step 1] Navigating browser to app URL...\");\n const navController = new AbortController();\n const navTimeout = setTimeout(()=>navController.abort(), 30000);\n try {\n const navResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/call\",\n params: {\n name: \"execute_browser_action\",\n arguments: {\n action: \"navigate\",\n params: {\n url: urlWithBypass\n }\n }\n }\n }),\n signal: navController.signal\n });\n clearTimeout(navTimeout);\n if (navResponse.ok) {\n console.log(\"[Step 1] Browser navigation completed\");\n } else {\n console.log(`[Step 1] Browser navigation failed: ${navResponse.status}`);\n }\n } catch (navError) {\n clearTimeout(navTimeout);\n const isTimeout = navError instanceof Error && navError.name === \"AbortError\";\n console.log(`[Step 1] Browser navigation error: ${isTimeout ? \"Timed out after 30s\" : navError instanceof Error ? navError.message : String(navError)}`);\n }\n // Wait for page to fully load\n console.log(\"[Step 1] Waiting 5s for page load...\");\n await new Promise((resolve)=>setTimeout(resolve, 5000));\n // Capture \"before\" screenshot to prove the page loaded and for later comparison\n let beforeScreenshotUrl = null;\n console.log(\"[Step 1] Capturing 'before' screenshot...\");\n const screenshotController = new AbortController();\n const screenshotTimeout = setTimeout(()=>screenshotController.abort(), 30000);\n try {\n const screenshotResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/call\",\n params: {\n name: \"chrome-devtools_take_snapshot\",\n arguments: {}\n }\n }),\n signal: screenshotController.signal\n });\n clearTimeout(screenshotTimeout);\n if (screenshotResponse.ok) {\n const screenshotText = await screenshotResponse.text();\n // Parse SSE response to get screenshot data\n const lines = screenshotText.split(\"\\n\");\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n try {\n const json = JSON.parse(line.substring(6));\n if (json.result?.content) {\n for (const content of json.result.content){\n if (content.type === \"image\" && content.data) {\n // Upload base64 image to Vercel Blob\n const imageBuffer = Buffer.from(content.data, \"base64\");\n const timestamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n const filename = `screenshot-before-${timestamp}.png`;\n const blob = await put(filename, imageBuffer, {\n access: \"public\",\n contentType: \"image/png\"\n });\n beforeScreenshotUrl = blob.url;\n console.log(`[Step 1] ✅ Before screenshot uploaded: ${beforeScreenshotUrl}`);\n }\n }\n }\n } catch {\n // Continue parsing other lines\n }\n }\n }\n if (!beforeScreenshotUrl) {\n console.log(`[Step 1] Screenshot response received but no image data found`);\n console.log(`[Step 1] Response preview: ${screenshotText.substring(0, 500)}`);\n }\n } else {\n console.log(`[Step 1] Screenshot request failed: ${screenshotResponse.status}`);\n }\n } catch (error) {\n clearTimeout(screenshotTimeout);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] Screenshot capture error: ${isTimeout ? \"Timed out after 30s\" : error instanceof Error ? error.message : String(error)}`);\n }\n // Check d3k logs to see if it's capturing data (with 15s timeout)\n console.log(\"[Step 1] Fetching d3k logs from sandbox to verify it's working...\");\n const logsController = new AbortController();\n const logsTimeout = setTimeout(()=>logsController.abort(), 15000);\n try {\n const logsResponse = await fetch(`${mcpUrl}/api/logs`, {\n signal: logsController.signal\n });\n clearTimeout(logsTimeout);\n if (logsResponse.ok) {\n const logsText = await logsResponse.text();\n console.log(`[Step 1] d3k logs (last 1000 chars):\\n${logsText.slice(-1000)}`);\n } else {\n console.log(`[Step 1] Could not fetch d3k logs: ${logsResponse.status}`);\n }\n } catch (error) {\n clearTimeout(logsTimeout);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] Failed to fetch d3k logs: ${isTimeout ? \"Timed out after 15s\" : error instanceof Error ? error.message : String(error)}`);\n }\n // Call fix_my_app with focusArea='performance' to capture CLS and jank\n console.log(\"[Step 1] Calling fix_my_app with focusArea='performance'...\");\n // Set a 3-minute timeout for the MCP call\n const controller = new AbortController();\n const timeoutId = setTimeout(()=>controller.abort(), 3 * 60 * 1000);\n try {\n const mcpResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"tools/call\",\n params: {\n name: \"fix_my_app\",\n arguments: {\n mode: \"snapshot\",\n focusArea: \"performance\",\n timeRangeMinutes: 5,\n returnRawData: false\n }\n }\n }),\n signal: controller.signal\n });\n clearTimeout(timeoutId);\n if (!mcpResponse.ok) {\n throw new Error(`MCP request failed: ${mcpResponse.status}`);\n }\n // Parse SSE response\n const text = await mcpResponse.text();\n console.log(`[Step 1] fix_my_app response length: ${text.length} bytes`);\n console.log(`[Step 1] fix_my_app response preview (first 500 chars):\\n${text.substring(0, 500)}`);\n const lines = text.split(\"\\n\");\n console.log(`[Step 1] Response split into ${lines.length} lines`);\n let logAnalysis = \"\";\n let linesProcessed = 0;\n let contentBlocks = 0;\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n linesProcessed++;\n try {\n const json = JSON.parse(line.substring(6));\n console.log(`[Step 1] Parsed JSON line ${linesProcessed}:`, JSON.stringify(json).substring(0, 200));\n if (json.result?.content) {\n for (const content of json.result.content){\n if (content.type === \"text\") {\n contentBlocks++;\n logAnalysis += content.text;\n console.log(`[Step 1] Added text content block ${contentBlocks}, length: ${content.text.length}`);\n }\n }\n } else if (json.error) {\n console.log(`[Step 1] ERROR in response: ${JSON.stringify(json.error)}`);\n }\n } catch (error) {\n console.log(`[Step 1] Failed to parse JSON line ${linesProcessed}: ${error instanceof Error ? error.message : String(error)}`);\n console.log(`[Step 1] Problem line: ${line.substring(0, 200)}`);\n }\n }\n }\n console.log(`[Step 1] Processed ${linesProcessed} data lines, ${contentBlocks} content blocks`);\n console.log(`[Step 1] Got ${logAnalysis.length} chars from fix_my_app (performance analysis)`);\n if (logAnalysis.length === 0) {\n console.log(`[Step 1] WARNING: fix_my_app returned NO data. Full response:\\n${text}`);\n }\n return {\n logAnalysis: `d3k Performance Analysis for ${devUrl}\\n\\n${logAnalysis}`,\n beforeScreenshotUrl\n };\n } catch (error) {\n clearTimeout(timeoutId);\n if (error instanceof Error && error.name === \"AbortError\") {\n console.log(\"[Step 1] fix_my_app timed out after 3 minutes, using fallback method\");\n // Fall through to fallback method below\n } else {\n console.log(`[Step 1] fix_my_app error: ${error instanceof Error ? error.message : String(error)}`);\n // Fall through to fallback method below\n }\n }\n }\n // Fallback: Use AI Gateway with browser automation prompting\n console.log(\"[Step 1] Using AI Gateway with browser automation...\");\n const gateway = createGateway({\n apiKey: process.env.AI_GATEWAY_API_KEY,\n baseURL: \"https://ai-gateway.vercel.sh/v1/ai\"\n });\n const model = gateway(\"anthropic/claude-sonnet-4-20250514\");\n const prompt = `You are a web application debugger with access to browser automation tools via Playwright MCP.\n\nYour task is to visit this URL and capture any errors, warnings, or issues:\n${urlWithBypass}\n\nSteps to follow:\n1. Use browser_eval with action=\"start\" to start the browser\n2. Use browser_eval with action=\"navigate\" and params={url: \"${urlWithBypass}\"} to navigate to the page\n3. Wait a few seconds for the page to fully load and JavaScript to execute\n4. Use browser_eval with action=\"console_messages\" to get all browser console output (errors, warnings, logs)\n5. Use browser_eval with action=\"screenshot\" to capture a screenshot\n6. Use browser_eval with action=\"close\" to close the browser\n\nAnalyze the console messages and provide a detailed report including:\n- All console errors (with full stack traces if available)\n- All console warnings\n- HTTP status codes or network errors\n- Any visual issues you can identify from the screenshot\n- Screenshot URL if captured\n\nFormat your response as a clear, structured report that helps identify what's broken in the application.`;\n const { text } = await generateText({\n model,\n prompt,\n toolChoice: \"auto\",\n // @ts-expect-error - AI SDK types for maxTokens are incomplete\n maxTokens: 4000\n });\n console.log(`[Step 1] Browser automation response (first 500 chars): ${text.substring(0, 500)}...`);\n return {\n logAnalysis: `Browser Automation Analysis for ${devUrl}\\n\\n${text}`,\n beforeScreenshotUrl: null\n };\n } catch (error) {\n console.error(\"[Step 1] Error with browser automation:\", error);\n // Fallback to simple fetch if browser automation fails\n console.log(\"[Step 1] Falling back to simple HTTP fetch...\");\n try {\n const urlWithBypass = bypassToken ? `${devUrl}?x-vercel-protection-bypass=${bypassToken}` : devUrl;\n const headers = {\n \"User-Agent\": \"dev3000-cloud-fix/1.0\",\n Accept: \"text/html,application/json,*/*\"\n };\n if (bypassToken) {\n headers[\"x-vercel-protection-bypass\"] = bypassToken;\n }\n const response = await fetch(urlWithBypass, {\n method: \"GET\",\n headers\n });\n const body = await response.text();\n // Extract and log page title from HTML\n const titleMatch = body.match(/<title[^>]*>([^<]*)<\\/title>/i);\n const pageTitle = titleMatch ? titleMatch[1].trim() : \"(no title found)\";\n console.log(`[Step 1] HTTP fallback - Page title: \"${pageTitle}\"`);\n let logAnalysis = `Dev Server URL: ${devUrl}\\n`;\n logAnalysis += `Page Title: ${pageTitle}\\n`;\n logAnalysis += `HTTP Status: ${response.status} ${response.statusText}\\n\\n`;\n logAnalysis += `Note: Browser automation failed, using fallback HTTP fetch.\\n\\n`;\n if (!response.ok) {\n logAnalysis += `ERROR: HTTP ${response.status} ${response.statusText}\\n\\n`;\n }\n if (body.includes(\"ReferenceError\") || body.includes(\"Error\") || body.includes(\"error\")) {\n logAnalysis += `Response body contains error information:\\n${body.substring(0, 5000)}\\n\\n`;\n } else if (!response.ok) {\n logAnalysis += `Response body:\\n${body.substring(0, 2000)}\\n\\n`;\n } else {\n logAnalysis += \"No errors detected in response.\\n\";\n }\n return {\n logAnalysis,\n beforeScreenshotUrl: null\n };\n } catch (fallbackError) {\n const errorMessage = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);\n return {\n logAnalysis: `Failed to fetch logs from ${devUrl}\\n\\nError: ${errorMessage}\\n\\nThis may indicate the dev server is not accessible or has crashed.`,\n beforeScreenshotUrl: null\n };\n }\n }\n}\n/**\n * Step 2: Invoke AI agent to analyze logs and propose fixes\n * Uses AI SDK with AI Gateway for multi-model support\n */ export async function analyzeLogsWithAgent(logAnalysis, devUrl) {\n console.log(\"[Step 2] Invoking AI agent to analyze logs...\");\n // Create AI Gateway instance\n const gateway = createGateway({\n apiKey: process.env.AI_GATEWAY_API_KEY,\n baseURL: \"https://ai-gateway.vercel.sh/v1/ai\"\n });\n // Use Claude Sonnet 4 via AI Gateway\n const model = gateway(\"anthropic/claude-sonnet-4-20250514\");\n const prompt = `You are a skilled software engineer debugging an application.\n\nThe dev server is running at: ${devUrl}\n\nHere's the log analysis from the MCP fix_my_app tool:\n${logAnalysis}\n\nYour task:\n1. Identify the most critical error or issue from the logs\n2. Determine the root cause\n3. Propose a specific code fix with file paths and changes\n4. Create a git-style unified diff that can be applied with 'git apply'\n5. Explain why this fix will resolve the issue\n\nFormat your response EXACTLY as follows:\n\n## Issue\n[Brief description of the issue]\n\n## Root Cause\n[Explanation of what's causing the issue]\n\n## Proposed Fix\n[High-level explanation of the fix]\n\n## Git Patch\n\\`\\`\\`diff\n[Full unified diff format that can be applied with 'git apply' or 'patch']\n[Include file paths, line numbers, and exact changes]\n[Example format:]\n[diff --git a/path/to/file.ts b/path/to/file.ts]\n[index abc123..def456 100644]\n[--- a/path/to/file.ts]\n[+++ b/path/to/file.ts]\n[@@ -10,7 +10,7 @@ function example() {]\n[ unchanged line]\n[- old line to remove]\n[+ new line to add]\n[ unchanged line]\n\\`\\`\\`\n\n## Reasoning\n[Why this fix will work]\n\nIMPORTANT:\n- The Git Patch section must be a valid unified diff that can be applied directly with 'git apply'.\n- If no errors are found, respond with \"✅ **SYSTEM HEALTHY** - No errors found\" and do NOT include a Git Patch section.\n- Only include a Git Patch if there are actual issues that need fixing.`;\n const { text } = await generateText({\n model,\n prompt\n });\n console.log(`[Step 2] AI agent response (first 500 chars): ${text.substring(0, 500)}...`);\n return text;\n}\n/**\n * Step 3: Upload fix proposal to blob storage and return URL\n */ export async function uploadToBlob(fixProposal, projectName, logAnalysis, devUrl, beforeScreenshotUrl, gitDiff) {\n console.log(\"[Step 3] Uploading fix proposal to blob storage...\");\n if (beforeScreenshotUrl) {\n console.log(`[Step 3] Including before screenshot: ${beforeScreenshotUrl}`);\n }\n if (gitDiff) {\n console.log(`[Step 3] Including git diff (${gitDiff.length} chars)`);\n }\n // Create screenshot section if we have a screenshot\n const screenshotSection = beforeScreenshotUrl ? `## Before Screenshot\n\nThis screenshot was captured when the sandbox dev server first loaded, proving the page rendered successfully.\n\n![Before Screenshot](${beforeScreenshotUrl})\n\n---\n\n` : \"\";\n // Create git diff section if we have a diff from the sandbox\n const gitDiffSection = gitDiff ? `## Actual Git Diff from Sandbox\n\nThe following diff shows the actual changes made by d3k in the sandbox environment:\n\n\\`\\`\\`diff\n${gitDiff}\n\\`\\`\\`\n\n---\n\n` : \"\";\n // Create enhanced markdown with full context and attribution\n const timestamp = new Date().toISOString();\n const enhancedMarkdown = `# Fix Proposal for ${projectName}\n\n**Generated**: ${timestamp}\n\n**Powered by**: [dev3000](https://github.com/vercel-labs/dev3000) with Claude Code\n\n**Dev Server**: ${devUrl}\n\n---\n\n${screenshotSection}${gitDiffSection}## Original Log Analysis\n\n\\`\\`\\`\n${logAnalysis}\n\\`\\`\\`\n\n---\n\n${fixProposal}\n\n---\n\n## Attribution\n\nThis fix proposal was automatically generated by [dev3000](https://github.com/vercel-labs/dev3000),\nan AI-powered debugging tool that analyzes your application logs and suggests fixes.\n\n**Co-Authored-By**: Claude (dev3000) <noreply@anthropic.com>\n\n### About dev3000\n\ndev3000 monitors your development server, captures errors in real-time, and uses AI to:\n- Analyze error logs and stack traces\n- Identify root causes\n- Generate actionable fix proposals with git patches\n- Suggest specific code changes\n\nLearn more at https://github.com/vercel-labs/dev3000\n`;\n // Upload to Vercel Blob Storage\n const filenameTimestamp = timestamp.replace(/[:.]/g, \"-\");\n const filename = `fix-${projectName}-${filenameTimestamp}.md`;\n const blob = await put(filename, enhancedMarkdown, {\n access: \"public\",\n contentType: \"text/markdown\"\n });\n console.log(`[Step 3] Fix proposal uploaded to: ${blob.url}`);\n return {\n success: true,\n projectName,\n fixProposal,\n blobUrl: blob.url,\n beforeScreenshotUrl: beforeScreenshotUrl || null,\n message: \"Fix analysis completed and uploaded to blob storage\"\n };\n}\n/**\n * Step 4: Create GitHub PR with the fix\n * Uses GitHub API to create a branch, commit the patch, and open a PR\n */ export async function createGitHubPR(fixProposal, blobUrl, repoOwner, repoName, baseBranch, projectName) {\n console.log(`[Step 4] Creating GitHub PR for ${repoOwner}/${repoName}...`);\n const githubToken = process.env.GITHUB_TOKEN;\n if (!githubToken) {\n console.error(\"[Step 4] GITHUB_TOKEN not found in environment\");\n return {\n success: false,\n error: \"GitHub token not configured\"\n };\n }\n try {\n // Extract the git patch from the fix proposal\n const patchMatch = fixProposal.match(/```diff\\n([\\s\\S]*?)\\n```/);\n if (!patchMatch) {\n console.error(\"[Step 4] No git patch found in fix proposal\");\n return {\n success: false,\n error: \"No git patch found in fix proposal\"\n };\n }\n const patch = patchMatch[1];\n console.log(`[Step 4] Extracted patch (${patch.length} chars)`);\n // Parse the patch to extract file changes\n const fileChanges = parsePatchToFileChanges(patch);\n if (fileChanges.length === 0) {\n console.error(\"[Step 4] Failed to parse any file changes from patch\");\n return {\n success: false,\n error: \"Failed to parse file changes from patch\"\n };\n }\n console.log(`[Step 4] Parsed ${fileChanges.length} file change(s)`);\n // Create a unique branch name\n const branchName = `dev3000-fix-${projectName}-${Date.now()}`;\n console.log(`[Step 4] Branch name: ${branchName}`);\n // Get the base branch SHA\n const baseRef = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/git/ref/heads/${baseBranch}`, {\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\"\n }\n });\n if (!baseRef.ok) {\n const error = await baseRef.text();\n console.error(`[Step 4] Failed to get base branch: ${error}`);\n return {\n success: false,\n error: `Failed to get base branch: ${baseRef.status}`\n };\n }\n const baseData = await baseRef.json();\n const baseSha = baseData.object.sha;\n console.log(`[Step 4] Base SHA: ${baseSha}`);\n // Create new branch\n const createBranch = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/git/refs`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n ref: `refs/heads/${branchName}`,\n sha: baseSha\n })\n });\n if (!createBranch.ok) {\n const error = await createBranch.text();\n console.error(`[Step 4] Failed to create branch: ${error}`);\n return {\n success: false,\n error: `Failed to create branch: ${createBranch.status}`\n };\n }\n console.log(`[Step 4] Created branch: ${branchName}`);\n // For each file, fetch current content, apply changes, and commit\n for (const fileChange of fileChanges){\n console.log(`[Step 4] Processing file: ${fileChange.path}`);\n // Get current file content\n const fileResp = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/contents/${fileChange.path}?ref=${branchName}`, {\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\"\n }\n });\n let currentContent = \"\";\n let currentSha = \"\";\n if (fileResp.ok) {\n const fileData = await fileResp.json();\n currentSha = fileData.sha;\n currentContent = Buffer.from(fileData.content, \"base64\").toString(\"utf-8\");\n } else {\n console.log(`[Step 4] File doesn't exist, will create new file`);\n }\n // Apply the patch changes to the content\n const newContent = applyPatchChanges(currentContent, fileChange.changes);\n // Update file\n const updateFile = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/contents/${fileChange.path}`, {\n method: \"PUT\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n message: `Fix: Apply dev3000 fix for ${projectName}`,\n content: Buffer.from(newContent).toString(\"base64\"),\n branch: branchName,\n ...currentSha && {\n sha: currentSha\n }\n })\n });\n if (!updateFile.ok) {\n const error = await updateFile.text();\n console.error(`[Step 4] Failed to update file ${fileChange.path}: ${error}`);\n return {\n success: false,\n error: `Failed to update file ${fileChange.path}: ${updateFile.status}`\n };\n }\n console.log(`[Step 4] Updated file: ${fileChange.path}`);\n }\n // Create PR\n const prBody = `## Automated Fix Proposal\n\nThis PR was automatically generated by [dev3000](https://github.com/vercel-labs/dev3000) after analyzing your application.\n\n### Fix Details\nView the full analysis: [${blobUrl}](${blobUrl})\n\n${fixProposal}\n\n---\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude (dev3000) <noreply@anthropic.com>`;\n const createPR = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/pulls`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n title: `Fix: ${projectName} - Automated fix from dev3000`,\n head: branchName,\n base: baseBranch,\n body: prBody\n })\n });\n if (!createPR.ok) {\n const error = await createPR.text();\n console.error(`[Step 4] Failed to create PR: ${error}`);\n return {\n success: false,\n error: `Failed to create PR: ${createPR.status}`\n };\n }\n const prData = await createPR.json();\n console.log(`[Step 4] Created PR: ${prData.html_url}`);\n return {\n success: true,\n prUrl: prData.html_url,\n prNumber: prData.number,\n branch: branchName\n };\n } catch (error) {\n console.error(\"[Step 4] Error creating PR:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : String(error)\n };\n }\n}\n/**\n * Cleanup step: Stop the sandbox\n */ export async function cleanupSandbox(cleanup) {\n console.log(\"[Cleanup] Stopping sandbox...\");\n try {\n await cleanup();\n console.log(\"[Cleanup] Sandbox stopped successfully\");\n } catch (error) {\n console.error(\"[Cleanup] Error stopping sandbox:\", error);\n // Don't throw - cleanup errors shouldn't fail the workflow\n }\n}\n"],"names":[],"mappings":"sCAOW,eAAe,EAAiB,CAAO,CAAE,CAAM,CAAE,CAAW,CAAE,CAAW,CAAE,CAAe,EACjG,QAAQ,GAAG,CAAC,CAAC,kCAAkC,EAAE,EAAY,GAAG,CAAC,EACjE,QAAQ,GAAG,CAAC,CAAC,qBAAqB,EAAE,EAAA,CAAS,EAC7C,QAAQ,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAA,CAAQ,EAExC,QAAQ,GAAG,CAAC,CAAC,qCAAqC,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,iBAAiB,CAAA,CAAE,EACrF,QAAQ,GAAG,CAAC,CAAC,4CAA4C,EAAE,CAAC,CAAC,EAAA,CAAiB,EAC9E,QAAQ,GAAG,CAAC,CAAC,iCAAiC,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,YAAY,CAAA,CAAE,EAC5E,QAAQ,GAAG,CAAC,CAAC,qCAAqC,EAAE,CAAC,CAAC,EAAA,CAAa,EAG/D,GAAmB,CAAC,QAAQ,GAAG,CAAC,iBAAiB,EAAE,CACnD,QAAQ,GAAG,CAAC,iBAAiB,CAAG,EAChC,QAAQ,GAAG,CAAC,CAAC,oDAAoD,CAAC,GAEtE,IAAM,EAAgB,MAAM,qBAAqB,SAC7C,SACA,EACA,WAAY,GACZ,eAAgB,OAChB,OAAO,CACX,GACA,QAAQ,GAAG,CAAC,CAAC,qCAAqC,CAAC,EACnD,QAAQ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,GACA,GAAI,CAAC,EAAS,EAAE,CAAE,CACd,IAAM,EAAQ,MAAM,EAAS,IAAI,GAEjC,OADA,QAAQ,KAAK,CAAC,CAAC,8BAA8B,EAAE,EAAA,CAAO,EAC/C,CACH,SAAS,EACT,MAAO,CAAC,qBAAqB,EAAE,EAAS,MAAM,CAAA,CAClD,AADoD,CAExD,CACA,IAAM,EAAS,MAAM,EAAS,IAAI,GAElC,OADA,QAAQ,GAAG,CAAC,CAAC,qBAAqB,EAAE,EAAO,QAAQ,CAAA,CAAE,EAC9C,CACH,QAAS,GACT,MAAO,EAAO,QAAQ,CACtB,SAAU,EAAO,MAAM,CACvB,OAAQ,CACZ,CACJ,CAAE,MAAO,EAAO,CAEZ,OADA,QAAQ,KAAK,CAAC,8BAA+B,GACtC,CACH,SAAS,EACT,MAAO,aAAiB,MAAQ,EAAM,OAAO,CAAG,OAAO,EAC3D,CACJ,CACJ,CAGW,eAAe,EAAe,CAAO,EAC5C,QAAQ,GAAG,CAAC,iCACZ,GAAI,CACA,MAAM,IACN,QAAQ,GAAG,CAAC,yCAChB,CAAE,MAAO,EAAO,CACZ,QAAQ,KAAK,CAAC,oCAAqC,EAEvD,CACJ"}
1
+ {"version":3,"sources":["../../../../mcp-server/app/api/cloud/fix-workflow/steps.ts"],"sourcesContent":["/**\n * Step functions for fix-workflow\n * Separated into their own module to avoid workflow bundler issues\n */ /**__internal_workflows{\"steps\":{\"app/api/cloud/fix-workflow/steps.ts\":{\"analyzeLogsWithAgent\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//analyzeLogsWithAgent\"},\"cleanupSandbox\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//cleanupSandbox\"},\"createD3kSandbox\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//createD3kSandbox\"},\"createGitHubPR\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//createGitHubPR\"},\"fetchRealLogs\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//fetchRealLogs\"},\"uploadToBlob\":{\"stepId\":\"step//app/api/cloud/fix-workflow/steps.ts//uploadToBlob\"}}}}*/;\n/**\n * Step 0: Create d3k sandbox with MCP tools pre-configured\n * Also captures a \"before\" screenshot of the app\n */ export async function createD3kSandbox(repoUrl, branch, projectName, vercelToken, vercelOidcToken) {\n console.log(`[Step 0] Creating d3k sandbox for ${projectName}...`);\n console.log(`[Step 0] Repository: ${repoUrl}`);\n console.log(`[Step 0] Branch: ${branch}`);\n // Log available token types\n console.log(`[Step 0] VERCEL_OIDC_TOKEN from env: ${!!process.env.VERCEL_OIDC_TOKEN}`);\n console.log(`[Step 0] VERCEL_OIDC_TOKEN passed as param: ${!!vercelOidcToken}`);\n console.log(`[Step 0] VERCEL_TOKEN available: ${!!process.env.VERCEL_TOKEN}`);\n console.log(`[Step 0] User access token provided: ${!!vercelToken}`);\n // Set VERCEL_OIDC_TOKEN if passed from workflow context\n // This is necessary because workflow steps don't automatically inherit environment variables\n if (vercelOidcToken && !process.env.VERCEL_OIDC_TOKEN) {\n process.env.VERCEL_OIDC_TOKEN = vercelOidcToken;\n console.log(`[Step 0] Set VERCEL_OIDC_TOKEN from workflow context`);\n }\n const sandboxResult = await createD3kSandboxUtil({\n repoUrl,\n branch,\n projectDir: \"\",\n packageManager: \"pnpm\",\n debug: true\n });\n console.log(`[Step 0] Sandbox created successfully`);\n console.log(`[Step 0] Dev URL: ${sandboxResult.devUrl}`);\n console.log(`[Step 0] MCP URL: ${sandboxResult.mcpUrl}`);\n // Get the chromium path for screenshots\n console.log(`[Step 0] Getting Chromium path for screenshots...`);\n let chromiumPath = \"/tmp/chromium\";\n try {\n const chromiumResult = await runSandboxCommand(sandboxResult.sandbox, \"node\", [\n \"-e\",\n \"require('@sparticuz/chromium').executablePath().then(p => console.log(p))\"\n ]);\n if (chromiumResult.exitCode === 0 && chromiumResult.stdout.trim()) {\n chromiumPath = chromiumResult.stdout.trim();\n console.log(`[Step 0] Chromium path: ${chromiumPath}`);\n }\n } catch {\n console.log(`[Step 0] Could not get chromium path, using default: ${chromiumPath}`);\n }\n // CRITICAL DIAGNOSTIC: Test Chrome with EXACT d3k command\n // d3k uses: --user-data-dir, no --remote-debugging-address, loading page, etc.\n console.log(`[Step 0] ===== CHROMIUM CDP TEST (d3k exact command) =====`);\n try {\n const chromeTestScript = `\n exec 2>&1\n echo \"=== Chromium CDP Test (d3k exact command) ===\"\n echo \"Chromium path: ${chromiumPath}\"\n echo \"\"\n\n # Create user-data-dir like d3k does\n USER_DATA_DIR=\"/tmp/d3k-test-profile\"\n mkdir -p \"$USER_DATA_DIR\"\n echo \"1. Created user-data-dir: $USER_DATA_DIR\"\n\n # Create loading page like d3k does\n LOADING_DIR=\"/tmp/dev3000-loading\"\n mkdir -p \"$LOADING_DIR\"\n cat > \"$LOADING_DIR/loading.html\" << 'LOADINGHTML'\n<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body><h1>Loading dev3000...</h1></body>\n</html>\nLOADINGHTML\n echo \"2. Created loading page: $LOADING_DIR/loading.html\"\n echo \"\"\n\n # Use EXACT d3k command (from cdp-monitor.ts)\n # Note: d3k does NOT use --remote-debugging-address\n echo \"3. Starting Chrome with d3k's exact args...\"\n echo \" Command: ${chromiumPath} --remote-debugging-port=9222 --user-data-dir=$USER_DATA_DIR --no-first-run --no-default-browser-check --disable-component-extensions-with-background-pages --disable-background-networking --disable-sync --metrics-recording-only --disable-default-apps --disable-session-crashed-bubble --disable-restore-session-state --headless=new --no-sandbox --disable-setuid-sandbox --disable-gpu --disable-dev-shm-usage file://$LOADING_DIR/loading.html\"\n\n timeout 15 \"${chromiumPath}\" \\\\\n --remote-debugging-port=9222 \\\\\n --user-data-dir=\"$USER_DATA_DIR\" \\\\\n --no-first-run \\\\\n --no-default-browser-check \\\\\n --disable-component-extensions-with-background-pages \\\\\n --disable-background-networking \\\\\n --disable-sync \\\\\n --metrics-recording-only \\\\\n --disable-default-apps \\\\\n --disable-session-crashed-bubble \\\\\n --disable-restore-session-state \\\\\n --headless=new \\\\\n --no-sandbox \\\\\n --disable-setuid-sandbox \\\\\n --disable-gpu \\\\\n --disable-dev-shm-usage \\\\\n \"file://$LOADING_DIR/loading.html\" &\n PID=$!\n echo \" Chrome PID: $PID\"\n sleep 3\n echo \"\"\n\n echo \"4. Checking if Chrome is still running...\"\n if ps -p $PID > /dev/null 2>&1; then\n echo \" Chrome is RUNNING after 3s\"\n echo \"\"\n echo \"5. Trying CDP (note: d3k doesn't use --remote-debugging-address)...\"\n echo \" Trying 127.0.0.1...\"\n curl -s --max-time 5 http://127.0.0.1:9222/json/version 2>&1 || echo \" 127.0.0.1 failed\"\n echo \"\"\n echo \" Trying localhost...\"\n curl -s --max-time 5 http://localhost:9222/json/version 2>&1 || echo \" localhost failed\"\n echo \"\"\n echo \"6. Checking what's listening on 9222...\"\n ss -tlnp 2>/dev/null | grep 9222 || netstat -tlnp 2>/dev/null | grep 9222 || echo \" Could not check listening ports\"\n echo \"\"\n echo \"7. Killing test Chrome...\"\n kill $PID 2>/dev/null\n else\n echo \" Chrome DIED within 3s\"\n wait $PID 2>/dev/null\n EXIT_CODE=$?\n echo \" Exit code: $EXIT_CODE\"\n echo \"\"\n echo \" Checking for crash logs...\"\n ls -la \"$USER_DATA_DIR\" 2>&1 | head -10 || echo \" No user-data-dir\"\n fi\n echo \"\"\n echo \"=== End d3k exact command test ===\"\n `;\n const chromeTest = await runSandboxCommand(sandboxResult.sandbox, \"bash\", [\n \"-c\",\n chromeTestScript\n ]);\n console.log(`[Step 0] d3k Chrome test (exit ${chromeTest.exitCode}):\\n${chromeTest.stdout || \"(no output)\"}`);\n if (chromeTest.stderr) console.log(`[Step 0] d3k Chrome test stderr: ${chromeTest.stderr}`);\n } catch (error) {\n console.log(`[Step 0] d3k Chrome test error: ${error instanceof Error ? error.message : String(error)}`);\n }\n console.log(`[Step 0] ===== END d3k EXACT COMMAND TEST =====`);\n // Capture \"BEFORE\" screenshot - this shows the app before any fixes\n console.log(`[Step 0] Capturing BEFORE screenshot...`);\n let beforeScreenshotUrl = null;\n try {\n const beforeBase64 = await captureScreenshotInSandbox(sandboxResult.sandbox, \"http://localhost:3000\", chromiumPath, \"before\");\n if (beforeBase64) {\n beforeScreenshotUrl = await uploadScreenshot(beforeBase64, \"before\", projectName);\n }\n } catch (error) {\n console.log(`[Step 0] Before screenshot failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n // Now capture CLS and errors using MCP from INSIDE the sandbox\n console.log(`[Step 0] Capturing CLS metrics from inside sandbox...`);\n let clsData = null;\n let mcpError = null;\n try {\n // Call fix_my_app MCP tool via curl from inside the sandbox\n // This avoids network isolation issues - we're calling localhost:3684 from within the sandbox\n const mcpCommand = `curl -s -X POST http://localhost:3684/mcp -H \"Content-Type: application/json\" -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"fix_my_app\",\"arguments\":{\"mode\":\"snapshot\",\"focusArea\":\"performance\",\"returnRawData\":true}}}'`;\n console.log(`[Step 0] Executing MCP command inside sandbox...`);\n console.log(`[Step 0] MCP command: ${mcpCommand.substring(0, 200)}...`);\n let stdout = \"\";\n let stderr = \"\";\n let exitCode = -1;\n try {\n const result = await runSandboxCommand(sandboxResult.sandbox, \"bash\", [\n \"-c\",\n mcpCommand\n ]);\n stdout = result.stdout;\n stderr = result.stderr;\n exitCode = result.exitCode;\n console.log(`[Step 0] MCP command exit code: ${exitCode}`);\n console.log(`[Step 0] MCP stdout length: ${stdout.length} bytes`);\n if (stderr) {\n console.log(`[Step 0] MCP stderr: ${stderr.substring(0, 500)}`);\n }\n } catch (runCommandError) {\n const errorMsg = runCommandError instanceof Error ? runCommandError.message : String(runCommandError);\n console.log(`[Step 0] sandbox.runCommand threw: ${errorMsg}`);\n mcpError = `sandbox.runCommand failed: ${errorMsg}`;\n }\n if (exitCode === 0 && stdout) {\n try {\n const mcpResponse = JSON.parse(stdout);\n if (mcpResponse.result?.content) {\n // Extract the actual data from MCP response\n const contentArray = mcpResponse.result.content;\n for (const item of contentArray){\n if (item.type === \"text\" && item.text) {\n // Try to parse the text as JSON if it contains structured data\n try {\n clsData = JSON.parse(item.text);\n console.log(`[Step 0] Successfully parsed CLS data as JSON`);\n } catch {\n // If not JSON, treat as plain text\n clsData = {\n rawOutput: item.text\n };\n console.log(`[Step 0] CLS data stored as rawOutput (not JSON)`);\n }\n break;\n }\n }\n }\n if (clsData) {\n console.log(`[Step 0] CLS data captured:`, JSON.stringify(clsData).substring(0, 500));\n } else {\n console.log(`[Step 0] No CLS data extracted from MCP response`);\n console.log(`[Step 0] Response structure: ${JSON.stringify(mcpResponse).substring(0, 500)}`);\n }\n } catch (parseError) {\n mcpError = `Failed to parse MCP response: ${parseError instanceof Error ? parseError.message : String(parseError)}`;\n console.log(`[Step 0] ${mcpError}`);\n console.log(`[Step 0] Raw stdout: ${stdout.substring(0, 1000)}`);\n // Use raw stdout as fallback CLS data so Step 1 doesn't hang\n clsData = {\n rawMcpOutput: stdout.substring(0, 10000),\n parseError: mcpError\n };\n console.log(`[Step 0] Using raw stdout as fallback CLS data`);\n }\n } else if (exitCode !== 0 && !mcpError) {\n mcpError = `MCP command failed with exit code ${exitCode}`;\n console.log(`[Step 0] ${mcpError}`);\n if (stderr) {\n console.log(`[Step 0] stderr: ${stderr}`);\n }\n }\n } catch (error) {\n mcpError = `MCP execution error: ${error instanceof Error ? error.message : String(error)}`;\n console.log(`[Step 0] ${mcpError}`);\n }\n // IMPORTANT: Ensure clsData is ALWAYS set to something truthy so Step 1 doesn't hang on timeouts\n // Even if MCP failed, we should have sandbox logs that Step 1 can use\n if (!clsData) {\n console.log(`[Step 0] WARNING: No CLS data captured, creating placeholder to prevent Step 1 timeout`);\n clsData = {\n warning: \"MCP fix_my_app did not return data\",\n mcpError: mcpError || \"Unknown error\",\n sandboxDevUrl: sandboxResult.devUrl,\n sandboxMcpUrl: sandboxResult.mcpUrl\n };\n }\n console.log(`[Step 0] Final clsData truthy check: ${!!clsData}`);\n // Dump all sandbox logs before returning for debugging\n console.log(`[Step 0] === Dumping sandbox logs before returning ===`);\n try {\n const logsResult = await runSandboxCommand(sandboxResult.sandbox, \"sh\", [\n \"-c\",\n 'for log in /home/vercel-sandbox/.d3k/logs/*.log; do [ -f \"$log\" ] && echo \"=== $log ===\" && tail -100 \"$log\" || true; done 2>/dev/null || echo \"No log files found\"'\n ]);\n console.log(logsResult.stdout);\n } catch (logsError) {\n console.log(`[Step 0] Failed to dump logs: ${logsError instanceof Error ? logsError.message : String(logsError)}`);\n }\n console.log(`[Step 0] === End sandbox log dump ===`);\n // Capture git diff from sandbox - this shows any changes made by d3k\n console.log(`[Step 0] Capturing git diff from sandbox...`);\n let gitDiff = null;\n try {\n const diffResult = await runSandboxCommand(sandboxResult.sandbox, \"sh\", [\n \"-c\",\n \"cd /vercel/sandbox && git diff --no-color 2>/dev/null || echo 'No git diff available'\"\n ]);\n if (diffResult.exitCode === 0 && diffResult.stdout.trim() && diffResult.stdout.trim() !== \"No git diff available\") {\n gitDiff = diffResult.stdout.trim();\n console.log(`[Step 0] Git diff captured (${gitDiff.length} chars)`);\n console.log(`[Step 0] Git diff preview:\\n${gitDiff.substring(0, 500)}...`);\n } else {\n console.log(`[Step 0] No git changes detected in sandbox`);\n }\n } catch (diffError) {\n console.log(`[Step 0] Failed to capture git diff: ${diffError instanceof Error ? diffError.message : String(diffError)}`);\n }\n // Note: We cannot return the cleanup function or sandbox object as they're not serializable\n // Sandbox cleanup will happen automatically when the sandbox times out\n return {\n mcpUrl: sandboxResult.mcpUrl,\n devUrl: sandboxResult.devUrl,\n bypassToken: sandboxResult.bypassToken,\n clsData,\n mcpError,\n beforeScreenshotUrl,\n chromiumPath,\n gitDiff\n };\n}\n/**\n * Step 1: Use browser automation to capture real errors\n * Uses d3k MCP server in sandbox (if available) or AI Gateway for browser automation\n */ export async function fetchRealLogs(mcpUrlOrDevUrl, bypassToken, sandboxDevUrl, clsData, mcpError, beforeScreenshotUrlFromStep0) {\n // Debug: Log what we received from Step 0\n console.log(`[Step 1] Received clsData: ${clsData ? \"truthy\" : \"falsy\"}, type: ${typeof clsData}`);\n if (clsData) {\n console.log(`[Step 1] clsData preview: ${JSON.stringify(clsData).substring(0, 200)}`);\n }\n // If we already have CLS data from Step 0, use it along with the screenshot\n // This early return prevents the long MCP timeout delays\n if (clsData) {\n console.log(\"[Step 1] ✅ Using CLS data captured in Step 0 (skipping MCP calls)\");\n if (beforeScreenshotUrlFromStep0) {\n console.log(`[Step 1] Before screenshot from Step 0: ${beforeScreenshotUrlFromStep0}`);\n }\n return {\n logAnalysis: JSON.stringify(clsData, null, 2),\n beforeScreenshotUrl: beforeScreenshotUrlFromStep0 || null\n };\n }\n console.log(\"[Step 1] ⚠️ No CLS data from Step 0, will try MCP calls (may timeout)\");\n // If there was an MCP error in Step 0, log it\n if (mcpError) {\n console.log(`[Step 1] Note: MCP error from Step 0: ${mcpError}`);\n }\n // Determine if we're using sandbox MCP or direct dev URL\n const isSandbox = !!sandboxDevUrl;\n const devUrl = sandboxDevUrl || mcpUrlOrDevUrl;\n const mcpUrl = isSandbox ? mcpUrlOrDevUrl : null;\n console.log(`[Step 1] Fetching logs from: ${devUrl}`);\n console.log(`[Step 1] Using sandbox: ${isSandbox ? \"yes\" : \"no\"}`);\n if (mcpUrl) {\n console.log(`[Step 1] MCP URL: ${mcpUrl}`);\n }\n console.log(`[Step 1] Bypass token: ${bypassToken ? \"provided\" : \"not provided\"}`);\n try {\n // Construct URL with bypass token if provided\n const urlWithBypass = bypassToken ? `${devUrl}?x-vercel-protection-bypass=${bypassToken}` : devUrl;\n console.log(`[Step 1] Final URL: ${urlWithBypass.replace(bypassToken || \"\", \"***\")}`);\n if (isSandbox && mcpUrl) {\n // Use d3k MCP server in sandbox - capture CLS metrics and errors\n console.log(\"[Step 1] Using d3k MCP server to capture CLS metrics and errors...\");\n // First, validate MCP server access and list available tools\n // Use a 30-second timeout to avoid hanging the entire workflow\n console.log(\"[Step 1] Validating d3k MCP server access...\");\n const validationController = new AbortController();\n const validationTimeout = setTimeout(()=>validationController.abort(), 30000);\n try {\n const toolsResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/list\"\n }),\n signal: validationController.signal\n });\n clearTimeout(validationTimeout);\n if (toolsResponse.ok) {\n const toolsText = await toolsResponse.text();\n try {\n // Parse SSE response format: \"event: message\\ndata: {...}\\n\\n\"\n let toolsData = null;\n const lines = toolsText.split(\"\\n\");\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n try {\n toolsData = JSON.parse(line.substring(6));\n break;\n } catch {\n // Continue to next line\n }\n }\n }\n // Fallback: try parsing the whole response as JSON (non-SSE format)\n if (!toolsData) {\n toolsData = JSON.parse(toolsText);\n }\n const toolNames = toolsData.result?.tools?.map((t)=>t.name) || [];\n console.log(`[Step 1] ✅ d3k MCP server accessible`);\n console.log(`[Step 1] Available tools (${toolNames.length}): ${toolNames.join(\", \")}`);\n // Check for expected chrome-devtools and nextjs-dev tools\n const hasChrome = toolNames.some((name)=>name.includes(\"chrome-devtools\"));\n const hasNextjs = toolNames.some((name)=>name.includes(\"nextjs\"));\n const hasFixMyApp = toolNames.includes(\"fix_my_app\");\n console.log(`[Step 1] Chrome DevTools MCP: ${hasChrome ? \"✅\" : \"❌\"}`);\n console.log(`[Step 1] Next.js DevTools MCP: ${hasNextjs ? \"✅\" : \"❌\"}`);\n console.log(`[Step 1] fix_my_app tool: ${hasFixMyApp ? \"✅\" : \"❌\"}`);\n } catch {\n console.log(`[Step 1] MCP server responded but couldn't parse tools list: ${toolsText.substring(0, 200)}`);\n }\n } else {\n console.log(`[Step 1] ⚠️ MCP server not accessible: ${toolsResponse.status}`);\n }\n } catch (error) {\n clearTimeout(validationTimeout);\n const errorMsg = error instanceof Error ? error.message : String(error);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] ⚠️ Failed to validate MCP server: ${isTimeout ? \"Timed out after 30s\" : errorMsg}`);\n }\n // Navigate to the app to generate logs (with 30s timeout)\n console.log(\"[Step 1] Navigating browser to app URL...\");\n const navController = new AbortController();\n const navTimeout = setTimeout(()=>navController.abort(), 30000);\n try {\n const navResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/call\",\n params: {\n name: \"execute_browser_action\",\n arguments: {\n action: \"navigate\",\n params: {\n url: urlWithBypass\n }\n }\n }\n }),\n signal: navController.signal\n });\n clearTimeout(navTimeout);\n if (navResponse.ok) {\n console.log(\"[Step 1] Browser navigation completed\");\n } else {\n console.log(`[Step 1] Browser navigation failed: ${navResponse.status}`);\n }\n } catch (navError) {\n clearTimeout(navTimeout);\n const isTimeout = navError instanceof Error && navError.name === \"AbortError\";\n console.log(`[Step 1] Browser navigation error: ${isTimeout ? \"Timed out after 30s\" : navError instanceof Error ? navError.message : String(navError)}`);\n }\n // Wait for page to fully load\n console.log(\"[Step 1] Waiting 5s for page load...\");\n await new Promise((resolve)=>setTimeout(resolve, 5000));\n // Capture \"before\" screenshot to prove the page loaded and for later comparison\n let beforeScreenshotUrl = null;\n console.log(\"[Step 1] Capturing 'before' screenshot...\");\n const screenshotController = new AbortController();\n const screenshotTimeout = setTimeout(()=>screenshotController.abort(), 30000);\n try {\n const screenshotResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 0,\n method: \"tools/call\",\n params: {\n name: \"chrome-devtools_take_snapshot\",\n arguments: {}\n }\n }),\n signal: screenshotController.signal\n });\n clearTimeout(screenshotTimeout);\n if (screenshotResponse.ok) {\n const screenshotText = await screenshotResponse.text();\n // Parse SSE response to get screenshot data\n const lines = screenshotText.split(\"\\n\");\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n try {\n const json = JSON.parse(line.substring(6));\n if (json.result?.content) {\n for (const content of json.result.content){\n if (content.type === \"image\" && content.data) {\n // Upload base64 image to Vercel Blob\n const imageBuffer = Buffer.from(content.data, \"base64\");\n const timestamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n const filename = `screenshot-before-${timestamp}.png`;\n const blob = await put(filename, imageBuffer, {\n access: \"public\",\n contentType: \"image/png\"\n });\n beforeScreenshotUrl = blob.url;\n console.log(`[Step 1] ✅ Before screenshot uploaded: ${beforeScreenshotUrl}`);\n }\n }\n }\n } catch {\n // Continue parsing other lines\n }\n }\n }\n if (!beforeScreenshotUrl) {\n console.log(`[Step 1] Screenshot response received but no image data found`);\n console.log(`[Step 1] Response preview: ${screenshotText.substring(0, 500)}`);\n }\n } else {\n console.log(`[Step 1] Screenshot request failed: ${screenshotResponse.status}`);\n }\n } catch (error) {\n clearTimeout(screenshotTimeout);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] Screenshot capture error: ${isTimeout ? \"Timed out after 30s\" : error instanceof Error ? error.message : String(error)}`);\n }\n // Check d3k logs to see if it's capturing data (with 15s timeout)\n console.log(\"[Step 1] Fetching d3k logs from sandbox to verify it's working...\");\n const logsController = new AbortController();\n const logsTimeout = setTimeout(()=>logsController.abort(), 15000);\n try {\n const logsResponse = await fetch(`${mcpUrl}/api/logs`, {\n signal: logsController.signal\n });\n clearTimeout(logsTimeout);\n if (logsResponse.ok) {\n const logsText = await logsResponse.text();\n console.log(`[Step 1] d3k logs (last 1000 chars):\\n${logsText.slice(-1000)}`);\n } else {\n console.log(`[Step 1] Could not fetch d3k logs: ${logsResponse.status}`);\n }\n } catch (error) {\n clearTimeout(logsTimeout);\n const isTimeout = error instanceof Error && error.name === \"AbortError\";\n console.log(`[Step 1] Failed to fetch d3k logs: ${isTimeout ? \"Timed out after 15s\" : error instanceof Error ? error.message : String(error)}`);\n }\n // Call fix_my_app with focusArea='performance' to capture CLS and jank\n console.log(\"[Step 1] Calling fix_my_app with focusArea='performance'...\");\n // Set a 3-minute timeout for the MCP call\n const controller = new AbortController();\n const timeoutId = setTimeout(()=>controller.abort(), 3 * 60 * 1000);\n try {\n const mcpResponse = await fetch(`${mcpUrl}/mcp`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/event-stream\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: 1,\n method: \"tools/call\",\n params: {\n name: \"fix_my_app\",\n arguments: {\n mode: \"snapshot\",\n focusArea: \"performance\",\n timeRangeMinutes: 5,\n returnRawData: false\n }\n }\n }),\n signal: controller.signal\n });\n clearTimeout(timeoutId);\n if (!mcpResponse.ok) {\n throw new Error(`MCP request failed: ${mcpResponse.status}`);\n }\n // Parse SSE response\n const text = await mcpResponse.text();\n console.log(`[Step 1] fix_my_app response length: ${text.length} bytes`);\n console.log(`[Step 1] fix_my_app response preview (first 500 chars):\\n${text.substring(0, 500)}`);\n const lines = text.split(\"\\n\");\n console.log(`[Step 1] Response split into ${lines.length} lines`);\n let logAnalysis = \"\";\n let linesProcessed = 0;\n let contentBlocks = 0;\n for (const line of lines){\n if (line.startsWith(\"data: \")) {\n linesProcessed++;\n try {\n const json = JSON.parse(line.substring(6));\n console.log(`[Step 1] Parsed JSON line ${linesProcessed}:`, JSON.stringify(json).substring(0, 200));\n if (json.result?.content) {\n for (const content of json.result.content){\n if (content.type === \"text\") {\n contentBlocks++;\n logAnalysis += content.text;\n console.log(`[Step 1] Added text content block ${contentBlocks}, length: ${content.text.length}`);\n }\n }\n } else if (json.error) {\n console.log(`[Step 1] ERROR in response: ${JSON.stringify(json.error)}`);\n }\n } catch (error) {\n console.log(`[Step 1] Failed to parse JSON line ${linesProcessed}: ${error instanceof Error ? error.message : String(error)}`);\n console.log(`[Step 1] Problem line: ${line.substring(0, 200)}`);\n }\n }\n }\n console.log(`[Step 1] Processed ${linesProcessed} data lines, ${contentBlocks} content blocks`);\n console.log(`[Step 1] Got ${logAnalysis.length} chars from fix_my_app (performance analysis)`);\n if (logAnalysis.length === 0) {\n console.log(`[Step 1] WARNING: fix_my_app returned NO data. Full response:\\n${text}`);\n }\n return {\n logAnalysis: `d3k Performance Analysis for ${devUrl}\\n\\n${logAnalysis}`,\n beforeScreenshotUrl\n };\n } catch (error) {\n clearTimeout(timeoutId);\n if (error instanceof Error && error.name === \"AbortError\") {\n console.log(\"[Step 1] fix_my_app timed out after 3 minutes, using fallback method\");\n // Fall through to fallback method below\n } else {\n console.log(`[Step 1] fix_my_app error: ${error instanceof Error ? error.message : String(error)}`);\n // Fall through to fallback method below\n }\n }\n }\n // Fallback: Use AI Gateway with browser automation prompting\n console.log(\"[Step 1] Using AI Gateway with browser automation...\");\n const gateway = createGateway({\n apiKey: process.env.AI_GATEWAY_API_KEY,\n baseURL: \"https://ai-gateway.vercel.sh/v1/ai\"\n });\n const model = gateway(\"anthropic/claude-sonnet-4-20250514\");\n const prompt = `You are a web application debugger with access to browser automation tools via Playwright MCP.\n\nYour task is to visit this URL and capture any errors, warnings, or issues:\n${urlWithBypass}\n\nSteps to follow:\n1. Use browser_eval with action=\"start\" to start the browser\n2. Use browser_eval with action=\"navigate\" and params={url: \"${urlWithBypass}\"} to navigate to the page\n3. Wait a few seconds for the page to fully load and JavaScript to execute\n4. Use browser_eval with action=\"console_messages\" to get all browser console output (errors, warnings, logs)\n5. Use browser_eval with action=\"screenshot\" to capture a screenshot\n6. Use browser_eval with action=\"close\" to close the browser\n\nAnalyze the console messages and provide a detailed report including:\n- All console errors (with full stack traces if available)\n- All console warnings\n- HTTP status codes or network errors\n- Any visual issues you can identify from the screenshot\n- Screenshot URL if captured\n\nFormat your response as a clear, structured report that helps identify what's broken in the application.`;\n const { text } = await generateText({\n model,\n prompt,\n toolChoice: \"auto\",\n // @ts-expect-error - AI SDK types for maxTokens are incomplete\n maxTokens: 4000\n });\n console.log(`[Step 1] Browser automation response (first 500 chars): ${text.substring(0, 500)}...`);\n return {\n logAnalysis: `Browser Automation Analysis for ${devUrl}\\n\\n${text}`,\n beforeScreenshotUrl: null\n };\n } catch (error) {\n console.error(\"[Step 1] Error with browser automation:\", error);\n // Fallback to simple fetch if browser automation fails\n console.log(\"[Step 1] Falling back to simple HTTP fetch...\");\n try {\n const urlWithBypass = bypassToken ? `${devUrl}?x-vercel-protection-bypass=${bypassToken}` : devUrl;\n const headers = {\n \"User-Agent\": \"dev3000-cloud-fix/1.0\",\n Accept: \"text/html,application/json,*/*\"\n };\n if (bypassToken) {\n headers[\"x-vercel-protection-bypass\"] = bypassToken;\n }\n const response = await fetch(urlWithBypass, {\n method: \"GET\",\n headers\n });\n const body = await response.text();\n // Extract and log page title from HTML\n const titleMatch = body.match(/<title[^>]*>([^<]*)<\\/title>/i);\n const pageTitle = titleMatch ? titleMatch[1].trim() : \"(no title found)\";\n console.log(`[Step 1] HTTP fallback - Page title: \"${pageTitle}\"`);\n let logAnalysis = `Dev Server URL: ${devUrl}\\n`;\n logAnalysis += `Page Title: ${pageTitle}\\n`;\n logAnalysis += `HTTP Status: ${response.status} ${response.statusText}\\n\\n`;\n logAnalysis += `Note: Browser automation failed, using fallback HTTP fetch.\\n\\n`;\n if (!response.ok) {\n logAnalysis += `ERROR: HTTP ${response.status} ${response.statusText}\\n\\n`;\n }\n if (body.includes(\"ReferenceError\") || body.includes(\"Error\") || body.includes(\"error\")) {\n logAnalysis += `Response body contains error information:\\n${body.substring(0, 5000)}\\n\\n`;\n } else if (!response.ok) {\n logAnalysis += `Response body:\\n${body.substring(0, 2000)}\\n\\n`;\n } else {\n logAnalysis += \"No errors detected in response.\\n\";\n }\n return {\n logAnalysis,\n beforeScreenshotUrl: null\n };\n } catch (fallbackError) {\n const errorMessage = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);\n return {\n logAnalysis: `Failed to fetch logs from ${devUrl}\\n\\nError: ${errorMessage}\\n\\nThis may indicate the dev server is not accessible or has crashed.`,\n beforeScreenshotUrl: null\n };\n }\n }\n}\n/**\n * Step 2: Invoke AI agent to analyze logs and propose fixes\n * Uses AI SDK with AI Gateway for multi-model support\n */ export async function analyzeLogsWithAgent(logAnalysis, devUrl) {\n console.log(\"[Step 2] Invoking AI agent to analyze logs...\");\n // Create AI Gateway instance\n const gateway = createGateway({\n apiKey: process.env.AI_GATEWAY_API_KEY,\n baseURL: \"https://ai-gateway.vercel.sh/v1/ai\"\n });\n // Use Claude Sonnet 4 via AI Gateway\n const model = gateway(\"anthropic/claude-sonnet-4-20250514\");\n const prompt = `You are a skilled software engineer debugging an application.\n\nThe dev server is running at: ${devUrl}\n\nHere's the log analysis from the MCP fix_my_app tool:\n${logAnalysis}\n\nYour task:\n1. Identify the most critical error or issue from the logs\n2. Determine the root cause\n3. Propose a specific code fix with file paths and changes\n4. Create a git-style unified diff that can be applied with 'git apply'\n5. Explain why this fix will resolve the issue\n\nFormat your response EXACTLY as follows:\n\n## Issue\n[Brief description of the issue]\n\n## Root Cause\n[Explanation of what's causing the issue]\n\n## Proposed Fix\n[High-level explanation of the fix]\n\n## Git Patch\n\\`\\`\\`diff\n[Full unified diff format that can be applied with 'git apply' or 'patch']\n[Include file paths, line numbers, and exact changes]\n[Example format:]\n[diff --git a/path/to/file.ts b/path/to/file.ts]\n[index abc123..def456 100644]\n[--- a/path/to/file.ts]\n[+++ b/path/to/file.ts]\n[@@ -10,7 +10,7 @@ function example() {]\n[ unchanged line]\n[- old line to remove]\n[+ new line to add]\n[ unchanged line]\n\\`\\`\\`\n\n## Reasoning\n[Why this fix will work]\n\nIMPORTANT:\n- The Git Patch section must be a valid unified diff that can be applied directly with 'git apply'.\n- If no errors are found, respond with \"✅ **SYSTEM HEALTHY** - No errors found\" and do NOT include a Git Patch section.\n- Only include a Git Patch if there are actual issues that need fixing.`;\n const { text } = await generateText({\n model,\n prompt\n });\n console.log(`[Step 2] AI agent response (first 500 chars): ${text.substring(0, 500)}...`);\n return text;\n}\n/**\n * Step 3: Upload fix proposal to blob storage and return URL\n */ export async function uploadToBlob(fixProposal, projectName, logAnalysis, devUrl, beforeScreenshotUrl, gitDiff) {\n console.log(\"[Step 3] Uploading fix proposal to blob storage...\");\n if (beforeScreenshotUrl) {\n console.log(`[Step 3] Including before screenshot: ${beforeScreenshotUrl}`);\n }\n if (gitDiff) {\n console.log(`[Step 3] Including git diff (${gitDiff.length} chars)`);\n }\n // Create screenshot section if we have a screenshot\n const screenshotSection = beforeScreenshotUrl ? `## Before Screenshot\n\nThis screenshot was captured when the sandbox dev server first loaded, proving the page rendered successfully.\n\n![Before Screenshot](${beforeScreenshotUrl})\n\n---\n\n` : \"\";\n // Create git diff section if we have a diff from the sandbox\n const gitDiffSection = gitDiff ? `## Actual Git Diff from Sandbox\n\nThe following diff shows the actual changes made by d3k in the sandbox environment:\n\n\\`\\`\\`diff\n${gitDiff}\n\\`\\`\\`\n\n---\n\n` : \"\";\n // Create enhanced markdown with full context and attribution\n const timestamp = new Date().toISOString();\n const enhancedMarkdown = `# Fix Proposal for ${projectName}\n\n**Generated**: ${timestamp}\n\n**Powered by**: [dev3000](https://github.com/vercel-labs/dev3000) with Claude Code\n\n**Dev Server**: ${devUrl}\n\n---\n\n${screenshotSection}${gitDiffSection}## Original Log Analysis\n\n\\`\\`\\`\n${logAnalysis}\n\\`\\`\\`\n\n---\n\n${fixProposal}\n\n---\n\n## Attribution\n\nThis fix proposal was automatically generated by [dev3000](https://github.com/vercel-labs/dev3000),\nan AI-powered debugging tool that analyzes your application logs and suggests fixes.\n\n**Co-Authored-By**: Claude (dev3000) <noreply@anthropic.com>\n\n### About dev3000\n\ndev3000 monitors your development server, captures errors in real-time, and uses AI to:\n- Analyze error logs and stack traces\n- Identify root causes\n- Generate actionable fix proposals with git patches\n- Suggest specific code changes\n\nLearn more at https://github.com/vercel-labs/dev3000\n`;\n // Upload to Vercel Blob Storage\n const filenameTimestamp = timestamp.replace(/[:.]/g, \"-\");\n const filename = `fix-${projectName}-${filenameTimestamp}.md`;\n const blob = await put(filename, enhancedMarkdown, {\n access: \"public\",\n contentType: \"text/markdown\"\n });\n console.log(`[Step 3] Fix proposal uploaded to: ${blob.url}`);\n return {\n success: true,\n projectName,\n fixProposal,\n blobUrl: blob.url,\n beforeScreenshotUrl: beforeScreenshotUrl || null,\n message: \"Fix analysis completed and uploaded to blob storage\"\n };\n}\n/**\n * Step 4: Create GitHub PR with the fix\n * Uses GitHub API to create a branch, commit the patch, and open a PR\n */ export async function createGitHubPR(fixProposal, blobUrl, repoOwner, repoName, baseBranch, projectName) {\n console.log(`[Step 4] Creating GitHub PR for ${repoOwner}/${repoName}...`);\n const githubToken = process.env.GITHUB_TOKEN;\n if (!githubToken) {\n console.error(\"[Step 4] GITHUB_TOKEN not found in environment\");\n return {\n success: false,\n error: \"GitHub token not configured\"\n };\n }\n try {\n // Extract the git patch from the fix proposal\n const patchMatch = fixProposal.match(/```diff\\n([\\s\\S]*?)\\n```/);\n if (!patchMatch) {\n console.error(\"[Step 4] No git patch found in fix proposal\");\n return {\n success: false,\n error: \"No git patch found in fix proposal\"\n };\n }\n const patch = patchMatch[1];\n console.log(`[Step 4] Extracted patch (${patch.length} chars)`);\n // Parse the patch to extract file changes\n const fileChanges = parsePatchToFileChanges(patch);\n if (fileChanges.length === 0) {\n console.error(\"[Step 4] Failed to parse any file changes from patch\");\n return {\n success: false,\n error: \"Failed to parse file changes from patch\"\n };\n }\n console.log(`[Step 4] Parsed ${fileChanges.length} file change(s)`);\n // Create a unique branch name\n const branchName = `dev3000-fix-${projectName}-${Date.now()}`;\n console.log(`[Step 4] Branch name: ${branchName}`);\n // Get the base branch SHA\n const baseRef = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/git/ref/heads/${baseBranch}`, {\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\"\n }\n });\n if (!baseRef.ok) {\n const error = await baseRef.text();\n console.error(`[Step 4] Failed to get base branch: ${error}`);\n return {\n success: false,\n error: `Failed to get base branch: ${baseRef.status}`\n };\n }\n const baseData = await baseRef.json();\n const baseSha = baseData.object.sha;\n console.log(`[Step 4] Base SHA: ${baseSha}`);\n // Create new branch\n const createBranch = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/git/refs`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n ref: `refs/heads/${branchName}`,\n sha: baseSha\n })\n });\n if (!createBranch.ok) {\n const error = await createBranch.text();\n console.error(`[Step 4] Failed to create branch: ${error}`);\n return {\n success: false,\n error: `Failed to create branch: ${createBranch.status}`\n };\n }\n console.log(`[Step 4] Created branch: ${branchName}`);\n // For each file, fetch current content, apply changes, and commit\n for (const fileChange of fileChanges){\n console.log(`[Step 4] Processing file: ${fileChange.path}`);\n // Get current file content\n const fileResp = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/contents/${fileChange.path}?ref=${branchName}`, {\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\"\n }\n });\n let currentContent = \"\";\n let currentSha = \"\";\n if (fileResp.ok) {\n const fileData = await fileResp.json();\n currentSha = fileData.sha;\n currentContent = Buffer.from(fileData.content, \"base64\").toString(\"utf-8\");\n } else {\n console.log(`[Step 4] File doesn't exist, will create new file`);\n }\n // Apply the patch changes to the content\n const newContent = applyPatchChanges(currentContent, fileChange.changes);\n // Update file\n const updateFile = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/contents/${fileChange.path}`, {\n method: \"PUT\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n message: `Fix: Apply dev3000 fix for ${projectName}`,\n content: Buffer.from(newContent).toString(\"base64\"),\n branch: branchName,\n ...currentSha && {\n sha: currentSha\n }\n })\n });\n if (!updateFile.ok) {\n const error = await updateFile.text();\n console.error(`[Step 4] Failed to update file ${fileChange.path}: ${error}`);\n return {\n success: false,\n error: `Failed to update file ${fileChange.path}: ${updateFile.status}`\n };\n }\n console.log(`[Step 4] Updated file: ${fileChange.path}`);\n }\n // Create PR\n const prBody = `## Automated Fix Proposal\n\nThis PR was automatically generated by [dev3000](https://github.com/vercel-labs/dev3000) after analyzing your application.\n\n### Fix Details\nView the full analysis: [${blobUrl}](${blobUrl})\n\n${fixProposal}\n\n---\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude (dev3000) <noreply@anthropic.com>`;\n const createPR = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/pulls`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${githubToken}`,\n Accept: \"application/vnd.github.v3+json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n title: `Fix: ${projectName} - Automated fix from dev3000`,\n head: branchName,\n base: baseBranch,\n body: prBody\n })\n });\n if (!createPR.ok) {\n const error = await createPR.text();\n console.error(`[Step 4] Failed to create PR: ${error}`);\n return {\n success: false,\n error: `Failed to create PR: ${createPR.status}`\n };\n }\n const prData = await createPR.json();\n console.log(`[Step 4] Created PR: ${prData.html_url}`);\n return {\n success: true,\n prUrl: prData.html_url,\n prNumber: prData.number,\n branch: branchName\n };\n } catch (error) {\n console.error(\"[Step 4] Error creating PR:\", error);\n return {\n success: false,\n error: error instanceof Error ? error.message : String(error)\n };\n }\n}\n/**\n * Cleanup step: Stop the sandbox\n */ export async function cleanupSandbox(cleanup) {\n console.log(\"[Cleanup] Stopping sandbox...\");\n try {\n await cleanup();\n console.log(\"[Cleanup] Sandbox stopped successfully\");\n } catch (error) {\n console.error(\"[Cleanup] Error stopping sandbox:\", error);\n // Don't throw - cleanup errors shouldn't fail the workflow\n }\n}\n"],"names":[],"mappings":"sCAOW,eAAe,EAAiB,CAAO,CAAE,CAAM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(0,r.put)(t,JSON.stringify(e,null,2),{access:"public",addRandomSuffix:!1,allowOverwrite:!0});return console.log(`[Workflow Storage] Saved run to: ${o.url}`),o.url}async function o(e){let t=`workflows/${e}/`,{blobs:o}=await (0,r.list)({prefix:t});return(await Promise.all(o.map(async e=>{try{let r=await fetch(e.url);return await r.json()}catch(r){return console.error(`[Workflow Storage] Failed to fetch ${e.url}:`,r),null}}))).filter(e=>null!==e).sort((e,r)=>new Date(r.timestamp).getTime()-new Date(e.timestamp).getTime())}async function l(e,r){return(await o(e)).find(e=>e.id===r)||null}async function a(e,r,l,a,n,s,i){let u=(await o(e)).find(e=>e.id===r)||{id:r,userId:e,projectName:l,timestamp:a,status:"running"};u.stepNumber=n,u.currentStep=s,i&&(u.sandboxUrl=i),await t(u),console.log(`[Workflow Storage] Updated progress: Step ${n} - ${s}`)}async function n(e,t){let l=(await o(e)).filter(e=>t.includes(e.id)),a=[],n=0;for(let t of l){let o=[],l=`workflows/${e}/${t.timestamp}-${t.projectName}.json`,{blobs:s}=await (0,r.list)({prefix:l});for(let e of s)o.push(e.url);t.beforeScreenshotUrl&&o.push(t.beforeScreenshotUrl),t.afterScreenshotUrl&&o.push(t.afterScreenshotUrl),t.reportBlobUrl&&o.push(t.reportBlobUrl);try{o.length>0&&(await (0,r.del)(o),console.log(`[Workflow Storage] Deleted ${o.length} blobs for run ${t.id}`)),n++}catch(r){let e=`Failed to delete run ${t.id}: ${r instanceof Error?r.message:String(r)}`;console.error(`[Workflow Storage] ${e}`),a.push(e)}}return{deleted:n,errors:a}}e.s(["deleteWorkflowRuns",()=>n,"getWorkflowRun",()=>l,"listWorkflowRuns",()=>o,"saveWorkflowRun",()=>t,"updateWorkflowProgress",()=>a])}];
2
+
3
+ //# sourceMappingURL=mcp-server_lib_workflow-storage_ts_30ca7761._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../mcp-server/lib/workflow-storage.ts"],"sourcesContent":["import { del, list, put } from \"@vercel/blob\"\n\nexport interface WorkflowRun {\n id: string\n userId: string\n projectName: string\n timestamp: string\n status: \"running\" | \"done\" | \"failure\"\n currentStep?: string // Current step being executed (for live progress)\n stepNumber?: number // 0-4 to show progress (0=sandbox, 1=logs, 2=ai, 3=upload, 4=pr)\n reportBlobUrl?: string\n prUrl?: string\n error?: string\n beforeScreenshotUrl?: string\n afterScreenshotUrl?: string\n sandboxUrl?: string // Dev URL from sandbox for live viewing\n}\n\n/**\n * Save a workflow run to blob storage\n * Path format: workflows/{userId}/{timestamp}-{projectName}.json\n */\nexport async function saveWorkflowRun(run: WorkflowRun): Promise<string> {\n const path = `workflows/${run.userId}/${run.timestamp}-${run.projectName}.json`\n\n const blob = await put(path, JSON.stringify(run, null, 2), {\n access: \"public\",\n addRandomSuffix: false,\n allowOverwrite: true\n })\n\n console.log(`[Workflow Storage] Saved run to: ${blob.url}`)\n return blob.url\n}\n\n/**\n * List all workflow runs for a user\n * Returns runs sorted by timestamp (newest first)\n */\nexport async function listWorkflowRuns(userId: string): Promise<WorkflowRun[]> {\n const prefix = `workflows/${userId}/`\n\n const { blobs } = await list({ prefix })\n\n // Fetch and parse each blob\n const runs = await Promise.all(\n blobs.map(async (blob) => {\n try {\n const response = await fetch(blob.url)\n const run: WorkflowRun = await response.json()\n return run\n } catch (error) {\n console.error(`[Workflow Storage] Failed to fetch ${blob.url}:`, error)\n return null\n }\n })\n )\n\n // Filter out failed fetches and sort by timestamp\n return runs\n .filter((run): run is WorkflowRun => run !== null)\n .sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime())\n}\n\n/**\n * Get a single workflow run by ID\n */\nexport async function getWorkflowRun(userId: string, runId: string): Promise<WorkflowRun | null> {\n const runs = await listWorkflowRuns(userId)\n return runs.find((run) => run.id === runId) || null\n}\n\n/**\n * Update workflow progress (step tracking for live UI updates)\n * This is a lightweight update that only changes step info, not the full run\n */\nexport async function updateWorkflowProgress(\n userId: string,\n runId: string,\n projectName: string,\n timestamp: string,\n stepNumber: number,\n currentStep: string,\n sandboxUrl?: string\n): Promise<void> {\n // We need to re-save the full run with updated step info\n // First, try to get existing run data\n const existingRuns = await listWorkflowRuns(userId)\n const existingRun = existingRuns.find((r) => r.id === runId)\n\n const runData: WorkflowRun = existingRun || {\n id: runId,\n userId,\n projectName,\n timestamp,\n status: \"running\"\n }\n\n // Update with new step info\n runData.stepNumber = stepNumber\n runData.currentStep = currentStep\n if (sandboxUrl) {\n runData.sandboxUrl = sandboxUrl\n }\n\n await saveWorkflowRun(runData)\n console.log(`[Workflow Storage] Updated progress: Step ${stepNumber} - ${currentStep}`)\n}\n\n/**\n * Delete workflow runs and their associated blobs (screenshots, reports)\n * Returns the number of successfully deleted runs\n */\nexport async function deleteWorkflowRuns(\n userId: string,\n runIds: string[]\n): Promise<{ deleted: number; errors: string[] }> {\n const runs = await listWorkflowRuns(userId)\n const runsToDelete = runs.filter((run) => runIds.includes(run.id))\n\n const errors: string[] = []\n let deleted = 0\n\n for (const run of runsToDelete) {\n const urlsToDelete: string[] = []\n\n // Collect all blob URLs associated with this run\n // The workflow run JSON file\n const runPath = `workflows/${userId}/${run.timestamp}-${run.projectName}.json`\n const { blobs } = await list({ prefix: runPath })\n for (const blob of blobs) {\n urlsToDelete.push(blob.url)\n }\n\n // Screenshots\n if (run.beforeScreenshotUrl) {\n urlsToDelete.push(run.beforeScreenshotUrl)\n }\n if (run.afterScreenshotUrl) {\n urlsToDelete.push(run.afterScreenshotUrl)\n }\n\n // Report blob\n if (run.reportBlobUrl) {\n urlsToDelete.push(run.reportBlobUrl)\n }\n\n // Delete all collected URLs\n try {\n if (urlsToDelete.length > 0) {\n await del(urlsToDelete)\n console.log(`[Workflow Storage] Deleted ${urlsToDelete.length} blobs for run ${run.id}`)\n }\n deleted++\n } catch (error) {\n const errorMsg = `Failed to delete run ${run.id}: ${error instanceof Error ? error.message : String(error)}`\n console.error(`[Workflow Storage] ${errorMsg}`)\n errors.push(errorMsg)\n }\n }\n\n return { deleted, errors }\n}\n"],"names":[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AAa,MAAM,CAAC,eAAe,EAAE,EAAI,EAAE,CAAA,CAAE,GAEzF,GACF,CAAE,MAAO,EAAO,CACd,IAAM,EAAW,CAAC,qBAAqB,EAAE,EAAI,EAAE,CAAC,EAAE,EAAE,aAAiB,MAAQ,EAAM,OAAO,CAAG,OAAO,GAAA,CAAQ,CAC5G,QAAQ,KAAK,CAAC,CAAC,mBAAmB,EAAE,EAAA,CAAU,EAC9C,EAAO,IAAI,CAAC,EACd,CACF,CAEA,MAAO,SAAE,SAAS,CAAO,CAC3B"}
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},85790,a=>{a.n(a.i(29775))},81419,a=>{a.n(a.i(48983))},10063,a=>{a.n(a.i(119))},97432,a=>{a.n(a.i(86655))},42265,a=>{a.n(a.i(10243))},57764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},81111,(a,b,c)=>{b.exports=a.x("node:stream",()=>require("node:stream"))},99348,(a,b,c)=>{b.exports=a.x("string_decoder",()=>require("string_decoder"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},54799,(a,b,c)=>{b.exports=a.x("crypto",()=>require("crypto"))},27699,(a,b,c)=>{b.exports=a.x("events",()=>require("events"))},12057,(a,b,c)=>{b.exports=a.x("node:util",()=>require("node:util"))},87769,(a,b,c)=>{b.exports=a.x("node:events",()=>require("node:events"))},88947,(a,b,c)=>{b.exports=a.x("stream",()=>require("stream"))},49719,(a,b,c)=>{b.exports=a.x("assert",()=>require("assert"))},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},6461,(a,b,c)=>{b.exports=a.x("zlib",()=>require("zlib"))},21517,(a,b,c)=>{b.exports=a.x("http",()=>require("http"))},4446,(a,b,c)=>{b.exports=a.x("net",()=>require("net"))},55004,(a,b,c)=>{b.exports=a.x("tls",()=>require("tls"))},92509,(a,b,c)=>{b.exports=a.x("url",()=>require("url"))},10430,(a,b,c)=>{b.exports=a.x("async_hooks",()=>require("async_hooks"))},45706,(a,b,c)=>{b.exports=a.x("querystring",()=>require("querystring"))},63890,(a,b,c)=>{b.exports=a.x("stream/web",()=>require("stream/web"))},37702,(a,b,c)=>{b.exports=a.x("worker_threads",()=>require("worker_threads"))},60438,(a,b,c)=>{b.exports=a.x("perf_hooks",()=>require("perf_hooks"))},78249,(a,b,c)=>{b.exports=a.x("util/types",()=>require("util/types"))},54993,(a,b,c)=>{b.exports=a.x("diagnostics_channel",()=>require("diagnostics_channel"))},25328,(a,b,c)=>{b.exports=a.x("http2",()=>require("http2"))},11913,(a,b,c)=>{b.exports=a.x("console",()=>require("console"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))}];
1
+ module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},85790,a=>{a.n(a.i(29775))},81419,a=>{a.n(a.i(48983))},10063,a=>{a.n(a.i(119))},97432,a=>{a.n(a.i(86655))},42265,a=>{a.n(a.i(10243))},57764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))},81111,(a,b,c)=>{b.exports=a.x("node:stream",()=>require("node:stream"))},99348,(a,b,c)=>{b.exports=a.x("string_decoder",()=>require("string_decoder"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},54799,(a,b,c)=>{b.exports=a.x("crypto",()=>require("crypto"))},27699,(a,b,c)=>{b.exports=a.x("events",()=>require("events"))},12057,(a,b,c)=>{b.exports=a.x("node:util",()=>require("node:util"))},87769,(a,b,c)=>{b.exports=a.x("node:events",()=>require("node:events"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},88947,(a,b,c)=>{b.exports=a.x("stream",()=>require("stream"))},49719,(a,b,c)=>{b.exports=a.x("assert",()=>require("assert"))},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},6461,(a,b,c)=>{b.exports=a.x("zlib",()=>require("zlib"))},21517,(a,b,c)=>{b.exports=a.x("http",()=>require("http"))},4446,(a,b,c)=>{b.exports=a.x("net",()=>require("net"))},55004,(a,b,c)=>{b.exports=a.x("tls",()=>require("tls"))},92509,(a,b,c)=>{b.exports=a.x("url",()=>require("url"))},10430,(a,b,c)=>{b.exports=a.x("async_hooks",()=>require("async_hooks"))},45706,(a,b,c)=>{b.exports=a.x("querystring",()=>require("querystring"))},63890,(a,b,c)=>{b.exports=a.x("stream/web",()=>require("stream/web"))},37702,(a,b,c)=>{b.exports=a.x("worker_threads",()=>require("worker_threads"))},60438,(a,b,c)=>{b.exports=a.x("perf_hooks",()=>require("perf_hooks"))},78249,(a,b,c)=>{b.exports=a.x("util/types",()=>require("util/types"))},54993,(a,b,c)=>{b.exports=a.x("diagnostics_channel",()=>require("diagnostics_channel"))},25328,(a,b,c)=>{b.exports=a.x("http2",()=>require("http2"))},11913,(a,b,c)=>{b.exports=a.x("console",()=>require("console"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__bb161645._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__34cc4876._.js.map