@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.
- package/dist/bin.js +72183 -52586
- package/dist/client/.vite/manifest.json +549 -0
- package/dist/client/assets/{AgentDetailView-Cu4TgvBn.js → AgentDetailView-CnFf_eBZ.js} +3 -3
- package/dist/client/assets/AgentPermissionPolicyEditor-CGxjOr6G.css +1 -0
- package/dist/client/assets/AgentPermissionPolicyEditor-Cmkt9Z01.js +6 -0
- package/dist/client/assets/{AgentsView-CIH4Acck.js → AgentsView-LkVv9hph.js} +3 -3
- package/dist/client/assets/ChatView-DYjECCRG.js +1 -0
- package/dist/client/assets/{DevServerView-Bd8JZ-3C.js → DevServerView-D7legPr1.js} +1 -1
- package/dist/client/assets/{DevServerView-DlZpuAnj.css → DevServerView-VTQY28P7.css} +1 -1
- package/dist/client/assets/{DirectoryPicker-BOGqZNiq.js → DirectoryPicker-DctpCNrd.js} +1 -1
- package/dist/client/assets/DocumentsView-DORp5JjC.js +1 -0
- package/dist/client/assets/EvalsView-CYVJ1pbc.js +1 -0
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-BM7EnSvJ.js → ExperimentalAgentOnboardingModal-BULVNAiq.js} +1 -1
- package/dist/client/assets/GoalsView-Cg136Jcn.css +1 -0
- package/dist/client/assets/GoalsView-bmpZKOI_.js +1 -0
- package/dist/client/assets/{InsightsView-B0J4mhzV.css → InsightsView-C9-mqVvf.css} +1 -1
- package/dist/client/assets/InsightsView-mmtem0RU.js +11 -0
- package/dist/client/assets/{MemoryView-CE1D9euM.js → MemoryView-HVpO1fCH.js} +2 -2
- package/dist/client/assets/{NodesView-Zxusnhxu.js → NodesView-CM0eoCP8.js} +3 -3
- package/dist/client/assets/{PiExtensionsManager-BlMmxtLZ.js → PiExtensionsManager-Cyfas2VT.js} +2 -2
- package/dist/client/assets/{PluginManager-D4eZ0zA4.js → PluginManager-C7QDE3Lk.js} +1 -1
- package/dist/client/assets/ReliabilityView-C1C1j1SD.js +1 -0
- package/dist/client/assets/ReliabilityView-D9AsVv5l.css +1 -0
- package/dist/client/assets/ResearchView-Bn2WxwnQ.js +1 -0
- package/dist/client/assets/SecretsView-BFhVwJu6.css +1 -0
- package/dist/client/assets/SecretsView-DgrrgzFc.js +1 -0
- package/dist/client/assets/SettingsModal-BCZrCLl3.js +31 -0
- package/dist/client/assets/{SettingsModal-sp7SNwS9.css → SettingsModal-BZBV2kLr.css} +1 -1
- package/dist/client/assets/{SettingsModal-BAx4gt2A.css → SettingsModal-DZrJ5PFH.css} +1 -1
- package/dist/client/assets/{SettingsModal-DRnZ6eBW.js → SettingsModal-YCJM5is3.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-BmmRM3g-.js → SetupWizardModal-BT-mj3VD.js} +1 -1
- package/dist/client/assets/{SkillsView-DWVtT2-8.js → SkillsView-Db7dYpqd.js} +1 -1
- package/dist/client/assets/{StashRecoveryView-CKkaWzzc.js → StashRecoveryView-CSYYcWux.js} +1 -1
- package/dist/client/assets/TodoView-zqCqfy26.js +6 -0
- package/dist/client/assets/dashboard-view-PpcsMDvN.js +21 -0
- package/dist/client/assets/{folder-open-BTN2_Wuv.js → folder-open-mxsFQlAX.js} +1 -1
- package/dist/client/assets/index-Ba-F8c1g.js +732 -0
- package/dist/client/assets/index-D4HhaIOp.css +1 -0
- package/dist/client/assets/{upload-euJEs_N2.js → upload-j7JjaJzG.js} +1 -1
- package/dist/client/assets/{users-B7miEHCZ.js → users-DZ_0WcB6.js} +1 -1
- package/dist/client/index.html +15 -27
- package/dist/client/version.json +1 -1
- package/dist/droid-cli/package.json +1 -1
- package/dist/extension.js +52863 -36171
- package/dist/pi-claude-cli/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +1 -1
- package/skill/fusion/SKILL.md +2 -2
- package/skill/fusion/references/cli-commands.md +1 -1
- package/skill/fusion/references/engine-tools.md +1 -0
- package/skill/fusion/references/extension-tools.md +23 -2
- package/skill/fusion/references/fusion-capabilities.md +4 -2
- package/skill/fusion/workflows/task-management.md +1 -1
- package/dist/client/assets/AgentPermissionPolicyEditor-Ceg2Dszn.js +0 -6
- package/dist/client/assets/AgentPermissionPolicyEditor-CthjqUL_.css +0 -1
- package/dist/client/assets/ChatView-DqJoFquZ.js +0 -1
- package/dist/client/assets/DocumentsView-B-ELcw4o.js +0 -1
- package/dist/client/assets/EvalsView-Ccl9QBYN.js +0 -1
- package/dist/client/assets/InsightsView-DLF49bzu.js +0 -11
- package/dist/client/assets/ReliabilityView-KmH60I_5.js +0 -1
- package/dist/client/assets/ReliabilityView-rxA_HgEG.css +0 -1
- package/dist/client/assets/ResearchView-C14Zh7c9.js +0 -1
- package/dist/client/assets/SettingsModal-c1QwWno0.js +0 -31
- package/dist/client/assets/TodoView-hbD0NOCY.js +0 -6
- package/dist/client/assets/dashboard-view-VNPB3ca0.js +0 -21
- package/dist/client/assets/index-CZFBq256.css +0 -1
- package/dist/client/assets/index-DzSLVOnp.js +0 -695
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{r as t,j as R}from"./vendor-react-K0fH_qHe.js";import{cr as Ee,cs as ve,t as Ye,w as je,bh as Xe}from"./index-Ba-F8c1g.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:m,onDoubleTap:M}){const[C,I]=t.useState(!1),w=t.useRef(null),T=t.useRef(s),_=t.useRef(!1),n=t.useRef(null),h=t.useRef(!1);T.current=s,h.current=C;const l=t.useCallback(()=>{n.current=null},[]),b=t.useCallback(u=>{w.current=null,I(!1),h.current=!1,u&&(c?.(!1),m?.(),_.current=!0,l())},[m,c,l]),z=t.useCallback(u=>{if(!u.isPrimary)return;if(u.defaultPrevented){l();return}const P=Date.now();n.current&&P-n.current.timeStamp>ke&&l(),a&&u.stopPropagation();const D=u.currentTarget;a&&typeof D.setPointerCapture=="function"&&D.setPointerCapture(u.pointerId),w.current={pointerId:u.pointerId,pointerType:u.pointerType,startPointer:{x:u.clientX,y:u.clientY},startPosition:T.current,defaultPrevented:u.defaultPrevented,movedBeyondThreshold:!1}},[a,l]),v=t.useCallback(u=>{const P=w.current;if(!P||P.pointerId!==u.pointerId)return;a&&u.stopPropagation();const D=u.clientX-P.startPointer.x,Y=u.clientY-P.startPointer.y,ee=Math.hypot(D,Y);if(ee>=xe&&(P.movedBeyondThreshold=!0),!a){P.movedBeyondThreshold&&l();return}if(!h.current&&ee>=xe&&(I(!0),h.current=!0,c?.(!0),l()),ee<xe)return;const W=r>0?r:1;f(o,{x:P.startPosition.x+D/W,y:P.startPosition.y+Y/W})},[a,c,f,l,r,o]),L=t.useCallback((u,P)=>{if(!M||P.defaultPrevented||P.movedBeyondThreshold)return Date.now()-(n.current?.timeStamp??0)>ke&&l(),!1;if(P.pointerType==="mouse")return l(),!1;const D={timeStamp:Date.now(),point:{x:P.startPointer.x,y:P.startPointer.y}},Y=n.current;return!Y||D.timeStamp-Y.timeStamp>ke||Math.hypot(D.point.x-Y.point.x,D.point.y-Y.point.y)>Ae?(n.current=D,!1):(_.current=!0,l(),M(),!0)},[M,l]),$=t.useCallback(u=>{const P=w.current;if(!P||P.pointerId!==u.pointerId)return;a&&u.stopPropagation(),a&&typeof u.currentTarget.hasPointerCapture=="function"&&u.currentTarget.hasPointerCapture(u.pointerId)&&typeof u.currentTarget.releasePointerCapture=="function"&&u.currentTarget.releasePointerCapture(u.pointerId);const D=h.current;!D&&L(u,P)&&u.preventDefault(),b(D)},[a,b,L]),G=t.useCallback(u=>{const P=w.current;!P||P.pointerId!==u.pointerId||(a&&u.stopPropagation(),a&&typeof u.currentTarget.hasPointerCapture=="function"&&u.currentTarget.hasPointerCapture(u.pointerId)&&typeof u.currentTarget.releasePointerCapture=="function"&&u.currentTarget.releasePointerCapture(u.pointerId),l(),b(h.current))},[a,b,l]),A=t.useCallback(u=>{_.current&&(_.current=!1,u.preventDefault(),u.stopPropagation())},[]);return t.useMemo(()=>({isDragging:C,onPointerDown:z,onPointerMove:v,onPointerUp:$,onPointerCancel:G,onClickCapture:A}),[C,A,G,z,v,$])}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:m,onMouseLeave:M,onClick:C,onNodePositionChange:I,onNodeDragStateChange:w,onNodeDragEnd:T,..._}){const{task:n,globalPaused:h,taskStuckTimeoutMs:l,lastFetchTimeMs:b,onOpenDetail:z}=_,v=n.status==="failed",L=n.paused===!0,$=Ee(n,l,b),G=n.column==="triage"&&n.status==="awaiting-approval",A=!h&&!v&&!L&&!$&&!G&&(n.column==="in-progress"||Ge.has(n.status)),u=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":""}${A?" graph-task-node--active":""}${P?" graph-task-node--in-review":""}`,style:o,draggable:!1,"data-testid":`graph-task-node-${n.id}`,"data-current-step":A&&u?String(n.currentStep):void 0,onMouseEnter:m,onMouseLeave:M,onClick:C,onDoubleClick:Y=>{Y.defaultPrevented||z(n)},onClickCapture:D.onClickCapture,onPointerDown:D.onPointerDown,onPointerMove:D.onPointerMove,onPointerUp:D.onPointerUp,onPointerCancel:D.onPointerCancel,children:[A?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 m=!!(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=m&&(c?.has(w)??!1),_=C.x+r/2,n=C.y+(f?.get(M.source)??a),h=I.x+r/2,l=I.y,b=n+(l-n)/2;return R.jsx("path",{"data-testid":"dependency-edge","data-edge-id":w,className:`dependency-graph-edge${T?" graph-edge--highlighted":""}${m&&!T?" graph-edge--dimmed":""}`,d:`M ${_} ${n} C ${_} ${b}, ${h} ${b}, ${h} ${l}`,fill:"none",stroke:T?"var(--todo)":"var(--border)",strokeWidth:T?"var(--space-xs)":"var(--btn-border-width)",opacity:m&&!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 m=a.filter(n=>(c.get(n)??0)===0),M=[];for(;m.length>0;){const n=m.shift();M.push(n);for(const h of f.get(n)??[]){const l=(c.get(h)??0)-1;c.set(h,l),l===0&&m.push(h)}}for(const n of a)M.includes(n)||M.push(n);const C=new Map;for(const n of M){const h=o.edges.filter(b=>b.source===n).map(b=>b.target);let l=0;for(const b of h)l=Math.max(l,(C.get(b)??0)+1);C.set(n,l)}const I=new Map;for(const n of a){const h=C.get(n)??0,l=I.get(h)??[];l.push(n),I.set(h,l)}const w=new Map,T=Array.from(I.keys()).sort((n,h)=>n-h),_=new Map;if(r.orientation==="vertical"){let n=0;for(const h of T){_.set(h,n);const l=I.get(h)??[],b=Math.max(r.nodeHeight,...l.map(z=>r.measuredHeights?.get(z)??r.nodeHeight));n+=b+r.verticalGap}}for(const n of T){const h=I.get(n)??[];if(h.sort(),r.orientation==="horizontal"){const L=-(h.reduce((A,u)=>A+(r.measuredHeights?.get(u)??r.nodeHeight),0)+Math.max(0,h.length-1)*r.verticalGap)/2,$=n*(r.nodeWidth+r.horizontalGap);let G=L;for(const A of h)w.set(A,{x:$,y:G}),G+=(r.measuredHeights?.get(A)??r.nodeHeight)+r.verticalGap;continue}const z=-(h.length*r.nodeWidth+Math.max(0,h.length-1)*r.horizontalGap)/2;h.forEach((v,L)=>{const $=z+L*(r.nodeWidth+r.horizontalGap),G=_.get(n)??n*(r.nodeHeight+r.verticalGap);w.set(v,{x:$,y:G})})}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),m=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(()=>{m.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]),h=t.useMemo(()=>Math.round(r*100),[r]),l=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,g,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,-g,g)};const U=d-x.maxX*S,O=-x.minX*S,j=g-x.maxY*S,B=-x.minY*S,Z=U>O?(U+O)/2:J(i.x,U,O),K=j>B?(j+B)/2:J(i.y,j,B);return{x:Z,y:K}},[]),z=t.useCallback((i,d,g,S)=>{const x=M.current,U=m.current,O=J(i,ce,ue),j=O/x,B=b({x:d.x-(d.x-U.x)*j,y:d.y-(d.y-U.y)*j},g,S,O);a(O),s(B)},[b]),v=t.useCallback((i,d,g,S)=>{l(!1);const x=S??{x:d/2,y:g/2};z(M.current*i,x,d,g)},[l,z]),L=t.useCallback((i,d)=>{if(i&&d){v(1.2,i,d);return}a(g=>J(g+.1,ce,ue))},[v]),$=t.useCallback((i,d)=>{if(i&&d){v(1/1.2,i,d);return}a(g=>J(g-.1,ce,ue))},[v]),G=t.useCallback(()=>{l(!0),s({x:0,y:0}),a(1)},[l]),A=t.useCallback((i,d,g,S)=>{if(l(!0),i.size===0){s({x:0,y:0}),a(1);return}const x=S?.nodeWidth??280,U=S?.nodeHeight??100,O=Array.from(i.entries()),j=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)??U))),te=Math.max(1,Z-j),X=Math.max(1,K-B),re=Math.max(1,d-Te*2),se=Math.max(1,g-Te*2),ne=J(Math.min(re/te,se/X),ce,ue),he=(d-te*ne)/2-j*ne,de=(g-X*ne)/2-B*ne;a(ne),s(b({x:he,y:de},d,g,ne))},[b,l]),u=t.useCallback((i,d)=>{if(w.current.set(i,d),w.current.size===2){const[g,S]=Array.from(w.current.values());T.current={distance:Math.hypot(g.x-S.x,g.y-S.y),zoom:M.current,pan:m.current,midpoint:{x:(g.x+S.x)/2,y:(g.y+S.y)/2}},I.current=null;return}I.current={start:d,panStart:m.current}},[]),P=t.useCallback((i,d,g,S)=>{if(w.current.has(i)&&w.current.set(i,d),w.current.size===2&&T.current){l(!1);const[O,j]=Array.from(w.current.values()),Z=Math.hypot(O.x-j.x,O.y-j.y)/Math.max(1,T.current.distance),K={x:(O.x+j.x)/2,y:(O.y+j.y)/2},te=J(T.current.zoom*Z,ce,ue),X=te/T.current.zoom,re=b({x:K.x-(T.current.midpoint.x-T.current.pan.x)*X,y:K.y-(T.current.midpoint.y-T.current.pan.y)*X},g,S);a(te),s(re);return}const x=I.current;if(!x)return;l(!1);const U={x:x.panStart.x+(d.x-x.start.x),y:x.panStart.y+(d.y-x.start.y)};s(b(U,g,S))},[b,l]),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:m.current};return}w.current.size===0&&(I.current=null)},[]),Y=t.useCallback((i,d,g,S)=>{l(!1);const x={x:m.current.x-i,y:m.current.y-d};s(b(x,g,S))},[b,l]),ee=t.useCallback((i,d,g,S)=>{const x=i<0?1.1:.9;l(!1),z(M.current*x,d,g,S)},[l,z]),W=t.useCallback(i=>{_.current=i},[]),le=t.useCallback((i,d,g,S,x)=>{if(ct(i.target))return;const U=i.metaKey||i.ctrlKey;if(i.key==="Escape"){i.preventDefault(),G();return}if(U){if(i.key==="="||i.key==="+"){i.preventDefault(),v(1.2,d,g);return}if(i.key==="-"){i.preventDefault(),v(1/1.2,d,g);return}if(i.key==="0"){i.preventDefault(),G();return}(i.key==="f"||i.key==="F")&&i.shiftKey&&(i.preventDefault(),A(S,d,g,x))}},[A,G,v]);return{pan:o,zoom:r,zoomPercent:h,transform:n,transitioning:f,zoomIn:L,zoomOut:$,resetView:G,fitToGraph:A,setAnimate:l,onPointerDown:u,onPointerMove:P,onPointerUp:D,onWheelPan:Y,onWheelZoom:ee,handleKeyDown:le,setGraphBounds:W}}function lt(o){const{upstreamMap:s,downstreamMap:r}=t.useMemo(()=>{const f=new Map,c=new Map;for(const m of o)f.set(m.id,new Set(m.dependencies??[])),c.has(m.id)||c.set(m.id,new Set);for(const m of o)for(const M of m.dependencies??[])c.has(M)||c.set(M,new Set),c.get(M)?.add(m.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]),m=(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 m(f,s),m(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=Ye(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);je(Me,JSON.stringify(a),r)}function pt(o){Xe(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(m=>{ft(m,s,o),a(mt(m,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:m,onArchiveTask:M,onUnarchiveTask:C,onDeleteTask:I,onRetryTask:w,onOpenDetailWithTab:T,taskStuckTimeoutMs:_,onOpenMission:n,onMoveTask:h,lastFetchTimeMs:l,workflowStepNameLookup:b}){const z=t.useRef(null),v=t.useRef(!1),L=t.useRef(null),$=t.useRef(!1),G=t.useRef(new Map),[A,u]=t.useState(null),[P,D]=t.useState(null),[Y,ee]=t.useState({width:0,height:0}),[W,le]=t.useState(new Map),i=t.useMemo(()=>rt(o),[o]),d=it(i),{getChain:g}=lt(i),S=A??P,x=t.useMemo(()=>S?g(S):new Set,[S,g]),U=t.useMemo(()=>{const e=Y.width||(typeof window<"u"?window.innerWidth:0);return(Y.height||(typeof window<"u"?window.innerHeight:0))>e||e<yt?"horizontal":"vertical"},[Y.height,Y.width]),O=t.useMemo(()=>({nodeWidth:ae,nodeHeight:Q,horizontalGap:40,verticalGap:80,orientation:U,measuredHeights:W}),[W,U]),j=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}),[X,re]=t.useState(j),[se,ne]=t.useState(!1);t.useEffect(()=>{const e={};for(const[y,H]of j.entries())e[y]=H;const p=Z?ht(e,Z,B):e;re(new Map(Object.entries(p)))},[j,Z,B]),t.useEffect(()=>{const e=z.current;if(!e)return;const p=(H,E)=>{ee(k=>k.width===H&&k.height===E?k:{width:H,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 y=new ResizeObserver(H=>{const E=H[0];E&&p(E.contentRect.width,E.contentRect.height)});return y.observe(e),()=>y.disconnect()},[]),t.useEffect(()=>{const e=z.current;if(!e)return;const p=new Set(d.nodes.map(k=>k.task.id)),y=new Map;for(const k of p){const N=e.querySelector(`[data-testid="graph-task-node-${k}"]`);N&&y.set(k,N)}G.current=y,le(k=>{let N=!1;const F=new Map;for(const[oe,ie]of k.entries()){if(!p.has(oe)){N=!0;continue}F.set(oe,ie)}return N?F:k});const H=(k,N)=>{le(F=>{const oe=F.get(k);if(oe!==void 0&&Math.abs(oe-N)<1)return F;const ie=new Map(F);return ie.set(k,N),ie})};for(const[k,N]of y.entries())H(k,N.offsetHeight||Q);if(typeof ResizeObserver>"u")return;const E=new ResizeObserver(k=>{for(const N of k){const F=N.target,oe=Array.from(y.entries()).find(([,ie])=>ie===F)?.[0];oe&&H(oe,F.offsetHeight||Q)}});for(const k of y.values())E.observe(k);return()=>E.disconnect()},[d.nodes,X,Y.height,Y.width]);const{transform:he,zoom:de,transitioning:q,zoomIn:me,zoomOut:De,resetView:Re,fitToGraph:ge,onPointerDown:Ie,onPointerMove:ze,onPointerUp:be,onWheelPan:He,onWheelZoom:Ne,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(X,p.clientWidth,p.clientHeight,{nodeWidth:ae,nodeHeight:Q,measuredHeights:W}),v.current=!0)},[i.length,ge,W,X,Z]);const V=t.useMemo(()=>{const e=Array.from(X.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)),y=Math.min(...e.map(k=>k.y)),H=Math.max(...e.map(k=>k.x+ae)),E=Math.max(...Array.from(X.entries()).map(([k,N])=>N.y+(W.get(k)??Q)));return{minX:p,minY:y,maxX:H,maxY:E,width:Math.max(0,H-p),height:Math.max(0,E-y)}},[W,X]),ye=t.useMemo(()=>{if(X.size===0)return X;const e=new Map;for(const[p,y]of X.entries())e.set(p,{x:y.x-V.minX,y:y.y-V.minY});return e},[V.minX,V.minY,X]);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,y]of X.entries())e[p]=y;K(e)},[K,X]);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},$.current=!1,Ie(e.pointerId,{x:e.clientX,y:e.clientY}))},onPointerMove:e=>{if(se)return;const p=z.current;if(!p)return;const y=L.current;if(y){const H=Math.abs(e.clientX-y.x),E=Math.abs(e.clientY-y.y);(H>Ce||E>Ce)&&($.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,$.current=!1},onWheel:e=>{e.preventDefault();const p=z.current;if(p){if(e.ctrlKey||e.metaKey){const y=p.getBoundingClientRect();Ne(e.deltaY,{x:e.clientX-y.left,y:e.clientY-y.top},p.clientWidth,p.clientHeight);return}He(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:W})},tabIndex:0,onClick:()=>{$.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:W,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:(y,H)=>{re(E=>{const k={x:H.x+V.minX,y:H.y+V.minY},N=E.get(y);if(N&&N.x===k.x&&N.y===k.y)return E;const F=new Map(E);return F.set(y,k),F})},onNodeDragStateChange:ne,onNodeDragEnd:_e,isHighlighted:x.size>0&&x.has(e.task.id),isDimmed:x.size>0&&!x.has(e.task.id),onOpenDetail:a??(y=>r?.(y.id)),addToast:f??(()=>{}),globalPaused:c,onUpdateTask:m,onArchiveTask:M,onUnarchiveTask:C,onDeleteTask:I,onRetryTask:w,onOpenDetailWithTab:T,taskStuckTimeoutMs:_,onOpenMission:n,onMoveTask:h,lastFetchTimeMs:l,workflowStepNameLookup:b,onMouseEnter:()=>u(e.task.id),onMouseLeave:()=>u(null),onClick:y=>{y.stopPropagation(),$.current=!1,D(H=>H===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),y=new Map,H=Array.from(p.values()),E=H.length>0?Math.min(...H.map(N=>N.x)):0,k=H.length>0?Math.min(...H.map(N=>N.y)):0;for(const[N,F]of p.entries())y.set(N,{x:F.x-E,y:F.y-k});ge(y,e.clientWidth,e.clientHeight,{nodeWidth:ae,nodeHeight:Q,measuredHeights:W})},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};
|