module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46619,e=>{"use strict";var t=e.i(22734),r=e.i(14747);class a{static workspaceRoot=process.cwd();static ensureDirs(e){let a=r.default.join(e,".ai","neural-loom");t.default.existsSync(a)||t.default.mkdirSync(a,{recursive:!0});let n=r.default.join(e,".claude","commands");t.default.existsSync(n)||t.default.mkdirSync(n,{recursive:!0})}static initializeStaging(e=process.cwd()){this.ensureDirs(e);let a=r.default.join(e,".claude","commands","ccp.md");t.default.existsSync(a)||t.default.writeFileSync(a,"Read the prompt from .ai/neural-loom/cprompt.md and execute it. This is a staged prompt from the NeuralLoom UI. Treat the contents as user instructions.\n");let n=r.default.join(e,".claude","commands","ccc.md");t.default.existsSync(n)||t.default.writeFileSync(n,"Read the context from .ai/neural-loom/ccontext.md. This is persistent context from the NeuralLoom UI. Absorb it as background information for this session. Acknowledge briefly what you received.\n")}static updatePrompt(e,a=process.cwd()){this.ensureDirs(a);let n=r.default.join(a,".ai","neural-loom","cprompt.md");t.default.writeFileSync(n,e)}static updateContext(e,a=process.cwd()){this.ensureDirs(a);let n=r.default.join(a,".ai","neural-loom","ccontext.md");t.default.writeFileSync(n,e)}static updateRules(e,a=process.cwd()){this.ensureDirs(a);let n=r.default.join(a,"AGENTS.md");t.default.writeFileSync(n,e,"utf8")}static loadPrompt(e=process.cwd()){let a=r.default.join(e,".ai","neural-loom","cprompt.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static loadRules(e=process.cwd()){let a=r.default.join(e,"AGENTS.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static compileGlobalRules(){this.compileSessionContext()}static compileSessionContext(e=process.cwd(),a){this.ensureDirs(e),this.initializeStaging(e);let n=r.default.join(e,"AGENTS.md"),s="";if(t.default.existsSync(n))s=t.default.readFileSync(n,"utf8");else{let e=r.default.join(this.workspaceRoot,"AGENTS.md");t.default.existsSync(e)&&(s=t.default.readFileSync(e,"utf8"))}let o=`## Workspace Root Map (${e}):
${this.generateProjectMapFor(e)}`;a&&Array.isArray(a)&&a.forEach(e=>{t.default.existsSync(e)&&(o+=`

## Scoped Directory Map (${e}):
${this.generateProjectMapFor(e)}`)});let i=`# System Rules & Guidelines

${s}

# Project File Hierarchy Map

${o}`;this.updateContext(i,e);let l=r.default.join(e,".ai","neural-loom","cprompt.md");t.default.existsSync(l)||t.default.writeFileSync(l,"Hello! Please review the project context (/ccc) and check for any tasks to execute.")}static generateProjectMapFor(e){try{let a=(e,n=0)=>{if(n>2)return"";let s="";for(let o of t.default.readdirSync(e,{withFileTypes:!0})){if(o.name.startsWith(".")||"node_modules"===o.name||"out"===o.name||".next"===o.name)continue;let t="  ".repeat(n);o.isDirectory()?(s+=`${t}- [Dir] ${o.name}/
`,s+=a(r.default.join(e,o.name),n+1)):s+=`${t}- [File] ${o.name}
`}return s};return a(e)}catch(e){return"Error generating project map: "+(e instanceof Error?e.message:String(e))}}}e.s(["ContextManager",0,a])},69018,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),x=e.i(26937),m=e.i(10372),h=e.i(93695);e.i(52474);var R=e.i(220),y=e.i(89171),g=e.i(46619);async function v(){try{let e=g.ContextManager.loadPrompt(),t=g.ContextManager.loadRules();return y.NextResponse.json({prompt:e,rules:t})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return y.NextResponse.json({error:e},{status:500})}}async function w(e){try{let{promptText:t,rulesText:r}=await e.json();return void 0!==t&&g.ContextManager.updatePrompt(t),void 0!==r&&g.ContextManager.updateRules(r),g.ContextManager.compileGlobalRules(),y.NextResponse.json({success:!0})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return y.NextResponse.json({error:e},{status:500})}}e.s(["GET",0,v,"POST",0,w],82104);var S=e.i(82104);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/context/route",pathname:"/api/context",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/context/route.ts",nextConfigOutput:"",userland:S,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:j,serverHooks:A}=E;async function b(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/context/route";y=y.replace(/\/index$/,"")||"/";let g=await E.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:S,nextConfig:C,parsedUrl:j,isDraftMode:A,prerenderManifest:b,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:k,clientReferenceManifest:M,serverActionsManifest:q}=g,F=(0,i.normalizeAppPath)(y),_=!!(b.dynamicRoutes[F]||b.routes[k]),D=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,j,!1):t.end("This page could not be found"),null);if(_&&!A){let e=!!b.routes[k],t=b.dynamicRoutes[F];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await D();throw new h.NoFallbackError}}let O=null;!_||E.isDev||A||(O="/index"===(O=k)?"/":O);let U=!0===E.isDev||!_,H=_&&!U;q&&M&&(0,o.setManifestsSingleton)({page:y,clientReferenceManifest:M,serverActionsManifest:q});let $=e.method||"GET",I=(0,s.getTracer)(),G=I.getActiveScopeSpan(),K=!!(null==N?void 0:N.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),B=(0,n.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,C,b,L);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let W={params:S,previewProps:b.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:U,incrementalCache:B,cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>E.onRequestError(e,t,a,n,N)},sharedContext:{buildId:v,deploymentId:w}},z=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(z,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>E.handle(X,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=I.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${$} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${$} ${y}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!L&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=W.renderOpts.fetchMetrics;let i=W.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=W.renderOpts.collectedTags;if(!_)return await (0,p.sendResponse)(z,V,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,N),t}},d=await E.handleResponse({req:e,nextConfig:C,cacheKey:O,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!_)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&_||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,x.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(z,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&G?await i(G):(n=I.getActiveScopeSpan(),await I.withPropagatedContext(e.headers,()=>I.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},i),void 0,!K))}catch(t){if(t instanceof h.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:F,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,N),_)throw t;return await (0,p.sendResponse)(z,V,new Response(null,{status:500})),null}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:j})},"routeModule",0,E,"serverHooks",0,A,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,j],69018)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0k6w___._.js.map