module.exports=[324725,(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"))},750227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},902157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},874533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},660526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},918622,(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"))},556704,(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"))},832319,(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"))},270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},522734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},193695,(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"))},198840,e=>{"use strict";var t=e.i(855104);let r=["localhost","127.0.0.1","[::1]"],n=new Set(["127.0.0.1","::1","::ffff:127.0.0.1"]),s=/^c[a-z0-9]{20,30}$/;e.s(["requireLocalhost",0,function(e){let s=e.headers.get("x-forwarded-for");if(s&&!s.split(",").map(e=>e.trim()).every(e=>n.has(e)))return t.NextResponse.json({error:"Forbidden"},{status:403});let a=e.headers.get("host")??"";return r.some(e=>a.startsWith(e))?null:t.NextResponse.json({error:"Forbidden"},{status:403})},"validateProjectId",0,function(e){return s.test(e)?null:t.NextResponse.json({error:"Invalid projectId format"},{status:400})},"validateTaskId",0,function(e){return s.test(e)?null:t.NextResponse.json({error:"Invalid taskId format"},{status:400})}])},192520,e=>{"use strict";let t;var r=e.i(750227),n=e.i(660526),s=e.i(902157);function a(){return t||(t=process.env.TOWER_DATA_DIR||(0,r.join)((0,n.homedir)(),".tower"),(0,s.existsSync)(t)||(0,s.mkdirSync)(t,{recursive:!0})),t}e.s(["getAssistantDir",0,function(){let e=(0,r.join)(a(),"assistant");return(0,s.existsSync)(e)||(0,s.mkdirSync)(e,{recursive:!0}),e},"getBackupsDir",0,function(){let e=(0,r.join)(a(),"backups");return(0,s.existsSync)(e)||(0,s.mkdirSync)(e,{recursive:!0}),e},"getExtensionsDir",0,function(){let e=(0,r.join)(a(),"extensions");return(0,s.existsSync)(e)||(0,s.mkdirSync)(e,{recursive:!0}),e},"getStorageDir",0,function(){let e=process.env.TOWER_STORAGE_DIR||function(){try{let e=(0,s.readFileSync)((0,r.join)(a(),"storage-location"),"utf-8").trim();return e.length>0?e:null}catch{return null}}(),t=e&&e.length>0?e:(0,r.join)(a(),"storage");return(0,s.existsSync)(t)||(0,s.mkdirSync)(t,{recursive:!0}),t},"getTowerDbPath",0,function(){let e;return(0,r.join)((e=(0,r.join)(a(),"database"),(0,s.existsSync)(e)||(0,s.mkdirSync)(e,{recursive:!0}),e),"tower.db")},"getTowerDir",0,a])},471552,e=>{"use strict";var t=e.i(522734),r=e.i(814747),n=e.i(192520),s=e.i(173215),a=e.i(53674);let o=`# Tower Assistant

你是 Tower Assistant — Tower 任务管理平台的内置 AI 操作员。

## 身份

- 你是一个**任务管理操作员**，不是编程助手
- 你通过 Tower MCP 工具帮助用户管理工作区、项目、任务
- 你**不能**读写文件、运行命令、编辑代码、搜索网页
- 如果用户请求你无法完成的操作，告诉他们需要通过开发 MCP 扩展来支持

## 回复风格

- 使用用户的语言回复（中文问中文答，英文问英文答）
- 简洁明了，不要冗长的解释
- 主动使用工具查询信息，而不是猜测
- 当用户问"你能做什么"时，只列出 Tower MCP 工具提供的能力

## 行动准则（最重要）

- **说到就做，绝不只announce不action**：一旦信息足够，就在**同一轮回复里直接调用对应的 MCP 工具**完成操作。
- **严禁**只回复「我现在立即创建」「好的，立即创建」「马上为你处理」这类话却不实际发出工具调用。这种回复等于没做事，会让用户反复追问。
- 信息不足时（例如缺项目、缺必填项），**直接提出具体问题**问用户，而不是含糊地说「我来创建」。
- 创建任务时如果工具返回 \`needsDefaultsSetup: true\`，**立刻**向用户询问两件事（是否默认用 Git worktree 隔离、是否创建后自动开始执行），拿到答复就调用 \`set_task_defaults\` 保存，然后**再次调用** \`create_task\`——不要停在「我来创建」这句话上。
- 用户催你（如「创建了吗？」「快创建」）时，说明上一轮你没真正调用工具——这一轮必须立即发出工具调用，而不是再次口头答应。
`;function i(e){try{return(0,t.readFileSync)(e,"utf-8")}catch{return null}}e.s(["ensureTowerDir",0,function(){let e=(0,n.getAssistantDir)(),l=(0,r.join)(e,"CLAUDE.md"),c=(0,a.getPackageRoot)(),u=(0,r.join)(c,"skills","tower","SKILL.md"),d=(0,r.join)(e,".claude","skills","tower"),p=(0,r.join)(d,"SKILL.md");if((0,t.existsSync)(l)&&i(l)===o||((0,t.writeFileSync)(l,o,"utf-8"),console.error(`[init-tower] Wrote ${l}`)),(0,t.existsSync)(u)){let e=i(u);null===e||(0,t.existsSync)(p)&&i(p)===e||((0,t.mkdirSync)(d,{recursive:!0}),(0,t.copyFileSync)(u,p),console.error(`[init-tower] Copied SKILL.md → ${d}`))}return function(e){let n=(0,r.join)(e,".claude","settings.json");if((0,t.existsSync)(n))try{let e=JSON.parse((0,t.readFileSync)(n,"utf-8"));e&&"mcpServers"in e&&(delete e.mcpServers,(0,t.writeFileSync)(n,JSON.stringify(e,null,2)+"\n","utf-8"),console.error(`[init-tower] Removed legacy mcpServers from ${n}`))}catch{}let a=(0,r.join)(e,".mcp.json");if((0,t.existsSync)(a))try{let e=(0,s.getTowerMcpName)(),r=JSON.parse((0,t.readFileSync)(a,"utf-8")),n=r.mcpServers??{};e in n&&(delete n[e],0===Object.keys(n).length?delete r.mcpServers:r.mcpServers=n,(0,t.writeFileSync)(a,JSON.stringify(r,null,2)+"\n","utf-8"),console.error(`[init-tower] Removed legacy tower entry from ${a}`))}catch{}}(e),e}])},137382,e=>{"use strict";var t=e.i(765876),r=e.i(675896),n=e.i(959160),s=e.i(97944),a=e.i(86757),o=e.i(204144),i=e.i(273436),l=e.i(743641),c=e.i(813766),u=e.i(840884),d=e.i(498814),p=e.i(780006),h=e.i(544432),m=e.i(772005),x=e.i(450223),f=e.i(193695);e.i(628400);var v=e.i(800071),y=e.i(855104),g=e.i(198840),w=e.i(471552);function R(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}async function S(t){let r=(0,g.requireLocalhost)(t);if(r)return r;let n=t.nextUrl.searchParams.get("sessionId");if(!n)return y.NextResponse.json({error:"sessionId required"},{status:400});let s=(0,w.ensureTowerDir)();try{let{getSessionMessages:t}=await e.A(145135),r=await t(n,{dir:s}),a=function(e){let t=[];for(let n of e)switch(n.type){case"user":{var r;let e=n.message,s="string"==typeof e?.content?e.content:"";s.startsWith("/tower ")&&(s=s.slice(7));let a=s.match(/<command-args>([\s\S]*?)<\/command-args>/);a&&(s=a[1].trim()),s=s.replace(/\n---\nThe user has attached the following file\(s\)[\s\S]*$/,"").replace(/\n---\nThe user has attached the following image\(s\)[\s\S]*$/,"").trim();let o=void(Array.isArray(r=e?.content)&&r.filter(e=>"image"===e.type&&e.source?.data).length);s&&t.push({id:R(),role:"user",content:s,attachmentFilenames:o});break}case"assistant":{let e=n.message,r=Array.isArray(e?.content)?e.content:[],s=r.filter(e=>"text"===e.type&&e.text).map(e=>e.text);for(let e of(s.length>0&&t.push({id:R(),role:"assistant",content:s.join("")}),r))"tool_use"===e.type&&e.name&&t.push({id:R(),role:"tool",content:JSON.stringify(e.input??{},null,2),toolName:e.name});break}case"system":{let e=n.message;e?.subtype==="tool_result"&&e.content&&t.push({id:R(),role:"tool",content:e.content,toolName:`${e.tool_name??"tool"} (result)`})}}return t}(r);return y.NextResponse.json({messages:a})}catch(t){let e=t instanceof Error?t.message:String(t);return console.error("[assistant-sessions] Error:",e),y.NextResponse.json({error:e},{status:500})}}e.s(["GET",0,S,"dynamic",0,"force-dynamic","runtime",0,"nodejs"],866197);var _=e.i(866197);let j=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/internal/assistant/sessions/route",pathname:"/api/internal/assistant/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/internal/assistant/sessions/route.ts",nextConfigOutput:"standalone",userland:_}),{workAsyncStorage:k,workUnitAsyncStorage:E,serverHooks:A}=j;async function C(e,t,n){n.requestMeta&&(0,s.setRequestMeta)(e,n.requestMeta),j.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/internal/assistant/sessions/route";y=y.replace(/\/index$/,"")||"/";let g=await j.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:w,params:R,nextConfig:S,parsedUrl:_,isDraftMode:k,prerenderManifest:E,routerServerContext:A,isOnDemandRevalidate:C,revalidateOnlyGenerated:T,resolvedPathname:N,clientReferenceManifest:b,serverActionsManifest:P}=g,q=(0,i.normalizeAppPath)(y),I=!!(E.dynamicRoutes[q]||E.routes[N]),D=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,_,!1):t.end("This page could not be found"),null);if(I&&!k){let e=!!E.routes[N],t=E.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(S.adapterPath)return await D();throw new f.NoFallbackError}}let O=null;!I||j.isDev||k||(O="/index"===(O=N)?"/":O);let U=!0===j.isDev||!I,M=I&&!U;P&&b&&(0,o.setManifestsSingleton)({page:y,clientReferenceManifest:b,serverActionsManifest:P});let $=e.method||"GET",F=(0,a.getTracer)(),H=F.getActiveScopeSpan(),L=!!(null==A?void 0:A.isWrappedByNextServer),K=!!(0,s.getRequestMeta)(e,"minimalMode"),W=(0,s.getRequestMeta)(e,"incrementalCache")||await j.getIncrementalCache(e,S,E,K);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let B={params:R,previewProps:E.preview,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:U,incrementalCache:W,cacheLifeProfiles:S.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,s)=>j.onRequestError(e,t,n,s,A)},sharedContext:{buildId:w}},G=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),V=c.NextRequestAdapter.fromNodeNextRequest(G,(0,c.signalFromNodeResponse)(t));try{let s,o=async e=>j.handle(V,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.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 n=r.get("next.route");if(n){let t=`${$} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",n),s.updateName(t))}else e.updateName(`${$} ${y}`)}),i=async s=>{var a,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&C&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(s);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let l=B.renderOpts.collectedTags;if(!I)return await (0,p.sendResponse)(G,J,a,B.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,n=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await j.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,A),t}},c=await j.handleResponse({req:e,nextConfig:S,cacheKey:O,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!I)return null;if((null==c||null==(a=c.value)?void 0:a.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(i=c.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",C?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(c.value.headers);return K&&I||u.delete(x.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(c.cacheControl)),await (0,p.sendResponse)(G,J,new Response(c.value.body,{headers:u,status:c.value.status||200})),null};L&&H?await i(H):(s=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${y}`,kind:a.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},i),void 0,!L))}catch(t){if(t instanceof f.NoFallbackError||await j.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,A),I)throw t;return await (0,p.sendResponse)(G,J,new Response(null,{status:500})),null}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:E})},"routeModule",0,j,"serverHooks",0,A,"workAsyncStorage",0,k,"workUnitAsyncStorage",0,E],137382)},482848,e=>{e.v(e=>Promise.resolve().then(()=>e(874533)))},268548,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node_util_0xr.y7p._.js"].map(t=>e.l(t))).then(()=>t(812057)))},144264,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_child_process_0pwkpv9._.js"].map(t=>e.l(t))).then(()=>t(233405)))},534777,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_util_0wtvqkc._.js"].map(t=>e.l(t))).then(()=>t(224361)))},200628,e=>{e.v(e=>Promise.resolve().then(()=>e(769310)))},145135,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__00yf3l2._.js","server/chunks/07-d_@anthropic-ai_claude-agent-sdk_sdk_mjs_0.721uk._.js"].map(t=>e.l(t))).then(()=>t(217040)))}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0q.piu~._.js.map