import{join,resolve}from"node:path";import{mkdir,rm}from"node:fs/promises";import{resolveOutputDirectory}from"#internal/application/paths.js";import{randomUUID}from"node:crypto";import{VERCEL_EVE_AGENT_SUMMARY_OUTPUT_PATH}from"#internal/vercel-agent-summary.js";async function createApplicationBuildWorkspace(t,n){let r=resolve(t),i=join(r,`.eve`,`builds`,`${Date.now().toString(36)}-${randomUUID()}`),a=join(i,`compiler`),o={appRoot:r,compiler:{artifactsDir:join(a,`.eve`),rootDir:a},host:{artifactsDir:join(i,`host`)},nitro:{buildDir:join(i,`nitro`),surfaceOutputDir:join(i,`nitro-output`)},publication:{output:{finalDir:n??resolveOutputDirectory(r),stagedDir:join(i,`output`)},summary:{finalPath:join(r,VERCEL_EVE_AGENT_SUMMARY_OUTPUT_PATH),stagedPath:join(i,`agent-summary.json`)}},rootDir:i,workflow:{buildDir:join(i,`workflow`)}};return await mkdir(i,{recursive:!0}),o}async function removeApplicationBuildWorkspace(e){await rm(e.rootDir,{force:!0,recursive:!0})}export{createApplicationBuildWorkspace,removeApplicationBuildWorkspace};