@ngocsangairvds/vsaf 5.7.0 → 5.9.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/package.json +1 -1
- package/packages/web/dist/web/browser/chunk-33F7AVPH.js +1 -0
- package/packages/web/dist/web/browser/chunk-4R37VVI4.js +5 -0
- package/packages/web/dist/web/browser/{chunk-TTPORHEG.js → chunk-6H3AYIT3.js} +1 -1
- package/packages/web/dist/web/browser/{chunk-LPQARKUF.js → chunk-7ELOO4IC.js} +1 -1
- package/packages/web/dist/web/browser/chunk-FBCNCNPM.js +4 -0
- package/packages/web/dist/web/browser/{chunk-S76O6O57.js → chunk-FE2VGLSN.js} +1 -1
- package/packages/web/dist/web/browser/{chunk-FFYMNCCZ.js → chunk-GR7SKUVU.js} +1 -1
- package/packages/web/dist/web/browser/{chunk-IBSRIWBK.js → chunk-L7B3BT5E.js} +1 -1
- package/packages/web/dist/web/browser/{chunk-YBYKUHHQ.js → chunk-MCW5ACIZ.js} +1 -1
- package/packages/web/dist/web/browser/{chunk-UN7U5NAR.js → chunk-N3FOQ3O5.js} +1 -1
- package/packages/web/dist/web/browser/chunk-UDCOYDXU.js +1 -0
- package/packages/web/dist/web/browser/index.html +2 -2
- package/packages/web/dist/web/browser/{main-7PKVTIG7.js → main-3UCJ3N4F.js} +1 -1
- package/packages/web/dist/web/browser/styles-5MTP4CCO.css +1 -0
- package/packages/web/dist/web/browser/chunk-NSKD5KW7.js +0 -4
- package/packages/web/dist/web/browser/chunk-VA6YRKIE.js +0 -1
- package/packages/web/dist/web/browser/chunk-WDOCF7IL.js +0 -5
- package/packages/web/dist/web/browser/styles-MG7ITKTI.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ie}from"./chunk-33F7AVPH.js";import{b as ve,e as _e}from"./chunk-N3FOQ3O5.js";import{a as xe,b as ye,e as Ce,j as Ee,k as P}from"./chunk-7ELOO4IC.js";import{$,Ba as N,Fa as U,J as ne,Ka as C,Kb as ge,La as f,Lb as he,Ma as b,Mb as fe,Na as oe,O as y,Oa as O,Pa as F,Pb as be,Qa as m,Qb as M,Ra as a,Sa as o,T as I,Ta as E,U as S,V as k,Wb as we,Xa as D,Ya as g,Za as c,a as Z,aa as ie,b as ee,bb as se,cb as ae,db as de,ea as re,f as te,gb as G,ib as l,jb as v,kb as H,lb as A,mb as le,nb as ue,oa as B,ob as pe,qa as s,sb as ce,tb as me}from"./chunk-4R37VVI4.js";var j=class i{zone=y(ie);projectService=y(we);connect(t){return new te(e=>{let n=this.projectService.currentId,r=n?`?project=${encodeURIComponent(n)}`:"",d=new EventSource(`/api/runs/${t}/events${r}`),_=["node:start","node:complete","node:skip","node:fail","run:complete","run:state","run:pause","run:cancel"];for(let p of _)d.addEventListener(p,u=>{this.zone.run(()=>{e.next({type:p,data:JSON.parse(u.data)})})});return d.onerror=()=>{this.zone.run(()=>{e.complete()}),d.close()},()=>{d.close()}})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ne({token:i,factory:i.\u0275fac,providedIn:"root"})};var $e=new Set(["completed","failed","cancelled"]);function X(i){return i!==void 0&&$e.has(i)}function Se(i,t=new Date().toISOString()){X(i.status)&&!i.completedAt&&(i.completedAt=t)}var He="Approval required",Pe="Run paused \u2014 input required to continue.";function V(i){return`${i.nodeId}\0${i.iteration??""}\0${i.message}`}function De(i){let t=ke(i);if(t)return t;let e=i.approval;if(e&&typeof e=="object")return ke(e)}function ke(i){let t=T(i.approvalNodeId)??T(i.nodeId);if(!t)return;let e=T(i.approvalMessage)??T(i.message),n=T(i.approvalType)??T(i.type),r=i.iteration;return{nodeId:t,message:e||He,type:n==="interactive_loop"?"interactive_loop":"approval",iteration:typeof r=="number"?r:void 0}}function T(i){return typeof i=="string"&&i!==""?i:void 0}var K=class{current;state="hidden";error;answeredKey;pauseReceived(t){this.current=De(t)??Ne(),this.state="ready",this.error=void 0}runStateChanged(t,e){if(t!=="paused"){this.current=void 0,this.state="hidden",this.error=void 0,this.answeredKey=void 0;return}if(this.state==="submitting")return;let n=e?De(e):void 0,r=n?V(n):void 0;r!==void 0&&r===this.answeredKey||this.current&&r!==void 0&&r===V(this.current)||this.current&&n===void 0||(this.current=n??Ne(),this.state="ready",this.error=void 0)}submitStarted(){this.state!=="hidden"&&(this.state="submitting",this.error=void 0)}submitFailed(t){this.state!=="hidden"&&(this.state="error",this.error=t)}submitSucceeded(){this.current&&(this.answeredKey=V(this.current)),this.current=void 0,this.state="hidden",this.error=void 0}visible(){return this.state!=="hidden"}phase(){return this.state}request(){return this.current}errorMessage(){return this.error}submitAction(){return this.current?.type==="interactive_loop"?"resume":"approve"}};function Ne(){return{nodeId:"",message:Pe,type:"approval"}}function Me(i,t,e=new Date().toISOString()){let n=`gate:${V(t)}`;return i.some(r=>r.key===n)?i:[...i,{key:n,role:"gate",text:t.message,at:e,nodeId:t.nodeId,iteration:t.iteration}]}function Q(i,t,e,n=new Date().toISOString()){return[...i,{key:`user:${i.length}:${n}`,role:"user",kind:t,text:je(t,e),at:n}]}function je(i,t){let e=t.trim();switch(i){case"answer":return e;case"approve":return e?`Approved: ${e}`:"Approved";case"reject":return e?`Rejected: ${e}`:"Rejected"}}function Te(i){return Ke(i).split(/`([^`]*)`/).map((n,r)=>r%2===1?`<code>${n}</code>`:n.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>")).join("").replace(/\n/g,"<br>")}function Ke(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var We=["host"];function ze(i,t){if(i&1&&(k(),E(0,"path",9)),i&2){let e=t.$implicit;C("d",e)}}function qe(i,t){if(i&1&&(k(),a(0,"text",16),l(1),o()),i&2){let e=c().$implicit,n=c();C("x",n.NODE_W-12)("y",n.NODE_H/2+5),s(),A("",e.progress.done,"/",e.progress.total)}}function Be(i,t){if(i&1&&(k(),a(0,"text",17),l(1,"\u29C9"),o()),i&2){let e=c(2);C("x",e.NODE_W-12)("y",14)}}function Ue(i,t){if(i&1){let e=D();k(),a(0,"g",10),g("click",function(){let r=I(e).$implicit,d=c();return S(d.nodeClick.emit(r.key))}),E(1,"rect",11),a(2,"text",12),l(3),o(),a(4,"text",13),l(5),o(),U(6,qe,2,4,"text",14)(7,Be,2,2,"text",15),o()}if(i&2){let e=t.$implicit,n=c();C("transform","translate("+e.x+","+e.y+")"),s(),G("dag-pulse",e.status==="running"),C("width",n.NODE_W)("height",n.NODE_H)("fill",n.fillFor(e.status))("stroke",n.strokeFor(e.status)),s(),C("y",n.NODE_H/2+5)("fill",n.strokeFor(e.status)),s(),v(n.icon(e.status)),s(),C("y",n.NODE_H/2+5),s(),v(n.clip(e.label)),s(),m("ngIf",e.progress),s(),m("ngIf",e.isGroup)}}var R=class i{NODE_W=168;NODE_H=44;nodes=[];edges=[];width=0;height=0;nodeClick=new $;hostRef;scale=1;panX=16;panY=40;dragging=!1;lastX=0;lastY=0;get edgePaths(){let t=new Map(this.nodes.map(n=>[n.key,n])),e=[];for(let n of this.edges){let r=t.get(n.from),d=t.get(n.to);if(!r||!d)continue;let _=r.x+168/2,p=r.y+44,u=d.x+168/2,x=d.y,h=(p+x)/2;e.push(`M${_} ${p} C${_} ${h}, ${u} ${h}, ${u} ${x}`)}return e}onWheel(t){t.preventDefault(),this.zoomBy(t.deltaY<0?1.1:.9)}zoomBy(t,e){e?.stopPropagation(),this.scale=Math.min(2.5,Math.max(.2,this.scale*t))}onDown(t){this.dragging=!0,this.lastX=t.clientX,this.lastY=t.clientY}onMove(t){this.dragging&&(this.panX+=t.clientX-this.lastX,this.panY+=t.clientY-this.lastY,this.lastX=t.clientX,this.lastY=t.clientY)}onUp(){this.dragging=!1}fit(){if(!this.width||!this.height){this.scale=1,this.panX=16,this.panY=40;return}let t=this.hostRef?.nativeElement,e=t?.clientWidth??600,n=t?.clientHeight??400;this.scale=Math.min(2,Math.max(.2,Math.min((e-32)/this.width,(n-48)/this.height))),this.panX=Math.max(16,(e-this.width*this.scale)/2),this.panY=44}clip(t){return t.length>20?t.slice(0,19)+"\u2026":t}icon(t){return{completed:"\u2713",running:"\u25CF",failed:"\u2717",skipped:"\u2298"}[t]??"\u25CB"}fillFor(t){return{completed:"rgba(34,197,94,.14)",running:"rgba(59,130,246,.16)",failed:"rgba(239,68,68,.14)"}[t]??"rgba(30,41,59,.9)"}strokeFor(t){return{completed:"#22c55e",running:"#3b82f6",failed:"#ef4444",skipped:"#64748b"}[t]??"#475569"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=N({type:i,selectors:[["app-dag-graph"]],viewQuery:function(e,n){if(e&1&&se(We,5),e&2){let r;ae(r=de())&&(n.hostRef=r.first)}},inputs:{nodes:"nodes",edges:"edges",width:"width",height:"height"},outputs:{nodeClick:"nodeClick"},decls:16,vars:7,consts:[["host",""],[1,"relative","w-full","h-full","overflow-hidden","select-none","bg-slate-950/40",3,"wheel","mousedown","mousemove","mouseup","mouseleave"],[1,"absolute","top-2","left-2","z-10","flex","gap-1","items-center"],["type","button",1,"dag-btn",3,"click"],[1,"text-xs","text-slate-400","w-10","text-center","font-mono"],["type","button",1,"dag-btn","px-2","w-auto",3,"click"],[1,"absolute","inset-0","w-full","h-full"],["fill","none","stroke","#475569","stroke-width","2","opacity","0.8",4,"ngFor","ngForOf"],["class","cursor-pointer",3,"click",4,"ngFor","ngForOf"],["fill","none","stroke","#475569","stroke-width","2","opacity","0.8"],[1,"cursor-pointer",3,"click"],["rx","9","stroke-width","2"],["x","16","font-size","15"],["x","34","font-size","13","fill","#e2e8f0"],["text-anchor","end","font-size","10","fill","#94a3b8",4,"ngIf"],["text-anchor","end","font-size","11","fill","#94a3b8",4,"ngIf"],["text-anchor","end","font-size","10","fill","#94a3b8"],["text-anchor","end","font-size","11","fill","#94a3b8"]],template:function(e,n){e&1&&(a(0,"div",1,0),g("wheel",function(d){return n.onWheel(d)})("mousedown",function(d){return n.onDown(d)})("mousemove",function(d){return n.onMove(d)})("mouseup",function(){return n.onUp()})("mouseleave",function(){return n.onUp()}),a(2,"div",2)(3,"button",3),g("click",function(d){return n.zoomBy(.8,d)}),l(4,"\u2212"),o(),a(5,"span",4),l(6),ce(7,"number"),o(),a(8,"button",3),g("click",function(d){return n.zoomBy(1.25,d)}),l(9,"+"),o(),a(10,"button",5),g("click",function(){return n.fit()}),l(11,"fit"),o()(),k(),a(12,"svg",6)(13,"g"),U(14,ze,1,1,"path",7)(15,Ue,8,14,"g",8),o()()()),e&2&&(s(6),H("",me(7,4,n.scale*100,"1.0-0"),"%"),s(7),C("transform","translate("+n.panX+","+n.panY+") scale("+n.scale+")"),s(),m("ngForOf",n.edgePaths),s(),m("ngForOf",n.nodes))},dependencies:[M,he,fe,be],styles:[".dag-btn[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #334155;border-radius:6px;background:#1e293b;color:#94a3b8;font-size:13px;line-height:1}.dag-btn[_ngcontent-%COMP%]:hover{color:#e2e8f0}.dag-pulse[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_dagpulse 1.3s ease-in-out infinite}@keyframes _ngcontent-%COMP%_dagpulse{0%,to{opacity:1}50%{opacity:.45}}"]})};function L(i,t=""){let e=t===""?"":t+".",n=i.filter(u=>t===""||u.id===t||u.id.startsWith(e)),r=new Map(i.map(u=>[u.id,u])),d=new Map;for(let u of n){let x=t===""?u.id:u.id.slice(e.length),h=x.split(".")[0];if(!h)continue;let w=d.get(h);w||(w={key:e+h,label:h,leafIds:[],deeper:!1},d.set(h,w)),w.leafIds.push(u.id),x.includes(".")&&(w.deeper=!0)}let _=u=>{if(t!==""&&u!==t&&!u.startsWith(e))return;let h=(t===""?u:u.slice(e.length)).split(".")[0];return d.has(h)?e+h:void 0},p=[];for(let u of d.values()){let x=new Set;for(let h of u.leafIds)for(let w of r.get(h)?.dependsOn??[]){let q=_(w);q&&q!==u.key&&x.add(q)}p.push({key:u.key,label:u.label,isGroup:u.deeper,leafIds:u.leafIds,dependsOn:[...x]})}return p}var Fe=new Set(["completed","skipped"]);function Ge(i,t){let e=i.map(t);return e.some(n=>n==="failed")?"failed":e.some(n=>n==="running")?"running":e.length>0&&e.every(n=>n==="skipped")?"skipped":e.length>0&&e.every(n=>Fe.has(n))?"completed":e.some(n=>n==="completed")?"running":"pending"}function Ae(i,t){let e=i.map(t);return{done:e.filter(n=>Fe.has(n)).length,total:e.length}}function W(i,t,e=""){let n=L(i,e),r=Ie(n.map(p=>({key:p.key,dependsOn:p.dependsOn}))),d=n.map(p=>{let u=r.positions.get(p.key)??{x:0,y:0};return{key:p.key,label:p.label,isGroup:p.isGroup,status:p.isGroup?Ge(p.leafIds,t):t(p.leafIds[0]),progress:p.isGroup?Ae(p.leafIds,t):void 0,x:u.x,y:u.y}}),_=[];for(let p of n)for(let u of p.dependsOn)_.push({from:u,to:p.key});return{vms:d,edges:_,width:r.width,height:r.height}}function Ye(i,t){i&1&&(a(0,"span"),l(1," \u203A "),o())}function Xe(i,t){if(i&1){let e=D();a(0,"button",10),g("click",function(){let r=I(e).$implicit,d=c();return S(d.goTo(r))}),l(1),o(),f(2,Ye,2,0,"span")}if(i&2){let e=t.$implicit,n=t.$index,r=t.$count,d=c();s(),v(d.label(e)),s(),b(n!==r-1?2:-1)}}function Qe(i,t){i&1&&(a(0,"div",11),l(1,"\u0110ang t\u1EA3i output\u2026"),o())}function Je(i,t){if(i&1&&(a(0,"div",12),l(1),o()),i&2){let e=c(2);s(),v(e.leafError)}}function Ze(i,t){if(i&1&&(a(0,"pre",13),l(1),o()),i&2){let e=c(3);s(),v(e.leafData==null?null:e.leafData.error)}}function et(i,t){if(i&1&&(a(0,"pre",14),l(1),o()),i&2){let e=c(3);s(),v(e.leafData==null?null:e.leafData.output)}}function tt(i,t){i&1&&(a(0,"div",15),l(1,"Kh\xF4ng c\xF3 output"),o())}function nt(i,t){if(i&1&&(f(0,Ze,2,1,"pre",13),f(1,et,2,1,"pre",14)(2,tt,2,0,"div",15)),i&2){let e=c(2);b(e.leafData!=null&&e.leafData.error?0:-1),s(),b(e.leafData!=null&&e.leafData.output?1:e.leafData!=null&&e.leafData.error?-1:2)}}function it(i,t){if(i&1&&(a(0,"div",8),f(1,Qe,2,0,"div",11)(2,Je,2,1,"div",12)(3,nt,3,2),o()),i&2){let e,n=c();s(),b((e=n.leafPhase)==="loading"?1:e==="error"?2:e==="loaded"?3:-1)}}function rt(i,t){if(i&1){let e=D();a(0,"app-dag-graph",16),g("nodeClick",function(r){I(e);let d=c();return S(d.onSubClick(r))}),o()}if(i&2){let e=c();m("nodes",e.subNodes)("edges",e.subEdges)("width",e.subWidth)("height",e.subHeight)}}var z=class i{api=y(P);runId="";nodes=[];statusOf=()=>"pending";rootKey="";close=new $;breadcrumb=[];isLeaf=!1;subNodes=[];subEdges=[];subWidth=0;subHeight=0;leafPhase="loading";leafData;leafError="";ngOnChanges(t){if(t.rootKey){this.breadcrumb=[],this.goTo(this.rootKey);return}(t.nodes||t.statusOf)&&!this.isLeaf&&this.breadcrumb.length&&this.buildSubView(this.breadcrumb[this.breadcrumb.length-1])}goTo(t){let e=this.breadcrumb.indexOf(t);this.breadcrumb=e>=0?this.breadcrumb.slice(0,e+1):[...this.breadcrumb,t];let n=L(this.nodes,t);if(this.isLeaf=n.length===0,this.isLeaf){this.loadLeaf(t);return}this.buildSubView(t)}buildSubView(t){let e=W(this.nodes,this.statusOf,t);this.subNodes=e.vms,this.subEdges=e.edges,this.subWidth=e.width,this.subHeight=e.height}onSubClick(t){this.goTo(t)}loadLeaf(t){this.leafPhase="loading",this.api.getNodeOutput(this.runId,t).subscribe({next:e=>{this.leafData={output:e.output,error:e.error},this.leafPhase="loaded"},error:e=>{this.leafError=e?.error?.error??"Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c output.",this.leafPhase="error"}})}label(t){return t.split(".").pop()??t}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=N({type:i,selectors:[["app-node-inspector"]],inputs:{runId:"runId",nodes:"nodes",statusOf:"statusOf",rootKey:"rootKey"},outputs:{close:"close"},features:[re],decls:13,vars:1,consts:[[1,"absolute","inset-0","z-20","flex"],[1,"absolute","inset-0","bg-black/40",3,"click"],[1,"relative","m-3","flex-1","max-w-[78%]","bg-slate-900","border","border-slate-700","rounded-xl","shadow-2xl","flex","flex-col","overflow-hidden"],[1,"flex","items-center","gap-2","px-4","py-2.5","border-b","border-slate-800","text-sm"],[1,"text-slate-500"],[1,"flex-1"],["type","button",1,"text-slate-400","hover:text-slate-100",3,"click"],[1,"flex-1","min-h-0","relative"],[1,"absolute","inset-0","overflow-auto","p-4","text-xs"],[3,"nodes","edges","width","height"],["type","button",1,"hover:text-slate-200",3,"click"],[1,"text-slate-500","animate-pulse"],[1,"text-red-400"],[1,"font-mono","text-red-300","bg-red-500/10","border","border-red-500/30","rounded","p-3","mb-2","whitespace-pre-wrap","break-words"],[1,"font-mono","text-slate-300","bg-slate-950","border","border-slate-800","rounded","p-3","whitespace-pre-wrap","break-words"],[1,"text-slate-500","italic"],[3,"nodeClick","nodes","edges","width","height"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1),g("click",function(){return n.close.emit()}),o(),a(2,"div",2)(3,"div",3)(4,"span",4),O(5,Xe,3,2,null,null,oe),o(),E(7,"span",5),a(8,"button",6),g("click",function(){return n.close.emit()}),l(9,"\u2715"),o()(),a(10,"div",7),f(11,it,4,1,"div",8)(12,rt,1,4,"app-dag-graph",9),o()()()),e&2&&(s(5),F(n.breadcrumb),s(6),b(n.isLeaf?11:12))},dependencies:[M,R],encapsulation:2})};var ot=(i,t)=>t.id,st=(i,t)=>t.key;function at(i,t){if(i&1&&(a(0,"span",6),l(1),o()),i&2){let e=c();m("ngClass",e.statusClass(e.run.status)),s(),A(" ",e.statusIcon(e.run.status)," ",e.run.status," ")}}function dt(i,t){i&1&&(a(0,"div",10),l(1,"Kh\xF4ng d\u1EF1ng \u0111\u01B0\u1EE3c s\u01A1 \u0111\u1ED3 ph\u1EE5 thu\u1ED9c \u2014 hi\u1EC3n th\u1ECB theo th\u1EE9 t\u1EF1 ch\u1EA1y."),o())}function lt(i,t){if(i&1){let e=D();a(0,"app-node-inspector",23),g("close",function(){I(e);let r=c();return S(r.closeInspector())}),o()}if(i&2){let e=c();m("runId",e.run.runId)("nodes",e.dagInputNodes)("statusOf",e.statusOf)("rootKey",e.inspectorKey)}}function ut(i,t){if(i&1&&(a(0,"div",24)(1,"div",25),E(2,"div",26),o()()),i&2){let e=t.$implicit,n=c();G("justify-end",e.role==="user"),s(),m("ngClass",e.role==="user"?"bg-indigo-500/15 text-indigo-100":"bg-slate-800 text-slate-200"),s(),m("innerHTML",n.render(e.content),B)}}function pt(i,t){i&1&&(a(0,"div",16),l(1,"\u2014 phi\xEAn hi\u1EC7n t\u1EA1i \u2014"),o())}function ct(i,t){if(i&1&&(a(0,"div",27),l(1),o()),i&2){let e=c().$implicit;s(),A(" \u23F8 ",e.nodeId||"gate","",e.iteration!==void 0?" \xB7 iteration "+e.iteration:""," ")}}function mt(i,t){if(i&1&&(a(0,"div",24)(1,"div",25),f(2,ct,2,2,"div",27),E(3,"div",26),o()()),i&2){let e=t.$implicit,n=c();G("justify-end",e.role==="user"),s(),m("ngClass",e.role==="user"?"bg-indigo-500/15 text-indigo-100":"bg-slate-800 text-slate-200"),s(),b(e.role==="gate"?2:-1),s(),m("innerHTML",n.render(e.text),B)}}function gt(i,t){if(i&1&&(a(0,"div",19),l(1),o()),i&2){let e=c();s(),v(e.gate.errorMessage())}}var Ve=class i{route=y(ve);api=y(P);sse=y(j);run;gate=new K;feed=[];messages=[];draft="";runId="";sseSub;timerInterval;focusAnswerOnShow=!1;dagNodes=[];dagEdges=[];dagWidth=0;dagHeight=0;dagInputNodes=[];statusMap=new Map;ngOnInit(){this.runId=this.route.snapshot.paramMap.get("runId"),this.focusAnswerOnShow=this.route.snapshot.fragment==="answer",this.api.getRun(this.runId).subscribe(t=>{this.run=t,t.conversationId&&this.api.getConversationMessages(t.conversationId).subscribe({next:e=>{this.messages=e.messages},error:()=>{this.messages=[]}}),this.rebuildDag(),this.stopTimerIfFinished(),this.syncGateFromRun()}),this.sseSub=this.sse.connect(this.runId).subscribe(t=>{this.handleSseEvent(t)}),this.timerInterval=setInterval(()=>{},1e3)}ngOnDestroy(){this.sseSub?.unsubscribe(),this.timerInterval&&clearInterval(this.timerInterval)}inspectorKey=null;onNodeClick(t){this.inspectorKey=t}closeInspector(){this.inspectorKey=null}hierInput(){let t=this.run?.graph?.nodes;if(t&&t.length)return t.map(n=>({id:n.id,dependsOn:n.dependsOn}));let e=this.run?Object.keys(this.run.nodes):[];return e.map((n,r)=>({id:n,dependsOn:r===0?[]:[e[r-1]]}))}statusOf=t=>this.statusMap.get(t)??"pending";syncStatusMap(){if(this.run)for(let[t,e]of Object.entries(this.run.nodes))this.statusMap.has(t)||this.statusMap.set(t,e.status)}rebuildDag(){if(!this.run)return;this.syncStatusMap(),this.dagInputNodes=this.hierInput();let t=W(this.dagInputNodes,this.statusOf,"");this.dagNodes=t.vms,this.dagEdges=t.edges,this.dagWidth=t.width,this.dagHeight=t.height}handleSseEvent(t){let e=t.data,n=e.nodeId;switch(t.type){case"run:state":{let r=e;this.run=ee(Z({},r),{graph:r.graph??this.run?.graph,conversationId:r.conversationId??this.run?.conversationId}),this.rebuildDag(),this.stopTimerIfFinished(),this.syncGateFromRun();break}case"run:pause":this.run&&(this.run.status="paused"),this.gate.pauseReceived(e),this.noteGateInFeed(),this.maybeFocusAnswer();break;case"run:cancel":this.run&&(this.run.status="cancelled"),this.gate.runStateChanged("cancelled"),this.stopTimerIfFinished();break;case"node:start":this.updateNodeStatus(n,"running",void 0,{provider:e.provider,model:e.model});break;case"node:complete":this.updateNodeStatus(n,"completed",e.durationMs);break;case"node:skip":this.updateNodeStatus(n,"skipped");break;case"node:fail":this.updateNodeStatus(n,"failed");break;case"run:complete":this.run&&(this.run.status=e.success?"completed":"failed",this.gate.runStateChanged(this.run.status)),this.stopTimerIfFinished();break}}updateNodeStatus(t,e,n,r){this.statusMap.set(t,e),this.rebuildDag()}syncGateFromRun(){this.run&&(this.gate.runStateChanged(this.run.status,this.run),this.noteGateInFeed(),this.maybeFocusAnswer())}noteGateInFeed(){let t=this.gate.request();this.gate.visible()&&t&&(this.feed=Me(this.feed,t))}sendAnswer(){if(!this.gate.visible()||this.gate.phase()==="submitting")return;let t=this.draft.trim(),e=this.gate.submitAction();if(e==="resume"&&!t)return;this.gate.submitStarted(),(e==="resume"?this.api.resumeRun(this.runId,t):this.api.approveRun(this.runId,t||void 0)).subscribe({next:()=>{this.feed=Q(this.feed,e==="resume"?"answer":"approve",t),this.draft="",this.gate.submitSucceeded()},error:r=>this.gate.submitFailed(r?.error?.error??"Failed to send the answer.")})}rejectGate(){if(!this.gate.visible()||this.gate.phase()==="submitting")return;let t=prompt("Rejection reason","Rejected by operator");t!==null&&(this.gate.submitStarted(),this.api.rejectRun(this.runId,t||void 0).subscribe({next:()=>{this.feed=Q(this.feed,"reject",t),this.gate.submitSucceeded()},error:e=>this.gate.submitFailed(e?.error?.error??"Failed to reject the run.")}))}render(t){return Te(t)}maybeFocusAnswer(){!this.focusAnswerOnShow||!this.gate.visible()||(this.focusAnswerOnShow=!1,setTimeout(()=>{document.getElementById("gate-answer-panel")?.scrollIntoView({behavior:"smooth",block:"center"}),document.getElementById("gate-answer-input")?.focus()}))}stopTimerIfFinished(){!this.run||!X(this.run.status)||(Se(this.run),this.timerInterval&&(clearInterval(this.timerInterval),this.timerInterval=void 0))}statusClass(t){switch(t){case"completed":return"bg-green-500/10 text-green-400";case"failed":return"bg-red-500/10 text-red-400";case"running":return"bg-blue-500/10 text-blue-400";default:return"bg-slate-700 text-slate-400"}}statusIcon(t){switch(t){case"completed":return"\u2713";case"failed":return"\u2717";case"running":return"\u25CF";default:return"\u25CB"}}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=N({type:i,selectors:[["app-run-execution"]],decls:35,vars:17,consts:[[1,"flex","flex-col","h-[calc(100vh-6rem)]"],[1,"flex","items-center","mb-3","gap-2","text-sm","shrink-0"],["routerLink","/",1,"text-slate-500","hover:text-slate-300"],[1,"text-slate-600"],[1,"text-slate-300"],[1,"font-mono","text-slate-100"],[1,"text-xs","px-2","py-0.5","rounded","ml-2",3,"ngClass"],[1,"flex-1","flex","min-h-0","gap-3"],[1,"flex-[1.6]","min-w-0","border","border-slate-800","rounded-lg","overflow-hidden","relative"],[3,"nodeClick","nodes","edges","width","height"],[1,"absolute","bottom-2","left-2","text-[10px]","text-slate-500"],[3,"runId","nodes","statusOf","rootKey"],[1,"flex-1","min-w-0","flex","flex-col","border","border-slate-800","rounded-lg","overflow-hidden"],[1,"px-3","py-2","border-b","border-slate-800","text-sm","text-slate-200","shrink-0"],[1,"flex-1","overflow-auto","p-3","space-y-2"],[1,"flex",3,"justify-end"],[1,"text-[10px]","text-slate-600","text-center"],["id","gate-answer-panel",1,"border-t","border-slate-800","p-3","shrink-0","bg-slate-900/40"],["id","gate-answer-input","rows","2",1,"w-full","rounded","border","border-slate-700","bg-slate-950","p-2","text-sm","text-slate-100","focus:border-amber-500","focus:outline-none",3,"ngModelChange","ngModel","disabled","placeholder"],[1,"text-xs","text-red-400","mt-1"],[1,"flex","gap-2","mt-2"],["type","button",1,"rounded","bg-amber-500","px-3","py-1.5","text-sm","font-semibold","text-slate-950","hover:bg-amber-400","disabled:opacity-40","disabled:cursor-not-allowed",3,"click","disabled"],["type","button",1,"rounded","border","border-red-500/50","px-3","py-1.5","text-sm","text-red-300","hover:bg-red-500/10","disabled:opacity-40",3,"click","disabled"],[3,"close","runId","nodes","statusOf","rootKey"],[1,"flex"],[1,"max-w-[90%]","rounded-lg","px-3","py-2","text-sm",3,"ngClass"],[3,"innerHTML"],[1,"text-[10px]","uppercase","tracking-wide","text-amber-400","mb-1"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1)(2,"a",2),l(3,"Dashboard"),o(),a(4,"span",3),l(5,"\u203A"),o(),a(6,"span",4),l(7),o(),a(8,"span",3),l(9,"\u203A"),o(),a(10,"span",5),l(11),o(),f(12,at,2,3,"span",6),o(),a(13,"div",7)(14,"div",8)(15,"app-dag-graph",9),g("nodeClick",function(d){return n.onNodeClick(d)}),o(),f(16,dt,2,0,"div",10),f(17,lt,1,4,"app-node-inspector",11),o(),a(18,"div",12)(19,"div",13),l(20,"\u{1F4AC} H\u1ED9i tho\u1EA1i"),o(),a(21,"div",14),O(22,ut,3,4,"div",15,ot),f(24,pt,2,0,"div",16),O(25,mt,4,5,"div",15,st),o(),a(27,"div",17)(28,"textarea",18),pe("ngModelChange",function(d){return ue(n.draft,d)||(n.draft=d),d}),o(),f(29,gt,2,1,"div",19),a(30,"div",20)(31,"button",21),g("click",function(){return n.sendAnswer()}),l(32),o(),a(33,"button",22),g("click",function(){return n.rejectGate()}),l(34," T\u1EEB ch\u1ED1i "),o()()()()()()),e&2&&(s(7),v(n.run==null?null:n.run.workflow),s(4),v(n.run==null?null:n.run.runId),s(),b(n.run?12:-1),s(3),m("nodes",n.dagNodes)("edges",n.dagEdges)("width",n.dagWidth)("height",n.dagHeight),s(),b(!(n.run==null||n.run.graph==null||n.run.graph.nodes==null)&&n.run.graph.nodes.length?-1:16),s(),b(n.inspectorKey?17:-1),s(5),F(n.messages),s(2),b(n.messages.length&&n.feed.length?24:-1),s(),F(n.feed),s(3),le("ngModel",n.draft),m("disabled",n.gate.phase()==="submitting")("placeholder",n.gate.visible()?n.gate.submitAction()==="resume"?"Nh\u1EADp c\xE2u tr\u1EA3 l\u1EDDi\u2026":"Ph\u1EA3n h\u1ED3i (tu\u1EF3 ch\u1ECDn)\u2026":"Ch\u1EC9 tr\u1EA3 l\u1EDDi \u0111\u01B0\u1EE3c khi run \u0111ang t\u1EA1m d\u1EEBng."),s(),b(n.gate.errorMessage()?29:-1),s(2),m("disabled",!n.gate.visible()||n.gate.phase()==="submitting"||n.gate.submitAction()==="resume"&&!n.draft.trim()),s(),H(" ",n.gate.phase()==="submitting"?"\u0110ang g\u1EEDi\u2026":"G\u1EEDi"," "),s(),m("disabled",!n.gate.visible()||n.gate.phase()==="submitting"))},dependencies:[M,ge,Ee,xe,ye,Ce,_e,R,z],encapsulation:2})};export{Ve as RunExecutionComponent};
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<base href="/">
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
8
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
9
|
-
<style>@layer properties;@layer theme,base,components,utilities;@layer theme{:root{--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-500:oklch(58.5% .233 277.117);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-font-family:Inter, ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, monospace}}@layer base{*,:after,:before{box-sizing:border-box;margin:0;padding:0;border:0 solid}html{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}}@layer utilities{}:root{--background:oklch(.14 .005 260);--surface:oklch(.18 .008 260);--surface-elevated:oklch(.22 .01 260);--border:oklch(.28 .01 260);--border-bright:oklch(.35 .015 260);--text-primary:oklch(.93 .005 260);--text-secondary:oklch(.65 .01 260);--text-tertiary:oklch(.45 .01 260);--primary:oklch(.65 .18 250);--primary-foreground:oklch(.98 .005 260);--success:oklch(.65 .17 155);--warning:oklch(.75 .15 75);--error:oklch(.6 .2 25)}html,body{min-height:100%;background:var(--background);color:var(--text-primary);font-family:Inter,ui-sans-serif,system-ui,sans-serif}@property --tw-rotate-x{syntax:"*";inherits:false;}@property --tw-rotate-y{syntax:"*";inherits:false;}@property --tw-rotate-z{syntax:"*";inherits:false;}@property --tw-skew-x{syntax:"*";inherits:false;}@property --tw-skew-y{syntax:"*";inherits:false;}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0;}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid;}@property --tw-font-weight{syntax:"*";inherits:false;}@property --tw-tracking{syntax:"*";inherits:false;}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-shadow-color{syntax:"*";inherits:false;}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-inset-shadow-color{syntax:"*";inherits:false;}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-ring-color{syntax:"*";inherits:false;}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-inset-ring-color{syntax:"*";inherits:false;}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-ring-inset{syntax:"*";inherits:false;}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0px;}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff;}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid;}@property --tw-blur{syntax:"*";inherits:false;}@property --tw-brightness{syntax:"*";inherits:false;}@property --tw-contrast{syntax:"*";inherits:false;}@property --tw-grayscale{syntax:"*";inherits:false;}@property --tw-hue-rotate{syntax:"*";inherits:false;}@property --tw-invert{syntax:"*";inherits:false;}@property --tw-opacity{syntax:"*";inherits:false;}@property --tw-saturate{syntax:"*";inherits:false;}@property --tw-sepia{syntax:"*";inherits:false;}@property --tw-drop-shadow{syntax:"*";inherits:false;}@property --tw-drop-shadow-color{syntax:"*";inherits:false;}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-drop-shadow-size{syntax:"*";inherits:false;}@property --tw-ease{syntax:"*";inherits:false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}</style><link rel="stylesheet" href="styles-
|
|
9
|
+
<style>@layer properties;@layer theme,base,components,utilities;@layer theme{:root{--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-500:oklch(58.5% .233 277.117);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-font-family:Inter, ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, monospace}}@layer base{*,:after,:before{box-sizing:border-box;margin:0;padding:0;border:0 solid}html{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}}@layer utilities{}:root{--background:oklch(.14 .005 260);--surface:oklch(.18 .008 260);--surface-elevated:oklch(.22 .01 260);--border:oklch(.28 .01 260);--border-bright:oklch(.35 .015 260);--text-primary:oklch(.93 .005 260);--text-secondary:oklch(.65 .01 260);--text-tertiary:oklch(.45 .01 260);--primary:oklch(.65 .18 250);--primary-foreground:oklch(.98 .005 260);--success:oklch(.65 .17 155);--warning:oklch(.75 .15 75);--error:oklch(.6 .2 25)}html,body{min-height:100%;background:var(--background);color:var(--text-primary);font-family:Inter,ui-sans-serif,system-ui,sans-serif}@property --tw-rotate-x{syntax:"*";inherits:false;}@property --tw-rotate-y{syntax:"*";inherits:false;}@property --tw-rotate-z{syntax:"*";inherits:false;}@property --tw-skew-x{syntax:"*";inherits:false;}@property --tw-skew-y{syntax:"*";inherits:false;}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0;}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid;}@property --tw-font-weight{syntax:"*";inherits:false;}@property --tw-tracking{syntax:"*";inherits:false;}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-shadow-color{syntax:"*";inherits:false;}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-inset-shadow-color{syntax:"*";inherits:false;}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-ring-color{syntax:"*";inherits:false;}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-inset-ring-color{syntax:"*";inherits:false;}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-ring-inset{syntax:"*";inherits:false;}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0px;}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff;}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid;}@property --tw-blur{syntax:"*";inherits:false;}@property --tw-brightness{syntax:"*";inherits:false;}@property --tw-contrast{syntax:"*";inherits:false;}@property --tw-grayscale{syntax:"*";inherits:false;}@property --tw-hue-rotate{syntax:"*";inherits:false;}@property --tw-invert{syntax:"*";inherits:false;}@property --tw-opacity{syntax:"*";inherits:false;}@property --tw-saturate{syntax:"*";inherits:false;}@property --tw-sepia{syntax:"*";inherits:false;}@property --tw-drop-shadow{syntax:"*";inherits:false;}@property --tw-drop-shadow-color{syntax:"*";inherits:false;}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%;}@property --tw-drop-shadow-size{syntax:"*";inherits:false;}@property --tw-ease{syntax:"*";inherits:false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}</style><link rel="stylesheet" href="styles-5MTP4CCO.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-5MTP4CCO.css"></noscript></head>
|
|
10
10
|
<body>
|
|
11
11
|
<app-root></app-root>
|
|
12
|
-
<link rel="modulepreload" href="chunk-
|
|
12
|
+
<link rel="modulepreload" href="chunk-N3FOQ3O5.js"><link rel="modulepreload" href="chunk-4R37VVI4.js"><script src="polyfills-YMBILSHJ.js" type="module"></script><script src="main-3UCJ3N4F.js" type="module"></script></body>
|
|
13
13
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,c as P,e as M,f as O,g as A}from"./chunk-
|
|
1
|
+
import{a as S,c as P,e as M,f as O,g as A}from"./chunk-N3FOQ3O5.js";import{Ba as f,Bb as w,La as x,Ma as u,O as d,Oa as C,Pa as v,Qa as s,Ra as n,Sa as o,T as m,Ta as h,U as g,Vb as j,Wb as L,Xa as b,Ya as k,Za as c,ib as i,jb as _,qa as a,qb as y}from"./chunk-4R37VVI4.js";var E=[{path:"",loadComponent:()=>import("./chunk-MCW5ACIZ.js").then(e=>e.DashboardComponent)},{path:"workflows",loadComponent:()=>import("./chunk-GR7SKUVU.js").then(e=>e.WorkflowsComponent)},{path:"workflows/builder",loadComponent:()=>import("./chunk-FBCNCNPM.js").then(e=>e.WorkflowBuilderComponent)},{path:"workflows/detail",loadComponent:()=>import("./chunk-6H3AYIT3.js").then(e=>e.WorkflowDetailComponent)},{path:"conversations",loadComponent:()=>import("./chunk-FE2VGLSN.js").then(e=>e.ConversationsComponent)},{path:"conversations/:conversationId",loadComponent:()=>import("./chunk-FE2VGLSN.js").then(e=>e.ConversationsComponent)},{path:"runs/:runId",loadComponent:()=>import("./chunk-UDCOYDXU.js").then(e=>e.RunExecutionComponent)},{path:"settings",loadComponent:()=>import("./chunk-L7B3BT5E.js").then(e=>e.SettingsComponent)}];var I={providers:[w({eventCoalescing:!0}),A(E),j()]};var R=()=>({exact:!0}),T=(e,r)=>r.id;function V(e,r){if(e&1&&(n(0,"option",14),i(1),o()),e&2){let t=r.$implicit,p=c(2);s("value",t.id)("selected",t.id===p.selectedId()),a(),_(t.name)}}function F(e,r){if(e&1){let t=b();n(0,"select",13),k("change",function(z){m(t);let D=c();return g(D.onProjectChange(z))}),C(1,V,2,3,"option",14,T),o()}if(e&2){let t=c();a(),v(t.projects())}}var l=class e{projectService=d(L);projects=this.projectService.projects;selectedId=this.projectService.selectedId;constructor(){this.projectService.load()}onProjectChange(r){let t=r.target.value;!t||t===this.selectedId()||(this.projectService.select(t),document.location.reload())}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=f({type:e,selectors:[["app-root"]],decls:21,vars:3,consts:[[1,"app-shell"],[1,"app-nav"],["routerLink","/",1,"brand-link"],[1,"brand-icon"],[1,"brand-name"],["routerLink","/","routerLinkActive","border-primary text-primary",1,"nav-link",3,"routerLinkActiveOptions"],["routerLink","/workflows","routerLinkActive","border-primary text-primary",1,"nav-link"],["routerLink","/conversations","routerLinkActive","border-primary text-primary",1,"nav-link"],["routerLink","/settings","routerLinkActive","border-primary text-primary",1,"nav-link"],[1,"nav-spacer"],["aria-label","Project","title","Switch project",1,"project-select"],[1,"version-pill"],[1,"app-main"],["aria-label","Project","title","Switch project",1,"project-select",3,"change"],[3,"value","selected"]],template:function(t,p){t&1&&(n(0,"div",0)(1,"nav",1)(2,"a",2)(3,"span",3),i(4,"V"),o(),n(5,"span",4),i(6,"VSAF"),o()(),n(7,"a",5),i(8," Dashboard "),o(),n(9,"a",6),i(10," Workflows "),o(),n(11,"a",7),i(12," Conversations "),o(),n(13,"a",8),i(14," Settings "),o(),n(15,"div",9),x(16,F,3,0,"select",10),n(17,"span",11),i(18,"v0.2.0"),o()()(),n(19,"main",12),h(20,"router-outlet"),o()()),t&2&&(a(7),s("routerLinkActiveOptions",y(2,R)),a(9),u(p.projects().length>1?16:-1))},dependencies:[P,M,O],styles:["[_nghost-%COMP%]{display:block;min-height:100vh;background:#101114;color:#e7e7ea}.app-shell[_ngcontent-%COMP%]{min-height:100vh;background:#101114;color:#e7e7ea}.app-nav[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;height:56px;border-bottom:1px solid #2b2d33;background:#17181d;padding:0 16px;box-sizing:border-box}.brand-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:9px;margin-right:18px;color:#f4f4f5;text-decoration:none}.brand-link[_ngcontent-%COMP%]:hover{opacity:.82}.brand-icon[_ngcontent-%COMP%]{display:grid;place-items:center;width:30px;height:30px;border-radius:7px;background:#6366f1;color:#fff;font-size:14px;font-weight:800}.brand-name[_ngcontent-%COMP%]{font-size:14px;font-weight:800}.nav-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;height:56px;border-bottom:2px solid transparent;padding:0 13px;color:#a1a1aa;font-size:14px;font-weight:650;text-decoration:none;box-sizing:border-box}.nav-link[_ngcontent-%COMP%]:hover{color:#f4f4f5}.nav-link.border-primary[_ngcontent-%COMP%], .nav-link.text-primary[_ngcontent-%COMP%]{border-bottom-color:#6366f1;color:#a5b4fc}.nav-spacer[_ngcontent-%COMP%]{margin-left:auto;display:flex;align-items:center;gap:12px}.project-select[_ngcontent-%COMP%]{border:1px solid #2b2d33;border-radius:7px;background:#20222a;color:#e7e7ea;padding:5px 8px;font:inherit;font-size:12px;max-width:220px;cursor:pointer}.project-select[_ngcontent-%COMP%]:focus{outline:none;border-color:#6366f1}.version-pill[_ngcontent-%COMP%]{border:1px solid #2b2d33;border-radius:7px;background:#20222a;color:#a1a1aa;padding:5px 8px;font-size:12px}.app-main[_ngcontent-%COMP%]{min-height:calc(100vh - 56px);overflow:auto;background:#101114}"]})};S(l,I).catch(e=>console.error(e));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--color-red-300: oklch(80.8% .114 19.571);--color-red-400: oklch(70.4% .191 22.216);--color-red-500: oklch(63.7% .237 25.331);--color-amber-400: oklch(82.8% .189 84.429);--color-amber-500: oklch(76.9% .188 70.08);--color-green-400: oklch(79.2% .209 151.711);--color-green-500: oklch(72.3% .219 149.579);--color-blue-400: oklch(70.7% .165 254.624);--color-blue-500: oklch(62.3% .214 259.815);--color-blue-600: oklch(54.6% .245 262.881);--color-indigo-100: oklch(93% .034 272.788);--color-indigo-500: oklch(58.5% .233 277.117);--color-slate-100: oklch(96.8% .007 247.896);--color-slate-200: oklch(92.9% .013 255.508);--color-slate-300: oklch(86.9% .022 252.894);--color-slate-400: oklch(70.4% .04 256.788);--color-slate-500: oklch(55.4% .046 257.417);--color-slate-600: oklch(44.6% .043 257.281);--color-slate-700: oklch(37.2% .044 257.287);--color-slate-800: oklch(27.9% .041 260.031);--color-slate-900: oklch(20.8% .042 265.755);--color-slate-950: oklch(12.9% .042 264.695);--color-black: #000;--color-white: #fff;--spacing: .25rem;--container-md: 28rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-lg: 1.125rem;--text-lg--line-height: calc(1.75 / 1.125);--font-weight-semibold: 600;--tracking-wide: .025em;--radius-lg: .5rem;--radius-xl: .75rem;--ease-in-out: cubic-bezier(.4, 0, .2, 1);--animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-font-family: Inter, ui-sans-serif, system-ui, sans-serif;--default-mono-font-family: "JetBrains Mono", ui-monospace, monospace}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.bottom-2{bottom:calc(var(--spacing) * 2)}.left-2{left:calc(var(--spacing) * 2)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.m-3{margin:calc(var(--spacing) * 3)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.table{display:table}.h-\[calc\(100vh-6rem\)\]{height:calc(100vh - 6rem)}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.w-10{width:calc(var(--spacing) * 10)}.w-auto{width:auto}.w-full{width:100%}.max-w-\[78\%\]{max-width:78%}.max-w-\[90\%\]{max-width:90%}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-\[1\.6\]{flex:1.6}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-primary{border-color:var(--primary)}.border-red-500\/30{border-color:color-mix(in srgb,oklch(63.7% .237 25.331) 30%,transparent)}@supports (color: color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/50{border-color:color-mix(in srgb,oklch(63.7% .237 25.331) 50%,transparent)}@supports (color: color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500) 50%,transparent)}}.border-slate-600{border-color:var(--color-slate-600)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-800{border-color:var(--color-slate-800)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-black\/40{background-color:color-mix(in srgb,#000 40%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/60{background-color:color-mix(in srgb,#000 60%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-blue-500\/10{background-color:color-mix(in srgb,oklch(62.3% .214 259.815) 10%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500) 10%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-green-500\/10{background-color:color-mix(in srgb,oklch(72.3% .219 149.579) 10%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:color-mix(in srgb,oklch(58.5% .233 277.117) 15%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-red-500\/10{background-color:color-mix(in srgb,oklch(63.7% .237 25.331) 10%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/40{background-color:color-mix(in srgb,oklch(20.8% .042 265.755) 40%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-slate-900\/40{background-color:color-mix(in oklab,var(--color-slate-900) 40%,transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-slate-950\/40{background-color:color-mix(in srgb,oklch(12.9% .042 264.695) 40%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-slate-950\/40{background-color:color-mix(in oklab,var(--color-slate-950) 40%,transparent)}}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.text-center{text-align:center}.font-mono{font-family:JetBrains Mono,ui-monospace,monospace}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading, var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.font-semibold{--tw-font-weight: var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking: var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-blue-400{color:var(--color-blue-400)}.text-green-400{color:var(--color-green-400)}.text-indigo-100{color:var(--color-indigo-100)}.text-primary{color:var(--primary)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-slate-100{color:var(--color-slate-100)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-950{color:var(--color-slate-950)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.shadow-2xl{--tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / .25));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.ease-in-out{--tw-ease: var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}}@media(hover:hover){.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}}@media(hover:hover){.hover\:bg-red-500\/10:hover{background-color:color-mix(in srgb,oklch(63.7% .237 25.331) 10%,transparent)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}}@media(hover:hover){.hover\:text-slate-100:hover{color:var(--color-slate-100)}}@media(hover:hover){.hover\:text-slate-200:hover{color:var(--color-slate-200)}}@media(hover:hover){.hover\:text-slate-300:hover{color:var(--color-slate-300)}}.focus\:border-amber-500:focus{border-color:var(--color-amber-500)}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:outline-none:focus{--tw-outline-style: none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:40%}}:root{--background: oklch(.14 .005 260);--surface: oklch(.18 .008 260);--surface-elevated: oklch(.22 .01 260);--border: oklch(.28 .01 260);--border-bright: oklch(.35 .015 260);--text-primary: oklch(.93 .005 260);--text-secondary: oklch(.65 .01 260);--text-tertiary: oklch(.45 .01 260);--primary: oklch(.65 .18 250);--primary-foreground: oklch(.98 .005 260);--success: oklch(.65 .17 155);--warning: oklch(.75 .15 75);--error: oklch(.6 .2 25)}html,body{min-height:100%;background:var(--background);color:var(--text-primary);font-family:Inter,ui-sans-serif,system-ui,sans-serif}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--background)}::-webkit-scrollbar-thumb{background:var(--border);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--border-bright)}@property --tw-rotate-x{syntax: "*"; inherits: false;}@property --tw-rotate-y{syntax: "*"; inherits: false;}@property --tw-rotate-z{syntax: "*"; inherits: false;}@property --tw-skew-x{syntax: "*"; inherits: false;}@property --tw-skew-y{syntax: "*"; inherits: false;}@property --tw-space-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: "*"; inherits: false;}@property --tw-tracking{syntax: "*"; inherits: false;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-outline-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-blur{syntax: "*"; inherits: false;}@property --tw-brightness{syntax: "*"; inherits: false;}@property --tw-contrast{syntax: "*"; inherits: false;}@property --tw-grayscale{syntax: "*"; inherits: false;}@property --tw-hue-rotate{syntax: "*"; inherits: false;}@property --tw-invert{syntax: "*"; inherits: false;}@property --tw-opacity{syntax: "*"; inherits: false;}@property --tw-saturate{syntax: "*"; inherits: false;}@property --tw-sepia{syntax: "*"; inherits: false;}@property --tw-drop-shadow{syntax: "*"; inherits: false;}@property --tw-drop-shadow-color{syntax: "*"; inherits: false;}@property --tw-drop-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-drop-shadow-size{syntax: "*"; inherits: false;}@property --tw-ease{syntax: "*"; inherits: false;}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x: initial;--tw-rotate-y: initial;--tw-rotate-z: initial;--tw-skew-x: initial;--tw-skew-y: initial;--tw-space-y-reverse: 0;--tw-border-style: solid;--tw-font-weight: initial;--tw-tracking: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-outline-style: solid;--tw-blur: initial;--tw-brightness: initial;--tw-contrast: initial;--tw-grayscale: initial;--tw-hue-rotate: initial;--tw-invert: initial;--tw-opacity: initial;--tw-saturate: initial;--tw-sepia: initial;--tw-drop-shadow: initial;--tw-drop-shadow-color: initial;--tw-drop-shadow-alpha: 100%;--tw-drop-shadow-size: initial;--tw-ease: initial}}}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{b as H,d as J,e as K}from"./chunk-UN7U5NAR.js";import{a as U,b as X,e as Q,g as Z,h as ee,i as te,j as ne,k as oe}from"./chunk-LPQARKUF.js";import{Ba as V,Fa as _,Jb as j,Ka as F,Kb as q,O as M,Ob as G,Qa as u,Ra as i,Sa as r,T as m,Ta as O,U as g,Ua as D,V as S,Va as $,W as I,Xa as C,Ya as f,Za as p,a as B,b as T,cb as z,db as L,eb as P,fb as R,gb as d,hb as w,ib as v,jb as N,kb as h,lb as x,mb as b,pb as Y,qa as s,sb as A}from"./chunk-WDOCF7IL.js";var le=l=>["/runs",l];function de(l,n){if(l&1){let e=C();i(0,"button",39),f("dragstart",function(o){let a=m(e).$implicit,c=p();return g(c.onPaletteDragStart(o,a.type))})("click",function(){let o=m(e).$implicit,a=p();return g(a.addNode(o.type))}),i(1,"span",40),d(2),r(),i(3,"span")(4,"strong"),d(5),r(),i(6,"small"),d(7),r()()()}if(l&2){let e=n.$implicit,t=p();s(2),w(t.iconFor(e.type)),s(3),w(e.label),s(2),w(e.description)}}function se(l,n){if(l&1){let e=C();i(0,"button",41),f("click",function(){let o=m(e).$implicit,a=p();return g(a.loadWorkflow(o.id))}),i(1,"span"),d(2),r(),i(3,"small"),d(4),r()()}if(l&2){let e=n.$implicit;s(2),w(e.name),s(2),v("",e.nodeCount," nodes")}}function ce(l,n){if(l&1&&(i(0,"div",42),d(1),r()),l&2){let e=p();P("error",e.saveState==="error"),s(),v(" ",e.statusMessage," ")}}function pe(l,n){l&1&&(i(0,"div",43)(1,"h2"),d(2,"Drop nodes here"),r(),i(3,"p"),d(4,"Build a DAG by adding Bash, Command, and Prompt nodes."),r()())}function me(l,n){if(l&1&&(S(),O(0,"line")),l&2){let e=n.$implicit;F("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)}}function ge(l,n){if(l&1){let e=C();i(0,"button",44),f("click",function(){let o=m(e).$implicit,a=p();return g(a.selectNode(o))})("dragstart",function(o){let a=m(e).$implicit,c=p();return g(c.onNodeDragStart(o,a))}),i(1,"span",45),d(2),r(),i(3,"span",46)(4,"strong"),d(5),r(),i(6,"small"),d(7),r()()()}if(l&2){let e=n.$implicit,t=p();L("left",e.x,"px")("top",e.y,"px"),P("selected",(t.selectedNode==null?null:t.selectedNode.id)===e.id),s(2),w(t.iconFor(e.type)),s(3),w(e.id),s(2),N("",e.type," \xB7 ",e.dependsOn.length||0," deps")}}function ue(l,n){if(l&1&&(i(0,"option",67),d(1),r()),l&2){let e=n.$implicit;u("value",e.name)("disabled",!e.available),s(),N(" ",e.name,"",e.available?"":" \u2014 not available on this machine"," ")}}function fe(l,n){if(l&1&&O(0,"option",68),l&2){let e=n.$implicit;u("value",e)}}function _e(l,n){if(l&1){let e=C();i(0,"label",69)(1,"input",70),f("change",function(o){let a=m(e).$implicit,c=p(2);return g(c.toggleDependency(a.id,o))}),r(),i(2,"span"),d(3),r()()}if(l&2){let e=n.$implicit,t=p(2);s(),u("checked",t.selectedNode.dependsOn.includes(e.id)),s(2),w(e.id)}}function we(l,n){if(l&1){let e=C();D(0),i(1,"div",34),d(2,"Inspector"),r(),i(3,"label",47),d(4,"Node ID"),r(),i(5,"input",48),f("ngModelChange",function(o){m(e);let a=p();return g(a.renameSelectedNode(o))}),r(),i(6,"label",49),d(7,"Type"),r(),i(8,"select",50),b("ngModelChange",function(o){m(e);let a=p();return x(a.selectedNode.type,o)||(a.selectedNode.type=o),g(o)}),f("ngModelChange",function(){m(e);let o=p();return g(o.refreshYaml())}),i(9,"option",51),d(10,"bash"),r(),i(11,"option",52),d(12,"command"),r(),i(13,"option",53),d(14,"prompt"),r()(),i(15,"label",54),d(16,"Content"),r(),i(17,"textarea",55),b("ngModelChange",function(o){m(e);let a=p();return x(a.selectedNode.content,o)||(a.selectedNode.content=o),g(o)}),f("ngModelChange",function(){m(e);let o=p();return g(o.refreshYaml())}),r(),i(18,"label",56),d(19,"Provider"),r(),i(20,"select",57),b("ngModelChange",function(o){m(e);let a=p();return x(a.selectedNode.provider,o)||(a.selectedNode.provider=o),g(o)}),f("ngModelChange",function(){m(e);let o=p();return g(o.refreshYaml())}),i(21,"option",58),d(22,"(inherit workflow)"),r(),_(23,ue,2,4,"option",59),r(),i(24,"label",60),d(25,"Model"),r(),i(26,"input",61),b("ngModelChange",function(o){m(e);let a=p();return x(a.selectedNode.model,o)||(a.selectedNode.model=o),g(o)}),f("ngModelChange",function(){m(e);let o=p();return g(o.refreshYaml())}),r(),i(27,"datalist",62),_(28,fe,1,1,"option",63),r(),i(29,"label",64),d(30,"Depends on"),r(),_(31,_e,4,2,"label",65),i(32,"button",66),f("click",function(){m(e);let o=p();return g(o.deleteSelectedNode())}),d(33,"Delete Node"),r(),$()}if(l&2){let e=p();s(5),u("ngModel",e.selectedNode.id),s(3),h("ngModel",e.selectedNode.type),s(9),h("ngModel",e.selectedNode.content),s(3),h("ngModel",e.selectedNode.provider),s(3),u("ngForOf",e.providers),s(3),h("ngModel",e.selectedNode.model),s(2),u("ngForOf",e.modelSuggestions),s(3),u("ngForOf",e.dependencyCandidates)}}function he(l,n){l&1&&(i(0,"div",34),d(1,"Inspector"),r(),i(2,"p",71),d(3,"Select a node to edit its ID, type, command body, and dependencies."),r())}function xe(l,n){if(l&1&&(i(0,"a",72)(1,"span")(2,"strong"),d(3),r(),i(4,"small"),d(5),r()(),i(6,"em"),d(7),r()()),l&2){let e=n.$implicit,t=p();u("routerLink",Y(6,le,e.runId)),s(3),w(e.workflow),s(2),w(e.runId),s(),R(t.statusClass(e.status)),s(),w(e.status)}}function be(l,n){l&1&&(i(0,"p",71),d(1,"No runs yet."),r())}var ie=class l{api=M(oe);router=M(J);route=M(H);palette=[{type:"bash",label:"Bash",description:"Run a shell step"},{type:"command",label:"Command",description:"Use a .vsaf command"},{type:"prompt",label:"Prompt",description:"Call an AI provider"}];workflowName="new-workflow";workflowFolder="";description="Draft workflow";nodes=[];selectedNode;workflows=[];runs=[];providers=[];yamlPreview="";saveState="idle";statusMessage="";draggingType;draggingNodeId;ngOnInit(){this.workflowFolder=W(this.route.snapshot.queryParamMap.get("folder")??""),this.refreshData(),this.resetBuilder();let n=this.route.snapshot.queryParamMap.get("edit");n&&this.loadWorkflow(n)}refreshData(){this.api.getWorkflows().subscribe(n=>this.workflows=n),this.api.getRuns().subscribe(n=>this.runs=n.slice().reverse().slice(0,8)),this.api.getProviders().subscribe({next:n=>this.providers=n.providers??[],error:()=>this.providers=[]})}get modelSuggestions(){let n=this.selectedNode?.provider||re;return this.providers.find(e=>e.name===n)?.defaultModels??[]}resetBuilder(){this.workflowName="new-workflow",this.description="Draft workflow",this.nodes=[this.makeNode("bash",80,100,"setup"),this.makeNode("command",330,170,"review")],this.nodes[1].dependsOn=[this.nodes[0].id],this.selectedNode=this.nodes[0],this.setStatus(""),this.refreshYaml()}get workflowId(){let n=W(this.workflowFolder),e=y(this.workflowName);return n?`${n}/${e}`:e}onPaletteDragStart(n,e){this.draggingType=e,n.dataTransfer?.setData("application/x-vsaf-node-type",e),n.dataTransfer?.setData("text/plain",e)}onNodeDragStart(n,e){this.draggingNodeId=e.id,n.dataTransfer?.setData("application/x-vsaf-node-id",e.id)}onCanvasDragOver(n){n.preventDefault()}onCanvasDrop(n){n.preventDefault();let e=n.currentTarget.getBoundingClientRect(),t=Math.max(18,n.clientX-e.left-95),o=Math.max(18,n.clientY-e.top-24),a=n.dataTransfer?.getData("application/x-vsaf-node-id")||this.draggingNodeId;if(a){let k=this.nodes.find(ae=>ae.id===a);k&&(k.x=t,k.y=o,this.selectNode(k),this.refreshYaml()),this.draggingNodeId=void 0;return}let c=n.dataTransfer?.getData("application/x-vsaf-node-type")||this.draggingType;c&&this.addNode(c,t,o),this.draggingType=void 0}addNode(n,e=90+this.nodes.length*34,t=90+this.nodes.length*42){let o=this.makeNode(n,e,t);this.nodes=[...this.nodes,o],this.selectNode(o),this.refreshYaml()}selectNode(n){this.selectedNode=n}renameSelectedNode(n){if(!this.selectedNode)return;let e=y(n);if(!e)return;let t=this.selectedNode.id;if(t!==e){if(this.nodes.some(o=>o.id===e)){this.setStatus(`Node ID already exists: ${e}`,"error");return}this.selectedNode.id=e;for(let o of this.nodes)o.dependsOn=o.dependsOn.map(a=>a===t?e:a);this.refreshYaml()}}toggleDependency(n,e){if(!this.selectedNode)return;e.target.checked?this.selectedNode.dependsOn=[...new Set([...this.selectedNode.dependsOn,n])]:this.selectedNode.dependsOn=this.selectedNode.dependsOn.filter(o=>o!==n),this.refreshYaml()}deleteSelectedNode(){if(!this.selectedNode)return;let n=this.selectedNode.id;this.nodes=this.nodes.filter(e=>e.id!==n).map(e=>T(B({},e),{dependsOn:e.dependsOn.filter(t=>t!==n)})),this.selectedNode=this.nodes[0],this.refreshYaml()}loadWorkflow(n){this.api.getWorkflow(n).subscribe(e=>{let t=e.id.lastIndexOf("/");this.workflowFolder=t>=0?e.id.slice(0,t):"",this.workflowName=t>=0?e.id.slice(t+1):e.id,this.description=e.description||"Workflow loaded from disk",this.nodes=e.nodes.map((o,a)=>({id:o.id,type:o.type,title:o.id,content:o.content,dependsOn:o.dependsOn,provider:o.provider??"",model:o.model??"",x:80+a%3*250,y:80+Math.floor(a/3)*120})),this.selectedNode=this.nodes[0],this.setStatus(`Loaded ${e.name}`),this.refreshYaml()})}saveWorkflow(){this.saveCurrentWorkflow()}runWorkflow(){this.saveCurrentWorkflow(n=>{this.api.startRun(n,"").subscribe({next:e=>this.router.navigate(["/runs",e.runId]),error:e=>this.setStatus(e?.error?.error??e?.message??"Run failed","error")})})}refreshYaml(){this.yamlPreview=ye(this.workflowName,this.description,this.nodes),this.saveState==="saved"&&(this.saveState="idle")}get dependencyCandidates(){return this.selectedNode?this.nodes.filter(n=>n.id!==this.selectedNode.id):[]}get edges(){let n=new Map(this.nodes.map(t=>[t.id,t])),e=[];for(let t of this.nodes)for(let o of t.dependsOn){let a=n.get(o);a&&e.push({x1:a.x+190,y1:a.y+28,x2:t.x,y2:t.y+28})}return e}iconFor(n){switch(n){case"bash":return"$";case"command":return"/";case"prompt":return"AI"}}statusClass(n){switch(n){case"completed":return"status-completed";case"failed":return"status-failed";case"running":return"status-running";default:return"status-default"}}saveCurrentWorkflow(n){let e=y(this.workflowName),t=W(this.workflowFolder),o=t?`${t}/${e}`:e;if(!e||this.nodes.length===0){this.setStatus("Workflow name and at least one node are required.","error");return}this.workflowName=e,this.refreshYaml(),this.saveState="saving",this.api.saveWorkflow(o,this.yamlPreview).subscribe({next:()=>{this.saveState="saved",this.setStatus(`Saved ${o}`),this.refreshData(),n?.(o)},error:a=>{this.saveState="error",this.setStatus(a?.error?.error??a?.message??"Save failed","error")}})}makeNode(n,e,t,o=n){let a=ve(this.nodes.map(c=>c.id),`${n}-${o}`);return{id:a,type:n,title:a,content:Ce(n,a),dependsOn:[],provider:"",model:"",x:e,y:t}}setStatus(n,e="idle"){this.statusMessage=n,this.saveState=e}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=V({type:l,selectors:[["app-workflow-builder"]],decls:63,vars:19,consts:[["noSelection",""],[1,"builder-shell"],[1,"sidebar"],[1,"brand-row"],[1,"brand-mark"],[1,"brand-title"],[1,"brand-subtitle"],["for","workflow-folder",1,"field-label"],["id","workflow-folder","placeholder","e.g. sdlc/release",1,"text-input",3,"ngModelChange","ngModel"],["for","workflow-name",1,"field-label"],["id","workflow-name",1,"text-input",3,"ngModelChange","ngModel"],["for","workflow-description",1,"field-label"],["id","workflow-description","rows","3",1,"text-area",3,"ngModelChange","ngModel"],[1,"section-title"],["type","button","class","palette-item","draggable","true",3,"dragstart","click",4,"ngFor","ngForOf"],["type","button","class","workflow-link",3,"click",4,"ngFor","ngForOf"],[1,"workspace"],[1,"toolbar"],[1,"toolbar-actions"],["type","button",1,"ghost-button",3,"click"],["type","button",1,"primary-button",3,"click","disabled"],["type","button",1,"run-button",3,"click","disabled"],["class","status-row",3,"error",4,"ngIf"],[1,"builder-grid"],[1,"canvas",3,"dragover","drop"],[1,"canvas-grid"],["class","empty-state",4,"ngIf"],["aria-hidden","true",1,"edges"],[4,"ngFor","ngForOf"],["type","button","class","node-card","draggable","true",3,"selected","left","top","click","dragstart",4,"ngFor","ngForOf"],[1,"inspector"],[4,"ngIf","ngIfElse"],[1,"bottom-grid"],[1,"yaml-panel"],[1,"panel-title"],[1,"yaml-editor",3,"ngModelChange","ngModel"],[1,"runs-panel"],["class","run-row",3,"routerLink",4,"ngFor","ngForOf"],["class","muted",4,"ngIf"],["type","button","draggable","true",1,"palette-item",3,"dragstart","click"],[1,"palette-icon"],["type","button",1,"workflow-link",3,"click"],[1,"status-row"],[1,"empty-state"],["type","button","draggable","true",1,"node-card",3,"click","dragstart"],[1,"node-kind"],[1,"node-copy"],["for","node-id",1,"field-label"],["id","node-id",1,"text-input",3,"ngModelChange","ngModel"],["for","node-type",1,"field-label"],["id","node-type",1,"text-input",3,"ngModelChange","ngModel"],["value","bash"],["value","command"],["value","prompt"],["for","node-content",1,"field-label"],["id","node-content","rows","7",1,"text-area","mono",3,"ngModelChange","ngModel"],["for","node-provider",1,"field-label"],["id","node-provider",1,"text-input",3,"ngModelChange","ngModel"],["value",""],[3,"value","disabled",4,"ngFor","ngForOf"],["for","node-model",1,"field-label"],["id","node-model","list","builder-model-suggestions","placeholder","(inherit)",1,"text-input",3,"ngModelChange","ngModel"],["id","builder-model-suggestions"],[3,"value",4,"ngFor","ngForOf"],[1,"field-label"],["class","check-row",4,"ngFor","ngForOf"],["type","button",1,"danger-button",3,"click"],[3,"value","disabled"],[3,"value"],[1,"check-row"],["type","checkbox",3,"change","checked"],[1,"muted"],[1,"run-row",3,"routerLink"]],template:function(e,t){if(e&1){let o=C();i(0,"section",1)(1,"aside",2)(2,"div",3)(3,"div",4),d(4,"V"),r(),i(5,"div")(6,"div",5),d(7,"VSAF Builder"),r(),i(8,"div",6),d(9,"Workflow canvas"),r()()(),i(10,"label",7),d(11,"Folder"),r(),i(12,"input",8),b("ngModelChange",function(c){return m(o),x(t.workflowFolder,c)||(t.workflowFolder=c),g(c)}),r(),i(13,"label",9),d(14,"Workflow name"),r(),i(15,"input",10),b("ngModelChange",function(c){return m(o),x(t.workflowName,c)||(t.workflowName=c),g(c)}),f("ngModelChange",function(){return t.refreshYaml()}),r(),i(16,"label",11),d(17,"Description"),r(),i(18,"textarea",12),b("ngModelChange",function(c){return m(o),x(t.description,c)||(t.description=c),g(c)}),f("ngModelChange",function(){return t.refreshYaml()}),r(),i(19,"div",13),d(20,"Node Palette"),r(),_(21,de,8,3,"button",14),i(22,"div",13),d(23,"Existing"),r(),_(24,se,5,2,"button",15),r(),i(25,"main",16)(26,"header",17)(27,"div")(28,"h1"),d(29),r(),i(30,"p"),d(31),r()(),i(32,"div",18)(33,"button",19),f("click",function(){return t.resetBuilder()}),d(34,"New"),r(),i(35,"button",19),f("click",function(){return t.refreshData()}),d(36,"Reload"),r(),i(37,"button",20),f("click",function(){return t.saveWorkflow()}),d(38),r(),i(39,"button",21),f("click",function(){return t.runWorkflow()}),d(40,"Run"),r()()(),_(41,ce,2,3,"div",22),i(42,"div",23)(43,"section",24),f("dragover",function(c){return t.onCanvasDragOver(c)})("drop",function(c){return t.onCanvasDrop(c)}),O(44,"div",25),_(45,pe,5,0,"div",26),S(),i(46,"svg",27),_(47,me,1,4,"line",28),r(),_(48,ge,8,10,"button",29),r(),I(),i(49,"aside",30),_(50,we,34,8,"ng-container",31)(51,he,4,0,"ng-template",null,0,A),r()(),i(53,"section",32)(54,"div",33)(55,"div",34),d(56,"Workflow YAML"),r(),i(57,"textarea",35),b("ngModelChange",function(c){return m(o),x(t.yamlPreview,c)||(t.yamlPreview=c),g(c)}),r()(),i(58,"div",36)(59,"div",34),d(60,"Recent Runs"),r(),_(61,xe,8,8,"a",37)(62,be,2,0,"p",38),r()()()()}if(e&2){let o=z(52);s(12),h("ngModel",t.workflowFolder),s(3),h("ngModel",t.workflowName),s(3),h("ngModel",t.description),s(3),u("ngForOf",t.palette),s(3),u("ngForOf",t.workflows),s(5),w(t.workflowId||"untitled-workflow"),s(2),v("",t.nodes.length," nodes \xB7 drag from palette or click a node to edit"),s(6),u("disabled",t.saveState==="saving"),s(),v(" ",t.saveState==="saving"?"Saving...":"Save Workflow"," "),s(),u("disabled",t.nodes.length===0),s(2),u("ngIf",t.statusMessage),s(4),u("ngIf",t.nodes.length===0),s(2),u("ngForOf",t.edges),s(),u("ngForOf",t.nodes),s(2),u("ngIf",t.selectedNode)("ngIfElse",o),s(7),h("ngModel",t.yamlPreview),s(4),u("ngForOf",t.runs),s(),u("ngIf",t.runs.length===0)}},dependencies:[G,j,q,ne,ee,te,U,Z,X,Q,K],styles:["[_nghost-%COMP%]{display:block;min-height:calc(100vh - 56px);background:#101114;color:#e7e7ea}button[_ngcontent-%COMP%], input[_ngcontent-%COMP%], textarea[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{font:inherit}.builder-shell[_ngcontent-%COMP%]{display:grid;grid-template-columns:280px minmax(0,1fr);min-height:calc(100vh - 56px)}.sidebar[_ngcontent-%COMP%]{border-right:1px solid #2b2d33;background:#17181d;padding:16px;overflow:auto}.brand-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;margin-bottom:22px}.brand-mark[_ngcontent-%COMP%]{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:#6366f1;color:#fff;font-weight:700}.brand-title[_ngcontent-%COMP%]{font-size:15px;font-weight:700}.brand-subtitle[_ngcontent-%COMP%], .muted[_ngcontent-%COMP%], small[_ngcontent-%COMP%]{color:#9ca3af}.field-label[_ngcontent-%COMP%], .section-title[_ngcontent-%COMP%]{display:block;margin:14px 0 7px;color:#a1a1aa;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}.text-input[_ngcontent-%COMP%], .text-area[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;border:1px solid #333640;border-radius:7px;background:#101114;color:#f4f4f5;padding:9px 10px;outline:none}.text-input[_ngcontent-%COMP%]:focus, .text-area[_ngcontent-%COMP%]:focus, .yaml-editor[_ngcontent-%COMP%]:focus{border-color:#6366f1;box-shadow:0 0 0 2px #6366f12e}.text-area[_ngcontent-%COMP%]{resize:vertical}.mono[_ngcontent-%COMP%], .yaml-editor[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.palette-item[_ngcontent-%COMP%], .workflow-link[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;width:100%;border:1px solid #2b2d33;border-radius:8px;background:#1f2128;color:#e7e7ea;padding:10px;margin-bottom:8px;text-align:left;cursor:grab}.palette-item[_ngcontent-%COMP%]:hover, .workflow-link[_ngcontent-%COMP%]:hover{border-color:#4f46e5;background:#242633}.palette-icon[_ngcontent-%COMP%]{display:grid;place-items:center;width:28px;height:28px;border-radius:7px;background:#111827;color:#a5b4fc}.palette-item[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], .workflow-link[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-size:13px}.palette-item[_ngcontent-%COMP%] small[_ngcontent-%COMP%], .workflow-link[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{display:block;font-size:11px;margin-top:2px}.workflow-link[_ngcontent-%COMP%]{justify-content:space-between;cursor:pointer}.workspace[_ngcontent-%COMP%]{min-width:0;padding:18px;overflow:auto}.toolbar[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:12px}.toolbar[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;font-size:20px}.toolbar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0 0;color:#9ca3af;font-size:13px}.toolbar-actions[_ngcontent-%COMP%]{display:flex;gap:8px;flex-wrap:wrap}.ghost-button[_ngcontent-%COMP%], .primary-button[_ngcontent-%COMP%], .run-button[_ngcontent-%COMP%], .danger-button[_ngcontent-%COMP%]{border:1px solid #333640;border-radius:7px;padding:8px 12px;color:#f4f4f5;background:#20222a;cursor:pointer}.primary-button[_ngcontent-%COMP%]{background:#4f46e5;border-color:#4f46e5}.run-button[_ngcontent-%COMP%]{background:#059669;border-color:#059669}.danger-button[_ngcontent-%COMP%]{width:100%;margin-top:14px;background:#3f1d24;border-color:#7f1d1d;color:#fecaca}.primary-button[_ngcontent-%COMP%]:disabled, .run-button[_ngcontent-%COMP%]:disabled{opacity:.55;cursor:not-allowed}.status-row[_ngcontent-%COMP%]{border:1px solid #1f5f45;border-radius:8px;background:#092d22;color:#a7f3d0;padding:10px 12px;margin-bottom:12px;font-size:13px}.status-row.error[_ngcontent-%COMP%]{border-color:#7f1d1d;background:#2a1217;color:#fecaca}.builder-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(520px,1fr) 320px;gap:14px;min-height:470px}.canvas[_ngcontent-%COMP%]{position:relative;overflow:hidden;min-height:470px;border:1px solid #2b2d33;border-radius:8px;background:#15161b}.canvas-grid[_ngcontent-%COMP%]{position:absolute;inset:0;background-image:linear-gradient(#24262e 1px,transparent 1px),linear-gradient(90deg,#24262e 1px,transparent 1px);background-size:28px 28px;opacity:.45}.empty-state[_ngcontent-%COMP%]{position:absolute;inset:0;display:grid;place-content:center;text-align:center;color:#9ca3af;pointer-events:none}.empty-state[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 6px;color:#e7e7ea}.edges[_ngcontent-%COMP%]{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.edges[_ngcontent-%COMP%] line[_ngcontent-%COMP%]{stroke:#6366f1;stroke-width:2;stroke-dasharray:5 5;opacity:.8}.node-card[_ngcontent-%COMP%]{position:absolute;z-index:2;display:flex;align-items:center;gap:10px;width:190px;border:1px solid #3f4250;border-radius:8px;background:#20222a;color:#f4f4f5;padding:11px;cursor:move;text-align:left;box-shadow:0 12px 28px #00000038}.node-card.selected[_ngcontent-%COMP%]{border-color:#818cf8;box-shadow:0 0 0 2px #6366f147,0 12px 28px #00000038}.node-kind[_ngcontent-%COMP%]{display:grid;place-items:center;width:30px;height:30px;border-radius:7px;background:#111827;color:#a5b4fc}.node-copy[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], .node-copy[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-copy[_ngcontent-%COMP%]{min-width:0}.inspector[_ngcontent-%COMP%], .yaml-panel[_ngcontent-%COMP%], .runs-panel[_ngcontent-%COMP%]{border:1px solid #2b2d33;border-radius:8px;background:#17181d;padding:14px}.panel-title[_ngcontent-%COMP%]{margin-bottom:12px;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#d4d4d8}.check-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:8px 0;color:#d4d4d8;font-size:13px}.bottom-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:14px;margin-top:14px}.yaml-editor[_ngcontent-%COMP%]{width:100%;min-height:260px;box-sizing:border-box;border:1px solid #333640;border-radius:7px;background:#0f1014;color:#d4d4d8;padding:12px;resize:vertical}.run-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:12px;padding:10px 0;color:#e7e7ea;text-decoration:none;border-bottom:1px solid #252730}.run-row[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], .run-row[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{display:block}.run-row[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.status-completed[_ngcontent-%COMP%]{color:#34d399}.status-failed[_ngcontent-%COMP%]{color:#f87171}.status-running[_ngcontent-%COMP%]{color:#60a5fa}.status-default[_ngcontent-%COMP%]{color:#a1a1aa}@media(max-width:980px){.builder-shell[_ngcontent-%COMP%], .builder-grid[_ngcontent-%COMP%], .bottom-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}.sidebar[_ngcontent-%COMP%]{border-right:0;border-bottom:1px solid #2b2d33}.toolbar[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column}}"]})};function Ce(l,n){switch(l){case"bash":return`echo "${n}"`;case"command":return n;case"prompt":return`Complete ${n} and summarize the result.`}}var re="claude";function ye(l,n,e){let t=[`name: ${y(l)||"new-workflow"}`,`description: ${E(n||"Draft workflow")}`,`provider: ${re}`,"model: sonnet","nodes:"];for(let o of e)if(t.push(` - id: ${o.id}`),o.dependsOn.length>0&&t.push(` depends_on: [${o.dependsOn.join(", ")}]`),o.provider&&t.push(` provider: ${o.provider}`),o.model&&t.push(` model: ${o.model}`),o.type==="bash")t.push(` bash: ${E(o.content||"echo ok")}`);else if(o.type==="command")t.push(` command: ${E(o.content||o.id)}`);else{t.push(" prompt: |");for(let a of(o.content||`Complete ${o.id}`).split(`
|
|
2
|
-
`))t.push(` ${a}`)}return`${t.join(`
|
|
3
|
-
`)}
|
|
4
|
-
`}function y(l){return l.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}function W(l){return l.split("/").map(y).filter(Boolean).join("/")}function ve(l,n){let e=y(n)||"node";if(!l.includes(e))return e;let t=2;for(;l.includes(`${e}-${t}`);)t++;return`${e}-${t}`}function E(l){return JSON.stringify(l)}export{ie as WorkflowBuilderComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as we,e as Ie}from"./chunk-UN7U5NAR.js";import{a as Se,b as De,e as ke,j as Ne,k as B}from"./chunk-LPQARKUF.js";import{$ as z,$a as ce,Ba as F,Fa as ee,Ib as xe,J as de,Jb as ye,Ka as D,Kb as Ce,La as C,Ma as E,Na as pe,Nb as Ee,O as S,Oa as P,Ob as A,Pa as H,Qa as g,Ra as d,Sa as o,T as M,Ta as k,U as T,Ub as Me,V as G,Xa as R,Ya as h,Za as m,a as oe,aa as ue,ab as me,b as se,bb as ge,ea as le,eb as K,f as ae,gb as l,hb as w,ib as q,jb as j,kb as he,lb as fe,mb as be,oa as Z,qa as a,qb as ve,rb as _e}from"./chunk-WDOCF7IL.js";var X=class i{zone=S(ue);projectService=S(Me);connect(t){return new ae(e=>{let n=this.projectService.currentId,r=n?`?project=${encodeURIComponent(n)}`:"",s=new EventSource(`/api/runs/${t}/events${r}`),_=["node:start","node:complete","node:skip","node:fail","run:complete","run:state","run:pause","run:cancel"];for(let p of _)s.addEventListener(p,u=>{this.zone.run(()=>{e.next({type:p,data:JSON.parse(u.data)})})});return s.onerror=()=>{this.zone.run(()=>{e.complete()}),s.close()},()=>{s.close()}})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=de({token:i,factory:i.\u0275fac,providedIn:"root"})};var qe=new Set(["completed","failed","cancelled"]);function ne(i){return i!==void 0&&qe.has(i)}function Te(i,t=new Date().toISOString()){ne(i.status)&&!i.completedAt&&(i.completedAt=t)}var Be="Approval required",Xe="Run paused \u2014 input required to continue.";function W(i){return`${i.nodeId}\0${i.iteration??""}\0${i.message}`}function Re(i){let t=Oe(i);if(t)return t;let e=i.approval;if(e&&typeof e=="object")return Oe(e)}function Oe(i){let t=V(i.approvalNodeId)??V(i.nodeId);if(!t)return;let e=V(i.approvalMessage)??V(i.message),n=V(i.approvalType)??V(i.type),r=i.iteration;return{nodeId:t,message:e||Be,type:n==="interactive_loop"?"interactive_loop":"approval",iteration:typeof r=="number"?r:void 0}}function V(i){return typeof i=="string"&&i!==""?i:void 0}var Y=class{current;state="hidden";error;answeredKey;pauseReceived(t){this.current=Re(t)??Ge(),this.state="ready",this.error=void 0}runStateChanged(t,e){if(t!=="paused"){this.current=void 0,this.state="hidden",this.error=void 0,this.answeredKey=void 0;return}if(this.state==="submitting")return;let n=e?Re(e):void 0,r=n?W(n):void 0;r!==void 0&&r===this.answeredKey||this.current&&r!==void 0&&r===W(this.current)||this.current&&n===void 0||(this.current=n??Ge(),this.state="ready",this.error=void 0)}submitStarted(){this.state!=="hidden"&&(this.state="submitting",this.error=void 0)}submitFailed(t){this.state!=="hidden"&&(this.state="error",this.error=t)}submitSucceeded(){this.current&&(this.answeredKey=W(this.current)),this.current=void 0,this.state="hidden",this.error=void 0}visible(){return this.state!=="hidden"}phase(){return this.state}request(){return this.current}errorMessage(){return this.error}submitAction(){return this.current?.type==="interactive_loop"?"resume":"approve"}};function Ge(){return{nodeId:"",message:Xe,type:"approval"}}function Fe(i,t,e=new Date().toISOString()){let n=`gate:${W(t)}`;return i.some(r=>r.key===n)?i:[...i,{key:n,role:"gate",text:t.message,at:e,nodeId:t.nodeId,iteration:t.iteration}]}function ie(i,t,e,n=new Date().toISOString()){return[...i,{key:`user:${i.length}:${n}`,role:"user",kind:t,text:Ye(t,e),at:n}]}function Ye(i,t){let e=t.trim();switch(i){case"answer":return e;case"approve":return e?`Approved: ${e}`:"Approved";case"reject":return e?`Rejected: ${e}`:"Rejected"}}function Ae(i){return Ue(i).split(/`([^`]*)`/).map((n,r)=>r%2===1?`<code>${n}</code>`:n.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>")).join("").replace(/\n/g,"<br>")}function Ue(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ve(i){let t=new Map(i.map(c=>[c.key,c])),e=new Map,n=new Set,r=c=>{let b=e.get(c);if(b!==void 0)return b;if(n.has(c))return 0;n.add(c);let N=(t.get(c)?.dependsOn??[]).filter(y=>t.has(y)),x=N.length===0?0:Math.max(...N.map(r))+1;return n.delete(c),e.set(c,x),x};for(let c of i)r(c.key);let s=new Map;for(let c of i){let b=e.get(c.key);(s.get(b)??s.set(b,[]).get(b)).push(c.key)}let _=196,p=84,u=[...s.keys()].sort((c,b)=>c-b),f=new Map;for(let c of u){let b=s.get(c);if(c===0){b.forEach((x,y)=>f.set(x,y));continue}let N=x=>{let y=(t.get(x)?.dependsOn??[]).filter(L=>f.has(L));return y.length===0?f.get(x)??0:y.reduce((L,ze)=>L+f.get(ze),0)/y.length};b.sort((x,y)=>N(x)-N(y)),b.forEach((x,y)=>f.set(x,y))}let I=Math.max(1,...u.map(c=>s.get(c).length))*_,O=new Map;for(let c of u){let b=s.get(c),N=b.length*_,x=(I-N)/2;b.forEach((y,L)=>O.set(y,{x:x+L*_,y:c*p}))}let We=((u.length?u[u.length-1]:0)+1)*p;return{positions:O,layerOf:e,width:I,height:We}}var Je=["host"];function Ze(i,t){if(i&1&&(G(),k(0,"path",9)),i&2){let e=t.$implicit;D("d",e)}}function et(i,t){if(i&1&&(G(),d(0,"text",16),l(1),o()),i&2){let e=m().$implicit,n=m();D("x",n.NODE_W-12)("y",n.NODE_H/2+5),a(),j("",e.progress.done,"/",e.progress.total)}}function tt(i,t){if(i&1&&(G(),d(0,"text",17),l(1,"\u29C9"),o()),i&2){let e=m(2);D("x",e.NODE_W-12)("y",14)}}function nt(i,t){if(i&1){let e=R();G(),d(0,"g",10),h("click",function(){let r=M(e).$implicit,s=m();return T(s.nodeClick.emit(r.key))}),k(1,"rect",11),d(2,"text",12),l(3),o(),d(4,"text",13),l(5),o(),ee(6,et,2,4,"text",14)(7,tt,2,2,"text",15),o()}if(i&2){let e=t.$implicit,n=m();D("transform","translate("+e.x+","+e.y+")"),a(),K("dag-pulse",e.status==="running"),D("width",n.NODE_W)("height",n.NODE_H)("fill",n.fillFor(e.status))("stroke",n.strokeFor(e.status)),a(),D("y",n.NODE_H/2+5)("fill",n.strokeFor(e.status)),a(),w(n.icon(e.status)),a(),D("y",n.NODE_H/2+5),a(),w(n.clip(e.label)),a(),g("ngIf",e.progress),a(),g("ngIf",e.isGroup)}}var $=class i{NODE_W=168;NODE_H=44;nodes=[];edges=[];width=0;height=0;nodeClick=new z;hostRef;scale=1;panX=16;panY=40;dragging=!1;lastX=0;lastY=0;get edgePaths(){let t=new Map(this.nodes.map(n=>[n.key,n])),e=[];for(let n of this.edges){let r=t.get(n.from),s=t.get(n.to);if(!r||!s)continue;let _=r.x+168/2,p=r.y+44,u=s.x+168/2,f=s.y,v=(p+f)/2;e.push(`M${_} ${p} C${_} ${v}, ${u} ${v}, ${u} ${f}`)}return e}onWheel(t){t.preventDefault(),this.zoomBy(t.deltaY<0?1.1:.9)}zoomBy(t,e){e?.stopPropagation(),this.scale=Math.min(2.5,Math.max(.2,this.scale*t))}onDown(t){this.dragging=!0,this.lastX=t.clientX,this.lastY=t.clientY}onMove(t){this.dragging&&(this.panX+=t.clientX-this.lastX,this.panY+=t.clientY-this.lastY,this.lastX=t.clientX,this.lastY=t.clientY)}onUp(){this.dragging=!1}fit(){if(!this.width||!this.height){this.scale=1,this.panX=16,this.panY=40;return}let t=this.hostRef?.nativeElement,e=t?.clientWidth??600,n=t?.clientHeight??400;this.scale=Math.min(2,Math.max(.2,Math.min((e-32)/this.width,(n-48)/this.height))),this.panX=Math.max(16,(e-this.width*this.scale)/2),this.panY=44}clip(t){return t.length>20?t.slice(0,19)+"\u2026":t}icon(t){return{completed:"\u2713",running:"\u25CF",failed:"\u2717",skipped:"\u2298"}[t]??"\u25CB"}fillFor(t){return{completed:"rgba(34,197,94,.14)",running:"rgba(59,130,246,.16)",failed:"rgba(239,68,68,.14)"}[t]??"rgba(30,41,59,.9)"}strokeFor(t){return{completed:"#22c55e",running:"#3b82f6",failed:"#ef4444",skipped:"#64748b"}[t]??"#475569"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=F({type:i,selectors:[["app-dag-graph"]],viewQuery:function(e,n){if(e&1&&ce(Je,5),e&2){let r;me(r=ge())&&(n.hostRef=r.first)}},inputs:{nodes:"nodes",edges:"edges",width:"width",height:"height"},outputs:{nodeClick:"nodeClick"},decls:16,vars:7,consts:[["host",""],[1,"relative","w-full","h-full","overflow-hidden","select-none","bg-slate-950/40",3,"wheel","mousedown","mousemove","mouseup","mouseleave"],[1,"absolute","top-2","left-2","z-10","flex","gap-1","items-center"],["type","button",1,"dag-btn",3,"click"],[1,"text-xs","text-slate-400","w-10","text-center","font-mono"],["type","button",1,"dag-btn","px-2","w-auto",3,"click"],[1,"absolute","inset-0","w-full","h-full"],["fill","none","stroke","#475569","stroke-width","2","opacity","0.8",4,"ngFor","ngForOf"],["class","cursor-pointer",3,"click",4,"ngFor","ngForOf"],["fill","none","stroke","#475569","stroke-width","2","opacity","0.8"],[1,"cursor-pointer",3,"click"],["rx","9","stroke-width","2"],["x","16","font-size","15"],["x","34","font-size","13","fill","#e2e8f0"],["text-anchor","end","font-size","10","fill","#94a3b8",4,"ngIf"],["text-anchor","end","font-size","11","fill","#94a3b8",4,"ngIf"],["text-anchor","end","font-size","10","fill","#94a3b8"],["text-anchor","end","font-size","11","fill","#94a3b8"]],template:function(e,n){e&1&&(d(0,"div",1,0),h("wheel",function(s){return n.onWheel(s)})("mousedown",function(s){return n.onDown(s)})("mousemove",function(s){return n.onMove(s)})("mouseup",function(){return n.onUp()})("mouseleave",function(){return n.onUp()}),d(2,"div",2)(3,"button",3),h("click",function(s){return n.zoomBy(.8,s)}),l(4,"\u2212"),o(),d(5,"span",4),l(6),ve(7,"number"),o(),d(8,"button",3),h("click",function(s){return n.zoomBy(1.25,s)}),l(9,"+"),o(),d(10,"button",5),h("click",function(){return n.fit()}),l(11,"fit"),o()(),G(),d(12,"svg",6)(13,"g"),ee(14,Ze,1,1,"path",7)(15,nt,8,14,"g",8),o()()()),e&2&&(a(6),q("",_e(7,4,n.scale*100,"1.0-0"),"%"),a(7),D("transform","translate("+n.panX+","+n.panY+") scale("+n.scale+")"),a(),g("ngForOf",n.edgePaths),a(),g("ngForOf",n.nodes))},dependencies:[A,ye,Ce,Ee],styles:[".dag-btn[_ngcontent-%COMP%]{width:24px;height:24px;border:1px solid #334155;border-radius:6px;background:#1e293b;color:#94a3b8;font-size:13px;line-height:1}.dag-btn[_ngcontent-%COMP%]:hover{color:#e2e8f0}.dag-pulse[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_dagpulse 1.3s ease-in-out infinite}@keyframes _ngcontent-%COMP%_dagpulse{0%,to{opacity:1}50%{opacity:.45}}"]})};function U(i,t=""){let e=t===""?"":t+".",n=i.filter(u=>t===""||u.id===t||u.id.startsWith(e)),r=new Map(i.map(u=>[u.id,u])),s=new Map;for(let u of n){let f=t===""?u.id:u.id.slice(e.length),v=f.split(".")[0];if(!v)continue;let I=s.get(v);I||(I={key:e+v,label:v,leafIds:[],deeper:!1},s.set(v,I)),I.leafIds.push(u.id),f.includes(".")&&(I.deeper=!0)}let _=u=>{if(t!==""&&u!==t&&!u.startsWith(e))return;let v=(t===""?u:u.slice(e.length)).split(".")[0];return s.has(v)?e+v:void 0},p=[];for(let u of s.values()){let f=new Set;for(let v of u.leafIds)for(let I of r.get(v)?.dependsOn??[]){let O=_(I);O&&O!==u.key&&f.add(O)}p.push({key:u.key,label:u.label,isGroup:u.deeper,leafIds:u.leafIds,dependsOn:[...f]})}return p}var Pe=new Set(["completed","skipped"]);function He(i,t){let e=i.map(t);return e.some(n=>n==="failed")?"failed":e.some(n=>n==="running")?"running":e.length>0&&e.every(n=>n==="skipped")?"skipped":e.length>0&&e.every(n=>Pe.has(n))?"completed":e.some(n=>n==="completed")?"running":"pending"}function Ke(i,t){let e=i.map(t);return{done:e.filter(n=>Pe.has(n)).length,total:e.length}}function Q(i,t,e=""){let n=U(i,e),r=Ve(n.map(p=>({key:p.key,dependsOn:p.dependsOn}))),s=n.map(p=>{let u=r.positions.get(p.key)??{x:0,y:0};return{key:p.key,label:p.label,isGroup:p.isGroup,status:p.isGroup?He(p.leafIds,t):t(p.leafIds[0]),progress:p.isGroup?Ke(p.leafIds,t):void 0,x:u.x,y:u.y}}),_=[];for(let p of n)for(let u of p.dependsOn)_.push({from:u,to:p.key});return{vms:s,edges:_,width:r.width,height:r.height}}function it(i,t){i&1&&(d(0,"span"),l(1," \u203A "),o())}function rt(i,t){if(i&1){let e=R();d(0,"button",10),h("click",function(){let r=M(e).$implicit,s=m();return T(s.goTo(r))}),l(1),o(),C(2,it,2,0,"span")}if(i&2){let e=t.$implicit,n=t.$index,r=t.$count,s=m();a(),w(s.label(e)),a(),E(n!==r-1?2:-1)}}function ot(i,t){i&1&&(d(0,"div",11),l(1,"\u0110ang t\u1EA3i output\u2026"),o())}function st(i,t){if(i&1&&(d(0,"div",12),l(1),o()),i&2){let e=m(2);a(),w(e.leafError)}}function at(i,t){if(i&1&&(d(0,"pre",13),l(1),o()),i&2){let e=m(3);a(),w(e.leafData==null?null:e.leafData.error)}}function dt(i,t){if(i&1&&(d(0,"pre",14),l(1),o()),i&2){let e=m(3);a(),w(e.leafData==null?null:e.leafData.output)}}function ut(i,t){i&1&&(d(0,"div",15),l(1,"Kh\xF4ng c\xF3 output"),o())}function lt(i,t){if(i&1&&(C(0,at,2,1,"pre",13),C(1,dt,2,1,"pre",14)(2,ut,2,0,"div",15)),i&2){let e=m(2);E(e.leafData!=null&&e.leafData.error?0:-1),a(),E(e.leafData!=null&&e.leafData.output?1:e.leafData!=null&&e.leafData.error?-1:2)}}function pt(i,t){if(i&1&&(d(0,"div",8),C(1,ot,2,0,"div",11)(2,st,2,1,"div",12)(3,lt,3,2),o()),i&2){let e,n=m();a(),E((e=n.leafPhase)==="loading"?1:e==="error"?2:e==="loaded"?3:-1)}}function ct(i,t){if(i&1){let e=R();d(0,"app-dag-graph",16),h("nodeClick",function(r){M(e);let s=m();return T(s.onSubClick(r))}),o()}if(i&2){let e=m();g("nodes",e.subNodes)("edges",e.subEdges)("width",e.subWidth)("height",e.subHeight)}}var J=class i{api=S(B);runId="";nodes=[];statusOf=()=>"pending";rootKey="";close=new z;breadcrumb=[];isLeaf=!1;subNodes=[];subEdges=[];subWidth=0;subHeight=0;leafPhase="loading";leafData;leafError="";ngOnChanges(t){if(t.rootKey){this.breadcrumb=[],this.goTo(this.rootKey);return}(t.nodes||t.statusOf)&&!this.isLeaf&&this.breadcrumb.length&&this.buildSubView(this.breadcrumb[this.breadcrumb.length-1])}goTo(t){let e=this.breadcrumb.indexOf(t);this.breadcrumb=e>=0?this.breadcrumb.slice(0,e+1):[...this.breadcrumb,t];let n=U(this.nodes,t);if(this.isLeaf=n.length===0,this.isLeaf){this.loadLeaf(t);return}this.buildSubView(t)}buildSubView(t){let e=Q(this.nodes,this.statusOf,t);this.subNodes=e.vms,this.subEdges=e.edges,this.subWidth=e.width,this.subHeight=e.height}onSubClick(t){this.goTo(t)}loadLeaf(t){this.leafPhase="loading",this.api.getNodeOutput(this.runId,t).subscribe({next:e=>{this.leafData={output:e.output,error:e.error},this.leafPhase="loaded"},error:e=>{this.leafError=e?.error?.error??"Kh\xF4ng t\u1EA3i \u0111\u01B0\u1EE3c output.",this.leafPhase="error"}})}label(t){return t.split(".").pop()??t}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=F({type:i,selectors:[["app-node-inspector"]],inputs:{runId:"runId",nodes:"nodes",statusOf:"statusOf",rootKey:"rootKey"},outputs:{close:"close"},features:[le],decls:13,vars:1,consts:[[1,"absolute","inset-0","z-20","flex"],[1,"absolute","inset-0","bg-black/40",3,"click"],[1,"relative","m-3","flex-1","max-w-[78%]","bg-slate-900","border","border-slate-700","rounded-xl","shadow-2xl","flex","flex-col","overflow-hidden"],[1,"flex","items-center","gap-2","px-4","py-2.5","border-b","border-slate-800","text-sm"],[1,"text-slate-500"],[1,"flex-1"],["type","button",1,"text-slate-400","hover:text-slate-100",3,"click"],[1,"flex-1","min-h-0","relative"],[1,"absolute","inset-0","overflow-auto","p-4","text-xs"],[3,"nodes","edges","width","height"],["type","button",1,"hover:text-slate-200",3,"click"],[1,"text-slate-500","animate-pulse"],[1,"text-red-400"],[1,"font-mono","text-red-300","bg-red-500/10","border","border-red-500/30","rounded","p-3","mb-2","whitespace-pre-wrap","break-words"],[1,"font-mono","text-slate-300","bg-slate-950","border","border-slate-800","rounded","p-3","whitespace-pre-wrap","break-words"],[1,"text-slate-500","italic"],[3,"nodeClick","nodes","edges","width","height"]],template:function(e,n){e&1&&(d(0,"div",0)(1,"div",1),h("click",function(){return n.close.emit()}),o(),d(2,"div",2)(3,"div",3)(4,"span",4),P(5,rt,3,2,null,null,pe),o(),k(7,"span",5),d(8,"button",6),h("click",function(){return n.close.emit()}),l(9,"\u2715"),o()(),d(10,"div",7),C(11,pt,4,1,"div",8)(12,ct,1,4,"app-dag-graph",9),o()()()),e&2&&(a(5),H(n.breadcrumb),a(6),E(n.isLeaf?11:12))},dependencies:[A,$],encapsulation:2})};var mt=(i,t)=>t.id,gt=(i,t)=>t.key;function ht(i,t){if(i&1&&(d(0,"span",6),l(1),o()),i&2){let e=m();g("ngClass",e.statusClass(e.run.status)),a(),j(" ",e.statusIcon(e.run.status)," ",e.run.status," ")}}function ft(i,t){i&1&&(d(0,"div",10),l(1,"Kh\xF4ng d\u1EF1ng \u0111\u01B0\u1EE3c s\u01A1 \u0111\u1ED3 ph\u1EE5 thu\u1ED9c \u2014 hi\u1EC3n th\u1ECB theo th\u1EE9 t\u1EF1 ch\u1EA1y."),o())}function bt(i,t){if(i&1){let e=R();d(0,"app-node-inspector",23),h("close",function(){M(e);let r=m();return T(r.closeInspector())}),o()}if(i&2){let e=m();g("runId",e.run.runId)("nodes",e.dagInputNodes)("statusOf",e.statusOf)("rootKey",e.inspectorKey)}}function vt(i,t){if(i&1&&(d(0,"div",24)(1,"div",25),k(2,"div",26),o()()),i&2){let e=t.$implicit,n=m();K("justify-end",e.role==="user"),a(),g("ngClass",e.role==="user"?"bg-indigo-500/15 text-indigo-100":"bg-slate-800 text-slate-200"),a(),g("innerHTML",n.render(e.content),Z)}}function _t(i,t){i&1&&(d(0,"div",16),l(1,"\u2014 phi\xEAn hi\u1EC7n t\u1EA1i \u2014"),o())}function xt(i,t){if(i&1&&(d(0,"div",27),l(1),o()),i&2){let e=m().$implicit;a(),j(" \u23F8 ",e.nodeId||"gate","",e.iteration!==void 0?" \xB7 iteration "+e.iteration:""," ")}}function yt(i,t){if(i&1&&(d(0,"div",24)(1,"div",25),C(2,xt,2,2,"div",27),k(3,"div",26),o()()),i&2){let e=t.$implicit,n=m();K("justify-end",e.role==="user"),a(),g("ngClass",e.role==="user"?"bg-indigo-500/15 text-indigo-100":"bg-slate-800 text-slate-200"),a(),E(e.role==="gate"?2:-1),a(),g("innerHTML",n.render(e.text),Z)}}function Ct(i,t){if(i&1&&(d(0,"div",19),l(1),o()),i&2){let e=m();a(),w(e.gate.errorMessage())}}var je=class i{route=S(we);api=S(B);sse=S(X);run;gate=new Y;feed=[];messages=[];draft="";runId="";sseSub;timerInterval;focusAnswerOnShow=!1;dagNodes=[];dagEdges=[];dagWidth=0;dagHeight=0;dagInputNodes=[];statusMap=new Map;ngOnInit(){this.runId=this.route.snapshot.paramMap.get("runId"),this.focusAnswerOnShow=this.route.snapshot.fragment==="answer",this.api.getRun(this.runId).subscribe(t=>{this.run=t,t.conversationId&&this.api.getConversationMessages(t.conversationId).subscribe({next:e=>{this.messages=e.messages},error:()=>{this.messages=[]}}),this.rebuildDag(),this.stopTimerIfFinished(),this.syncGateFromRun()}),this.sseSub=this.sse.connect(this.runId).subscribe(t=>{this.handleSseEvent(t)}),this.timerInterval=setInterval(()=>{},1e3)}ngOnDestroy(){this.sseSub?.unsubscribe(),this.timerInterval&&clearInterval(this.timerInterval)}inspectorKey=null;onNodeClick(t){this.inspectorKey=t}closeInspector(){this.inspectorKey=null}hierInput(){let t=this.run?.graph?.nodes;if(t&&t.length)return t.map(n=>({id:n.id,dependsOn:n.dependsOn}));let e=this.run?Object.keys(this.run.nodes):[];return e.map((n,r)=>({id:n,dependsOn:r===0?[]:[e[r-1]]}))}statusOf=t=>this.statusMap.get(t)??"pending";syncStatusMap(){if(this.run)for(let[t,e]of Object.entries(this.run.nodes))this.statusMap.has(t)||this.statusMap.set(t,e.status)}rebuildDag(){if(!this.run)return;this.syncStatusMap(),this.dagInputNodes=this.hierInput();let t=Q(this.dagInputNodes,this.statusOf,"");this.dagNodes=t.vms,this.dagEdges=t.edges,this.dagWidth=t.width,this.dagHeight=t.height}handleSseEvent(t){let e=t.data,n=e.nodeId;switch(t.type){case"run:state":{let r=e;this.run=se(oe({},r),{graph:r.graph??this.run?.graph,conversationId:r.conversationId??this.run?.conversationId}),this.rebuildDag(),this.stopTimerIfFinished(),this.syncGateFromRun();break}case"run:pause":this.run&&(this.run.status="paused"),this.gate.pauseReceived(e),this.noteGateInFeed(),this.maybeFocusAnswer();break;case"run:cancel":this.run&&(this.run.status="cancelled"),this.gate.runStateChanged("cancelled"),this.stopTimerIfFinished();break;case"node:start":this.updateNodeStatus(n,"running",void 0,{provider:e.provider,model:e.model});break;case"node:complete":this.updateNodeStatus(n,"completed",e.durationMs);break;case"node:skip":this.updateNodeStatus(n,"skipped");break;case"node:fail":this.updateNodeStatus(n,"failed");break;case"run:complete":this.run&&(this.run.status=e.success?"completed":"failed",this.gate.runStateChanged(this.run.status)),this.stopTimerIfFinished();break}}updateNodeStatus(t,e,n,r){this.statusMap.set(t,e),this.rebuildDag()}syncGateFromRun(){this.run&&(this.gate.runStateChanged(this.run.status,this.run),this.noteGateInFeed(),this.maybeFocusAnswer())}noteGateInFeed(){let t=this.gate.request();this.gate.visible()&&t&&(this.feed=Fe(this.feed,t))}sendAnswer(){if(!this.gate.visible()||this.gate.phase()==="submitting")return;let t=this.draft.trim(),e=this.gate.submitAction();if(e==="resume"&&!t)return;this.gate.submitStarted(),(e==="resume"?this.api.resumeRun(this.runId,t):this.api.approveRun(this.runId,t||void 0)).subscribe({next:()=>{this.feed=ie(this.feed,e==="resume"?"answer":"approve",t),this.draft="",this.gate.submitSucceeded()},error:r=>this.gate.submitFailed(r?.error?.error??"Failed to send the answer.")})}rejectGate(){if(!this.gate.visible()||this.gate.phase()==="submitting")return;let t=prompt("Rejection reason","Rejected by operator");t!==null&&(this.gate.submitStarted(),this.api.rejectRun(this.runId,t||void 0).subscribe({next:()=>{this.feed=ie(this.feed,"reject",t),this.gate.submitSucceeded()},error:e=>this.gate.submitFailed(e?.error?.error??"Failed to reject the run.")}))}render(t){return Ae(t)}maybeFocusAnswer(){!this.focusAnswerOnShow||!this.gate.visible()||(this.focusAnswerOnShow=!1,setTimeout(()=>{document.getElementById("gate-answer-panel")?.scrollIntoView({behavior:"smooth",block:"center"}),document.getElementById("gate-answer-input")?.focus()}))}stopTimerIfFinished(){!this.run||!ne(this.run.status)||(Te(this.run),this.timerInterval&&(clearInterval(this.timerInterval),this.timerInterval=void 0))}statusClass(t){switch(t){case"completed":return"bg-green-500/10 text-green-400";case"failed":return"bg-red-500/10 text-red-400";case"running":return"bg-blue-500/10 text-blue-400";default:return"bg-slate-700 text-slate-400"}}statusIcon(t){switch(t){case"completed":return"\u2713";case"failed":return"\u2717";case"running":return"\u25CF";default:return"\u25CB"}}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=F({type:i,selectors:[["app-run-execution"]],decls:35,vars:17,consts:[[1,"flex","flex-col","h-[calc(100vh-6rem)]"],[1,"flex","items-center","mb-3","gap-2","text-sm","shrink-0"],["routerLink","/",1,"text-slate-500","hover:text-slate-300"],[1,"text-slate-600"],[1,"text-slate-300"],[1,"font-mono","text-slate-100"],[1,"text-xs","px-2","py-0.5","rounded","ml-2",3,"ngClass"],[1,"flex-1","flex","min-h-0","gap-3"],[1,"flex-[1.6]","min-w-0","border","border-slate-800","rounded-lg","overflow-hidden","relative"],[3,"nodeClick","nodes","edges","width","height"],[1,"absolute","bottom-2","left-2","text-[10px]","text-slate-500"],[3,"runId","nodes","statusOf","rootKey"],[1,"flex-1","min-w-0","flex","flex-col","border","border-slate-800","rounded-lg","overflow-hidden"],[1,"px-3","py-2","border-b","border-slate-800","text-sm","text-slate-200","shrink-0"],[1,"flex-1","overflow-auto","p-3","space-y-2"],[1,"flex",3,"justify-end"],[1,"text-[10px]","text-slate-600","text-center"],["id","gate-answer-panel",1,"border-t","border-slate-800","p-3","shrink-0","bg-slate-900/40"],["id","gate-answer-input","rows","2",1,"w-full","rounded","border","border-slate-700","bg-slate-950","p-2","text-sm","text-slate-100","focus:border-amber-500","focus:outline-none",3,"ngModelChange","ngModel","disabled","placeholder"],[1,"text-xs","text-red-400","mt-1"],[1,"flex","gap-2","mt-2"],["type","button",1,"rounded","bg-amber-500","px-3","py-1.5","text-sm","font-semibold","text-slate-950","hover:bg-amber-400","disabled:opacity-40","disabled:cursor-not-allowed",3,"click","disabled"],["type","button",1,"rounded","border","border-red-500/50","px-3","py-1.5","text-sm","text-red-300","hover:bg-red-500/10","disabled:opacity-40",3,"click","disabled"],[3,"close","runId","nodes","statusOf","rootKey"],[1,"flex"],[1,"max-w-[90%]","rounded-lg","px-3","py-2","text-sm",3,"ngClass"],[3,"innerHTML"],[1,"text-[10px]","uppercase","tracking-wide","text-amber-400","mb-1"]],template:function(e,n){e&1&&(d(0,"div",0)(1,"div",1)(2,"a",2),l(3,"Dashboard"),o(),d(4,"span",3),l(5,"\u203A"),o(),d(6,"span",4),l(7),o(),d(8,"span",3),l(9,"\u203A"),o(),d(10,"span",5),l(11),o(),C(12,ht,2,3,"span",6),o(),d(13,"div",7)(14,"div",8)(15,"app-dag-graph",9),h("nodeClick",function(s){return n.onNodeClick(s)}),o(),C(16,ft,2,0,"div",10),C(17,bt,1,4,"app-node-inspector",11),o(),d(18,"div",12)(19,"div",13),l(20,"\u{1F4AC} H\u1ED9i tho\u1EA1i"),o(),d(21,"div",14),P(22,vt,3,4,"div",15,mt),C(24,_t,2,0,"div",16),P(25,yt,4,5,"div",15,gt),o(),d(27,"div",17)(28,"textarea",18),be("ngModelChange",function(s){return fe(n.draft,s)||(n.draft=s),s}),o(),C(29,Ct,2,1,"div",19),d(30,"div",20)(31,"button",21),h("click",function(){return n.sendAnswer()}),l(32),o(),d(33,"button",22),h("click",function(){return n.rejectGate()}),l(34," T\u1EEB ch\u1ED1i "),o()()()()()()),e&2&&(a(7),w(n.run==null?null:n.run.workflow),a(4),w(n.run==null?null:n.run.runId),a(),E(n.run?12:-1),a(3),g("nodes",n.dagNodes)("edges",n.dagEdges)("width",n.dagWidth)("height",n.dagHeight),a(),E(!(n.run==null||n.run.graph==null||n.run.graph.nodes==null)&&n.run.graph.nodes.length?-1:16),a(),E(n.inspectorKey?17:-1),a(5),H(n.messages),a(2),E(n.messages.length&&n.feed.length?24:-1),a(),H(n.feed),a(3),he("ngModel",n.draft),g("disabled",n.gate.phase()==="submitting")("placeholder",n.gate.visible()?n.gate.submitAction()==="resume"?"Nh\u1EADp c\xE2u tr\u1EA3 l\u1EDDi\u2026":"Ph\u1EA3n h\u1ED3i (tu\u1EF3 ch\u1ECDn)\u2026":"Ch\u1EC9 tr\u1EA3 l\u1EDDi \u0111\u01B0\u1EE3c khi run \u0111ang t\u1EA1m d\u1EEBng."),a(),E(n.gate.errorMessage()?29:-1),a(2),g("disabled",!n.gate.visible()||n.gate.phase()==="submitting"||n.gate.submitAction()==="resume"&&!n.draft.trim()),a(),q(" ",n.gate.phase()==="submitting"?"\u0110ang g\u1EEDi\u2026":"G\u1EEDi"," "),a(),g("disabled",!n.gate.visible()||n.gate.phase()==="submitting"))},dependencies:[A,xe,Ne,Se,De,ke,Ie,$,J],encapsulation:2})};export{je as RunExecutionComponent};
|