@runfusion/fusion 0.30.0 → 0.32.0

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.
Files changed (76) hide show
  1. package/dist/bin.js +72183 -52586
  2. package/dist/client/.vite/manifest.json +549 -0
  3. package/dist/client/assets/{AgentDetailView-Cu4TgvBn.js → AgentDetailView-CnFf_eBZ.js} +3 -3
  4. package/dist/client/assets/AgentPermissionPolicyEditor-CGxjOr6G.css +1 -0
  5. package/dist/client/assets/AgentPermissionPolicyEditor-Cmkt9Z01.js +6 -0
  6. package/dist/client/assets/{AgentsView-CIH4Acck.js → AgentsView-LkVv9hph.js} +3 -3
  7. package/dist/client/assets/ChatView-DYjECCRG.js +1 -0
  8. package/dist/client/assets/{DevServerView-Bd8JZ-3C.js → DevServerView-D7legPr1.js} +1 -1
  9. package/dist/client/assets/{DevServerView-DlZpuAnj.css → DevServerView-VTQY28P7.css} +1 -1
  10. package/dist/client/assets/{DirectoryPicker-BOGqZNiq.js → DirectoryPicker-DctpCNrd.js} +1 -1
  11. package/dist/client/assets/DocumentsView-DORp5JjC.js +1 -0
  12. package/dist/client/assets/EvalsView-CYVJ1pbc.js +1 -0
  13. package/dist/client/assets/{ExperimentalAgentOnboardingModal-BM7EnSvJ.js → ExperimentalAgentOnboardingModal-BULVNAiq.js} +1 -1
  14. package/dist/client/assets/GoalsView-Cg136Jcn.css +1 -0
  15. package/dist/client/assets/GoalsView-bmpZKOI_.js +1 -0
  16. package/dist/client/assets/{InsightsView-B0J4mhzV.css → InsightsView-C9-mqVvf.css} +1 -1
  17. package/dist/client/assets/InsightsView-mmtem0RU.js +11 -0
  18. package/dist/client/assets/{MemoryView-CE1D9euM.js → MemoryView-HVpO1fCH.js} +2 -2
  19. package/dist/client/assets/{NodesView-Zxusnhxu.js → NodesView-CM0eoCP8.js} +3 -3
  20. package/dist/client/assets/{PiExtensionsManager-BlMmxtLZ.js → PiExtensionsManager-Cyfas2VT.js} +2 -2
  21. package/dist/client/assets/{PluginManager-D4eZ0zA4.js → PluginManager-C7QDE3Lk.js} +1 -1
  22. package/dist/client/assets/ReliabilityView-C1C1j1SD.js +1 -0
  23. package/dist/client/assets/ReliabilityView-D9AsVv5l.css +1 -0
  24. package/dist/client/assets/ResearchView-Bn2WxwnQ.js +1 -0
  25. package/dist/client/assets/SecretsView-BFhVwJu6.css +1 -0
  26. package/dist/client/assets/SecretsView-DgrrgzFc.js +1 -0
  27. package/dist/client/assets/SettingsModal-BCZrCLl3.js +31 -0
  28. package/dist/client/assets/{SettingsModal-sp7SNwS9.css → SettingsModal-BZBV2kLr.css} +1 -1
  29. package/dist/client/assets/{SettingsModal-BAx4gt2A.css → SettingsModal-DZrJ5PFH.css} +1 -1
  30. package/dist/client/assets/{SettingsModal-DRnZ6eBW.js → SettingsModal-YCJM5is3.js} +1 -1
  31. package/dist/client/assets/{SetupWizardModal-BmmRM3g-.js → SetupWizardModal-BT-mj3VD.js} +1 -1
  32. package/dist/client/assets/{SkillsView-DWVtT2-8.js → SkillsView-Db7dYpqd.js} +1 -1
  33. package/dist/client/assets/{StashRecoveryView-CKkaWzzc.js → StashRecoveryView-CSYYcWux.js} +1 -1
  34. package/dist/client/assets/TodoView-zqCqfy26.js +6 -0
  35. package/dist/client/assets/dashboard-view-PpcsMDvN.js +21 -0
  36. package/dist/client/assets/{folder-open-BTN2_Wuv.js → folder-open-mxsFQlAX.js} +1 -1
  37. package/dist/client/assets/index-Ba-F8c1g.js +732 -0
  38. package/dist/client/assets/index-D4HhaIOp.css +1 -0
  39. package/dist/client/assets/{upload-euJEs_N2.js → upload-j7JjaJzG.js} +1 -1
  40. package/dist/client/assets/{users-B7miEHCZ.js → users-DZ_0WcB6.js} +1 -1
  41. package/dist/client/index.html +15 -27
  42. package/dist/client/version.json +1 -1
  43. package/dist/droid-cli/package.json +1 -1
  44. package/dist/extension.js +52863 -36171
  45. package/dist/pi-claude-cli/package.json +1 -1
  46. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  47. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  48. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  49. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  50. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  51. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  52. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  53. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  54. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  55. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  56. package/package.json +1 -1
  57. package/skill/fusion/SKILL.md +2 -2
  58. package/skill/fusion/references/cli-commands.md +1 -1
  59. package/skill/fusion/references/engine-tools.md +1 -0
  60. package/skill/fusion/references/extension-tools.md +23 -2
  61. package/skill/fusion/references/fusion-capabilities.md +4 -2
  62. package/skill/fusion/workflows/task-management.md +1 -1
  63. package/dist/client/assets/AgentPermissionPolicyEditor-Ceg2Dszn.js +0 -6
  64. package/dist/client/assets/AgentPermissionPolicyEditor-CthjqUL_.css +0 -1
  65. package/dist/client/assets/ChatView-DqJoFquZ.js +0 -1
  66. package/dist/client/assets/DocumentsView-B-ELcw4o.js +0 -1
  67. package/dist/client/assets/EvalsView-Ccl9QBYN.js +0 -1
  68. package/dist/client/assets/InsightsView-DLF49bzu.js +0 -11
  69. package/dist/client/assets/ReliabilityView-KmH60I_5.js +0 -1
  70. package/dist/client/assets/ReliabilityView-rxA_HgEG.css +0 -1
  71. package/dist/client/assets/ResearchView-C14Zh7c9.js +0 -1
  72. package/dist/client/assets/SettingsModal-c1QwWno0.js +0 -31
  73. package/dist/client/assets/TodoView-hbD0NOCY.js +0 -6
  74. package/dist/client/assets/dashboard-view-VNPB3ca0.js +0 -21
  75. package/dist/client/assets/index-CZFBq256.css +0 -1
  76. package/dist/client/assets/index-DzSLVOnp.js +0 -695
@@ -1,6 +0,0 @@
1
- import{r as d,j as e}from"./vendor-react-K0fH_qHe.js";import{c as wt,cd as Ct,ce as St,cf as At,cg as $t,ch as Et,ci as Dt,cj as Ft,ck as Tt,v as Mt,i as Ot,z as G,cl as lt,L as Rt,J as Pt,bt as H,X as Q,cm as ut,aY as mt,Y as bt,ae as Ut,a as _t,at as Kt,B as pt}from"./index-DzSLVOnp.js";import"./vendor-xterm-DzcZoU0P.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Bt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Yt=wt("circle-plus",Bt);function zt(k){const{items:l,...x}=k;return x}function ht(k){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${k}-${crypto.randomUUID()}`:`${k}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Jt(k={}){const{projectId:l,addToast:x}=k,[I,N]=d.useState([]),[g,L]=d.useState([]),[Y,F]=d.useState(!0),[S,j]=d.useState(null),[$,E]=d.useState(null),[y,f]=d.useState([]),C=d.useRef($);C.current=$,d.useEffect(()=>{let s=!1;async function c(){F(!0),j(null);try{const r=await Tt(l);if(s)return;f(r),N(r.map(zt));const m=C.current&&r.some(i=>i.id===C.current)?C.current:r[0]?.id??null;E(m),L(m?r.find(i=>i.id===m)?.items??[]:[])}catch(r){if(s)return;f([]),N([]),L([]),E(null),j(r instanceof Error?r.message:"Failed to load todo lists")}finally{s||F(!1)}}return c(),()=>{s=!0}},[l]),d.useEffect(()=>{if(!$){L([]);return}const s=y.find(c=>c.id===$);L(s?.items??[])},[y,$]);const z=d.useCallback(async s=>{const c=I,r=y,m=new Date().toISOString(),i={id:ht("temp-list"),projectId:l??"",title:s,createdAt:m,updatedAt:m};j(null),N(n=>[...n,i]),f(n=>[...n,{...i,items:[]}]);try{const n=await Ct(s,l);N(a=>a.map(o=>o.id===i.id?n:o)),f(a=>a.map(o=>o.id===i.id?{...n,items:[]}:o)),C.current||E(n.id)}catch(n){N(c),f(r),j(n instanceof Error?n.message:"Failed to create list"),x?.("Failed to create todo list","error")}},[x,y,I,l]),J=d.useCallback(async(s,c)=>{const r=I,m=y;j(null),N(i=>i.map(n=>n.id===s?{...n,title:c}:n)),f(i=>i.map(n=>n.id===s?{...n,title:c}:n));try{const i=await St(s,c,l);N(n=>n.map(a=>a.id===s?i:a)),f(n=>n.map(a=>a.id===s?{...i,items:a.items}:a))}catch(i){N(r),f(m),j(i instanceof Error?i.message:"Failed to rename list"),x?.("Failed to rename todo list","error")}},[x,y,I,l]),V=d.useCallback(async s=>{const c=I,r=y,m=C.current,i=m===s?I.find(n=>n.id!==s)?.id??null:m;j(null),N(n=>n.filter(a=>a.id!==s)),f(n=>n.filter(a=>a.id!==s)),m===s&&E(i);try{await At(s,l)}catch(n){N(c),f(r),E(m),j(n instanceof Error?n.message:"Failed to delete list"),x?.("Failed to delete todo list","error")}},[x,y,I,l]),T=d.useCallback(async s=>{const c=C.current;if(!c)return;const r=g,m=y,i=new Date().toISOString(),n=g.reduce((o,u)=>Math.max(o,u.sortOrder),-1),a={id:ht("temp-item"),listId:c,text:s,completed:!1,completedAt:null,createdAt:i,updatedAt:i,sortOrder:n+1};j(null),L(o=>[...o,a]),f(o=>o.map(u=>u.id===c?{...u,items:[...u.items,a]}:u));try{const o=await $t(c,s,l);L(u=>u.map(h=>h.id===a.id?o:h)),f(u=>u.map(h=>h.id===c?{...h,items:h.items.map(D=>D.id===a.id?o:D)}:h))}catch(o){L(r),f(m),j(o instanceof Error?o.message:"Failed to create item"),x?.("Failed to create todo item","error")}},[x,g,y,l]),w=d.useCallback(async(s,c)=>{const r=g.find(o=>o.id===s);if(!r)return;const m=g,i=y,n=c.completed??r.completed,a={...r,...c,completed:n,completedAt:n?r.completedAt??new Date().toISOString():null,updatedAt:new Date().toISOString()};j(null),L(o=>o.map(u=>u.id===s?a:u)),f(o=>o.map(u=>u.id===a.listId?{...u,items:u.items.map(h=>h.id===s?a:h)}:u));try{const o=await Et(s,c,l);L(u=>u.map(h=>h.id===s?o:h)),f(u=>u.map(h=>h.id===o.listId?{...h,items:h.items.map(D=>D.id===s?o:D)}:h))}catch(o){L(m),f(i),j(o instanceof Error?o.message:"Failed to update item"),x?.("Failed to update todo item","error")}},[x,g,y,l]),_=d.useCallback(async s=>{const c=g.find(r=>r.id===s);c&&await w(s,{completed:!c.completed})},[g,w]),A=d.useCallback(async s=>{const c=g,r=y;j(null),L(m=>m.filter(i=>i.id!==s)),f(m=>m.map(i=>({...i,items:i.items.filter(n=>n.id!==s)})));try{await Dt(s,l)}catch(m){L(c),f(r),j(m instanceof Error?m.message:"Failed to delete item"),x?.("Failed to delete todo item","error")}},[x,g,y,l]),M=d.useCallback(async s=>{const c=C.current;if(!c)return;const r=g,m=y,i=new Map(g.map(a=>[a.id,a])),n=s.map((a,o)=>{const u=i.get(a);return u?{...u,sortOrder:o}:null}).filter(a=>a!==null);j(null),L(n),f(a=>a.map(o=>o.id===c?{...o,items:n}:o));try{await Ft(c,s,l)}catch(a){L(r),f(m),j(a instanceof Error?a.message:"Failed to reorder items"),x?.("Failed to reorder todo items","error")}},[x,g,y,l]);return{lists:I,items:g,loading:Y,error:S,selectedListId:$,setSelectedListId:E,createList:z,renameList:J,deleteList:V,createItem:T,updateItem:w,toggleItem:_,deleteItem:A,reorderItems:M}}function Vt(k){return[...k].sort((l,x)=>l.sortOrder-x.sortOrder)}function Qt({projectId:k,addToast:l,onPlanningMode:x,onTaskCreated:I,mobileKeyboardActive:N=!1}){const{lists:g,items:L,loading:Y,error:F,selectedListId:S,setSelectedListId:j,createList:$,renameList:E,deleteList:y,createItem:f,updateItem:C,toggleItem:z,deleteItem:J,reorderItems:V}=Jt({projectId:k,addToast:(t,p)=>{if(p==="success"||p==="error"||p==="info"||p===void 0){l(t,p);return}l(t,"info")}}),[T,w]=d.useState(null),[_,A]=d.useState(""),[M,s]=d.useState(null),[c,r]=d.useState(""),[m,i]=d.useState(""),[n,a]=d.useState(!1),[o,u]=d.useState(""),[h,D]=d.useState([]),[ft,W]=d.useState(!1),[X,O]=d.useState(!1),[Z,R]=d.useState(null),q=d.useRef(null),{confirm:xt}=Mt(),tt=d.useMemo(()=>g.find(t=>t.id===S)??null,[g,S]),K=d.useMemo(()=>Vt(L.filter(t=>t.listId===S)),[L,S]);function et(){w(null),A(""),i(""),a(!1)}function B(){s(null),r(""),u("")}function gt(t){et(),B(),j(t)}const vt=d.useCallback(async()=>{W(!0);try{const t=await Ot(void 0,k);D(t),O(!0)}catch(t){l(`Failed to load agents: ${G(t)}`,"error"),O(!1),R(null)}finally{W(!1)}},[k,l]);d.useEffect(()=>{w(null),A(""),i(""),a(!1),s(null),r(""),u(""),O(!1),R(null)},[S]),d.useEffect(()=>{if(!X)return;const t=p=>{q.current&&!q.current.contains(p.target)&&(O(!1),R(null))};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[X]);function jt(t){B(),w(t.id),A(t.title),a(!1)}async function st(){if(!T)return;const t=_.trim();if(!t){w(null),A("");return}await E(T,t),w(null),A("")}function nt(){w(null),A("")}function at(t){et(),s(t.id),r(t.text)}async function it(){if(!M)return;const t=c.trim();if(!t){s(null),r("");return}await C(M,{text:t}),s(null),r("")}function ot(){s(null),r("")}async function dt(){const t=m.trim();t&&(await $(t),i(""),a(!1))}async function rt(){if(!S)return;const t=o.trim();t&&(await f(t),u(""))}async function yt(t){await xt({title:"Delete List",message:"Delete this list and all its items?",danger:!0})&&await y(t)}async function Lt(t){await J(t)}async function ct(t,p){const v=K.map(U=>U.id),b=v.findIndex(U=>U===t);if(b<0)return;const P=p==="up"?b-1:b+1;P<0||P>=v.length||([v[b],v[P]]=[v[P],v[b]],await V(v))}const kt=d.useCallback(async t=>{try{const p={description:t.text,column:"triage",source:{sourceType:"dashboard_ui"}},v=await lt(p,k);I?.(v),l(`Created ${v.id} from todo`,"success")}catch(p){l(`Failed to create task: ${G(p)}`,"error")}},[k,l,I]),It=d.useCallback(async(t,p)=>{try{const v={description:t.text,column:"triage",assignedAgentId:p,source:{sourceType:"dashboard_ui"}},b=await lt(v,k);I?.(b);const U=h.find(Nt=>Nt.id===p)?.name??p;l(`Created ${b.id} and assigned to ${U}`,"success"),O(!1),R(null)}catch(v){l(`Failed to create and assign task: ${G(v)}`,"error")}},[k,l,h,I]);return Y?e.jsx("div",{className:"todo-view",children:e.jsxs("div",{className:"todo-loading",children:[e.jsx(Rt,{className:"todo-loading-icon","aria-hidden":"true"}),e.jsx("p",{children:"Loading todos..."})]})}):e.jsx("div",{className:`todo-view${N?" todo-view--mobile-keyboard-active":""}`,"data-testid":"todo-view-root",children:e.jsxs("div",{className:"todo-view-layout",children:[e.jsxs("aside",{className:"todo-view-sidebar","aria-label":"Todo lists sidebar",children:[e.jsxs("div",{className:"todo-sidebar-header",children:[e.jsx("h3",{className:"todo-sidebar-title",children:"Lists"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-add-list-btn",onClick:()=>{B(),a(!0),w(null)},"aria-label":"Add list","data-testid":"add-list-button",children:e.jsx(Pt,{})})]}),n&&e.jsxs("div",{className:"todo-list-item",children:[e.jsx("input",{className:"input todo-inline-edit-input",placeholder:"New list title",value:m,onChange:t=>i(t.target.value),onKeyDown:t=>{t.key==="Enter"&&dt(),t.key==="Escape"&&(i(""),a(!1))},autoFocus:!0,"data-testid":"new-list-input"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{dt()},"aria-label":"Save list",children:e.jsx(H,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{i(""),a(!1)},"aria-label":"Cancel list",children:e.jsx(Q,{})})]}),g.length===0&&!n?e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(ut,{"aria-hidden":"true"}),e.jsx("p",{children:"No todo lists yet. Create one to get started."}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{B(),a(!0)},children:"Create List"})]}):e.jsx("div",{className:"todo-list-items",role:"list","aria-label":"Todo lists",children:g.map(t=>{const p=t.id===S,v=t.id===T;return e.jsx("div",{className:`todo-list-item${p?" todo-list-item--active":""}`,role:"listitem",children:v?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"input todo-inline-edit-input",value:_,onChange:b=>A(b.target.value),onKeyDown:b=>{b.key==="Enter"&&st(),b.key==="Escape"&&nt()},autoFocus:!0,"data-testid":`rename-list-input-${t.id}`}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{st()},"aria-label":"Save list rename",children:e.jsx(H,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:nt,"aria-label":"Cancel list rename",children:e.jsx(Q,{})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"todo-list-select-btn",onClick:()=>gt(t.id),"aria-label":`Select list ${t.title}`,"aria-current":p?"true":void 0,"data-testid":`todo-list-${t.id}`,children:e.jsx("span",{className:"todo-list-item-name",children:t.title})}),e.jsxs("div",{className:"todo-list-item-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{jt(t)},"aria-label":`Rename ${t.title}`,"data-testid":`rename-list-button-${t.id}`,children:e.jsx(mt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{yt(t.id)},"aria-label":`Delete ${t.title}`,"data-testid":`delete-list-button-${t.id}`,children:e.jsx(bt,{})})]})]})},t.id)})})]}),e.jsxs("section",{className:"todo-view-main","aria-label":"Todo items",children:[F&&e.jsxs("div",{className:"todo-error-banner",role:"alert",children:[e.jsx("span",{className:"todo-error-message",children:F}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>window.location.reload(),children:"Retry"})]}),tt?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"todo-items-header",children:e.jsx("h3",{children:tt.title})}),e.jsxs("div",{className:"todo-add-item-row",children:[e.jsx("input",{className:"input",placeholder:"Add a todo item",value:o,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&rt(),t.key==="Escape"&&u("")},"data-testid":"new-item-input"}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{rt()},children:"Add"})]}),K.length===0?e.jsx("div",{className:"todo-empty-state",children:e.jsx("p",{children:"No items in this list. Add one above."})}):e.jsx("div",{className:"todo-items-list",children:K.map((t,p)=>{const v=t.id===M;return e.jsxs("div",{className:"todo-item","data-testid":`todo-item-${t.id}`,children:[e.jsxs("div",{className:"todo-item-main-row",children:[e.jsx("input",{type:"checkbox",checked:t.completed,onChange:()=>{z(t.id)},className:"todo-item-checkbox","aria-label":`Toggle ${t.text}`,"data-testid":`toggle-item-${t.id}`}),v?e.jsx("input",{className:"input todo-inline-edit-input",value:c,onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Enter"&&it(),b.key==="Escape"&&ot()},autoFocus:!0,"data-testid":`edit-item-input-${t.id}`}):e.jsx("button",{type:"button",className:`todo-item-text${t.completed?" todo-item-text--completed":""}`,onClick:()=>at(t),children:t.text})]}),e.jsx("div",{className:"todo-item-actions","data-testid":`todo-item-actions-${t.id}`,children:v?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{it()},"aria-label":"Save item edit",children:e.jsx(H,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:ot,"aria-label":"Cancel item edit",children:e.jsx(Q,{})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"todo-item-reorder-btns",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{ct(t.id,"up")},disabled:p===0,"aria-label":`Move ${t.text} up`,"data-testid":`move-up-${t.id}`,children:e.jsx(Ut,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{ct(t.id,"down")},disabled:p===K.length-1,"aria-label":`Move ${t.text} down`,"data-testid":`move-down-${t.id}`,children:e.jsx(_t,{})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{x?.(t.text)},"aria-label":`Start planning from ${t.text}`,"data-testid":`planning-from-${t.id}`,children:e.jsx(Kt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{kt(t)},"aria-label":`Create task from ${t.text}`,"data-testid":`create-task-from-${t.id}`,children:e.jsx(Yt,{})}),e.jsxs("div",{className:"todo-agent-picker-trigger",ref:Z===t.id?q:void 0,children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{R(t.id),vt()},"aria-label":`Assign ${t.text} to agent`,"data-testid":`assign-agent-for-${t.id}`,children:e.jsx(pt,{})}),X&&Z===t.id&&e.jsx("div",{className:"todo-agent-picker-dropdown",onMouseDown:b=>{b.preventDefault()},children:ft?e.jsx("div",{className:"todo-agent-picker-loading",children:"Loading agents..."}):h.length>0?h.map(b=>e.jsxs("button",{type:"button",className:"todo-agent-picker-item",onClick:()=>{It(t,b.id)},children:[e.jsx(pt,{}),e.jsx("span",{children:b.name}),e.jsx("span",{className:"todo-agent-picker-role",children:b.role})]},b.id)):e.jsx("div",{className:"todo-agent-picker-empty",children:"No agents available"})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>at(t),"aria-label":`Edit ${t.text}`,"data-testid":`edit-item-${t.id}`,children:e.jsx(mt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{Lt(t.id)},"aria-label":`Delete ${t.text}`,"data-testid":`delete-item-${t.id}`,children:e.jsx(bt,{})})]})})]},t.id)})})]}):e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(ut,{"aria-hidden":"true"}),e.jsx("p",{children:"Select a list from the sidebar"})]})]})]})})}export{Qt as TodoView};
@@ -1,21 +0,0 @@
1
- import{r as t,j as R}from"./vendor-react-K0fH_qHe.js";import{co as Ee,cp as ve,t as je,w as Xe,b9 as Ye}from"./index-DzSLVOnp.js";import{c as pe}from"./createLucideIcon-BazL2hk5.js";import"./vendor-xterm-DzcZoU0P.js";import"./vendor-codemirror-jBKmHyH0.js";const xe=4,ke=300,Ae=24;function $e({taskId:o,position:s,scale:r,canDrag:a,onPositionChange:f,onDragStateChange:c,onDragEnd:h,onDoubleTap:M}){const[C,I]=t.useState(!1),w=t.useRef(null),T=t.useRef(s),_=t.useRef(!1),n=t.useRef(null),y=t.useRef(!1);T.current=s,y.current=C;const u=t.useCallback(()=>{n.current=null},[]),b=t.useCallback(l=>{w.current=null,I(!1),y.current=!1,l&&(c?.(!1),h?.(),_.current=!0,u())},[h,c,u]),z=t.useCallback(l=>{if(!l.isPrimary)return;if(l.defaultPrevented){u();return}const P=Date.now();n.current&&P-n.current.timeStamp>ke&&u(),a&&l.stopPropagation();const D=l.currentTarget;a&&typeof D.setPointerCapture=="function"&&D.setPointerCapture(l.pointerId),w.current={pointerId:l.pointerId,pointerType:l.pointerType,startPointer:{x:l.clientX,y:l.clientY},startPosition:T.current,defaultPrevented:l.defaultPrevented,movedBeyondThreshold:!1}},[a,u]),v=t.useCallback(l=>{const P=w.current;if(!P||P.pointerId!==l.pointerId)return;a&&l.stopPropagation();const D=l.clientX-P.startPointer.x,j=l.clientY-P.startPointer.y,ee=Math.hypot(D,j);if(ee>=xe&&(P.movedBeyondThreshold=!0),!a){P.movedBeyondThreshold&&u();return}if(!y.current&&ee>=xe&&(I(!0),y.current=!0,c?.(!0),u()),ee<xe)return;const A=r>0?r:1;f(o,{x:P.startPosition.x+D/A,y:P.startPosition.y+j/A})},[a,c,f,u,r,o]),L=t.useCallback((l,P)=>{if(!M||P.defaultPrevented||P.movedBeyondThreshold)return Date.now()-(n.current?.timeStamp??0)>ke&&u(),!1;if(P.pointerType==="mouse")return u(),!1;const D={timeStamp:Date.now(),point:{x:P.startPointer.x,y:P.startPointer.y}},j=n.current;return!j||D.timeStamp-j.timeStamp>ke||Math.hypot(D.point.x-j.point.x,D.point.y-j.point.y)>Ae?(n.current=D,!1):(_.current=!0,u(),M(),!0)},[M,u]),W=t.useCallback(l=>{const P=w.current;if(!P||P.pointerId!==l.pointerId)return;a&&l.stopPropagation(),a&&typeof l.currentTarget.hasPointerCapture=="function"&&l.currentTarget.hasPointerCapture(l.pointerId)&&typeof l.currentTarget.releasePointerCapture=="function"&&l.currentTarget.releasePointerCapture(l.pointerId);const D=y.current;!D&&L(l,P)&&l.preventDefault(),b(D)},[a,b,L]),F=t.useCallback(l=>{const P=w.current;!P||P.pointerId!==l.pointerId||(a&&l.stopPropagation(),a&&typeof l.currentTarget.hasPointerCapture=="function"&&l.currentTarget.hasPointerCapture(l.pointerId)&&typeof l.currentTarget.releasePointerCapture=="function"&&l.currentTarget.releasePointerCapture(l.pointerId),u(),b(y.current))},[a,b,u]),U=t.useCallback(l=>{_.current&&(_.current=!1,l.preventDefault(),l.stopPropagation())},[]);return t.useMemo(()=>({isDragging:C,onPointerDown:z,onPointerMove:v,onPointerUp:W,onPointerCancel:F,onClickCapture:U}),[C,U,F,z,v,W])}const Ge=new Set(["planning","researching","executing","finalizing","merging","merging-fix"]);function Le(o){return o?o.charAt(0).toUpperCase()+o.slice(1):"Executing"}function We({style:o,position:s,scale:r,isSelected:a=!1,isHighlighted:f=!1,isDimmed:c=!1,onMouseEnter:h,onMouseLeave:M,onClick:C,onNodePositionChange:I,onNodeDragStateChange:w,onNodeDragEnd:T,..._}){const{task:n,globalPaused:y,taskStuckTimeoutMs:u,lastFetchTimeMs:b,onOpenDetail:z}=_,v=n.status==="failed",L=n.paused===!0,W=Ee(n,u,b),F=n.column==="triage"&&n.status==="awaiting-approval",U=!y&&!v&&!L&&!W&&!F&&(n.column==="in-progress"||Ge.has(n.status)),l=typeof n.currentStep=="number"&&n.currentStep>=0&&Array.isArray(n.steps)&&n.currentStep<n.steps.length,P=n.column==="in-review",D=$e({taskId:n.id,position:s,scale:r,canDrag:a,onPositionChange:I,onDragStateChange:w,onDragEnd:T,onDoubleTap:()=>z(n)});return R.jsxs("div",{className:`graph-task-node${a?" graph-node--draggable graph-task-node--selected":""}${D.isDragging?" graph-node--dragging":""}${f?" graph-task-node--highlighted graph-node--highlighted":""}${c?" graph-task-node--dimmed graph-node--dimmed":""}${U?" graph-task-node--active":""}${P?" graph-task-node--in-review":""}`,style:o,draggable:!1,"data-testid":`graph-task-node-${n.id}`,"data-current-step":U&&l?String(n.currentStep):void 0,onMouseEnter:h,onMouseLeave:M,onClick:C,onDoubleClick:j=>{j.defaultPrevented||z(n)},onClickCapture:D.onClickCapture,onPointerDown:D.onPointerDown,onPointerMove:D.onPointerMove,onPointerUp:D.onPointerUp,onPointerCancel:D.onPointerCancel,children:[U?R.jsx("div",{className:"graph-task-active-indicator",children:R.jsx("span",{className:"graph-task-active-indicator-text",children:Le(n.status)})}):null,R.jsx(ve,{..._,onOpenDetail:()=>{},disableDrag:!0})]})}/**
2
- * @license lucide-react v0.542.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ue=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Fe=pe("maximize",Ue);/**
7
- * @license lucide-react v0.542.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Be=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Ze=pe("rotate-ccw",Be);/**
12
- * @license lucide-react v0.542.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Ve=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ke=pe("zoom-in",Ve);/**
17
- * @license lucide-react v0.542.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const qe=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Je=pe("zoom-out",qe);function Qe({zoom:o,onZoomIn:s,onZoomOut:r,onFitToGraph:a,onResetView:f}){return R.jsxs("div",{className:"graph-toolbar","data-testid":"graph-toolbar",children:[R.jsx("button",{className:"btn btn-icon",title:"Zoom in (Ctrl+=)","aria-label":"Zoom in",onClick:s,children:R.jsx(Ke,{size:16})}),R.jsx("button",{className:"btn btn-icon",title:"Zoom out (Ctrl+-)","aria-label":"Zoom out",onClick:r,children:R.jsx(Je,{size:16})}),R.jsxs("div",{className:"graph-toolbar__zoom-label","aria-live":"polite",children:[Math.round(o*100),"%"]}),R.jsx("button",{className:"btn btn-icon",title:"Fit to graph (Ctrl+Shift+F)","aria-label":"Fit to graph",onClick:a,children:R.jsx(Fe,{size:16})}),R.jsx("button",{className:"btn btn-icon",title:"Reset view (Ctrl+0)","aria-label":"Reset view",onClick:f,children:R.jsx(Ze,{size:16})})]})}const et=280,tt=100;function nt({edges:o,positions:s,nodeWidth:r=et,nodeHeight:a=tt,nodeHeights:f,highlightedEdgeIds:c}){const h=!!(c&&c.size>0);return R.jsxs("svg",{className:"dependency-graph-edges","aria-hidden":"true",children:[R.jsx("defs",{children:R.jsx("marker",{id:"dependency-graph-arrowhead",markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",markerUnits:"strokeWidth",children:R.jsx("path",{d:"M 0 0 L 10 3.5 L 0 7 z",fill:"var(--border)"})})}),o.map(M=>{const C=s.get(M.source),I=s.get(M.target);if(!C||!I)return null;const w=`${M.source}->${M.target}`,T=h&&(c?.has(w)??!1),_=C.x+r/2,n=C.y+(f?.get(M.source)??a),y=I.x+r/2,u=I.y,b=n+(u-n)/2;return R.jsx("path",{"data-testid":"dependency-edge","data-edge-id":w,className:`dependency-graph-edge${T?" graph-edge--highlighted":""}${h&&!T?" graph-edge--dimmed":""}`,d:`M ${_} ${n} C ${_} ${b}, ${y} ${b}, ${y} ${u}`,fill:"none",stroke:T?"var(--todo)":"var(--border)",strokeWidth:T?"var(--space-xs)":"var(--btn-border-width)",opacity:h&&!T?.15:1,markerEnd:"url(#dependency-graph-arrowhead)",style:{transition:"opacity var(--transition-fast), stroke var(--transition-fast), stroke-width var(--transition-fast)"}},w)})]})}const ot=new Set(["triage","todo","in-progress","in-review"]);function rt(o){return o.filter(s=>ot.has(s.column))}const st={nodeWidth:280,nodeHeight:100,horizontalGap:40,verticalGap:80,orientation:"vertical"};function we(o,s){const r={...st,...s},a=o.nodes.map(n=>n.task.id);if(a.length===0)return new Map;const f=new Map,c=new Map;for(const n of a)c.set(n,0),f.set(n,[]);for(const n of o.edges)!c.has(n.source)||!c.has(n.target)||(f.get(n.target)?.push(n.source),c.set(n.source,(c.get(n.source)??0)+1));const h=a.filter(n=>(c.get(n)??0)===0),M=[];for(;h.length>0;){const n=h.shift();M.push(n);for(const y of f.get(n)??[]){const u=(c.get(y)??0)-1;c.set(y,u),u===0&&h.push(y)}}for(const n of a)M.includes(n)||M.push(n);const C=new Map;for(const n of M){const y=o.edges.filter(b=>b.source===n).map(b=>b.target);let u=0;for(const b of y)u=Math.max(u,(C.get(b)??0)+1);C.set(n,u)}const I=new Map;for(const n of a){const y=C.get(n)??0,u=I.get(y)??[];u.push(n),I.set(y,u)}const w=new Map,T=Array.from(I.keys()).sort((n,y)=>n-y),_=new Map;if(r.orientation==="vertical"){let n=0;for(const y of T){_.set(y,n);const u=I.get(y)??[],b=Math.max(r.nodeHeight,...u.map(z=>r.measuredHeights?.get(z)??r.nodeHeight));n+=b+r.verticalGap}}for(const n of T){const y=I.get(n)??[];y.sort();const u=r.orientation==="horizontal",z=-(y.length*(u?r.nodeHeight:r.nodeWidth)+Math.max(0,y.length-1)*(u?r.verticalGap:r.horizontalGap))/2;y.forEach((v,L)=>{if(u){const U=n*(r.nodeWidth+r.horizontalGap),l=z+L*(r.nodeHeight+r.verticalGap);w.set(v,{x:U,y:l});return}const W=z+L*(r.nodeWidth+r.horizontalGap),F=_.get(n)??n*(r.nodeHeight+r.verticalGap);w.set(v,{x:W,y:F})})}return w}function it(o){return t.useMemo(()=>{const s=o.map(f=>({task:f})),r=new Set(o.map(f=>f.id)),a=o.flatMap(f=>(f.dependencies??[]).filter(c=>r.has(c)).map(c=>({source:f.id,target:c})));return{nodes:s,edges:a}},[o])}const ce=.1,ue=3,Te=40,at=200;function J(o,s,r){return Math.min(r,Math.max(s,o))}function ct(o){if(!(o instanceof HTMLElement))return!1;const s=o.tagName.toLowerCase();return o.isContentEditable||s==="input"||s==="textarea"||s==="select"}function ut(){const[o,s]=t.useState({x:0,y:0}),[r,a]=t.useState(1),[f,c]=t.useState(!1),h=t.useRef(o),M=t.useRef(r),C=t.useRef(null),I=t.useRef(null),w=t.useRef(new Map),T=t.useRef(null),_=t.useRef({minX:0,minY:0,maxX:0,maxY:0});t.useEffect(()=>{h.current=o},[o]),t.useEffect(()=>{M.current=r},[r]),t.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]);const n=t.useMemo(()=>`translate(${o.x}px, ${o.y}px) scale(${r})`,[o.x,o.y,r]),y=t.useMemo(()=>Math.round(r*100),[r]),u=t.useCallback(i=>{if(!i){C.current!==null&&(window.clearTimeout(C.current),C.current=null),c(!1);return}c(!0),C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{c(!1),C.current=null},at)},[]),b=t.useCallback((i,d,m,S=M.current)=>{const x=_.current;if(x.maxX<=x.minX||x.maxY<=x.minY)return{x:J(i.x,-d,d),y:J(i.y,-m,m)};const $=d-x.maxX*S,O=-x.minX*S,X=m-x.maxY*S,B=-x.minY*S,Z=$>O?($+O)/2:J(i.x,$,O),K=X>B?(X+B)/2:J(i.y,X,B);return{x:Z,y:K}},[]),z=t.useCallback((i,d,m,S)=>{const x=M.current,$=h.current,O=J(i,ce,ue),X=O/x,B=b({x:d.x-(d.x-$.x)*X,y:d.y-(d.y-$.y)*X},m,S,O);a(O),s(B)},[b]),v=t.useCallback((i,d,m,S)=>{u(!1);const x=S??{x:d/2,y:m/2};z(M.current*i,x,d,m)},[u,z]),L=t.useCallback((i,d)=>{if(i&&d){v(1.2,i,d);return}a(m=>J(m+.1,ce,ue))},[v]),W=t.useCallback((i,d)=>{if(i&&d){v(1/1.2,i,d);return}a(m=>J(m-.1,ce,ue))},[v]),F=t.useCallback(()=>{u(!0),s({x:0,y:0}),a(1)},[u]),U=t.useCallback((i,d,m,S)=>{if(u(!0),i.size===0){s({x:0,y:0}),a(1);return}const x=S?.nodeWidth??280,$=S?.nodeHeight??100,O=Array.from(i.entries()),X=Math.min(...O.map(([,q])=>q.x)),B=Math.min(...O.map(([,q])=>q.y)),Z=Math.max(...O.map(([,q])=>q.x+x)),K=Math.max(...O.map(([q,me])=>me.y+(S?.measuredHeights?.get(q)??$))),te=Math.max(1,Z-X),Y=Math.max(1,K-B),re=Math.max(1,d-Te*2),se=Math.max(1,m-Te*2),ne=J(Math.min(re/te,se/Y),ce,ue),he=(d-te*ne)/2-X*ne,de=(m-Y*ne)/2-B*ne;a(ne),s(b({x:he,y:de},d,m,ne))},[b,u]),l=t.useCallback((i,d)=>{if(w.current.set(i,d),w.current.size===2){const[m,S]=Array.from(w.current.values());T.current={distance:Math.hypot(m.x-S.x,m.y-S.y),zoom:M.current,pan:h.current,midpoint:{x:(m.x+S.x)/2,y:(m.y+S.y)/2}},I.current=null;return}I.current={start:d,panStart:h.current}},[]),P=t.useCallback((i,d,m,S)=>{if(w.current.has(i)&&w.current.set(i,d),w.current.size===2&&T.current){u(!1);const[O,X]=Array.from(w.current.values()),Z=Math.hypot(O.x-X.x,O.y-X.y)/Math.max(1,T.current.distance),K={x:(O.x+X.x)/2,y:(O.y+X.y)/2},te=J(T.current.zoom*Z,ce,ue),Y=te/T.current.zoom,re=b({x:K.x-(T.current.midpoint.x-T.current.pan.x)*Y,y:K.y-(T.current.midpoint.y-T.current.pan.y)*Y},m,S);a(te),s(re);return}const x=I.current;if(!x)return;u(!1);const $={x:x.panStart.x+(d.x-x.start.x),y:x.panStart.y+(d.y-x.start.y)};s(b($,m,S))},[b,u]),D=t.useCallback(i=>{if(w.current.delete(i),w.current.size<2&&(T.current=null),w.current.size===1){const[d]=Array.from(w.current.values());I.current={start:d,panStart:h.current};return}w.current.size===0&&(I.current=null)},[]),j=t.useCallback((i,d,m,S)=>{u(!1);const x={x:h.current.x-i,y:h.current.y-d};s(b(x,m,S))},[b,u]),ee=t.useCallback((i,d,m,S)=>{const x=i<0?1.1:.9;u(!1),z(M.current*x,d,m,S)},[u,z]),A=t.useCallback(i=>{_.current=i},[]),le=t.useCallback((i,d,m,S,x)=>{if(ct(i.target))return;const $=i.metaKey||i.ctrlKey;if(i.key==="Escape"){i.preventDefault(),F();return}if($){if(i.key==="="||i.key==="+"){i.preventDefault(),v(1.2,d,m);return}if(i.key==="-"){i.preventDefault(),v(1/1.2,d,m);return}if(i.key==="0"){i.preventDefault(),F();return}(i.key==="f"||i.key==="F")&&i.shiftKey&&(i.preventDefault(),U(S,d,m,x))}},[U,F,v]);return{pan:o,zoom:r,zoomPercent:y,transform:n,transitioning:f,zoomIn:L,zoomOut:W,resetView:F,fitToGraph:U,setAnimate:u,onPointerDown:l,onPointerMove:P,onPointerUp:D,onWheelPan:j,onWheelZoom:ee,handleKeyDown:le,setGraphBounds:A}}function lt(o){const{upstreamMap:s,downstreamMap:r}=t.useMemo(()=>{const f=new Map,c=new Map;for(const h of o)f.set(h.id,new Set(h.dependencies??[])),c.has(h.id)||c.set(h.id,new Set);for(const h of o)for(const M of h.dependencies??[])c.has(M)||c.set(M,new Set),c.get(M)?.add(h.id);return{upstreamMap:f,downstreamMap:c}},[o]);return{getChain:t.useCallback(f=>{if(!s.has(f)&&!r.has(f))return new Set;const c=new Set([f]),h=(M,C)=>{const I=[M],w=new Set([M]);for(;I.length>0;){const T=I.shift();if(!T)continue;const _=C.get(T);if(_)for(const n of _)w.has(n)||(w.add(n),c.add(n),I.push(n))}};return h(f,s),h(f,r),c},[r,s])}}const Me="fusion-plugin-dependency-graph:positions";function fe(o){if(!o||typeof o!="object")return!1;const s=o;return typeof s.x=="number"&&Number.isFinite(s.x)&&typeof s.y=="number"&&Number.isFinite(s.y)}function dt(o){const s=je(Me,o);if(!s)return{};try{const r=JSON.parse(s);if(!r||typeof r!="object")return{};const a={};for(const[f,c]of Object.entries(r))fe(c)&&(a[f]=c);return a}catch{return{}}}function ft(o,s,r){const a={};for(const[f,c]of Object.entries(o))s.has(f)&&fe(c)&&(a[f]=c);Xe(Me,JSON.stringify(a),r)}function pt(o){Ye(Me,o)}function ht(o,s,r){const a={};for(const[f,c]of Object.entries(o))r.has(f)&&fe(c)&&(a[f]=c);for(const[f,c]of Object.entries(s))r.has(f)&&fe(c)&&(a[f]=c);return a}function mt(o,s){const r={};for(const[a,f]of Object.entries(o))s.has(a)&&(r[a]=f);return r}function gt({projectId:o,visibleTaskIds:s}){const[r,a]=t.useState(null);t.useEffect(()=>{a(dt(o))},[o]);const f=t.useCallback(h=>{ft(h,s,o),a(mt(h,s))},[o,s]),c=t.useCallback(()=>{pt(o),a(null)},[o]);return{savedPositions:r,persistPositions:f,clearSavedPositions:c}}const ae=280,Q=100,yt=768,Ce=4;function xt({tasks:o,projectId:s,onOpenTaskDetail:r,onOpenDetail:a,addToast:f,globalPaused:c,onUpdateTask:h,onArchiveTask:M,onUnarchiveTask:C,onDeleteTask:I,onRetryTask:w,onOpenDetailWithTab:T,taskStuckTimeoutMs:_,onOpenMission:n,onMoveTask:y,lastFetchTimeMs:u,workflowStepNameLookup:b}){const z=t.useRef(null),v=t.useRef(!1),L=t.useRef(null),W=t.useRef(!1),F=t.useRef(new Map),[U,l]=t.useState(null),[P,D]=t.useState(null),[j,ee]=t.useState({width:0,height:0}),[A,le]=t.useState(new Map),i=t.useMemo(()=>rt(o),[o]),d=it(i),{getChain:m}=lt(i),S=U??P,x=t.useMemo(()=>S?m(S):new Set,[S,m]),$=t.useMemo(()=>{const e=j.width||(typeof window<"u"?window.innerWidth:0);return(j.height||(typeof window<"u"?window.innerHeight:0))>e||e<yt?"horizontal":"vertical"},[j.height,j.width]),O=t.useMemo(()=>({nodeWidth:ae,nodeHeight:Q,horizontalGap:40,verticalGap:80,orientation:$,measuredHeights:A}),[A,$]),X=t.useMemo(()=>we(d,O),[d,O]),B=t.useMemo(()=>new Set(i.map(e=>e.id)),[i]),{savedPositions:Z,persistPositions:K,clearSavedPositions:te}=gt({projectId:s,visibleTaskIds:B}),[Y,re]=t.useState(X),[se,ne]=t.useState(!1);t.useEffect(()=>{const e={};for(const[g,N]of X.entries())e[g]=N;const p=Z?ht(e,Z,B):e;re(new Map(Object.entries(p)))},[X,Z,B]),t.useEffect(()=>{const e=z.current;if(!e)return;const p=(N,E)=>{ee(k=>k.width===N&&k.height===E?k:{width:N,height:E})};if(typeof ResizeObserver>"u"){p(e.clientWidth||(typeof window<"u"?window.innerWidth:0),e.clientHeight||(typeof window<"u"?window.innerHeight:0));return}p(e.clientWidth,e.clientHeight);const g=new ResizeObserver(N=>{const E=N[0];E&&p(E.contentRect.width,E.contentRect.height)});return g.observe(e),()=>g.disconnect()},[]),t.useEffect(()=>{const e=z.current;if(!e)return;const p=new Set(d.nodes.map(k=>k.task.id)),g=new Map;for(const k of p){const H=e.querySelector(`[data-testid="graph-task-node-${k}"]`);H&&g.set(k,H)}F.current=g,le(k=>{let H=!1;const G=new Map;for(const[oe,ie]of k.entries()){if(!p.has(oe)){H=!0;continue}G.set(oe,ie)}return H?G:k});const N=(k,H)=>{le(G=>{const oe=G.get(k);if(oe!==void 0&&Math.abs(oe-H)<1)return G;const ie=new Map(G);return ie.set(k,H),ie})};for(const[k,H]of g.entries())N(k,H.offsetHeight||Q);if(typeof ResizeObserver>"u")return;const E=new ResizeObserver(k=>{for(const H of k){const G=H.target,oe=Array.from(g.entries()).find(([,ie])=>ie===G)?.[0];oe&&N(oe,G.offsetHeight||Q)}});for(const k of g.values())E.observe(k);return()=>E.disconnect()},[d.nodes,Y,j.height,j.width]);const{transform:he,zoom:de,transitioning:q,zoomIn:me,zoomOut:De,resetView:Re,fitToGraph:ge,onPointerDown:Ie,onPointerMove:ze,onPointerUp:be,onWheelPan:Ne,onWheelZoom:He,handleKeyDown:Oe,setGraphBounds:Pe}=ut();t.useEffect(()=>{if(v.current||i.length===0)return;if(!!(Z&&Object.keys(Z).length>0)){v.current=!0;return}const p=z.current;p&&(ge(Y,p.clientWidth,p.clientHeight,{nodeWidth:ae,nodeHeight:Q,measuredHeights:A}),v.current=!0)},[i.length,ge,A,Y,Z]);const V=t.useMemo(()=>{const e=Array.from(Y.values());if(e.length===0)return{minX:0,minY:0,maxX:0,maxY:0,width:0,height:0};const p=Math.min(...e.map(k=>k.x)),g=Math.min(...e.map(k=>k.y)),N=Math.max(...e.map(k=>k.x+ae)),E=Math.max(...Array.from(Y.entries()).map(([k,H])=>H.y+(A.get(k)??Q)));return{minX:p,minY:g,maxX:N,maxY:E,width:Math.max(0,N-p),height:Math.max(0,E-g)}},[A,Y]),ye=t.useMemo(()=>{if(Y.size===0)return Y;const e=new Map;for(const[p,g]of Y.entries())e.set(p,{x:g.x-V.minX,y:g.y-V.minY});return e},[V.minX,V.minY,Y]);t.useEffect(()=>{Pe({minX:0,minY:0,maxX:V.width,maxY:V.height})},[V.height,V.width,Pe]);const Se=t.useCallback(()=>{te();const e=we(d,O);re(e)},[te,d,O]),_e=t.useCallback(()=>{const e={};for(const[p,g]of Y.entries())e[p]=g;K(e)},[K,Y]);return R.jsxs("section",{className:"dependency-graph","data-testid":"dependency-graph",children:[R.jsx("div",{ref:z,className:"dependency-graph__viewport",onPointerDown:e=>{se||(L.current={x:e.clientX,y:e.clientY},W.current=!1,Ie(e.pointerId,{x:e.clientX,y:e.clientY}))},onPointerMove:e=>{if(se)return;const p=z.current;if(!p)return;const g=L.current;if(g){const N=Math.abs(e.clientX-g.x),E=Math.abs(e.clientY-g.y);(N>Ce||E>Ce)&&(W.current=!0)}ze(e.pointerId,{x:e.clientX,y:e.clientY},p.clientWidth,p.clientHeight)},onPointerUp:e=>{se||be(e.pointerId),L.current=null},onPointerCancel:e=>{se||be(e.pointerId),L.current=null,W.current=!1},onWheel:e=>{e.preventDefault();const p=z.current;if(p){if(e.ctrlKey||e.metaKey){const g=p.getBoundingClientRect();He(e.deltaY,{x:e.clientX-g.left,y:e.clientY-g.top},p.clientWidth,p.clientHeight);return}Ne(e.deltaX,e.deltaY,p.clientWidth,p.clientHeight)}},onKeyDown:e=>{const p=z.current;p&&Oe(e,p.clientWidth,p.clientHeight,ye,{nodeWidth:ae,nodeHeight:Q,measuredHeights:A})},tabIndex:0,onClick:()=>{W.current||se||D(null)},children:i.length===0?R.jsx("div",{className:"dependency-graph__empty",children:"No active tasks to display in graph view."}):R.jsxs("div",{className:`graph-canvas-transform${q?" graph-canvas-transform--animate":""}`,style:{transform:he,width:`${V.width}px`,height:`${V.height}px`},children:[R.jsx(nt,{edges:d.edges,positions:ye,nodeWidth:ae,nodeHeight:Q,nodeHeights:A,highlightedEdgeIds:x.size>0?new Set(d.edges.filter(e=>x.has(e.source)&&x.has(e.target)).map(e=>`${e.source}->${e.target}`)):void 0}),R.jsx("div",{className:"dependency-graph__nodes-layer",children:d.nodes.map(e=>{const p=ye.get(e.task.id);return p?R.jsx(We,{task:e.task,projectId:s,isSelected:P===e.task.id,style:{minHeight:`${Q}px`,left:`${p.x}px`,top:`${p.y}px`},position:p,scale:de,onNodePositionChange:(g,N)=>{re(E=>{const k={x:N.x+V.minX,y:N.y+V.minY},H=E.get(g);if(H&&H.x===k.x&&H.y===k.y)return E;const G=new Map(E);return G.set(g,k),G})},onNodeDragStateChange:ne,onNodeDragEnd:_e,isHighlighted:x.size>0&&x.has(e.task.id),isDimmed:x.size>0&&!x.has(e.task.id),onOpenDetail:a??(g=>r?.(g.id)),addToast:f??(()=>{}),globalPaused:c,onUpdateTask:h,onArchiveTask:M,onUnarchiveTask:C,onDeleteTask:I,onRetryTask:w,onOpenDetailWithTab:T,taskStuckTimeoutMs:_,onOpenMission:n,onMoveTask:y,lastFetchTimeMs:u,workflowStepNameLookup:b,onMouseEnter:()=>l(e.task.id),onMouseLeave:()=>l(null),onClick:g=>{g.stopPropagation(),W.current=!1,D(N=>N===e.task.id?null:e.task.id)}},e.task.id):null})})]})}),R.jsx(Qe,{zoom:de,onZoomIn:()=>{const e=z.current;e&&me(e.clientWidth,e.clientHeight)},onZoomOut:()=>{const e=z.current;e&&De(e.clientWidth,e.clientHeight)},onFitToGraph:()=>{Se();const e=z.current;if(!e)return;const p=we(d,O),g=new Map,N=Array.from(p.values()),E=N.length>0?Math.min(...N.map(H=>H.x)):0,k=N.length>0?Math.min(...N.map(H=>H.y)):0;for(const[H,G]of p.entries())g.set(H,{x:G.x-E,y:G.y-k});ge(g,e.clientWidth,e.clientHeight,{nodeWidth:ae,nodeHeight:Q,measuredHeights:A})},onResetView:()=>{Se(),Re()}})]})}function kt(o){return new Map((o??[]).map(s=>[s.id,s.name]))}function Tt({context:o}){return t.createElement(xt,{tasks:o?.tasks??[],projectId:o?.projectId,workflowStepNameLookup:kt(o?.workflowSteps),onOpenDetail:o?.openTaskDetail})}export{xt as DependencyGraph,Tt as DependencyGraphDashboardView,Tt as default};