module.exports=[287068,a=>{"use strict";var b=a.i(761469);function c(a,b){return{id:a.note_id,type:"note",title:a.title,subtitle:`${a.workspace_name} / ${a.project_name}`,navigateTo:`/workspaces/${a.workspaceId}/notes?projectId=${a.projectId}`,snippet:a.content?a.content.slice(0,b):void 0}}async function d(a,e="task",f){if(!a.trim())return[];let g=a.trim(),{resultLimit:h,allModeCap:i,snippetLength:j}=f;if("all"===e){let[a,b,c,e,h]=await Promise.allSettled([d(g,"task",f),d(g,"project",f),d(g,"repository",f),d(g,"note",f),d(g,"asset",f)]),j=a=>"fulfilled"===a.status?a.value.slice(0,i):[];return[...j(a),...j(b),...j(c),...j(e),...j(h)]}if("task"===e)return(await b.db.task.findMany({where:{OR:[{title:{contains:g}},{description:{contains:g}}]},include:{project:{include:{workspace:!0}}},take:h,orderBy:{updatedAt:"desc"}})).map(a=>{let b="DONE"===a.status||"CANCELLED"===a.status,c=a.project.workspaceId;return{id:a.id,type:"task",title:a.title,subtitle:`${a.project.workspace.name} / ${a.project.name}`,navigateTo:b?`/workspaces/${c}/archive?projectId=${a.projectId}`:`/workspaces/${c}?projectId=${a.projectId}`}});if("project"===e)return(await b.db.project.findMany({where:{OR:[{name:{contains:g}},{alias:{contains:g}},{description:{contains:g}}]},include:{workspace:!0},take:h,orderBy:{updatedAt:"desc"}})).map(a=>({id:a.id,type:"project",title:a.alias?`${a.name} (${a.alias})`:a.name,subtitle:a.workspace.name,navigateTo:`/workspaces/${a.workspaceId}?projectId=${a.id}`}));if("repository"===e)return(await b.db.repository.findMany({where:{OR:[{name:{contains:g}},{path:{contains:g}}]},include:{project:{include:{workspace:!0}}},take:h})).map(a=>({id:a.id,type:"repository",title:a.name,subtitle:`${a.project.workspace.name} / ${a.project.name} \xb7 ${a.branch}`,navigateTo:`/workspaces/${a.project.workspaceId}?projectId=${a.projectId}`}));if("note"===e){if(g.length<3)return(await b.db.$queryRawUnsafe(`SELECT n.id as note_id, n.title, n.content,
                n."projectId", p."workspaceId", p.name as project_name, w.name as workspace_name
         FROM "ProjectNote" n
         JOIN "Project" p ON p.id = n."projectId"
         JOIN "Workspace" w ON w.id = p."workspaceId"
         WHERE n.title LIKE ? OR n.content LIKE ?
         LIMIT ?`,`%${g}%`,`%${g}%`,h)).map(a=>c(a,j));try{return(await b.db.$queryRawUnsafe(`SELECT f.note_id, f.title, f.content,
                n."projectId", p."workspaceId", p.name as project_name, w.name as workspace_name
         FROM notes_fts f
         JOIN "ProjectNote" n ON n.id = f.note_id
         JOIN "Project" p ON p.id = n."projectId"
         JOIN "Workspace" w ON w.id = p."workspaceId"
         WHERE f.notes_fts MATCH ?
         ORDER BY rank
         LIMIT ?`,g,h)).map(a=>c(a,j))}catch{return(await b.db.$queryRawUnsafe(`SELECT n.id as note_id, n.title, n.content,
                n."projectId", p."workspaceId", p.name as project_name, w.name as workspace_name
         FROM "ProjectNote" n
         JOIN "Project" p ON p.id = n."projectId"
         JOIN "Workspace" w ON w.id = p."workspaceId"
         WHERE n.title LIKE ? OR n.content LIKE ?
         LIMIT ?`,`%${g}%`,`%${g}%`,h)).map(a=>c(a,j))}}return"asset"===e?(await b.db.projectAsset.findMany({where:{OR:[{filename:{contains:g}},{description:{contains:g}}]},include:{project:{include:{workspace:!0}}},take:h,orderBy:{createdAt:"desc"}})).map(a=>({id:a.id,type:"asset",title:a.filename,subtitle:`${a.project.workspace.name} / ${a.project.name}`,navigateTo:`/workspaces/${a.project.workspaceId}/assets?projectId=${a.projectId}`,snippet:a.description||void 0})):[]}a.s(["search",0,d])},396904,a=>a.a(async(b,c)=>{try{var d=a.i(815429),e=a.i(287068),f=a.i(980999),g=a.i(630048),h=b([f]);async function i(a,b="task"){let c=await (0,f.getConfigValues)(["search.resultLimit","search.allModeCap","search.snippetLength"]);return(0,e.search)(a,b,{resultLimit:c["search.resultLimit"]??20,allModeCap:c["search.allModeCap"]??5,snippetLength:c["search.snippetLength"]??80})}[f]=h.then?(await h)():h,(0,g.ensureServerEntryExports)([i]),(0,d.registerServerReference)(i,"605c2fc35fe8ffc8c86eea4b9b750a9ac5c7b745f6",null),a.s(["globalSearch",0,i]),c()}catch(a){c(a)}},!1),101844,a=>{"use strict";var b=a.i(815429),c=a.i(924868),d=a.i(522734),e=a.i(814747),f=a.i(761469),g=a.i(188139),h=a.i(630048);async function i(b){if(!b||"string"!=typeof b)return{safe:!1,reason:"无效的项目 ID"};let g=await f.db.project.findUnique({where:{id:b}});if(!g||!g.localPath)return{safe:!1,reason:"项目不存在或未设置本地路径"};if((await f.db.taskExecution.findMany({where:{task:{projectId:b},status:"RUNNING"},select:{id:!0}})).length>0)return{safe:!1,reason:"该项目有正在运行的任务执行，请先停止所有执行"};let h=await f.db.task.findMany({where:{projectId:b},select:{id:!0}}),{getSession:i}=await a.A(98813);for(let a of h)if(void 0!==i(a.id))return{safe:!1,reason:"该项目有活跃的终端会话，请先关闭"};let j=e.default.join(g.localPath,".worktrees");if((0,d.existsSync)(j))try{if((await (0,c.readdir)(j)).length>0)return{safe:!1,reason:"该项目有活跃的 Git Worktree，请先清理"}}catch{}return{safe:!0}}async function j(b,h){if(!b||"string"!=typeof b)return{success:!1,error:"无效的项目 ID"};if(!h||"string"!=typeof h||!e.default.isAbsolute(h))return{success:!1,error:"目标路径必须是非空的绝对路径"};let i=await f.db.project.findUnique({where:{id:b}});if(!i||!i.localPath)return{success:!1,error:"项目不存在或未设置本地路径"};let j=i.localPath;if(h===j)return{success:!1,error:"源路径和目标路径相同"};if((await f.db.taskExecution.findMany({where:{task:{projectId:b},status:"RUNNING"},select:{id:!0}})).length>0)return{success:!1,error:"该项目有正在运行的任务执行，请先停止所有执行"};let k=await f.db.task.findMany({where:{projectId:b},select:{id:!0}}),{getSession:l}=await a.A(98813);for(let a of k)if(void 0!==l(a.id))return{success:!1,error:"该项目有活跃的终端会话，请先关闭"};let m=e.default.join(j,".worktrees");if((0,d.existsSync)(m))try{if((await (0,c.readdir)(m)).length>0)return{success:!1,error:"该项目有活跃的 Git Worktree，请先清理"}}catch{}if((0,d.existsSync)(h))try{if((await (0,c.readdir)(h)).length>0)return{success:!1,error:"目标路径已存在且不为空"}}catch{return{success:!1,error:"目标路径已存在且不为空"}}let n=e.default.dirname(h);try{await (0,c.mkdir)(n,{recursive:!0})}catch(a){if("EACCES"===a.code||"EPERM"===a.code)return{success:!1,error:`无权限创建父目录 ${n} — 请检查 Git 路径映射规则的模板是否漏了 "~/" 前缀`};if("EROFS"===a.code)return{success:!1,error:`父目录所在文件系统只读：${n}`};return{success:!1,error:`创建父目录失败：${a.message||a.code||"未知错误"}`}}try{await (0,c.rename)(j,h)}catch(a){if("EXDEV"===a.code)return{success:!1,error:"源路径和目标路径不在同一文件系统，不支持跨设备迁移"};if("EACCES"===a.code||"EPERM"===a.code)return{success:!1,error:`无权限移动到 ${h}`};return{success:!1,error:a.message||"文件系统操作失败"}}return await f.db.project.update({where:{id:b},data:{localPath:h}}),(0,g.revalidatePath)("/workspaces"),{success:!0}}let k=`分析这个项目目录，生成一段简短的 Markdown 项目描述。

读取 package.json、README.md 等关键文件，然后概括：

**技术栈：** 一句话列出主要语言、框架、关键库
**定位：** 一句话说明项目是什么
**核心模块：** 2-3 个关键模块，每个一句话

要求：
- 总字数不超过 500 字
- 用简洁的 Markdown（加粗标签 + 短句），不要用 ## 大标题和表格
- 不要罗列每个文件/目录，只说关键信息
- 中文输出`,l=`Analyze this project directory and generate a brief Markdown project description.

Read package.json, README.md and other key files, then summarize:

**Tech Stack:** One sentence listing primary languages, frameworks, and key libraries
**Overview:** One sentence describing what this project is
**Core Modules:** 2-3 key modules, one sentence each

Requirements:
- Keep it under 1000 words
- Use concise Markdown (bold labels + short sentences), no ## headings or tables
- Don't list every file/directory, only key information
- Output in English`;async function m(b,c="zh"){if(!b||"string"!=typeof b)throw Error("无效的本地路径");if(b.startsWith("~"))throw Error("不支持 ~ 别名，请提供绝对路径");if(!e.default.isAbsolute(b))throw Error("本地路径必须为绝对路径");let{aiQuery:d}=await a.A(752453),f=await d("en"===c?l:k,b,{maxTurns:10,tools:["Read","Glob"],allowedTools:["Read","Glob"]});if(!f)throw Error("AI 分析未返回结果");return f.length>2e3?f.slice(0,2e3).trimEnd()+"\n\n...":f}(0,h.ensureServerEntryExports)([i,j,m]),(0,b.registerServerReference)(i,"40c7f324fe557fb80c37a1a32181503a0536257351",null),(0,b.registerServerReference)(j,"60c86ef167fca66c0b566738b7d16ce04945d66ce2",null),(0,b.registerServerReference)(m,"603afc0abc8a99c0d1556130213be4f1900ced3cf3",null),a.s(["analyzeProjectDirectory",0,m,"checkMigrationSafety",0,i,"migrateProjectPath",0,j])},42344,a=>a.a(async(b,c)=>{try{a.i(244256),a.i(495370);var d=a.i(396904),e=a.i(980999);a.i(101844),a.i(563736),a.i(4634);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),413773,a=>a.a(async(b,c)=>{try{var d=a.i(42344),e=a.i(244256),f=a.i(495370),g=a.i(396904),h=a.i(980999),i=a.i(101844),j=a.i(563736),k=a.i(4634),l=b([d,g,h]);[d,g,h]=l.then?(await l)():l,a.s(["003ef32d24bc4b29c342acf4c816cf95fa4fe3f598",()=>h.getActualWsPort,"003f1dfdc13dd3928867e8ca32a72ccaefc2e0573d",()=>k.getOnboardingStatus,"006aab408acb61a0962235f55a3de594983b7dd5bf",()=>j.listAllExtensionStatus,"400e2fda1bae5acb01074e51d080a2be2a77bc34cd",()=>h.getConfigValues,"4012b5a73e0f56276592ab3dffbfb4a5886b44ad1f",()=>h.resolveGitLocalPath,"4030983d0916967d1b45111b1f8932995e322ac168",()=>f.getLabelsForWorkspace,"405365149185a3f1aa7bf7b74cf5fd91f66a6c9d5b",()=>e.deleteWorkspace,"4054c3d2ea9f6bcddfa7d33d42dc7ae43c5d3bc071",()=>j.installExtension,"4054f9623c07304a83a2f85e6b3b6fae81dc47f655",()=>e.reorderWorkspaces,"40769e3e7c790732374614ca824e004ce8291d79f2",()=>e.createWorkspace,"4089bb43b964c3cc5b2848bc729865dee8e56f60a6",()=>k.dispatchTaskCompletionEvent,"4090dece3eac4df8d9aa55e39136298bd458446dac",()=>f.createLabel,"40ace337192d4dd9a4a7362eab01bc86850fb4a0d8",()=>k.setOnboardingProgress,"40b312e080b33001e97622ba996bad24f8aaf9fe1d",()=>j.checkExtension,"40b4afd819167bb48c681e66a7e9184ef54b187356",()=>j.uninstallExtension,"40c7f324fe557fb80c37a1a32181503a0536257351",()=>i.checkMigrationSafety,"40ccc3be5ee2c307201017260aa05492281bf067fb",()=>e.createProject,"40f89aa83057e20a65456875f67e50fe3a99de604e",()=>f.deleteLabel,"6003b9bf4e05e9d923ec7aa8ed47b1d2e8b1806cb7",()=>k.setOnboardingExtensions,"6022565280345647acafc879d6697aabada2ec392f",()=>k.completeOnboarding,"603afc0abc8a99c0d1556130213be4f1900ced3cf3",()=>i.analyzeProjectDirectory,"605c2fc35fe8ffc8c86eea4b9b750a9ac5c7b745f6",()=>g.globalSearch,"609263c53e73f969487fb3a78f5cad865efcc601e8",()=>e.updateWorkspace,"60c086bb0d6a417695daf1a78de8b35ca7f8183e15",()=>h.setConfigValue,"60c86ef167fca66c0b566738b7d16ce04945d66ce2",()=>i.migrateProjectPath,"60fed8ee888cd0a6a4480474a484ee4fe77a6d9c20",()=>h.getConfigValue]),c()}catch(a){c(a)}},!1),76052,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_0e27xy7._.js"].map(b=>a.l(b))).then(()=>b(492067)))},98813,a=>{a.v(a=>Promise.resolve().then(()=>a(962620)))},507502,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_worktree_ts_06cucy3._.js"].map(b=>a.l(b))).then(()=>b(845427)))},752453,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0m7ydqb._.js"].map(b=>a.l(b))).then(()=>b(897667)))}];

//# sourceMappingURL=_0cxhub8._.js.map