@oxgeneral/orch 1.0.5 → 1.0.7
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/App-LEVUTWQN.js +22 -0
- package/dist/{chunk-UTDC3OB3.js → chunk-4TDXD3LA.js} +53 -6
- package/dist/chunk-4TDXD3LA.js.map +1 -0
- package/dist/{chunk-BSJVYRI3.js → chunk-EH3HRQP4.js} +59 -8
- package/dist/chunk-EH3HRQP4.js.map +1 -0
- package/dist/chunk-FQ5YUP4J.js +4 -0
- package/dist/{chunk-TPTHLFOB.js → chunk-HYPSQAQX.js} +1 -1
- package/dist/{chunk-LXNRCJ22.js → chunk-KR7VDF23.js} +1 -1
- package/dist/{chunk-KFQTWMZI.js → chunk-LOJ26OVK.js} +1 -1
- package/dist/{chunk-PJ5DKXGR.js → chunk-N4OXN2HW.js} +1 -1
- package/dist/{chunk-MOWC2CHX.js → chunk-TWEMIPRN.js} +12 -8
- package/dist/chunk-TWEMIPRN.js.map +1 -0
- package/dist/chunk-WVJTXBPL.js +11 -0
- package/dist/claude-ADMRIWTR.js +2 -0
- package/dist/{claude-4R6L6BWY.js → claude-OTQ2NSJR.js} +3 -3
- package/dist/{claude-4R6L6BWY.js.map → claude-OTQ2NSJR.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{codex-YRSODLH4.js → codex-AZD52UPS.js} +1 -1
- package/dist/{codex-IMOW5ZUZ.js → codex-WQ3LU3MM.js} +3 -3
- package/dist/{codex-IMOW5ZUZ.js.map → codex-WQ3LU3MM.js.map} +1 -1
- package/dist/container-FXUUV6PP.js +4 -0
- package/dist/{cursor-2HILMNM3.js → cursor-M3EJ432K.js} +1 -1
- package/dist/{cursor-NHV7X3WG.js → cursor-TKV5FFCN.js} +3 -3
- package/dist/{cursor-NHV7X3WG.js.map → cursor-TKV5FFCN.js.map} +1 -1
- package/dist/doctor-P2J6VAUX.js +2 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/{init-56QC5QVX.js → init-PTAYCSMO.js} +4 -4
- package/dist/{once-runner-UCMXCY6C.js → once-runner-AMKCFW22.js} +1 -1
- package/dist/{opencode-3S4VDXRG.js → opencode-4G7VAZGY.js} +1 -1
- package/dist/{opencode-ULT6DYCT.js → opencode-YWT3M4NX.js} +3 -3
- package/dist/{opencode-ULT6DYCT.js.map → opencode-YWT3M4NX.js.map} +1 -1
- package/dist/orchestrator-JOTMB5XT.js +13 -0
- package/dist/orchestrator-XPEMMBOO.js +6 -0
- package/dist/{orchestrator-64BHTD42.js.map → orchestrator-XPEMMBOO.js.map} +1 -1
- package/dist/{serve-3DV74ZSO.js → serve-5OAANN6J.js} +1 -1
- package/dist/shell-JC2WDWBR.js +2 -0
- package/dist/{shell-UXEJRK3D.js → shell-PMLIRG3N.js} +3 -3
- package/dist/{shell-UXEJRK3D.js.map → shell-PMLIRG3N.js.map} +1 -1
- package/dist/{task-M2JGNUYW.js → task-QFLIIRKZ.js} +1 -1
- package/dist/{tui-4VRDSRVB.js → tui-BJHZBCIR.js} +1 -1
- package/dist/{workspace-manager-ABXFBL2A.js → workspace-manager-5EYCMAEO.js} +25 -9
- package/dist/workspace-manager-5EYCMAEO.js.map +1 -0
- package/dist/workspace-manager-XKOZ5WM6.js +3 -0
- package/package.json +19 -9
- package/readme.md +111 -2
- package/scripts/demo.sh +202 -0
- package/scripts/{postinstall.js → postinstall.cjs} +25 -4
- package/skills/orch/SKILL.md +278 -0
- package/dist/App-SSYYVFGW.js +0 -22
- package/dist/chunk-BSJVYRI3.js.map +0 -1
- package/dist/chunk-MOWC2CHX.js.map +0 -1
- package/dist/chunk-QNZ6D63E.js +0 -4
- package/dist/chunk-UTDC3OB3.js.map +0 -1
- package/dist/chunk-X54D5JZG.js +0 -11
- package/dist/claude-ZLVOLRUG.js +0 -2
- package/dist/container-FUHRQOV4.js +0 -4
- package/dist/doctor-GKTV4YYD.js +0 -2
- package/dist/orchestrator-64BHTD42.js +0 -6
- package/dist/orchestrator-KEH7RQAV.js +0 -13
- package/dist/shell-OBHIVC2H.js +0 -2
- package/dist/workspace-manager-ABXFBL2A.js.map +0 -1
- package/dist/workspace-manager-Q6WWXSTR.js +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {a}from'./chunk-N4OXN2HW.js';import {c,a as a$1}from'./chunk-HXOMNULD.js';import {b,a as a$2}from'./chunk-BCPUTULS.js';import {f,h,g}from'./chunk-64WUDYEM.js';import {m}from'./chunk-IKNBPOQL.js';import nn,{useState,useMemo,useEffect,useRef,useCallback}from'react';import {Box,Text,useInput,useApp,useStdout}from'ink';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var e={amber:"#ffaf00",amberDim:"#af8700",green:"#5faf87",red:"#d75f5f",blue:"#5fafd7",yellow:"#d7af00",cyan:"#5fd7d7",purple:"#af87ff",white:"#eeeeee",silver:"#bcbcbc",gray:"#808080",dim:"#585858",ghost:"#3a3a3a",void:"#262626",errorBg:"#3d1515",warnBg:"#3d2e0a",successBg:"#0f2d1f",infoBg:"#1a1a22",toolBg:"#0f1f2d"},Cn="\u2501",Ve="\u2500",ue="\xB7",Qt="\u25C8",Tr="\u2605",mo="\u27F3",Ut="\u25C6",In={in_progress:e.green,retrying:e.yellow,review:e.blue,todo:e.dim,done:e.green,failed:e.red,cancelled:e.dim},xs=new Map,bs=new Map;function He(t){if(t<=0)return "";let o=xs.get(t);return o||(o=Cn.repeat(t),xs.set(t,o)),o}function ye(t){if(t<=0)return "";let o=bs.get(t);return o||(o=Ve.repeat(t),bs.set(t,o)),o}function nt(t,o){return t.length>o?t.slice(0,o-1)+"\u2026":t}var Fa=1e4;function yr(t,o=Fa){if(t)return t.length>o?t.slice(0,o)+`
|
|
3
|
+
\u2026[truncated]`:t}var Ts={active:e.green,paused:e.dim,achieved:e.amber,abandoned:e.ghost};var za=120,wr=0,Qo=null,Mn=new Set;function Va(){Qo||(Qo=setInterval(()=>{wr++;for(let t of Mn)t(wr);},za));}function Ha(){Qo&&Mn.size===0&&(clearInterval(Qo),Qo=null);}function fo(){let[t,o]=useState(wr);return useEffect(()=>{let n=r=>o(r);return Mn.add(n),Va(),()=>{Mn.delete(n),Ha();}},[]),t}var ys=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Bo({color:t}){let o=fo();return jsx(Text,{color:t,children:ys[o%ys.length]})}var en={in_progress:0,retrying:1,review:2,todo:3,done:4,failed:5,cancelled:6};var qa="\u25CB",Ss="\u2713",ks="\u2715",Ka="\u21BB",Ya="\u2500",Za="\u25B6",Ft={green:"#0f2d1f",blue:"#0f1f2d",yellow:"#2d2a0f",red:"#2d0f0f",neutral:"#1a1a22",amber:"#2d1f0a"},Ja={in_progress:{icon:Za,label:"RUN",fg:e.green,bg:Ft.green,bold:true,spinner:true},retrying:{icon:Ka,label:"RETRY",fg:e.yellow,bg:Ft.yellow,spinner:true},review:{icon:Qt,label:"REVIEW",fg:e.blue,bg:Ft.blue},todo:{icon:qa,label:"TODO",fg:e.dim,bg:Ft.neutral},done:{icon:Ss,label:"DONE",fg:e.green,bg:Ft.green},failed:{icon:ks,label:"FAIL",fg:e.red,bg:Ft.red,bold:true},cancelled:{icon:Ya,label:"OFF",fg:e.dim,bg:Ft.neutral}},Qa={1:{color:e.red,label:"!!!"},2:{color:e.yellow,label:"!!"},3:{color:e.dim,label:"!"},4:{color:e.ghost,label:ue}};var tl=18,ol="#2d1f0a",vn=nn.memo(function({task:o,selected:n,width:r,agentNameMap:l,goalMap:f$1}){let b=Ja[o.status],T=o.status==="in_progress"||o.status==="retrying",x=Qa[o.priority]??{color:e.ghost,label:ue},y,C;if(o.status==="done")y=Ss,C=e.green;else if(o.status==="failed")y=ks,C=e.red;else if(T){let E=Date.now()-new Date(o.updated_at).getTime();y=f(E),C=e.cyan;}else y="\u2014",C=void 0;let M=n?"\u25B8":" ",B=o.goalId?f$1?.get(o.goalId):void 0,k=!!B,H=10,V=4,F=14,P=k?tl:0,j=7,L=2+H+V+F+P+j,O=r?Math.max(10,r-L):40,N=o.assignee?l?.get(o.assignee)??o.assignee:void 0;return jsxs(Box,{children:[jsxs(Text,{color:n?e.amber:void 0,children:[M," "]}),jsx(Box,{width:H,children:jsx(Text,{backgroundColor:b.bg,color:b.fg,bold:b.bold,children:b.spinner?jsxs(Fragment,{children:[" ",jsx(Bo,{color:b.fg})," ",b.label," "]}):jsxs(Fragment,{children:[" ",b.icon," ",b.label," "]})})}),jsx(Box,{width:V,children:jsx(Text,{color:x.color,bold:o.priority<=2,children:x.label})}),jsxs(Box,{width:O,children:[jsx(Text,{wrap:"truncate",bold:n||T,color:n?e.white:T?e.silver:void 0,children:o.title.length>O?o.title.slice(0,O-1)+"\u2026":o.title}),(o.attachments?.length??0)>0&&jsxs(Text,{color:e.dim,children:[" ","\u{1F4CE}",o.attachments.length]})]}),k&&jsx(Box,{width:P,children:jsxs(Text,{backgroundColor:ol,color:e.amberDim,wrap:"truncate",children:[" \u2295 ",nt(B.title,13)," "]})}),jsx(Box,{width:F,children:N?jsxs(Text,{backgroundColor:Ft.green,color:e.green,wrap:"truncate",children:[" ",N.length>F-2?N.slice(0,F-3)+"\u2026":N," "]}):jsx(Text,{color:e.ghost,children:"\u2014"})}),jsx(Box,{width:j,justifyContent:"flex-end",children:jsx(Text,{color:C,dimColor:!C,children:y})})]})});var Cs="\u2295";function Is({goalTitle:t,taskCount:o,doneCount:n,width:r}){let l=o>0?Math.round(n/o*100):0,f=` ${Cs} ${t.toUpperCase()} ${ue} ${o} task${o!==1?"s":""} ${ue} ${l}% done `,b=3,T=Math.max(0,r-b-f.length-4);return jsxs(Box,{paddingX:2,children:[jsx(Text,{color:e.ghost,children:ye(b)}),jsx(Text,{backgroundColor:Ft.amber,color:e.amber,bold:true,children:f}),jsx(Text,{color:e.ghost,children:ye(T)})]})}function Ms({taskCount:t,width:o}){let n=` ${Cs} UNGROUPED ${ue} ${t} task${t!==1?"s":""} `,r=3,l=Math.max(0,o-r-n.length-4);return jsxs(Box,{paddingX:2,children:[jsx(Text,{color:e.ghost,children:ye(r)}),jsx(Text,{backgroundColor:Ft.neutral,color:e.dim,children:n}),jsx(Text,{color:e.ghost,children:ye(l)})]})}var rl="\u2715",vs="\u25CB",sl="\u25B6",il="\u2713",Eo={green:"#0f2d1f",red:"#2d0f0f",neutral:"#1a1a22",amber:"#2d1f0a"},al={running:{icon:sl,label:"ACTIVE",fg:e.green,bg:Eo.green,bold:true,spinner:true},idle:{icon:vs,label:"IDLE",fg:e.dim,bg:Eo.neutral},error:{icon:rl,label:"ERROR",fg:e.red,bg:Eo.red,bold:true},disabled:{icon:vs,label:"OFF",fg:e.ghost,bg:Eo.neutral}},Sr={running:0,idle:1,error:2,disabled:3},Rs=nn.memo(function({agent:o,selected:n,width:r,runningEntry:l,currentTaskTitle:f$1,teamName:b,isLead:T}){let x=al[o.status],y=o.status==="running",C,M;if(y&&l){let N=Date.now()-new Date(l.started_at).getTime();C=f(N),M=e.cyan;}else o.stats.total_runs>0?(C=`${o.stats.tasks_completed}/${o.stats.total_runs}`,M=o.stats.tasks_completed>0?e.green:e.dim):(C="\u2014",M=void 0);let B=n?"\u25B8":" ",k=11,H=8,V=b?Math.min(b.length+2,12):0,F=10,P=2+k+H+V+F,j=r?Math.max(8,r-P):20,L=o.stats.total_runs>0,O=L?Math.round(o.stats.tasks_completed/o.stats.total_runs*100):0;return jsxs(Box,{children:[jsxs(Text,{color:n?e.amber:void 0,children:[B," "]}),jsx(Box,{width:k,children:jsx(Text,{backgroundColor:x.bg,color:x.fg,bold:x.bold,children:x.spinner?jsxs(Fragment,{children:[" ",jsx(Bo,{color:x.fg})," ",x.label," "]}):jsxs(Fragment,{children:[" ",x.icon," ",x.label," "]})})}),jsx(Box,{width:j,children:jsxs(Text,{wrap:"truncate",bold:n||y,color:n?e.white:y?e.green:e.silver,children:[o.autonomous&&jsxs(Text,{color:e.cyan,children:[mo," "]}),T&&jsxs(Text,{color:e.amber,children:[Tr," "]}),o.name,y&&f$1&&jsxs(Text,{color:e.dim,children:[" ",ue," ",f$1]}),o.status==="error"&&o.last_error&&jsxs(Text,{color:e.red,children:[" ",ue," ",nt(m[o.last_error.kind]?.message??o.last_error.message,30)]})]})}),jsx(Box,{width:H,children:jsx(Text,{color:e.dim,children:o.adapter})}),b&&jsx(Box,{width:V,children:jsx(Text,{color:e.amber,wrap:"truncate",children:b})}),jsx(Box,{width:F,justifyContent:"flex-end",children:L&&!y?jsxs(Text,{color:O>=80?e.green:O>=50?e.yellow:e.red,children:[C," ",il]}):jsx(Text,{color:M,dimColor:!M,children:C})})]})});function As({teamName:t,memberCount:o,leadName:n,width:r}){let l=`${o} agent${o!==1?"s":""}`,f=n?` ${ue} ${Tr} ${n}`:"",b=` ${Qt} ${t.toUpperCase()} ${ue} ${l}${f} `,T=3,x=Math.max(0,r-T-b.length-4);return jsxs(Box,{paddingX:2,children:[jsx(Text,{color:e.ghost,children:ye(T)}),jsx(Text,{backgroundColor:Eo.amber,color:e.amber,bold:true,children:b}),jsx(Text,{color:e.ghost,children:ye(x)})]})}var ll="\u25C7";function $s({memberCount:t,width:o}){let n=`${t} agent${t!==1?"s":""}`,r=` ${ll} UNASSIGNED ${ue} ${n} `,l=3,f=Math.max(0,o-l-r.length-4);return jsxs(Box,{paddingX:2,children:[jsx(Text,{color:e.ghost,children:ye(l)}),jsx(Text,{backgroundColor:Eo.neutral,color:e.dim,children:r}),jsx(Text,{color:e.ghost,children:ye(f)})]})}var Bs="\u2713",Es="\u2715",dl="\u2016",ul="\u25C9",on={green:"#0f2d1f",amber:"#2d1f0a",neutral:"#1a1a22"},gl={active:{icon:ul,label:"ACTIVE",fg:e.green,bg:on.green,bold:true},paused:{icon:dl,label:"PAUSED",fg:e.dim,bg:on.neutral},achieved:{icon:Bs,label:"DONE",fg:e.amber,bg:on.amber,bold:true},abandoned:{icon:Es,label:"DROP",fg:e.ghost,bg:on.neutral}},ml="\u2588",fl="\u2591",pl=14,Ls=nn.memo(function({goal:o,selected:n,width:r,agentNameMap:l,tasksByGoal:f}){let b=gl[o.status],T=n?"\u25B8":" ",x=f?.length??0,y=f?.filter(O=>O.status==="done").length??0,C=x>0,M=11,B=C?pl:0,k=14,H=7,V=2+M+B+k+H,F=r?Math.max(10,r-V):40,P=o.assignee?l?.get(o.assignee)??o.assignee:void 0,j,L;if(o.status==="achieved")j=Bs,L=e.amber;else if(o.status==="abandoned")j=Es,L=e.ghost;else {let O=Date.now()-new Date(o.created_at).getTime(),N=Math.floor(O/864e5);j=N>0?`${N}d`:"<1d",L=e.dim;}return jsxs(Box,{children:[jsxs(Text,{color:n?e.amber:void 0,children:[T," "]}),jsx(Box,{width:M,children:jsxs(Text,{backgroundColor:b.bg,color:b.fg,bold:b.bold,children:[" ",b.icon," ",b.label," "]})}),jsx(Box,{width:F,children:jsx(Text,{wrap:"truncate",bold:n||o.status==="active",color:n?e.white:o.status==="active"?e.silver:void 0,children:o.title.length>F?o.title.slice(0,F-1)+"\u2026":o.title})}),C&&(()=>{let N=x>0?Math.round(y/x*6):0,E=6-N;return jsxs(Box,{width:B,children:[jsx(Text,{color:e.green,children:ml.repeat(N)}),jsx(Text,{color:e.ghost,children:fl.repeat(E)}),jsx(Text,{color:e.dim,children:` ${y}/${x}`})]})})(),jsx(Box,{width:k,children:P?jsxs(Text,{backgroundColor:on.green,color:e.green,wrap:"truncate",children:[" ",P.length>k-2?P.slice(0,k-3)+"\u2026":P," "]}):jsx(Text,{color:e.ghost,children:"\u2014"})}),jsx(Box,{width:H,justifyContent:"flex-end",children:jsx(Text,{color:L,dimColor:!L,children:j})})]})});var hl={system:"\u2666",lifecycle:"\u25B6",output:"\u2502",tool:"\u2699",result:"\u2190",error:"\u2715",file:"\u270E",info:"\u2502"};function Po({label:t,width:o,color:n}){let r=o-4,l=` ${t} `,f=3,b=Math.max(0,r-f-l.length);return jsxs(Text,{color:n??e.ghost,children:[" ",ye(f),l,ye(b)]})}function Os({task:t,height:o,width:n,taskLogs:r,agentNameMap:l,taskTitleMap:f}){let b=In[t.status]??e.dim,T=t.priority<=2?t.priority===1?e.red:e.yellow:void 0,x=24,y=!!t.description?.trim(),C=!!t.proof?.agent_summary,M=(t.proof?.files_changed?.length??0)>0,B=(r?.length??0)>0,k=(t.attachments?.length??0)>0,H=y?t.description.split(`
|
|
4
|
+
`):[],V=C?t.proof.agent_summary.split(`
|
|
5
|
+
`):[],F=3;k&&(F+=2+t.attachments.length),y?(F+=1,F+=Math.min(H.length,Math.max(1,Math.ceil((o-10)*.3)))):C||(F+=2),C&&(F+=2),M&&(F+=1),B&&(F+=2);let P=Math.max(0,o-F),j=0,L=0;C&&B?(j=Math.max(1,Math.floor(P*.4)),L=Math.max(1,P-j)):C?j=P:B&&(L=P);let O=y?H.slice(0,Math.max(1,Math.ceil((o-10)*.3))):[],N=V.slice(0,j);return jsxs(Box,{flexDirection:"column",paddingX:2,children:[jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" status "}),jsx(Text,{color:b,children:t.status})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" assignee "}),jsx(Text,{color:t.assignee?e.green:e.dim,children:t.assignee?l?.get(t.assignee)??t.assignee:"\u2014"})]})]}),jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" priority "}),jsxs(Text,{color:T,bold:t.priority<=2,children:["P",t.priority]})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" attempts "}),jsxs(Text,{children:[t.attempts,"/",t.max_attempts]})]})]}),jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" labels "}),jsx(Text,{color:e.purple,children:t.labels.length>0?t.labels.join(", "):"\u2014"})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" depends "}),jsx(Text,{dimColor:true,children:t.depends_on.length>0?t.depends_on.map(E=>f?.get(E)??E).join(", "):"\u2014"})]})]}),k&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsx(Po,{label:`attachments (${t.attachments.length})`,width:n,color:e.dim}),t.attachments.map((E,G)=>jsxs(Text,{color:e.cyan,wrap:"truncate",children:[" ",E]},`a${G}`))]}),y&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),O.map((E,G)=>jsxs(Text,{color:e.silver,wrap:"truncate",children:[" ",nt(E,n-8)]},`d${G}`))]}),!y&&!C&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsx(Text,{color:e.dim,children:" No description."})]}),C&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsx(Po,{label:"result",width:n,color:e.dim}),N.map((E,G)=>jsxs(Text,{color:e.white,wrap:"truncate",children:[" ",nt(E,n-8)]},`r${G}`))]}),M&&jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" files "}),jsx(Text,{color:e.cyan,children:t.proof.files_changed.length}),jsx(Text,{color:e.dim,children:" changed"}),t.proof.branch&&jsxs(Fragment,{children:[jsxs(Text,{color:e.dim,children:[" ","\xB7"," "]}),jsx(Text,{color:e.cyan,children:t.proof.branch})]})]}),B&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsx(Po,{label:"activity",width:n,color:e.dim}),r.slice(-L).map((E,G)=>{let z=E.msgType??"info",X=hl[z]??"\u2502",R=E.color;z==="tool"?R=e.cyan:z==="file"?R=e.purple:z==="error"?R=e.red:z==="lifecycle"?R=e.green:z==="system"&&(R=e.dim);let ie=Math.max(10,n-12),Le=nt(E.text,ie);return jsxs(Box,{children:[jsxs(Text,{color:e.ghost,children:[" ",E.time," "]}),jsxs(Text,{color:z==="error"?e.red:e.dim,children:[X," "]}),jsx(Text,{color:R,bold:z==="lifecycle",children:Le})]},G)})]})]})}var _n=[{key:"G",id:"goals",label:"GOALS"},{key:"T",id:"tasks",label:"TASKS"},{key:"A",id:"agents",label:"AGENTS"},{key:"L",id:"logs",label:"ACTIONS"}];var xl="\u25CF",Ns="\u25CB",bl="\u2713",Tl="\u2715",yl="\u2191",wl="\u2193",Sl="\u03A3",kl="\u25B6",Cl="\u21BB",Il="\u{1F9E0}",Ps=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],kr=[" ","\u2581","\u2582","\u2583","\u2584","\u2585","\u2586","\u2587","\u2588"],ft={green:"#0f2d1f",blue:"#0f1f2d",yellow:"#2d2a0f",red:"#2d0f0f",neutral:"#1a1a22",amber:"#2d1f0a"};function Ds({color:t}){let o=fo();return jsx(Text,{color:t,children:Ps[o%Ps.length]})}function Ml(){let t=fo(),o=Math.floor(t/10)%2===0;return jsx(Text,{color:o?e.amber:e.amberDim,bold:true,children:Ut})}function vl({width:t,active:o}){let n=Math.max(4,Math.floor(t*.08)),r=2,l=fo(),f=Math.ceil((t+n)/r),b=o?l%(f*2):0;if(!o)return jsx(Box,{paddingX:1,children:jsx(Text,{color:e.ghost,children:He(t)})});let T=b<f?b*r:(f*2-b)*r,x=Math.max(0,T-n),y=Math.min(t,T),C=x,M=Math.max(0,y-x),B=Math.max(0,t-y);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(C)}),jsx(Text,{color:e.amber,children:He(M)}),jsx(Text,{color:e.ghost,children:He(B)})]})}function _l({data:t,width:o,color:n}){if(t.length===0)return null;let r=t.slice(-o),l=Math.max(...r,1),f=r.map(b=>{let T=Math.round(b/l*(kr.length-1));return kr[T]??kr[0]}).join("");return jsx(Text,{color:n,children:f})}function Rl({tab:t,flashColor:o,onComplete:n,badge:r}){let l=fo(),f=nn.useRef(l),b=nn.useRef(false),T=l-f.current,x=2,y=6*x;return nn.useEffect(()=>{T>=y&&!b.current&&(b.current=true,n());},[T,n]),Math.floor(T/x)%2===0&&T<y?jsxs(Text,{backgroundColor:o,color:"#0a0a0c",bold:true,children:[" ",t.key," ",t.label,r," "]}):jsxs(Box,{gap:0,children:[jsx(Text,{color:e.ghost,children:t.key}),jsxs(Text,{color:e.dim,children:[" ",t.label.toLowerCase(),r]})]})}function Al({projectName:t,activeView:o,mode:n,stats:r,uptime:l,width:f,version:b,latestVersion:T,taskBadge:x,flashTab:y,flashColor:C,onFlashComplete:M}){let B=n==="watching";return jsxs(Box,{paddingX:1,justifyContent:"space-between",width:f,children:[jsxs(Box,{gap:0,children:[jsx(Ml,{}),jsx(Text,{color:e.amber,bold:true,children:" ORCH"}),b&&jsxs(Text,{color:e.ghost,children:[" ",b]}),T&&T!==b&&jsxs(Text,{backgroundColor:ft.green,color:e.green,bold:true,children:[" UPDATE ",T," "]}),jsxs(Text,{color:e.ghost,children:[" ",ue," "]}),jsx(Text,{color:e.silver,children:t})]}),jsx(Box,{gap:0,children:_n.map((k,H)=>{let V=o===k.id,F=k.id==="tasks"&&x!=null&&x>0?` (${x})`:"",P=!V&&y===k.id&&C&&M;return jsxs(nn.Fragment,{children:[H>0&&jsx(Text,{children:" "}),V?jsxs(Text,{backgroundColor:e.amber,color:"#0a0a0c",bold:true,children:[" ",k.key," ",k.label,F," "]}):P?jsx(Rl,{tab:k,flashColor:C,onComplete:M,badge:F}):jsxs(Box,{gap:0,children:[jsx(Text,{color:e.ghost,children:k.key}),jsxs(Text,{color:e.dim,children:[" ",k.label.toLowerCase(),F]})]})]},k.id)})}),jsxs(Box,{gap:0,children:[B?jsxs(Text,{backgroundColor:ft.green,color:e.green,bold:true,children:[" ",xl," WATCHING"," "]}):jsxs(Text,{backgroundColor:ft.neutral,color:e.dim,children:[" ",Ns," IDLE"," "]}),r.running>0&&jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsxs(Text,{backgroundColor:ft.green,color:e.green,children:[" ",jsx(Ds,{color:e.green})," ",r.running," active"," "]})]}),l&&jsxs(Text,{color:e.ghost,children:[" ",l]})]})]})}function $l({stats:t,tokens:o,width:n,sparklineData:r}){let f=[{icon:kl,label:"RUN",count:t.running,fg:e.green,bg:ft.green,bold:true,spinner:true,show:t.running>0},{icon:Cl,label:"RETRY",count:t.retrying,fg:e.yellow,bg:ft.yellow,show:t.retrying>0},{icon:Qt,label:"REVIEW",count:t.review,fg:e.blue,bg:ft.blue,show:t.review>0},{icon:Ns,label:"TODO",count:t.todo,fg:e.dim,bg:ft.neutral,show:t.todo>0},{icon:bl,label:"DONE",count:t.done,fg:e.green,bg:ft.green,show:t.done>0},{icon:Tl,label:"FAIL",count:t.failed,fg:e.red,bg:ft.red,bold:true,show:t.failed>0},{icon:Ut,label:"TEAMS",count:t.teams,fg:e.amber,bg:ft.amber,show:t.teams>0}].filter(x=>x.show),b=o.total>0,T=r&&r.length>0?Math.min(16,r.length):0;return jsxs(Box,{paddingX:1,justifyContent:"space-between",width:n,children:[jsxs(Box,{gap:1,children:[f.map(x=>jsx(Text,{backgroundColor:x.bg,color:x.fg,bold:x.bold,children:x.spinner?jsxs(Fragment,{children:[" ",jsx(Ds,{color:x.fg})," ",x.count," ",x.label," "]}):jsxs(Fragment,{children:[" ",x.icon," ",x.count," ",x.label," "]})},x.label)),f.length===0&&jsxs(Text,{backgroundColor:ft.neutral,color:e.dim,children:[" ","NO TASKS"," "]})]}),jsxs(Box,{gap:0,children:[T>0&&r&&jsxs(Fragment,{children:[jsx(_l,{data:r,width:T,color:e.amberDim}),jsx(Text,{children:" "})]}),b&&jsxs(Text,{backgroundColor:ft.amber,color:e.cyan,children:[" ",yl,h(o.input)," ",wl,h(o.output),o.reasoning>0?` ${Il}${h(o.reasoning)}`:""," ",ue," ",Sl,h(o.total)," "]})]})]})}var Fs=nn.memo(function(o){let n=Math.max(10,o.width-2),r=o.stats.running>0;return jsxs(Box,{flexDirection:"column",children:[jsx(Box,{height:1}),jsx(Al,{projectName:o.projectName,activeView:o.activeView,mode:o.mode,stats:o.stats,uptime:o.uptime,width:o.width,version:o.version,latestVersion:o.latestVersion,taskBadge:o.taskBadge,flashTab:o.flashTab,flashColor:o.flashColor,onFlashComplete:o.onFlashComplete}),jsx(Box,{height:1}),jsx($l,{stats:o.stats,tokens:o.tokens,width:o.width,sparklineData:o.sparklineData}),jsx(vl,{width:n,active:r})]})});var rn="\u0423\u041F\u0420\u0410\u0412\u041B\u0415\u041D\u0418\u0415",No="\u041C\u041E\u041D\u0418\u0422\u041E\u0420\u0418\u041D\u0413",An="\u041D\u0410\u0421\u0422\u0420\u041E\u0419\u041A\u0418",po={task:{sub:["add","list","show","cancel","retry","assign","approve","reject","delete"],help:"Manage tasks",category:rn},agent:{sub:["add","list","disable","enable","delete","autonomous","shop"],help:"Manage agents",category:rn},team:{sub:["create","list","join","leave","disband","set-lead"],help:"Manage teams",category:rn},goal:{sub:["add","list","show","status","delete"],help:"Manage goals",category:rn},run:{args:"[id]",help:"Run task (or selected)",category:No},"run-all":{help:"Run all todo tasks",category:No},watch:{help:"Start watch mode (auto-dispatch)",category:No},pause:{help:"Pause watch mode",category:No},status:{help:"Show orchestrator status",category:No},config:{sub:["activity-filter","max-concurrent"],help:"TUI settings",category:An},help:{help:"List all commands",category:An},quit:{help:"Exit the TUI",category:An}};function Cr(t){if(!t.startsWith("/"))return null;let o=t.slice(1),n=o.indexOf(" ");if(n===-1){let T=o;if(!T)return null;let x=Object.keys(po).find(y=>y.startsWith(T)&&y!==T);return x?x.slice(T.length):null}let r=o.slice(0,n),l=po[r];if(!l?.sub)return null;let f=o.slice(n+1);if(!f)return null;let b=l.sub.find(T=>T.startsWith(f)&&T!==f);return b?b.slice(f.length):null}function Ws(t){if(!t.startsWith("/"))return [];let o=t.slice(1),n=o.indexOf(" ");if(n===-1){let T=o.toLowerCase(),x=[];if(!T){let y=[rn,No,An];for(let C of y){x.push({cmd:"",desc:`\u2500\u2500 ${C} \u2500\u2500`});for(let[M,B]of Object.entries(po))if(B.category===C){let k=B.args?` ${B.args}`:"";x.push({cmd:`/${M}${k}`,desc:B.help,subs:B.sub?.join(" \xB7 ")});}}return x}for(let[y,C]of Object.entries(po))if(y.startsWith(T)){let M=C.args?` ${C.args}`:"";if(x.push({cmd:`/${y}${M}`,desc:C.help,subs:C.sub?.join(" \xB7 ")}),y===T&&C.sub)for(let B of C.sub)x.push({cmd:`/${y} ${B}`,desc:`${C.help}: ${B}`});}return x}let r=o.slice(0,n),l=po[r];if(!l?.sub)return [];let f=o.slice(n+1).toLowerCase(),b=[];for(let T of l.sub)(!f||T.startsWith(f))&&b.push({cmd:`/${r} ${T}`,desc:`${l.help}: ${T}`});return b}var $n=class{entries=[];cursor=0;push(o){o&&(this.entries[this.entries.length-1]!==o&&(this.entries.push(o),this.entries.length>100&&this.entries.shift()),this.cursor=this.entries.length);}prev(){return this.entries.length===0?null:(this.cursor>0&&this.cursor--,this.entries[this.cursor]??null)}next(){return this.cursor<this.entries.length-1?(this.cursor++,this.entries[this.cursor]??null):(this.cursor=this.entries.length,null)}reset(){this.cursor=this.entries.length;}};var El="\u2588",Gs=nn.memo(function({mode:o,value:n,completion:r,activeView:l,canRun:f,canNew:b,canApprove:T,canReject:x,canCancel:y,canDelete:C,canUndo:M,canEdit:B,canForceStop:k,canToggleAuto:H,autoActive:V,canPause:F,isPaused:P,canToggleShowAll:j,showAllActive:L,hasDetail:O,itemCount:N,itemLabel:E,width:G,hasSuggestions:z,onboardingCompleted:X}){if(o==="command"){let R=z?" \u2191\u2193 select Tab fill Esc \u2715":" Enter exec \u2191\u2193 history Tab complete Esc \u2715",ie=Math.max(4,G-6-R.length-(r?.length??0)-1),Le=n.length>ie?"\u2026"+n.slice(-(ie-1)):n;return jsx(Box,{paddingX:2,justifyContent:"space-between",width:G,children:jsxs(Box,{children:[jsx(Text,{color:e.amber,children:"/ "}),jsx(Text,{color:e.white,children:Le}),r&&jsx(Text,{color:e.ghost,children:r}),jsx(Text,{color:e.amber,children:El}),jsx(Text,{color:e.dim,children:R})]})})}return jsxs(Box,{paddingX:2,justifyContent:"space-between",width:G,children:[jsxs(Text,{color:e.dim,children:[jsx(Text,{bold:true,color:e.gray,children:"\u2191\u2193"})," ",jsx(Text,{bold:true,color:e.gray,children:"Tab"}),"/",jsx(Text,{bold:true,color:e.gray,children:"\u2190\u2192"})," ",jsx(Text,{bold:true,color:e.gray,children:"/"})," cmd",b&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"N"})," new"]}),f&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"R"})," run"]}),y&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.amber,children:"C"})," cancel"]}),T&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.green,children:"A"})," approve"]}),x&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.red,children:"X"})," reject"]}),B&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.cyan,children:"E"})," edit"]}),k&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.red,children:"S"})," stop"]}),F&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.amber,children:"P"}),P?" resume":" pause"]}),H&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.cyan,children:"U"}),V?" auto off":" auto on"]}),j&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"S"}),L?" collapse":" show all"]}),C&&!T&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"D"})," delete"]}),M&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.yellow,children:"Z"})," undo"]}),O&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"Esc"})," close"]}),!O&&(l==="tasks"||l==="agents"||l==="goals")&&jsxs(Fragment,{children:[" ",jsx(Text,{bold:true,color:e.gray,children:"Enter"})," detail"]})," ",jsx(Text,{bold:true,color:e.gray,children:"Q"})," quit"," ",jsx(Text,{bold:true,color:X===false?e.amber:e.gray,children:"?"}),jsx(Text,{color:X===false?e.amber:void 0,children:" help"})]}),N>0&&jsxs(Text,{color:e.dim,children:[N," ",E]})]})});var Bn="\u2588",Mr=process.platform==="darwin"?"\u2318":"Ctrl";function Pl(t,o){if(o<=0||t.length<=o)return [t];let n=[];for(let r=0;r<t.length;r+=o)n.push(t.slice(r,r+o));return n}function En(t,o){if(o<=0)return 0;let n=o-1;for(;n>0&&t[n-1]===" ";)n--;for(;n>0&&t[n-1]!==" ";)n--;return n}function Hs(t,o){if(o>=t.length)return t.length;let n=o;for(;n<t.length&&t[n]!==" ";)n++;for(;n<t.length&&t[n]===" ";)n++;return n}function js({title:t,steps:o,onComplete:n,onCancel:r,width:l,height:f,onPasteImage:b,footerExtra:T,onSuggestionSelected:x}){let [y,C]=useState(0),[M,B]=useState({}),[k,H]=useState(()=>{let A=o.find(S=>!S.skip?.({}));return A?.type==="text"&&A.defaultValue?A.defaultValue:""}),[V,F]=useState(()=>{let A=o.find(S=>!S.skip?.({}));return A?.type==="text"&&A.defaultValue?A.defaultValue.length:0}),[P,j]=useState(()=>{let A=o.find(S=>!S.skip?.({}));return A?.type==="textarea"&&A.defaultValue?A.defaultValue.split(`
|
|
6
|
+
`):[""]}),[L,O]=useState(0),[N,E]=useState(0),[G,z]=useState(()=>{let A=o.find(S=>!S.skip?.({}));if(A?.type==="select"&&A.defaultValue){let I=(A.getOptions?.({})??A.options??[]).findIndex($=>$.value===A.defaultValue);return I>=0?I:0}return 0}),X=useMemo(()=>o.filter(A=>!A.skip?.(M)),[o,M]),R=X[y],ie=X.length,{taLineNumWidth:zt,taContentWidth:ct}=useMemo(()=>{let A=String(P.length).length;return {taLineNumWidth:A,taContentWidth:Math.max(1,l-A-4)}},[P.length,l]),Ae=useMemo(()=>{if(!R||R.type!=="textarea")return [];let A=[];for(let S=0;S<P.length;S++){let I=Pl(P[S]??"",ct);for(let $=0;$<I.length;$++)A.push({logicalRow:S,startCol:$*ct,text:I[$],isFirst:$===0});}return A},[R?.id,R?.type,P,ct]),Ke=useMemo(()=>{for(let A=0;A<Ae.length;A++){let S=Ae[A];if(S.logicalRow===L&&(N>=S.startCol&&N<S.startCol+ct||N>=S.startCol&&(A+1>=Ae.length||Ae[A+1].logicalRow!==L)))return A}return 0},[Ae,L,N,ct]),[dt,pt]=useState(new Set),[De,Ye]=useState(false),[ut,Ze]=useState(0),[ro,Ce]=useState(false),[ht,Et]=useState(null),[Kt,xt]=useState(false),et=useRef(null),gt=useRef(null),Wo=useMemo(()=>R?R.type==="text"?k:R.type==="textarea"?P.join(`
|
|
7
|
+
`):"":"",[R,k,P]),ln=useCallback((A,S)=>{if(et.current&&clearTimeout(et.current),!S){Et(null);return}et.current=setTimeout(()=>{Et(S(A));},300);},[]);useEffect(()=>(R&&R.validate&&(R.type==="text"||R.type==="textarea")&&ln(Wo,R.validate),()=>{et.current&&clearTimeout(et.current);}),[Wo,R,ln]),useEffect(()=>()=>{gt.current&&clearTimeout(gt.current);},[]);let It=useMemo(()=>!R||R.type!=="select"&&R.type!=="multiselect"?[]:R.getOptions?.(M)??R.options??[],[R,M]),Yt=Math.min(G,Math.max(0,It.length-1)),Vt=useMemo(()=>{if(!R?.suggestions)return [];if(!k.trim())return R.suggestions;let A=k.toLowerCase();return R.suggestions.filter(S=>S.label.toLowerCase().includes(A)||(S.hint??"").toLowerCase().includes(A))},[R?.suggestions,k]),Ht=Math.min(ut,Math.max(0,Vt.length-1)),tt=A=>{let S={...M,[R.id]:A};B(S),H(""),F(0),j([""]),O(0),E(0),z(0),pt(new Set),Ye(false),Ze(0),Ce(false),Et(null),xt(false),et.current&&clearTimeout(et.current);let I=R.id,K=o.findIndex(Q=>Q.id===I)+1;for(;K<o.length;){let Q=o[K];if(Q&&!Q.skip?.(S))break;K++;}if(K>=o.length)n(S);else {let Q=o[K].id,ce=o.filter(he=>!he.skip?.(S)).findIndex(he=>he.id===Q);C(ce>=0?ce:0);let ge=o[K];if(ge.type==="text"){let he=ge.defaultValue??"";H(he),F(he.length);}else if(ge.type==="textarea"){let he=ge.defaultValue?ge.defaultValue.split(`
|
|
8
|
+
`):[""];j(he),O(he.length-1),E(he[he.length-1].length);}else if(ge.type==="select"){let he=ge.getOptions?.(S)??ge.options??[];if(ge.defaultValue){let vt=he.findIndex(_=>_.value===ge.defaultValue);z(vt>=0?vt:0);}else z(0);}else ge.type==="multiselect"&&(z(0),ge.defaultValue?pt(new Set(ge.defaultValue.split(","))):pt(new Set));}},bo=()=>{if(y===0){r();return}let A=R.id,I=o.findIndex(ce=>ce.id===A)-1;for(;I>=0;){let ce=o[I];if(ce&&!ce.skip?.(M))break;I--;}if(I<0){r();return}let $=o[I].id,K=X.findIndex(ce=>ce.id===$);C(K>=0?K:0),Ye(false),Ze(0),Ce(false),Et(null),xt(false),et.current&&clearTimeout(et.current);let Q=o[I];if(M[Q.id]&&Ce(true),Q.type==="text"){let ce=M[Q.id]??Q.defaultValue??"";H(ce),F(ce.length);}else if(Q.type==="textarea"){let ce=M[Q.id]??Q.defaultValue??"",ge=ce?ce.split(`
|
|
9
|
+
`):[""];j(ge),O(ge.length-1),E(ge[ge.length-1].length);}else if(Q.type==="multiselect"){z(0);let ce=M[Q.id];pt(ce?new Set(ce.split(",")):new Set);}else {let ce=Q.getOptions?.(M)??Q.options??[],ge=M[Q.id],he=ce.findIndex(vt=>vt.value===ge);z(he>=0?he:0);}};if(useInput((A,S)=>{if(R){if(S.escape){y===0?r():bo();return}if((S.ctrl||S.meta)&&(A==="v"||A==="i")&&b&&(R.type==="text"||R.type==="textarea")){b();return}if(R.type==="text"){if(De&&Vt.length>0){if(S.upArrow){Ht<=0?Ye(false):Ze(I=>I-1);return}if(S.downArrow){Ze(I=>Math.min(Vt.length-1,I+1));return}if(S.return){let I=Vt[Ht];I&&x&&x(I.value);return}Ye(false);}if(S.return){let I=k.trim();if(R.required&&!I){Ce(true);return}if(ht!==null){Ce(true),xt(true),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>xt(false),2e3);return}tt(I);return}if(S.downArrow&&R.suggestions&&Vt.length>0){Ye(true),Ze(0);return}if(S.ctrl&&A==="a"){F(0);return}if(S.ctrl&&A==="e"){F(k.length);return}if(S.ctrl&&A==="k"){Ce(true),H(I=>I.slice(0,V));return}if(S.ctrl&&A==="u"){Ce(true),H(I=>I.slice(V)),F(0);return}if(S.ctrl&&A==="w"){Ce(true);let I=En(k,V);H($=>$.slice(0,I)+$.slice(V)),F(I);return}if(S.meta&&(S.leftArrow||A==="b")){F(En(k,V));return}if(S.meta&&(S.rightArrow||A==="f")){F(Hs(k,V));return}if(S.leftArrow){F(I=>Math.max(0,I-1));return}if(S.rightArrow){F(I=>Math.min(k.length,I+1));return}if(S.backspace||S.delete){if(V===0&&k.length===0&&y>0){bo();return}V>0&&(H(I=>I.slice(0,V-1)+I.slice(V)),F(I=>I-1));return}A&&!S.ctrl&&!S.meta&&!S.escape&&(Ce(true),Ye(false),Ze(0),H(I=>I.slice(0,V)+A+I.slice(V)),F(I=>I+A.length));return}if(R.type==="textarea"){if(S.return&&(S.ctrl||S.meta)){let I=P.join(`
|
|
10
|
+
`).trim();if(R.required&&!I){Ce(true);return}if(ht!==null){Ce(true),xt(true),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>xt(false),2e3);return}tt(I);return}if(S.return){Ce(true),j(I=>{let $=I[L]??"",K=$.slice(0,N),Q=$.slice(N),Ie=[...I];return Ie.splice(L,1,K,Q),Ie}),O(I=>I+1),E(0);return}if(S.ctrl&&A==="a"){E(0);return}if(S.ctrl&&A==="e"){E((P[L]??"").length);return}if(S.ctrl&&A==="k"){Ce(true),j(I=>{let $=[...I];return $[L]=($[L]??"").slice(0,N),$});return}if(S.ctrl&&A==="u"){Ce(true),j(I=>{let $=[...I];return $[L]=($[L]??"").slice(N),$}),E(0);return}if(S.ctrl&&A==="w"){Ce(true);let I=L,$=N;j(K=>{let Q=K[I]??"",Ie=En(Q,$),ce=[...K];return ce[I]=Q.slice(0,Ie)+Q.slice($),E(Ie),ce});return}if(S.meta&&(S.leftArrow||A==="b")){E(En(P[L]??"",N));return}if(S.meta&&(S.rightArrow||A==="f")){E(Hs(P[L]??"",N));return}if(S.upArrow){if(Ke>0){let I=Ae[Ke],$=Ae[Ke-1],K=N-(I?.startCol??0),Q=Math.min($.startCol+K,$.startCol+$.text.length);O($.logicalRow),E(Q);}return}if(S.downArrow){if(Ke<Ae.length-1){let I=Ae[Ke],$=Ae[Ke+1],K=N-(I?.startCol??0),Q=Math.min($.startCol+K,$.startCol+$.text.length);O($.logicalRow),E(Q);}return}if(S.leftArrow){N>0?E(I=>I-1):L>0&&(O(I=>I-1),E((P[L-1]??"").length));return}if(S.rightArrow){let I=(P[L]??"").length;N<I?E($=>$+1):L<P.length-1&&(O($=>$+1),E(0));return}if(S.backspace||S.delete){if(N===0&&L===0)return;if(N>0)j(I=>{let $=[...I],K=$[L]??"";return $[L]=K.slice(0,N-1)+K.slice(N),$}),E(I=>I-1);else {let I=(P[L-1]??"").length;j($=>{let K=[...$],Q=K[L-1]??"",Ie=K[L]??"";return K.splice(L-1,2,Q+Ie),K}),E(I),O($=>$-1);}return}if(A&&!S.ctrl&&!S.meta&&!S.escape){Ce(true);let I=A.split(/\r?\n/);if(I.length===1)j($=>{let K=[...$],Q=K[L]??"";return K[L]=Q.slice(0,N)+A+Q.slice(N),K}),E($=>$+A.length);else {let $=L,K=N;j(Q=>{let Ie=[...Q],ce=Ie[$]??"",ge=ce.slice(0,K),he=ce.slice(K),vt=I[0]??"",_=I[I.length-1]??"",Zt=[ge+vt,...I.slice(1,-1),_+he];return Ie.splice($,1,...Zt),Ie}),O($+I.length-1),E((I[I.length-1]??"").length);}}return}if(R.type==="select"||R.type==="multiselect"){if(S.upArrow||A==="k"){z(I=>Math.max(0,I-1));return}if(S.downArrow||A==="j"){z(I=>Math.min(It.length-1,I+1));return}if(S.backspace||S.delete){bo();return}if(R.type==="select"){if(S.return||S.tab){let I=It[Yt];if(I){if(R.validate){let $=R.validate(I.value);if($!==null){Ce(true),Et($),xt(true),gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>xt(false),2e3);return}}tt(I.value);}return}if(A>="1"&&A<="9"){let I=parseInt(A,10)-1;if(I<It.length){let $=It[I];$&&tt($.value);}return}}else {if(A===" "){let I=It[Yt];I&&pt($=>{let K=new Set($);return K.has(I.value)?K.delete(I.value):K.add(I.value),K});return}if(S.return){let I=Array.from(dt).join(",");tt(I);return}}}}}),!R)return null;let bt=ro?ht:null,Mt=Math.max(20,l-6),To=`${y+1}/${ie}`,$e=Math.max(2,f-4),so=0;Yt>=$e&&(so=Yt-$e+1);let le=It.slice(so,so+$e);return jsxs(Box,{flexDirection:"column",paddingX:2,children:[jsxs(Box,{children:[jsx(Text,{color:e.amber,bold:true,children:t}),jsxs(Text,{color:e.ghost,children:[" ",Ve,Ve," "]}),jsxs(Text,{color:e.dim,children:["step ",To]})]}),jsxs(Box,{children:[jsx(Text,{children:" "}),X.map((A,S)=>jsxs(Text,{color:S===y?e.amber:S<y?e.green:e.ghost,children:[S===y?"\u25CF":S<y?"\u2713":"\u25CB"," "]},A.id))]}),jsxs(Box,{marginTop:0,children:[jsxs(Text,{color:e.white,bold:true,children:[" ",R.label]}),R.required&&jsx(Text,{color:e.red,children:" *"}),!R.required&&jsxs(Text,{color:e.dim,children:[" (optional, ",R.type==="textarea"?`${Mr}+Enter`:"Enter"," to skip)"]})]}),R.description&&jsx(Box,{children:jsxs(Text,{color:e.dim,children:[" ",R.description]})}),R.type==="text"&&jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{borderStyle:bt?"round":void 0,borderColor:bt?e.red:void 0,children:[jsxs(Text,{color:e.amber,children:[" ",">"," "]}),k.length>0?jsxs(Fragment,{children:[jsx(Text,{color:e.white,children:k.slice(0,V)}),jsx(Text,{color:e.amber,children:Bn}),jsx(Text,{color:e.white,children:k.slice(V)})]}):R.placeholder?jsxs(Fragment,{children:[jsx(Text,{color:e.ghost,children:R.placeholder}),jsx(Text,{color:e.amber,children:Bn})]}):jsx(Text,{color:e.amber,children:Bn})]}),bt&&jsxs(Text,{color:e.red,dimColor:true,children:[" ",bt]}),Kt&&jsx(Text,{color:e.red,children:" Fix the error above"})]}),R.type==="text"&&R.suggestions&&Vt.length>0&&(()=>{let A=Math.max(2,f-6),S=0;De&&Ht>=A&&(S=Ht-A+1);let I=Vt.slice(S,S+A);return jsxs(Box,{flexDirection:"column",children:[jsxs(Text,{color:e.ghost,children:[" ",Ve,Ve,Ve," or browse templates ",Ve.repeat(Math.max(0,Mt-28))]}),I.map(($,K)=>{let Q=K+S,Ie=De&&Q===Ht;return jsxs(Box,{children:[jsx(Text,{color:Ie?e.amber:e.ghost,children:Ie?" \u25B8 ":" "}),jsx(Text,{color:Ie?e.white:e.silver,bold:Ie,children:$.label}),$.hint&&jsxs(Text,{color:e.dim,wrap:"truncate",children:[" ",Ve," ",$.hint.replace(/\n/g," ")]})]},$.value)})]})})(),R.type==="textarea"&&(()=>{let A=Math.max(3,f-6),S=0;Ke>=A&&(S=Ke-A+1);let I=Ae.slice(S,S+A);return jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"column",borderStyle:bt?"round":void 0,borderColor:bt?e.red:void 0,children:[I.map(($,K)=>{let Q=K+S,Ie=$.isFirst?String($.logicalRow+1).padStart(zt," "):"".padStart(zt," "),ce=Q===Ke,ge=N-$.startCol;return jsxs(Box,{children:[jsxs(Text,{color:e.dim,children:[" ",Ie," "]}),jsxs(Text,{color:e.ghost,children:["\u2502"," "]}),ce?jsxs(Fragment,{children:[jsx(Text,{color:e.white,children:$.text.slice(0,ge)}),jsx(Text,{color:e.amber,children:Bn}),jsx(Text,{color:e.white,children:$.text.slice(ge)})]}):jsx(Text,{color:e.silver,children:$.text||($.isFirst?" ":"")})]},`${$.logicalRow}-${$.startCol}`)}),P.length===1&&P[0]===""&&R.placeholder&&jsx(Box,{children:jsxs(Text,{color:e.dim,children:[" ","".padStart(zt," ")," ",R.placeholder]})})]}),bt&&jsxs(Text,{color:e.red,dimColor:true,children:[" ",bt]}),Kt&&jsx(Text,{color:e.red,children:" Fix the error above"})]})})(),R.type==="select"&&jsxs(Box,{flexDirection:"column",children:[le.map((A,S)=>{let I=S+so,$=I===Yt,K=String(I+1).padStart(It.length>=10?2:1);return jsxs(Box,{children:[jsx(Text,{color:$?e.amber:e.ghost,children:$?" \u25B8 ":` ${K} `}),jsx(Text,{color:$?e.white:e.silver,bold:$,children:A.label}),A.hint&&jsxs(Text,{color:e.dim,wrap:"truncate",children:[" ",Ve," ",A.hint.replace(/\n/g," ")]})]},A.value)}),bt&&jsxs(Text,{color:e.red,dimColor:true,children:[" ",bt]}),Kt&&jsx(Text,{color:e.red,children:" Fix the error above"})]}),R.type==="multiselect"&&jsxs(Box,{flexDirection:"column",children:[le.map((A,S)=>{let $=S+so===Yt,K=dt.has(A.value);return jsxs(Box,{children:[jsx(Text,{color:$?e.amber:e.ghost,children:$?" \u25B8 ":" "}),jsx(Text,{color:K?e.green:e.dim,children:K?"[\u2713]":"[ ]"}),jsxs(Text,{color:$?e.white:e.silver,bold:$,children:[" ",A.label]}),A.hint&&jsxs(Text,{color:e.dim,wrap:"truncate",children:[" ",Ve," ",A.hint.replace(/\n/g," ")]})]},A.value)}),dt.size>0&&jsx(Box,{children:jsxs(Text,{color:e.dim,children:[" ","\u2514"," ",dt.size," selected"]})})]}),jsxs(Box,{marginTop:0,children:[jsxs(Text,{color:e.ghost,children:[" ",R.type==="select"?"\u2191\u2193 select Enter confirm":R.type==="multiselect"?"\u2191\u2193 move Space toggle Enter confirm":R.type==="textarea"?`Enter newline ${Mr}+Enter confirm \u2190\u2191\u2192\u2193 navigate`:De?"\u2191\u2193 browse Enter select \u2191 back to input":R.suggestions?"\u2190\u2192 move Enter confirm \u2193 browse templates":"\u2190\u2192 move Enter confirm",b&&(R.type==="text"||R.type==="textarea")?` ${Mr}+V paste image`:""," Esc ",y>0?"back":"cancel"]}),T&&jsxs(Text,{color:e.amber,children:[" ",T]})]})]})}var qs=nn.memo(function({agents:o,selected:n,msgCounts:r,colorMap:l,maxHeight:f,onConfirm:b,onCancel:T}){let [x,y]=useState(0),[C,M]=useState(()=>new Set(n));useMemo(()=>C.size===0||C.size===o.length,[C.size,o.length]);let k=Math.max(3,f-5),H=useMemo(()=>{if(o.length<=k)return 0;let P=Math.floor(k/2),j=o.length-k;return Math.min(j,Math.max(0,x-P))},[x,o.length,k]),V=o.slice(H,H+k);useInput((P,j)=>{if(j.upArrow){y(L=>L>0?L-1:o.length-1);return}if(j.downArrow){y(L=>L<o.length-1?L+1:0);return}if(P===" "){let L=o[x];if(!L)return;M(O=>{let N=new Set(O);return N.has(L.id)?N.delete(L.id):N.add(L.id),N});return}if(P==="a"||P==="A"){M(L=>new Set);return}if(j.return){b(new Set(C));return}if(j.escape){T();return}});let F=C.size===0?o.length:C.size;return jsxs(Box,{flexDirection:"column",borderStyle:"round",borderColor:e.amber,paddingX:1,children:[jsxs(Box,{gap:1,children:[jsx(Text,{color:e.amber,bold:true,children:" \u25C8 Agent Filter"}),jsxs(Text,{color:e.dim,children:[ue," ",F,"/",o.length," selected"]})]}),jsx(Text,{color:e.ghost,children:Ve.repeat(36)}),V.map((P,j)=>{let O=j+H===x,N=C.size===0||C.has(P.id),E=l.get(P.id)??e.silver,G=r.get(P.id)??0;return jsxs(Box,{gap:0,children:[jsx(Text,{color:O?e.amber:e.ghost,children:O?" \u25B8 ":" "}),jsx(Text,{color:N?e.green:e.ghost,children:N?"[\u2713]":"[ ]"}),jsxs(Text,{color:O?E:N?e.silver:e.dim,bold:O,children:[" ",P.name]}),G>0&&jsxs(Text,{color:e.dim,children:[" ",ue,G]})]},P.id)}),o.length>k&&jsxs(Text,{color:e.ghost,children:[" ",H>0?"\u2191":" "," ",H+k<o.length?"\u2193":" "," ",x+1,"/",o.length]}),jsx(Text,{color:e.ghost,children:Ve.repeat(36)}),jsxs(Text,{color:e.dim,children:[" Space toggle"," ",ue," ","a all"," ",ue," ","Enter confirm"," ",ue," ","Esc cancel"]})]})});var Gl={system:"\u2666",lifecycle:"\u25B6",output:"\u2502",tool:"\u2699",result:"\u2190",error:"\u2715",file:"\u270E",info:"\u2502"},zl={system:"System",lifecycle:"Lifecycle",output:"Output",tool:"Tool calls",result:"Results",error:"Errors",file:"Files",info:"Info"},Vl={system:e.purple,lifecycle:e.cyan,output:e.white,tool:e.blue,result:e.green,error:e.red,file:e.purple,info:e.silver},St=["system","lifecycle","output","tool","result","error","file","info"],Zs=[{key:"1",label:"all",types:St},{key:"2",label:"text",types:["output"]},{key:"3",label:"tools",types:["tool","result","file"]},{key:"4",label:"errors",types:["error"]},{key:"5",label:"events",types:["lifecycle","system"]}],Js=nn.memo(function({selected:o,typeCounts:n,onConfirm:r,onCancel:l}){let[f,b]=useState(0),[T,x]=useState(()=>new Set(o)),y=useMemo(()=>T.size===St.length||St.every(M=>T.has(M)),[T]);useInput((M,B)=>{if(B.upArrow){b(k=>k>0?k-1:St.length-1);return}if(B.downArrow){b(k=>k<St.length-1?k+1:0);return}if(M===" "){let k=St[f];if(!k)return;x(H=>{let V=new Set(H);return V.has(k)?V.delete(k):V.add(k),V});return}if(M==="a"||M==="A"){x(k=>k.size===St.length?new Set:new Set(St));return}for(let k of Zs)if(M===k.key){x(new Set(k.types));return}if(B.return){let k=T.size===0?new Set(St):new Set(T);r(k);return}if(B.escape){l();return}});let C=y?St.length:T.size;return jsxs(Box,{flexDirection:"column",borderStyle:"round",borderColor:e.amber,paddingX:1,children:[jsxs(Box,{gap:1,children:[jsx(Text,{color:e.amber,bold:true,children:" \u25C8 Type Filter"}),jsxs(Text,{color:e.dim,children:[ue," ",C,"/",St.length," selected"]})]}),jsx(Text,{color:e.ghost,children:Ve.repeat(36)}),St.map((M,B)=>{let k=B===f,H=T.has(M),V=n[M]??0,F=Vl[M];return jsxs(Box,{gap:0,children:[jsx(Text,{color:k?e.amber:e.ghost,children:k?" \u25B8 ":" "}),jsx(Text,{color:H?e.green:e.ghost,children:H?"[\u2713]":"[ ]"}),jsxs(Text,{color:k?F:e.dim,children:[" ",Gl[M]," "]}),jsx(Text,{color:k?F:H?e.silver:e.dim,bold:k,children:zl[M]}),V>0&&jsxs(Text,{color:e.dim,children:[" ",ue,V]})]},M)}),jsx(Text,{color:e.ghost,children:Ve.repeat(36)}),jsxs(Box,{gap:0,children:[jsx(Text,{color:e.dim,children:" "}),Zs.map((M,B)=>jsxs(nn.Fragment,{children:[B>0&&jsxs(Text,{color:e.ghost,children:[" ",ue," "]}),jsx(Text,{color:e.amberDim,children:M.key}),jsxs(Text,{color:e.dim,children:["=",M.label]})]},M.key))]}),jsxs(Text,{color:e.dim,children:[" Space toggle"," ",ue," ","a all"," ",ue," ","Enter confirm"," ",ue," ","Esc cancel"]})]})});var Pn="\u256D",Nn="\u256E",Dn="\u2570",Fn="\u256F",Me="\u2502";function no({children:t,cw:o}){return jsxs(Text,{children:[jsx(Text,{color:e.ghost,children:Me}),jsxs(Text,{children:[" ",t.padEnd(o)," "]}),jsx(Text,{color:e.ghost,children:Me})]})}function On({cw:t}){return jsx(no,{cw:t,children:""})}function Qs({width:t,height:o}){let n=Math.min(t-4,50),r=n-6,l=ye(n-2);return jsxs(Box,{flexDirection:"column",paddingX:2,marginTop:1,children:[jsxs(Text,{color:e.ghost,children:[Pn,l,Nn]}),jsx(no,{cw:r,children:""}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.amber,children:Ut}),jsx(Text,{color:e.white,bold:true,children:" Welcome to Orch"}),jsx(Text,{children:" ".repeat(Math.max(0,r-15-2))}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(no,{cw:r,children:""}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.silver,children:"Press N to create your first task".padEnd(r)}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(no,{cw:r,children:""}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.amber,children:"N"}),jsx(Text,{color:e.gray,children:" new task"}),jsx(Text,{children:" ".repeat(Math.max(0,r-1-1-8))}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(no,{cw:r,children:""}),jsxs(Text,{color:e.ghost,children:[Dn,l,Fn]})]})}function ei({step:t,width:o}){let n=Math.min(o-4,50),r=n-6,l=ye(n-2),f,b=null;if(t==="task_created")f="Press R to run task",b={key:"R",label:"run task"};else if(t==="run_started")f="Agent is running your task...";else return null;return jsxs(Box,{flexDirection:"column",paddingX:2,marginTop:1,children:[jsxs(Text,{color:e.ghost,children:[Pn,l,Nn]}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.amber,children:Ut}),jsxs(Text,{color:e.silver,children:[" ",f.padEnd(b?r-2-b.key.length-1-b.label.length-2:r-2)]}),b&&jsxs(Fragment,{children:[jsxs(Text,{color:e.amber,children:[" ",b.key]}),jsxs(Text,{color:e.gray,children:[" ",b.label]})]}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsxs(Text,{color:e.ghost,children:[Dn,l,Fn]})]})}function ti({width:t}){let o=Math.min(t-4,50),n=o-6,r=ye(o-2);return jsxs(Box,{flexDirection:"column",paddingX:2,marginTop:1,children:[jsxs(Text,{color:e.ghost,children:[Pn,r,Nn]}),jsx(no,{cw:n,children:""}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.green,bold:true,children:"First task completed!"}),jsx(Text,{children:" ".repeat(Math.max(0,n-21))}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(no,{cw:n,children:""}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.silver,children:"Type / to see all commands".padEnd(n)}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(no,{cw:n,children:""}),jsxs(Text,{color:e.ghost,children:[Dn,r,Fn]})]})}function Wn({count:t,config:o,width:n}){if(t>=3)return null;let r=Math.min((n??44)-4,50),l=r-6,f=ye(r-2),b=jsxs(Text,{color:e.ghost,children:[Pn,f,Nn]}),T=jsxs(Text,{color:e.ghost,children:[Dn,f,Fn]});if(t>0){let y=o.hints[0],C=y?` ${y.key} ${y.label}`:"";return jsxs(Box,{flexDirection:"column",paddingX:2,marginTop:1,children:[b,jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.amber,children:Ut}),jsxs(Text,{color:e.silver,children:[" ",o.nudge.padEnd(l-2-C.length)]}),y&&jsxs(Fragment,{children:[jsxs(Text,{color:e.amber,children:[" ",y.key]}),jsxs(Text,{color:e.gray,children:[" ",y.label]})]}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),T]})}let x=o.hints.reduce((y,C,M)=>y+C.key.length+1+C.label.length+(M>0?3:0),0);return jsxs(Box,{flexDirection:"column",paddingX:2,marginTop:1,children:[b,jsx(On,{cw:l}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.amber,children:Ut}),jsxs(Text,{color:e.white,bold:true,children:[" ",o.title]}),jsx(Text,{children:" ".repeat(Math.max(0,l-o.title.length-2))}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(On,{cw:l}),o.description.map((y,C)=>jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),jsx(Text,{color:e.silver,children:y.padEnd(l)}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]},C)),jsx(On,{cw:l}),jsxs(Text,{children:[jsxs(Text,{color:e.ghost,children:[Me," "]}),o.hints.map((y,C)=>jsxs(nn.Fragment,{children:[C>0&&jsx(Text,{color:e.ghost,children:" "}),jsx(Text,{color:e.amber,children:y.key}),jsxs(Text,{color:e.gray,children:[" ",y.label]})]},C)),jsx(Text,{children:" ".repeat(Math.max(0,l-x))}),jsx(Text,{children:" "}),jsx(Text,{color:e.ghost,children:Me})]}),jsx(On,{cw:l}),T]})}var jl=2,si=360,Ul={done:4e3,failed:8e3,review:6e3},Xl={done:"\u2713",failed:"\u2715",review:Qt},ql={done:e.green,failed:e.red,review:e.blue},Kl={done:e.successBg,failed:e.errorBg,review:e.infoBg};function Yl(t){let o=t.agentName??"Agent";switch(t.type){case "done":return `Task completed by ${o}`;case "failed":return "Task failed \u2014 press Enter for details";case "review":return "Task ready for review \u2014 press A to approve"}}var Zl=nn.memo(function({toast:o,onDismiss:n}){let[r,l]=useState(true),[f,b]=useState(false);useEffect(()=>{let k=setTimeout(()=>l(false),si);return ()=>clearTimeout(k)},[]),useEffect(()=>{let k=Ul[o.type],H=setTimeout(()=>b(true),k),V=setTimeout(()=>n(o.id),k+si);return ()=>{clearTimeout(H),clearTimeout(V);}},[o.id,o.type,n]);let T=r||f,x=Xl[o.type],y=ql[o.type],C=Kl[o.type],M=Yl(o),B=o.title.length>40?o.title.slice(0,39)+"\u2026":o.title;return jsx(Box,{children:jsxs(Text,{backgroundColor:C,children:[jsxs(Text,{color:T?e.dim:y,children:[" ",x," "]}),jsx(Text,{color:T?e.dim:e.white,bold:!T,children:B}),jsxs(Text,{color:T?e.dim:e.silver,children:[" ",M," "]})]})})}),li=nn.memo(function({toasts:o,onDismiss:n}){let r=o.slice(0,jl);return r.length===0?null:jsx(Box,{flexDirection:"column",children:r.map(l=>jsx(Zl,{toast:l,onDismiss:n},l.id))})});var ec="\u256D",tc="\u256E",oc="\u2570",nc="\u256F",lt="\u2502",Ar=[{key:"\u2191\u2193/j/k",label:"Navigate"},{key:"Tab/\u2190\u2192",label:"Switch tabs"},{key:"Enter",label:"Detail view"},{key:"G",label:"Goals tab"},{key:"T",label:"Tasks tab"},{key:"A",label:"Agents tab"},{key:"L",label:"Logs tab"}],$r=[{key:"N",label:"New item"},{key:"E",label:"Edit"},{key:"D",label:"Delete"},{key:"R",label:"Run task"},{key:"S",label:"Show / Stop"},{key:"C",label:"Cancel"},{key:"A",label:"Approve"},{key:"X",label:"Reject"},{key:"U",label:"Autonomous"},{key:"Z",label:"Undo delete"}],Br=[{key:"/",label:"Command mode"},{key:"/task add",label:"Create task"},{key:"/run",label:"Execute"},{key:"/watch",label:"Auto-dispatch"},{key:"/config",label:"Settings"},{key:"/help",label:"Help"},{key:"/quit",label:"Exit"}],Do=10,qt=22;function Er(t){let o=Math.max(0,Math.floor((qt-t.length-2)/2)),n=Math.max(0,qt-o-t.length-2);return ye(o)+" "+t+" "+ye(n)}var ci=nn.memo(function({width:o,height:n}){let r=qt*3+3+3+2,l=r+2,f=ye(l-2),b="KEYBOARD SHORTCUTS",T=Math.max(0,Math.floor((r-b.length)/2)),x=Math.max(0,r-T-b.length),y="Press any key to dismiss",C=Math.max(0,Math.floor((r-y.length)/2)),M=Math.max(0,r-C-y.length),B=Math.max(Ar.length,$r.length,Br.length),k=B+10,H=Math.max(0,Math.floor((n-k)/2)),V=[];for(let O=0;O<B;O++){let N=O<Ar.length?Ar[O]:null,E=O<$r.length?$r[O]:null,G=O<Br.length?Br[O]:null;V.push(jsxs(Text,{children:[jsx(Text,{color:e.amber,children:lt}),jsx(Text,{children:" "}),N?jsxs(Fragment,{children:[jsx(Text,{color:e.amber,bold:true,children:N.key.padEnd(Do)}),jsx(Text,{color:e.silver,children:N.label.padEnd(qt-Do)})]}):jsx(Text,{children:" ".repeat(qt)}),jsxs(Text,{color:e.dim,children:[" ",lt," "]}),E?jsxs(Fragment,{children:[jsx(Text,{color:e.amber,bold:true,children:E.key.padEnd(Do)}),jsx(Text,{color:e.silver,children:E.label.padEnd(qt-Do)})]}):jsx(Text,{children:" ".repeat(qt)}),jsxs(Text,{color:e.dim,children:[" ",lt," "]}),G?jsxs(Fragment,{children:[jsx(Text,{color:e.amber,bold:true,children:G.key.padEnd(Do)}),jsx(Text,{color:e.silver,children:G.label.padEnd(qt-Do)})]}):jsx(Text,{children:" ".repeat(qt)}),jsx(Text,{children:" "}),jsx(Text,{color:e.amber,children:lt})]},`r${O}`));}let F=O=>jsxs(Text,{children:[jsx(Text,{color:e.amber,children:lt}),jsx(Text,{children:" ".repeat(r)}),jsx(Text,{color:e.amber,children:lt})]},O),P=Er("NAVIGATION"),j=Er("ACTIONS"),L=Er("COMMANDS");return jsxs(Box,{flexDirection:"column",paddingX:Math.max(0,Math.floor((o-l)/2)),marginTop:H,children:[jsxs(Text,{color:e.amber,children:[ec,f,tc]}),F("e1"),jsxs(Text,{children:[jsx(Text,{color:e.amber,children:lt}),jsx(Text,{children:" ".repeat(T)}),jsx(Text,{color:e.amber,bold:true,children:b}),jsx(Text,{children:" ".repeat(x)}),jsx(Text,{color:e.amber,children:lt})]}),F("e2"),jsxs(Text,{children:[jsx(Text,{color:e.amber,children:lt}),jsx(Text,{children:" "}),jsx(Text,{color:e.dim,children:P}),jsxs(Text,{color:e.dim,children:[" ",lt," "]}),jsx(Text,{color:e.dim,children:j}),jsxs(Text,{color:e.dim,children:[" ",lt," "]}),jsx(Text,{color:e.dim,children:L}),jsx(Text,{children:" "}),jsx(Text,{color:e.amber,children:lt})]}),F("e3"),V,F("e4"),jsxs(Text,{children:[jsx(Text,{color:e.amber,children:lt}),jsx(Text,{children:" ".repeat(C)}),jsx(Text,{color:e.dim,children:y}),jsx(Text,{children:" ".repeat(M)}),jsx(Text,{color:e.amber,children:lt})]}),F("e5"),jsxs(Text,{color:e.amber,children:[oc,f,nc]})]})});var gi=[{value:"claude-opus-4-6",label:"Claude Opus 4.6",hint:"most capable"},{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",hint:"fast, balanced"},{value:"claude-haiku-4-6",label:"Claude Haiku 4.6",hint:"fastest, cheapest"},{value:"claude-sonnet-4-5-20250929",label:"Claude Sonnet 4.5",hint:"extended thinking"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",hint:"legacy"}],mi=[{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",hint:"default, balanced"},{value:"gpt-5.4",label:"GPT-5.4",hint:"latest"},{value:"gpt-5",label:"GPT-5",hint:"capable"},{value:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",hint:"fast"},{value:"o3",label:"o3",hint:"reasoning"},{value:"o4-mini",label:"o4-mini",hint:"fast reasoning"},{value:"gpt-5-mini",label:"GPT-5 Mini",hint:"light"},{value:"gpt-5-nano",label:"GPT-5 Nano",hint:"cheapest"},{value:"codex-mini-latest",label:"Codex Mini",hint:"legacy"}],fi=[{value:"auto",label:"Auto",hint:"let Cursor decide"},{value:"composer-1.5",label:"Composer 1.5",hint:"latest agent"},{value:"composer-1",label:"Composer 1",hint:"stable agent"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",hint:"OpenAI"},{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",hint:"Anthropic"}],pi=[{value:"",label:"Default",hint:"use model configured in opencode"},{value:"openrouter/anthropic/claude-sonnet-4.6",label:"Claude Sonnet 4.6",hint:"fast, balanced"},{value:"openrouter/anthropic/claude-opus-4.6",label:"Claude Opus 4.6",hint:"most capable"},{value:"openrouter/google/gemini-2.5-pro",label:"Gemini 2.5 Pro",hint:"Google"},{value:"openrouter/google/gemini-2.5-flash",label:"Gemini 2.5 Flash",hint:"Google, fast"},{value:"openrouter/deepseek/deepseek-v3.2",label:"DeepSeek V3.2",hint:"open-source"},{value:"openrouter/deepseek/deepseek-r1:free",label:"DeepSeek R1",hint:"reasoning, free"},{value:"opencode/big-pickle",label:"Big Pickle",hint:"opencode native"}],hi=[{value:"",label:"Default",hint:"use shell adapter default"}],rc=[{value:"claude",label:"Claude",hint:"Claude Code CLI"},{value:"opencode",label:"OpenCode",hint:"OpenCode \u2014 multi-provider"},{value:"codex",label:"Codex",hint:"OpenAI Codex CLI"},{value:"cursor",label:"Cursor",hint:"Cursor Agent CLI"},{value:"shell",label:"Shell",hint:"custom shell command"}],xi=[{value:"1",label:"P1 Critical",hint:"urgent, do first"},{value:"2",label:"P2 High",hint:"important"},{value:"3",label:"P3 Medium",hint:"default priority"},{value:"4",label:"P4 Low",hint:"nice to have"}],di=60;function bi(t){return t.filter(o=>o.status!=="disabled").map(o=>{let n=(o.role??"").split(`
|
|
11
|
+
`)[0].trim(),r=n.length>di?n.slice(0,di-1)+"\u2026":n,l=r?`[${o.adapter}] ${r}`:o.adapter;return {value:o.id,label:o.name,hint:l}})}function Vn(t,o="Auto-assign",n="orchestrator picks the best agent"){return [{value:"",label:o,hint:n},...bi(t)]}var Or=[{value:"",label:"Skip",hint:"no role description"},{value:"Full-stack developer",label:"Full-stack developer",hint:"general purpose"},{value:"Frontend developer",label:"Frontend developer",hint:"React, CSS, UI"},{value:"Backend developer",label:"Backend developer",hint:"APIs, databases, services"},{value:"DevOps engineer",label:"DevOps engineer",hint:"CI/CD, infra, deploys"},{value:"QA / Test engineer",label:"QA / Test engineer",hint:"testing, quality"},{value:"Code reviewer",label:"Code reviewer",hint:"review PRs, find bugs"},{value:"Technical writer",label:"Technical writer",hint:"docs, READMEs"},{value:"__custom__",label:"Custom...",hint:"type your own"}];function Ti(t){return [{value:"",label:"None",hint:"no team"},...(t??[]).filter(o=>o.status==="active").map(o=>({value:o.id,label:o.name,hint:`${o.members.length} members`}))]}function yi(){return [{id:"shop_template",label:"Agent Shop \u2014 choose a template",type:"select",options:a$2.map(t=>({value:t.key,label:t.name,hint:t.description}))}]}function Pr(t,o){return t.map(n=>{switch(n.id){case "name":return {...n,defaultValue:o.name};case "adapter":return {...n,defaultValue:o.adapter};case "model":return {...n,defaultValue:o.model};case "role":return {...n,defaultValue:"__custom__"};case "role_custom":return {...n,defaultValue:o.role,skip:void 0};case "skills":return {...n,defaultValue:o.skills.join(", ")};case "approval_policy":return {...n,defaultValue:o.approval_policy};default:return n}})}function Hn(t,o){let n=Ti(o);return [{id:"name",label:"Agent name",type:"text",placeholder:"e.g. alpha, frontend-bot, reviewer",required:true,validate:r=>r.trim()?t?.some(l=>l.name===r.trim())?"Agent with this name already exists":null:"Name is required",suggestions:a$2.map(r=>({value:r.key,label:r.name,hint:r.description}))},{id:"adapter",label:"Provider",type:"select",options:rc},{id:"model",label:"Model",type:"select",getOptions:r=>r.adapter==="opencode"?pi:r.adapter==="codex"?mi:r.adapter==="cursor"?fi:r.adapter==="shell"?hi:gi},{id:"role",label:"Role / specialization",type:"select",options:Or},{id:"role_custom",label:"Describe the role",type:"textarea",placeholder:"e.g. Specialist in React and TypeScript",skip:r=>r.role!=="__custom__"},{id:"skills",label:"Skills (comma-separated)",type:"text",placeholder:"e.g. feature-dev:feature-dev, testing-suite:generate-tests"},{id:"approval_policy",label:"Approval policy",type:"text",skip:()=>true},{id:"team",label:"Join team",type:"select",options:n,skip:()=>n.length<=1}]}function wi(t){let o=t.role==="__custom__"?t.role_custom||void 0:t.role||void 0,n=t.skills?t.skills.split(",").map(l=>l.trim()).filter(Boolean):void 0,r=t.approval_policy||"auto";return {name:t.name,adapter:t.adapter||"claude",role:o,model:t.model||void 0,approval_policy:r,skills:n,team_id:t.team||void 0}}function Si(t,o){let n=bi(t);return [{id:"name",label:"Team name",type:"text",placeholder:"e.g. frontend, backend, qa",required:true,validate:r=>r.trim()?o?.some(l=>l.name===r.trim())?"Team with this name already exists":null:"Name is required"},{id:"lead",label:"Team lead",type:"select",options:n},{id:"members",label:"Team members",type:"multiselect",getOptions:r=>n.filter(l=>l.value!==r.lead),skip:r=>!n.some(l=>l.value!==r.lead)},{id:"description",label:"Description",type:"textarea",placeholder:"Optional team purpose..."}]}function ki(t){let o=t.members?t.members.split(",").filter(Boolean):[];return {name:t.name,lead_agent_id:t.lead,member_agent_ids:o.length>0?o:void 0,description:t.description||void 0}}function Ci(t){let o=Vn(t);return [{id:"title",label:"Task title",type:"text",placeholder:"What needs to be done?",required:true,validate:n=>n.trim()?null:"Title is required"},{id:"priority",label:"Priority",type:"select",options:xi,defaultValue:"3",validate:n=>{let r=Number(n);return !Number.isInteger(r)||r<1||r>4?"Priority must be 1-4":null}},{id:"assignee",label:"Assignee",type:"select",options:o,skip:()=>o.length<=1},{id:"description",label:"Description",type:"textarea",placeholder:"Optional details, context, acceptance criteria..."}]}function Ii(t){return {title:t.title,priority:t.priority?parseInt(t.priority,10):void 0,assignee:t.assignee||void 0,description:t.description||void 0}}function Mi(t,o){let n=Vn(o,"None / Auto","remove assignee");return [{id:"title",label:"Task title",type:"text",defaultValue:t.title,required:true,validate:r=>r.trim()?null:"Title is required"},{id:"priority",label:"Priority",type:"select",options:xi,defaultValue:String(t.priority),validate:r=>{let l=Number(r);return !Number.isInteger(l)||l<1||l>4?"Priority must be 1-4":null}},{id:"assignee",label:"Assignee",type:"select",options:n,defaultValue:t.assignee??"",skip:()=>n.length<=1},{id:"description",label:"Description",type:"textarea",defaultValue:t.description||"",placeholder:"Optional details..."}]}function vi(t){return {title:t.title,priority:t.priority?parseInt(t.priority,10):void 0,assignee:t.assignee||void 0,description:t.description??""}}function _i(t,o,n){let r=Or.find(x=>x.value===t.role),l=r?t.role:t.role?"__custom__":"",f=t.adapter==="opencode"?pi:t.adapter==="codex"?mi:t.adapter==="cursor"?fi:t.adapter==="shell"?hi:gi,b=Ti(n),T=n?.find(x=>x.members.some(y=>y.agent_id===t.id))?.id;return [{id:"name",label:"Agent name",type:"text",defaultValue:t.name,required:true,validate:x=>x.trim()?o?.some(y=>y.id!==t.id&&y.name===x.trim())?"Agent with this name already exists":null:"Name is required"},{id:"model",label:"Model",type:"select",options:f,defaultValue:t.config.model??""},{id:"role",label:"Role / specialization",type:"select",options:Or,defaultValue:l},{id:"role_custom",label:"Describe the role",type:"textarea",defaultValue:t.role&&!r?t.role:"",placeholder:"e.g. Specialist in React and TypeScript",skip:x=>x.role!=="__custom__"},{id:"team",label:"Team",type:"select",options:b,defaultValue:T??"",skip:()=>b.length<=1}]}var sc=[{value:"1",label:"1 agent",hint:"~0.5 GB RAM, 1 subprocess"},{value:"2",label:"2 agents",hint:"~1 GB RAM, 2 subprocesses"},{value:"3",label:"3 agents",hint:"~1.5 GB RAM, 3 subprocesses"},{value:"4",label:"4 agents",hint:"~2 GB RAM, 4 subprocesses"},{value:"6",label:"6 agents",hint:"~3 GB RAM, 6 subprocesses"},{value:"8",label:"8 agents",hint:"~4 GB RAM, 8 subprocesses"},{value:"10",label:"10 agents",hint:"~5 GB RAM, 10 subprocesses"}],ic=[{value:"all",label:"All",hint:"show everything"},{value:"text",label:"Text",hint:"agent output only"},{value:"tools",label:"Tools",hint:"tool calls, results, files"},{value:"errors",label:"Errors",hint:"errors only"},{value:"events",label:"Events",hint:"lifecycle, system events"}],ui=[{value:"true",label:"On"},{value:"false",label:"Off"}];function Ri(t,o,n){let r=n??{toast:true,bell:false};return [{id:"activity_filter",label:"Activity filter preset",type:"select",options:ic,defaultValue:t},{id:"max_concurrent",label:"Max concurrent agents",type:"select",options:sc,defaultValue:String(o)},{id:"notifications_toast",label:"Toast notifications",type:"select",options:ui,defaultValue:String(r.toast)},{id:"notifications_bell",label:"Bell on completion",type:"select",options:ui,defaultValue:String(r.bell)}]}function Ai(t){let o=t.role==="__custom__"?t.role_custom||void 0:t.role||void 0;return {name:t.name,role:o,model:t.model||void 0,team_id:t.team||void 0}}function jn(t){let o=Vn(t,"Any agent","auto-assign to autonomous agents");return [{id:"title",label:"Goal title",type:"text",placeholder:'e.g. "Implement OAuth2 login with Google and GitHub"',description:"Be specific \u2014 agents work better with clear, measurable objectives",required:true,validate:n=>n.trim()?null:"Title is required"},{id:"assignee",label:"Assignee",type:"select",description:"Assigned agent gets autonomous mode \u2014 it will plan and execute without prompts",options:o,skip:()=>o.length<=1},{id:"description",label:"Description",type:"textarea",placeholder:"Success criteria, constraints, technical context...",description:'Context matters \u2014 include tech stack, constraints, and what "done" looks like'}]}function $i(t){return {title:t.title,assignee:t.assignee||void 0,description:t.description||void 0}}function Bi(t,o){let n=Vn(o,"Any agent","auto-assign");return [{id:"title",label:"Goal title",type:"text",defaultValue:t.title,description:"Be specific \u2014 agents work better with clear, measurable objectives",required:true,validate:r=>r.trim()?null:"Title is required"},{id:"assignee",label:"Assignee",type:"select",description:"Assigned agent gets autonomous mode \u2014 it will plan and execute without prompts",options:n,defaultValue:t.assignee??"",skip:()=>n.length<=1},{id:"description",label:"Description",type:"textarea",defaultValue:t.description||"",placeholder:"Success criteria, constraints, technical context...",description:'Context matters \u2014 include tech stack, constraints, and what "done" looks like'}]}function Ei(t){return {title:t.title,assignee:t.assignee||void 0,description:t.description??""}}var Li=10,Oi=500,Yn=2048,xo=500,Pi=5,Nr=new Set(["todo","failed","cancelled"]),dc={title:"Goals",description:["Define what your team should achieve.","The orchestrator breaks goals into tasks","and assigns them to agents automatically."],hints:[{key:"N",label:"new goal"},{key:"/",label:"commands"}],nudge:"Add more goals to keep your team focused."},uc={title:"Tasks",description:["Units of work dispatched to agents.","Create them manually or let goals","generate them automatically."],hints:[{key:"N",label:"new task"},{key:"W",label:"start orchestrator"}],nudge:"Add more tasks to keep agents busy."},gc={title:"Agents",description:["AI workers that execute your tasks.","Each agent uses an adapter (claude, codex,","cursor, shell) and has its own role."],hints:[{key:"N",label:"new agent"},{key:"W",label:"start orchestrator"}],nudge:"Add more agents to increase parallelism."},Ni=5e3,Fi=0;function ju(){Fi=0;}var Wi=/^\[[\w_]+\]$/;function Gi(t){return Wi.test(t)?{msgType:"lifecycle",color:e.dim}:t.startsWith("\u2699")?{msgType:"tool",color:e.dim}:t.startsWith("\u2190")?{msgType:"result",color:e.dim}:t.startsWith("\u2713")?{msgType:"lifecycle",color:e.dim}:t.startsWith("\u23F3")?{msgType:"info",color:e.silver}:{msgType:"output",color:e.silver}}var Fr=["#5faf87","#5fafd7","#af87ff","#d7af00","#5fd7d7","#d787af","#afaf5f","#d7875f"],mc=" ".repeat(9),Zn={system:"\u2666",lifecycle:"\u25B6",output:"\u2502",tool:"\u2699",result:"\u2190",error:"\u2715",file:"\u270E",info:"\u2502"},qn=["system","lifecycle","output","tool","result","error","file","info"],Fo=[{label:"all",types:qn},{label:"text",types:["output"]},{label:"tools",types:["tool","result","file"]},{label:"errors",types:["error"]},{label:"events",types:["lifecycle","system"]}];function Dr(t){let n=(Fo.findIndex(r=>r.types.length===t.size&&r.types.every(l=>t.has(l)))+1)%Fo.length;return Fo[n]}function Uu({projectName:t,tasks:o,agents:n=[],state:r,onRunTask:l,onCreateTask:f,onCancelTask:b$1,onRetryTask:T,onAssignTask:x,onRunAll:y,onDisableAgent:C,onEnableAgent:M,onSubscribeEvents:B,onRefreshTasks:k,onRefreshAgents:H,onRefreshState:V,onLoadHistory:F,onAddAgent:P,onDeleteAgent:j,onApproveTask:L,onRejectTask:O,onDeleteTask:N,onUpdateTask:E,onUpdateAgent:G,onForceStopAgent:z,onCreateTeam:X,onListTeams:R,onJoinTeam:ie,onLeaveTeam:Le,onDisbandTeam:zt,onSetTeamLead:ct,onStartWatch:Ae,onStopWatch:Ke,onToggleAutonomous:dt,onRefreshGoals:pt,onCreateGoal:De,onUpdateGoal:Ye,onUpdateGoalStatus:ut,onDeleteGoal:Ze,onGetGoalProgress:ro,onCompleteOnboarding:Ce,initialWatchActive:ht,watchError:Et,messageBatchMs:Kt=process.env.VITEST?0:80,initialActivityFilter:xt="all",onSaveActivityFilter:et,initialMaxConcurrent:gt=a.scheduling.max_concurrent_agents,onSaveMaxConcurrent:Wo,initialNotifications:ln,onSaveNotifications:It,version:Yt,latestVersion:Vt}){let{exit:Ht}=useApp(),{stdout:tt}=useStdout(),[bo,bt]=useState({w:tt?.columns??80,h:tt?.rows??24});useEffect(()=>{if(!tt)return;let i=()=>bt({w:tt.columns,h:tt.rows});return tt.on("resize",i),()=>{tt.off("resize",i);}},[tt]);let Mt=bo.w,To=bo.h,[$e,so]=useState(o),[le,A]=useState(n),[S,I]=useState(r),[$,K]=useState(ht??!!r.pid),[Q,Ie]=useState([]),[ce,ge]=useState(void 0),[he,vt]=useState(()=>r.onboardingCompleted||(r.stats?.total_tasks_completed??0)>0?"dismissed":Object.keys(r.running??{}).length>0?"run_started":o.length>0?"task_created":"welcome");useEffect(()=>{if(he!=="completed")return;let i=setTimeout(()=>{vt("dismissed"),Ce?.().catch(()=>{});},5e3);return ()=>clearTimeout(i)},[he,Ce]);let[_,Zt]=useState("tasks"),[cn,Go]=useState(0),[Jn,Wr]=useState(0),[Qn,Gr]=useState(0),[Be,zo]=useState(false),[ze,zr]=useState([]),[Fe,Oe]=useState("none"),[io,_t]=useState(""),[Tt,Je]=useState(null),[ao,Vo]=useState([]),[Lt,er]=useState(false),[Vr,Xi]=useState(()=>new Set),[yo,tr]=useState(false),[Ho,or]=useState(false),[Hr,jr]=useState(()=>new Set(qn)),[jo,nr]=useState(-1),[qi,Uo]=useState(0),[wo,rr]=useState(()=>{let i=Fo.find(h=>h.label===xt);return new Set(i?.types??qn)}),dn=useMemo(()=>Fo.find(h=>h.types.length===wo.size&&h.types.every(s=>wo.has(s)))?.label??"all",[wo]),sr=useMemo(()=>wo.size>=qn.length?ze:ze.filter(i=>wo.has(i.msgType??"info")),[ze,wo]),[Ur,Ki]=useState(gt),[un,Yi]=useState(ln??{toast:true,bell:false}),[Zi,Xr]=useState([]),Ji=useRef(0),[ir,qr]=useState(),Kr=useRef(_);Kr.current=_;let Yr=useRef($e);Yr.current=$e;let Zr=useRef(le);Zr.current=le;let gn=useRef(un);gn.current=un;let mn=useCallback((i,h)=>{if(!gn.current.toast)return;let s=Yr.current.find(p=>p.id===h),d=s?.title??h,u=s?.assignee?Zr.current.find(p=>p.id===s.assignee):void 0;Xr(p=>{let g=[...p,{id:`toast_${Ji.current++}`,type:i,title:d,agentName:u?.name,ts:Date.now()}];return g.length>Pi?g.slice(g.length-Pi):g}),gn.current.bell&&(i==="failed"||i==="review")&&process.stdout.write("\x07");},[]),Qi=useCallback(i=>{Xr(h=>h.filter(s=>s.id!==i));},[]),fn=nn.useRef(new $n).current,[ea,So]=useState(0),[Jr,Qr]=useState(false),[Xo,ta]=useState(false),[oa,ar]=useState(0),[na,lr]=useState(0),[cr,ko]=useState(0),[pn,dr]=useState(false),[ra,qo]=useState(0),[hn,Jt]=useState(0),[jt,es]=useState([]),[Co,ur]=useState([]),Io=useRef(jt);Io.current=jt;let Z=useCallback(async i=>{let[h,s,d,u,p]=await Promise.all([k?.()??Promise.resolve($e),H?.()??Promise.resolve(le),V?.()??Promise.resolve(S),i?.includeTeams?R?.()??Promise.resolve(Io.current):Promise.resolve(null),pt?.()??Promise.resolve(Q)]);so(h),A(s),I(d),u!==null&&es(u),Ie(p),ht&&K(!!d.pid);},[k,H,V,R,pt,ht]),Mo=useMemo(()=>{let i=new Map;for(let h of Q)i.set(h.id,h);return i},[Q]),Pe=useMemo(()=>{let i=[...$e].sort((p,g)=>(en[p.status]??9)-(en[g.status]??9));if(!Xo)return i;let h=[],s=[],d=[],u=new Map;for(let p of i)p.goalId&&Mo.has(p.goalId)?(u.has(p.goalId)||(d.push(p.goalId),u.set(p.goalId,[])),u.get(p.goalId).push(p)):s.push(p);for(let p of d)h.push(...u.get(p));return [...h,...s]},[$e,Xo,Mo]),Ot=Jr?Pe:Pe.slice(0,Li),vo=Pe.length-Ot.length,U=Pe[cn],Ko=useMemo(()=>{let i=new Map;for(let h of $e)i.set(h.id,h.title);return i},[$e]),lo=useMemo(()=>{let i=new Map;for(let h of le)i.set(h.id,h.name);return i},[le]),sa=useMemo(()=>{let i=new Map;for(let h of $e)if(h.goalId){let s=i.get(h.goalId);s||(s=[],i.set(h.goalId,s)),s.push(h);}return i},[$e]),xn=useMemo(()=>{let i=new Map;for(let h=0;h<le.length;h++)i.set(le[h].id,Fr[h%Fr.length]);return i},[le]),ts=useMemo(()=>{let i=new Map;for(let h of ze)h.agentId&&i.set(h.agentId,(i.get(h.agentId)??0)+1);return i},[ze]),ia=useMemo(()=>{let i={};for(let h of ze){let s=h.msgType??"info";i[s]=(i[s]??0)+1;}return i},[ze]),{agentTeamMap:_o,activeTeamCount:Yo,teamLeadSet:aa}=useMemo(()=>{let i=new Map,h=new Set,s=0;for(let d of jt)if(d.status==="active"){s++,h.add(d.lead_agent_id);for(let u of d.members)i.set(u.agent_id,d.name);}return {agentTeamMap:i,activeTeamCount:s,teamLeadSet:h}},[jt]),We=useMemo(()=>{let i=[...le];return i.sort((h,s)=>{let d=_o.get(h.id),u=_o.get(s.id);return d&&!u?-1:!d&&u?1:d&&u&&d!==u?d.localeCompare(u):(Sr[h.status]??9)-(Sr[s.status]??9)}),i},[le,_o]),J=We[Jn],mt=useMemo(()=>[...Q].sort((i,h)=>(c[i.status]??9)-(c[h.status]??9)),[Q]),te=mt[Qn],la=useMemo(()=>te?$e.filter(i=>i.goalId===te.id):[],[te,$e]),gr=useRef(ro);gr.current=ro,useEffect(()=>{if(!te||!gr.current){ge(void 0);return}let i=false;return gr.current(te.id).then(h=>{i||ge(h);}).catch(()=>{}),()=>{i=true;}},[te?.id]);let co=useRef(new Map),bn=useRef(new Map);useEffect(()=>{for(let[i,h]of Object.entries(S.running))co.current.set(h.run_id,h.agent_id),bn.current.set(h.run_id,i);if(co.current.size>Oi){let i=co.current.size-Oi,h=0;for(let s of co.current.keys()){if(h++>=i)break;co.current.delete(s),bn.current.delete(s);}}},[S.running]);let uo=useRef([]),Zo=useRef(null),mr=useCallback(()=>{if(Zo.current=null,uo.current.length===0)return;let i=uo.current;uo.current=[],zr(h=>{if(i.length>=xo)return i.slice(-xo);let s=xo-i.length;return (h.length>s?h.slice(-s):h).concat(i)});},[]);useEffect(()=>()=>{Zo.current&&clearTimeout(Zo.current);},[]);let a=useCallback((i,h,s)=>{let d=new Date,u=d.toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"}),p=s?.detail&&s.detail.length>Yn?s.detail.slice(0,Yn)+"\u2026[truncated]":s?.detail;uo.current.push({text:i,color:h,time:u,ts:d.getTime(),...s,detail:p}),uo.current.length>xo&&(uo.current=uo.current.slice(-xo)),Kt===0?mr():Zo.current||(Zo.current=setTimeout(mr,Kt));},[mr]);useEffect(()=>{Et&&a(`Watch mode failed: ${Et}. Tasks will not auto-dispatch.`,e.red);},[]);let Ro=useCallback((i,h,s,d)=>{let u={key:++Fi,entityType:i,entityId:h,entityName:s,expiresAt:Date.now()+Ni,needsForceStop:d?.needsForceStop};ur(p=>[...p,u]),a(`\u2717 "${s}" will be deleted in ${Math.round(Ni/1e3)}s \u2014 press Z to undo`,e.yellow);},[a]),ca=useCallback(()=>{ur(i=>{if(i.length===0)return i;let h=i[i.length-1];return a(`\u21B6 Undo: "${h.entityName}" restored`,e.green),i.slice(0,-1)});},[a]),os=useCallback(async i=>{try{i.entityType==="task"&&N?await N(i.entityId):i.entityType==="agent"?(i.needsForceStop&&z&&await z(i.entityId),j&&await j(i.entityId)):i.entityType==="goal"&&Ze&&await Ze(i.entityId),a(`\u2713 Deleted "${i.entityName}"`,e.green),Z();}catch(h){a(`Failed to delete "${i.entityName}": ${h instanceof Error?h.message:String(h)}`,e.red);}},[N,j,Ze,z,a,Z]),ns=useRef(os);ns.current=os,useEffect(()=>{if(Co.length===0)return;let i=setInterval(()=>{let h=Date.now(),s=[];ur(d=>{let u=d.filter(p=>p.expiresAt<=h?(s.push(p),false):true);return s.length>0?u:d});for(let d of s)ns.current(d);},1e3);return ()=>clearInterval(i)},[Co.length>0]),useEffect(()=>{if(!F)return;let i=h=>{let s=new Date(h.timestamp).toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"}),d=typeof h.data=="string"?h.data:JSON.stringify(h.data),u,p=e.silver,g="output";if(h.type==="error")u=typeof h.data=="string"?h.data:JSON.stringify(h.data),u=u.slice(0,200),p=e.red,g="error";else if(h.type==="file_changed")u=String(h.data),p=e.purple,g="file";else if(h.type==="done")u="Completed",p=e.green,g="lifecycle";else if(h.type==="tool_call")u=`\u2699 ${h.data?.name??"tool"}()`,p=e.cyan,g="tool";else {let{summary:w}=Ui(d);if(!w)return null;u=w;let Y=Gi(u);g=Y.msgType,p=Y.color;}return {text:u,color:p,time:s,ts:new Date(h.timestamp).getTime(),agentId:h.agentId,taskId:h.taskId,msgType:g}};F(h=>{if(h.length===0)return;let s=h.map(i).filter(d=>d!==null);zr(d=>{let u=[...s,...d];return u.length>xo?u.slice(-xo):u});}).catch(h=>{process.stderr.write(`[TUI] onLoadHistory error: ${h instanceof Error?h.stack??h.message:String(h)}
|
|
12
|
+
`);});},[]),useEffect(()=>{R?.().then(es).catch(()=>{}),pt?.().then(Ie).catch(()=>{});},[]);let Tn=useCallback(()=>{Je({title:"NEW AGENT",steps:Hn(le,Io.current),kind:"agent"}),Oe("wizard");},[le]),rs=useCallback(()=>{Je({title:"AGENT SHOP",steps:yi(),kind:"agent_shop"}),Oe("wizard");},[]),yn=useCallback(()=>{Vo([]),Je({title:"NEW TASK",steps:Ci(le),kind:"task"}),Oe("wizard");},[le]),da=useCallback(async()=>{try{let{detectClipboardType:i,getClipboardImage:h}=await import('./clipboard-service-WVON5ZN4.js'),s=await i();if(s!=="image")return a(s==="text"?"Clipboard has text, not image":"Clipboard is empty",e.dim),s;let d=await h();if(!d)return a("Failed to read clipboard image",e.red),"empty";let{mkdtemp:u,writeFile:p}=await import('fs/promises'),{tmpdir:g}=await import('os'),{join:w}=await import('path'),Y=await u(w(g(),"orch-paste-")),Nt=w(Y,`clipboard-${Date.now()}.${d.ext}`);return await p(Nt,d.data),Vo(go=>[...go,Nt]),a(`\u{1F4CE} Image attached (${Math.round(d.data.length/1024)}KB)`,e.green),"image"}catch{return a("Clipboard paste failed",e.red),"empty"}},[a]),ua=useCallback(i=>{Je({title:"EDIT TASK",steps:Mi(i,le),kind:"edit_task",targetId:i.id}),Oe("wizard");},[le]),ss=useCallback(()=>{Je({title:"NEW TEAM",steps:Si(le,jt),kind:"team"}),Oe("wizard");},[le]),ga=useCallback(i=>{Je({title:"EDIT AGENT",steps:_i(i,le,jt),kind:"edit_agent",targetId:i.id}),Oe("wizard");},[jt]),is=useCallback(()=>{Je({title:"SETTINGS",steps:Ri(dn,Ur,un),kind:"config"}),Oe("wizard");},[dn,Ur]),ma=useCallback(i=>{Oe("none");let h=Tt?.kind,s=Tt?.targetId;if(Je(null),h==="agent_shop"){let d=i.shop_template,u=d?b(d):void 0;if(u){let p=Hn(le,Io.current),g=Pr(p,u);Je({title:`NEW AGENT \u2014 ${u.name}`,steps:g,kind:"agent_from_shop"}),Oe("wizard");}else a("No template selected",e.yellow);return}if((h==="agent"||h==="agent_from_shop")&&P){let d=wi(i);a(`Creating agent "${d.name}"...`,e.amber),P(d.name,d.adapter,{model:d.model,role:d.role,approval_policy:d.approval_policy,skills:d.skills}).then(u=>{a(`\u2713 Created agent "${u.name}" (${u.id}, ${u.adapter})`,e.green),d.team_id&&ie?ie(d.team_id,u.id).then(p=>{a(`\u2713 Joined team "${p.name}"`,e.green),Z({includeTeams:true});},p=>a(`Failed to join team: ${p instanceof Error?p.message:String(p)}`,e.red)):Z();},u=>a(`Failed: ${u instanceof Error?u.message:String(u)}`,e.red));}else if(h==="team"&&X){let d=ki(i);a(`Creating team "${d.name}"...`,e.amber),X(d).then(u=>{a(`\u2713 Created team "${u.name}" (${u.id}, ${u.members.length} members)`,e.green),Z({includeTeams:true});},u=>a(`Failed: ${u instanceof Error?u.message:String(u)}`,e.red));}else if(h==="task"&&f){let d=Ii(i),u=ao.length>0?[...ao]:void 0;Vo([]),a(`Creating "${d.title}"...`,e.amber),f(d.title,{priority:d.priority,description:d.description,attachments:u}).then(p=>{a(`\u2713 Created "${p.title}" (${p.id})${u?` \u{1F4CE}${u.length}`:""}`,e.green),d.assignee&&x&&x(p.id,d.assignee).catch(()=>{}),Z();},p=>a(`Failed: ${p instanceof Error?p.message:String(p)}`,e.red));}else if(h==="edit_task"&&s&&E){let d=vi(i),u=ao.length>0?[...ao]:void 0;Vo([]),a("Updating task...",e.amber),E(s,{...d,attachments:u}).then(p=>{a(`\u2713 Updated "${p.title}"${u?` \u{1F4CE}${u.length}`:""}`,e.green),d.assignee&&x&&x(s,d.assignee).catch(()=>{}),Z();},p=>a(`Failed: ${p instanceof Error?p.message:String(p)}`,e.red));}else if(h==="edit_agent"&&s&&G){let d=Ai(i),u=d.team_id??"",p=jt.find(g=>g.members.some(w=>w.agent_id===s))?.id??"";a("Updating agent...",e.amber),G(s,{name:d.name,role:d.role,model:d.model}).then(g=>{a(`\u2713 Updated agent "${g.name}"`,e.green);let w=[];p&&p!==u&&Le&&w.push(Le(p,s).then(Y=>a(`\u2713 Left team "${Y.name}"`,e.green),Y=>a(`Failed to leave team: ${Y instanceof Error?Y.message:String(Y)}`,e.red))),u&&u!==p&&ie&&w.push(ie(u,s).then(Y=>a(`\u2713 Joined team "${Y.name}"`,e.green),Y=>a(`Failed to join team: ${Y instanceof Error?Y.message:String(Y)}`,e.red))),Promise.all(w).then(()=>Z({includeTeams:w.length>0}));},g=>a(`Failed: ${g instanceof Error?g.message:String(g)}`,e.red));}else if(h==="config"){if(i.activity_filter){let g=Fo.find(w=>w.label===i.activity_filter);g&&(rr(new Set(g.types)),et?.(g.label));}if(i.max_concurrent){let g=parseInt(i.max_concurrent,10);g>0&&(Ki(g),Wo?.(g));}let d=i.notifications_toast==="true",u=i.notifications_bell==="true",p={toast:d,bell:u};Yi(p),It?.(p),a("Settings saved",e.green);}else if(h==="goal"&&De){let d=$i(i);a(`Creating goal "${d.title}"...`,e.amber),De(d).then(u=>{a(`\u2713 Created goal "${u.title}" (${u.id})`,e.green),Z();},u=>a(`Failed: ${u instanceof Error?u.message:String(u)}`,e.red));}else if(h==="edit_goal"&&s&&Ye){let d=Ei(i);a("Updating goal...",e.amber),Ye(s,d).then(u=>{a(`\u2713 Updated goal "${u.title}"`,e.green),Z();},u=>a(`Failed: ${u instanceof Error?u.message:String(u)}`,e.red));}},[Tt,P,f,X,ie,Le,x,E,G,dt,De,Ye,a,Z,et,Wo,un,It,jt,ao]),fa=useCallback(()=>{Oe("none"),Je(null),Vo([]);},[]),pa=useCallback(i=>{let h=b(i);if(!h)return;let s=Hn(le,Io.current),d=Pr(s,h);Je({title:`NEW AGENT \u2014 ${h.name}`,steps:d,kind:"agent_from_shop"}),Oe("wizard");},[]);useEffect(()=>{if(!B)return;let i=null,h=()=>{i||(i=setTimeout(()=>{i=null,Z().catch(()=>{});},150));},s=B(d=>{if(d.type==="agent:started"&&(co.current.set(d.runId,d.agentId),bn.current.set(d.runId,d.taskId)),Bc(d,a,co.current,bn.current),d.type==="task:created"?vt(u=>u==="welcome"?"task_created":u):d.type==="agent:started"?vt(u=>u==="task_created"?"run_started":u):d.type==="task:status_changed"&&d.to==="done"&&vt(u=>u==="run_started"?"completed":u),d.type==="task:status_changed"&&(d.to==="done"?mn("done",d.taskId):d.to==="failed"?mn("failed",d.taskId):d.to==="review"&&mn("review",d.taskId),gn.current.toast&&Kr.current!=="tasks")){let u=d.to==="done"?e.green:d.to==="failed"?e.red:d.to==="review"?e.blue:void 0;u&&qr({tab:"tasks",color:u});}(d.type==="task:status_changed"||d.type==="task:created"||d.type==="task:assigned"||d.type==="agent:started"||d.type==="agent:completed"||d.type==="run:retry"||d.type==="goal:created"||d.type==="goal:status_changed"||d.type==="goal:updated"||d.type==="goal:deleted")&&h();});return ()=>{s(),i&&clearTimeout(i);}},[B,a,Z,mn]);let fr=$?"watching":"idle",ha=S.started_at?g(S.started_at):void 0,as=S.stats.total_tokens.total,ls=useMemo(()=>{let i={running:0,retrying:0,review:0,todo:0,done:0,failed:0,cancelled:0};for(let h of $e)h.status==="in_progress"?i.running++:h.status==="retrying"?i.retrying++:h.status==="review"?i.review++:h.status==="todo"?i.todo++:h.status==="done"?i.done++:h.status==="failed"?i.failed++:h.status==="cancelled"&&i.cancelled++;return {...i,teams:Yo}},[$e,Yo]);ls.running;let xa=useMemo(()=>({input:S.stats.total_tokens.input??0,output:S.stats.total_tokens.output??0,reasoning:S.stats.total_tokens.reasoning??0,total:as,cache_read:S.stats.total_tokens.cache_read??0,cache_write:S.stats.total_tokens.cache_write??0}),[S.stats.total_tokens,as]),Rt=Math.max(4,To-9),ba=_o.size,Ta=le.length>ba,ya=Yo>0?Yo+(Ta?1:0):0,wa=useMemo(()=>{if(!Xo||Mo.size===0)return 0;let i=0,h=new Set,s=false;for(let d of Ot)d.goalId&&Mo.has(d.goalId)?h.has(d.goalId)||(h.add(d.goalId),i++):s=true;return s&&i++,i},[Xo,Mo,Ot]),Sa=_==="goals"?mt.length+1:_==="tasks"?Ot.length+1+(vo>0?1:0)+wa:_==="agents"?le.length+1+ya:0,ka=Math.min(Sa+1,Math.ceil(Rt*.5)),Ca=_==="logs"?Rt:Math.max(2,Math.min(ka,Rt-4)),Se,Pt;if(_==="logs")Se=Rt,Pt=0;else if(pn)Se=0,Pt=Math.max(1,Rt);else {let i=Math.max(3,Math.min(Ca+cr,Rt-4));Se=i,Pt=Math.max(1,Rt-i);}let _e=Math.max(10,Mt-2),At=useMemo(()=>Fe==="command"?Ws(io):[],[Fe,io]),Ao=Rt-4-3;useEffect(()=>{cr>Ao&&ko(Ao),cr<-Ao&&ko(-Ao);},[Rt]),useEffect(()=>{So(i=>Math.min(i,Math.max(0,Ot.length-Se)));},[Ot.length,Se]),useEffect(()=>{ar(i=>Math.min(i,Math.max(0,We.length-Se)));},[We.length,Se]),useEffect(()=>{lr(i=>Math.min(i,Math.max(0,mt.length-Se)));},[mt.length,Se]);let Ia=useCallback(i=>{let s=i.trim().replace(/^\//,"").split(/\s+/),d=s[0]?.toLowerCase();if(!d)return;let u=p=>p instanceof Error?p.message:String(p);switch(d){case "cancel":{if(!U){a("No task selected",e.yellow);return}if(!b$1)return;a(`Cancelling "${U.title}"...`,e.amber),b$1(U.id).then(()=>{a(`\u2713 Cancelled "${U.title}"`,e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}case "retry":{if(!U){a("No task selected",e.yellow);return}if(!T)return;a(`Retrying "${U.title}"...`,e.amber),T(U.id).then(()=>{a(`\u2713 Retried "${U.title}"`,e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}case "assign":{if(!U){a("No task selected",e.yellow);return}if(!x||!s[1]){a("Usage: assign <agent>",e.yellow);return}a(`Assigning "${U.title}" to ${s[1]}...`,e.amber),x(U.id,s[1]).then(()=>{a(`\u2713 Assigned "${U.title}" to ${s[1]}`,e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}case "task":{let p=s[1]?.toLowerCase();if(p==="add"){let g=s.slice(2).join(" ");if(!g){yn();return}if(!f){a("Create not available",e.yellow);return}a(`Creating "${g}"...`,e.amber),f(g).then(w=>{a(`\u2713 Created "${w.title}" (${w.id})`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="list"){let g=Pe.map(w=>` ${w.id} ${w.status.padEnd(11)} ${w.title}`);if(g.length===0)a("No tasks",e.dim);else for(let w of g)a(w,e.cyan);}else if(p==="show"){let g=s[2]?Pe.find(w=>w.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}a(`${g.id} ${g.status} P${g.priority} "${g.title}"`,e.cyan),g.assignee&&a(` agent: ${g.assignee}`,e.dim),g.description&&a(` ${g.description.slice(0,100)}`,e.dim);}else if(p==="cancel"){let g=s[2]?Pe.find(w=>w.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}if(!b$1)return;a(`Cancelling "${g.title}"...`,e.amber),b$1(g.id).then(()=>{a(`\u2713 Cancelled "${g.title}"`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="retry"){let g=s[2]?Pe.find(w=>w.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}if(!T)return;a(`Retrying "${g.title}"...`,e.amber),T(g.id).then(()=>{a(`\u2713 Retried "${g.title}"`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="assign"){let g=s[2]?Pe.find(Nt=>Nt.id===s[2]):void 0,w=g??U,Y=g?s[3]:s[2];if(!w){a("No task selected or id given",e.yellow);return}if(!Y){a("Usage: /task assign [id] <agent>",e.yellow);return}if(!x)return;a(`Assigning "${w.title}" to ${Y}...`,e.amber),x(w.id,Y).then(()=>{a(`\u2713 Assigned "${w.title}" to ${Y}`,e.green),Z();},Nt=>a(`Failed: ${u(Nt)}`,e.red));}else if(p==="approve"){let g=s[2]?Pe.find(w=>w.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}if(g.status!=="review"){a(`Cannot approve \u2014 status is ${g.status}`,e.yellow);return}if(!L)return;a(`Approving "${g.title}"...`,e.amber),L(g.id).then(()=>{a(`\u2713 Approved "${g.title}"`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="reject"){let g=s[2]?Pe.find(Y=>Y.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}if(g.status!=="review"){a(`Cannot reject \u2014 status is ${g.status}`,e.yellow);return}if(!O)return;let w=s.slice(s[2]&&Pe.find(Y=>Y.id===s[2])?3:2).join(" ").trim()||void 0;a(`Rejecting "${g.title}"${w?" with feedback":""}...`,e.amber),O(g.id,w).then(()=>{a(`\u2713 Rejected "${g.title}" \u2192 todo`,e.green),Z();},Y=>a(`Failed: ${u(Y)}`,e.red));}else if(p==="delete"){let g=s[2]?Pe.find(w=>w.id===s[2]):U;if(!g){a("No task selected or id given",e.yellow);return}if(g.status==="in_progress"){a("Cannot delete \u2014 task is running",e.yellow);return}if(!N)return;Ro("task",g.id,g.title);}else a("Usage: /task add|list|show|cancel|retry|assign|approve|reject|delete",e.yellow);return}case "agent":{let p=s[1]?.toLowerCase();if(p==="add"){let g=s[2];if(!g){Tn();return}if(!P){a("Agent creation not available",e.yellow);return}let w=s[3];a(`Creating agent "${g}"...`,e.amber),P(g,w).then(Y=>{a(`\u2713 Created agent "${Y.name}" (${Y.id}, ${Y.adapter})`,e.green),Z();},Y=>a(`Failed: ${u(Y)}`,e.red));}else if(p==="list"){let g=We.map(w=>` ${w.id} ${w.status.padEnd(8)} ${w.name} (${w.adapter})`);if(g.length===0)a("No agents",e.dim);else for(let w of g)a(w,e.cyan);}else if(p==="disable"){let g=s[2]?We.find(w=>w.id===s[2]||w.name===s[2]):J;if(!g){a("No agent selected or id given",e.yellow);return}if(!C)return;a(`Disabling ${g.name}...`,e.amber),C(g.id).then(()=>{a(`\u2713 Disabled ${g.name}`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="enable"){let g=s[2]?We.find(w=>w.id===s[2]||w.name===s[2]):J;if(!g){a("No agent selected or id given",e.yellow);return}if(!M)return;a(`Enabling ${g.name}...`,e.amber),M(g.id).then(()=>{a(`\u2713 Enabled ${g.name}`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="delete"||p==="remove"){let g=s[2]?We.find(w=>w.id===s[2]||w.name===s[2]):J;if(!g){a("No agent selected or id given",e.yellow);return}if(g.status==="running"){a("Cannot delete \u2014 agent is running",e.yellow);return}if(!j){a("Agent deletion not available",e.yellow);return}Ro("agent",g.id,g.name);}else if(p==="autonomous"||p==="auto"){let g=s[2]?We.find(w=>w.id===s[2]||w.name===s[2]):J;if(!g){a("No agent selected or id given",e.yellow);return}if(!dt){a("Autonomous toggle not available",e.yellow);return}g.autonomous?(a(`Disabling autonomous mode for "${g.name}"...`,e.amber),dt(g.id,false).then(()=>{a(`${mo} ${g.name} autonomous OFF`,e.cyan),Z();},w=>a(`Failed: ${u(w)}`,e.red))):(a(`Enabling autonomous mode for "${g.name}"...`,e.amber),dt(g.id,true).then(()=>{a(`${mo} ${g.name} autonomous ON`,e.cyan),Z();},w=>a(`Failed: ${u(w)}`,e.red)));}else p==="shop"?rs():a("Usage: /agent add|list|disable|enable|delete|autonomous|shop",e.yellow);return}case "team":{let p=s[1]?.toLowerCase();if(p==="create"||p==="add")ss();else if(p==="list"){let g=Io.current;if(g.length===0)a("No teams",e.dim);else for(let w of g)a(` ${w.id} ${w.status.padEnd(8)} ${w.name} (${w.members.length} members)`,e.cyan);}else if(p==="join"){if(!ie){a("Join not available",e.yellow);return}let g=s[2],w=s[3]??J?.id;if(!g||!w){a("Usage: /team join <teamId> [agentId]",e.yellow);return}a(`Joining team ${g}...`,e.amber),ie(g,w).then(Y=>{a(`\u2713 Agent joined team "${Y.name}"`,e.green),Z({includeTeams:true});},Y=>a(`Failed: ${u(Y)}`,e.red));}else if(p==="leave"){if(!Le){a("Leave not available",e.yellow);return}let g=s[2],w=s[3]??J?.id;if(!g||!w){a("Usage: /team leave <teamId> [agentId]",e.yellow);return}a(`Leaving team ${g}...`,e.amber),Le(g,w).then(Y=>{a(`\u2713 Agent left team "${Y.name}"`,e.green),Z({includeTeams:true});},Y=>a(`Failed: ${u(Y)}`,e.red));}else if(p==="disband"){if(!zt){a("Disband not available",e.yellow);return}let g=s[2];if(!g){a("Usage: /team disband <teamId>",e.yellow);return}a(`Disbanding team ${g}...`,e.amber),zt(g).then(()=>{a("\u2713 Team disbanded",e.green),Z({includeTeams:true});},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="set-lead"){if(!ct){a("Set-lead not available",e.yellow);return}let g=s[2],w=s[3];if(!g||!w){a("Usage: /team set-lead <teamId> <agentId>",e.yellow);return}a(`Setting lead for team ${g}...`,e.amber),ct(g,w).then(Y=>{a(`\u2713 New lead for team "${Y.name}"`,e.green),Z({includeTeams:true});},Y=>a(`Failed: ${u(Y)}`,e.red));}else a("Usage: /team create|list|join|leave|disband|set-lead",e.yellow);return}case "goal":{let p=s[1]?.toLowerCase();if(p==="add"||p==="create"){let g=s.slice(2).join(" ").trim();if(!g){let w=jn(le);Je({title:"New Goal",steps:w,kind:"goal"}),Oe("wizard");return}if(!De){a("Goal creation not available",e.yellow);return}a(`Creating goal "${g}"...`,e.amber),De({title:g}).then(w=>{a(`\u2713 Created goal "${w.title}" (${w.id})`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));}else if(p==="list"){let g=mt.map(w=>` ${w.id} ${w.status.padEnd(8)} ${w.title}`);if(g.length===0)a("No goals",e.dim);else for(let w of g)a(w,e.cyan);}else if(p==="show"){let g=s[2]?mt.find(w=>w.id===s[2]):te;if(!g){a("No goal selected or id given",e.yellow);return}a(`${g.id} ${g.status} "${g.title}"`,e.cyan),g.description&&a(` ${g.description.slice(0,100)}`,e.dim);}else if(p==="status"){let g=s[2]?mt.find(go=>go.id===s[2]):void 0,w=g??te;if(!w){a("No goal selected or id given",e.yellow);return}let Y=s[g?3:2];if(!Y||!a$1.includes(Y)){a("Usage: /goal status [id] <active|paused|achieved|abandoned>",e.yellow);return}let Nt=Y;if(!ut){a("Status update not available",e.yellow);return}a(`Updating goal status to ${Nt}...`,e.amber),ut(w.id,Nt).then(go=>{a(`\u2713 Goal "${go.title}" \u2192 ${Nt}`,e.green),Z();},go=>a(`Failed: ${u(go)}`,e.red));}else if(p==="delete"){let g=s[2]?mt.find(w=>w.id===s[2]):te;if(!g){a("No goal selected or id given",e.yellow);return}if(!Ze){a("Goal deletion not available",e.yellow);return}Ro("goal",g.id,g.title);}else a("Usage: /goal add|list|show|status|delete",e.yellow);return}case "run":{let p=s[1]??U?.id;if(!p){a("No task selected or id given",e.yellow);return}if(!l){a("Run not available",e.yellow);return}let g=Pe.find(w=>w.id===p);if(g&&!Nr.has(g.status)){a(`Cannot run \u2014 status is ${g.status}`,e.yellow);return}a(`Running ${p}...`,e.amber),l(p).then(()=>{a(`\u2713 Dispatched ${p}`,e.green),Z();},w=>a(`Failed: ${u(w)}`,e.red));return}case "run-all":{if(!y){a("Run-all not available",e.yellow);return}a("Running all todo tasks...",e.amber),y().then(()=>{a("\u2713 Dispatched all todo tasks",e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}case "watch":{if($){a("Watch mode already active",e.yellow);return}if(!Ae){a("Watch not available",e.yellow);return}a("Starting watch mode...",e.amber),Ae().then(()=>{K(true),a("\u2713 Watch mode started",e.green);},p=>a(`Failed: ${u(p)}`,e.red));return}case "pause":{if(!$){a("Watch mode not active",e.yellow);return}if(!Ke){a("Pause not available",e.yellow);return}a("Pausing watch mode...",e.amber),Ke().then(()=>{K(false),a("\u2713 Watch mode paused",e.green);},p=>a(`Failed: ${u(p)}`,e.red));return}case "config":{s[1]?.toLowerCase()==="activity-filter"?rr(g=>{let w=Dr(g);return et?.(w.label),a(`Activity filter: ${w.label}`,e.amber),new Set(w.types)}):is();return}case "status":{let p=$e.filter(g=>g.status==="in_progress").length;a(`${fr} ${p} running ${$e.length} tasks ${We.length} agents`,e.cyan);return}case "help":{for(let[p,g]of Object.entries(po)){let w=g.sub?" "+g.sub.join("|"):g.args?" "+g.args:"";a(` /${p}${w} \u2014 ${g.help}`,e.silver);}return}case "quit":{Ht();return}case "disable":{if(!J){a("No agent selected",e.yellow);return}if(!C)return;a(`Disabling ${J.name}...`,e.amber),C(J.id).then(()=>{a(`\u2713 Disabled ${J.name}`,e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}case "enable":{if(!J){a("No agent selected",e.yellow);return}if(!M)return;a(`Enabling ${J.name}...`,e.amber),M(J.id).then(()=>{a(`\u2713 Enabled ${J.name}`,e.green),Z();},p=>a(`Failed: ${u(p)}`,e.red));return}default:a(`Unknown: ${d}. Type /help for commands`,e.yellow);}},[U,J,Pe,We,$e,fr,$,b$1,T,x,y,l,f,C,M,P,L,O,N,ie,Le,zt,ct,Ae,Ke,a,Ht,Z,yn,Tn,ss,is]);useInput((i,h)=>{if(!(Lt&&(er(false),i==="?"||h.escape||i==="\x1BOP"))&&!yo){if((h.ctrl||h.meta)&&i==="s"&&Fe==="wizard"&&Tt?.kind==="agent"){rs();return}if(Fe!=="none"){if(h.escape){Oe("none"),_t(""),fn.reset();return}if(h.return){let s=io.trim();if(!s)return;if(Fe==="new_task"){if(!f)return;Oe("none"),_t(""),a(`Creating "${s}"...`,e.amber),f(s).then(d=>{a(`\u2713 Created "${d.title}" (${d.id})`,e.green),Z();},d=>a(`Failed to create: ${d instanceof Error?d.message:String(d)}`,e.red));}else if(Fe==="command"){let d=s;if(At.length>0&&At[hn]){let u=At[hn],p=u.cmd.replace(/\s+\[.*\]$/,"");if((p.startsWith(s)||s==="/")&&(d=p),u.subs&&!p.includes(" ")){_t(p+" "),Jt(0);return}}Oe("none"),_t(""),Jt(0),fn.push(d),Ia(d);}return}if(h.tab&&Fe==="command"){if(At.length>0){let s=At[hn];if(s){let d=s.cmd.replace(/\s+\[.*\]$/,"");_t(d+(s.subs?" ":"")),Jt(0);}}else {let s=Cr(io);s&&_t(d=>d+s);}return}if(h.upArrow&&Fe==="command"){if(At.length>0)Jt(s=>Math.max(0,s-1));else {let s=fn.prev();s!==null&&_t(s);}return}if(h.downArrow&&Fe==="command"){if(At.length>0)Jt(s=>Math.min(At.length-1,s+1));else {let s=fn.next();_t(s??"");}return}if(h.backspace||h.delete){_t(s=>s.slice(0,-1)),Jt(0);return}i&&!h.ctrl&&!h.meta&&(_t(s=>s+i),Jt(0));return}if(i.toLowerCase()==="q"){Ht();return}if(h.escape){if(Be){zo(false),qo(0);return}if(_==="logs"&&jo>=0){nr(-1),Uo(0);return}return}if((i==="+"||i==="=")&&_!=="logs"){pn?(dr(false),ko(-Math.floor(Rt/2))):ko(s=>Math.max(-Ao,s-3));return}if(i==="-"&&_!=="logs"){pn?(dr(false),ko(Math.floor(Rt/2))):ko(s=>Math.min(Ao,s+3));return}if(i==="M"&&_!=="logs"){dr(s=>!s);return}if(i==="?"){er(true);return}if(i==="\x1BOP"){er(true);return}if(i==="/"&&!Be){Oe("command"),_t("/"),Jt(0);return}if((i==="a"||i==="A")&&_==="logs"&&!Be&&!yo&&!Ho){tr(true);return}if(i==="f"&&_==="logs"&&!Be&&!yo&&!Ho){or(true);return}if(i==="F"&&_==="logs"&&!Be&&!yo&&!Ho){jr(s=>new Set(Dr(s).types));return}if((i==="z"||i==="Z")&&Co.length>0){ca();return}if((i==="f"||i==="F")&&(_==="tasks"||_==="agents"||_==="goals")&&!Be){rr(s=>{let d=Dr(s);return et?.(d.label),new Set(d.types)});return}if((i==="n"||i==="N")&&_==="tasks"&&!Be&&f){yn();return}if((i==="n"||i==="N")&&_==="agents"&&!Be&&P){Tn();return}if((i==="n"||i==="N")&&_==="goals"&&!Be&&De){let s=jn(le);Je({title:"New Goal",steps:s,kind:"goal"}),Oe("wizard");return}if((i==="e"||i==="E")&&_==="goals"&&te&&Ye){let s=Bi(te,le);Je({title:`Edit Goal: ${te.title}`,steps:s,kind:"edit_goal",targetId:te.id}),Oe("wizard");return}if((i==="d"||i==="D")&&_==="goals"&&te&&Ze){Ro("goal",te.id,te.title);return}if((i==="c"||i==="C")&&_==="goals"&&te&&ut){(te.status==="active"||te.status==="paused")&&(a(`Marking goal "${te.title}" as achieved...`,e.amber),ut(te.id,"achieved").then(()=>{a(`\u2713 Goal "${te.title}" achieved`,e.green),Z();},s=>a(`Failed: ${s instanceof Error?s.message:String(s)}`,e.red)));return}if((i==="x"||i==="X")&&_==="goals"&&te&&ut){(te.status==="active"||te.status==="paused")&&(a(`Abandoning goal "${te.title}"...`,e.amber),ut(te.id,"abandoned").then(()=>{a(`\u2713 Goal "${te.title}" abandoned`,e.dim),Z();},s=>a(`Failed: ${s instanceof Error?s.message:String(s)}`,e.red)));return}if((i==="p"||i==="P")&&_==="goals"&&te&&ut){let s=te.status==="paused"?"active":"paused";(te.status==="active"||te.status==="paused")&&ut(te.id,s).then(()=>{a(`Goal "${te.title}" ${s}`,e.cyan),Z();},d=>a(`Failed: ${d instanceof Error?d.message:String(d)}`,e.red));return}if((i==="a"||i==="A")&&_==="tasks"&&U?.status==="review"&&L){a(`Approving "${U.title}"...`,e.amber),L(U.id).then(()=>{a(`\u2713 Approved "${U.title}"`,e.green),Z();},s=>a(`Failed: ${s instanceof Error?s.message:String(s)}`,e.red));return}if((i==="x"||i==="X")&&_==="tasks"&&U?.status==="review"&&O){a(`Rejecting "${U.title}"...`,e.amber),O(U.id).then(()=>{a(`\u2713 Rejected "${U.title}" \u2192 todo`,e.green),Z();},s=>a(`Failed: ${s instanceof Error?s.message:String(s)}`,e.red));return}if((i==="c"||i==="C")&&_==="tasks"&&U&&b$1){if(U.status==="done"||U.status==="failed"||U.status==="cancelled"){a(`Cannot cancel \u2014 status is ${U.status}`,e.yellow);return}a(`Cancelling "${U.title}"...`,e.amber),b$1(U.id).then(()=>{a(`\u2713 Cancelled "${U.title}"`,e.green),Z();},s=>a(`Failed: ${s instanceof Error?s.message:String(s)}`,e.red));return}if((i==="e"||i==="E")&&_==="tasks"&&U&&E){ua(U);return}if((i==="e"||i==="E")&&_==="agents"&&J&&G){ga(J);return}if((i==="s"||i==="S")&&_==="tasks"){Qr(s=>!s),Go(0),So(0);return}if((i==="g"||i==="G")&&_==="tasks"&&!Be){ta(s=>!s),Go(0),So(0);return}if((i==="s"||i==="S")&&_==="agents"&&J&&z){if(!Object.values(S.running).some(d=>d.agent_id===J.id)&&J.status!=="running"){a(`Agent "${J.name}" is not running`,e.yellow);return}a(`Force-stopping agent "${J.name}"...`,e.amber),z(J.id).then(()=>{a(`\u2713 Stopped agent "${J.name}"`,e.green),Z();},d=>a(`Failed: ${d instanceof Error?d.message:String(d)}`,e.red));return}if((i==="d"||i==="D")&&_==="tasks"&&U&&U.status!=="in_progress"&&N){Ro("task",U.id,U.title);return}if((i==="d"||i==="D")&&_==="agents"&&J&&j){let s=Object.values(S.running).some(d=>d.agent_id===J.id);if(s&&!z){a(`Cannot delete \u2014 agent "${J.name}" is running. Press S to stop first.`,e.yellow);return}Ro("agent",J.id,J.name,{needsForceStop:s});return}if((i==="u"||i==="U")&&_==="agents"&&J&&dt){let s=!J.autonomous;a(`${s?"Enabling":"Disabling"} autonomous mode for "${J.name}"...`,e.amber),dt(J.id,s).then(()=>{a(`${mo} ${J.name} autonomous ${s?"ON":"OFF"}`,e.cyan),Z();},d=>a(`Failed: ${d instanceof Error?d.message:String(d)}`,e.red));return}if(!Be){if(i==="g"||i==="G"){Zt("goals");return}if(i==="t"||i==="T"){Zt("tasks");return}if(i==="a"||i==="A"){Zt("agents");return}if(i==="l"||i==="L"){Zt("logs");return}}if(!Be){let s=_n.map(u=>u.id),d=s.indexOf(_);if(h.tab||h.rightArrow){Zt(s[(d+1)%s.length]);return}if(h.leftArrow){Zt(s[(d+s.length-1)%s.length]);return}}if(h.return){let s=vo>0?Ot.length:-1;if(_==="tasks"&&cn===s){Qr(u=>!u),Go(0),So(0);return}let d=Ot.length+(vo>0?1:0);if(_==="tasks"&&cn===d&&f){yn();return}if(_==="goals"&&Qn===mt.length&&De){let u=jn(le);Je({title:"New Goal",steps:u,kind:"goal"}),Oe("wizard");return}if(_==="agents"&&Jn===We.length&&P){Tn();return}if(_==="goals"&&te){zo(u=>!u),qo(0);return}if(_==="tasks"&&U){zo(u=>!u);return}if(_==="agents"&&J){zo(u=>!u);return}if(_==="logs"&&jo>=0){zo(u=>!u);return}}if((i==="r"||i==="R")&&_==="tasks"&&U&&l){if(!Nr.has(U.status)){a(`Cannot run "${U.title}" \u2014 status is ${U.status}`,e.yellow);return}a(`Running "${U.title}"...`,e.green),l(U.id).then(()=>{a(`Dispatched "${U.title}"`,e.green),Z();},s=>a(`Failed to run: ${s instanceof Error?s.message:String(s)}`,e.red));return}if(h.upArrow||i==="k"){if(_==="goals"&&Be){qo(s=>Math.max(0,s-1));return}_==="goals"?Gr(s=>{let d=Math.max(0,s-1);return lr(u=>d<u?d:u),d}):_==="tasks"?Go(s=>{let d=Math.max(0,s-1);return So(u=>d<u?d:u),d}):_==="agents"?Wr(s=>{let d=Math.max(0,s-1);return ar(u=>d<u?d:u),d}):_==="logs"&&nr(s=>{if(s===-1){let u=ze.length-1;return Uo(Math.max(0,u-Se+2)),Math.max(0,u)}let d=Math.max(0,s-1);return Uo(u=>d<u?d:u),d});}if(h.downArrow||i==="j"){if(_==="goals"&&Be){qo(s=>s+1);return}if(_==="goals"){let s=mt.length+(De?1:0)-1;Gr(d=>{let u=Math.min(Math.max(0,s),d+1);return lr(p=>u>=p+Se?u-Se+1:p),u});}else if(_==="tasks"){let s=Ot.length+(f?1:0)+(vo>0?1:0)-1;Go(d=>{let u=Math.min(Math.max(0,s),d+1);return So(p=>u>=p+Se?u-Se+1:p),u});}else if(_==="agents"){let s=We.length+(P?1:0)-1;Wr(d=>{let u=Math.min(Math.max(0,s),d+1);return ar(p=>u>=p+Se?u-Se+1:p),u});}else _==="logs"&&nr(s=>{if(s===-1)return -1;let d=ze.length-1;if(s>=d)return Uo(0),-1;let u=s+1;return Uo(p=>u>=p+Se-1?u-Se+2:p),u});}}});let ot=Fe!=="none",cs=jo>=0?ze[jo]:void 0,wn=pn?"+/- exit max":"+/- resize \u2502 M max",ds=!ot&&Be&&_==="tasks"&&U,us=!ot&&Be&&_==="agents"&&J,gs=!ot&&Be&&_==="goals"&&te,Ma=!ot&&Be&&_==="logs"&&cs,pr=U?.id,va=useMemo(()=>pr?ze.filter(i=>i.taskId===pr):[],[ze,pr]),_a=!ot&&_==="tasks"&&U&&Nr.has(U.status)&&!!l,Ra=!ot&&!Be&&(_==="goals"&&!!De||_==="tasks"&&!!f||_==="agents"&&!!P),Aa=!ot&&_==="tasks"&&U?.status==="review"&&!!L,$a=!ot&&_==="tasks"&&U?.status==="review"&&!!O,Ba=J?Object.values(S.running).some(i=>i.agent_id===J.id):false,Ea=!ot&&(_==="goals"&&te&&!!Ze||_==="tasks"&&U&&U.status!=="in_progress"&&!!N||_==="agents"&&J&&!!j),La=!ot&&!Be&&(_==="goals"&&!!te&&!!Ye||_==="tasks"&&!!U&&!!E||_==="agents"&&!!J&&!!G),Oa=!ot&&_==="agents"&&J&&(Ba||J.status==="running")&&!!z,Pa=!ot&&_==="agents"&&!!J&&!!dt,Na=!ot&&_==="goals"&&!!te&&(te.status==="active"||te.status==="paused")&&!!ut,Da=!ot&&Co.length>0,ms=Fe==="command"&&At.length>0,fs=Tt?.kind==="task"||Tt?.kind==="edit_task";return jsxs(Box,{flexDirection:"column",width:Mt,height:To,children:[jsx(Fs,{projectName:t,activeView:_,mode:fr,stats:ls,tokens:xa,uptime:ha,width:Mt,version:Yt,latestVersion:Vt,taskBadge:vo>0?Pe.length:void 0,flashTab:ir?.tab,flashColor:ir?.color,onFlashComplete:ir?()=>qr(void 0):void 0}),jsx(Box,{height:1}),Lt&&jsx(ci,{width:Mt,height:To-7}),!Lt&&he==="welcome"&&_==="tasks"&&jsx(Qs,{width:Mt,height:To}),!Lt&&_==="goals"&&jsx(hc,{goals:mt,selectedIndex:Qn,scrollOffset:na,height:Se,width:_e,showAddRow:!!De,agentNameMap:lo,tasksByGoalMap:sa}),!Lt&&he!=="welcome"&&_==="tasks"&&jsx(bc,{tasks:Ot,selectedIndex:cn,scrollOffset:ea,height:Se,width:_e,showAddRow:!!f,agentNameMap:lo,hiddenCount:vo,goalMap:Mo,groupByGoal:Xo}),!Lt&&_==="tasks"&&(he==="task_created"||he==="run_started")&&jsx(ei,{step:he,width:Mt}),!Lt&&_==="tasks"&&he==="completed"&&jsx(ti,{width:Mt}),!Lt&&_==="agents"&&jsx(Tc,{agents:We,selectedIndex:Jn,scrollOffset:oa,height:Se,width:_e,state:S,taskTitleMap:Ko,showAddRow:!!P,agentTeamMap:_o,teamLeadSet:aa,activeTeamCount:Yo}),!Lt&&_==="logs"&&jsxs(Fragment,{children:[jsx(wc,{messages:ze,height:yo||Ho?Math.max(3,Se-16):Se,agents:We,logAgentFilter:Vr,logTypeFilter:Hr,selectedIndex:jo,scrollOffset:qi,agentNameMap:lo,agentColorMap:xn,agentMsgCounts:ts,taskTitleMap:Ko,width:_e}),yo&&jsx(Box,{paddingX:2,children:jsx(qs,{agents:We,selected:Vr,msgCounts:ts,colorMap:xn,maxHeight:Math.min(Se-4,18),onConfirm:i=>{Xi(i),tr(false);},onCancel:()=>tr(false)})}),Ho&&jsx(Box,{paddingX:2,children:jsx(Js,{selected:Hr,typeCounts:ia,onConfirm:i=>{jr(i),or(false);},onCancel:()=>or(false)})})]}),jsx(Box,{height:1}),Lt?null:Fe==="wizard"&&Tt?jsx(js,{title:Tt.title,steps:Tt.steps,onComplete:ma,onCancel:fa,width:_e,height:Pt,onPasteImage:fs?da:void 0,onSuggestionSelected:Tt.kind==="agent"?pa:void 0,footerExtra:ao.length>0&&fs?`\u{1F4CE}${ao.length}`:void 0},`${Tt.kind}-${Tt.title}`):ms?jsxs(Fragment,{children:[jsx(Un,{label:"COMMANDS",width:_e}),jsx(pc,{suggestions:At,selectedIndex:hn,height:Math.min(At.length,Pt),width:_e})]}):Fe==="new_task"?jsxs(Fragment,{children:[jsx(Rc,{mode:Fe,width:_e}),jsx(Ac,{mode:Fe,value:io,width:_e})]}):ds?jsxs(Fragment,{children:[jsx(Cc,{task:U,width:_e,resizeHint:wn}),jsx(Os,{task:U,height:Pt,width:_e,taskLogs:va,agentNameMap:lo,taskTitleMap:Ko})]}):gs?jsxs(Fragment,{children:[jsx(Un,{label:`GOAL: ${te.title}`,width:_e,suffixLen:wn.length+2,suffix:jsxs(Text,{color:e.dim,children:[" ",wn," "]})}),jsx(xc,{goal:te,height:Pt,width:_e,agentNameMap:lo,tasks:la,progressReport:ce,scrollOffset:ra,onClampScroll:qo})]}):us?jsxs(Fragment,{children:[jsx(Ic,{agent:J,width:_e,resizeHint:wn}),jsx(Mc,{agent:J,height:Pt,state:S,taskTitleMap:Ko,teamName:_o.get(J.id)})]}):Ma?jsxs(Fragment,{children:[jsx(Un,{label:"LOG",width:_e}),jsx(kc,{message:cs,height:Pt,width:_e,agents:We,agentNameMap:lo,agentColorMap:xn,taskTitleMap:Ko})]}):ze.length>0&&_!=="logs"?jsxs(Fragment,{children:[(()=>{let i=` F:${dn.toUpperCase()} \u2502 ${sr.length}/${ze.length}`;return jsx(Un,{label:"ACTIVITY",width:_e,suffixLen:i.length,suffix:jsxs(Fragment,{children:[jsx(Text,{color:e.dim,children:" F:"}),jsx(Text,{color:e.amber,children:dn.toUpperCase()}),jsxs(Text,{color:e.ghost,children:[" ","\u2502"," ",sr.length,"/",ze.length]})]})})})(),jsx(Sc,{messages:sr,height:Math.max(1,Pt-1),width:_e,agents:We,agentNameMap:lo,agentColorMap:xn})]}):_==="goals"?jsx(Wn,{count:mt.length,config:dc,width:_e}):_==="tasks"?jsx(Wn,{count:Pe.length,config:uc,width:_e}):_==="agents"?jsx(Wn,{count:We.length,config:gc,width:_e}):null,jsx(Box,{flexGrow:1}),jsx(li,{toasts:Zi,onDismiss:Qi}),Co.length>0&&jsx(fc,{deletions:Co,width:Mt}),jsx(Gs,{mode:Fe==="command"?"command":"navigate",value:Fe==="command"?io:"",completion:Fe==="command"?Cr(io):null,activeView:_,canRun:!!_a,canNew:!!Ra,canApprove:!!Aa,canReject:!!$a,canCancel:_==="tasks"&&!!U&&U.status==="in_progress"&&!!b$1,canDelete:!!Ea,canUndo:!!Da,canEdit:!!La,canForceStop:!!Oa,canToggleAuto:!!Pa,autoActive:J?.autonomous,canPause:!!Na,isPaused:te?.status==="paused",canToggleShowAll:_==="tasks"&&Pe.length>Li,showAllActive:Jr,hasDetail:!!(ds||us||gs),itemCount:_==="goals"?mt.length:_==="tasks"?Pe.length:_==="agents"?le.length:ze.length,itemLabel:_==="goals"?"goals":_==="tasks"?"tasks":_==="agents"?"agents":"events",width:Mt,hasSuggestions:ms,onboardingCompleted:r.onboardingCompleted})]})}var fc=nn.memo(function({deletions:o,width:n}){let[,r]=useState(0);useEffect(()=>{let f=setInterval(()=>r(b=>b+1),1e3);return ()=>clearInterval(f)},[]);let l=Date.now();return jsx(Box,{flexDirection:"column",width:n,children:o.map(f=>{let b=Math.max(0,Math.ceil((f.expiresAt-l)/1e3)),T=Math.max(0,n-4),x=f.entityType==="task"?"Task":f.entityType==="agent"?"Agent":"Goal",y=Math.max(10,T-x.length-30),C=f.entityName.length>y?f.entityName.slice(0,y-1)+"\u2026":f.entityName;return jsx(Box,{paddingX:2,children:jsxs(Text,{color:e.yellow,children:["\u2717 ",jsx(Text,{bold:true,children:x}),` "${C}" \u2014 `,jsxs(Text,{color:e.amber,bold:true,children:[b,"s"]}),jsx(Text,{color:e.dim,children:" \u2502 "}),jsx(Text,{color:e.gray,bold:true,children:"Z"}),jsx(Text,{color:e.dim,children:" undo"})]})},f.key)})})});function pc({suggestions:t,selectedIndex:o,height:n,width:r}){let l=n,f=0;o>=l&&(f=o-l+1);let b=t.slice(f,f+l);return jsx(Box,{flexDirection:"column",paddingX:2,children:b.map((T,x)=>{let y=x+f,C=y===o,M=C?"\u25B6":" ",B=Math.min(20,Math.max(14,...t.map(P=>P.cmd.length+1))),k=T.cmd.padEnd(B),H=T.subs?` ${T.subs}`:"",V=Math.max(4,r-B-H.length-8),F=T.desc.length>V?T.desc.slice(0,V-1)+"\u2026":T.desc;return jsxs(Text,{wrap:"truncate",children:[jsx(Text,{color:C?e.amber:e.ghost,children:` ${M} `}),jsx(Text,{color:C?e.white:e.silver,bold:C,children:k}),jsx(Text,{color:e.dim,children:F}),H&&jsx(Text,{color:e.ghost,children:H})]},y)})})}function hc({goals:t,selectedIndex:o,scrollOffset:n=0,height:r,width:l,showAddRow:f,agentNameMap:b,tasksByGoalMap:T}){let x=t.length,y=t.slice(n,n+r),C=f&&x>=n&&x<n+r;return jsxs(Box,{flexDirection:"column",height:r,children:[y.map((M,B)=>jsx(Box,{paddingX:2,children:jsx(Ls,{goal:M,selected:B+n===o,width:l-2,agentNameMap:b,tasksByGoal:T?.get(M.id)})},M.id)),C&&jsx(Box,{paddingX:2,children:jsxs(Text,{color:o===x?e.amber:e.ghost,children:[o===x?" \u25B8 ":" ",jsx(Text,{color:o===x?e.amber:e.dim,children:"+ add goal..."})]})},"__add__")]})}function xc({goal:t,height:o,width:n,agentNameMap:r,tasks:l,progressReport:f,scrollOffset:b=0,onClampScroll:T}){let y=nn.useMemo(()=>{let V=l??[],F=t.assignee?r?.get(t.assignee)??t.assignee:"\u2014",P=Math.max(20,n-6),j=(z,X)=>{if(z.length<=X)return [z];let R=[];for(let ie=0;ie<z.length;ie+=X)R.push(z.slice(ie,ie+X));return R},L=yr(f)?.split(`
|
|
13
|
+
`).flatMap(z=>j(z,P))??[],O=yr(t.description)?.split(`
|
|
14
|
+
`).flatMap(z=>j(z,P))??[],N=Ts[t.status]??e.dim,E=new Map;for(let z of V)E.set(z.status,(E.get(z.status)??0)+1);let G=[];if(G.push({key:"row-status",node:jsxs(Box,{children:[jsxs(Box,{width:24,children:[jsx(Text,{color:e.dim,children:" status "}),jsx(Text,{color:N,bold:true,children:t.status})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" assignee "}),jsx(Text,{color:t.assignee?e.green:e.dim,children:F})]})]})}),G.push({key:"row-id",node:jsxs(Box,{children:[jsxs(Box,{width:24,children:[jsx(Text,{color:e.dim,children:" id "}),jsx(Text,{color:e.dim,children:t.id})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" created "}),jsx(Text,{children:t.created_at.slice(0,10)})]})]})}),t.updated_at&&t.updated_at!==t.created_at&&G.push({key:"row-updated",node:jsxs(Box,{children:[jsx(Box,{width:24,children:jsxs(Text,{color:e.dim,children:[" "," "]})}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" Updated "}),jsx(Text,{children:t.updated_at.slice(0,10)})]})]})}),V.length>0){let z=[];for(let[X,R]of E)z.push(`${R} ${X}`);G.push({key:"row-tasks-summary",node:jsxs(Box,{children:[jsxs(Box,{width:24,children:[jsx(Text,{color:e.dim,children:" tasks "}),jsx(Text,{color:e.cyan,children:V.length})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" "}),jsx(Text,{color:e.dim,children:z.join(" \xB7 ")})]})]})});}if(O.length>0){G.push({key:"desc-gap",node:jsx(Text,{children:" "})});for(let z=0;z<O.length;z++)G.push({key:`desc-${z}`,node:jsxs(Text,{color:e.silver,wrap:"truncate",children:[" ",O[z]]})});}else G.push({key:"desc-gap",node:jsx(Text,{children:" "})}),G.push({key:"desc-empty",node:jsx(Text,{color:e.dim,children:" No description."})});if(L.length>0){G.push({key:"prog-gap",node:jsx(Text,{children:" "})}),G.push({key:"prog-div",node:jsx(Po,{label:"progress",width:n})});for(let z=0;z<L.length;z++)G.push({key:`prog-${z}`,node:jsxs(Text,{color:e.white,wrap:"truncate",children:[" ",L[z]]})});}if(V.length>0){G.push({key:"tasks-gap",node:jsx(Text,{children:" "})}),G.push({key:"tasks-div",node:jsx(Po,{label:`tasks (${V.length})`,width:n})});for(let z of V){let X=In[z.status]??e.dim;G.push({key:`task-${z.id}`,node:jsxs(Text,{color:e.silver,wrap:"truncate",children:[" ",jsx(Text,{color:X,children:z.status.padEnd(12)}),z.title.slice(0,Math.max(10,n-22))]})});}}return G},[t,l,f,n,r]),C=Math.max(0,y.length-o),M=Math.min(b,C);nn.useEffect(()=>{T&&M!==b&&T(M);},[M,b,T]);let B=y.length>o&&M<C,k=B?o-1:o,H=y.slice(M,M+k);return jsxs(Box,{flexDirection:"column",height:o,paddingX:2,children:[H.map(V=>jsx(Box,{children:V.node},V.key)),B&&jsxs(Text,{color:e.ghost,children:[" ","\u2193"," ",y.length-M-k," more ","\u2014"," ","\u2191","\u2193"," to scroll"]})]})}function bc({tasks:t,selectedIndex:o,scrollOffset:n=0,height:r,width:l,showAddRow:f,agentNameMap:b,hiddenCount:T=0,goalMap:x,groupByGoal:y=false}){let C=T>0,M=C?t.length:-1,B=t.length+(C?1:0),k=t.slice(n,n+r),H=C&&M>=n&&M<n+r,V=f&&B>=n&&B<n+r,F=useMemo(()=>{if(!y||!x||x.size===0)return null;let N=new Map;for(let E of t)if(E.goalId&&x.has(E.goalId)){let G=N.get(E.goalId)??{total:0,done:0};G.total++,E.status==="done"&&G.done++,N.set(E.goalId,G);}return N},[t,y,x]),P=y&&x?t.filter(N=>!N.goalId||!x.has(N.goalId)).length:0,j=y&&x&&x.size>0&&F&&F.size>0,L=[],O=n>0?t[n-1]?.goalId??null:void 0;for(let N=0;N<k.length&&L.length<r;N++){let E=k[N],G=E.goalId&&x?.has(E.goalId)?E.goalId:null;if(j){if(G&&G!==O){let z=x.get(G),X=F.get(G)??{total:0,done:0};if(L.push(jsx(Is,{goalTitle:z.title,taskCount:X.total,doneCount:X.done,width:l},`gh_${G}`)),L.length>=r)break}if(!G&&O!==null&&O!==void 0&&(L.push(jsx(Ms,{taskCount:P,width:l},"__ungrouped__")),L.length>=r))break}O=G,L.push(jsx(Box,{paddingX:2,children:jsx(vn,{task:E,selected:N+n===o,width:l-2,agentNameMap:b,goalMap:x})},E.id));}return H&&L.length<r&&L.push(jsx(Box,{paddingX:2,children:jsxs(Text,{color:o===M?e.amber:e.ghost,children:[o===M?" \u25B8 ":" ",jsxs(Text,{color:o===M?e.amber:e.dim,children:["\u25BC"," Show all (",T," more) \u2014 press ",jsx(Text,{bold:true,color:e.gray,children:"S"})]})]})},"__show_all__")),V&&L.length<r&&L.push(jsx(Box,{paddingX:2,children:jsxs(Text,{color:o===B?e.amber:e.ghost,children:[o===B?" \u25B8 ":" ",jsx(Text,{color:o===B?e.amber:e.dim,children:"+ add task..."})]})},"__add__")),jsx(Box,{flexDirection:"column",height:r,children:L})}function Tc({agents:t,selectedIndex:o,scrollOffset:n=0,height:r,width:l,state:f,taskTitleMap:b,showAddRow:T,agentTeamMap:x,teamLeadSet:y,activeTeamCount:C}){let M=new Map;for(let E of Object.values(f.running))M.set(E.agent_id,E);let B=new Map;if(C&&C>0)for(let E of t){let G=x?.get(E.id);G&&B.set(G,(B.get(G)??0)+1);}let k=t.length,H=t.slice(n,n+r),V=T&&k>=n&&k<n+r,F=C!=null&&C>0,P=new Map;if(F&&y&&x){for(let E of t)if(y.has(E.id)){let G=x.get(E.id);G&&P.set(G,E.name);}}let j=0;for(let E of B.values())j+=E;let L=t.length-j,O=[],N=n>0?x?.get(t[n-1]?.id??""):void 0;for(let E=0;E<H.length&&O.length<r;E++){let G=H[E],z=x?.get(G.id);if(F&&z&&z!==N&&(O.push(jsx(As,{teamName:z,memberCount:B.get(z)??0,leadName:P.get(z),width:l},`ts-${z}`)),O.length>=r)||F&&!z&&N&&(O.push(jsx($s,{memberCount:L,width:l},"ts-unassigned")),O.length>=r))break;N=z,O.push(jsx(Box,{paddingX:2,children:jsx(Rs,{agent:G,selected:E+n===o,width:l-2,runningEntry:M.get(G.id),currentTaskTitle:G.current_task?b.get(G.current_task):void 0,teamName:z,isLead:y?.has(G.id)})},G.id));}return V&&O.length<r&&O.push(jsx(Box,{paddingX:2,children:jsxs(Text,{color:o===k?e.amber:e.ghost,children:[o===k?" \u25B8 ":" ",jsx(Text,{color:o===k?e.amber:e.dim,children:"+ add agent..."})]})},"__add__")),jsx(Box,{flexDirection:"column",height:r,children:O})}function zi(t=5e3){let[o,n]=useState(Date.now());return useEffect(()=>{let r=setInterval(()=>n(Date.now()),t);return ()=>clearInterval(r)},[t]),o}function Vi(t,o){let n=Math.max(0,o-t);return n<3e3?"now":n<6e4?`${Math.floor(n/1e3)}s`:n<36e5?`${Math.floor(n/6e4)}m`:`${Math.floor(n/36e5)}h`}function yc(t){if(t==="error")return e.errorBg}function Hi(t,o){switch(t){case "output":return e.white;case "tool":return e.dim;case "result":return e.dim;case "file":return e.gray;case "error":return e.red;case "lifecycle":return e.dim;case "system":return e.dim;default:return o}}function wc({messages:t,height:o,agents:n,logAgentFilter:r,logTypeFilter:l,selectedIndex:f,scrollOffset:b,agentNameMap:T,agentColorMap:x,agentMsgCounts:y,taskTitleMap:C,width:M}){let B=zi(),k=useMemo(()=>t.filter(X=>{if(r.size>0&&X.agentId&&!r.has(X.agentId))return false;let R=X.msgType??"info";return l.has(R)}),[t,r,l]);useMemo(()=>{let X={};for(let R of t){let ie=R.msgType??"info";X[ie]=(X[ie]??0)+1;}return X},[t]);let V=l.size>=8?"all":l.size===1&&l.has("output")?"text":l.size===1&&l.has("error")?"errors":l.has("tool")&&!l.has("output")?"tools":l.has("lifecycle")&&!l.has("output")?"events":`${l.size} types`,F=r.size>0,P=o-2,j=f===-1?k.slice(-P):k.slice(b,b+P),L=f===-1?-1:f-b,O=Math.min(10,Math.max(6,...n.map(X=>X.name.length))),N=11+O,E=X=>{if(X===0)return true;let R=j[X],ie=j[X-1];return R.agentId!==ie.agentId?true:R.agentId?R.ts-ie.ts>3e4:false},G=Math.max(4,Math.floor((M-20)/Math.max(1,n.length))-1),z=Math.min(G,10);return jsxs(Box,{flexDirection:"column",paddingX:1,children:[jsxs(Box,{gap:0,justifyContent:"space-between",width:M,children:[jsxs(Box,{gap:0,children:[f===-1?jsxs(Box,{gap:0,children:[jsx(Text,{backgroundColor:e.successBg,color:e.green,children:" "}),jsx(Text,{backgroundColor:e.successBg,color:e.green,children:jsx(Bo,{color:e.green})}),jsx(Text,{backgroundColor:e.successBg,color:e.green,children:" LIVE "})]}):jsxs(Text,{backgroundColor:e.warnBg,color:e.amber,children:[" \u2191\u2193 ",f+1,"/",k.length," "]}),jsxs(Text,{color:e.dim,children:[" ",k.length," events"]}),V!=="all"&&jsxs(Text,{color:e.amber,children:[" f:",V]}),F&&jsxs(Text,{color:e.cyan,children:[" ",r.size,"/",n.length," agents"]})]}),jsxs(Box,{gap:0,children:[jsx(Text,{color:e.amber,bold:true,children:"a"}),jsx(Text,{color:e.dim,children:" filter "}),jsx(Text,{color:e.amber,bold:true,children:"f"}),jsx(Text,{color:e.dim,children:" type "}),jsx(Text,{color:e.amber,bold:true,children:"F"}),jsx(Text,{color:e.dim,children:" cycle"})]})]}),jsx(Box,{gap:0,children:n.map(X=>{let R=x.get(X.id)??Fr[0],ie=r.size===0||r.has(X.id),Le=X.name.length>z?X.name.slice(0,z-1)+"\u2026":X.name;return jsxs(Text,{color:ie?R:e.ghost,bold:ie,children:[" ",Le]},X.id)})}),j.length===0?jsxs(Box,{flexDirection:"column",paddingX:2,paddingTop:1,children:[jsx(Text,{color:e.dim,children:t.length===0?" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E":"No events for current filter."}),t.length===0&&jsxs(Fragment,{children:[jsx(Text,{color:e.dim,children:" \u2502 \u2502"}),jsxs(Text,{color:e.dim,children:[" \u2502 ",jsx(Text,{color:e.ghost,children:"\u25C7"}),jsx(Text,{color:e.gray,children:" Waiting for activity "}),"\u2502"]}),jsxs(Text,{color:e.dim,children:[" \u2502 ",jsx(Text,{color:e.ghost,children:"\u2502"}),jsx(Text,{color:e.dim,children:" Run tasks or start "}),"\u2502"]}),jsxs(Text,{color:e.dim,children:[" \u2502 ",jsx(Text,{color:e.ghost,children:"\u2502"}),jsx(Text,{color:e.dim,children:" the orchestrator "}),"\u2502"]}),jsxs(Text,{color:e.dim,children:[" \u2502 ",jsx(Text,{color:e.ghost,children:"\u25C7"}),jsx(Text,{color:e.dim,children:" "}),"\u2502"]}),jsx(Text,{color:e.dim,children:" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"})]})]}):j.map((X,R)=>{let ie=R===L,Le=X.msgType??"info",zt=Zn[Le]??"\u2502",ct=X.agentId?T.get(X.agentId)??X.agentId.slice(0,8):void 0,Ae=X.agentId?x.get(X.agentId):void 0,Ke=E(R),pt=(R>0?j[R-1]:void 0)?.agentId===X.agentId&&!!X.agentId,De=!pt&&!!ct,Ye=pt&&!!ct,ut=Hi(Le,X.color),Ze=ie?e.infoBg:Le==="error"?e.errorBg:void 0,ro=X.taskId?C.get(X.taskId):void 0,Ce=Vi(X.ts,B),ht=ro&&M>80?`#${ro.slice(0,20)}`:"",Et=ht?ht.length+3:0,Kt=Math.max(10,M-2-N-Et),xt=nt(X.text,Kt);return jsxs(Box,{backgroundColor:Ze,children:[jsx(Text,{color:Ae??e.ghost,children:Ke&&De?"\u250C":Ye?"\u2502":" "}),jsx(Text,{color:ie?e.amber:void 0,children:ie?"\u25B8":" "}),jsx(Box,{width:5,children:jsx(Text,{color:Ce==="now"?e.green:ie?e.silver:e.ghost,children:Ce.padStart(4)})}),jsx(Box,{width:O+1,children:De?jsxs(Text,{color:Ae,bold:true,children:[" ",ct.slice(0,O).padEnd(O)]}):Ye?jsxs(Text,{color:Ae??e.ghost,children:[" ","\xB7".padEnd(O)]}):jsxs(Text,{color:e.ghost,children:[" "," ".padEnd(O)]})}),jsxs(Text,{color:Le==="error"?e.red:Ae??e.dim,children:[" ",zt," "]}),jsx(Text,{color:ie?e.white:ut,bold:ie||Le==="lifecycle",children:xt}),ht&&jsxs(Text,{color:e.ghost,children:[" ",jsx(Text,{color:e.dim,backgroundColor:e.void,children:` ${ht} `})]})]},R)})]})}function Sc({messages:t,height:o,width:n,agents:r,agentNameMap:l,agentColorMap:f}){let b=zi(),T=t.slice(-o),x=Math.max(10,n-2-17),y=Math.max(0,o-T.length),C=0,M=[];for(let B=0;B<T.length;B++)B>0&&T[B].agentId!==T[B-1].agentId&&C++,M.push(C);return jsxs(Box,{flexDirection:"column",paddingX:1,children:[y>0&&jsx(Box,{height:y}),T.map((B,k)=>{let H=B.agentId?l.get(B.agentId)??B.agentId.slice(0,8):void 0,V=B.agentId?f.get(B.agentId):void 0,F=B.msgType??"info",P=Zn[F]??"\u2502",j=Hi(F,B.color),O=(k>0?T[k-1]:void 0)?.agentId===B.agentId&&!!B.agentId,N=(M[k]&1)===1,E=yc(F)??(N?"#1a1a1a":void 0),G=Vi(B.ts,b),z=nt(B.text,x);return jsxs(Box,{backgroundColor:E,children:[jsx(Text,{color:V??e.ghost,children:!O&&H?"\u258D":O?"\u258F":" "}),jsx(Box,{width:5,children:jsx(Text,{color:O?e.ghost:G==="now"?e.green:e.dim,children:O?" ":G.padStart(4)})}),jsx(Box,{width:9,children:H&&!O?jsxs(Text,{color:V,bold:true,children:[" ",H.slice(0,8)]}):jsx(Text,{color:e.ghost,children:mc})}),jsxs(Text,{color:F==="error"?e.red:O?e.ghost:V??e.dim,children:[P," "]}),jsx(Text,{color:j,children:z})]},k)})]})}function kc({message:t,height:o,width:n,agents:r,agentNameMap:l,agentColorMap:f,taskTitleMap:b}){let T=t.detail??t.text,x=t.msgType??"info",y=t.agentId?l.get(t.agentId)??t.agentId.slice(0,8):void 0,C=t.agentId?f.get(t.agentId):e.dim,M=t.taskId?b.get(t.taskId):void 0,B,k=false;try{let P=JSON.parse(T);B=JSON.stringify(P,null,2),k=!0;}catch{B=T;}let H=Math.max(4,n-6),V=Math.max(1,o-4),F=B.split(`
|
|
15
|
+
`).slice(0,V);return jsxs(Box,{flexDirection:"column",paddingX:1,children:[jsx(Box,{children:jsxs(Text,{color:e.ghost,children:["\u256D",ye(H+2),"\u256E"]})}),jsxs(Box,{children:[jsx(Text,{color:e.ghost,children:"\u2502 "}),jsx(Text,{color:e.dim,children:t.time}),jsx(Text,{color:e.ghost,children:" \u2502 "}),y&&jsx(Text,{color:C,bold:true,children:y}),y&&jsx(Text,{color:e.ghost,children:" \u2502 "}),jsxs(Text,{color:Zn[x]?x==="error"?e.red:e.dim:e.dim,children:[Zn[x]??"\u2502"," ",x]}),M&&jsxs(Fragment,{children:[jsx(Text,{color:e.ghost,children:" \u2502 "}),jsxs(Text,{color:e.dim,children:["#",M.slice(0,30)]})]})]}),jsxs(Box,{children:[jsx(Text,{color:e.ghost,children:"\u2502 "}),jsx(Text,{color:t.color,bold:true,wrap:"truncate",children:t.text.slice(0,H)})]}),jsx(Box,{children:jsxs(Text,{color:e.ghost,children:["\u251C",ye(H+2),"\u2524"]})}),F.map((P,j)=>jsxs(Box,{children:[jsx(Text,{color:e.ghost,children:"\u2502 "}),k&&jsxs(Text,{color:e.ghost,children:[String(j+1).padStart(3)," "]}),jsx(Text,{wrap:"truncate",color:k&&P.includes('"')?e.cyan:k&&/^\s*[}\]]/.test(P)?e.ghost:P.startsWith("error")||P.startsWith("Error")?e.red:e.silver,children:P.slice(0,k?H-4:H)})]},j)),jsx(Box,{children:jsxs(Text,{color:e.ghost,children:["\u2570",ye(H+2),"\u256F"]})})]})}function Un({label:t,width:o,suffix:n,suffixLen:r=0}){let l=` ${t} `,f=3,b=f+l.length+2;if(!n){let y=Math.max(0,o-b);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(f)}),jsx(Text,{backgroundColor:"#1a1a22",color:e.dim,bold:true,children:l}),jsx(Text,{color:e.ghost,children:He(y)})]})}let T=2,x=Math.max(0,o-b-T-r);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(f)}),jsx(Text,{backgroundColor:"#1a1a22",color:e.dim,bold:true,children:l}),jsx(Text,{color:e.ghost,children:He(T)}),n,jsx(Text,{color:e.ghost,children:He(x)})]})}function Cc({task:t,width:o,resizeHint:n}){let r=" DETAIL ",l=n?` ${n} `:"",f=o-r.length-l.length-10,b=t.title.length>f?t.title.slice(0,f-3)+"...":t.title,T=Math.max(0,o-3-r.length-b.length-l.length-4);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(3)}),jsx(Text,{backgroundColor:"#2d1f0a",color:e.amber,bold:true,children:r}),jsxs(Text,{color:e.ghost,children:[Cn," "]}),jsx(Text,{color:e.white,bold:true,children:b}),jsxs(Text,{color:e.ghost,children:[" ",He(Math.max(0,T))]}),l?jsx(Text,{color:e.dim,children:l}):null]})}function Ic({agent:t,width:o,resizeHint:n}){let r=" AGENT ",l=n?` ${n} `:"",f=o-r.length-l.length-10,b=t.name.length>f?t.name.slice(0,f-3)+"...":t.name,T=Math.max(0,o-3-r.length-b.length-l.length-4);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(3)}),jsx(Text,{backgroundColor:"#0f2d1f",color:e.green,bold:true,children:r}),jsxs(Text,{color:e.ghost,children:[Cn," "]}),jsx(Text,{color:e.green,bold:true,children:b}),jsxs(Text,{color:e.ghost,children:[" ",He(Math.max(0,T))]}),l?jsx(Text,{color:e.dim,children:l}):null]})}function Mc({agent:t,height:o,state:n,taskTitleMap:r,teamName:l}){let f=vc[t.status]??e.dim;Object.values(n.running).find(y=>y.agent_id===t.id);let T=t.current_task?r.get(t.current_task):void 0,x=24;return jsxs(Box,{flexDirection:"column",paddingX:2,children:[jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" status "}),jsx(Text,{color:f,children:t.status})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" adapter "}),jsx(Text,{color:e.cyan,children:t.adapter})]})]}),jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" model "}),jsx(Text,{children:t.config.model??"\u2014"})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" task "}),jsx(Text,{color:T?e.white:e.dim,children:T??"\u2014"})]})]}),jsxs(Box,{children:[jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" runs "}),jsx(Text,{children:t.stats.total_runs}),jsx(Text,{color:e.dim,children:" ("}),jsx(Text,{color:e.green,children:t.stats.tasks_completed}),jsx(Text,{color:e.dim,children:"/"}),jsx(Text,{color:t.stats.tasks_failed>0?e.red:e.dim,children:t.stats.tasks_failed}),jsx(Text,{color:e.dim,children:")"})]}),jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" team "}),jsx(Text,{color:l?e.amber:e.dim,children:l??"\u2014"})]})]}),t.autonomous&&jsx(Box,{children:jsxs(Box,{width:x,children:[jsx(Text,{color:e.dim,children:" auto "}),jsxs(Text,{color:e.cyan,children:[mo," ON"]})]})}),t.config.skills&&t.config.skills.length>0&&jsxs(Box,{children:[jsx(Text,{color:e.dim,children:" skills "}),jsx(Text,{color:e.cyan,wrap:"truncate",children:nt(t.config.skills.join(", "),500)})]}),t.last_error&&(()=>{let y=t.last_error.kind,C=m[y],M=!C||y==="unknown",B=t.last_error.timestamp,k=B?g(B)+" ago":"";return jsxs(Fragment,{children:[jsx(Text,{children:" "}),jsxs(Box,{flexDirection:"column",borderStyle:"single",borderColor:e.red,paddingX:1,children:[jsxs(Text,{color:e.red,bold:true,children:["\u26A0"," \u041E\u0448\u0438\u0431\u043A\u0430"]}),C&&jsx(Text,{color:e.white,children:C.message}),C&&jsx(Text,{color:e.cyan,children:C.fix}),C?.doctorHint&&jsx(Text,{color:e.yellow,children:"\u0414\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0430: orch doctor"}),M&&t.last_error.message&&jsx(Text,{color:e.dim,children:nt(t.last_error.message,120)}),k&&jsx(Text,{color:e.dim,children:k})]})]})})(),jsx(Text,{children:" "}),t.role?t.role.split(`
|
|
16
|
+
`).slice(0,Math.max(1,o-(t.last_error?10:4))).map((y,C)=>jsxs(Text,{color:e.silver,wrap:"truncate",children:[" ",nt(y,500)]},C)):jsx(Text,{color:e.dim,children:" No role description."})]})}var vc={idle:e.dim,running:e.green,error:e.red,disabled:e.ghost},_c="\u2588";function Rc({mode:t,width:o}){let r=` ${t==="command"?"COMMAND":"NEW TASK"} `,l=Math.max(0,o-3-r.length-2);return jsxs(Box,{paddingX:1,children:[jsx(Text,{color:e.ghost,children:He(3)}),jsx(Text,{backgroundColor:"#2d1f0a",color:e.amber,bold:true,children:r}),jsx(Text,{color:e.ghost,children:He(l)})]})}function Ac({mode:t,value:o,width:n}){let r=t==="command"?"/":"\u25B8",l=Math.max(10,n-8),f=o.length>l?o.slice(-l):o;return jsxs(Box,{paddingX:2,children:[jsxs(Text,{color:e.amber,children:[r," "]}),jsx(Text,{color:e.white,children:f}),jsx(Text,{color:e.amber,children:_c})]})}function ji(t,o){if(!o||typeof o!="object")return "";let n=o;if(n.file_path&&typeof n.file_path=="string")return n.file_path.split("/").slice(-2).join("/");if(n.command&&typeof n.command=="string")return n.command.slice(0,60);if(n.pattern&&typeof n.pattern=="string")return `"${n.pattern.slice(0,40)}"`;if(n.glob&&typeof n.glob=="string")return n.glob.slice(0,40);let r=JSON.stringify(n);return r.length>80?r.slice(0,77)+"...":r}function Xn(t,o=200){if(typeof t=="string")return t.slice(0,o);if(!Array.isArray(t))return null;let n=[],r=0;for(let l of t){if(r>=o)break;if(l?.type==="text"&&typeof l.text=="string"){let f=l.text.split(`
|
|
17
|
+
`).find(b=>b.trim().length>0)??"";n.push(f.slice(0,o-r)),r+=f.length;}else if(l?.type==="tool_use"){let f=ji(l.name??"tool",l.input),b=`\u2699 ${l.name??"tool"}(${f})`;n.push(b),r+=b.length;}else if(l?.type==="tool_result")n.push("\u2190 (result)"),r+=10;else if(l?.type==="thinking"&&typeof l.thinking=="string"){let f=l.thinking.slice(0,60).split(`
|
|
18
|
+
`)[0]??"";n.push(`\u{1F4AD} ${f}`),r+=f.length+3;}}return n.length>0?n.join(" "):null}function Di(t){if(typeof t=="string"){let n=t.split(`
|
|
19
|
+
`).length,r=t.split(`
|
|
20
|
+
`).find(l=>l.trim().length>0)??"";return n>3?`${r.slice(0,80)}... (${n} lines)`:r.slice(0,120)}if(!Array.isArray(t))return "(result)";let o=[];for(let n of t)if(n?.type==="tool_result"){n.tool_use_id?n.tool_use_id.slice(0,8):"";let l=n.is_error,f=typeof n.content=="string"?n.content:"",b=f.split(`
|
|
21
|
+
`).length;l?o.push(`\u2715 error: ${f.slice(0,60)}`):b>3?o.push(`\u2713 ${b} lines`):o.push(`\u2713 ${f.slice(0,80)}`);}else n?.type==="text"&&typeof n.text=="string"&&o.push(n.text.split(`
|
|
22
|
+
`)[0]?.slice(0,80)??"");return o.join(" ")||"(result)"}function Ui(t){let o=()=>t.length>Yn?t.slice(0,Yn)+"\u2026":t;if(Wi.test(t.trim()))return {summary:t.trim(),detail:o()};try{let n=JSON.parse(t);if(n.type==="message"&&n.role==="assistant"){let r=Xn(n.content);return r?{summary:r.slice(0,200),detail:o()}:{summary:null,detail:""}}if(n.type==="assistant"||n.role==="assistant"){let r=n.message?.content??n.content,l=Xn(r);return l?{summary:l.slice(0,200),detail:o()}:{summary:null,detail:""}}if(n.type==="user"||n.role==="user"){let r=n.message?.content??n.content;return {summary:`\u2190 ${Di(r).slice(0,180)}`,detail:o()}}if(n.type==="tool_use"||typeof n.name=="string"&&"input"in n){let r=n.name??"tool",l=ji(r,n.input);return {summary:`\u2699 ${r}(${l})`,detail:o()}}if(n.type==="tool_result")return {summary:`\u2190 ${Di(n.content).slice(0,180)}`,detail:o()};if(n.type==="result"){let r=typeof n.result=="string"?n.result:null;return {summary:r?`\u2713 ${r.slice(0,180)}`:"\u2713 Agent finished",detail:o()}}if(n.type==="rate_limit_event")return {summary:`\u23F3 Rate limited (${n.rate_limit_info?.rateLimitType??"unknown"})`,detail:o()};if(n.subtype){if(n.message){let r=n.message.content??n.message,l=Xn(r);if(l)return {summary:l.slice(0,200),detail:o()}}return {summary:`[${n.subtype}]`,detail:o()}}if(n.content){let r=Xn(n.content);if(r)return {summary:r.slice(0,200),detail:o()}}return n.type?{summary:`[${n.type}]`,detail:o()}:{summary:t.slice(0,150),detail:o()}}catch{return {summary:$c(t),detail:o()}}}function $c(t){let o=t.match(/"subtype"\s*:\s*"([^"]+)"/);if(o)return `[${o[1]}]`;let n=t.match(/"type"\s*:\s*"([^"]+)"/),r=t.match(/"role"\s*:\s*"([^"]+)"/),l=n?.[1],f=r?.[1];if(!l&&!f)return t.slice(0,200);if(l==="assistant"||l==="message"||f==="assistant"){let b=t.match(/"text"\s*:\s*"((?:[^"\\]|\\.)*)"/);if(b)try{return JSON.parse(`"${b[1]}"`).slice(0,200)}catch{}return "\u{1F4AC} (assistant)"}if(l==="user"||l==="tool_result"||f==="user")return "\u2190 (tool result)";if(l==="tool_use")return `\u2699 ${t.match(/"name"\s*:\s*"([^"]+)"/)?.[1]??"tool"}()`;if(l==="result"){let b=t.match(/"result"\s*:\s*"((?:[^"\\]|\\.)*)"/);if(b)try{return `\u2713 ${JSON.parse(`"${b[1]}"`).slice(0,180)}`}catch{}return "\u2713 Agent finished"}return l==="rate_limit_event"?"\u23F3 Rate limited":`[${l??f}]`}function Bc(t,o,n,r){let l=f=>r?.get(f);switch(t.type){case "agent:started":o("Started task",e.green,{agentId:t.agentId,taskId:t.taskId,msgType:"lifecycle"});break;case "agent:output":{let{summary:f,detail:b}=Ui(t.data);if(f){let T=Gi(f);o(f,T.color,{agentId:t.agentId,taskId:l(t.runId),detail:b,msgType:T.msgType});}break}case "agent:file_changed":o(`${t.path}`,e.purple,{agentId:t.agentId,taskId:l(t.runId),msgType:"file"});break;case "agent:completed":o(t.success?"Completed successfully":"Failed",t.success?e.green:e.red,{agentId:t.agentId,taskId:l(t.runId),msgType:"lifecycle"});break;case "agent:error":o(`${t.error.slice(0,150)}`,e.red,{agentId:t.agentId,taskId:l(t.runId),detail:t.error,msgType:"error"});break;case "task:status_changed":o(`${t.from} \u2192 ${t.to}`,e.cyan,{taskId:t.taskId,msgType:"system"});break;case "task:assigned":o(`Assigned \u2192 ${t.agentId}`,e.cyan,{taskId:t.taskId,msgType:"system"});break;case "task:created":o(`Created: ${t.task.title}`,e.amber,{taskId:t.task.id,msgType:"system"});break;case "run:retry":o(`Retry #${t.attempt} (${Math.round(t.delay_ms/1e3)}s delay)`,e.yellow,{agentId:n?.get(t.runId),taskId:l(t.runId),msgType:"lifecycle"});break;case "orchestrator:tick":(t.running>0||t.queued>0)&&o(`${t.running} running \xB7 ${t.queued} queued`,e.ghost,{msgType:"system"});break;case "orchestrator:stall_detected":o("Stall detected",e.yellow,{agentId:n?.get(t.runId),taskId:l(t.runId),msgType:"error"});break}}export{Uu as App,ju as _resetPendingDeletionSeq};
|
|
@@ -30,12 +30,14 @@ function isBlocked(task, allTasks) {
|
|
|
30
30
|
if (allTasks instanceof Map) {
|
|
31
31
|
return task.depends_on.some((depId) => {
|
|
32
32
|
const dep = allTasks.get(depId);
|
|
33
|
-
|
|
33
|
+
if (!dep) return false;
|
|
34
|
+
return dep.status !== "done";
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return task.depends_on.some((depId) => {
|
|
37
38
|
const dep = allTasks.find((t) => t.id === depId);
|
|
38
|
-
|
|
39
|
+
if (!dep) return false;
|
|
40
|
+
return dep.status !== "done";
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
function resolveFailureStatus(task) {
|
|
@@ -137,11 +139,15 @@ async function acquireLock(lockPath) {
|
|
|
137
139
|
release();
|
|
138
140
|
}
|
|
139
141
|
}
|
|
142
|
+
var LOCK_STALE_MS = 6e4;
|
|
140
143
|
async function doAcquire(lockPath) {
|
|
141
144
|
const existing = await readLockPid(lockPath);
|
|
142
145
|
if (existing !== null) {
|
|
143
146
|
if (isProcessAlive(existing)) {
|
|
144
|
-
|
|
147
|
+
const stale = await isLockStaleByAge(lockPath);
|
|
148
|
+
if (!stale) {
|
|
149
|
+
return { acquired: false, pid: existing };
|
|
150
|
+
}
|
|
145
151
|
}
|
|
146
152
|
await fs.unlink(lockPath).catch(() => {
|
|
147
153
|
});
|
|
@@ -163,6 +169,11 @@ async function releaseLock(lockPath) {
|
|
|
163
169
|
await fs.unlink(lockPath).catch(() => {
|
|
164
170
|
});
|
|
165
171
|
}
|
|
172
|
+
async function touchLock(lockPath) {
|
|
173
|
+
const now = Date.now() / 1e3;
|
|
174
|
+
await fs.utimes(lockPath, now, now).catch(() => {
|
|
175
|
+
});
|
|
176
|
+
}
|
|
166
177
|
async function readLockPid(lockPath) {
|
|
167
178
|
try {
|
|
168
179
|
const content = await fs.readFile(lockPath, "utf-8");
|
|
@@ -172,6 +183,14 @@ async function readLockPid(lockPath) {
|
|
|
172
183
|
return null;
|
|
173
184
|
}
|
|
174
185
|
}
|
|
186
|
+
async function isLockStaleByAge(lockPath) {
|
|
187
|
+
try {
|
|
188
|
+
const stat = await fs.stat(lockPath);
|
|
189
|
+
return Date.now() - stat.mtimeMs > LOCK_STALE_MS;
|
|
190
|
+
} catch {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
175
194
|
function isProcessAlive(pid) {
|
|
176
195
|
try {
|
|
177
196
|
process.kill(pid, 0);
|
|
@@ -368,6 +387,7 @@ var Orchestrator = class {
|
|
|
368
387
|
immediateDispatchTimer = null;
|
|
369
388
|
taskCreatedUnsub = null;
|
|
370
389
|
tickInProgress = false;
|
|
390
|
+
stoppedResolvers = [];
|
|
371
391
|
/** When true, `tick()` skips `seedAutonomousTasks()`. Set via `startWatch()` options. */
|
|
372
392
|
skipAutonomousSeeding = false;
|
|
373
393
|
/** Promise-chain mutex to serialize critical state mutations. */
|
|
@@ -500,6 +520,16 @@ var Orchestrator = class {
|
|
|
500
520
|
this.deps.config.scheduling.poll_interval_ms
|
|
501
521
|
);
|
|
502
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Returns a promise that resolves when stop() completes.
|
|
525
|
+
* Use in long-running modes (serve, run --watch) to keep the process alive.
|
|
526
|
+
*/
|
|
527
|
+
waitForStop() {
|
|
528
|
+
if (this.shuttingDown) return Promise.resolve();
|
|
529
|
+
return new Promise((resolve) => {
|
|
530
|
+
this.stoppedResolvers.push(resolve);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
503
533
|
/**
|
|
504
534
|
* Register SIGINT/SIGTERM handlers for graceful shutdown.
|
|
505
535
|
*/
|
|
@@ -572,6 +602,8 @@ var Orchestrator = class {
|
|
|
572
602
|
this.lockAcquired = false;
|
|
573
603
|
}
|
|
574
604
|
this.removeSignalHandlers();
|
|
605
|
+
for (const resolve of this.stoppedResolvers) resolve();
|
|
606
|
+
this.stoppedResolvers = [];
|
|
575
607
|
}
|
|
576
608
|
/**
|
|
577
609
|
* Cancel a running task: kill agent process, clean state, mark cancelled.
|
|
@@ -668,6 +700,7 @@ var Orchestrator = class {
|
|
|
668
700
|
queued
|
|
669
701
|
});
|
|
670
702
|
});
|
|
703
|
+
await touchLock(this.deps.lockPath);
|
|
671
704
|
} finally {
|
|
672
705
|
this.tickInProgress = false;
|
|
673
706
|
}
|
|
@@ -1080,6 +1113,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
|
|
|
1080
1113
|
});
|
|
1081
1114
|
});
|
|
1082
1115
|
} catch (err) {
|
|
1116
|
+
this.abortControllers.delete(taskId);
|
|
1083
1117
|
this.unclaim(taskId);
|
|
1084
1118
|
await this.saveState();
|
|
1085
1119
|
throw err;
|
|
@@ -1177,6 +1211,8 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
|
|
|
1177
1211
|
if (entry) {
|
|
1178
1212
|
await this.handleRunFailure(taskId, entry, error, errorKind);
|
|
1179
1213
|
}
|
|
1214
|
+
} finally {
|
|
1215
|
+
this.deps.runStore.closeRunEvents(runId);
|
|
1180
1216
|
}
|
|
1181
1217
|
}
|
|
1182
1218
|
async handleRunSuccess(taskId, runId, agentId, tokens, resultText, filesChanged) {
|
|
@@ -1242,7 +1278,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
|
|
|
1242
1278
|
taskId,
|
|
1243
1279
|
branch: task.proof.branch
|
|
1244
1280
|
});
|
|
1245
|
-
await this.deps.workspaceManager.cleanup(taskId).catch((err) => {
|
|
1281
|
+
await this.deps.workspaceManager.cleanup(taskId, task.proof.branch).catch((err) => {
|
|
1246
1282
|
this.deps.eventBus.emit({
|
|
1247
1283
|
type: "orchestrator:error",
|
|
1248
1284
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -1361,6 +1397,16 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
|
|
|
1361
1397
|
state.stats.total_tasks_failed++;
|
|
1362
1398
|
}
|
|
1363
1399
|
state.stats.total_runtime_ms += runtimeMs;
|
|
1400
|
+
if (task.proof?.branch) {
|
|
1401
|
+
await this.deps.workspaceManager.cleanup(taskId, task.proof.branch).catch((err) => {
|
|
1402
|
+
this.deps.eventBus.emit({
|
|
1403
|
+
type: "orchestrator:error",
|
|
1404
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1405
|
+
context: `workspace cleanup for ${taskId}`,
|
|
1406
|
+
fatal: false
|
|
1407
|
+
});
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1364
1410
|
delete state.running[taskId];
|
|
1365
1411
|
state.stats.total_runs++;
|
|
1366
1412
|
await this.saveState();
|
|
@@ -1491,6 +1537,7 @@ ${task.proof?.agent_summary ?? ""}`.slice(0, 2e3),
|
|
|
1491
1537
|
})
|
|
1492
1538
|
);
|
|
1493
1539
|
}
|
|
1540
|
+
state.claimed = /* @__PURE__ */ new Set();
|
|
1494
1541
|
if (cleanedTaskIds.size > 0) {
|
|
1495
1542
|
const allTasks = await this.cachedTaskStore.list();
|
|
1496
1543
|
const orphaned = allTasks.filter(
|
|
@@ -1572,5 +1619,5 @@ function serializeEventData(data, maxLen) {
|
|
|
1572
1619
|
}
|
|
1573
1620
|
|
|
1574
1621
|
export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus };
|
|
1575
|
-
//# sourceMappingURL=chunk-
|
|
1576
|
-
//# sourceMappingURL=chunk-
|
|
1622
|
+
//# sourceMappingURL=chunk-4TDXD3LA.js.map
|
|
1623
|
+
//# sourceMappingURL=chunk-4TDXD3LA.js.map
|