"use strict";exports.id=2787,exports.ids=[2787],exports.modules={2787:(a,b,c)=>{c.d(b,{createTask:()=>o,deleteTask:()=>s,getTask:()=>q,listTasks:()=>p,updateTask:()=>r});var d=c(73024),e=c(76760),f=c.n(e),g=c(77598),h=c.n(g),i=c(30192),j=c.n(i),k=c(13474),l=c(11178),m=c(75207);let n="task";async function o(a,b){let c=`t-${h().randomBytes(4).toString("hex")}`,e=b.title.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||c,g=new Date().toISOString().slice(0,10),i=`${g}-${e}.md`,j=f().join((0,k.FF)(a),n);await d.promises.mkdir(j,{recursive:!0});let l=await v(j,i),m={id:c,title:b.title.trim(),type:b.type??"feature",status:b.status??"backlog",priority:b.priority??"normal",labels:b.labels??[],assignee:b.assignee??null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),topicId:null,agentRequested:null,worktree:null,links:b.links??{},parent:b.parent??null,pre:b.pre??[],post:b.post??[],attachments:b.attachments??[],relPath:f().relative((0,k.FF)(a),l).split(f().sep).join("/"),body:(b.body??"").trim()};return await u(l,m),m}async function p(a){let b=await (0,l.dj)(a).catch(()=>[]),c=[];for(let d of b){if(d.meta.kind!==n)continue;let b=await t(d.abs,a).catch(()=>null);b&&c.push(b)}return c.sort((a,b)=>a.updatedAt<b.updatedAt?1:-1),c}async function q(a,b){return(await p(a)).find(a=>a.id===b)??null}async function r(a,b,c){let d=await q(a,b);if(!d)return null;let e=f().join((0,k.FF)(a),d.relPath),g={...d,...c,updatedAt:new Date().toISOString()};return await u(e,g),g}async function s(a,b){let c=await q(a,b);if(!c)return!1;let e=f().join((0,k.FF)(a),c.relPath);return await d.promises.rm(e,{force:!0}),!0}async function t(a,b){var c,e,g;let h=await d.promises.readFile(a,"utf8"),i=j()(h),l=i.data,n="string"==typeof l.id?l.id:null,o="string"==typeof l.title?l.title:null;if(!n||!o)return null;let p=f().relative((0,k.FF)(b),a).split(f().sep).join("/");return{id:n,title:o,type:x(l.type,m.ci,"feature"),status:x(l.status,m.Hi,"backlog"),priority:x(l.priority,m.PN,"normal"),labels:Array.isArray(l.labels)?l.labels.map(String):[],assignee:"string"==typeof l.assignee?l.assignee:null,createdAt:"string"==typeof l.createdAt?l.createdAt:new Date().toISOString(),updatedAt:"string"==typeof l.updatedAt?l.updatedAt:new Date().toISOString(),topicId:"string"==typeof l.topicId?l.topicId:null,agentRequested:"string"==typeof l.agentRequested?l.agentRequested:null,worktree:(c=l.worktree)&&"object"==typeof c&&"string"==typeof c.dir&&"string"==typeof c.branch&&"string"==typeof c.baseRef?{dir:c.dir,branch:c.branch,baseRef:c.baseRef}:null,links:(e=l.links)&&"object"==typeof e?{...Array.isArray(e.blocks)?{blocks:e.blocks.map(String)}:{},...Array.isArray(e.blockedBy)?{blockedBy:e.blockedBy.map(String)}:{},...Array.isArray(e.related)?{related:e.related.map(String)}:{}}:{},parent:"string"==typeof l.parent?l.parent:null,pre:y(l.pre),post:y(l.post),attachments:Array.isArray(g=l.attachments)?g.map(a=>{if(!a||"object"!=typeof a)return null;let b=a.kind;return"image"!==b&&"text"!==b&&"file"!==b||"string"!=typeof a.file?null:{kind:b,file:a.file,..."string"==typeof a.caption?{caption:a.caption}:{}}}).filter(a=>!!a):[],relPath:p,body:i.content.trim()}}async function u(a,b){let c={id:b.id,title:b.title,kind:n,type:b.type,status:b.status,priority:b.priority,labels:b.labels,assignee:b.assignee,createdAt:b.createdAt,updatedAt:b.updatedAt,topicId:b.topicId,agentRequested:b.agentRequested,worktree:b.worktree,links:b.links,parent:b.parent,pre:b.pre,post:b.post,attachments:b.attachments},e=b.body.trim(),g=j().stringify(e?e+"\n":"",c);await d.promises.mkdir(f().dirname(a),{recursive:!0}),await d.promises.writeFile(a,g,"utf8")}async function v(a,b){let c=f().extname(b),d=b.slice(0,b.length-c.length),e=f().join(a,b),g=2;for(;await w(e);)e=f().join(a,`${d}-${g}${c}`),g++;return e}async function w(a){try{return await d.promises.stat(a),!0}catch{return!1}}function x(a,b,c){return"string"==typeof a&&b.includes(a)?a:c}function y(a){return Array.isArray(a)?a.map(a=>a&&"object"==typeof a?"workflow"===a.kind&&"string"==typeof a.id?{kind:"workflow",id:a.id}:"chat"===a.kind&&"string"==typeof a.prompt?{kind:"chat",prompt:a.prompt}:null:null).filter(a=>!!a):[]}},75207:(a,b,c)=>{c.d(b,{Hi:()=>e,KT:()=>i,PN:()=>f,Yj:()=>g,ak:()=>j,ci:()=>d,kJ:()=>h});let d=["feature","bug","refactor","docs","chore","research","review","call","idea"],e=["backlog","ready","in-progress","review","done","blocked"],f=["low","normal","high"],g={feature:{isCode:!0},bug:{isCode:!0,defaultSkill:"deep-research"},refactor:{isCode:!0},docs:{isCode:!0},chore:{isCode:!0},research:{isCode:!1,defaultSkill:"deep-research"},review:{isCode:!0},call:{isCode:!1},idea:{isCode:!1}};function h(a){return d.includes(a)}function i(a){return e.includes(a)}function j(a){return f.includes(a)}}};