import{readFile}from"node:fs/promises";import{readDevelopmentEnvironmentHostValues}from"#cli/dev/environment.js";import{createHash}from"node:crypto";import{computeChannelRouteRegistrations}from"#internal/nitro/host/channel-routes.js";async function computeDevelopmentHostFingerprint(e){let r=e.compileResult.manifest,i=[r,...r.subagents.map(e=>e.agent)],a={agentName:r.config.name,bundler:{externalDependencies:[...new Set(i.flatMap(e=>e.config.build?.externalDependencies??[]))].sort((e,t)=>e.localeCompare(t)),extensionScopes:(r.extensionMounts??[]).map(e=>({packageNamespace:e.packageNamespace,sourceRoot:e.sourceRoot})).sort((e,t)=>e.sourceRoot.localeCompare(t.sourceRoot)),sandboxBackends:[...new Set(i.map(e=>e.sandbox?.backendName).filter(e=>e!==void 0))].sort((e,t)=>e.localeCompare(t))},channels:computeChannelRouteRegistrations(e),environment:readDevelopmentEnvironmentHostValues(e.appRoot),instrumentation:await readInstrumentationSource(e),workflow:{enabled:i.some(e=>e.workflowTool!==void 0),world:r.config.experimental?.workflow?.world??`local`}};return createHash(`sha256`).update(JSON.stringify(a)).digest(`hex`)}async function readInstrumentationSource(t){let n=t.compiledArtifacts.instrumentationSourcePath;return n===void 0?null:await readFile(n,`utf8`)}export{computeDevelopmentHostFingerprint};