module.exports=[10005,e=>{"use strict";let t=new(e.i(472129)).ClaudeCliAdapter;async function r(n,l,a={}){let i="";try{let{query:r}=await e.A(145135),u=t.resolveCommand();for await(let e of r({prompt:n,options:{tools:a.tools??[],allowedTools:a.allowedTools??[],maxTurns:a.maxTurns??1,cwd:l,pathToClaudeCodeExecutable:u,sessionPersistence:!1}}))if("assistant"===e.type){let t=e.message.content.filter(e=>"text"===e.type);i+=t.map(e=>e.text??"").join("")}else if("result"===e.type){let t="string"==typeof e.result?e.result:"";t&&!i&&(i=t)}return i.trim()||null}catch(e){if(e.message?.includes("maximum number of turns")&&i.trim())return i.trim();return console.error("[aiQuery] Failed:",e.message,e.stack?.slice(0,300)),null}}async function n(e,t){let n=`以下是一次AI编程助手的终端会话记录。请用一句简短的中文总结这次会话做了什么（不超过50字，只回答总结内容，不要加引号或前缀）：

\`\`\`
${e.slice(-5e3)}
\`\`\``,l=await r(n,t);return l&&l.replace(/^[#*\->"'\s]+/,"").trim()||null}e.s(["aiQuery",0,r,"generateSummaryFromLog",0,n])},283373,e=>{"use strict";var t=e.i(233405),r=e.i(522734),n=e.i(843793),l=e.i(10005);function a(e,r){return(0,t.execFileSync)("git",e,{cwd:r,timeout:1e4,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}function i(e,t){if(t)return t;for(let t of["main","master","develop"])try{return a(["merge-base","HEAD",t],e)}catch{}return null}function u(e){if(!e)return null;let t=e.split("\n").filter(Boolean);if(0===t.length)return null;let r=t[0].replace(/^[a-f0-9]+\s+/,"");return 1===t.length?r:`${t.length} commits: ${r}`}async function s(e,t,o,c,m,f=null){try{let t;console.error(`[captureExecutionSummary] Starting: exec=${e.slice(0,8)} exit=${o} buffer=${c.length}chars worktree=${m} fork=${f?.slice(0,8)??"none"}`);let s=null,p=null,d=null;if(m&&(0,r.existsSync)(m))try{if(a(["rev-parse","--git-dir"],m),s=function(e,t){try{let r=i(e,t);if(!r)return null;return a(["log","--oneline",`${r}..HEAD`],e)||null}catch{return null}}(m,f),(p=function(e,t){try{let r=i(e,t);if(!r)return null;let n=a(["diff","--stat",`${r}..HEAD`],e);if(!n)return null;return function(e){let t=e.split("\n"),r=t[t.length-1];if(!r)return null;let n=r.match(/(\d+)\s+files?\s+changed/),l=r.match(/(\d+)\s+insertions?\(\+\)/),a=r.match(/(\d+)\s+deletions?\(-\)/);return n||l||a?{commits:0,filesChanged:n?parseInt(n[1],10):0,insertions:l?parseInt(l[1],10):0,deletions:a?parseInt(a[1],10):0}:null}(n)}catch{return null}}(m,f))&&s){let e=s.split("\n").filter(Boolean).length;p={...p,commits:e}}d=u(s)}catch{}let g=(t=c.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/\x1b[^[\]()][^\x1b]*/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"").replace(/\n{3,}/g,"\n\n").trim()).length<=10240?t:t.slice(t.length-10240);await n.db.taskExecution.update({where:{id:e},data:{summary:d??(s?u(s):null),gitLog:s??null,gitStats:p?JSON.stringify(p):null,exitCode:o,terminalLog:g||null}}),g&&m&&(console.error("[captureExecutionSummary] Starting background AI summary..."),(0,l.generateSummaryFromLog)(g,m).then(async t=>{t&&(console.error(`[captureExecutionSummary] AI summary ready: ${t.slice(0,80)}`),await n.db.taskExecution.update({where:{id:e},data:{summary:t}}))}).catch(e=>{console.error("[captureExecutionSummary] Background AI summary failed:",e)}))}catch(e){console.error("[captureExecutionSummary] Failed to capture summary:",e)}}e.s(["captureExecutionSummary",0,s])},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=_0lb0q5p._.js.map