module.exports=[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"))},724241,e=>{"use strict";var t=e.i(233405),r=e.i(522734),i=e.i(843793);async function n(e){let n=await i.db.task.findUnique({where:{id:e},include:{project:!0}});if(!n)return{kind:"error",status:404,message:"Task not found"};if(!n.project?.localPath)return{kind:"error",status:400,message:"Project has no local path"};let s=n.baseBranch||"main",a=n.project.localPath,l=await i.db.taskExecution.findFirst({where:{taskId:e},orderBy:{createdAt:"desc"}});if(!l)return{kind:"empty"};let{forkCommit:o,mergeCommit:c,branchTipCommit:d,worktreeBranch:u,worktreePath:f}=l;if(c&&o){let e=d||c;return{kind:"ok",data:{diffCwd:a,diffTarget:`${o}..${e}`,baseRef:o,endRef:e,worktreePath:null}}}if(o&&f&&(0,r.existsSync)(f))return{kind:"ok",data:{diffCwd:f,diffTarget:o,baseRef:o,endRef:null,worktreePath:f}};if(o&&!f)return{kind:"ok",data:{diffCwd:a,diffTarget:o,baseRef:o,endRef:null,worktreePath:null}};if(u)try{let e=(0,t.execFileSync)("git",["merge-base",s,u],{cwd:a,encoding:"utf-8",timeout:5e3}).trim(),i=f&&(0,r.existsSync)(f)?f:a;return{kind:"ok",data:{diffCwd:i,diffTarget:e,baseRef:e,endRef:null,worktreePath:f&&(0,r.existsSync)(f)?f:null}}}catch{return{kind:"branch-deleted"}}return{kind:"empty"}}e.s(["resolveTaskDiffSource",0,n])},10005,e=>{"use strict";let t=new(e.i(472129)).ClaudeCliAdapter;async function r(i,n,s={}){let a="";try{let{query:r}=await e.A(145135),l=t.resolveCommand();for await(let e of r({prompt:i,options:{tools:s.tools??[],allowedTools:s.allowedTools??[],maxTurns:s.maxTurns??1,cwd:n,pathToClaudeCodeExecutable:l,sessionPersistence:!1}}))if("assistant"===e.type){let t=e.message.content.filter(e=>"text"===e.type);a+=t.map(e=>e.text??"").join("")}else if("result"===e.type){let t="string"==typeof e.result?e.result:"";t&&!a&&(a=t)}return a.trim()||null}catch(e){if(e.message?.includes("maximum number of turns")&&a.trim())return a.trim();return console.error("[aiQuery] Failed:",e.message,e.stack?.slice(0,300)),null}}async function i(e,t){let i=`以下是一次AI编程助手的终端会话记录。请用一句简短的中文总结这次会话做了什么（不超过50字，只回答总结内容，不要加引号或前缀）：

\`\`\`
${e.slice(-5e3)}
\`\`\``,n=await r(i,t);return n&&n.replace(/^[#*\->"'\s]+/,"").trim()||null}e.s(["aiQuery",0,r,"generateSummaryFromLog",0,i])},322263,e=>{"use strict";var t=e.i(233405),r=e.i(522734),i=e.i(843793);async function n(e,t){await e.$executeRawUnsafe("DELETE FROM notes_fts WHERE note_id = ?",t.id),await e.$executeRawUnsafe("INSERT INTO notes_fts(note_id, title, content) VALUES (?, ?, ?)",t.id,t.title,t.content)}var s=e.i(10005),a=e.i(724241),l=e.i(678272);function o(e,r,i=1048576){try{return(0,t.execFileSync)("git",e,{cwd:r,encoding:"utf-8",timeout:3e4,maxBuffer:i,stdio:["pipe","pipe","pipe"]}).trim()}catch{return null}}async function c(e){let t=await i.db.task.findUnique({where:{id:e},include:{project:!0}});if(!t||!t.project)return null;let n=t.project.localPath??null,s=[],c=null,d=0,u=null,f=n||process.cwd();if(n){let t=await (0,a.resolveTaskDiffSource)(e);if("ok"===t.kind){let{diffCwd:e,diffTarget:r}=t.data;f=e;let i=r.includes("..")?r:`${r}..HEAD`,n=o(["diff","--numstat",r],e,0x4000000);n&&(s=(0,l.parseDiffOutput)(n,"").files),c=o(["log","--oneline",i],e)||null;let a=o(["rev-list","--count",i],e);d=a&&parseInt(a,10)||0;let p=o(["diff",r],e,0x4000000);p&&(u=p.length>12288?p.slice(0,12288)+"\n...(diff truncated)":p)}}if(0===s.length&&0===d){let t=await i.db.taskExecution.findFirst({where:{taskId:e},orderBy:{createdAt:"desc"},select:{gitLog:!0,worktreePath:!0}});t?.gitLog&&(c=t.gitLog,d=t.gitLog.split("\n").filter(Boolean).length),t?.worktreePath&&(0,r.existsSync)(t.worktreePath)&&(f=t.worktreePath)}if(0===s.length&&0===d)return null;let p=(await i.db.projectAsset.findMany({where:{taskId:e},orderBy:{createdAt:"asc"},select:{filename:!0,description:!0}})).map(e=>({filename:e.filename,description:e.description}));return{taskId:e,taskTitle:t.title,projectId:t.projectId,projectName:t.project.name,files:s,commitLog:c,commitCount:d,diffText:u,assets:p,cwd:f}}async function d(e){let t=e.files.slice(0,60).map(e=>e.isBinary?`${e.filename} (binary)`:`${e.filename} (+${e.added}/-${e.removed})`).join("\n")||"（无文件清单）",i=`你是资深工程师。下面是一个刚完成的开发任务的代码改动信息，请用简洁中文写一段「改动摘要」：说明这次改动做了什么、解决了什么问题、主要涉及哪些模块或逻辑。要求 3-6 句、纯文本，不要 markdown 标题，不要逐条罗列文件（文件清单会另外展示）。

任务标题：${e.taskTitle}

提交记录：
${e.commitLog??"（无提交记录）"}

变更文件（共 ${e.files.length} 个）：
${t}

diff（可能已截断）：
\`\`\`diff
${e.diffText??"（无 diff）"}
\`\`\``,n=(0,r.existsSync)(e.cwd)?e.cwd:process.cwd(),a=await (0,s.aiQuery)(i,n,{maxTurns:1});if(a){let e=a.replace(/^[#*\->"'\s]+/,"").trim();if(e)return e}var l=e.commitLog;if(!l)return null;let o=l.split("\n").filter(Boolean);if(0===o.length)return null;let c=o[0].replace(/^[a-f0-9]+\s+/,"");return 1===o.length?c:`${o.length} 个提交：${c}`}async function u(e,t={}){let r=t.kind??"done",s=null;try{s=await c(e)}catch(e){console.error("[captureTaskOverview] Failed to gather change data:",e);return}if(!s)return void console.error(`[captureTaskOverview] No changes for task=${e.slice(0,8)} — skip`);let a=s;(async()=>{try{let t=await d(a),s=new Date().toISOString(),l=function(e,t,r,i="done"){let n=[];if(n.push("cancelled"===i?"> 本笔记由任务取消时自动生成，记录已产生的改动，作为下次重启该任务的参考经验。":"> 本笔记由任务完成时自动生成，记录本次任务的改动概览，便于后续复盘与排查。"),n.push(""),n.push("## 改动摘要"),n.push(t??"（未能生成改动摘要）"),n.push(""),n.push("## 文件清单"),e.files.length>0){let t=e.files.slice(0,100);for(let e of t)n.push(e.isBinary?`- \`${e.filename}\`（二进制）`:`- \`${e.filename}\` (+${e.added} / -${e.removed})`);e.files.length>t.length&&n.push(`- …其余 ${e.files.length-t.length} 个文件`),n.push(""),n.push(`共 ${e.files.length} 个文件、${e.commitCount} 个提交。`)}else n.push(`（未能获取精确文件清单，本次约 ${e.commitCount} 个提交。）`);if(n.push(""),n.push("## 相关附件与参考资料"),e.assets.length>0)for(let t of e.assets)n.push(t.description?`- ${t.filename} — ${t.description}`:`- ${t.filename}`);else n.push("（无）");return n.push(""),n.push("---"),n.push(`> 关联任务：${e.taskTitle} (\`${e.taskId}\`)`),n.push(`> 项目：${e.projectName}`),n.push(`> 生成时间：${r}`),n.join("\n")}(a,t,s,r),o=function(e,t="done"){return`${"cancelled"===t?"任务概览（已取消）：":"任务概览："}${e}`.slice(0,200)}(a.taskTitle,r),c=await i.db.projectNote.create({data:{title:o,content:l,category:"任务笔记",projectId:a.projectId,taskId:a.taskId}});await n(i.db,{id:c.id,title:c.title,content:c.content}),console.error(`[captureTaskOverview] Note created: ${c.id} for task=${e.slice(0,8)}`)}catch(e){console.error("[captureTaskOverview] Failed to create overview note:",e)}})()}e.s(["captureTaskOverview",0,u],322263)},482848,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node_child_process_06l~6ej._.js"].map(t=>e.l(t))).then(()=>t(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(e=>Promise.resolve().then(()=>e(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(t=>Promise.all(["server/chunks/[root-of-the-server]__0fey.8j._.js"].map(t=>e.l(t))).then(()=>t(769310)))},145135,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__0lhlhz4._.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__08u6wg.._.js.map