epiq 1.17.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Index-RF3FTG55.js +17 -0
- package/dist/{args-D7OXPSAH.js → args-2F7WNQYO.js} +1 -1
- package/dist/chunk-5WUPZIRV.js +120 -0
- package/dist/chunk-6R2YRUOL.js +2 -0
- package/dist/{chunk-ITVJCUOL.js → chunk-J3S3W27J.js} +1 -1
- package/dist/gui/main.js +118 -117
- package/dist/index.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{server-JQTYRNQ7.js → server-NKAY4NNC.js} +1 -1
- package/dist/{virtual-nodes-XI6JN2RD.js → virtual-nodes-DSAMVKWE.js} +1 -1
- package/package.json +1 -1
- package/dist/Index-3QU43YBE.js +0 -17
- package/dist/chunk-2KWSZBVJ.js +0 -2
- package/dist/chunk-7KCKIQRO.js +0 -116
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{$a as Bo,A as Jt,Aa as ht,
|
|
2
|
+
import{$a as Bo,A as Jt,Aa as ht,Ab as M,B as Qt,Ba as bo,Bc as xt,C as Zt,Ca as bt,Cc as Je,D as Ae,Da as Rt,E as O,F as eo,Fa as Ro,Fc as _,G as to,Ga as yt,Gc as Zo,H as te,Ha as ze,Hc as es,I as oo,Ia as yo,J as D,Ja as Ao,Jb as me,K as We,Ka as Se,Kb as Ee,La as Ke,M as Te,Ma as To,Mb as pe,N as so,Na as wo,O as no,Oa as At,P as pt,Pa as Tt,Pb as jo,Q as ro,Qa as y,Qb as Ho,R as io,Ra as So,Rb as Uo,S as ao,Sa as A,T as F,Ta as Eo,Ub as zo,V as U,Va as wt,Vb as Ko,W as $,Wa as ue,Wb as Xo,Xa as xo,Ya as ce,Za as oe,_ as C,_a as Co,ab as S,b as Fe,c as le,ca as lo,d as _e,e as Ge,f as zt,fa as uo,fb as Lo,g as Q,ga as co,gb as No,hc as qo,i as Kt,ia as k,k as $e,ka as mo,kb as ko,la as po,lb as Xe,ma as je,mb as Po,mc as Vo,n as ee,na as He,nb as Oo,nc as St,o as Xt,oa as we,ob as Mo,oc as Yo,pa as ft,pb as Do,q as mt,qa as gt,qb as Fo,ra as de,rb as _o,s as qt,sa as Ue,sb as Go,sc as Ve,ta as It,tc as Jo,ua as fo,ub as $o,va as go,wa as vt,wc as Qo,xa as Io,xc as Ye,y as Vt,ya as vo,yb as qe,yc as Et,z as Yt,za as ho,zb as Wo}from"./chunk-5WUPZIRV.js";import{g as Ut}from"./chunk-WUCQWBQE.js";import{b as d,c as m,d as l}from"./chunk-5RIQL7P4.js";var dn=e=>e.payload??{},Ct=e=>{let t=new Map,o={},s=new Set,n=new Set,a=new Set;for(let r of e){let{id:i,name:u}=dn(r);if(i)switch(r.action){case"create.contributor":case"create.tag":t.set(i,u??""),s.add(i),n.delete(i);break;case"rename.contributor":u!==void 0&&s.has(i)&&!n.has(i)&&t.set(i,u);break;case"tombstone.contributor":s.has(i)&&(t.set(i,We),n.add(i));break;case"restore.contributor":case"restore.tag":u!==void 0&&s.has(i)&&(t.set(i,u),n.delete(i));break;case"add.board":u!==void 0&&(t.set(i,u),a.add(i));break;case"add.swimlane":u!==void 0&&(t.set(i,u),a.add(i),o[i]=u);break;case"edit.title":u!==void 0&&a.has(i)&&(t.set(i,u),i in o&&(o[i]=u));break;default:break}}return{byId:t,lanes:o}};var un=e=>{let t=new Map,o=new Map;for(let s of e){let n=s.payload;!n?.id||!n.parent||(s.action==="move.node"&&t.set(s.id,o.get(n.id)),o.set(n.id,n.parent))}return t},os=e=>{let t=e.payload;return e.action==="tombstone.tag"||e.action==="restore.tag"?t?.id:t?.tag},cn=e=>{let t=new Set,o=new Map;for(let s of e){let n=s.payload,a=n?.id;a&&(s.action==="add.issue"&&t.add(a),n.parent&&o.set(a,n.parent))}return{issueIds:t,parentById:o}},mn=(e,{issueIds:t,parentById:o})=>{let s=e.payload;if(s?.issue)return s.issue;let n=new Set,a=s?.id;for(;a!==void 0&&!n.has(a);){if(t.has(a))return a;n.add(a),a=o.get(a)}return null},pn=new Set(["add.issue.comment","edit.issue.comment","delete.issue.comment"]),fn=e=>pn.has(e.action)?e.payload?.id??null:null,gn=new Set(["add.issue","move.node","close.issue","reopen.issue"]),In=(e,t)=>{let o=new Map;return e.map((s,n)=>{let a=t[n]??null;if(a===null)return{lane:null,laneBefore:null};let r=s.payload,i=null;if(gn.has(s.action)&&r?.id===a&&r.parent){let u=o.get(a);u!==void 0&&u!==r.parent&&(i=u),o.set(a,r.parent)}return{lane:o.get(a)??null,laneBefore:i}})},vn=e=>{let t=new Map,o=new Map;return e.map(s=>{let{id:n,name:a}=s.payload??{};if(!n)return null;s.action==="add.board"&&t.set(n,"board"),s.action==="add.swimlane"&&t.set(n,"swimlane");let r=t.get(n);if(!r)return null;let i={kind:r,name:o.get(n)??a};return(s.action==="edit.title"||s.action.startsWith("add."))&&a!==void 0&&o.set(n,a),i})},ts=90,hn=e=>{let t=e.trim().split(`
|
|
3
3
|
`)[0]?.trim()??"";return t.length>ts?`${t.slice(0,ts).trimEnd()}\u2026`:t},ss=({kind:e,name:t})=>t===void 0?e:`${e} "${t}"`,bn=(e,t,o,s)=>{let{name:n,parent:a}=e.payload??{},r=ss(t);switch(e.action){case"move.node":{if(t.kind==="board"||!a)return`Moved ${r}`;let i=o.get(a);return i?s.get(e.id)===a?`Moved ${r} within ${i}`:`Moved ${r} to ${i}`:`Moved ${r}`}case"edit.title":return n===void 0?`Renamed ${r}`:`Renamed ${r} to "${n}"`;case"delete.node":return`Deleted ${r}`;case"lock.node":return`Locked ${r}`;default:return null}},Rn=(e,t,o,s,n)=>{let a=e.payload,r=os(e),i=e.action?Zo(e.action):"";if(a?.md!==void 0){let f=hn(a.md),g=e.action==="edit.description"&&!s&&n?`${i} of ${ss(n)}`:i;return f?`${g}: ${f}`:g}if(n&&!s){let f=bn(e,n,t,o);if(f)return f}if(e.action==="move.node"&&a?.parent){let f=t.get(a.parent),g=s?`${A(s)} moved`:"Moved";return f?o.get(e.id)===a.parent?`${g} within ${f}`:`${g} to ${f}`:s?g:i}if((e.action==="close.issue"||e.action==="reopen.issue")&&s)return`${A(s)} ${i.toLowerCase()}`;if(Qt(e.action))return[i,Zt(e)].filter(Boolean).join(" ");let u=r!==void 0?t.get(r)??"":a?.assignee!==void 0?t.get(a.assignee)??"":a?.email!==void 0?a.email:a?.name!==void 0?`"${a.name}"`:"";return[i,u].filter(Boolean).join(" ")},Bt=(e,t)=>e?D(e,t.get(e)):null,yn=(e,t)=>{let o=e.payload;return{actor:Bt(e.userId,t),tag:Bt(os(e),t),assignee:Bt(o?.assignee,t)}},ns=e=>{let t=new Map,o=new Set,s=n=>{let a=new Set,r=n;for(;r&&!a.has(r);){if(o.has(r))return r;a.add(r),r=t.get(r)}return null};return e.map(n=>{let a=n.payload,r=a?.id;if(!r)return null;n.action==="add.board"&&o.add(r);let i=n.action==="close.issue"?s(r):null,u=a.parent??a.issue;return u&&t.set(r,u),i!==null?i:o.has(r)?r:s(r)})},rs=e=>An.has(e),An=new Set(["create.contributor","rename.contributor","tombstone.contributor","restore.contributor","link.contributor.user","link.contributor.email","unlink.contributor.email","connect.repo","edit.repo","disconnect.repo","create.tag","tombstone.tag","restore.tag"]),is=(e,t)=>{let o=ns(e);return e.filter((s,n)=>o[n]===t)},Tn=(e,t=new Map)=>{let o=new Map([...t,...Ct(e).byId]),s=un(e),n=cn(e),a=e.map(c=>mn(c,n)),r=vn(e),i=In(e,a),u=ns(e),f=eo(e.map(c=>te(c)));return e.flatMap((c,I)=>{let v=f[I]??null;return v===null?[]:[{id:c.id,t:v,action:c.action,label:Rn(c,o,s,a[I]??null,r[I]??null),issue:a[I]??null,target:fn(c),...i[I],board:u[I]??null,...yn(c,o)}]}).sort((c,I)=>c.t-I.t)},wn=e=>{let t=new Map;for(let s of e){if(s.issue===null||s.lane===null)continue;let n=t.get(s.issue)??[],a=n[n.length-1];(a===void 0||a.lane!==s.lane)&&(n.push({t:s.t,lane:s.lane,board:s.board}),t.set(s.issue,n))}let o=new Map;for(let[s,n]of t){let a=n[n.length-1];o.set(s,{changes:n,from:n[0].t,closedFrom:a.lane===k?a.t:null})}return o},Sn=(e,t)=>{let o=0,s=e.length;for(;o<s;){let n=o+s>>1;e[n].t<t?o=n+1:s=n}return e[o-1]},as=(e,t,o)=>{let s={};for(let[n,a]of e){if(a.from>=t||a.closedFrom!==null&&a.closedFrom<t)continue;let r=Sn(a.changes,t);r===void 0||r.lane===k||o&&r.board!==o||(s[n]=r.lane)}return s},En=e=>Ct(e).lanes,xe=null,ls=e=>{let t=Ke(e);if(xe&&xe.root===e&&xe.signature===t)return m("Timeline entries, cached",xe.index);let o=oe(e);if(l(o))return d(o.message);let s=Tn(o.value,ce(e)),n={entries:s,lanes:wn(s),laneNames:En(o.value)};return xe={root:e,signature:t,index:n},m("Timeline entries, built",n)};var ds=1e5,xn=2e4,Qe=null,us=Promise.resolve(),ms=e=>{let t=us.then(e,e);return us=t.then(()=>{},()=>{}),t},Ze=e=>{let t=Se(e);return l(t)?t:Q({repoRoot:t.value})},z=()=>{if(!Je())return{mode:"live",asOfTime:null};let{timeMode:e}=Qo();return e==="live"?{mode:"live",asOfTime:null}:{mode:"scrub",asOfTime:Qe}},cs=(e,t)=>{let o=0,s=e.length;for(;o<s;){let n=o+s>>1;e[n].t<t?o=n+1:s=n}return o},aa=async(e={})=>{let t=Ze(e.repoRoot);if(l(t))return d(t.message);let o=ls(t.value);if(l(o))return d(o.message);let s=o.value.entries,n=Date.now(),a=e.end??n,r=e.start??s[0]?.t??a;if(a<=r)return m("Empty time window",{bucketMs:0,buckets:[],capped:!1,events:[],lanesAtStart:{},laneNames:o.value.laneNames,closedLane:k,earliest:r,latest:a});let i=cs(s,r),u=cs(s,a),f=s.slice(i,u).filter(p=>!e.boardId||p.board===e.boardId||rs(p.action)),g=f.map(p=>p.t),c=Math.max(1,Math.ceil((a-r)/ds)),I=new Map;for(let p of g){let b=Math.min(ds-1,Math.floor((p-r)/c)),T=r+b*c;I.set(T,(I.get(T)??0)+1)}let v=[...I.entries()].sort(([p],[b])=>p-b).map(([p,b])=>({t:p,count:b})),h=f.length>xn;return m("Computed event timeline",{bucketMs:c,buckets:v,capped:h,events:h?[]:f,lanesAtStart:as(o.value.lanes,r,e.boardId),laneNames:o.value.laneNames,closedLane:k,earliest:r,latest:a})},ps=e=>{let t=oe(e);if(l(t))return d(t.message);let o=xt();if(l(o))return d(o.message);Qe=null;let s=wt(t.value),{fatal:n,skipped:a}=At(s);return n.length>0?d(n.map(r=>r.message).join(", ")):(Tt(a),Et({readOnly:!1,readOnlyReason:void 0,timeMode:"live",unappliedEvents:[],replay:null}),m("Restored live state",!0))},Cn=(e,t)=>{Qe=null;let o=ps(e);return l(o)?d(`${t} (recovery to live also failed: ${o.message})`):d(t)},Bn=e=>ms(async()=>{let t=Ze(e.repoRoot);if(l(t))return d(t.message);let o=Co(t.value,e.targetTime);if(l(o))return d(o.message);let{appliedEvents:s,unappliedEvents:n}=o.value,a=xt();if(l(a))return a;let r=wt(s),{fatal:i,skipped:u}=At(r);return i.length>0?Cn(t.value,i.map(f=>f.message).join(", ")):(Tt(u),Et({readOnly:!0,timeMode:"peek",unappliedEvents:n,replay:null}),Qe=e.targetTime,m("Checked out historical state",{asOfTime:e.targetTime}))}),la=async e=>{let t=Ze(e.repoRoot);if(l(t))return d(t.message);let o=Bo(t.value);if(l(o))return d(o.message);let s=o.value.get(e.eventId)??null;return s===null?d("Event not found in the log"):Bn({repoRoot:e.repoRoot,targetTime:s+1})},da=(e={})=>ms(async()=>{let t=Ze(e.repoRoot);if(l(t))return d(t.message);let o=ps(t.value);return l(o)?d(o.message):m("Returned to live state",!0)});import Nn from"node:fs";var fs=new Map,Ln=3e4,gs=async e=>{let t=fs.get(e);if(t&&Date.now()-t.readAt<Ln)return{name:t.name,email:t.email};let o=await Ge({args:["config","--get-regexp","^user\\.(name|email)$"],cwd:e}),s=null,n=null;if(o.exitCode===0)for(let a of(o.stdout??"").split(`
|
|
4
4
|
`)){let r=a.indexOf(" ");if(r===-1)continue;let i=a.slice(0,r),u=a.slice(r+1);i==="user.name"&&(s=u.trim()||null),i==="user.email"&&(n=Te(u)||null)}return fs.set(e,{name:s,email:n,readAt:Date.now()}),{name:s,email:n}},Is=async e=>(await gs(e)).email,fe=async e=>(await gs(e)).name;var se=e=>{let t=$e(e??process.cwd());return l(t)?d(t.message):m("Resolved Epiq repo root",t.value)},et=null,kn=async(e,t)=>{let o=se(e);if(l(o))return o;let s=Q({repoRoot:o.value});if(l(s))return d(s.message);let n=le(o.value);if(l(n))return d(n.message);if(!(et!==null&&et.repoRoot===o.value&&et.stateBranchRoot===s.value&&Nn.existsSync(Kt(s.value)))){let c=await zo({repoRoot:o.value,stateBranchName:n.value});if(l(c))return d(c.message);let I=await Ko({repoRoot:o.value,stateBranchRoot:s.value,stateBranchName:n.value});if(l(I))return d(I.message);et={repoRoot:o.value,stateBranchRoot:s.value}}if(t?.pull??!1){let c=await _e({cwd:s.value,args:["pull","--ff-only"]});l(c)&&Fe.info(3,c.message)}let r={repoRoot:o.value,stateBranchRoot:s.value},i=ee();l(i)||mt(i.value),mt({gitEmail:await Is(o.value),gitName:await fe(o.value)});let u=Ke(s.value);if(To(s.value)===u&&Je()&&z().mode==="live")return m("Booted Epiq state, unchanged",r);let f=ue(s.value);if(l(f))return d(f.message);let g=pe(f.value.events,f.value.unreadable);return l(g)?d(g.message):(wo(s.value,u),m("Booted Epiq state",r))},W=()=>{let e=ee();return l(e)?d(e.message):e.value.userId?e.value.userName?m("Resolved actor",{userId:e.value.userId,userName:e.value.userName}):d("Unable to retrieve user name"):d("Unable to retrieve user id")},B=()=>{let e=Ye();return l(e)?d(e.message):e},L=e=>kn(e,{pull:!1}),R=async e=>{let t=await L(e);if(l(t))return t;let o=W();if(l(o))return o;let s=B();return l(s)?s:m("Booted",{boot:t.value,actor:o.value,state:s.value})};import{ulid as Pn}from"ulid";var N=e=>{let t=B();if(l(t))return t;let o=t.value.nodes[e];return!o||o.isDeleted?d("Issue not found"):F(o)?o.readonly?d("Issue is readonly"):m("Found issue",o):d("Target must be an issue")},j=e=>{let t=B();if(l(t))return t;let o=t.value.nodes[e];return!o||o.isDeleted?d("Swimlane not found"):U(o)?o.readonly?d("Swimlane is readonly"):m("Found swimlane",o):d("Target must be a swimlane")},Ce=e=>{let t=B();if(l(t))return t;let o=t.value.nodes[e];return!o||o.isDeleted?d("Board not found"):$(o)?o.readonly?d("Board is readonly"):m("Found board",o):d("Target must be a board")};var Lt=e=>{if(!e)return;let t=B();if(l(t))return;let o=t.value.nodes[e];if(!o||!($(o)||U(o)))return;let s=o.props?.description;return s?.trim()?s:void 0},tt=e=>{let t=Lt(e);return t?{laneDescription:t}:{}},Be=e=>{let t=Lt(e);return t?{boardDescription:t}:{}},ge=e=>{let t=Lt(e);return t?{description:t}:{}},Le=({node:e,label:t,max:o,description:s,actor:n,stateBranchRoot:a,action:r="edit.description"})=>{let i=Wo(s),u=M(t,i,o);if(u)return d(u);if(z().mode!=="live")return d(`Cannot edit the ${t.toLowerCase()} while time travelling`);let f={id:e.id,ref:A(e.id),description:i};if((e.props?.description??"")===i)return m("No changes made",f);let g={id:Pn(),...y(n),action:r,payload:{id:e.id,md:i}},c=S([g],a);return l(c)?d(c.message):m(`Edited ${t.toLowerCase()}`,f)},On=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=Ce(e.boardId);return l(o)?o:Le({node:o.value,label:"Board description",max:qe("board"),description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot})},Mn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=j(e.swimlaneId);return l(o)?o:Le({node:o.value,label:"Swimlane description",max:qe("swimlane"),description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot})},Dn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=de(e.goal);return o?Le({node:{id:o.id,props:{description:o.description}},label:"Goal description",action:"edit.goal.description",max:qe("goal"),description:e.description,actor:t.value.actor,stateBranchRoot:t.value.boot.stateBranchRoot}):d(`No goal called or with the id "${e.goal}"`)};import{ulid as Ne}from"ulid";var kt=e=>({id:e.id,name:C(e.name),color:fo(e)}),Ie=e=>{let t=Ue(e);return t?{goal:kt(t)}:{}},vs=e=>({...kt(e),...ht(e.id),...e.description&&{description:e.description},...vt(e.id)&&{closed:!0}}),hs=()=>bt().map(vs),Fn=async(e={})=>{let t=await L(e.repoRoot);return l(t)?t:m("Listed goals",bt().map(o=>({...vs(o),boards:Io(o.id).map(s=>({id:s,ref:A(s)}))})))},ot=e=>ho(e).map(t=>({...kt(t),...ht(t.id),members:vo(t.id,e).map(o=>({id:o.id,done:bo(o)}))})),Nt=(e,t)=>l(e)||!t||!vt(t)?e:m(`${e.message}: all its tickets are closed, so the goal is closed`,e.value),st=(e,t,o)=>{let s=S(t,e);return l(s)?d(s.message):m("Saved",o)},_n=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=N(e.issueId);if(l(o))return o;let s=o.value,n={id:s.id,ref:A(s.id)},a;if(e.goal!==null){let u=de(e.goal);if(!u){let f=await bs({repoRoot:e.repoRoot,name:e.goal,issueId:s.id});return l(f)?f:Nt(m(`Created goal "${f.value.name}"`,n),f.value.id)}a=u.id}let r=It(s,a);if(r.length===0)return m("No changes made",n);let i=y(t.value.actor);return Nt(st(t.value.boot.stateBranchRoot,r.map(u=>({id:Ne(),...i,...u})),n),a)},bs=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=gt(e.name),s=Rt(o);if(s)return d(s);let n=y(t.value.actor),a=Ne(),r=[{id:a,...n,action:"create.goal",payload:{id:a,name:o}}];if(e.issueId){let i=N(e.issueId);if(l(i))return i;let u=i.value;for(let f of It(u,a))r.push({id:Ne(),...n,...f})}return Nt(st(t.value.boot.stateBranchRoot,r,{id:a,name:o}),a)},Gn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=ft(e.goalId);if(!o)return d("Goal not found");let s=gt(e.name);if(s===o.name)return m("No changes made",{id:o.id,name:s});let n=Rt(s,o.id);return n?d(n):st(t.value.boot.stateBranchRoot,[{id:Ne(),...y(t.value.actor),action:"rename.goal",payload:{id:o.id,name:s}}],{id:o.id,name:s})},$n=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=ft(e.goalId);return o?st(t.value.boot.stateBranchRoot,[{id:Ne(),...y(t.value.actor),action:"tombstone.goal",payload:{id:o.id}}],{id:o.id,name:o.name}):d("Goal not found")};import{ulid as Wn}from"ulid";var nt=e=>{let t=mo(e);return t.length>0?{rules:t}:{}},jn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=j(e.swimlaneId);if(l(o))return o;let s=o.value,n=po(s,e.rule,e.on);if(l(n))return n;let a={id:s.id,ref:A(s.id),rule:e.rule};if(!n.value)return m(n.message,a);let r=S([{id:Wn(),...y(t.value.actor),...n.value}],t.value.boot.stateBranchRoot);return l(r)?d(r.message):m(e.on?"Added lane rule":"Removed lane rule",a)};import Hn from"node:fs";import Un from"node:path";import{ulid as Pt}from"ulid";var zn=e=>{if(e.filePath)try{return m("Read attachment file",{data:Hn.readFileSync(e.filePath),name:e.name??Un.basename(e.filePath)})}catch(t){return d(`Unable to read ${e.filePath}: ${t instanceof Error?t.message:String(t)}`)}return e.dataBase64?m("Decoded attachment data",{data:Buffer.from(e.dataBase64,"base64"),name:e.name??"image"}):d("Provide either filePath or dataBase64")},rt=()=>{let e=ee();return l(e)?yt:e.value.attachmentMaxKb??yt},Kn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=N(e.issueId);if(l(o))return o;let s=zn(e);if(l(s))return s;let n=yo(t.value.boot.stateBranchRoot,s.value.data,rt());if(l(n))return n;let a=C(s.value.name).trim()||"image",r=Pt(),i={id:Pt(),...y(t.value.actor),action:"add.issue.attachment",payload:{id:r,issue:e.issueId,author:t.value.actor.userId,hash:n.value.hash,ext:n.value.ext,name:a,bytes:n.value.bytes}},u=S([i],t.value.boot.stateBranchRoot);if(l(u))return d(u.message);let f=ze(n.value.hash,n.value.ext);return m("Added issue attachment",{id:r,issueId:e.issueId,fileName:f,bytes:n.value.bytes,markdown:Ro(a,f)})},Xn=async e=>{let t=await R(e.repoRoot);if(l(t))return t;let o=t.value.state.eventLog.find(i=>i.action==="add.issue.attachment"&&i.payload.id===e.attachmentId);if(!o)return d("Unable to resolve attachment");if(o.payload.author!==t.value.actor.userId)return d("You can only delete your own attachments");let s=N(o.payload.issue);if(l(s))return s;if(t.value.state.eventLog.some(i=>i.action==="delete.issue.attachment"&&i.payload.id===e.attachmentId))return m("Attachment already deleted",{id:e.attachmentId,issueId:o.payload.issue});let a={id:Pt(),...y(t.value.actor),action:"delete.issue.attachment",payload:{id:e.attachmentId,issue:o.payload.issue}},r=S([a],t.value.boot.stateBranchRoot);return l(r)?d(r.message):m("Deleted issue attachment",{id:e.attachmentId,issueId:o.payload.issue})},qn=async e=>{let t=await L(e.repoRoot);return l(t)?t:Ao(t.value.stateBranchRoot,e.fileName,rt())};var Vn=e=>{switch(e.action){case"add.issue":case"move.node":case"close.issue":case"reopen.issue":return e.payload.parent;default:return null}},Ot=(e,t)=>{let o=[];for(let s of e){let n=Vn(s);if(n===null||n===o.at(-1)?.laneId)continue;let a=te(s);o.push({laneId:n,enteredAt:a===null?t:Ae(a)})}return o},Rs=(e,t)=>e.reduce((o,s)=>{let n=te(s);return n===null?o:Math.max(o,Ae(n))},t),ke=(e,t)=>Ot(e,t).at(-1)?.enteredAt??t;var ne=e=>uo(e).map(t=>D(t.id,t.name)),Yn=e=>_.getCommentsByIssue(e).sort((t,o)=>t.id<o.id?-1:t.id>o.id?1:0).map(t=>({id:t.id,author:oo(t.authorId,_.getContributor(t.authorId)?.name),createdAt:O(t.id),body:t.md})),re=e=>co(e).map(({id:t,name:o})=>D(t,o)),Jn=3,Qn=3,Zn=400,er=200,tr=" \u2026 [cut: call epiq_issue_get with allComments: true to read the rest]",or=e=>{let t=e.split(`
|
|
5
5
|
`).slice(0,Qn).join(`
|