qpilot 0.6.0 → 0.7.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +13 -13
- package/.next/standalone/.next/app-path-routes-manifest.json +4 -4
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +7 -7
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/api/run/[id]/answer/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/run/[id]/pause/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/run/[id]/shot/[num]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/run/[id]/stream/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/run/route.js +15 -7
- package/.next/standalone/.next/server/app/api/run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/run/[id]/page.js +1 -1
- package/.next/standalone/.next/server/app/run/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +4 -4
- package/.next/standalone/.next/server/functions-config-manifest.json +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/pages/_error.js +2 -2
- package/.next/standalone/.next/static/chunks/app/run/[id]/page-3b25ede818499602.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/.next/static/chunks/app/run/[id]/page-3b25ede818499602.js +1 -0
- package/bin/qa-agent.js +6 -6
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/app/run/[id]/page-92ff9979008aa551.js +0 -1
- package/.next/static/chunks/app/run/[id]/page-92ff9979008aa551.js +0 -1
- /package/.next/standalone/.next/static/{0BGJbDsEr9uK-bZGpV9qy → OTVFCdqWzaakBh2l-H9cW}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{0BGJbDsEr9uK-bZGpV9qy → OTVFCdqWzaakBh2l-H9cW}/_ssgManifest.js +0 -0
- /package/.next/static/{0BGJbDsEr9uK-bZGpV9qy → OTVFCdqWzaakBh2l-H9cW}/_buildManifest.js +0 -0
- /package/.next/static/{0BGJbDsEr9uK-bZGpV9qy → OTVFCdqWzaakBh2l-H9cW}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{191:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>U});var n=r(5155),s=r(2115),a=r(2619),i=r.n(a),o=r(3229),l=r(3228),d=r(2638),c=r(3410),u=r(9746),g=r(7274),x=r(8215),m=r(5352),p=r(4788),f=r(7212),b=r(3916),h=r(1083),v=r(2027),j=r(3101),N=r(5016);let w=(0,j.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(e){let{className:t,variant:r="default",render:n,...s}=e;return(0,v.C)({defaultTagName:"span",props:(0,h.v6)({className:(0,N.cn)(w({variant:r}),t)},s),render:n,state:{slot:"badge",variant:r}})}var k=r(7003),z=r(4036),S=r(5949),A=r(4915),_=r(8502),C=r(8905),E=r(989);function q(e){let{...t}=e;return(0,n.jsx)(z.D,{"data-slot":"dialog",...t})}function F(e){let{...t}=e;return(0,n.jsx)(S.Z,{"data-slot":"dialog-portal",...t})}function O(e){let{className:t,...r}=e;return(0,n.jsx)(A.X,{"data-slot":"dialog-overlay",className:(0,N.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...r})}function P(e){let{className:t,children:r,showCloseButton:s=!0,...a}=e;return(0,n.jsxs)(F,{children:[(0,n.jsx)(O,{}),(0,n.jsxs)(_.h,{"data-slot":"dialog-content",className:(0,N.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...a,children:[r,s&&(0,n.jsxs)(C.H,{"data-slot":"dialog-close",render:(0,n.jsx)(k.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function T(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,N.cn)("flex flex-col gap-2",t),...r})}function R(e){let{className:t,...r}=e;return(0,n.jsx)(E.L,{"data-slot":"dialog-title",className:(0,N.cn)("font-heading text-base leading-none font-medium",t),...r})}var D=r(2045);function I(e){let{className:t,type:r,...s}=e;return(0,n.jsx)(D.p,{type:r,"data-slot":"input",className:(0,N.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})}var W=r(8521),$=r(2577),H=r(1127);function M(e){let{...t}=e;return(0,n.jsx)(W.N,{"data-slot":"collapsible",...t})}function B(e){let{...t}=e;return(0,n.jsx)($.R,{"data-slot":"collapsible-trigger",...t})}function J(e){let{...t}=e;return(0,n.jsx)(H.j,{"data-slot":"collapsible-content",...t})}function U(e){var t,r,a,g,x;let{params:m}=e,{id:p}=(0,s.use)(m),[f,b]=(0,s.useState)(null),[h,v]=(0,s.useState)([]),[j,w]=(0,s.useState)(!1),[y,z]=(0,s.useState)(null),[S,A]=(0,s.useState)(()=>Date.now()),[_,C]=(0,s.useState)(!1),E=(0,s.useRef)(!1);(0,s.useEffect)(()=>{E.current=!1;let e=new EventSource("/api/run/".concat(p,"/stream"));return e.onmessage=e=>{let t=JSON.parse(e.data);if(E.current=!0,t.events?v(t.events):t.event&&v(e=>[...e,t.event]),b({...t.run,events:[]}),!["running","waiting","paused"].includes(t.run.status)){var r,n,s,a,i;let e=null!=(i=null!=(a=null==(r=t.event)?void 0:r.ts)?a:null==(s=t.events)||null==(n=s.at(-1))?void 0:n.ts)?i:Date.now();z(t=>null!=t?t:e)}},e.onerror=()=>{e.close(),E.current||w(!0)},()=>e.close()},[p]);let F=null!=(r=null==f?void 0:f.status)?r:"running",O=null!=(a=null==f?void 0:f.steps)?a:[],T=O.filter(e=>"pass"===e.status).length,R=O.filter(e=>"fail"===e.status).length,D=O.filter(e=>"warn"===e.status).length,I="running"===F||"waiting"===F,W=I||"paused"===F;async function $(){W&&(C(!0),await fetch("/api/run/".concat(p,"/pause"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"paused"===F?"resume":"pause"})}).catch(()=>{}),C(!1))}let H=I&&null!=(g=null==(t=O.find(e=>"queued"===e.status))?void 0:t.num)?g:null;(0,s.useEffect)(()=>{if(!I)return;let e=setInterval(()=>A(Date.now()),1e3);return()=>clearInterval(e)},[I]),(0,s.useEffect)(()=>{var e;null!=H&&(null==(e=document.getElementById("step-".concat(H)))||e.scrollIntoView({behavior:"smooth",block:"center"}))},[H]);let M=f?(null!=y?y:S)-f.createdAt:0,B=O.filter(e=>"queued"!==e.status).length,J=O.length?B/O.length*100:0,U=[];for(let e of O){let t=U[U.length-1];t&&t.title===e.group?t.steps.push(e):U.push({title:e.group,steps:[e]})}return j?(0,n.jsxs)("main",{className:"flex flex-col items-center justify-center min-h-screen px-6 text-center",children:[(0,n.jsx)("p",{className:"text-6xl font-semibold text-muted-foreground/20 mb-4",children:"404"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Run not found — it may have finished and been cleared from memory."}),(0,n.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-sm text-foreground/70 hover:text-foreground transition-colors",children:[(0,n.jsx)(o.A,{className:"size-3.5"}),"New run"]})]}):(0,n.jsxs)("main",{className:"mx-auto max-w-2xl px-6 pt-10 pb-24",children:[(0,n.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-8",children:[(0,n.jsx)(o.A,{className:"size-3.5"}),"new run"]}),(0,n.jsxs)("section",{className:"mb-8",children:[(0,n.jsx)(G,{status:F}),(0,n.jsx)("h1",{className:"text-lg font-semibold tracking-tight mt-5 break-words text-foreground/90",children:null!=(x=null==f?void 0:f.title)?x:p}),f&&(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-1.5",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground font-mono",children:O.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"text-foreground/60",children:[B,"/",O.length," steps"]}),T>0&&(0,n.jsxs)("span",{className:"text-success ml-2",children:["\xb7 ",T," passed"]}),D>0&&(0,n.jsxs)("span",{className:"text-warning ml-2",children:["\xb7 ",D," warn"]}),R>0&&(0,n.jsxs)("span",{className:"text-destructive ml-2",children:["\xb7 ",R," failed"]})]}):(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"waiting for plan…"})}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[W&&(0,n.jsx)(k.$,{variant:"ghost",size:"sm",onClick:$,disabled:_||"waiting"===F,className:"h-7 px-2 text-muted-foreground/60 hover:text-foreground",children:"paused"===F?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{className:"size-3.5 mr-1"}),"Resume"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{className:"size-3.5 mr-1"}),"Pause"]})}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/60 font-mono tabular-nums",children:[(0,n.jsx)(c.A,{className:"size-3"}),function(e){let t=Math.max(0,Math.floor(e/1e3));return"".concat(Math.floor(t/60),":").concat(String(t%60).padStart(2,"0"))}(M)]})]})]}),O.length>0&&(0,n.jsx)("div",{className:"relative mt-3 h-[3px] rounded-full bg-white/5 overflow-hidden",children:(0,n.jsx)("div",{className:(0,N.cn)("absolute inset-y-0 left-0 rounded-full transition-all duration-700 ease-out","failed"===F||"error"===F?"bg-destructive":"bg-success"),style:{width:"".concat(J,"%")}})})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[0===O.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,n.jsx)(u.A,{className:"size-5 text-muted-foreground/30 animate-spin mb-3"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground/50",children:"waiting for agent to start…"})]}),U.map((e,t)=>(0,n.jsxs)("div",{className:"space-y-2",children:[e.title&&(0,n.jsx)("div",{className:"pt-4 first:pt-0 text-[10.5px] font-semibold uppercase tracking-widest text-muted-foreground/40",children:e.title}),e.steps.map((e,t)=>(0,n.jsx)("div",{id:"step-".concat(e.num),className:"scroll-mt-6",children:(0,n.jsx)(K,{step:e,displayNum:t+1,active:e.num===H,events:h.filter(t=>t.stepNum===e.num)})},e.num))]},t))]}),(null==f?void 0:f.summary)&&(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/7 bg-card/60 px-4 py-3",children:[(0,n.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/40 mb-1.5",children:"Summary"}),(0,n.jsx)("div",{className:"text-sm leading-relaxed text-foreground/80",children:f.summary})]}),("passed"===F||"failed"===F)&&(0,n.jsx)(V,{}),(0,n.jsx)(q,{open:!!(null==f?void 0:f.pending),children:(0,n.jsx)(P,{showCloseButton:!1,children:(null==f?void 0:f.pending)&&(0,n.jsx)(ee,{runId:p,question:f.pending})})})]})}function V(){return(0,n.jsxs)("a",{href:"https://github.com/broxhq/qpilot",target:"_blank",rel:"noreferrer",className:"group mt-6 flex items-center gap-3 rounded-xl border border-white/7 bg-card/60 px-4 py-3 transition-colors hover:border-warning/30 hover:bg-warning/[0.03]",children:[(0,n.jsx)(g.A,{className:"size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-warning group-hover:fill-warning"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"text-sm text-foreground/80",children:["Did qpilot save you time?"," ",(0,n.jsx)("span",{className:"text-foreground/95 group-hover:text-warning transition-colors",children:"Star it on GitHub"})]}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground/50",children:"A ⭐ helps more people find it — takes two seconds."})]})]})}let L={running:{label:"Running",sub:"agent is executing steps",icon:(0,n.jsx)(u.A,{className:"size-4 animate-spin"}),color:"text-foreground/70",bg:"bg-white/5",border:"border-white/10"},waiting:{label:"Waiting",sub:"agent needs your input",icon:(0,n.jsx)(x.A,{className:"size-4"}),color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"},paused:{label:"Paused",sub:"run is paused",icon:(0,n.jsx)(d.A,{className:"size-4"}),color:"text-foreground/50",bg:"bg-white/5",border:"border-white/10"},passed:{label:"Passed",sub:"all steps passed",icon:(0,n.jsx)(m.A,{className:"size-4",strokeWidth:2.5}),color:"text-success",bg:"bg-success/10",border:"border-success/20"},failed:{label:"Failed",sub:"some steps failed",icon:(0,n.jsx)(p.A,{className:"size-4",strokeWidth:2.5}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"},error:{label:"Error",sub:"agent crashed",icon:(0,n.jsx)(x.A,{className:"size-4"}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"}};function G(e){var t;let{status:r}=e,s=null!=(t=L[r])?t:L.running;return(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:(0,N.cn)("flex items-center justify-center size-9 rounded-xl border transition-colors",s.bg,s.border,s.color),children:s.icon}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:(0,N.cn)("text-sm font-semibold tracking-tight",s.color),children:s.label}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground/60",children:s.sub})]})]})}let Q={queued:{border:"border-l-white/8",badge:"bg-white/5 text-muted-foreground/50",bg:"",label:"queued"},pass:{border:"border-l-success/60",badge:"bg-success/10 text-success",bg:"",label:"pass"},warn:{border:"border-l-warning/60",badge:"bg-warning/10 text-warning",bg:"",label:"warn"},fail:{border:"border-l-destructive/60",badge:"bg-destructive/10 text-destructive",bg:"bg-destructive/[0.03]",label:"fail"},skipped:{border:"border-l-white/8",badge:"bg-white/4 text-muted-foreground/30",bg:"",label:"skipped"}},X={border:"border-l-warning/80",badge:"bg-warning/10 text-warning",bg:"bg-warning/[0.03]"};function Z(e){if("action"===e.kind&&("report_step"===e.toolName||"finish"===e.toolName||"set_plan"===e.toolName))return!1;if("observation"===e.kind){var t;let r=null!=(t=e.text)?t:"";return r.startsWith("Error:")||r.startsWith("[debug]")}return!0}function K(e){var t;let{step:r,events:a,active:i,displayNum:o}=e,l=null!=(t=Q[r.status])?t:Q.queued,d=i?{...l,...X}:l,c=a.filter(Z),g=i||"fail"===r.status,[x,m]=(0,s.useState)(g);return(0,s.useEffect)(()=>m(g),[g]),(0,n.jsx)(M,{open:x,onOpenChange:m,children:(0,n.jsxs)("div",{className:(0,N.cn)("rounded-xl border border-white/7 border-l-2 overflow-hidden transition-colors",d.border,d.bg),children:[(0,n.jsxs)(B,{className:"group w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-white/[0.02] transition-colors",children:[(0,n.jsx)(y,{className:(0,N.cn)("border-0 text-[9.5px] tracking-widest font-semibold shrink-0 gap-1 uppercase rounded-md px-1.5",d.badge),children:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.A,{className:"size-2.5 animate-spin"}),"running"]}):l.label}),(0,n.jsxs)("span",{className:"flex-1 min-w-0 text-[13px] text-foreground/80",children:[(0,n.jsx)("span",{className:"text-muted-foreground/40 mr-2 font-mono text-[11px]",children:String(null!=o?o:r.num).padStart(2,"0")}),r.description]}),(0,n.jsx)(f.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 group-data-open:hidden"}),(0,n.jsx)(b.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 hidden group-data-open:inline"})]}),r.evidence&&(0,n.jsx)("div",{className:"px-4 pb-3 -mt-0.5 text-[11.5px] text-muted-foreground/60 leading-relaxed font-mono",children:r.evidence}),(0,n.jsx)(J,{children:(0,n.jsxs)("div",{className:"px-4 pb-4 pt-3 space-y-3 border-t border-white/5",children:[r.screenshot&&(0,n.jsx)("a",{href:r.screenshot,target:"_blank",rel:"noreferrer",className:"block rounded-lg overflow-hidden border border-white/8 hover:border-white/15 transition-colors",children:(0,n.jsx)("img",{src:r.screenshot,alt:"screenshot step ".concat(r.num),className:"max-h-64 w-full object-contain bg-black/20"})}),c.length>0?(0,n.jsx)("div",{className:"space-y-0.5",children:c.map((e,t)=>(0,n.jsx)(Y,{event:e},t))}):(0,n.jsx)("div",{className:"text-[11px] text-muted-foreground/30",children:"no events for this step"})]})})]})})}function Y(e){let{event:t}=e,{icon:r,text:s,cls:a}=function(e){var t,r,n,s,a,i,o,l,d;switch(e.kind){case"action":return{icon:"→",text:function(e,t){var r,n,s,a,i,o,l,d;let c=null!=t?t:{};switch(e){case"navigate":return"Opening ".concat(null!=(r=c.url)?r:"");case"snapshot":return c.near?'Reading "'.concat(c.near,'" block'):"Reading page";case"click":return c.name?'Clicking "'.concat(c.name,'"'):"Clicking element";case"fill":return c.name?'Filling "'.concat(c.name,'" → "').concat(null!=(n=c.value)?n:"",'"'):'Filling "'.concat(null!=(s=c.value)?s:"",'"');case"select":return c.name?'Selecting "'.concat(null!=(a=c.value)?a:"",'" in "').concat(c.name,'"'):'Selecting "'.concat(null!=(i=c.value)?i:"",'"');case"hover":return c.name?'Hovering "'.concat(c.name,'"'):"Hovering element";case"scroll_to":return"Scrolling to ".concat(c.text?'"'.concat(c.text,'"'):null!=(o=c.ref)?o:"element");case"scroll":{let e=[Number(c.y)?"".concat(Number(c.y)>0?"down":"up"," ").concat(Math.abs(Number(c.y)),"px"):"",Number(c.x)?"".concat(Number(c.x)>0?"right":"left"," ").concat(Math.abs(Number(c.x)),"px"):""].filter(Boolean).join(", "),t=c.ref?" inside ".concat(c.ref):"";return"Scrolling ".concat(e||"0px").concat(t)}case"press":return"Pressing ".concat(null!=(l=c.key)?l:"");case"dismiss":return"Closing overlay";case"wait":return"Waiting ".concat(null!=(d=c.ms)?d:""," ms");case"ask_user":return"Asking user";default:return null!=e?e:"action"}}(e.toolName,e.toolInput),cls:"text-foreground/70"};case"step":{let s=null!=(n=null==(t=e.step)?void 0:t.status)?n:"",a="pass"===s?"text-success":"fail"===s?"text-destructive":"text-warning";return{icon:"pass"===s?"✓":"fail"===s?"✗":"!",text:"Step ".concat(null==(r=e.step)?void 0:r.num," — ").concat(s.toUpperCase()),cls:a}}case"observation":{let t=null!=(s=e.text)?s:"";if(t.startsWith("Error:"))return{icon:"✗",text:t,cls:"text-destructive"};return{icon:"\xb7",text:t,cls:"text-muted-foreground/40"}}case"question":return{icon:"?",text:"Asking: ".concat(null!=(i=null==(a=e.question)?void 0:a.prompt)?i:""),cls:"text-warning"};case"answer":return{icon:"✎",text:"User answered",cls:"text-foreground/50"};case"thought":return{icon:"›",text:null!=(o=e.text)?o:"",cls:"text-muted-foreground/40 italic"};case"done":return{icon:"■",text:"Run finished — ".concat(null!=(l=e.status)?l:""),cls:"text-foreground/60"};case"error":return{icon:"✗",text:null!=(d=e.text)?d:"",cls:"text-destructive"};default:return{icon:"\xb7",text:"",cls:"text-muted-foreground/30"}}}(t),i=new Date(t.ts).toLocaleTimeString("en-US",{hour12:!1});return(0,n.jsxs)("div",{className:"flex gap-2.5 text-[11.5px] leading-relaxed items-baseline font-mono",children:[(0,n.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground/25 text-[10px]",children:i}),(0,n.jsx)("span",{className:(0,N.cn)("shrink-0 w-3.5 text-center",a),children:r}),(0,n.jsx)("span",{className:(0,N.cn)("min-w-0 break-words",a),children:s})]})}function ee(e){let{runId:t,question:r}=e,[a,i]=(0,s.useState)(""),[o,l]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null);async function u(e){if(e.preventDefault(),a){l(!0),c(null);try{let e=await fetch("/api/run/".concat(t,"/answer"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:r.id,answer:a})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"HTTP ".concat(e.status))}i("")}catch(e){c(e instanceof Error?e.message:String(e)),l(!1)}}}return(0,n.jsxs)("form",{onSubmit:u,className:"space-y-4",children:[(0,n.jsx)(T,{children:(0,n.jsxs)(R,{className:"flex items-center gap-2 text-base",children:[(0,n.jsx)(x.A,{className:"size-4 text-warning shrink-0"}),"Agent needs input"]})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r.prompt}),(0,n.jsx)(I,{autoFocus:!0,type:r.secret?"password":"text",value:a,onChange:e=>i(e.target.value),placeholder:r.secret?"OTP / password":"answer",className:"font-mono"}),d&&(0,n.jsx)("p",{className:"text-destructive text-xs",children:d}),(0,n.jsx)(k.$,{type:"submit",disabled:!a||o,className:"w-full",children:o?"Sending…":"Submit"})]})}},5016:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var n=r(2821),s=r(5889);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,n.$)(t))}},7003:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var n=r(5155),s=r(9574),a=r(3101),i=r(5016);let o=(0,a.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r="default",size:a="default",...l}=e;return(0,n.jsx)(s.$,{"data-slot":"button",className:(0,i.cn)(o({variant:r,size:a,className:t})),...l})}},9578:(e,t,r)=>{Promise.resolve().then(r.bind(r,191))}},e=>{e.O(0,[248,532,441,255,358],()=>e(e.s=9578)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{191:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>U});var n=r(5155),s=r(2115),a=r(2619),i=r.n(a),o=r(3229),l=r(3228),d=r(2638),c=r(3410),u=r(9746),g=r(7274),x=r(8215),m=r(5352),p=r(4788),f=r(7212),b=r(3916),h=r(1083),v=r(2027),j=r(3101),N=r(5016);let w=(0,j.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(e){let{className:t,variant:r="default",render:n,...s}=e;return(0,v.C)({defaultTagName:"span",props:(0,h.v6)({className:(0,N.cn)(w({variant:r}),t)},s),render:n,state:{slot:"badge",variant:r}})}var k=r(7003),z=r(4036),S=r(5949),A=r(4915),_=r(8502),C=r(8905),E=r(989);function q(e){let{...t}=e;return(0,n.jsx)(z.D,{"data-slot":"dialog",...t})}function F(e){let{...t}=e;return(0,n.jsx)(S.Z,{"data-slot":"dialog-portal",...t})}function O(e){let{className:t,...r}=e;return(0,n.jsx)(A.X,{"data-slot":"dialog-overlay",className:(0,N.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...r})}function P(e){let{className:t,children:r,showCloseButton:s=!0,...a}=e;return(0,n.jsxs)(F,{children:[(0,n.jsx)(O,{}),(0,n.jsxs)(_.h,{"data-slot":"dialog-content",className:(0,N.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...a,children:[r,s&&(0,n.jsxs)(C.H,{"data-slot":"dialog-close",render:(0,n.jsx)(k.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function T(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,N.cn)("flex flex-col gap-2",t),...r})}function R(e){let{className:t,...r}=e;return(0,n.jsx)(E.L,{"data-slot":"dialog-title",className:(0,N.cn)("font-heading text-base leading-none font-medium",t),...r})}var D=r(2045);function I(e){let{className:t,type:r,...s}=e;return(0,n.jsx)(D.p,{type:r,"data-slot":"input",className:(0,N.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})}var W=r(8521),$=r(2577),H=r(1127);function M(e){let{...t}=e;return(0,n.jsx)(W.N,{"data-slot":"collapsible",...t})}function B(e){let{...t}=e;return(0,n.jsx)($.R,{"data-slot":"collapsible-trigger",...t})}function J(e){let{...t}=e;return(0,n.jsx)(H.j,{"data-slot":"collapsible-content",...t})}function U(e){var t,r,a,g,x;let{params:m}=e,{id:p}=(0,s.use)(m),[f,b]=(0,s.useState)(null),[h,v]=(0,s.useState)([]),[j,w]=(0,s.useState)(!1),[y,z]=(0,s.useState)(null),[S,A]=(0,s.useState)(()=>Date.now()),[_,C]=(0,s.useState)(!1),E=(0,s.useRef)(!1);(0,s.useEffect)(()=>{E.current=!1;let e=new EventSource("/api/run/".concat(p,"/stream"));return e.onmessage=e=>{let t=JSON.parse(e.data);if(E.current=!0,t.events?v(t.events):t.event&&v(e=>[...e,t.event]),b({...t.run,events:[]}),!["running","waiting","paused"].includes(t.run.status)){var r,n,s,a,i;let e=null!=(i=null!=(a=null==(r=t.event)?void 0:r.ts)?a:null==(s=t.events)||null==(n=s.at(-1))?void 0:n.ts)?i:Date.now();z(t=>null!=t?t:e)}},e.onerror=()=>{e.close(),E.current||w(!0)},()=>e.close()},[p]);let F=null!=(r=null==f?void 0:f.status)?r:"running",O=null!=(a=null==f?void 0:f.steps)?a:[],T=O.filter(e=>"pass"===e.status).length,R=O.filter(e=>"fail"===e.status).length,D=O.filter(e=>"warn"===e.status).length,I="running"===F||"waiting"===F,W=I||"paused"===F;async function $(){W&&(C(!0),await fetch("/api/run/".concat(p,"/pause"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"paused"===F?"resume":"pause"})}).catch(()=>{}),C(!1))}let H=I&&null!=(g=null==(t=O.find(e=>"queued"===e.status))?void 0:t.num)?g:null;(0,s.useEffect)(()=>{if(!I)return;let e=setInterval(()=>A(Date.now()),1e3);return()=>clearInterval(e)},[I]),(0,s.useEffect)(()=>{var e;null!=H&&(null==(e=document.getElementById("step-".concat(H)))||e.scrollIntoView({behavior:"smooth",block:"center"}))},[H]);let M=f?(null!=y?y:S)-f.createdAt:0,B=O.filter(e=>"queued"!==e.status).length,J=O.length?B/O.length*100:0,U=[];for(let e of O){let t=U[U.length-1];t&&t.title===e.group?t.steps.push(e):U.push({title:e.group,steps:[e]})}return j?(0,n.jsxs)("main",{className:"flex flex-col items-center justify-center min-h-screen px-6 text-center",children:[(0,n.jsx)("p",{className:"text-6xl font-semibold text-muted-foreground/20 mb-4",children:"404"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Run not found — it may have finished and been cleared from memory."}),(0,n.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-sm text-foreground/70 hover:text-foreground transition-colors",children:[(0,n.jsx)(o.A,{className:"size-3.5"}),"New run"]})]}):(0,n.jsxs)("main",{className:"mx-auto max-w-2xl px-6 pt-10 pb-24",children:[(0,n.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-8",children:[(0,n.jsx)(o.A,{className:"size-3.5"}),"new run"]}),(0,n.jsxs)("section",{className:"mb-8",children:[(0,n.jsx)(G,{status:F}),(0,n.jsx)("h1",{className:"text-lg font-semibold tracking-tight mt-5 break-words text-foreground/90",children:null!=(x=null==f?void 0:f.title)?x:p}),f&&(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-1.5",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground font-mono",children:O.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"text-foreground/60",children:[B,"/",O.length," steps"]}),T>0&&(0,n.jsxs)("span",{className:"text-success ml-2",children:["\xb7 ",T," passed"]}),D>0&&(0,n.jsxs)("span",{className:"text-warning ml-2",children:["\xb7 ",D," warn"]}),R>0&&(0,n.jsxs)("span",{className:"text-destructive ml-2",children:["\xb7 ",R," failed"]})]}):(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"waiting for plan…"})}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[W&&(0,n.jsx)(k.$,{variant:"ghost",size:"sm",onClick:$,disabled:_||"waiting"===F,className:"h-7 px-2 text-muted-foreground/60 hover:text-foreground",children:"paused"===F?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{className:"size-3.5 mr-1"}),"Resume"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{className:"size-3.5 mr-1"}),"Pause"]})}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/60 font-mono tabular-nums",children:[(0,n.jsx)(c.A,{className:"size-3"}),function(e){let t=Math.max(0,Math.floor(e/1e3));return"".concat(Math.floor(t/60),":").concat(String(t%60).padStart(2,"0"))}(M)]})]})]}),O.length>0&&(0,n.jsx)("div",{className:"relative mt-3 h-[3px] rounded-full bg-white/5 overflow-hidden",children:(0,n.jsx)("div",{className:(0,N.cn)("absolute inset-y-0 left-0 rounded-full transition-all duration-700 ease-out","failed"===F||"error"===F?"bg-destructive":"bg-success"),style:{width:"".concat(J,"%")}})})]}),(0,n.jsxs)("section",{className:"space-y-2",children:[0===O.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,n.jsx)(u.A,{className:"size-5 text-muted-foreground/30 animate-spin mb-3"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground/50",children:"waiting for agent to start…"})]}),U.map((e,t)=>(0,n.jsxs)("div",{className:"space-y-2",children:[e.title&&(0,n.jsx)("div",{className:"pt-4 first:pt-0 text-[10.5px] font-semibold uppercase tracking-widest text-muted-foreground/40",children:e.title}),e.steps.map((e,t)=>(0,n.jsx)("div",{id:"step-".concat(e.num),className:"scroll-mt-6",children:(0,n.jsx)(K,{step:e,displayNum:t+1,active:e.num===H,events:h.filter(t=>t.stepNum===e.num)})},e.num))]},t))]}),(null==f?void 0:f.summary)&&(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/7 bg-card/60 px-4 py-3",children:[(0,n.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/40 mb-1.5",children:"Summary"}),(0,n.jsx)("div",{className:"text-sm leading-relaxed text-foreground/80",children:f.summary})]}),("passed"===F||"failed"===F)&&(0,n.jsx)(V,{}),(0,n.jsx)(q,{open:!!(null==f?void 0:f.pending),children:(0,n.jsx)(P,{showCloseButton:!1,children:(null==f?void 0:f.pending)&&(0,n.jsx)(ee,{runId:p,question:f.pending})})})]})}function V(){return(0,n.jsxs)("a",{href:"https://github.com/broxhq/qpilot",target:"_blank",rel:"noreferrer",className:"group mt-6 flex items-center gap-3 rounded-xl border border-white/7 bg-card/60 px-4 py-3 transition-colors hover:border-warning/30 hover:bg-warning/[0.03]",children:[(0,n.jsx)(g.A,{className:"size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-warning group-hover:fill-warning"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"text-sm text-foreground/80",children:["Did qpilot save you time?"," ",(0,n.jsx)("span",{className:"text-foreground/95 group-hover:text-warning transition-colors",children:"Star it on GitHub"})]}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground/50",children:"A ⭐ helps more people find it — takes two seconds."})]})]})}let L={running:{label:"Running",sub:"agent is executing steps",icon:(0,n.jsx)(u.A,{className:"size-4 animate-spin"}),color:"text-foreground/70",bg:"bg-white/5",border:"border-white/10"},waiting:{label:"Waiting",sub:"agent needs your input",icon:(0,n.jsx)(x.A,{className:"size-4"}),color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"},paused:{label:"Paused",sub:"run is paused",icon:(0,n.jsx)(d.A,{className:"size-4"}),color:"text-foreground/50",bg:"bg-white/5",border:"border-white/10"},passed:{label:"Passed",sub:"all steps passed",icon:(0,n.jsx)(m.A,{className:"size-4",strokeWidth:2.5}),color:"text-success",bg:"bg-success/10",border:"border-success/20"},failed:{label:"Failed",sub:"some steps failed",icon:(0,n.jsx)(p.A,{className:"size-4",strokeWidth:2.5}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"},error:{label:"Error",sub:"agent crashed",icon:(0,n.jsx)(x.A,{className:"size-4"}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"}};function G(e){var t;let{status:r}=e,s=null!=(t=L[r])?t:L.running;return(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:(0,N.cn)("flex items-center justify-center size-9 rounded-xl border transition-colors",s.bg,s.border,s.color),children:s.icon}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:(0,N.cn)("text-sm font-semibold tracking-tight",s.color),children:s.label}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground/60",children:s.sub})]})]})}let Q={queued:{border:"border-l-white/8",badge:"bg-white/5 text-muted-foreground/50",bg:"",label:"queued"},pass:{border:"border-l-success/60",badge:"bg-success/10 text-success",bg:"",label:"pass"},warn:{border:"border-l-warning/60",badge:"bg-warning/10 text-warning",bg:"",label:"warn"},fail:{border:"border-l-destructive/60",badge:"bg-destructive/10 text-destructive",bg:"bg-destructive/[0.03]",label:"fail"},skipped:{border:"border-l-white/8",badge:"bg-white/4 text-muted-foreground/30",bg:"",label:"skipped"}},X={border:"border-l-warning/80",badge:"bg-warning/10 text-warning",bg:"bg-warning/[0.03]"};function Z(e){if("action"===e.kind&&("report_step"===e.toolName||"finish"===e.toolName||"set_plan"===e.toolName))return!1;if("observation"===e.kind){var t;let r=null!=(t=e.text)?t:"";return r.startsWith("Error:")||r.startsWith("[debug]")}return!0}function K(e){var t;let{step:r,events:a,active:i,displayNum:o}=e,l=null!=(t=Q[r.status])?t:Q.queued,d=i?{...l,...X}:l,c=a.filter(Z),g=i||"fail"===r.status,[x,m]=(0,s.useState)(g);return(0,s.useEffect)(()=>m(g),[g]),(0,n.jsx)(M,{open:x,onOpenChange:m,children:(0,n.jsxs)("div",{className:(0,N.cn)("rounded-xl border border-white/7 border-l-2 overflow-hidden transition-colors",d.border,d.bg),children:[(0,n.jsxs)(B,{className:"group w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-white/[0.02] transition-colors",children:[(0,n.jsx)(y,{className:(0,N.cn)("border-0 text-[9.5px] tracking-widest font-semibold shrink-0 gap-1 uppercase rounded-md px-1.5",d.badge),children:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.A,{className:"size-2.5 animate-spin"}),"running"]}):l.label}),(0,n.jsxs)("span",{className:"flex-1 min-w-0 text-[13px] text-foreground/80",children:[(0,n.jsx)("span",{className:"text-muted-foreground/40 mr-2 font-mono text-[11px]",children:String(null!=o?o:r.num).padStart(2,"0")}),r.description]}),(0,n.jsx)(f.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 group-data-open:hidden"}),(0,n.jsx)(b.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 hidden group-data-open:inline"})]}),r.evidence&&(0,n.jsx)("div",{className:"px-4 pb-3 -mt-0.5 text-[11.5px] text-muted-foreground/60 leading-relaxed font-mono",children:r.evidence}),(0,n.jsx)(J,{children:(0,n.jsxs)("div",{className:"px-4 pb-4 pt-3 space-y-3 border-t border-white/5",children:[r.screenshot&&(0,n.jsx)("a",{href:r.screenshot,target:"_blank",rel:"noreferrer",className:"block rounded-lg overflow-hidden border border-white/8 hover:border-white/15 transition-colors",children:(0,n.jsx)("img",{src:r.screenshot,alt:"screenshot step ".concat(r.num),className:"max-h-64 w-full object-contain bg-black/20"})}),c.length>0?(0,n.jsx)("div",{className:"space-y-0.5",children:c.map((e,t)=>(0,n.jsx)(Y,{event:e},t))}):(0,n.jsx)("div",{className:"text-[11px] text-muted-foreground/30",children:"no events for this step"})]})})]})})}function Y(e){let{event:t}=e,{icon:r,text:s,cls:a}=function(e){var t,r,n,s,a,i,o,l,d;switch(e.kind){case"action":return{icon:"→",text:function(e,t){var r,n,s,a,i,o,l,d;let c=null!=t?t:{};switch(e){case"navigate":return"Opening ".concat(null!=(r=c.url)?r:"");case"snapshot":return c.near?'Reading "'.concat(c.near,'" block'):"Reading page";case"click":return c.name?'Clicking "'.concat(c.name,'"'):"Clicking element";case"fill":return c.name?'Filling "'.concat(c.name,'" → "').concat(null!=(n=c.value)?n:"",'"'):'Filling "'.concat(null!=(s=c.value)?s:"",'"');case"select":return c.name?'Selecting "'.concat(null!=(a=c.value)?a:"",'" in "').concat(c.name,'"'):'Selecting "'.concat(null!=(i=c.value)?i:"",'"');case"hover":return c.name?'Hovering "'.concat(c.name,'"'):"Hovering element";case"scroll_to":return"Scrolling to ".concat(c.text?'"'.concat(c.text,'"'):null!=(o=c.ref)?o:"element");case"scroll":{let e=[Number(c.y)?"".concat(Number(c.y)>0?"down":"up"," ").concat(Math.abs(Number(c.y)),"px"):"",Number(c.x)?"".concat(Number(c.x)>0?"right":"left"," ").concat(Math.abs(Number(c.x)),"px"):""].filter(Boolean).join(", "),t=c.ref?" inside ".concat(c.ref):"";return"Scrolling ".concat(e||"0px").concat(t)}case"press":return"Pressing ".concat(null!=(l=c.key)?l:"");case"dismiss":return"Closing overlay";case"wait":return"Waiting ".concat(null!=(d=c.ms)?d:""," ms");case"ask_user":return"Asking user";default:return null!=e?e:"action"}}(e.toolName,e.toolInput),cls:"text-foreground/70"};case"step":{let s=null!=(n=null==(t=e.step)?void 0:t.status)?n:"",a="pass"===s?"text-success":"fail"===s?"text-destructive":"text-warning";return{icon:"pass"===s?"✓":"fail"===s?"✗":"!",text:"Step ".concat(null==(r=e.step)?void 0:r.num," — ").concat(s.toUpperCase()),cls:a}}case"observation":{let t=null!=(s=e.text)?s:"";if(t.startsWith("Error:"))return{icon:"✗",text:t,cls:"text-destructive"};return{icon:"\xb7",text:t,cls:"text-muted-foreground/40"}}case"question":return{icon:"?",text:"Asking: ".concat(null!=(i=null==(a=e.question)?void 0:a.prompt)?i:""),cls:"text-warning"};case"answer":return{icon:"✎",text:"User answered",cls:"text-foreground/50"};case"thought":return{icon:"›",text:null!=(o=e.text)?o:"",cls:"text-muted-foreground/40 italic"};case"done":return{icon:"■",text:"Run finished — ".concat(null!=(l=e.status)?l:""),cls:"text-foreground/60"};case"error":return{icon:"✗",text:null!=(d=e.text)?d:"",cls:"text-destructive"};default:return{icon:"\xb7",text:"",cls:"text-muted-foreground/30"}}}(t),i=new Date(t.ts).toLocaleTimeString("en-US",{hour12:!1});return(0,n.jsxs)("div",{className:"flex gap-2.5 text-[11.5px] leading-relaxed items-baseline font-mono",children:[(0,n.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground/25 text-[10px]",children:i}),(0,n.jsx)("span",{className:(0,N.cn)("shrink-0 w-3.5 text-center",a),children:r}),(0,n.jsx)("span",{className:(0,N.cn)("min-w-0 break-words",a),children:s})]})}function ee(e){let{runId:t,question:r}=e,[a,i]=(0,s.useState)(""),[o,l]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null);async function u(e){if(e.preventDefault(),a){l(!0),c(null);try{let e=await fetch("/api/run/".concat(t,"/answer"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:r.id,answer:a})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"HTTP ".concat(e.status))}i("")}catch(e){c(e instanceof Error?e.message:String(e)),l(!1)}}}return(0,n.jsxs)("form",{onSubmit:u,className:"space-y-4",children:[(0,n.jsx)(T,{children:(0,n.jsxs)(R,{className:"flex items-center gap-2 text-base",children:[(0,n.jsx)(x.A,{className:"size-4 text-warning shrink-0"}),"Agent needs input"]})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r.prompt}),(0,n.jsx)(I,{autoFocus:!0,type:r.secret?"password":"text",value:a,onChange:e=>i(e.target.value),placeholder:r.secret?"OTP / password":"answer",className:"font-mono"}),d&&(0,n.jsx)("p",{className:"text-destructive text-xs",children:d}),(0,n.jsx)(k.$,{type:"submit",disabled:!a||o,className:"w-full",children:o?"Sending…":"Submit"})]})}},5016:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var n=r(2821),s=r(5889);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,n.$)(t))}},7003:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var n=r(5155),s=r(9574),a=r(3101),i=r(5016);let o=(0,a.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r="default",size:a="default",...l}=e;return(0,n.jsx)(s.$,{"data-slot":"button",className:(0,i.cn)(o({variant:r,size:a,className:t})),...l})}},9578:(e,t,r)=>{Promise.resolve().then(r.bind(r,191))}},e=>{e.O(0,[248,532,441,255,358],()=>e(e.s=9578)),_N_E=e.O()}]);
|
package/bin/qa-agent.js
CHANGED
|
@@ -22,7 +22,7 @@ const args = process.argv.slice(2);
|
|
|
22
22
|
let VISIBLE = args.includes("--visible") || args.includes("-v");
|
|
23
23
|
const WANTS_SETUP =
|
|
24
24
|
args[0] === "config" || args[0] === "setup" || args.includes("--config");
|
|
25
|
-
//
|
|
25
|
+
// menu/prompts only in a real terminal; in scripts start silently
|
|
26
26
|
const INTERACTIVE = Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
27
27
|
|
|
28
28
|
function findFreePort(port) {
|
|
@@ -76,7 +76,7 @@ function saveConfig(cfg) {
|
|
|
76
76
|
writeFileSync(CONFIG_PATH, JSON.stringify(cfg, null, 2), { mode: 0o600 });
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
79
|
+
/** Fallback: Anthropic key from env / .env.local (backwards compatibility). */
|
|
80
80
|
function envConfig(fileEnv) {
|
|
81
81
|
const apiKey = process.env.ANTHROPIC_API_KEY || fileEnv.ANTHROPIC_API_KEY;
|
|
82
82
|
if (!apiKey) return null;
|
|
@@ -87,7 +87,7 @@ function envConfig(fileEnv) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/** config → env
|
|
90
|
+
/** config → env vars the server understands (lib/provider.ts). */
|
|
91
91
|
function configToEnv(cfg) {
|
|
92
92
|
if (cfg.provider === "custom") {
|
|
93
93
|
return {
|
|
@@ -133,7 +133,7 @@ function configSummary(cfg, source) {
|
|
|
133
133
|
return lines.join("\n");
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
// ──
|
|
136
|
+
// ── interactive (@clack/prompts, ESM → dynamic import) ──────────────────────
|
|
137
137
|
|
|
138
138
|
const required = (v) => (v && v.trim() ? undefined : "Required");
|
|
139
139
|
|
|
@@ -231,7 +231,7 @@ async function runSetup(p) {
|
|
|
231
231
|
return cfg;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
/**
|
|
234
|
+
/** Config card + menu: Start / Start visible / Change / Exit. */
|
|
235
235
|
async function startMenu(p, cfg, source) {
|
|
236
236
|
for (;;) {
|
|
237
237
|
p.note(configSummary(cfg, source), "Provider");
|
|
@@ -306,7 +306,7 @@ async function main() {
|
|
|
306
306
|
|
|
307
307
|
let cfg;
|
|
308
308
|
if (!INTERACTIVE) {
|
|
309
|
-
//
|
|
309
|
+
// scripts/CI: no menu — use saved config or env, else error
|
|
310
310
|
cfg = loadConfig() || envConfig(fileEnv);
|
|
311
311
|
if (WANTS_SETUP || !cfg) {
|
|
312
312
|
console.error(
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{191:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>U});var r=n(5155),s=n(2115),a=n(2619),i=n.n(a),o=n(3229),l=n(3228),d=n(2638),c=n(3410),u=n(9746),g=n(7274),x=n(8215),m=n(5352),p=n(4788),f=n(7212),b=n(3916),h=n(1083),v=n(2027),j=n(3101),N=n(5016);let w=(0,j.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(e){let{className:t,variant:n="default",render:r,...s}=e;return(0,v.C)({defaultTagName:"span",props:(0,h.v6)({className:(0,N.cn)(w({variant:n}),t)},s),render:r,state:{slot:"badge",variant:n}})}var k=n(7003),z=n(4036),S=n(5949),A=n(4915),_=n(8502),E=n(8905),C=n(989);function q(e){let{...t}=e;return(0,r.jsx)(z.D,{"data-slot":"dialog",...t})}function F(e){let{...t}=e;return(0,r.jsx)(S.Z,{"data-slot":"dialog-portal",...t})}function O(e){let{className:t,...n}=e;return(0,r.jsx)(A.X,{"data-slot":"dialog-overlay",className:(0,N.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}function P(e){let{className:t,children:n,showCloseButton:s=!0,...a}=e;return(0,r.jsxs)(F,{children:[(0,r.jsx)(O,{}),(0,r.jsxs)(_.h,{"data-slot":"dialog-content",className:(0,N.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...a,children:[n,s&&(0,r.jsxs)(E.H,{"data-slot":"dialog-close",render:(0,r.jsx)(k.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(p.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function T(e){let{className:t,...n}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,N.cn)("flex flex-col gap-2",t),...n})}function R(e){let{className:t,...n}=e;return(0,r.jsx)(C.L,{"data-slot":"dialog-title",className:(0,N.cn)("font-heading text-base leading-none font-medium",t),...n})}var D=n(2045);function I(e){let{className:t,type:n,...s}=e;return(0,r.jsx)(D.p,{type:n,"data-slot":"input",className:(0,N.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})}var W=n(8521),$=n(2577),H=n(1127);function M(e){let{...t}=e;return(0,r.jsx)(W.N,{"data-slot":"collapsible",...t})}function B(e){let{...t}=e;return(0,r.jsx)($.R,{"data-slot":"collapsible-trigger",...t})}function J(e){let{...t}=e;return(0,r.jsx)(H.j,{"data-slot":"collapsible-content",...t})}function U(e){var t,n,a,g,x;let{params:m}=e,{id:p}=(0,s.use)(m),[f,b]=(0,s.useState)(null),[h,v]=(0,s.useState)([]),[j,w]=(0,s.useState)(!1),[y,z]=(0,s.useState)(null),[S,A]=(0,s.useState)(()=>Date.now()),[_,E]=(0,s.useState)(!1),C=(0,s.useRef)(!1);(0,s.useEffect)(()=>{C.current=!1;let e=new EventSource("/api/run/".concat(p,"/stream"));return e.onmessage=e=>{let t=JSON.parse(e.data);if(C.current=!0,t.events?v(t.events):t.event&&v(e=>[...e,t.event]),b({...t.run,events:[]}),!["running","waiting","paused"].includes(t.run.status)){var n,r,s,a,i;let e=null!=(i=null!=(a=null==(n=t.event)?void 0:n.ts)?a:null==(s=t.events)||null==(r=s.at(-1))?void 0:r.ts)?i:Date.now();z(t=>null!=t?t:e)}},e.onerror=()=>{e.close(),C.current||w(!0)},()=>e.close()},[p]);let F=null!=(n=null==f?void 0:f.status)?n:"running",O=null!=(a=null==f?void 0:f.steps)?a:[],T=O.filter(e=>"pass"===e.status).length,R=O.filter(e=>"fail"===e.status).length,D=O.filter(e=>"warn"===e.status).length,I="running"===F||"waiting"===F,W=I||"paused"===F;async function $(){W&&(E(!0),await fetch("/api/run/".concat(p,"/pause"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"paused"===F?"resume":"pause"})}).catch(()=>{}),E(!1))}let H=I&&null!=(g=null==(t=O.find(e=>"queued"===e.status))?void 0:t.num)?g:null;(0,s.useEffect)(()=>{if(!I)return;let e=setInterval(()=>A(Date.now()),1e3);return()=>clearInterval(e)},[I]),(0,s.useEffect)(()=>{var e;null!=H&&(null==(e=document.getElementById("step-".concat(H)))||e.scrollIntoView({behavior:"smooth",block:"center"}))},[H]);let M=f?(null!=y?y:S)-f.createdAt:0,B=O.filter(e=>"queued"!==e.status).length,J=O.length?B/O.length*100:0,U=[];for(let e of O){let t=U[U.length-1];t&&t.title===e.group?t.steps.push(e):U.push({title:e.group,steps:[e]})}return j?(0,r.jsxs)("main",{className:"flex flex-col items-center justify-center min-h-screen px-6 text-center",children:[(0,r.jsx)("p",{className:"text-6xl font-semibold text-muted-foreground/20 mb-4",children:"404"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Run not found — it may have finished and been cleared from memory."}),(0,r.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-sm text-foreground/70 hover:text-foreground transition-colors",children:[(0,r.jsx)(o.A,{className:"size-3.5"}),"New run"]})]}):(0,r.jsxs)("main",{className:"mx-auto max-w-2xl px-6 pt-10 pb-24",children:[(0,r.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-8",children:[(0,r.jsx)(o.A,{className:"size-3.5"}),"new run"]}),(0,r.jsxs)("section",{className:"mb-8",children:[(0,r.jsx)(G,{status:F}),(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight mt-5 break-words text-foreground/90",children:null!=(x=null==f?void 0:f.title)?x:p}),f&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-1.5",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground font-mono",children:O.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"text-foreground/60",children:[B,"/",O.length," steps"]}),T>0&&(0,r.jsxs)("span",{className:"text-success ml-2",children:["\xb7 ",T," passed"]}),D>0&&(0,r.jsxs)("span",{className:"text-warning ml-2",children:["\xb7 ",D," warn"]}),R>0&&(0,r.jsxs)("span",{className:"text-destructive ml-2",children:["\xb7 ",R," failed"]})]}):(0,r.jsx)("span",{className:"text-muted-foreground/50",children:"waiting for plan…"})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[W&&(0,r.jsx)(k.$,{variant:"ghost",size:"sm",onClick:$,disabled:_||"waiting"===F,className:"h-7 px-2 text-muted-foreground/60 hover:text-foreground",children:"paused"===F?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.A,{className:"size-3.5 mr-1"}),"Resume"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.A,{className:"size-3.5 mr-1"}),"Pause"]})}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/60 font-mono tabular-nums",children:[(0,r.jsx)(c.A,{className:"size-3"}),function(e){let t=Math.max(0,Math.floor(e/1e3));return"".concat(Math.floor(t/60),":").concat(String(t%60).padStart(2,"0"))}(M)]})]})]}),O.length>0&&(0,r.jsx)("div",{className:"relative mt-3 h-[3px] rounded-full bg-white/5 overflow-hidden",children:(0,r.jsx)("div",{className:(0,N.cn)("absolute inset-y-0 left-0 rounded-full transition-all duration-700 ease-out","failed"===F||"error"===F?"bg-destructive":"bg-success"),style:{width:"".concat(J,"%")}})})]}),(0,r.jsxs)("section",{className:"space-y-2",children:[0===O.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,r.jsx)(u.A,{className:"size-5 text-muted-foreground/30 animate-spin mb-3"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground/50",children:"waiting for agent to start…"})]}),U.map((e,t)=>(0,r.jsxs)("div",{className:"space-y-2",children:[e.title&&(0,r.jsx)("div",{className:"pt-4 first:pt-0 text-[10.5px] font-semibold uppercase tracking-widest text-muted-foreground/40",children:e.title}),e.steps.map((e,t)=>(0,r.jsx)("div",{id:"step-".concat(e.num),className:"scroll-mt-6",children:(0,r.jsx)(K,{step:e,displayNum:t+1,active:e.num===H,events:h.filter(t=>t.stepNum===e.num)})},e.num))]},t))]}),(null==f?void 0:f.summary)&&(0,r.jsxs)("div",{className:"mt-6 rounded-xl border border-white/7 bg-card/60 px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/40 mb-1.5",children:"Summary"}),(0,r.jsx)("div",{className:"text-sm leading-relaxed text-foreground/80",children:f.summary})]}),("passed"===F||"failed"===F)&&(0,r.jsx)(V,{}),(0,r.jsx)(q,{open:!!(null==f?void 0:f.pending),children:(0,r.jsx)(P,{showCloseButton:!1,children:(null==f?void 0:f.pending)&&(0,r.jsx)(ee,{runId:p,question:f.pending})})})]})}function V(){return(0,r.jsxs)("a",{href:"https://github.com/broxhq/qpilot",target:"_blank",rel:"noreferrer",className:"group mt-6 flex items-center gap-3 rounded-xl border border-white/7 bg-card/60 px-4 py-3 transition-colors hover:border-warning/30 hover:bg-warning/[0.03]",children:[(0,r.jsx)(g.A,{className:"size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-warning group-hover:fill-warning"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"text-sm text-foreground/80",children:["Did qpilot save you time?"," ",(0,r.jsx)("span",{className:"text-foreground/95 group-hover:text-warning transition-colors",children:"Star it on GitHub"})]}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground/50",children:"A ⭐ helps more people find it — takes two seconds."})]})]})}let L={running:{label:"Running",sub:"agent is executing steps",icon:(0,r.jsx)(u.A,{className:"size-4 animate-spin"}),color:"text-foreground/70",bg:"bg-white/5",border:"border-white/10"},waiting:{label:"Waiting",sub:"agent needs your input",icon:(0,r.jsx)(x.A,{className:"size-4"}),color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"},paused:{label:"Paused",sub:"run is paused",icon:(0,r.jsx)(d.A,{className:"size-4"}),color:"text-foreground/50",bg:"bg-white/5",border:"border-white/10"},passed:{label:"Passed",sub:"all steps passed",icon:(0,r.jsx)(m.A,{className:"size-4",strokeWidth:2.5}),color:"text-success",bg:"bg-success/10",border:"border-success/20"},failed:{label:"Failed",sub:"some steps failed",icon:(0,r.jsx)(p.A,{className:"size-4",strokeWidth:2.5}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"},error:{label:"Error",sub:"agent crashed",icon:(0,r.jsx)(x.A,{className:"size-4"}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"}};function G(e){var t;let{status:n}=e,s=null!=(t=L[n])?t:L.running;return(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:(0,N.cn)("flex items-center justify-center size-9 rounded-xl border transition-colors",s.bg,s.border,s.color),children:s.icon}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:(0,N.cn)("text-sm font-semibold tracking-tight",s.color),children:s.label}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground/60",children:s.sub})]})]})}let Q={queued:{border:"border-l-white/8",badge:"bg-white/5 text-muted-foreground/50",bg:"",label:"queued"},pass:{border:"border-l-success/60",badge:"bg-success/10 text-success",bg:"",label:"pass"},warn:{border:"border-l-warning/60",badge:"bg-warning/10 text-warning",bg:"",label:"warn"},fail:{border:"border-l-destructive/60",badge:"bg-destructive/10 text-destructive",bg:"bg-destructive/[0.03]",label:"fail"},skipped:{border:"border-l-white/8",badge:"bg-white/4 text-muted-foreground/30",bg:"",label:"skipped"}},X={border:"border-l-warning/80",badge:"bg-warning/10 text-warning",bg:"bg-warning/[0.03]"};function Z(e){if("action"===e.kind&&("report_step"===e.toolName||"finish"===e.toolName||"set_plan"===e.toolName))return!1;if("observation"===e.kind){var t;let n=null!=(t=e.text)?t:"";return n.startsWith("Error:")||n.startsWith("[debug]")}return!0}function K(e){var t;let{step:n,events:a,active:i,displayNum:o}=e,l=null!=(t=Q[n.status])?t:Q.queued,d=i?{...l,...X}:l,c=a.filter(Z),g=i||"fail"===n.status,[x,m]=(0,s.useState)(g);return(0,s.useEffect)(()=>m(g),[g]),(0,r.jsx)(M,{open:x,onOpenChange:m,children:(0,r.jsxs)("div",{className:(0,N.cn)("rounded-xl border border-white/7 border-l-2 overflow-hidden transition-colors",d.border,d.bg),children:[(0,r.jsxs)(B,{className:"group w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-white/[0.02] transition-colors",children:[(0,r.jsx)(y,{className:(0,N.cn)("border-0 text-[9.5px] tracking-widest font-semibold shrink-0 gap-1 uppercase rounded-md px-1.5",d.badge),children:i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{className:"size-2.5 animate-spin"}),"running"]}):l.label}),(0,r.jsxs)("span",{className:"flex-1 min-w-0 text-[13px] text-foreground/80",children:[(0,r.jsx)("span",{className:"text-muted-foreground/40 mr-2 font-mono text-[11px]",children:String(null!=o?o:n.num).padStart(2,"0")}),n.description]}),(0,r.jsx)(f.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 group-data-open:hidden"}),(0,r.jsx)(b.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 hidden group-data-open:inline"})]}),n.evidence&&(0,r.jsx)("div",{className:"px-4 pb-3 -mt-0.5 text-[11.5px] text-muted-foreground/60 leading-relaxed font-mono",children:n.evidence}),(0,r.jsx)(J,{children:(0,r.jsxs)("div",{className:"px-4 pb-4 pt-3 space-y-3 border-t border-white/5",children:[n.screenshot&&(0,r.jsx)("a",{href:n.screenshot,target:"_blank",rel:"noreferrer",className:"block rounded-lg overflow-hidden border border-white/8 hover:border-white/15 transition-colors",children:(0,r.jsx)("img",{src:n.screenshot,alt:"screenshot step ".concat(n.num),className:"max-h-64 w-full object-contain bg-black/20"})}),c.length>0?(0,r.jsx)("div",{className:"space-y-0.5",children:c.map((e,t)=>(0,r.jsx)(Y,{event:e},t))}):(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground/30",children:"no events for this step"})]})})]})})}function Y(e){let{event:t}=e,{icon:n,text:s,cls:a}=function(e){var t,n,r,s,a,i,o,l,d;switch(e.kind){case"action":return{icon:"→",text:function(e,t){var n,r,s,a,i,o,l,d;let c=null!=t?t:{};switch(e){case"navigate":return"Opening ".concat(null!=(n=c.url)?n:"");case"snapshot":return c.near?'Reading "'.concat(c.near,'" block'):"Reading page";case"click":return c.name?'Clicking "'.concat(c.name,'"'):"Clicking element";case"fill":return c.name?'Filling "'.concat(c.name,'" → "').concat(null!=(r=c.value)?r:"",'"'):'Filling "'.concat(null!=(s=c.value)?s:"",'"');case"select":return c.name?'Selecting "'.concat(null!=(a=c.value)?a:"",'" in "').concat(c.name,'"'):'Selecting "'.concat(null!=(i=c.value)?i:"",'"');case"hover":return c.name?'Hovering "'.concat(c.name,'"'):"Hovering element";case"scroll_to":return"Scrolling to ".concat(c.text?'"'.concat(c.text,'"'):null!=(o=c.ref)?o:"element");case"scroll":{let e=[Number(c.y)?"".concat(Number(c.y)>0?"down":"up"," ").concat(Math.abs(Number(c.y)),"px"):"",Number(c.x)?"".concat(Number(c.x)>0?"right":"left"," ").concat(Math.abs(Number(c.x)),"px"):""].filter(Boolean).join(", "),t=c.ref?" inside ".concat(c.ref):"";return"Scrolling ".concat(e||"0px").concat(t)}case"press":return"Pressing ".concat(null!=(l=c.key)?l:"");case"wait":return"Waiting ".concat(null!=(d=c.ms)?d:""," ms");case"ask_user":return"Asking user";default:return null!=e?e:"action"}}(e.toolName,e.toolInput),cls:"text-foreground/70"};case"step":{let s=null!=(r=null==(t=e.step)?void 0:t.status)?r:"",a="pass"===s?"text-success":"fail"===s?"text-destructive":"text-warning";return{icon:"pass"===s?"✓":"fail"===s?"✗":"!",text:"Step ".concat(null==(n=e.step)?void 0:n.num," — ").concat(s.toUpperCase()),cls:a}}case"observation":{let t=null!=(s=e.text)?s:"";if(t.startsWith("Error:"))return{icon:"✗",text:t,cls:"text-destructive"};return{icon:"\xb7",text:t,cls:"text-muted-foreground/40"}}case"question":return{icon:"?",text:"Asking: ".concat(null!=(i=null==(a=e.question)?void 0:a.prompt)?i:""),cls:"text-warning"};case"answer":return{icon:"✎",text:"User answered",cls:"text-foreground/50"};case"thought":return{icon:"›",text:null!=(o=e.text)?o:"",cls:"text-muted-foreground/40 italic"};case"done":return{icon:"■",text:"Run finished — ".concat(null!=(l=e.status)?l:""),cls:"text-foreground/60"};case"error":return{icon:"✗",text:null!=(d=e.text)?d:"",cls:"text-destructive"};default:return{icon:"\xb7",text:"",cls:"text-muted-foreground/30"}}}(t),i=new Date(t.ts).toLocaleTimeString("en-US",{hour12:!1});return(0,r.jsxs)("div",{className:"flex gap-2.5 text-[11.5px] leading-relaxed items-baseline font-mono",children:[(0,r.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground/25 text-[10px]",children:i}),(0,r.jsx)("span",{className:(0,N.cn)("shrink-0 w-3.5 text-center",a),children:n}),(0,r.jsx)("span",{className:(0,N.cn)("min-w-0 break-words",a),children:s})]})}function ee(e){let{runId:t,question:n}=e,[a,i]=(0,s.useState)(""),[o,l]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null);async function u(e){if(e.preventDefault(),a){l(!0),c(null);try{let e=await fetch("/api/run/".concat(t,"/answer"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:n.id,answer:a})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"HTTP ".concat(e.status))}i("")}catch(e){c(e instanceof Error?e.message:String(e)),l(!1)}}}return(0,r.jsxs)("form",{onSubmit:u,className:"space-y-4",children:[(0,r.jsx)(T,{children:(0,r.jsxs)(R,{className:"flex items-center gap-2 text-base",children:[(0,r.jsx)(x.A,{className:"size-4 text-warning shrink-0"}),"Agent needs input"]})}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.prompt}),(0,r.jsx)(I,{autoFocus:!0,type:n.secret?"password":"text",value:a,onChange:e=>i(e.target.value),placeholder:n.secret?"OTP / password":"answer",className:"font-mono"}),d&&(0,r.jsx)("p",{className:"text-destructive text-xs",children:d}),(0,r.jsx)(k.$,{type:"submit",disabled:!a||o,className:"w-full",children:o?"Sending…":"Submit"})]})}},5016:(e,t,n)=>{"use strict";n.d(t,{cn:()=>a});var r=n(2821),s=n(5889);function a(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.QP)((0,r.$)(t))}},7003:(e,t,n)=>{"use strict";n.d(t,{$:()=>l});var r=n(5155),s=n(9574),a=n(3101),i=n(5016);let o=(0,a.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:n="default",size:a="default",...l}=e;return(0,r.jsx)(s.$,{"data-slot":"button",className:(0,i.cn)(o({variant:n,size:a,className:t})),...l})}},9578:(e,t,n)=>{Promise.resolve().then(n.bind(n,191))}},e=>{e.O(0,[248,532,441,255,358],()=>e(e.s=9578)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{191:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>U});var r=n(5155),s=n(2115),a=n(2619),i=n.n(a),o=n(3229),l=n(3228),d=n(2638),c=n(3410),u=n(9746),g=n(7274),x=n(8215),m=n(5352),p=n(4788),f=n(7212),b=n(3916),h=n(1083),v=n(2027),j=n(3101),N=n(5016);let w=(0,j.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function y(e){let{className:t,variant:n="default",render:r,...s}=e;return(0,v.C)({defaultTagName:"span",props:(0,h.v6)({className:(0,N.cn)(w({variant:n}),t)},s),render:r,state:{slot:"badge",variant:n}})}var k=n(7003),z=n(4036),S=n(5949),A=n(4915),_=n(8502),E=n(8905),C=n(989);function q(e){let{...t}=e;return(0,r.jsx)(z.D,{"data-slot":"dialog",...t})}function F(e){let{...t}=e;return(0,r.jsx)(S.Z,{"data-slot":"dialog-portal",...t})}function O(e){let{className:t,...n}=e;return(0,r.jsx)(A.X,{"data-slot":"dialog-overlay",className:(0,N.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}function P(e){let{className:t,children:n,showCloseButton:s=!0,...a}=e;return(0,r.jsxs)(F,{children:[(0,r.jsx)(O,{}),(0,r.jsxs)(_.h,{"data-slot":"dialog-content",className:(0,N.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...a,children:[n,s&&(0,r.jsxs)(E.H,{"data-slot":"dialog-close",render:(0,r.jsx)(k.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(p.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function T(e){let{className:t,...n}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,N.cn)("flex flex-col gap-2",t),...n})}function R(e){let{className:t,...n}=e;return(0,r.jsx)(C.L,{"data-slot":"dialog-title",className:(0,N.cn)("font-heading text-base leading-none font-medium",t),...n})}var D=n(2045);function I(e){let{className:t,type:n,...s}=e;return(0,r.jsx)(D.p,{type:n,"data-slot":"input",className:(0,N.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})}var W=n(8521),$=n(2577),H=n(1127);function M(e){let{...t}=e;return(0,r.jsx)(W.N,{"data-slot":"collapsible",...t})}function B(e){let{...t}=e;return(0,r.jsx)($.R,{"data-slot":"collapsible-trigger",...t})}function J(e){let{...t}=e;return(0,r.jsx)(H.j,{"data-slot":"collapsible-content",...t})}function U(e){var t,n,a,g,x;let{params:m}=e,{id:p}=(0,s.use)(m),[f,b]=(0,s.useState)(null),[h,v]=(0,s.useState)([]),[j,w]=(0,s.useState)(!1),[y,z]=(0,s.useState)(null),[S,A]=(0,s.useState)(()=>Date.now()),[_,E]=(0,s.useState)(!1),C=(0,s.useRef)(!1);(0,s.useEffect)(()=>{C.current=!1;let e=new EventSource("/api/run/".concat(p,"/stream"));return e.onmessage=e=>{let t=JSON.parse(e.data);if(C.current=!0,t.events?v(t.events):t.event&&v(e=>[...e,t.event]),b({...t.run,events:[]}),!["running","waiting","paused"].includes(t.run.status)){var n,r,s,a,i;let e=null!=(i=null!=(a=null==(n=t.event)?void 0:n.ts)?a:null==(s=t.events)||null==(r=s.at(-1))?void 0:r.ts)?i:Date.now();z(t=>null!=t?t:e)}},e.onerror=()=>{e.close(),C.current||w(!0)},()=>e.close()},[p]);let F=null!=(n=null==f?void 0:f.status)?n:"running",O=null!=(a=null==f?void 0:f.steps)?a:[],T=O.filter(e=>"pass"===e.status).length,R=O.filter(e=>"fail"===e.status).length,D=O.filter(e=>"warn"===e.status).length,I="running"===F||"waiting"===F,W=I||"paused"===F;async function $(){W&&(E(!0),await fetch("/api/run/".concat(p,"/pause"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"paused"===F?"resume":"pause"})}).catch(()=>{}),E(!1))}let H=I&&null!=(g=null==(t=O.find(e=>"queued"===e.status))?void 0:t.num)?g:null;(0,s.useEffect)(()=>{if(!I)return;let e=setInterval(()=>A(Date.now()),1e3);return()=>clearInterval(e)},[I]),(0,s.useEffect)(()=>{var e;null!=H&&(null==(e=document.getElementById("step-".concat(H)))||e.scrollIntoView({behavior:"smooth",block:"center"}))},[H]);let M=f?(null!=y?y:S)-f.createdAt:0,B=O.filter(e=>"queued"!==e.status).length,J=O.length?B/O.length*100:0,U=[];for(let e of O){let t=U[U.length-1];t&&t.title===e.group?t.steps.push(e):U.push({title:e.group,steps:[e]})}return j?(0,r.jsxs)("main",{className:"flex flex-col items-center justify-center min-h-screen px-6 text-center",children:[(0,r.jsx)("p",{className:"text-6xl font-semibold text-muted-foreground/20 mb-4",children:"404"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Run not found — it may have finished and been cleared from memory."}),(0,r.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-sm text-foreground/70 hover:text-foreground transition-colors",children:[(0,r.jsx)(o.A,{className:"size-3.5"}),"New run"]})]}):(0,r.jsxs)("main",{className:"mx-auto max-w-2xl px-6 pt-10 pb-24",children:[(0,r.jsxs)(i(),{href:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mb-8",children:[(0,r.jsx)(o.A,{className:"size-3.5"}),"new run"]}),(0,r.jsxs)("section",{className:"mb-8",children:[(0,r.jsx)(G,{status:F}),(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight mt-5 break-words text-foreground/90",children:null!=(x=null==f?void 0:f.title)?x:p}),f&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-1.5",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground font-mono",children:O.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"text-foreground/60",children:[B,"/",O.length," steps"]}),T>0&&(0,r.jsxs)("span",{className:"text-success ml-2",children:["\xb7 ",T," passed"]}),D>0&&(0,r.jsxs)("span",{className:"text-warning ml-2",children:["\xb7 ",D," warn"]}),R>0&&(0,r.jsxs)("span",{className:"text-destructive ml-2",children:["\xb7 ",R," failed"]})]}):(0,r.jsx)("span",{className:"text-muted-foreground/50",children:"waiting for plan…"})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[W&&(0,r.jsx)(k.$,{variant:"ghost",size:"sm",onClick:$,disabled:_||"waiting"===F,className:"h-7 px-2 text-muted-foreground/60 hover:text-foreground",children:"paused"===F?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.A,{className:"size-3.5 mr-1"}),"Resume"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.A,{className:"size-3.5 mr-1"}),"Pause"]})}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/60 font-mono tabular-nums",children:[(0,r.jsx)(c.A,{className:"size-3"}),function(e){let t=Math.max(0,Math.floor(e/1e3));return"".concat(Math.floor(t/60),":").concat(String(t%60).padStart(2,"0"))}(M)]})]})]}),O.length>0&&(0,r.jsx)("div",{className:"relative mt-3 h-[3px] rounded-full bg-white/5 overflow-hidden",children:(0,r.jsx)("div",{className:(0,N.cn)("absolute inset-y-0 left-0 rounded-full transition-all duration-700 ease-out","failed"===F||"error"===F?"bg-destructive":"bg-success"),style:{width:"".concat(J,"%")}})})]}),(0,r.jsxs)("section",{className:"space-y-2",children:[0===O.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,r.jsx)(u.A,{className:"size-5 text-muted-foreground/30 animate-spin mb-3"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground/50",children:"waiting for agent to start…"})]}),U.map((e,t)=>(0,r.jsxs)("div",{className:"space-y-2",children:[e.title&&(0,r.jsx)("div",{className:"pt-4 first:pt-0 text-[10.5px] font-semibold uppercase tracking-widest text-muted-foreground/40",children:e.title}),e.steps.map((e,t)=>(0,r.jsx)("div",{id:"step-".concat(e.num),className:"scroll-mt-6",children:(0,r.jsx)(K,{step:e,displayNum:t+1,active:e.num===H,events:h.filter(t=>t.stepNum===e.num)})},e.num))]},t))]}),(null==f?void 0:f.summary)&&(0,r.jsxs)("div",{className:"mt-6 rounded-xl border border-white/7 bg-card/60 px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/40 mb-1.5",children:"Summary"}),(0,r.jsx)("div",{className:"text-sm leading-relaxed text-foreground/80",children:f.summary})]}),("passed"===F||"failed"===F)&&(0,r.jsx)(V,{}),(0,r.jsx)(q,{open:!!(null==f?void 0:f.pending),children:(0,r.jsx)(P,{showCloseButton:!1,children:(null==f?void 0:f.pending)&&(0,r.jsx)(ee,{runId:p,question:f.pending})})})]})}function V(){return(0,r.jsxs)("a",{href:"https://github.com/broxhq/qpilot",target:"_blank",rel:"noreferrer",className:"group mt-6 flex items-center gap-3 rounded-xl border border-white/7 bg-card/60 px-4 py-3 transition-colors hover:border-warning/30 hover:bg-warning/[0.03]",children:[(0,r.jsx)(g.A,{className:"size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-warning group-hover:fill-warning"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"text-sm text-foreground/80",children:["Did qpilot save you time?"," ",(0,r.jsx)("span",{className:"text-foreground/95 group-hover:text-warning transition-colors",children:"Star it on GitHub"})]}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground/50",children:"A ⭐ helps more people find it — takes two seconds."})]})]})}let L={running:{label:"Running",sub:"agent is executing steps",icon:(0,r.jsx)(u.A,{className:"size-4 animate-spin"}),color:"text-foreground/70",bg:"bg-white/5",border:"border-white/10"},waiting:{label:"Waiting",sub:"agent needs your input",icon:(0,r.jsx)(x.A,{className:"size-4"}),color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"},paused:{label:"Paused",sub:"run is paused",icon:(0,r.jsx)(d.A,{className:"size-4"}),color:"text-foreground/50",bg:"bg-white/5",border:"border-white/10"},passed:{label:"Passed",sub:"all steps passed",icon:(0,r.jsx)(m.A,{className:"size-4",strokeWidth:2.5}),color:"text-success",bg:"bg-success/10",border:"border-success/20"},failed:{label:"Failed",sub:"some steps failed",icon:(0,r.jsx)(p.A,{className:"size-4",strokeWidth:2.5}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"},error:{label:"Error",sub:"agent crashed",icon:(0,r.jsx)(x.A,{className:"size-4"}),color:"text-destructive",bg:"bg-destructive/10",border:"border-destructive/20"}};function G(e){var t;let{status:n}=e,s=null!=(t=L[n])?t:L.running;return(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:(0,N.cn)("flex items-center justify-center size-9 rounded-xl border transition-colors",s.bg,s.border,s.color),children:s.icon}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:(0,N.cn)("text-sm font-semibold tracking-tight",s.color),children:s.label}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground/60",children:s.sub})]})]})}let Q={queued:{border:"border-l-white/8",badge:"bg-white/5 text-muted-foreground/50",bg:"",label:"queued"},pass:{border:"border-l-success/60",badge:"bg-success/10 text-success",bg:"",label:"pass"},warn:{border:"border-l-warning/60",badge:"bg-warning/10 text-warning",bg:"",label:"warn"},fail:{border:"border-l-destructive/60",badge:"bg-destructive/10 text-destructive",bg:"bg-destructive/[0.03]",label:"fail"},skipped:{border:"border-l-white/8",badge:"bg-white/4 text-muted-foreground/30",bg:"",label:"skipped"}},X={border:"border-l-warning/80",badge:"bg-warning/10 text-warning",bg:"bg-warning/[0.03]"};function Z(e){if("action"===e.kind&&("report_step"===e.toolName||"finish"===e.toolName||"set_plan"===e.toolName))return!1;if("observation"===e.kind){var t;let n=null!=(t=e.text)?t:"";return n.startsWith("Error:")||n.startsWith("[debug]")}return!0}function K(e){var t;let{step:n,events:a,active:i,displayNum:o}=e,l=null!=(t=Q[n.status])?t:Q.queued,d=i?{...l,...X}:l,c=a.filter(Z),g=i||"fail"===n.status,[x,m]=(0,s.useState)(g);return(0,s.useEffect)(()=>m(g),[g]),(0,r.jsx)(M,{open:x,onOpenChange:m,children:(0,r.jsxs)("div",{className:(0,N.cn)("rounded-xl border border-white/7 border-l-2 overflow-hidden transition-colors",d.border,d.bg),children:[(0,r.jsxs)(B,{className:"group w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-white/[0.02] transition-colors",children:[(0,r.jsx)(y,{className:(0,N.cn)("border-0 text-[9.5px] tracking-widest font-semibold shrink-0 gap-1 uppercase rounded-md px-1.5",d.badge),children:i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{className:"size-2.5 animate-spin"}),"running"]}):l.label}),(0,r.jsxs)("span",{className:"flex-1 min-w-0 text-[13px] text-foreground/80",children:[(0,r.jsx)("span",{className:"text-muted-foreground/40 mr-2 font-mono text-[11px]",children:String(null!=o?o:n.num).padStart(2,"0")}),n.description]}),(0,r.jsx)(f.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 group-data-open:hidden"}),(0,r.jsx)(b.A,{className:"size-3.5 text-muted-foreground/30 shrink-0 hidden group-data-open:inline"})]}),n.evidence&&(0,r.jsx)("div",{className:"px-4 pb-3 -mt-0.5 text-[11.5px] text-muted-foreground/60 leading-relaxed font-mono",children:n.evidence}),(0,r.jsx)(J,{children:(0,r.jsxs)("div",{className:"px-4 pb-4 pt-3 space-y-3 border-t border-white/5",children:[n.screenshot&&(0,r.jsx)("a",{href:n.screenshot,target:"_blank",rel:"noreferrer",className:"block rounded-lg overflow-hidden border border-white/8 hover:border-white/15 transition-colors",children:(0,r.jsx)("img",{src:n.screenshot,alt:"screenshot step ".concat(n.num),className:"max-h-64 w-full object-contain bg-black/20"})}),c.length>0?(0,r.jsx)("div",{className:"space-y-0.5",children:c.map((e,t)=>(0,r.jsx)(Y,{event:e},t))}):(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground/30",children:"no events for this step"})]})})]})})}function Y(e){let{event:t}=e,{icon:n,text:s,cls:a}=function(e){var t,n,r,s,a,i,o,l,d;switch(e.kind){case"action":return{icon:"→",text:function(e,t){var n,r,s,a,i,o,l,d;let c=null!=t?t:{};switch(e){case"navigate":return"Opening ".concat(null!=(n=c.url)?n:"");case"snapshot":return c.near?'Reading "'.concat(c.near,'" block'):"Reading page";case"click":return c.name?'Clicking "'.concat(c.name,'"'):"Clicking element";case"fill":return c.name?'Filling "'.concat(c.name,'" → "').concat(null!=(r=c.value)?r:"",'"'):'Filling "'.concat(null!=(s=c.value)?s:"",'"');case"select":return c.name?'Selecting "'.concat(null!=(a=c.value)?a:"",'" in "').concat(c.name,'"'):'Selecting "'.concat(null!=(i=c.value)?i:"",'"');case"hover":return c.name?'Hovering "'.concat(c.name,'"'):"Hovering element";case"scroll_to":return"Scrolling to ".concat(c.text?'"'.concat(c.text,'"'):null!=(o=c.ref)?o:"element");case"scroll":{let e=[Number(c.y)?"".concat(Number(c.y)>0?"down":"up"," ").concat(Math.abs(Number(c.y)),"px"):"",Number(c.x)?"".concat(Number(c.x)>0?"right":"left"," ").concat(Math.abs(Number(c.x)),"px"):""].filter(Boolean).join(", "),t=c.ref?" inside ".concat(c.ref):"";return"Scrolling ".concat(e||"0px").concat(t)}case"press":return"Pressing ".concat(null!=(l=c.key)?l:"");case"wait":return"Waiting ".concat(null!=(d=c.ms)?d:""," ms");case"ask_user":return"Asking user";default:return null!=e?e:"action"}}(e.toolName,e.toolInput),cls:"text-foreground/70"};case"step":{let s=null!=(r=null==(t=e.step)?void 0:t.status)?r:"",a="pass"===s?"text-success":"fail"===s?"text-destructive":"text-warning";return{icon:"pass"===s?"✓":"fail"===s?"✗":"!",text:"Step ".concat(null==(n=e.step)?void 0:n.num," — ").concat(s.toUpperCase()),cls:a}}case"observation":{let t=null!=(s=e.text)?s:"";if(t.startsWith("Error:"))return{icon:"✗",text:t,cls:"text-destructive"};return{icon:"\xb7",text:t,cls:"text-muted-foreground/40"}}case"question":return{icon:"?",text:"Asking: ".concat(null!=(i=null==(a=e.question)?void 0:a.prompt)?i:""),cls:"text-warning"};case"answer":return{icon:"✎",text:"User answered",cls:"text-foreground/50"};case"thought":return{icon:"›",text:null!=(o=e.text)?o:"",cls:"text-muted-foreground/40 italic"};case"done":return{icon:"■",text:"Run finished — ".concat(null!=(l=e.status)?l:""),cls:"text-foreground/60"};case"error":return{icon:"✗",text:null!=(d=e.text)?d:"",cls:"text-destructive"};default:return{icon:"\xb7",text:"",cls:"text-muted-foreground/30"}}}(t),i=new Date(t.ts).toLocaleTimeString("en-US",{hour12:!1});return(0,r.jsxs)("div",{className:"flex gap-2.5 text-[11.5px] leading-relaxed items-baseline font-mono",children:[(0,r.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground/25 text-[10px]",children:i}),(0,r.jsx)("span",{className:(0,N.cn)("shrink-0 w-3.5 text-center",a),children:n}),(0,r.jsx)("span",{className:(0,N.cn)("min-w-0 break-words",a),children:s})]})}function ee(e){let{runId:t,question:n}=e,[a,i]=(0,s.useState)(""),[o,l]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null);async function u(e){if(e.preventDefault(),a){l(!0),c(null);try{let e=await fetch("/api/run/".concat(t,"/answer"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:n.id,answer:a})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"HTTP ".concat(e.status))}i("")}catch(e){c(e instanceof Error?e.message:String(e)),l(!1)}}}return(0,r.jsxs)("form",{onSubmit:u,className:"space-y-4",children:[(0,r.jsx)(T,{children:(0,r.jsxs)(R,{className:"flex items-center gap-2 text-base",children:[(0,r.jsx)(x.A,{className:"size-4 text-warning shrink-0"}),"Agent needs input"]})}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.prompt}),(0,r.jsx)(I,{autoFocus:!0,type:n.secret?"password":"text",value:a,onChange:e=>i(e.target.value),placeholder:n.secret?"OTP / password":"answer",className:"font-mono"}),d&&(0,r.jsx)("p",{className:"text-destructive text-xs",children:d}),(0,r.jsx)(k.$,{type:"submit",disabled:!a||o,className:"w-full",children:o?"Sending…":"Submit"})]})}},5016:(e,t,n)=>{"use strict";n.d(t,{cn:()=>a});var r=n(2821),s=n(5889);function a(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.QP)((0,r.$)(t))}},7003:(e,t,n)=>{"use strict";n.d(t,{$:()=>l});var r=n(5155),s=n(9574),a=n(3101),i=n(5016);let o=(0,a.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:n="default",size:a="default",...l}=e;return(0,r.jsx)(s.$,{"data-slot":"button",className:(0,i.cn)(o({variant:n,size:a,className:t})),...l})}},9578:(e,t,n)=>{Promise.resolve().then(n.bind(n,191))}},e=>{e.O(0,[248,532,441,255,358],()=>e(e.s=9578)),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|