module.exports=[495370,a=>{"use strict";var b=a.i(815429),c=a.i(761469),d=a.i(188139),e=a.i(496877);async function f(a){return c.db.label.findMany({where:{OR:[{isBuiltin:!0},{workspaceId:a}]},orderBy:[{isBuiltin:"desc"},{name:"asc"}]})}async function g(a){let b=e.createLabelSchema.parse(a),f=await c.db.label.create({data:{name:b.name,color:b.color,workspaceId:b.workspaceId}});return(0,d.revalidatePath)("/workspaces"),f}async function h(a){let b=await c.db.label.findUnique({where:{id:a}});if(!b)throw Error("Label not found");if(b.isBuiltin)throw Error("Cannot delete builtin labels");await c.db.label.delete({where:{id:a}}),(0,d.revalidatePath)("/workspaces")}async function i(a,b){await c.db.$transaction(async c=>{await c.taskLabel.deleteMany({where:{taskId:a}}),b.length>0&&await c.taskLabel.createMany({data:b.map(b=>({taskId:a,labelId:b}))})}),(0,d.revalidatePath)("/workspaces")}async function j(a){return(await c.db.taskLabel.findMany({where:{taskId:a},include:{label:!0}})).map(a=>a.label)}(0,a.i(630048).ensureServerEntryExports)([f,g,h,i,j]),(0,b.registerServerReference)(f,"401870399b89009a4502624938f15efc197a88ebec",null),(0,b.registerServerReference)(g,"40f571ce03adc188fe32ee860d48e55a1cf6b2a684",null),(0,b.registerServerReference)(h,"404ad1847b150ab1e558b855e3eece3b3315136889",null),(0,b.registerServerReference)(i,"60f2ad2f2ebd3461f369f7eff7cd52e082adaed75c",null),(0,b.registerServerReference)(j,"40997bc2676629966ee5b257ab6694e81c304b6ce7",null),a.s(["createLabel",0,g,"deleteLabel",0,h,"getLabelsForWorkspace",0,f,"getTaskLabels",0,j,"setTaskLabels",0,i])},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,"605ee2e74b8c10c47e2334c9891fe5bdecbe23940c",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,"404dcaf1dc95afc391344bd6d4c7d9daeda04835cd",null),(0,b.registerServerReference)(j,"604088b38ae055299d29dd4fe5af2eb8395b2b3d5f",null),(0,b.registerServerReference)(m,"60b1e9d8d102c97c9e03b5924b5744c3be4e5744e3",null),a.s(["analyzeProjectDirectory",0,m,"checkMigrationSafety",0,i,"migrateProjectPath",0,j])},196195,a=>{"use strict";var b=a.i(815429),c=a.i(233405),d=a.i(814747),e=a.i(446786);function f(a){return a.startsWith("~/")||"~"===a?d.default.join(e.default.homedir(),a.slice(1)):a}async function g(a){if(!a?.trim())return null;let b=d.default.resolve(f(a));try{return(0,c.execSync)("git rev-parse --abbrev-ref HEAD",{cwd:b,encoding:"utf-8",timeout:5e3}).trim()}catch{return null}}async function h(a){if(!a?.trim())return[];let b=d.default.resolve(f(a));try{let a,d;return a=new Set((0,c.execSync)("git branch --format='%(refname:short)'",{cwd:b,encoding:"utf-8",timeout:5e3}).trim().split("\n").filter(Boolean).map(a=>a.replace(/'/g,""))),d=(0,c.execSync)("git branch -r --format='%(refname:short)'",{cwd:b,encoding:"utf-8",timeout:5e3}).trim().split("\n").filter(Boolean).map(a=>a.replace(/'/g,"").replace(/^origin\//,"")).filter(b=>"HEAD"!==b&&!a.has(b)),[...a,...d]}catch{return[]}}async function i(a){if(!a?.trim())return;let b=d.default.resolve(f(a));try{(0,c.spawn)("git",["fetch","--prune"],{cwd:b,stdio:"ignore",detached:!0}).unref()}catch{}}(0,a.i(630048).ensureServerEntryExports)([g,h,i]),(0,b.registerServerReference)(g,"40bb845be3488b537749ce5903c8274735813d497e",null),(0,b.registerServerReference)(h,"401a31f33236fc2c607cdadafa503c1cb1e6fb3d20",null),(0,b.registerServerReference)(i,"40f194623f7775e9cf69a06393bc11e0dedad5ef16",null),a.s(["fetchRemoteBranches",0,i,"getCurrentBranch",0,g,"getProjectBranches",0,h])},488766,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),a.i(689171),a.i(536960),a.i(196195);var f=b([d,e]);[d,e]=f.then?(await f)():f,a.s([]),c()}catch(a){c(a)}},!1),566559,a=>a.a(async(b,c)=>{try{var d=a.i(488766),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=a.i(689171),m=a.i(536960),n=a.i(196195),o=b([d,g,h]);[d,g,h]=o.then?(await o)():o,a.s(["0008e048c31e099f5b0ff42ce909dfb635d13d86c4",()=>j.listAllExtensionStatus,"001f9f5f09a8ec4af5306467a95b9a884f1bd15610",()=>h.getActualWsPort,"00312df80b3c8208578a8b18cd0fa599e94ffdee48",()=>k.getOnboardingStatus,"00c5dba7038be3c8ef0ed9565e7e1eafbdeb3d5b78",()=>e.getWorkspacesWithProjects,"4003af4db97554807eaae82a1c1bfc1d44ee57c3f4",()=>e.deleteWorkspace,"40040f4fb9834d8b51a904ea8a6dc164a28474719d",()=>l.deleteTask,"4008d5df4a813b5da80654743c06cb9afd012aa47e",()=>j.installExtension,"400b85788c94fdf13b91ebd07c6b0c654b4639bd26",()=>m.openInTerminal,"40142e10fa89a2473b5bf6073ec2a2e4d173f8aa8f",()=>e.getProjectByLocalPath,"401870399b89009a4502624938f15efc197a88ebec",()=>f.getLabelsForWorkspace,"40195180d5a2c9c2a056dd1ac9e6f01864b2897663",()=>k.dispatchTaskCompletionEvent,"401a31f33236fc2c607cdadafa503c1cb1e6fb3d20",()=>n.getProjectBranches,"401d9b63bc4bef391b5a2793da2985461b471bd022",()=>l.getArchivedTaskCount,"40263d9083d759e6c0f7b43b32a9046b7104f50c87",()=>e.getRecentLocalProjects,"402a9489f0725e413bf18bc3eb7e0110de6e3dafbd",()=>l.getTaskOverview,"4047e75f6b563a057a25b3703e0157987da7ddef47",()=>l.checkWorktreeClean,"4048b6c9c8b9568f3f3e3221907e0b72c9133bdf3f",()=>j.uninstallExtension,"404ad1847b150ab1e558b855e3eece3b3315136889",()=>f.deleteLabel,"404da9d668d485be7c807d52a1cc6eaab6f32f7452",()=>l.createTask,"404dcaf1dc95afc391344bd6d4c7d9daeda04835cd",()=>i.checkMigrationSafety,"406cdf547b9a5e97bd6adcfb5388440a2ea4d9a582",()=>e.createProject,"407047ebb0b71eaa6813d5443dc6c24439e9d452f9",()=>e.getWorkspacesWithRecentTasks,"407098a18e64c23f6264dd01012c585e40207d7729",()=>e.getWorkspaceById,"407ac0259c4c529308bfb2f1160d20d00ebe088060",()=>l.getArchivedTasks,"407dd144dadc927c501a20a311504bf49531c43078",()=>e.getOrCreateTowerTaskId,"408c17cfecd963a980c178b4da5d44d388638100bd",()=>m.openInFileManager,"4098a2e12f3bf84cda1b91fe6b63e5cd2f57a431c5",()=>h.getConfigValues,"40997bc2676629966ee5b257ab6694e81c304b6ce7",()=>f.getTaskLabels,"409dcb08312444bd27e76817435b0ca3b52ce09f5b",()=>l.getProjectTasks,"409fde2335dd72a0cc5f9fc4007807c90cf84ac587",()=>e.createWorkspace,"40ad6d9d9fc9f4271dc88f0a6f0ce0b998e9c1942a",()=>e.deleteProject,"40b7fbed759b8e664404cd676bc0471a8998532582",()=>k.setOnboardingProgress,"40bb845be3488b537749ce5903c8274735813d497e",()=>n.getCurrentBranch,"40c3ea6bef09de01a9e170315978f773338ae5cd08",()=>h.resolveGitLocalPath,"40cb4a6bb2aa8c3f18f26548a6a34c458196c45e81",()=>m.openInEditor,"40cf7c74a26a6b79d2db9f4952e321ba9ac217b7a0",()=>j.checkExtension,"40d1577557e20171f1037c3aa9bfd40bef3932a8b2",()=>l.searchTasks,"40eb42cee81987cdd889d4207810747489aa4ba222",()=>l.toggleTaskPinned,"40edef7a4c404a6cdd5a19f7e0ceca3abb693d1de4",()=>e.reorderWorkspaces,"40f194623f7775e9cf69a06393bc11e0dedad5ef16",()=>n.fetchRemoteBranches,"40f571ce03adc188fe32ee860d48e55a1cf6b2a684",()=>f.createLabel,"602b826b85b8bad56bcfd2c11aa0feb221cbdb4baa",()=>l.commitWorktreeChanges,"602ebb4afa308d031087f196c68af4b48c2c328910",()=>k.completeOnboarding,"604088b38ae055299d29dd4fe5af2eb8395b2b3d5f",()=>i.migrateProjectPath,"605ee2e74b8c10c47e2334c9891fe5bdecbe23940c",()=>g.globalSearch,"607a5fed773e92b7a633af89e870e87936de01057c",()=>h.setConfigValue,"60831f735faffaad311a7d171059867d5f617d013c",()=>e.updateWorkspace,"60833fa33531c02f00a1f5248eb271eabd3b1a0e25",()=>k.setOnboardingExtensions,"609ac8f0624cd6a8c30fb3077c4e46c8a57a589770",()=>h.getConfigValue,"60a8b260c2dc2ba3ac88d62911a4d42430eca3c5f5",()=>l.updateTask,"60b1e9d8d102c97c9e03b5924b5744c3be4e5744e3",()=>i.analyzeProjectDirectory,"60e5bd011dc6a4e5a4e590212faf0b52070559e282",()=>e.updateProject,"60f2ad2f2ebd3461f369f7eff7cd52e082adaed75c",()=>f.setTaskLabels,"60f659e004fb16c8a128b886533dd5575184a09662",()=>l.updateTaskStatus]),c()}catch(a){c(a)}},!1),76052,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_127qa83._.js"].map(b=>a.l(b))).then(()=>b(492067)))},98813,a=>{a.v(a=>Promise.resolve().then(()=>a(962620)))},507502,a=>{a.v(a=>Promise.resolve().then(()=>a(845427)))},752453,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__13374-3._.js"].map(b=>a.l(b))).then(()=>b(897667)))},144264,a=>{a.v(a=>Promise.resolve().then(()=>a(233405)))},662330,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__0la1659._.js"].map(b=>a.l(b))).then(()=>b(818992)))},323970,a=>{a.v(a=>Promise.resolve().then(()=>a(522734)))},173855,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_lib_open-targets_ts_12a-_~u._.js"].map(b=>a.l(b))).then(()=>b(289288)))},889618,a=>{a.v(a=>Promise.resolve().then(()=>a(163812)))}];

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