module.exports=[24361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},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 i=`## Workspace Root Map (${e}):
${this.generateProjectMapFor(e)}`;a&&Array.isArray(a)&&a.forEach(e=>{t.default.existsSync(e)&&(i+=`

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

${s}

# Project File Hierarchy Map

${i}`;this.updateContext(o,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 i of t.default.readdirSync(e,{withFileTypes:!0})){if(i.name.startsWith(".")||"node_modules"===i.name||"out"===i.name||".next"===i.name)continue;let t="  ".repeat(n);i.isDirectory()?(s+=`${t}- [Dir] ${i.name}/
`,s+=a(r.default.join(e,i.name),n+1)):s+=`${t}- [File] ${i.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])},86100,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(26937),h=e.i(10372),x=e.i(93695);e.i(52474);var R=e.i(220),y=e.i(89171),g=e.i(29307);async function v(e){try{let{searchParams:t}=new URL(e.url),r=t.get("id"),a=g.SessionManager.getInstance();if(r){let e=a.getSession(r);if(!e)return y.NextResponse.json({error:"Session not found"},{status:404});return y.NextResponse.json({...e.getStatus(),logs:e.logs})}let n=a.listSessions();return y.NextResponse.json({sessions:n})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return y.NextResponse.json({error:e},{status:500})}}e.s(["GET",0,v],72626);var w=e.i(72626);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/route.ts",nextConfigOutput:"",userland:w,...{}}),{workAsyncStorage:E,workUnitAsyncStorage:C,serverHooks:j}=S;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),S.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/sessions/route";y=y.replace(/\/index$/,"")||"/";let g=await S.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:E,nextConfig:C,parsedUrl:j,isDraftMode:A,prerenderManifest:N,routerServerContext:b,isOnDemandRevalidate:T,revalidateOnlyGenerated:k,resolvedPathname:P,clientReferenceManifest:q,serverActionsManifest:_}=g,F=(0,o.normalizeAppPath)(y),M=!!(N.dynamicRoutes[F]||N.routes[P]),D=async()=>((null==b?void 0:b.render404)?await b.render404(e,t,j,!1):t.end("This page could not be found"),null);if(M&&!A){let e=!!N.routes[P],t=N.dynamicRoutes[F];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await D();throw new x.NoFallbackError}}let O=null;!M||S.isDev||A||(O="/index"===(O=P)?"/":O);let U=!0===S.isDev||!M,H=M&&!U;_&&q&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:q,serverActionsManifest:_});let I=e.method||"GET",$=(0,s.getTracer)(),G=$.getActiveScopeSpan(),K=!!(null==b?void 0:b.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),B=(0,n.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,C,N,L);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let W={params:E,previewProps:N.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)=>S.onRequestError(e,t,a,n,b)},sharedContext:{buildId:v,deploymentId:w}},z=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t));try{let n,i=async e=>S.handle(X,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.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=`${I} ${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(`${I} ${y}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!L&&T&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!M)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[h.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>=h.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=h.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 S.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,b),t}},u=await S.handleResponse({req:e,nextConfig:C,cacheKey:O,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!M)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return L&&M||d.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,m.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(z,V,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};K&&G?await o(G):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${I} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":I,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof x.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:F,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,b),M)throw t;return await (0,p.sendResponse)(z,V,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:C})},"routeModule",0,S,"serverHooks",0,j,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,C],86100)},37661,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node-pty_12c-8pf._.js"].map(t=>e.l(t))).then(()=>t(75609)))}];

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