@vostride/agent-qa-dashboard-ui 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{arrow-up-down-DyIZvSrC.js → arrow-up-down-D8UGCR46.js} +1 -1
- package/dist/assets/{badge-BbhOGRC0.js → badge-Dd058S66.js} +1 -1
- package/dist/assets/{batch-action-bar-CZxUcNFZ.js → batch-action-bar-BlKdJC25.js} +1 -1
- package/dist/assets/{circle-alert-pBH5T6su.js → circle-alert-Cr31wwud.js} +1 -1
- package/dist/assets/{circle-x-DLBotPS8.js → circle-x-CbsF-Or-.js} +1 -1
- package/dist/assets/config-B6eE0o2y.js +10 -0
- package/dist/assets/{copy-Gj5_oF-8.js → copy-BdD4bkD_.js} +1 -1
- package/dist/assets/display-step-4AfU6w4K.js +1 -0
- package/dist/assets/{dist-DZYW0-Ta.js → dist-D9h3nbVK.js} +1 -1
- package/dist/assets/{dist-DFSjTjXY.js → dist-DrO-WGvP.js} +1 -1
- package/dist/assets/dist-KjoEChiB.js +1 -0
- package/dist/assets/{empty-state-Dluv5C1Q.js → empty-state-c1UKljbh.js} +1 -1
- package/dist/assets/{external-link-BZ9gsZx_.js → external-link-MKpqbawt.js} +1 -1
- package/dist/assets/{eye-CZ7GiZXJ.js → eye-vXF-W3Sy.js} +1 -1
- package/dist/assets/{file-code-GHpcb0ud.js → file-code-C7vOuS4q.js} +1 -1
- package/dist/assets/{file-search-CIA16Vb8.js → file-search-COrO0ndH.js} +1 -1
- package/dist/assets/filename-validation-Ccwuaki1.js +1 -0
- package/dist/assets/{grip-vertical-aDoBVncr.js → grip-vertical-B4rX3Pd9.js} +1 -1
- package/dist/assets/{hook-editor-Dvrur2VR.js → hook-editor-fVte-sFt.js} +1 -1
- package/dist/assets/{hook-runtime-ChJ0-jZo.js → hook-runtime-CPPjqz70.js} +1 -1
- package/dist/assets/hook-viewer-Ceps9GqL.js +1 -0
- package/dist/assets/hooks-BwveYPPu.js +1 -0
- package/dist/assets/{id-badge-Dzm7eQ9l.js → id-badge-5c0D9pZV.js} +2 -2
- package/dist/assets/{index-B3xPCIyH.js → index-CZotRLCc.js} +2 -2
- package/dist/assets/{insights-rNBE_Oot.js → insights-D_d7szDN.js} +1 -1
- package/dist/assets/{insights-line-grid-G3ouKANt.js → insights-line-grid-DzQiRxUU.js} +4 -4
- package/dist/assets/{lib-BPEPp1D-.js → lib-CCr9qhea.js} +1 -1
- package/dist/assets/live-run-BxEaMSEi.js +1 -0
- package/dist/assets/{memory-DcKox3BM.js → memory-7vVmoZvP.js} +1 -1
- package/dist/assets/memory-product-B30NAtAP.js +2 -0
- package/dist/assets/{monaco-editor-CDJrOpKK.js → monaco-editor-Ba9qdSve.js} +2 -2
- package/dist/assets/{monaco-editor-inner-Q9WqqJ52.js → monaco-editor-inner-CeD8qR_F.js} +2 -2
- package/dist/assets/{monaco.contribution-DTHp-zXN.js → monaco.contribution-ZpEX2Im1.js} +2 -2
- package/dist/assets/{observation-block-DdB7C1c0.js → observation-block-BRa3lkBV.js} +1 -1
- package/dist/assets/observation-markdown-BJ9B18Mk.js +1 -0
- package/dist/assets/{pencil-BmkcPKBm.js → pencil-BdoVUAcl.js} +1 -1
- package/dist/assets/plus-BDA9KiOF.js +1 -0
- package/dist/assets/popover-BAlAEoO4.js +1 -0
- package/dist/assets/{refresh-cw-v_0wwa0P.js → refresh-cw-3zJOKpgR.js} +1 -1
- package/dist/assets/{resizable-COfX_iMb.js → resizable-BuOu2RfX.js} +1 -1
- package/dist/assets/run-detail-BkmoKeU2.js +1 -0
- package/dist/assets/runs-Bs16pBe9.js +1 -0
- package/dist/assets/{scroll-area-DfPMtFw0.js → scroll-area-48uajHeh.js} +1 -1
- package/dist/assets/select-B2_tSMl_.js +1 -0
- package/dist/assets/{shortcut-hints-CfVf0REF.js → shortcut-hints-BnEYaq1r.js} +1 -1
- package/dist/assets/split-button-C54F4hz3.js +1 -0
- package/dist/assets/square-lmyO8EeE.js +1 -0
- package/dist/assets/{step-name-pills-COKv64-4.js → step-name-pills-hCVbMRBe.js} +1 -1
- package/dist/assets/suite-editor-HxXY0n_h.js +5 -0
- package/dist/assets/suite-navbar-DzgJZNSk.js +1 -0
- package/dist/assets/suite-viewer-DX-uI0KI.js +1 -0
- package/dist/assets/{suites-Cbjz7uPI.js → suites-BrCm410e.js} +1 -1
- package/dist/assets/{switch-BOdp7A9U.js → switch-C7U17ptQ.js} +1 -1
- package/dist/assets/tab-console-W4FDWhGS.js +1 -0
- package/dist/assets/table-BGMQ2E9D.js +1 -0
- package/dist/assets/{tabs-CfNQIHt-.js → tabs-CWnvxa-h.js} +1 -1
- package/dist/assets/test-editor-C7jMc_bm.js +9 -0
- package/dist/assets/test-navbar-1FE5zQJP.js +7 -0
- package/dist/assets/{test-viewer-C6Rg-HeW.js → test-viewer-yi44-64J.js} +1 -1
- package/dist/assets/tests-D9iNxwue.js +1 -0
- package/dist/assets/{tests-suites-table-widths-tlOYaS72.js → tests-suites-table-widths-C3pXnpiW.js} +1 -1
- package/dist/assets/{textarea-ByegDm2e.js → textarea-C-0LUFGZ.js} +1 -1
- package/dist/assets/{trash-2-CawFHfTJ.js → trash-2-Cj6kkRf4.js} +1 -1
- package/dist/assets/{tsMode-DGJI_hpV.js → tsMode-fizT3CAG.js} +1 -1
- package/dist/assets/{use-hook-run-session-Cjqu9VED.js → use-hook-run-session-RvECpdZN.js} +1 -1
- package/dist/assets/{use-keyboard-shortcuts-BRF3cm7O.js → use-keyboard-shortcuts-BTppBDf3.js} +1 -1
- package/dist/assets/{use-page-title-CK82kWb2.js → use-page-title-BeSr97vd.js} +1 -1
- package/dist/assets/use-run-status-favicon-ClaOG7BI.js +1 -0
- package/dist/assets/{use-selection-queue-CZ4rXNAT.js → use-selection-queue-B7ZRHEAV.js} +1 -1
- package/dist/assets/{viewer-url-state-CZTYs75z.js → viewer-url-state-aAMA3-2e.js} +1 -1
- package/dist/assets/{zap-C7OZlYXQ.js → zap-oUNJUGP6.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/config-BfxB7vJt.js +0 -10
- package/dist/assets/display-step-CV3zilMS.js +0 -1
- package/dist/assets/dist-o2A-YJGQ.js +0 -1
- package/dist/assets/filename-validation-BOmZP9gf.js +0 -1
- package/dist/assets/hook-viewer-DwQt3CRN.js +0 -1
- package/dist/assets/hooks-DcW2AVgE.js +0 -1
- package/dist/assets/live-run-C2WLFzlf.js +0 -1
- package/dist/assets/memory-product-oHTD8fqS.js +0 -2
- package/dist/assets/observation-markdown-CvCuqq7R.js +0 -1
- package/dist/assets/plus-C6Zz9JLt.js +0 -1
- package/dist/assets/popover-CvQRjfg5.js +0 -1
- package/dist/assets/run-detail-B6QhqCjq.js +0 -1
- package/dist/assets/runs-DO4LkmoV.js +0 -1
- package/dist/assets/select-B5gV6YUf.js +0 -1
- package/dist/assets/split-button-C7J0EKrF.js +0 -1
- package/dist/assets/square-CvSqzenY.js +0 -1
- package/dist/assets/suite-editor-CaMQ5mWb.js +0 -5
- package/dist/assets/suite-navbar-CnJmeIp-.js +0 -1
- package/dist/assets/suite-viewer-HsI0Pn4t.js +0 -1
- package/dist/assets/tab-console-CLKFTABo.js +0 -1
- package/dist/assets/table-DL0PmHAE.js +0 -1
- package/dist/assets/test-editor-CIRL6zSb.js +0 -9
- package/dist/assets/test-navbar-CZhYoxgB.js +0 -7
- package/dist/assets/tests-C0Xhq39F.js +0 -1
- package/dist/assets/use-run-status-favicon-DoJZcfHz.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{d as t,f as n,i as r,n as i,o as a,r as o,t as s,u as c}from"./tab-console-W4FDWhGS.js";import{i as ee,n as l,o as u,s as d,t as te,u as ne}from"./select-B2_tSMl_.js";import{C as f,c as re,i as p,n as m,r as h,w as g}from"./id-badge-5c0D9pZV.js";import{r as ie}from"./monaco-editor-Ba9qdSve.js";import{t as _}from"./circle-x-CbsF-Or-.js";import{t as ae}from"./copy-BdD4bkD_.js";import{t as v}from"./eye-vXF-W3Sy.js";import{t as oe}from"./file-search-COrO0ndH.js";import{c as se}from"./split-button-C54F4hz3.js";import{t as y}from"./refresh-cw-3zJOKpgR.js";import{t as ce}from"./square-lmyO8EeE.js";import{a as b}from"./dist-DrO-WGvP.js";import{t as x}from"./scroll-area-48uajHeh.js";import{t as S}from"./switch-C7U17ptQ.js";import{i as C,n as le,r as ue,t as de}from"./tabs-CWnvxa-h.js";import{B as w,Fn as fe,Gn as pe,H as T,Ht as E,Jn as me,Nn as he,Pn as D,Qn as O,Rn as ge,Un as _e,Ut as k,Vt as A,W as j,Wn as ve,Wt as M,bt as N,er as ye,or as be,pr as P,qt as xe,tr as F,zn as I}from"./index-CZotRLCc.js";import{t as L}from"./badge-Dd058S66.js";import{n as Se,r as Ce,t as we}from"./resizable-BuOu2RfX.js";import{t as R}from"./empty-state-c1UKljbh.js";import{t as z}from"./display-step-4AfU6w4K.js";var B=me(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Te=me(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),V=e(P(),1);function H(e){function t(e){if(h(e)){e.flow=!1;for(let n of e.items)t(n.value)}if(p(e)){e.flow=!1;for(let n of e.items)t(n)}}t(e.contents)}function Ee(e){function t(e){return h(e)?(e.items=e.items.filter(e=>!t(e.value)),e.items.length===0):!1}t(e.contents)}var De=[`name`,`test-id`,`target`,`use`,`meta`,`context`,`steps`];function Oe(e){function t(e,n){if(h(e)){n?e.items.sort((e,t)=>{let n=De.indexOf(String(e.key)),r=De.indexOf(String(t.key));return(n===-1?De.length:n)-(r===-1?De.length:r)}):e.items.sort((e,t)=>String(e.key).localeCompare(String(t.key)));for(let n of e.items)t(n.value,!1)}}t(e.contents,!0)}function ke(e){return Ee(e),H(e),Oe(e),e.toString()}function Ae(e){let t=(0,V.useRef)(null),{doc:n,error:r}=(0,V.useMemo)(()=>{if(!e)return{doc:null,error:null};try{let n=m(e);return t.current=n,{doc:n,error:null}}catch(e){return{doc:t.current,error:e instanceof Error?e.message:`Invalid YAML`}}},[e]);return{doc:n,error:r,getIn:(0,V.useCallback)(e=>{if(n)return n.getIn(e)},[n]),setIn:(0,V.useCallback)((t,n)=>{let r=m(e);return r.setIn(t,n),ke(r)},[e]),deleteIn:(0,V.useCallback)(t=>{let n=m(e);return n.deleteIn(t),ke(n)},[e])}}var U=O(),je=[{value:`chromium`,label:`Chromium`},{value:`firefox`,label:`Firefox`},{value:`webkit`,label:`WebKit`}];function W(e){return e==null?``:`${e} (inherited)`}function Me(e){return e===!0?`(inherited: on)`:e===!1?`(inherited: off)`:`(inherited)`}function G(e){return e===`preserve`?`Preserve app data (inherited)`:e===`reset`?`Reset app data (inherited)`:`Select app state`}function Ne({content:e,onChange:t,selectedTarget:n,showMeta:r=!0}){let{getIn:i,setIn:a,deleteIn:o}=Ae(e);function s(e,n){t(n===``||n==null?o(e):a(e,n))}function c(e,n,r){t(n===(r??!1)?o(e):a(e,n))}let{targets:ne,globalUse:f}=re(),p=n?ne[n]?.platform:void 0,m=p===`android`||p===`ios`,h=i([`use`,`browser`,`name`]),g=i([`use`,`browser`,`headless`]),ie=i([`use`,`browser`,`viewport`,`width`]),_=i([`use`,`browser`,`viewport`,`height`]),ae=i([`use`,`timeout`,`step`]),v=i([`use`,`timeout`,`test`]),oe=i([`use`,`timeout`,`navigation`]),se=i([`use`,`healing`,`maxAttempts`]),y=i([`use`,`planner`,`maxSubActions`]),ce=i([`use`,`planner`,`previousStepCount`]),x=i([`use`,`logCapture`,`console`]),C=i([`use`,`logCapture`,`network`]),le=i([`use`,`llm`]),ue=i([`use`,`parallel`]),de=i([`use`,`device`]),w=i([`use`,`mobile`,`appState`]),fe=i([`meta`,`retries`]),pe=i([`meta`,`record`]),T=f?.browser?.headless,me=f?.logCapture?.console,he=f?.logCapture?.network,D=f?.parallel,O=f?.mobile?.appState,ge=r?`Select a device for this mobile test.`:`Select a device for this mobile suite.`;function _e(e){t(e===O?o([`use`,`mobile`,`appState`]):a([`use`,`mobile`,`appState`],e))}return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-1 opacity-50`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Not applicable to mobile targets`})]}),(0,U.jsx)(A,{})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Engine`}),(0,U.jsxs)(te,{value:h??``,onValueChange:e=>s([`use`,`browser`,`name`],e||void 0),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:W(f?.browser?.name??`chromium`)})}),(0,U.jsx)(l,{children:je.map(e=>(0,U.jsx)(ee,{value:e.value,children:e.label},e.value))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Headless `,g===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(T)})]}),(0,U.jsx)(S,{checked:g??T??!0,onCheckedChange:e=>c([`use`,`browser`,`headless`],e,T)})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport W`}),(0,U.jsx)(E,{type:`number`,value:ie??``,onChange:e=>s([`use`,`browser`,`viewport`,`width`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.width??1280),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport H`}),(0,U.jsx)(E,{type:`number`,value:_??``,onChange:e=>s([`use`,`browser`,`viewport`,`height`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.height??720),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{})]}),m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Mobile`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Device`}),(0,U.jsx)(E,{value:de??``,onChange:e=>s([`use`,`device`],e.target.value||void 0),placeholder:ge,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`App state`}),(0,U.jsxs)(te,{value:w??``,onValueChange:e=>_e(e),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:G(O)})}),(0,U.jsxs)(l,{children:[(0,U.jsx)(ee,{value:`preserve`,children:`Preserve app data`}),(0,U.jsx)(ee,{value:`reset`,children:`Reset app data`})]})]})]})]}),(0,U.jsx)(A,{})]}):null,(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Timeouts`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Step`}),(0,U.jsx)(E,{value:ae??``,onChange:e=>s([`use`,`timeout`,`step`],e.target.value||void 0),placeholder:W(f?.timeout?.step??`30s`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Test`}),(0,U.jsx)(E,{value:v??``,onChange:e=>s([`use`,`timeout`,`test`],e.target.value||void 0),placeholder:W(f?.timeout?.test??`5m`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Navigation`}),(0,U.jsx)(E,{value:oe??``,onChange:e=>s([`use`,`timeout`,`navigation`],e.target.value||void 0),placeholder:W(f?.timeout?.navigation??`15s`),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Agent`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Heal Attempts`}),(0,U.jsx)(E,{type:`number`,min:0,value:se??``,onChange:e=>s([`use`,`healing`,`maxAttempts`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.healing?.maxAttempts??3),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Sub-Actions`}),(0,U.jsx)(E,{type:`number`,min:1,value:y??``,onChange:e=>s([`use`,`planner`,`maxSubActions`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.maxSubActions??5),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Prev Steps`}),(0,U.jsx)(E,{type:`number`,min:0,value:ce??``,onChange:e=>s([`use`,`planner`,`previousStepCount`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.previousStepCount??3),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Log Capture`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Console `,x===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(me)})]}),(0,U.jsx)(S,{checked:x??me??!1,onCheckedChange:e=>c([`use`,`logCapture`,`console`],e,me)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Network `,C===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(he)})]}),(0,U.jsx)(S,{checked:C??he??!1,onCheckedChange:e=>c([`use`,`logCapture`,`network`],e,he)})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`LLM`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`LLM Config`}),(0,U.jsx)(E,{value:le??``,onChange:e=>s([`use`,`llm`],e.target.value||void 0),placeholder:W(f?.llm??`default`),className:`h-7 text-xs`})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Execution`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Parallel `,ue===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(D)})]}),(0,U.jsx)(S,{checked:ue??D??!1,onCheckedChange:e=>c([`use`,`parallel`],e,D)})]}),r&&(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Retries`}),(0,U.jsx)(E,{type:`number`,min:0,value:fe??``,onChange:e=>s([`meta`,`retries`],e.target.value?Number(e.target.value):void 0),placeholder:`0 (inherited)`,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Record `,pe===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(inherited: off)`})]}),(0,U.jsx)(`div`,{className:`flex items-center h-7`,children:(0,U.jsx)(S,{checked:pe??!1,onCheckedChange:e=>c([`meta`,`record`],e,!1)})})]})]})]})]})}function Pe({runId:e,onClose:n}){let[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(`connecting`),[s,c]=(0,V.useState)(),[ee,l]=(0,V.useState)(0),u=(0,V.useRef)(null);if((0,V.useEffect)(()=>{if(!e)return;let t=!1;i([]),o(`connecting`),c(void 0),l(0);let n=Date.now();u.current=setInterval(()=>{t||l(Date.now()-n)},200);let r=N(e,{onRunStart:()=>{t||o(`running`)},onStepStart:e=>{t||(o(`running`),i(t=>[...t,{name:e.stepName,status:`running`}]))},onStepComplete:e=>{t||i(t=>{let n=!1;return t.map(t=>n||t.name!==e.stepName||t.status!==`running`?t:(n=!0,{...t,status:be(e.status),duration:e.duration,error:e.error??void 0}))})},onRunComplete:e=>{if(t)return;let n=F(e.status);c(n.normalized),o(n.normalized===`passed`?`complete`:`error`),i(t=>t.map(t=>t.status===`running`?{...t,status:ye(e.status)}:t)),u.current&&clearInterval(u.current)},onRunError:e=>{t||(o(`error`),i(t=>[...t,{name:`Run Error`,status:`failed`,error:e.error}]),u.current&&clearInterval(u.current))}});return()=>{t=!0,u.current&&clearInterval(u.current),r.close()}},[e]),!e)return null;let d=s?F(s):null,te=a===`connecting`?`Connecting...`:a===`running`?`Running`:d?.label??(a===`complete`?`Passed`:`Failed`);return(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a===`running`||a===`connecting`?(0,U.jsx)(g,{className:`size-4 text-primary`}):d?.normalized===`passed`||a===`complete`?(0,U.jsx)(_e,{className:`size-4 text-emerald-500`}):d?.normalized===`cancelled`?(0,U.jsx)(ce,{className:`size-4 text-muted-foreground`}):d?.normalized===`flaky`||d?.normalized===`healed`?(0,U.jsx)(y,{className:`size-4 text-amber-500`}):(0,U.jsx)(_,{className:`size-4 text-red-500`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:te}),(a===`running`||a===`connecting`)&&(0,U.jsxs)(L,{variant:`outline`,className:`text-xs gap-1`,children:[(0,U.jsx)(t,{className:`size-3`}),xe(ee)]})]}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-xs`,onClick:n,children:(0,U.jsx)(he,{className:`size-3.5`})})]}),(0,U.jsx)(x,{className:`flex-1 [&>[data-slot=scroll-area-viewport]>div]:!block`,children:(0,U.jsxs)(`div`,{className:`p-3 space-y-1.5`,children:[r.map((e,t)=>(0,U.jsxs)(`div`,{className:M(`relative overflow-hidden flex items-start gap-2 rounded-md border px-3 py-2 text-sm`,e.status===`running`&&`live-running-surface border-border/60 bg-primary/5`,e.status===`passed`&&`border-emerald-500/20 bg-emerald-500/5`,e.status===`failed`&&`border-destructive/20 bg-destructive/5`,e.status===`cancelled`&&`border-border/60 bg-muted/30`,e.status===`flaky`&&`border-amber-500/20 bg-amber-500/5`,e.status!==`running`&&e.status!==`passed`&&e.status!==`failed`&&e.status!==`cancelled`&&e.status!==`flaky`&&`border-border/60 bg-card/40`),children:[e.status===`running`?(0,U.jsx)(g,{className:`size-3.5 mt-0.5 shrink-0 text-primary`}):e.status===`passed`||e.status===`completed`?(0,U.jsx)(_e,{className:`size-3.5 mt-0.5 text-emerald-500 shrink-0`}):e.status===`cancelled`?(0,U.jsx)(ce,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}):e.status===`flaky`?(0,U.jsx)(y,{className:`size-3.5 mt-0.5 text-amber-500 shrink-0`}):(0,U.jsx)(_,{className:`size-3.5 mt-0.5 text-red-500 shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 min-w-0 break-words`,children:e.name}),e.duration!==void 0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:xe(e.duration)})]},`${e.name}-${t}`)),r.length===0&&a===`connecting`&&(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Waiting for events...`})]})})]})}function Fe({ariaTree:e,onRefresh:t,isExecuting:n}){return e?(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-end px-3 py-1 border-b border-border/50`,children:t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,"aria-label":`Refresh ARIA tree`,children:[(0,U.jsx)(y,{className:`size-3`}),`Refresh`]})}),(0,U.jsx)(x,{className:`flex-1`,children:(0,U.jsx)(`pre`,{className:`font-mono text-xs p-3 whitespace-pre-wrap`,children:e})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:`Run a step or click Fetch to capture the accessibility tree`}),t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1.5 text-xs px-2.5 py-1 rounded border border-border hover:bg-muted transition-colors disabled:opacity-50`,children:[(0,U.jsx)(y,{className:`size-3`}),`Fetch`]})]})}function K(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:e.phaseDurations?.observe??null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:e.phaseDurations?.plan??null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:e.phaseDurations?.execute??null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),e.verifierReasoning&&t.push({key:`verifier`,label:`Verifier`,icon:c,content:e.verifierReasoning,duration:e.phaseDurations?.verify??null}),t}function Ie(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}function Le({step:e,subAction:t}){if(t){let e=K(t);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Sub-action #`,t.index+1]}),(0,U.jsx)(`span`,{className:`text-xs font-medium ${t.result===`success`?`text-emerald-500`:`text-red-500`}`,children:t.result}),t.confidence!=null&&(0,U.jsx)(a,{confidence:t.confidence})]}),(0,U.jsx)(r,{mode:`static`,sections:e}),t.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:t.error})]})}let n=Ie(e);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Step #`,e.stepOrder+1]}),e.confidence!=null&&(0,U.jsx)(a,{confidence:e.confidence})]}),n.length>0?(0,U.jsx)(r,{mode:`static`,sections:n}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No reasoning data yet.`}),e.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:e.error})]})}function Re({screenshot:e,connectionState:t,onReconnect:n}){return(0,U.jsx)(`div`,{className:`relative flex h-full w-full items-center justify-center overflow-hidden bg-background`,children:e?(0,U.jsx)(`img`,{src:e,alt:`Browser preview`,className:`max-w-full max-h-full object-contain`}):t===`connecting`||t===`connected`&&!e?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(I,{className:`h-6 w-6 animate-spin`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Connecting to browser...`})]}):t===`disconnected`||t===`error`?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(Te,{className:`h-6 w-6`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Browser disconnected`}),n&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:n,children:`Reconnect`})]}):null})}var ze={idle:{label:`Ready`,tone:`bg-muted-foreground/35`},connecting:{label:`Connecting`,tone:`bg-primary animate-pulse`},connected:{label:`Connected`,tone:`bg-emerald-500`},executing:{label:`Executing`,tone:`bg-primary animate-pulse`},disconnected:{label:`Disconnected`,tone:`bg-amber-500`},error:{label:`Error`,tone:`bg-destructive`}};function Be(e){switch(e){case`invalid`:return{label:`Draft invalid`,className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`};case`saved`:return{label:`Saved draft`,className:`border-border/70 bg-background text-muted-foreground`};default:return{label:`Using unsaved draft`,className:`border-primary/25 bg-primary/10 text-primary`}}}function Ve(e,t){let n=e.trim();if(!n)return``;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return n;if(n.startsWith(`/`))try{return new URL(n,t??`https://example.com`).toString()}catch{return n}return/^[\w.-]+(?::\d+)?(?:[/?#]|$)/.test(n)?`https://${n}`:n}function He({hook:e}){return e.status===`passed`?(0,U.jsxs)(L,{className:`border-emerald-500/20 bg-emerald-500/15 text-emerald-500`,children:[(0,U.jsx)(_e,{className:`size-3`}),`Passed`]}):e.status===`failed`?(0,U.jsxs)(L,{variant:`destructive`,children:[(0,U.jsx)(fe,{className:`size-3`}),`Failed`]}):e.status===`running`?(0,U.jsxs)(L,{className:`border-primary/20 bg-primary/15 text-primary`,children:[(0,U.jsx)(I,{className:`size-3 animate-spin`}),`Running`]}):(0,U.jsx)(L,{variant:`outline`,children:`Pending`})}function Ue({hook:e}){return!e.variables||Object.keys(e.variables).length===0?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`This hook did not emit any variables`}):(0,U.jsx)(`div`,{className:`space-y-2 p-4`,children:Object.entries(e.variables).map(([e,t])=>(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e}),(0,U.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all font-mono text-xs`,children:t})]},e))})}function We({hook:e}){return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(D,{className:`size-4 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,U.jsx)(L,{variant:`outline`,className:`font-mono text-[10px]`,children:e.id}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:e.phase}),(0,U.jsx)(He,{hook:e}),e.duration!=null&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),e.stdout&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stdout`}),(0,U.jsx)(`pre`,{className:`rounded-md border bg-background/80 p-3 text-xs whitespace-pre-wrap break-all`,children:e.stdout})]}),e.stderr&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stderr`}),(0,U.jsx)(`pre`,{className:`rounded-md border border-destructive/20 bg-destructive/5 p-3 text-xs whitespace-pre-wrap break-all text-destructive`,children:e.stderr})]}),e.variables&&Object.keys(e.variables).length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Emitted Variables`}),(0,U.jsx)(Ue,{hook:e})]}),!e.stdout&&!e.stderr&&(!e.variables||Object.keys(e.variables).length===0)&&!e.error&&(0,U.jsx)(R,{icon:D,title:`No hook output yet`,description:`Connect a live session, run a teardown hook, or end the current session to capture hook output.`})]})}function Ge(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.status!==`idle`||n.phases.length>0||n.executionHistory.length>0||n.consoleLogs.length>0||n.networkLogs.length>0)return n}return null}function Ke(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:return`border-destructive/20 bg-destructive/10 text-destructive`;case`cancelled`:return`border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400`;default:return`border-border/70 bg-background text-muted-foreground`}}function qe(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:case`healed`:case`flaky`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:case`cancelled`:case`skipped`:return`border-destructive/20 bg-destructive/10 text-destructive`;default:return`border-border/70 bg-background text-muted-foreground`}}function Je({test:e,selectedStep:t,subAction:n}){let r=e.liveSteps.map(e=>z(e,e.stepIndex));return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.path})]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,Ke(e.status)),children:e.status}),typeof e.duration==`number`&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Setup Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestSetupHooks.length>0?e.perTestSetupHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test setup hooks`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Teardown Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestTeardownHooks.length>0?e.perTestTeardownHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test teardown hooks`})]})]}),r.length>0?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Steps`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>{let r=t?.id===e.id,i=e.subActionsData??[];return(0,U.jsxs)(`div`,{className:M(`overflow-hidden rounded-md border bg-background/80`,r&&`border-primary/30 ring-1 ring-primary/20`),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[(0,U.jsxs)(`span`,{className:`shrink-0 text-sm font-medium`,children:[`Step #`,e.stepOrder+1]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,qe(e.status)),children:e.status}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.name}),e.duration>0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),i.length>0?(0,U.jsx)(`div`,{className:`divide-y divide-border/60`,children:i.map(t=>(0,U.jsx)(`div`,{className:M(r&&n?.index===t.index&&`bg-primary/5`),children:(0,U.jsx)(Le,{step:e,subAction:t})},`${e.id}-sub-${t.index}`))}):(0,U.jsx)(Le,{step:e,subAction:r?n:null})]},e.id)})})]}):(0,U.jsx)(`div`,{className:`rounded-md border border-dashed px-4 py-6 text-sm text-muted-foreground`,children:`This test has not produced any live step detail yet. Run it from the queue to inspect reasoning, console, network, and hook output.`})]})}function q({connectionState:e,isLaunching:t,targetName:n,targetLabel:r,platform:a,screenshot:c,currentUrl:ee,pendingNavigation:l,steps:u,setupHooks:d,teardownHooks:te,tests:re=[],selection:p,runningStepId:m,terminalState:h,draftState:g,ariaTree:_,errorMessage:v,devtoolsTab:b,canRunAll:S,isRunningAll:w,isStoppingRunAll:T,setupHooksStale:E=!1,onDevtoolsTabChange:me,onRunAll:he,onStopAll:D,onEndSession:O,onRestartSession:ge,showEndSessionAction:_e=!1,onCloseLiveMode:A,onStartFreshSession:j,onBack:N,onForward:ye,onRefresh:be,onNavigate:P,onRequestAriaTree:xe,executionUnit:F=`step`,runAllLabel:Te,stopAllLabel:H,liveSessionNumber:Ee=null,unitRowsSlot:De}){let[Oe,ke]=(0,V.useState)(!1),[Ae,je]=(0,V.useState)(``),[W,Me]=(0,V.useState)(!1),G=t?`connecting`:e,Ne=h?{label:h.reason===`ended`?`Ended`:`Disconnected`,tone:h.reason===`ended`?`bg-muted-foreground/45`:`bg-amber-500`}:ze[G],Pe=(0,V.useMemo)(()=>u.map((e,t)=>z(e,t)),[u]),K=F===`test`,Ie=!K,He=(0,V.useMemo)(()=>[...d,...te],[d,te]),Ke=(0,V.useMemo)(()=>m||(Ge(u)?.id??null),[m,u]),qe=p&&`stepId`in p?p.stepId:Ke,q=(0,V.useMemo)(()=>Pe.find(e=>e.id===qe)??null,[Pe,qe]),Ye=(0,V.useMemo)(()=>p?.type!==`subaction`||!q?null:q.subActionsData?.[p.subIndex]??null,[p,q]),Xe=(0,V.useMemo)(()=>u.find(e=>e.id===q?.id)??null,[q,u]),J=(0,V.useMemo)(()=>p?.type===`hook`?He.find(e=>e.id===p.hookId)??null:null,[p,He]),Y=(0,V.useMemo)(()=>!K||!p?null:p.type===`test`||p.type===`test-hook`?re[p.testIndex]??null:`stepId`in p?re.find(e=>e.liveSteps.some(e=>e.id===p.stepId))??null:null,[p,K,re]),Ze=(0,V.useMemo)(()=>!K||p?.type!==`suite-hook`?null:(p.phase===`setup`?d:te).find(e=>e.id===p.hookId)??null,[p,d,K,te]),Qe=(0,V.useMemo)(()=>{if(!K||p?.type!==`test-hook`)return null;let e=re[p.testIndex];return e?(p.phase===`setup`?e.perTestSetupHooks:e.perTestTeardownHooks).find(e=>e.id===p.hookId)??null:null},[p,K,re]),X=(0,V.useMemo)(()=>{if(!K||!Y)return null;if(p&&`stepId`in p){let e=Y.liveSteps.find(e=>e.id===p.stepId);if(e)return e}if(Y.runningStepIndex!==null){let e=Y.liveSteps.find(e=>e.stepIndex===Y.runningStepIndex);if(e)return e}return Ge(Y.liveSteps)},[p,Y,K]),Z=(0,V.useMemo)(()=>X?z(X,X.stepIndex):null,[X]),$e=(0,V.useMemo)(()=>p?.type!==`subaction`||!Z?null:Z.subActionsData?.[p.subIndex]??null,[p,Z]),et=(0,V.useMemo)(()=>Y?.liveSteps.map(e=>z(e,e.stepIndex))??[],[Y]),tt=X?.executionLogs??[],nt=Xe?.executionLogs??[],Q=Be(g),$=a===`web`?ee||r||`Configured start URL`:r||(a===`android`?`Android device`:`iOS device`);(0,V.useEffect)(()=>{W||je($)},[$,W]);let rt=(0,V.useMemo)(()=>{if(K){let e=re.find(e=>e.status===`running`);return e?`Running ${e.name}`:null}if(!m)return null;let e=Pe.find(e=>e.id===m);return e?`Running step ${e.stepOrder+1}`:`Running current step`},[Pe,m,K,re]),it=async()=>{$&&(await navigator.clipboard.writeText($),ke(!0),window.setTimeout(()=>ke(!1),1500))},at=()=>{let e=Ve(Ae,ee);if(!e){je($);return}je(e),Me(!1),P(e)},ot=!K&&!!(p&&p.type!==`hook`&&!q);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card/30`,children:[(0,U.jsxs)(`div`,{className:`border-b px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:n||`Live Session`}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:Ne.label}),(e===`connected`||e===`executing`)&&typeof Ee==`number`&&(0,U.jsxs)(L,{variant:`outline`,"aria-live":`polite`,className:`text-[10px] tracking-wider font-medium text-muted-foreground bg-muted/50 border-border/50`,children:[`Session #`,Ee]}),rt&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:rt})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a===`web`?(0,U.jsx)(se,{className:`size-3.5 shrink-0`}):(0,U.jsx)(f,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,title:$,children:$})]}),v&&!h&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-2xl text-xs text-destructive [overflow-wrap:anywhere]`,children:v})]}),!h&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px]`,Q.className),children:Q.label}),E&&(0,U.jsx)(L,{className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`,children:`Restart required`}),Ie&&(w?(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:D,disabled:T,children:[T?(0,U.jsx)(I,{className:`size-3.5 animate-spin`}):(0,U.jsx)(ce,{className:`size-3.5`}),T?`Stopping...`:H??`Stop All Steps`]}):(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:he,disabled:!S,children:[(0,U.jsx)(ie,{className:`size-3.5`}),Te??`Run All Steps`]})),_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})]})]}),E&&!h&&(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-start justify-between gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,U.jsx)(fe,{className:`mt-0.5 size-4 shrink-0`}),(0,U.jsx)(`span`,{children:`Hook order or names changed after this live session started. Continue using the current disposable session, or restart to apply the latest setup and teardown hooks.`})]}),ge&&(0,U.jsx)(k,{type:`button`,size:`sm`,className:`shrink-0`,onClick:ge,children:`Restart Live Session`})]}),!h&&(a===`web`?(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:N,disabled:G===`executing`||G===`idle`,"aria-label":`Go back`,children:(0,U.jsx)(pe,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:ye,disabled:G===`executing`||G===`idle`,"aria-label":`Go forward`,children:(0,U.jsx)(ve,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:be,disabled:G===`executing`||G===`idle`,"aria-label":`Refresh page`,children:(0,U.jsx)(y,{className:`size-3.5`})})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 rounded-full border bg-background px-3 py-2`,children:[l?(0,U.jsx)(I,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`}):(0,U.jsx)(se,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`input`,{value:Ae,title:$,onFocus:()=>Me(!0),onBlur:()=>{Me(!1),je($)},onChange:e=>je(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),at()),e.key===`Escape`&&(e.preventDefault(),Me(!1),je($))},disabled:G===`executing`||G===`idle`,className:M(`min-w-0 flex-1 bg-transparent text-sm outline-none`,W?`text-left`:`text-center`)})]}),(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-1`,children:(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:it,disabled:!$,"aria-label":Oe?`URL copied`:`Copy URL`,title:Oe?`URL copied`:`Copy URL`,children:Oe?(0,U.jsx)(ne,{className:`size-3.5`}):(0,U.jsx)(ae,{className:`size-3.5`})})})]}):(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})}))]}),F===`test`&&De,(0,U.jsxs)(Ce,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[(0,U.jsx)(Se,{defaultSize:62,minSize:32,children:h?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-lg flex-col items-center gap-4 rounded-lg border bg-background/80 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:h.title}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:h.description})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[A&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:A,children:`Close Live Mode`}),j&&(0,U.jsx)(k,{size:`sm`,onClick:j,children:`Start Fresh Session`})]})]})}):G===`idle`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-4 rounded-lg border bg-background/70 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:`Live mode is target-scoped`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This workspace runs the current builder draft against the selected target. Sessions are disposable and draft changes only persist when you save the test.`})]})]})}):(0,U.jsx)(Re,{screenshot:c,connectionState:G})}),(0,U.jsx)(we,{withHandle:!0}),(0,U.jsx)(Se,{defaultSize:38,minSize:20,children:(0,U.jsxs)(de,{value:b,onValueChange:e=>me(e),className:`flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(ue,{variant:`line`,className:`h-9 justify-start rounded-none border-b px-3`,children:[(0,U.jsx)(C,{value:`reasoning`,className:`rounded-none text-xs`,children:`Reasoning`}),(0,U.jsx)(C,{value:`env`,className:`rounded-none text-xs`,children:`Env`}),(0,U.jsx)(C,{value:`network`,className:`rounded-none text-xs`,children:`Network`}),(0,U.jsx)(C,{value:`console`,className:`rounded-none text-xs`,children:`Console`}),(0,U.jsx)(C,{value:`aria`,className:`rounded-none text-xs`,children:`ARIA Tree`})]}),(0,U.jsx)(le,{value:`reasoning`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(x,{className:`h-full`,children:K?Ze?(0,U.jsx)(We,{hook:Ze}):Qe?(0,U.jsx)(We,{hook:Qe}):Y?(0,U.jsx)(Je,{test:Y,selectedStep:Z,subAction:$e}):(0,U.jsx)(R,{icon:oe,title:`Select a test to inspect it`,description:`Choose a test in the live queue to see its reasoning, logs, hooks, and network activity.`}):J?(0,U.jsx)(We,{hook:J}):q?(0,U.jsx)(Le,{step:q,subAction:Ye}):ot?(0,U.jsx)(R,{icon:oe,title:`Selection is no longer available`,description:`Pick another step in the builder to inspect its reasoning.`}):(0,U.jsx)(R,{icon:oe,title:`No reasoning yet`,description:`Run a step from the builder or use Run All Steps to populate the live reasoning trace.`})})}),(0,U.jsx)(le,{value:`env`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:X,executionLogs:tt})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test-owned hook or run a step to inspect variables and runJS output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:J})}):Xe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:Xe,executionLogs:nt})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect variables and runJS output`})}),(0,U.jsx)(le,{value:`network`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze||Qe?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a test step to inspect requests.`}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:Z,allSteps:et,platform:a})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect its network activity`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a step to inspect requests.`}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:q,allSteps:Pe,platform:a})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect network activity`})}),(0,U.jsx)(le,{value:`console`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:Z,allSteps:et,executionLogs:tt,isHookStep:tt.length>0})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect console output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:J})}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:q,allSteps:Pe,executionLogs:nt,isHookStep:nt.length>0})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect console output`})}),(0,U.jsx)(le,{value:`aria`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(Fe,{ariaTree:_,onRefresh:xe,isExecuting:G===`executing`})})]})})]})]})}function Ye(){return typeof window<`u`&&window.localStorage!==void 0}function Xe(){if(!Ye())return!1;try{return window.localStorage.getItem(`agent-qa:live-debug`)===`1`}catch{return!1}}function J(e,t,n){if(!Xe())return;let r=`[agent-qa live:${e}] ${t}`;if(n){console.info(r,n);return}console.info(r)}function Y(e,t){let n=typeof e==`string`?{instruction:e}:e;return{id:t?.id??n.draftId??crypto.randomUUID(),draftId:n.draftId??t?.draftId??null,instruction:n.instruction,status:t?.status??`idle`,duration:t?.duration,error:t?.error,phases:t?.phases??[],executionHistory:t?.executionHistory??[],capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[],executionGeneration:t?.executionGeneration??0}}function Ze(e,t){return{id:e.hookId,executionId:t?.executionId??null,name:e.name??t?.name??e.hookId,phase:e.phase,status:t?.status??`pending`,duration:t?.duration,stdout:t?.stdout??null,stderr:t?.stderr??null,variables:t?.variables??null,error:t?.error,createdAt:t?.createdAt}}function Qe(e,t){return{...Y({draftId:t?.draftId,instruction:e.instruction},t),id:t?.id??crypto.randomUUID(),stepIndex:e.stepIndex}}function X(e,t){let n=e.findIndex(e=>e.id===t.id);return n===-1?[...e,t]:e.map((e,r)=>r===n?{...e,...t}:e)}function Z(e,t,n){let r=e.find(e=>e.stepIndex===t.stepIndex),i={...Qe(t,r),...n};return[...r?e.map(e=>e.stepIndex===t.stepIndex?i:e):[...e,i]].sort((e,t)=>e.stepIndex-t.stepIndex)}function $e(e,t){let n=t.map(e=>({draftId:e.draftId,instruction:e.instruction}));if(e.length===n.length&&e.every((e,t)=>e.instruction===n[t].instruction&&e.draftId===n[t].draftId))return e;let r=new Map(e.filter(e=>!!e.draftId).map(e=>[e.draftId,e]));return n.map((t,n)=>Y(t,t.draftId?r.get(t.draftId):e[n]))}function et(e,t,n){if(e.length===t.length&&e.every((e,r)=>e.id===t[r]&&e.phase===n))return e;let r=new Map(e.map(e=>[e.id,e]));return t.map(e=>Ze({hookId:e,phase:n},r.get(e)))}function tt(e,t,n){return{id:n?.id??`${e.testId}:${e.path}:${t}`,draftId:e.draftId??n?.draftId??null,testId:e.testId,path:e.path,name:e.name,status:n?.status??`idle`,duration:n?.duration,error:n?.error,testExecutionId:n?.testExecutionId??null,liveSteps:n?.liveSteps??[],runningStepIndex:n?.runningStepIndex??null,perTestSetupHooks:n?.perTestSetupHooks??[],perTestTeardownHooks:n?.perTestTeardownHooks??[],lastRunAt:n?.lastRunAt}}function nt(e,t){let n=e.findIndex(e=>e.testExecutionId===t.testExecutionId);if(n!==-1)return n;let r=e.findIndex(e=>e.testId===t.testId&&e.name===t.testName);return r===-1?t.testIndex>=0&&t.testIndex<e.length?t.testIndex:-1:r}function Q(e,t,n){let r=nt(e,t);return r===-1?e:e.map((e,t)=>t===r?n(e):e)}function $(e){return e.scope===`test`}function rt(e,t={}){let n=t.steps,r=t.tests,i=t.setupHooks??[],a=t.teardownHooks??[],o=t.allowReconnect??!n,[s,c]=(0,V.useState)(`idle`),[ee,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(()=>et([],i,`setup`)),[te,ne]=(0,V.useState)(()=>et([],a,`teardown`)),[f,re]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[ie,_]=(0,V.useState)(null),[ae,v]=(0,V.useState)(null),[oe,se]=(0,V.useState)([]),[y,ce]=(0,V.useState)(`web`),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),[le,ue]=(0,V.useState)(!1),[de,w]=(0,V.useState)([]),[fe,pe]=(0,V.useState)(null),[T,E]=(0,V.useState)(!1),[me,he]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(0),ge=(0,V.useRef)(null),_e=(0,V.useRef)(null),k=(0,V.useRef)(`idle`),A=(0,V.useRef)([]),j=(0,V.useRef)(null),ve=(0,V.useRef)(!1),M=(0,V.useRef)(null),N=(0,V.useRef)(null),ye=(0,V.useRef)(!1),be=(0,V.useRef)(0),P=(0,V.useRef)(`web`),xe=(0,V.useRef)(null),F=(0,V.useRef)(!!n),I=(0,V.useRef)(null),L=(0,V.useRef)([]),Se=(0,V.useRef)(null),Ce=(0,V.useRef)(!1),we=(0,V.useRef)(null);k.current=s,A.current=ee,j.current=ae,P.current=y,F.current=!!n,L.current=de,Se.current=fe;let R=(0,V.useCallback)(()=>{_e.current&&=(clearInterval(_e.current),null)},[]),z=(0,V.useCallback)(e=>{let t=D.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),B=(0,V.useCallback)(e=>{R(),_e.current=setInterval(()=>{document.hidden||z({type:`get-screenshot`})},e)},[R,z]),Te=(0,V.useCallback)(()=>new Promise(e=>{N.current=e,setTimeout(()=>{N.current===e&&(N.current=null,e())},5e3)}),[]),H=(0,V.useCallback)(()=>{let e=xe.current;e&&(xe.current=null,l(t=>$e(t,e)))},[]),Ee=(0,V.useCallback)(e=>{D.current&&=(J(`hook`,`closing previous websocket before reconnect`,{sessionId:e}),D.current.close(),null),c(`connecting`),ve.current=!1,J(`hook`,`connecting websocket`,{sessionId:e});let t=`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}/api/live-editor/ws?sessionId=${e}`,n=new WebSocket(t);D.current=n,n.onopen=()=>{O.current=0,J(`hook`,`websocket opened`,{sessionId:e})},n.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}switch(n.type){case`session-ready`:{let t=n.platform??`web`;ce(t),P.current=t;let r=n.interactive!==!1;c(r?`connected`:`error`),_(n.error??null),J(`hook`,`session ready`,{sessionId:e,platform:t,interactive:r}),r&&B(t===`web`?1e3:2e3);break}case`hook-start`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0,createdAt:e.createdAt};if(e.owner.scope===`suite`)(e.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===e.phase&&I.current.hookId===e.hookId&&(I.current={...I.current,executionId:e.executionId});else if($(e.owner)){let n=e.owner;w(r=>Q(r,n,n=>({...n,perTestSetupHooks:e.phase===`setup`?X(n.perTestSetupHooks,t):n.perTestSetupHooks,perTestTeardownHooks:e.phase===`teardown`?X(n.perTestTeardownHooks,t):n.perTestTeardownHooks})))}break}case`hook-complete`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt};if(e.owner.scope===`suite`)(t.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===t.phase&&I.current.hookId===t.id&&(!I.current.executionId||I.current.executionId===t.executionId)&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H());else if($(e.owner)){let n=e.owner;w(e=>Q(e,n,e=>({...e,perTestSetupHooks:t.phase===`setup`?X(e.perTestSetupHooks,t):e.perTestSetupHooks,perTestTeardownHooks:t.phase===`teardown`?X(e.perTestTeardownHooks,t):e.perTestTeardownHooks})))}break}case`step-phase`:l(e=>e.map((e,t)=>t===j.current&&e.status===`running`&&e.executionGeneration===be.current?{...e,phases:[...e.phases,{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]}:e));break;case`step-complete`:{let t=n.result,r=j.current,i=t?.status===`passed`?`passed`:`failed`;l(e=>e.map((e,n)=>n===r&&e.status===`running`?{...e,status:i,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]}:e)),v(null),c(`connected`),J(`hook`,`step completed`,{sessionId:e,stepIndex:r??void 0,status:i}),B(P.current===`web`?1e3:2e3),M.current?.({status:i}),M.current=null,N.current?.(),N.current=null,H();break}case`test-start`:{let e=n.test;Se.current=e.testIndex,pe(e.testIndex),w(t=>Q(t,e,t=>({...t,status:`running`,duration:void 0,error:void 0,testExecutionId:e.testExecutionId,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]})));break}case`test-step-start`:{let e=n.step;w(t=>Q(t,e,t=>({...t,status:`running`,testExecutionId:e.testExecutionId,runningStepIndex:e.stepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,duration:void 0,error:void 0,phases:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[]})})));break}case`test-step-phase`:{let e=n.step;w(t=>Q(t,e,t=>({...t,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,phases:[...t.liveSteps.find(t=>t.stepIndex===e.stepIndex)?.phases??[],{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]})})));break}case`test-step-complete`:{let e=n.step,t=n.result;w(n=>Q(n,e,n=>({...n,runningStepIndex:n.runningStepIndex===e.stepIndex?null:n.runningStepIndex,liveSteps:Z(n.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:t?.status??`failed`,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]})})));break}case`test-step-cancelled`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`cancelled`})})));break}case`test-step-error`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`failed`,error:n.error})})));break}case`test-complete`:{let e=n.test,t=n.result,r=t?.status??`failed`,i=t?.error;if(!i&&r===`failed`&&Array.isArray(t?.stepResults)){let e=t.stepResults.find(e=>e?.status===`failed`);e?.error&&(i=`Step ${t.stepResults.indexOf(e)+1} failed: ${e.error}`)}w(n=>Q(n,e,n=>({...n,status:r,duration:t?.duration,error:i,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString(),liveSteps:Array.isArray(t?.stepResults)?t.stepResults.reduce((e,t,r)=>{let i=n.liveSteps.find(e=>e.stepIndex===r);return i?Z(e,{stepIndex:r,instruction:i.instruction},{status:t?.status??i.status,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??i.consoleLogs,networkLogs:t?.networkLogs??i.networkLogs,variableSnapshot:t?.variableSnapshot??i.variableSnapshot,originalStepName:t?.originalStepName??i.originalStepName,subActionsData:t?.subActionsData??i.subActionsData,executionLogs:t?.executionLogs??i.executionLogs}):e},n.liveSteps):n.liveSteps,perTestSetupHooks:Array.isArray(t?.setupHookExecutions)?t.setupHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestSetupHooks,perTestTeardownHooks:Array.isArray(t?.teardownHookExecutions)?t.teardownHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestTeardownHooks}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let a=we.current;we.current=null,a?.({status:r});break}case`test-error`:{let e=n.test;w(t=>Q(t,e,t=>({...t,status:`failed`,error:n.error,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString()}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let t=we.current;we.current=null,t?.({status:`failed`});break}case`step-error`:J(`hook`,`step failed`,{sessionId:e,stepIndex:j.current??void 0,error:n.error}),l(e=>e.map((e,t)=>t===j.current?e.status===`cancelling`?{...e,status:`cancelled`}:e.status===`running`?{...e,status:`failed`,error:n.error}:e:e)),v(null),c(`connected`),B(P.current===`web`?1e3:2e3),M.current?.({status:`failed`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-cancelled`:l(e=>e.map((e,t)=>t===j.current&&(e.status===`running`||e.status===`cancelling`)?{...e,status:`cancelled`}:e)),v(null),c(`connected`),J(`hook`,`step cancelled`,{sessionId:e,stepIndex:j.current??void 0}),B(P.current===`web`?1e3:2e3),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-busy`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3)),_(`Step already in progress: ${n.currentStep}`);break;case`screenshot`:re(`data:image/jpeg;base64,${n.data}`);break;case`navigate-complete`:m(n.url??null),g(null);break;case`session-state`:n.state&&`currentUrl`in n.state&&m(n.state.currentUrl??null),n.state?.interactive===!1&&(c(`error`),_(n.state.terminalError??`Live session is not ready`));break;case`device-logs`:se(e=>[...e,...n.entries]);break;case`aria-tree`:x(n.tree);break;case`session-terminated`:c(`disconnected`),g(null),I.current=null,R(),H(),J(`hook`,`session terminated by server`,{sessionId:e});break;case`error`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H()),_(n.message),J(`hook`,`server reported error`,{sessionId:e,message:n.message});break}},n.onclose=()=>{if(D.current=null,R(),ve.current){J(`hook`,`websocket closed after local termination`,{sessionId:e});return}if(J(`hook`,`websocket closed unexpectedly`,{sessionId:e,allowReconnect:o,reconnectCount:O.current}),c(`disconnected`),g(null),I.current=null,l(e=>e.map(e=>e.status===`running`||e.status===`cancelling`?{...e,status:`cancelled`}:e)),j.current=null,v(null),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H(),o&&O.current<3){let t=2**O.current*1e3;O.current++,J(`hook`,`scheduling reconnect`,{sessionId:e,delay:t,reconnectCount:O.current}),ge.current=setTimeout(()=>Ee(e),t)}},n.onerror=()=>{J(`hook`,`websocket error event`,{sessionId:e})}},[o,H,R,B]);(0,V.useEffect)(()=>{if(n){if(k.current===`executing`){xe.current=n,J(`hook`,`queued external step sync while executing`,{stepCount:n.length});return}xe.current=null,J(`hook`,`syncing external steps`,{stepCount:n.length}),l(e=>$e(e,n))}},[n]),(0,V.useEffect)(()=>{d(e=>et(e,i,`setup`))},[i]),(0,V.useEffect)(()=>{ne(e=>et(e,a,`teardown`))},[a]),(0,V.useEffect)(()=>{r&&w(e=>{let t=new Map(e.map(e=>[`${e.testId}::${e.path}`,e]));return r.map((e,n)=>tt(e,n,t.get(`${e.testId}::${e.path}`)))})},[r]),(0,V.useEffect)(()=>{if(!e){c(`idle`),l(n?$e([],n):[]),d(et([],i,`setup`)),ne(et([],a,`teardown`)),re(null),m(null),g(null),_(null),I.current=null,se([]),ce(`web`),x(null),C(!1),ue(!1),w(r?.map((e,t)=>tt(e,t))??[]),pe(null),E(!1),he(!1);return}return Ee(e),()=>{R(),ge.current&&=(clearTimeout(ge.current),null),D.current&&=(J(`hook`,`cleaning up websocket for session effect`,{sessionId:e}),D.current.close(),null)}},[R,Ee,e]),(0,V.useEffect)(()=>{s===`executing`?B(y===`web`?500:1e3):s===`connected`?B(y===`web`?1e3:2e3):R()},[s,y,B,R]),(0,V.useEffect)(()=>{let e=()=>{if(document.hidden)R();else{let e=k.current,t=P.current;e===`executing`?B(t===`web`?500:1e3):e===`connected`&&B(t===`web`?1e3:2e3)}};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[R,B]);let De=(0,V.useCallback)(e=>{if(F.current)return;let t=A.current.length;l(t=>[...t,{id:crypto.randomUUID(),draftId:null,instruction:e,status:`running`,phases:[],executionHistory:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:0}]),v(t),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:e,stepIndex:t})},[z]),Oe=(0,V.useCallback)(async(t,n)=>{let r=A.current[t];if(!r||!r.instruction.trim())return;if(j.current!==null){let e=j.current;ye.current=!0,l(t=>t.map((t,n)=>n===e&&t.status===`running`?{...t,status:`cancelling`}:t)),z({type:`cancel-step`}),await Te()}be.current++;let i=be.current;j.current=t,v(t),l(e=>e.map((e,n)=>n===t?{...e,status:`running`,phases:[],executionHistory:e.phases.length>0?[...e.executionHistory,{phases:e.phases,status:e.status,duration:e.duration,error:e.error,timestamp:new Date().toISOString()}]:e.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:e)),c(`executing`),_(null),J(`hook`,`executing step`,{sessionId:e,stepIndex:t,instruction:r.instruction,testName:n?.testName}),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:t,draft:n})},[z,e,Te]),ke=(0,V.useCallback)(async(t,n)=>{if(k.current!==`connected`){_(`Live session is busy or not ready`);return}I.current={phase:t,hookId:n},(t===`setup`?d:ne)(e=>e.map(e=>e.id===n?{...e,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0}:e)),c(`executing`),_(null),J(`hook`,`executing hook`,{sessionId:e,phase:t,hookId:n}),z({type:`execute-hook`,phase:t,hookId:n})},[z,e]),Ae=(0,V.useCallback)(()=>{F.current||l(e=>[...e,Y(``)])},[]),U=(0,V.useCallback)(e=>{F.current||l(t=>t.filter((t,n)=>n!==e))},[]),je=(0,V.useCallback)((e,t)=>{F.current||l(n=>n.map((n,r)=>r===e?{...n,instruction:t}:n))},[]),W=(0,V.useCallback)((e,t)=>{if(F.current)return;l(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r});let n=j.current;if(n!==null){let r=n;n===e?r=t:e<n&&t>=n?r=n-1:e>n&&t<=n&&(r=n+1),r!==n&&(j.current=r,v(r))}},[]),Me=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0)),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),J(`hook`,`cancelling active step`,{sessionId:e}),z({type:`cancel-step`})},[S,z,e]),G=(0,V.useCallback)(()=>{z({type:`get-screenshot`})},[z]),Ne=(0,V.useCallback)(()=>{g({action:`refresh`}),z({type:`refresh-page`})},[z]),Pe=(0,V.useCallback)(()=>{g({action:`back`}),z({type:`go-back`})},[z]),Fe=(0,V.useCallback)(()=>{g({action:`forward`}),z({type:`go-forward`})},[z]),K=(0,V.useCallback)(()=>{z({type:`get-aria-tree`})},[z]),Ie=(0,V.useCallback)(e=>{g({action:`navigate`,targetUrl:e}),z({type:`navigate`,url:e})},[z]),Le=(0,V.useCallback)((e,t)=>new Promise(n=>{M.current=n;let r=A.current[e];if(!r||!r.instruction.trim()){M.current=null,n({status:`skipped`});return}be.current++;let i=be.current;j.current=e,v(e),l(t=>t.map((t,n)=>n===e?{...t,status:`running`,phases:[],executionHistory:t.phases.length>0?[...t.executionHistory,{phases:t.phases,status:t.status,duration:t.duration,error:t.error,timestamp:new Date().toISOString()}]:t.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:t)),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:e,draft:t})}),[z]),Re=(0,V.useCallback)(async t=>{if(S)return;ye.current=!1;let n=A.current.length;C(!0),ue(!1),J(`hook`,`running all steps`,{sessionId:e,stepCount:n});try{for(let e=0;e<n&&!ye.current;e++){if(!A.current[e].instruction.trim())continue;let n=await Le(e,t);if(n.status===`failed`||n.status===`cancelled`)break}}finally{ye.current=!1,C(!1),ue(!1)}},[Le,S,e]),ze=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),j.current!==null&&z({type:`cancel-step`}))},[S,z]),Be=(0,V.useCallback)((e,t)=>new Promise(n=>{we.current=n;let r=L.current[e];if(!r){we.current=null,n({status:`skipped`});return}let i=crypto.randomUUID();Se.current=e,pe(e),w(t=>t.map((t,n)=>n===e?{...t,status:`running`,duration:void 0,error:void 0,testExecutionId:i,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]}:t)),c(`executing`),_(null),z({type:`execute-test`,testExecutionId:i,testId:r.testId,path:r.path,testIndex:e,draft:t})}),[z]),Ve=(0,V.useCallback)(async(e,t)=>{L.current[e]&&await Be(e,t)},[Be]),He=(0,V.useCallback)(async e=>{if(T)return;Ce.current=!1;let t=L.current.length;E(!0),he(!1);try{for(let n=0;n<t&&!Ce.current;n++){let t=await Be(n,e);if(t.status===`failed`||t.status===`cancelled`)break}}finally{Ce.current=!1,E(!1),he(!1)}},[Be,T]),Ue=(0,V.useCallback)(()=>{T&&(Ce.current=!0,he(!0),Se.current!==null&&z({type:`cancel-step`}))},[T,z]);return{connectionState:s,steps:ee,setupHooks:u,teardownHooks:te,screenshot:f,currentUrl:p,pendingNavigation:h,error:ie,executeStep:De,executeStepByIndex:Oe,executeHookById:ke,cancelStep:Me,requestScreenshot:G,refreshPage:Ne,goBack:Pe,goForward:Fe,navigate:Ie,runAll:Re,cancelRunAll:ze,terminateSession:(0,V.useCallback)(()=>{ye.current=!0,C(!1),ue(!1),ve.current=!0,J(`hook`,`terminating session`,{sessionId:e}),z({type:`terminate-session`})},[z,e]),addStep:Ae,removeStep:U,updateStepInstruction:je,reorderSteps:W,runningStepIndex:ae,runningStepId:ae===null?null:ee[ae]?.id??null,sessionId:e,isTerminated:ve.current,deviceLogs:oe,platform:y,ariaTree:b,requestAriaTree:K,isRunningAll:S,isStoppingRunAll:le,tests:de,executeTestByIndex:Ve,runAllTests:He,cancelRunAllTests:Ue,runningTestIndex:fe,isRunningAllTests:T,isStoppingRunAllTests:me}}function it(e){try{let t=m(e);if(t.errors.length>0)return{};let n=t.toJSON(),r=n?.use?.mobile?.appState;return{headless:n?.use?.browser?.headless,device:typeof n?.use?.device==`string`?n.use.device:void 0,appState:r===`preserve`||r===`reset`?r:void 0}}catch{return{}}}function at(e){let t=e.targets[e.targetName];if(!t)throw Error(`Selected target "${e.targetName}" was not found in workspace config`);let n=it(e.content),r=n.headless??e.globalUse?.browser?.headless;if(t.platform===`web`){if(!t.url)throw Error(`Selected web target "${e.targetName}" is missing a URL`);return{platform:`web`,url:t.url,headless:r}}return{platform:t.platform,targetName:e.targetName,useDeviceName:n.device,appState:n.appState??e.globalUse?.mobile?.appState,bundleId:t.bundleId,appPackage:t.appPackage,appActivity:t.appActivity,headless:r}}var ot=[{namespace:`runJS`,name:`document.title`,label:`Page title`},{namespace:`runJS`,name:`Date.now()`,label:`Current timestamp`},{namespace:`runJS`,name:`window.location.href`,label:`Current URL`},{namespace:`runJS`,name:`document.querySelector('...').textContent`,label:`Extract element text`}];function st(e){let[t,n]=(0,V.useState)([]),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let t=!1;c(!0);let r=[T().then(e=>{t||n(e.keys)}).catch(()=>{t||n([])}),j().then(e=>{t||i(e.hooks.map(e=>({id:e.id,name:e.name})))}).catch(()=>{t||i([])})];return e&&r.push(w(e).then(e=>{t||o(e.names)}).catch(()=>{t||o([])})),Promise.allSettled(r).then(()=>{t||c(!1)}),()=>{t=!0}},[e]),{suggestions:(0,V.useMemo)(()=>{let e=[];for(let n of t)e.push({namespace:`env`,name:n,label:`env`});for(let t of r)e.push({namespace:`runHook`,name:t.name,label:`hook`,insertValue:t.id,description:t.id});for(let t of a)e.push({namespace:`capture`,name:t,label:`captured`});return e.push(...ot),e},[t,r,a]),isLoading:s}}var ct=/^[a-zA-Z0-9._-]+$/,lt=/\.(yaml|yml)$/;function ut(e){return e.trim().replace(/\\/g,`/`).replace(/^\.\//,``)}function dt(e){let t=ut(e).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replace(/\*\*\//g,`__DIRSTAR__`).replace(/\*\*/g,`__DIRSTAR__`).replace(/\*/g,`[^/]*`).replace(/__DIRSTAR__/g,`(?:.*/)?`);return RegExp(`^${t}$`)}function ft(e,t){let n=ut(e);return t.some(e=>dt(e).test(n))}function pt(e){let t=e.trim();if(!t)return`Filename is required`;if(t.includes(`..`))return`Path must not contain '..' segments`;if(t.startsWith(`/`))return`Path must be relative, not absolute`;let n=t.split(`/`);for(let e of n){if(!e)return`Path contains empty segment (double slash)`;if(!ct.test(e))return`Path must contain only letters, numbers, hyphens, dots, underscores, and forward slashes, ending with .yaml or .yml`}let r=n[n.length-1];return lt.test(r)?null:`File must end with .yaml or .yml`}function mt(e,t,n){let r=pt(e);if(r)return r;let i=(t??[]).map(e=>e.trim()).filter(Boolean);return i.length===0?`workspace.${n} must contain at least one pattern`:ft(e.trim(),i)?null:`File path must match one of your workspace's ${n} patterns (${i.join(`, `)})`}export{J as a,Ne as c,rt as i,st as n,q as o,at as r,Pe as s,mt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Jn as e}from"./index-CZotRLCc.js";var t=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as ee,t as te}from"./select-B5gV6YUf.js";import{t as ne}from"./monaco-editor-CDJrOpKK.js";import{t as re}from"./refresh-cw-v_0wwa0P.js";import{t as ie}from"./use-page-title-CK82kWb2.js";import{a as i,t as a}from"./dist-DFSjTjXY.js";import{t as ae}from"./scroll-area-DfPMtFw0.js";import{t as oe}from"./switch-BOdp7A9U.js";import{A as se,Ct as ce,Ht as le,Jt as ue,Pn as de,Qn as o,S as s,T as fe,Ut as c,Vt as l,W as pe,Zn as u,cr as me,fr as d,r as he,sr as ge}from"./index-B3xPCIyH.js";import{i as _e,n as f,r as ve,t as ye}from"./hook-runtime-ChJ0-jZo.js";import{a as be,i as xe,n as Se,o as Ce,r as we,t as Te}from"./use-hook-run-session-Cjqu9VED.js";import{t as Ee}from"./empty-state-Dluv5C1Q.js";var p=e(d(),1),m=u();function De({title:e,body:t,tone:n=`warning`,children:r}){return(0,m.jsxs)(`div`,{className:`rounded-sm border px-4 py-3 text-sm ${n===`error`?`border-destructive/30 bg-destructive/10`:n===`neutral`?`border-border bg-muted/40`:`border-amber-500/30 bg-amber-500/10`}`,children:[(0,m.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t}),r?(0,m.jsx)(`div`,{className:`mt-3`,children:r}):null]})}function Oe(e){if(e===0)return`0ms`;for(let t of[{suffix:`d`,value:864e5},{suffix:`h`,value:36e5},{suffix:`m`,value:6e4},{suffix:`s`,value:1e3}])if(e%t.value===0)return`${e/t.value}${t.suffix}`;return`${e}ms`}function h(e){return JSON.stringify({name:e.name,runtime:e.runtime,file:e.file,timeout:e.timeout,network:e.network,source:e.source})}function g(e,t){return e.find(e=>e.field===t)??null}function ke(e){return Array.isArray(e)}function Ae(e){switch(e){case`javascript`:return`JavaScript`;case`typescript`:return`TypeScript`;case`python`:return`Python`;case`shell`:return`Shell`;default:return e}}function _(){let{id:e}=me(),u=ge(),d=ue(),_=!e,v=e??``,y=(0,p.useMemo)(()=>f(`node`),[]),b=(0,p.useRef)(_?a():v),[x,S]=(0,p.useState)(b.current),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(`node`),[D,O]=(0,p.useState)(y.file),[k,A]=(0,p.useState)(`30s`),[j,M]=(0,p.useState)(!0),[N,P]=(0,p.useState)(y.source),[F,I]=(0,p.useState)([]),[je,L]=(0,p.useState)(!_),[Me,R]=(0,p.useState)(!1),[Ne,Pe]=(0,p.useState)(!1),[Fe,z]=(0,p.useState)(null),[Ie,B]=(0,p.useState)([]),[Le,V]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(!1),[He,Ue]=(0,p.useState)(()=>h({name:``,runtime:`node`,file:y.file,timeout:`30s`,network:!0,source:y.source})),H=(0,p.useRef)(y.file),U=(0,p.useRef)(y.source);ie(_?`New Hook`:C.trim()||`Hook`);let W=h({name:C,runtime:T,file:D,timeout:k,network:j,source:N})!==He,We=F.find(e=>e.code===`file_missing`)??null,G=Te({hookId:x}),K=_e(T),Ge=Ae(K),q=(0,p.useMemo)(()=>_||!x||W?`Save this hook to run the latest changes.`:F.length>0?F.map(e=>e.message).join(` `):null,[F,x,_,W]);(0,p.useEffect)(()=>{if(_){S(b.current),R(!1);return}let e=!1;return L(!0),pe(v).then(t=>{if(e)return;let n=Oe(t.hook.timeout),r=t.source??``;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),z(null),V(null),B([]),R(!1),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r}).catch(t=>{if(!e){if(t instanceof s&&t.status===404){R(!0);return}z(t instanceof Error?t.message:`Failed to load hook`)}}).finally(()=>{e||L(!1)}),()=>{e=!0}},[_,v]);function Ke(e){if(_){let t=f(e,C);(D===H.current||!D.trim())&&O(t.file),(N===U.current||!N.trim())&&P(t.source),H.current=t.file,U.current=t.source}E(e)}function qe(e){if(w(e),!_)return;let t=f(T,e);(D===H.current||!D.trim())&&O(t.file),H.current=t.file}function Je(){if(!_)return;let e=a();b.current=e,S(e)}async function Ye(){Pe(!0),z(null),V(null),B([]);let e={hook:{id:x,name:C.trim(),runtime:T,file:D.trim(),timeout:k.trim(),network:j},source:N};try{let t=_?await fe(e):await ce(x,e),n=Oe(t.hook.timeout),r=t.source??N;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r,_&&u(o.hookEdit(t.hook.id),{replace:!0})}catch(e){if(e instanceof s){let t=e.payload?.error,n=e.payload?.fieldErrors;t===`validation_failed`&&ke(n)?(I(n),z(`Couldn't save this hook. Fix the highlighted issues and try again.`)):z(e.message)}else z(e instanceof Error?e.message:`Failed to save hook`)}finally{Pe(!1)}}async function Xe(e=!1){if(!(_||!x)){ze(!0),V(null);try{await se(x,{force:e}),u(o.hooks)}catch(e){if(e instanceof s){let t=e.payload?.error,n=e.payload?.references;if(t===`hook_in_use`&&Array.isArray(n)){B(n);return}V(e.message)}else V(e instanceof Error?e.message:`Failed to delete hook`)}finally{ze(!1)}}}function Ze(){V(null),B([]),Ve(!0)}function Qe(e){Ve(e),e||(V(null),B([]))}async function $e(){q||await G.submitRun()}if(je)return(0,m.jsx)(he,{});if(Me)return(0,m.jsx)(Ee,{icon:de,title:`Hook not found`,description:`This hook doesn't exist or could not be loaded.`,actionLabel:`View All Hooks`,onAction:()=>u(o.hooks)});let J=g(F,`name`),Y=g(F,`runtime`),X=g(F,`file`),Z=g(F,`timeout`),Q=g(F,`network`),$=(0,m.jsxs)(`div`,{className:c(`p-3`,d?`space-y-3`:`flex h-full min-h-0 flex-col gap-3 overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`space-y-3 shrink-0`,children:[Fe?(0,m.jsx)(De,{title:`Couldn't save this hook.`,body:Fe,tone:`error`}):null,We?(0,m.jsx)(De,{title:`Hook file missing`,body:`This hook is still registered, but its source file can't be found. Update the path or recreate the file, then save again.`}):null,(0,m.jsxs)(`section`,{className:`space-y-3`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-name`,children:`Hook name`}),(0,m.jsx)(l,{id:`hook-name`,value:C,onChange:e=>qe(e.currentTarget.value),placeholder:`Capture auth session`,"aria-invalid":!!J}),J?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:J.message}):null]}),_?(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-id`,children:`Hook ID`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(l,{id:`hook-id`,value:x,readOnly:!0,disabled:!0,"aria-label":`Hook ID`}),(0,m.jsx)(le,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:Je,"aria-label":`Generate new hook ID`,children:(0,m.jsx)(re,{className:`size-3.5`})})]})]}):null,(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-file`,children:`File path`}),(0,m.jsx)(l,{id:`hook-file`,value:D,onChange:e=>O(e.currentTarget.value),placeholder:`./hooks/login.js`,"aria-invalid":!!X}),X?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:X.message}):null]}),(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_minmax(0,0.8fr)]`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-runtime`,children:`Runtime`}),(0,m.jsxs)(te,{value:T,onValueChange:e=>Ke(e),children:[(0,m.jsx)(r,{id:`hook-runtime`,"aria-invalid":!!Y,children:(0,m.jsx)(ee,{placeholder:`Runtime`})}),(0,m.jsx)(n,{children:ye.map(e=>(0,m.jsx)(t,{value:e,children:ve(e).label},e))})]}),Y?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Y.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-timeout`,children:`Timeout`}),(0,m.jsx)(l,{id:`hook-timeout`,value:k,onChange:e=>A(e.currentTarget.value),placeholder:`5s`,"aria-invalid":!!Z}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Examples: 5s, 10m, 250ms`}),Z?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Z.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-network`,children:`Network`}),(0,m.jsxs)(`div`,{className:`flex h-10 items-center justify-between rounded-sm border bg-background/70 px-3`,children:[(0,m.jsx)(`span`,{className:`text-sm text-foreground`,children:j?`Enabled`:`Disabled`}),(0,m.jsx)(oe,{id:`hook-network`,checked:j,onCheckedChange:M,"aria-invalid":!!Q})]}),Q?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Q.message}):null]})]})]})]}),(0,m.jsxs)(`section`,{className:c(`space-y-2`,d?``:`flex min-h-[300px] flex-1 flex-col overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Source`}),(0,m.jsx)(`span`,{className:`rounded-sm border px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Ge})]}),(0,m.jsx)(ne,{value:N,onChange:P,onSave:Ye,language:K,className:c(`rounded-sm`,d?`h-[360px] min-h-[320px]`:`h-full min-h-[300px] flex-1`)})]})]}),et=d?(0,m.jsx)(ae,{className:`h-full`,children:$}):$,tt=(0,m.jsx)(we,{baselineCount:G.baselineVariables.length,baselineFilePath:G.baselineFilePath,baselineInfo:G.baselineInfo,isBaselineLoading:G.isBaselineLoading,overrideRows:G.overrideRows,overridingRowIds:G.overridingRowIds,recentRuns:G.recentRuns,selectedRunId:G.selectedRunId,isRunning:G.isRunning,runDisabledReason:q,runError:G.runError,onAddOverride:()=>G.addOverrideRow(),onUpdateOverride:G.updateOverrideRow,onRemoveOverride:G.removeOverrideRow,onRun:()=>{$e()},onSelectRun:G.selectRun}),nt=(0,m.jsx)(xe,{selectedRun:G.selectedRun});return(0,m.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,m.jsx)(be,{hookName:C.trim()||`New Hook`,isCreateMode:_,mode:`edit`,hookHref:_?void 0:o.hookView(x),editHref:_?void 0:o.hookEdit(x),unsaved:W,isSaving:Ne,isRunning:G.isRunning,isDeleting:Re,onSave:Ye,onRun:_?void 0:()=>{$e()},runDisabled:!!q,onDelete:_?void 0:Ze}),(0,m.jsx)(Se,{isMobile:d,leftPane:et,rightTopPane:tt,rightBottomPane:nt}),_?null:(0,m.jsx)(Ce,{open:Be,onOpenChange:Qe,hook:{id:x,name:C.trim()||`Hook`,runtime:T,file:D},isDeleting:Re,deleteError:Le,blockedReferences:Ie,onDelete:()=>{Xe(!1)},onForceDelete:()=>{Xe(!0)}})]})}export{_ as default};
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as ee,t as te}from"./select-B2_tSMl_.js";import{t as ne}from"./monaco-editor-Ba9qdSve.js";import{t as re}from"./refresh-cw-3zJOKpgR.js";import{t as ie}from"./use-page-title-BeSr97vd.js";import{a as i,t as a}from"./dist-DrO-WGvP.js";import{t as ae}from"./scroll-area-48uajHeh.js";import{t as oe}from"./switch-C7U17ptQ.js";import{$n as o,A as se,Fn as ce,G as le,Ht as s,Qn as c,S as l,T as ue,Ut as de,Wt as u,Yt as fe,cr as pe,lr as me,pr as d,r as he,wt as ge}from"./index-CZotRLCc.js";import{i as _e,n as f,r as ve,t as ye}from"./hook-runtime-CPPjqz70.js";import{a as be,i as xe,n as Se,o as Ce,r as we,t as Te}from"./use-hook-run-session-RvECpdZN.js";import{t as Ee}from"./empty-state-c1UKljbh.js";var p=e(d(),1),m=c();function De({title:e,body:t,tone:n=`warning`,children:r}){return(0,m.jsxs)(`div`,{className:`rounded-sm border px-4 py-3 text-sm ${n===`error`?`border-destructive/30 bg-destructive/10`:n===`neutral`?`border-border bg-muted/40`:`border-amber-500/30 bg-amber-500/10`}`,children:[(0,m.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t}),r?(0,m.jsx)(`div`,{className:`mt-3`,children:r}):null]})}function Oe(e){if(e===0)return`0ms`;for(let t of[{suffix:`d`,value:864e5},{suffix:`h`,value:36e5},{suffix:`m`,value:6e4},{suffix:`s`,value:1e3}])if(e%t.value===0)return`${e/t.value}${t.suffix}`;return`${e}ms`}function h(e){return JSON.stringify({name:e.name,runtime:e.runtime,file:e.file,timeout:e.timeout,network:e.network,source:e.source})}function g(e,t){return e.find(e=>e.field===t)??null}function ke(e){return Array.isArray(e)}function Ae(e){switch(e){case`javascript`:return`JavaScript`;case`typescript`:return`TypeScript`;case`python`:return`Python`;case`shell`:return`Shell`;default:return e}}function _(){let{id:e}=me(),c=pe(),d=fe(),_=!e,v=e??``,y=(0,p.useMemo)(()=>f(`node`),[]),b=(0,p.useRef)(_?a():v),[x,S]=(0,p.useState)(b.current),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(`node`),[D,O]=(0,p.useState)(y.file),[k,A]=(0,p.useState)(`30s`),[j,M]=(0,p.useState)(!0),[N,P]=(0,p.useState)(y.source),[F,I]=(0,p.useState)([]),[je,L]=(0,p.useState)(!_),[Me,R]=(0,p.useState)(!1),[Ne,Pe]=(0,p.useState)(!1),[Fe,z]=(0,p.useState)(null),[Ie,B]=(0,p.useState)([]),[Le,V]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(!1),[He,Ue]=(0,p.useState)(()=>h({name:``,runtime:`node`,file:y.file,timeout:`30s`,network:!0,source:y.source})),H=(0,p.useRef)(y.file),U=(0,p.useRef)(y.source);ie(_?`New Hook`:C.trim()||`Hook`);let W=h({name:C,runtime:T,file:D,timeout:k,network:j,source:N})!==He,We=F.find(e=>e.code===`file_missing`)??null,G=Te({hookId:x}),K=_e(T),Ge=Ae(K),q=(0,p.useMemo)(()=>_||!x||W?`Save this hook to run the latest changes.`:F.length>0?F.map(e=>e.message).join(` `):null,[F,x,_,W]);(0,p.useEffect)(()=>{if(_){S(b.current),R(!1);return}let e=!1;return L(!0),le(v).then(t=>{if(e)return;let n=Oe(t.hook.timeout),r=t.source??``;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),z(null),V(null),B([]),R(!1),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r}).catch(t=>{if(!e){if(t instanceof l&&t.status===404){R(!0);return}z(t instanceof Error?t.message:`Failed to load hook`)}}).finally(()=>{e||L(!1)}),()=>{e=!0}},[_,v]);function Ke(e){if(_){let t=f(e,C);(D===H.current||!D.trim())&&O(t.file),(N===U.current||!N.trim())&&P(t.source),H.current=t.file,U.current=t.source}E(e)}function qe(e){if(w(e),!_)return;let t=f(T,e);(D===H.current||!D.trim())&&O(t.file),H.current=t.file}function Je(){if(!_)return;let e=a();b.current=e,S(e)}async function Ye(){Pe(!0),z(null),V(null),B([]);let e={hook:{id:x,name:C.trim(),runtime:T,file:D.trim(),timeout:k.trim(),network:j},source:N};try{let t=_?await ue(e):await ge(x,e),n=Oe(t.hook.timeout),r=t.source??N;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r,_&&c(o.hookEdit(t.hook.id),{replace:!0})}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.fieldErrors;t===`validation_failed`&&ke(n)?(I(n),z(`Couldn't save this hook. Fix the highlighted issues and try again.`)):z(e.message)}else z(e instanceof Error?e.message:`Failed to save hook`)}finally{Pe(!1)}}async function Xe(e=!1){if(!(_||!x)){ze(!0),V(null);try{await se(x,{force:e}),c(o.hooks)}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.references;if(t===`hook_in_use`&&Array.isArray(n)){B(n);return}V(e.message)}else V(e instanceof Error?e.message:`Failed to delete hook`)}finally{ze(!1)}}}function Ze(){V(null),B([]),Ve(!0)}function Qe(e){Ve(e),e||(V(null),B([]))}async function $e(){q||await G.submitRun()}if(je)return(0,m.jsx)(he,{});if(Me)return(0,m.jsx)(Ee,{icon:ce,title:`Hook not found`,description:`This hook doesn't exist or could not be loaded.`,actionLabel:`View All Hooks`,onAction:()=>c(o.hooks)});let J=g(F,`name`),Y=g(F,`runtime`),X=g(F,`file`),Z=g(F,`timeout`),Q=g(F,`network`),$=(0,m.jsxs)(`div`,{className:u(`p-3`,d?`space-y-3`:`flex h-full min-h-0 flex-col gap-3 overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`space-y-3 shrink-0`,children:[Fe?(0,m.jsx)(De,{title:`Couldn't save this hook.`,body:Fe,tone:`error`}):null,We?(0,m.jsx)(De,{title:`Hook file missing`,body:`This hook is still registered, but its source file can't be found. Update the path or recreate the file, then save again.`}):null,(0,m.jsxs)(`section`,{className:`space-y-3`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-name`,children:`Hook name`}),(0,m.jsx)(s,{id:`hook-name`,value:C,onChange:e=>qe(e.currentTarget.value),placeholder:`Capture auth session`,"aria-invalid":!!J}),J?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:J.message}):null]}),_?(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-id`,children:`Hook ID`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(s,{id:`hook-id`,value:x,readOnly:!0,disabled:!0,"aria-label":`Hook ID`}),(0,m.jsx)(de,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:Je,"aria-label":`Generate new hook ID`,children:(0,m.jsx)(re,{className:`size-3.5`})})]})]}):null,(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-file`,children:`File path`}),(0,m.jsx)(s,{id:`hook-file`,value:D,onChange:e=>O(e.currentTarget.value),placeholder:`./hooks/login.js`,"aria-invalid":!!X}),X?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:X.message}):null]}),(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_minmax(0,0.8fr)]`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-runtime`,children:`Runtime`}),(0,m.jsxs)(te,{value:T,onValueChange:e=>Ke(e),children:[(0,m.jsx)(r,{id:`hook-runtime`,"aria-invalid":!!Y,children:(0,m.jsx)(ee,{placeholder:`Runtime`})}),(0,m.jsx)(n,{children:ye.map(e=>(0,m.jsx)(t,{value:e,children:ve(e).label},e))})]}),Y?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Y.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-timeout`,children:`Timeout`}),(0,m.jsx)(s,{id:`hook-timeout`,value:k,onChange:e=>A(e.currentTarget.value),placeholder:`5s`,"aria-invalid":!!Z}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Examples: 5s, 10m, 250ms`}),Z?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Z.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-network`,children:`Network`}),(0,m.jsxs)(`div`,{className:`flex h-10 items-center justify-between rounded-sm border bg-background/70 px-3`,children:[(0,m.jsx)(`span`,{className:`text-sm text-foreground`,children:j?`Enabled`:`Disabled`}),(0,m.jsx)(oe,{id:`hook-network`,checked:j,onCheckedChange:M,"aria-invalid":!!Q})]}),Q?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Q.message}):null]})]})]})]}),(0,m.jsxs)(`section`,{className:u(`space-y-2`,d?``:`flex min-h-[300px] flex-1 flex-col overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Source`}),(0,m.jsx)(`span`,{className:`rounded-sm border px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Ge})]}),(0,m.jsx)(ne,{value:N,onChange:P,onSave:Ye,language:K,className:u(`rounded-sm`,d?`h-[360px] min-h-[320px]`:`h-full min-h-[300px] flex-1`)})]})]}),et=d?(0,m.jsx)(ae,{className:`h-full`,children:$}):$,tt=(0,m.jsx)(we,{baselineCount:G.baselineVariables.length,baselineFilePath:G.baselineFilePath,baselineInfo:G.baselineInfo,isBaselineLoading:G.isBaselineLoading,overrideRows:G.overrideRows,overridingRowIds:G.overridingRowIds,recentRuns:G.recentRuns,selectedRunId:G.selectedRunId,isRunning:G.isRunning,runDisabledReason:q,runError:G.runError,onAddOverride:()=>G.addOverrideRow(),onUpdateOverride:G.updateOverrideRow,onRemoveOverride:G.removeOverrideRow,onRun:()=>{$e()},onSelectRun:G.selectRun}),nt=(0,m.jsx)(xe,{selectedRun:G.selectedRun});return(0,m.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,m.jsx)(be,{hookName:C.trim()||`New Hook`,isCreateMode:_,mode:`edit`,hookHref:_?void 0:o.hookView(x),editHref:_?void 0:o.hookEdit(x),unsaved:W,isSaving:Ne,isRunning:G.isRunning,isDeleting:Re,onSave:Ye,onRun:_?void 0:()=>{$e()},runDisabled:!!q,onDelete:_?void 0:Ze}),(0,m.jsx)(Se,{isMobile:d,leftPane:et,rightTopPane:tt,rightBottomPane:nt}),_?null:(0,m.jsx)(Ce,{open:Be,onOpenChange:Qe,hook:{id:x,name:C.trim()||`Hook`,runtime:T,file:D},isDeleting:Re,deleteError:Le,blockedReferences:Ie,onDelete:()=>{Xe(!1)},onForceDelete:()=>{Xe(!0)}})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{Qn as t,pr as n}from"./index-CZotRLCc.js";var r=e(n(),1),i={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},a=r.createContext&&r.createContext(i),o=[`attr`,`size`,`title`];function s(e,t){if(e==null)return{};var n,r,i=c(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function c(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e){return e&&e.map((e,t)=>r.createElement(e.tag,d({key:t},e.attr),h(e.child)))}function g(e){return t=>r.createElement(_,l({attr:d({},e.attr)},t),h(e.child))}function _(e){var t=t=>{var{attr:n,size:i,title:a}=e,c=s(e,o),u=i||t.size||`1em`,f;return t.className&&(f=t.className),e.className&&(f=(f?f+` `:``)+e.className),r.createElement(`svg`,l({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,c,{className:f,style:d(d({color:e.color||t.color},t.style),e.style),height:u,width:u,xmlns:`http://www.w3.org/2000/svg`}),a&&r.createElement(`title`,null,a),e.children)};return a===void 0?t(i):r.createElement(a.Consumer,null,e=>t(e))}function v(e){return g({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M432 32H80a64.07 64.07 0 0 0-64 64v320a64.07 64.07 0 0 0 64 64h352a64.07 64.07 0 0 0 64-64V96a64.07 64.07 0 0 0-64-64zM96 256a16 16 0 0 1-10-28.49L150.39 176 86 124.49a16 16 0 1 1 20-25l80 64a16 16 0 0 1 0 25l-80 64A16 16 0 0 1 96 256zm160 0h-64a16 16 0 0 1 0-32h64a16 16 0 0 1 0 32z`},child:[]}]})(e)}function y(e){return g({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M314 36.38c-18.59-3.06-45.8-4.47-64.27-4.38a311.09 311.09 0 0 0-51.66 4.38c-45.74 8-54.07 24.7-54.07 55.54V128h112v16H107.62C66.06 144 32.33 193.67 32 255.12v.88a162.91 162.91 0 0 0 3.13 32c9.29 46.28 38.23 80 72.49 80H128v-54c0-31.3 20.84-59.95 55-66.1l9.87-1.23H314a56.05 56.05 0 0 0 15.06-2A52.48 52.48 0 0 0 368 193.68V91.92c0-28.92-24.68-50.73-54-55.54zM194.93 105.5a20.37 20.37 0 1 1 20.3-20.3 20.29 20.29 0 0 1-20.3 20.3z`},child:[]},{tag:`path`,attr:{d:`M475.28 217c-10.7-42.61-38.41-73-70.9-73h-17.71v47.45c0 39.57-26 68.22-57.74 73.13a63.54 63.54 0 0 1-9.69.75H198.08a60 60 0 0 0-15.23 1.95C160.54 273.14 144 291.7 144 315.77v101.77c0 29 29.14 46 57.73 54.31 34.21 9.95 71.48 11.75 112.42 0 27.19-7.77 53.85-23.48 53.85-54.31V384H256v-16h148.38c29.44 0 54.95-24.93 67.45-61.31A156.83 156.83 0 0 0 480 256a160.64 160.64 0 0 0-4.72-39zM316.51 404a20.37 20.37 0 1 1-20.3 20.3 20.29 20.29 0 0 1 20.3-20.3z`},child:[]}]})(e)}function b(e){return g({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M429.76 130.07 274.33 36.85a37 37 0 0 0-36.65 0L82.24 130.06A38.2 38.2 0 0 0 64 162.83V349a38.26 38.26 0 0 0 18.24 32.8L123 406.14l.23.13c20.58 10.53 28.46 10.53 37.59 10.53 32.14 0 52.11-20.8 52.11-54.29V182a8.51 8.51 0 0 0-8.42-8.58h-22.38a8.51 8.51 0 0 0-8.42 8.58v180.51a15 15 0 0 1-6.85 13.07c-5.9 3.6-14.47 2.84-24.14-2.15l-39.06-23.51a1.1 1.1 0 0 1-.48-.92V165.46a1.32 1.32 0 0 1 .59-1.06l151.84-93a.82.82 0 0 1 .73 0l151.93 93a1.34 1.34 0 0 1 .55 1.1V349a1.28 1.28 0 0 1-.45 1l-152.06 90.65a1.22 1.22 0 0 1-.8 0l-38.83-23.06a7.8 7.8 0 0 0-7.83-.41l-.34.2c-10.72 6.35-13.6 8-23.54 11.62-1.62.59-5.43 2-5.76 5.77s3.29 6.45 6.51 8.32l51.9 31.87a35.67 35.67 0 0 0 18.3 5.07h.58a35.87 35.87 0 0 0 17.83-5.07l155.43-93.13A38.37 38.37 0 0 0 448 349V162.83a38.21 38.21 0 0 0-18.24-32.76z`},child:[]},{tag:`path`,attr:{d:`M307.88 318.05c-37.29 0-45.24-10.42-47.6-27.24a8.43 8.43 0 0 0-8.22-7.32h-19.8a8.44 8.44 0 0 0-8.26 8.58c0 14.58 5.12 62.17 83.92 62.17 24.38 0 44.66-5.7 58.63-16.49S388 311.26 388 292.55c0-37.55-24.5-47.83-72.75-54.55-49.05-6.82-49.05-10.29-49.05-17.89 0-5.47 0-18.28 35.46-18.28 25.23 0 38.74 3.19 43.06 20a8.35 8.35 0 0 0 8.06 6.67h19.87a8.24 8.24 0 0 0 6.16-2.86 8.91 8.91 0 0 0 2.12-6.44c-2.57-35.55-28.56-53.58-79.24-53.58-46.06 0-73.55 20.75-73.55 55.5 0 38.1 28.49 48.87 71.29 53.33 50 5.17 50 12.71 50 19.37.03 10.38-4.28 24.23-41.55 24.23z`},child:[]}]})(e)}var x=t();function S({className:e}){return(0,x.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,className:e,children:(0,x.jsx)(`path`,{fill:`currentColor`,d:`M11.966 22.566c6.609 0 11.966-4.326 11.966-9.661 0-3.308-2.051-6.23-5.204-7.963-1.283-.713-2.291-1.353-3.13-1.885-1.58-1.004-2.555-1.623-3.632-1.623-1.094 0-2.327.783-3.955 1.816a49.78 49.78 0 0 1-2.808 1.692C2.051 6.675 0 9.597 0 12.905c0 5.335 5.357 9.66 11.966 9.66Zm-1.397-17.83a5.885 5.885 0 0 0 .497-2.403c0-.144.201-.186.229-.028.656 2.775-.9 4.15-2.051 4.61-.124.048-.199-.12-.103-.208a5.748 5.748 0 0 0 1.428-1.971Zm2.052-.102a5.795 5.795 0 0 0-.78-2.3v-.015c-.068-.123.086-.263.185-.172 1.956 2.105 1.303 4.055.554 5.037-.082.102-.229-.003-.188-.126a5.837 5.837 0 0 0 .229-2.424Zm1.771-.559a5.708 5.708 0 0 0-1.607-1.801V2.26c-.112-.085-.024-.274.113-.218 2.588 1.084 2.766 3.171 2.452 4.395a.116.116 0 0 1-.048.071.11.11 0 0 1-.153-.026.118.118 0 0 1-.022-.083 5.864 5.864 0 0 0-.735-2.324Zm-5.072.559c-.616.544-1.279.758-2.058.997-.116 0-.194-.078-.155-.18 1.747-.907 2.369-1.645 2.99-2.771 0 0 .155-.117.188.085 0 .303-.348 1.325-.965 1.869Zm4.931 11.205a2.949 2.949 0 0 1-.935 1.549 2.16 2.16 0 0 1-1.282.618 2.167 2.167 0 0 1-1.323-.618 2.95 2.95 0 0 1-.923-1.549.243.243 0 0 1 .064-.197.23.23 0 0 1 .192-.069h3.954a.226.226 0 0 1 .19.07.239.239 0 0 1 .063.196Zm-5.443-2.17a1.85 1.85 0 0 1-2.377-.244 1.969 1.969 0 0 1-.233-2.44c.207-.318.502-.565.846-.711a1.84 1.84 0 0 1 1.089-.11c.365.075.701.26.964.53.264.27.443.616.515.99a1.98 1.98 0 0 1-.108 1.118 1.923 1.923 0 0 1-.696.866Zm8.471.005a1.849 1.849 0 0 1-2.374-.252 1.956 1.956 0 0 1-.546-1.362c0-.383.11-.758.319-1.076.207-.318.502-.566.847-.711a1.84 1.84 0 0 1 1.09-.108c.366.076.702.261.965.533s.44.617.512.993a1.98 1.98 0 0 1-.113 1.118 1.922 1.922 0 0 1-.7.865Z`})})}var C=[`node`,`bun`,`python`,`bash`],w={node:b,bun:S,python:y,bash:v},T={node:{label:`Node.js`,shortLabel:`JS`,icon:w.node,monacoLanguage:`javascript`,extension:`.js`,template:[`const fs = require('node:fs')`,``,`const envLines = [`,` 'HOOK_STATUS=ready',`,` 'HOOK_RUNTIME=node',`,`].join('\\n')`,``,"fs.writeFileSync('/tmp/agent-qa.env', `${envLines}\\n`)",`console.log('Hook wrote HOOK_STATUS and HOOK_RUNTIME to /tmp/agent-qa.env')`,`console.error('Sample stderr: replace with warnings or debug details when needed')`,``].join(`
|
|
2
2
|
`)},bun:{label:`Bun`,shortLabel:`BUN`,icon:w.bun,monacoLanguage:`typescript`,extension:`.ts`,template:[`const envLines = [`,` 'HOOK_STATUS=ready',`,` 'HOOK_RUNTIME=bun',`,`].join('\\n')`,``,"await Bun.write('/tmp/agent-qa.env', `${envLines}\\n`)",`console.log('Hook wrote HOOK_STATUS and HOOK_RUNTIME to /tmp/agent-qa.env')`,`console.error('Sample stderr: replace with warnings or debug details when needed')`,``].join(`
|
|
3
3
|
`)},python:{label:`Python`,shortLabel:`PY`,icon:w.python,monacoLanguage:`python`,extension:`.py`,template:[`from pathlib import Path`,`import sys`,``,`env_lines = '\\n'.join([`,` 'HOOK_STATUS=ready',`,` 'HOOK_RUNTIME=python',`,`]) + '\\n'`,``,`Path('/tmp/agent-qa.env').write_text(env_lines, encoding='utf-8')`,`print('Hook wrote HOOK_STATUS and HOOK_RUNTIME to /tmp/agent-qa.env')`,`print('Sample stderr: replace with warnings or debug details when needed', file=sys.stderr)`,``].join(`
|
|
4
4
|
`)},bash:{label:`Bash`,shortLabel:`SH`,icon:w.bash,monacoLanguage:`shell`,extension:`.sh`,template:[`#!/usr/bin/env bash`,`set -euo pipefail`,``,`cat > /tmp/agent-qa.env <<'EOF'`,`HOOK_STATUS=ready`,`HOOK_RUNTIME=bash`,`EOF`,``,`echo 'Hook wrote HOOK_STATUS and HOOK_RUNTIME to /tmp/agent-qa.env'`,`echo 'Sample stderr: replace with warnings or debug details when needed' >&2`,``].join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./monaco-editor-Ba9qdSve.js";import{t as n}from"./use-page-title-BeSr97vd.js";import{t as ee}from"./scroll-area-48uajHeh.js";import{$n as r,A as te,Fn as i,G as ne,Jn as a,Nt as re,Qn as o,S as s,Wt as c,Yt as ie,cr as ae,lr as oe,pr as l,qt as se,r as ce,ur as le}from"./index-CZotRLCc.js";import{t as u}from"./badge-Dd058S66.js";import{i as d,r as f}from"./hook-runtime-CPPjqz70.js";import{a as p,i as m,n as h,o as g,r as _,t as ue}from"./use-hook-run-session-RvECpdZN.js";import{t as v}from"./empty-state-c1UKljbh.js";import{t as de}from"./use-keyboard-shortcuts-BTppBDf3.js";var fe=a(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),y=e(l(),1),b=o(),x=[`overview`,`source`,`run`];function S(e){return e!==null&&x.includes(e)}function pe(e){let t=e.get(`tab`);return S(t)?t:`overview`}function C({title:e,body:t,tone:n=`warning`}){return(0,b.jsxs)(`div`,{className:`rounded-sm border px-4 py-3 text-sm ${n===`error`?`border-destructive/30 bg-destructive/10`:n===`neutral`?`border-border bg-muted/40`:`border-amber-500/30 bg-amber-500/10`}`,children:[(0,b.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,b.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t})]})}function w({fileMissing:e}){return e?(0,b.jsx)(u,{variant:`outline`,className:`border-amber-500/30 text-amber-600`,children:`File missing`}):(0,b.jsx)(u,{variant:`outline`,className:`border-emerald-500/30 text-emerald-600`,children:`Ready`})}function T({label:e,value:t,mono:n=!1}){return(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,b.jsx)(`div`,{className:n?`font-mono text-xs text-foreground break-all`:`text-sm text-foreground`,children:t})]})}function E(){let{id:e}=oe(),a=ae(),[o,l]=le(),u=e??``,x=ie(),[S,E]=(0,y.useState)(null),[me,D]=(0,y.useState)(!0),[O,k]=(0,y.useState)(!1),[A,j]=(0,y.useState)(null),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),[I,L]=(0,y.useState)([]),[R,z]=(0,y.useState)(!1),[he,B]=(0,y.useState)(!1),V=(0,y.useRef)(null),H=(0,y.useRef)(null),U=(0,y.useRef)(o.has(`tab`)?pe(o):null),W=ue({hookId:u});(0,y.useEffect)(()=>{if(o.has(`tab`)){let e=new URLSearchParams(o);e.delete(`tab`),l(e,{replace:!0})}},[o,l]),(0,y.useEffect)(()=>{let e=!1;return D(!0),k(!1),j(null),ne(u).then(t=>{e||E(t)}).catch(t=>{if(!e){if(E(null),t instanceof s&&t.status===404){k(!0);return}j(t instanceof Error?t.message:`Failed to load hook`)}}).finally(()=>{e||D(!1)}),()=>{e=!0}},[u]),n(S?.hook.name??`Hook`);let G=(0,y.useMemo)(()=>S?f(S.hook.runtime):null,[S]),K=G?.icon,q=S?.fieldErrors.some(e=>e.code===`file_missing`)??!1,J=S?.fieldErrors.filter(e=>e.code!==`file_missing`)??[],Y=(0,y.useMemo)(()=>S?S.fieldErrors.length===0?null:S.fieldErrors.map(e=>e.message).join(` `):`Hook details are still loading.`,[S]),X=(0,y.useCallback)(async()=>{H.current?.scrollIntoView?.({block:`start`}),!Y&&await W.submitRun()},[Y,W]),ge=(0,y.useCallback)(()=>{F(null),L([]),N(!0)},[]),_e=(0,y.useCallback)(e=>{N(e),e||(F(null),L([]))},[]),Z=(0,y.useCallback)(async(e=!1)=>{if(u){z(!0),F(null);try{await te(u,{force:e}),a(r.hooks)}catch(e){if(e instanceof s){let t=e.payload?.error,n=e.payload?.references;if(t===`hook_in_use`&&Array.isArray(n)){L(n);return}F(e.message)}else F(e instanceof Error?e.message:`Failed to delete hook`)}finally{z(!1)}}},[u,a]),Q=r.hookEdit(u);if(de({e:()=>{S&&a(Q)},r:()=>{X()},"shift+?":()=>B(e=>!e)}),(0,y.useEffect)(()=>{!S||!U.current||(U.current===`source`&&V.current?.scrollIntoView?.({block:`start`}),U.current===`run`&&H.current?.scrollIntoView?.({block:`start`}),U.current=null)},[S]),me)return(0,b.jsx)(ce,{});if(O)return(0,b.jsx)(v,{icon:fe,title:`Hook not found`,description:`This hook doesn't exist or could not be loaded.`,actionLabel:`View All Hooks`,onAction:()=>a(r.hooks)});if(!S)return(0,b.jsx)(v,{icon:i,title:`Hook couldn't be loaded`,description:A??`This hook could not be loaded right now.`,actionLabel:`View All Hooks`,onAction:()=>a(r.hooks)});let $=(0,b.jsxs)(`div`,{className:c(`p-3`,x?`space-y-3`:`flex h-full min-h-0 flex-col gap-3 overflow-hidden`),children:[(0,b.jsxs)(`div`,{className:`space-y-3 shrink-0`,children:[A?(0,b.jsx)(C,{title:`Hook could not be loaded`,body:A,tone:`error`}):null,q?(0,b.jsx)(C,{title:`Hook file missing`,body:`This hook is still registered, but its source file can't be found. Update the path or recreate the file, then save again.`}):null,J.length>0?(0,b.jsx)(C,{title:`Hook has recoverable authoring issues`,body:J.map(e=>e.message).join(` `)}):null,(0,b.jsxs)(`section`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Hook`}),(0,b.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:S.hook.name})]}),(0,b.jsx)(w,{fileMissing:q})]}),(0,b.jsxs)(`div`,{className:`grid gap-x-5 gap-y-3 sm:grid-cols-2`,children:[(0,b.jsx)(T,{label:`File`,value:S.hook.file,mono:!0}),(0,b.jsx)(T,{label:`Hook ID`,value:S.hook.id,mono:!0}),(0,b.jsx)(T,{label:`Runtime`,value:(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K?(0,b.jsx)(K,{className:`h-4 w-4 text-muted-foreground`}):null,(0,b.jsx)(`span`,{children:G?.label??S.hook.runtime})]})}),(0,b.jsx)(T,{label:`Timeout`,value:se(S.hook.timeout)}),(0,b.jsx)(T,{label:`Network`,value:S.hook.network?`Enabled`:`Disabled`}),(0,b.jsx)(T,{label:`Health`,value:(0,b.jsx)(w,{fileMissing:q})})]})]})]}),(0,b.jsxs)(`section`,{ref:V,className:c(`space-y-2`,x?``:`flex min-h-[300px] flex-1 flex-col overflow-hidden`),children:[(0,b.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Source`}),S.source?(0,b.jsx)(t,{value:S.source,onChange:()=>{},readOnly:!0,language:d(S.hook.runtime),className:c(`rounded-sm`,x?`h-[360px] min-h-[320px]`:`h-full min-h-[300px] flex-1`)}):(0,b.jsx)(`div`,{className:c(`flex items-center justify-center rounded-sm border border-dashed px-6 py-12 text-center`,x?`min-h-[320px]`:`min-h-[300px] flex-1`),children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(i,{className:`mx-auto h-5 w-5 text-muted-foreground`}),(0,b.jsx)(`div`,{className:`mt-3 text-sm font-medium text-foreground`,children:`No hook source found for this record.`}),(0,b.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:`Update the path or recreate the file in edit mode.`})]})})]})]}),ve=x?(0,b.jsx)(ee,{className:`h-full`,children:$}):$,ye=(0,b.jsx)(`div`,{ref:H,className:`h-full`,children:(0,b.jsx)(_,{baselineCount:W.baselineVariables.length,baselineFilePath:W.baselineFilePath,baselineInfo:W.baselineInfo,isBaselineLoading:W.isBaselineLoading,overrideRows:W.overrideRows,overridingRowIds:W.overridingRowIds,recentRuns:W.recentRuns,selectedRunId:W.selectedRunId,isRunning:W.isRunning,runDisabledReason:Y,runError:W.runError,onAddOverride:()=>W.addOverrideRow(),onUpdateOverride:W.updateOverrideRow,onRemoveOverride:W.removeOverrideRow,onRun:()=>{X()},onSelectRun:W.selectRun})}),be=(0,b.jsx)(m,{selectedRun:W.selectedRun});return(0,b.jsx)(re,{children:(0,b.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,b.jsx)(p,{hookName:S.hook.name,isCreateMode:!1,mode:`view`,hookHref:r.hookView(S.hook.id),editHref:r.hookEdit(S.hook.id),isRunning:W.isRunning,onRun:()=>{X()},runDisabled:!!Y,onDelete:ge,isDeleting:R,shortcutsOpen:he,onToggleShortcuts:()=>B(e=>!e)}),(0,b.jsx)(h,{isMobile:x,leftPane:ve,rightTopPane:ye,rightBottomPane:be}),(0,b.jsx)(g,{open:M,onOpenChange:_e,hook:{id:S.hook.id,name:S.hook.name,runtime:S.hook.runtime,file:S.hook.file},isDeleting:R,deleteError:P,blockedReferences:I,onDelete:()=>{Z(!1)},onForceDelete:()=>{Z(!0)}})]})})}export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./arrow-up-down-D8UGCR46.js";import{i as n,n as r,o as i,s as a,t as o}from"./select-B2_tSMl_.js";import{t as s}from"./file-code-C7vOuS4q.js";import{n as c,r as l}from"./shortcut-hints-BnEYaq1r.js";import{t as u}from"./plus-BDA9KiOF.js";import{t as d}from"./use-page-title-BeSr97vd.js";import{n as ee,t as te}from"./scroll-area-48uajHeh.js";import{$n as f,Ht as ne,Mt as re,Nt as ie,Pt as ae,Qn as p,Ut as m,W as oe,Wt as h,a as se,cr as ce,jt as le,pr as g,qt as _,ur as v}from"./index-CZotRLCc.js";import{t as y}from"./badge-Dd058S66.js";import{a as ue,i as b,n as de,o as x,r as S,t as C}from"./table-BGMQ2E9D.js";import{r as w,t as fe}from"./hook-runtime-CPPjqz70.js";import{t as pe}from"./empty-state-c1UKljbh.js";import{t as me}from"./use-keyboard-shortcuts-BTppBDf3.js";var T=e(g(),1),E=new Set([`asc`,`desc`]);function D(e){let t=new URLSearchParams;return e.search&&t.set(`search`,e.search),e.runtime&&t.set(`runtime`,e.runtime),e.health&&t.set(`health`,e.health),e.sort&&(t.set(`sort`,e.sort),t.set(`order`,e.order)),t}function he(){let[e,t]=v(),n=e.get(`search`)??``,r=e.get(`runtime`)??``,i=e.get(`health`)??``,a=e.get(`sort`)??``,o=e.get(`order`)??`asc`,s=E.has(o)?o:`asc`,c=(0,T.useMemo)(()=>a?[{id:a,desc:s===`desc`}]:[],[a,s]),l=(0,T.useRef)(c);l.current=c;let u=(0,T.useMemo)(()=>({search:n,runtime:r,health:i,sort:a,order:s}),[n,r,i,a,s]);(0,T.useEffect)(()=>{let n=D(u);n.toString()!==e.toString()&&t(n,{replace:!0})},[e,t,u]);let d=(0,T.useCallback)(e=>{t(D({...u,...e}),{replace:!0})},[t,u]);return{search:n,runtime:r,health:i,sort:a,order:s,sorting:c,onSortingChange:(0,T.useCallback)(e=>{let t=typeof e==`function`?e(l.current):e;t.length>0?d({sort:t[0].id,order:t[0].desc?`desc`:`asc`}):d({sort:``,order:`asc`})},[d]),setSearch:(0,T.useCallback)(e=>d({search:e}),[d]),setRuntime:(0,T.useCallback)(e=>d({runtime:e}),[d]),setHealth:(0,T.useCallback)(e=>d({health:e}),[d])}}var O=p(),k={hooks:[],filePath:null,errors:[],missing:!1},A=50;function j(e){return e.fileMissing?`file-missing`:`ready`}function M(e){return e===`file-missing`?`File missing`:`Ready`}function ge({hook:e}){return j(e)===`file-missing`?(0,O.jsx)(y,{variant:`outline`,className:`border-amber-500/30 text-amber-600`,children:`File missing`}):(0,O.jsx)(y,{variant:`outline`,className:`border-emerald-500/30 text-emerald-600`,children:`Ready`})}function _e({runtime:e}){let t=w(e),n=t.icon;return(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,O.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,O.jsx)(`span`,{children:t.label})]})}function ve({title:e,body:t}){return(0,O.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm`,children:[(0,O.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,O.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t})]})}function ye({isActive:e}){return h(`cursor-pointer outline-none hover:bg-muted/20 focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/60`,e&&`bg-primary/10 ring-1 ring-inset ring-primary/60`)}function N(){d(`Hooks`);let e=ce(),[p,h]=(0,T.useState)(k),[g,v]=(0,T.useState)(null),[y,E]=(0,T.useState)(!0),[D,N]=(0,T.useState)(-1),[P,F]=(0,T.useState)(0),I=(0,T.useRef)([]),{search:L,runtime:R,health:z,sorting:B,onSortingChange:be,setSearch:V,setRuntime:H,setHealth:U}=he();(0,T.useEffect)(()=>{let e=!1;return oe().then(t=>{e||(h(t),v(null))}).catch(t=>{e||(h(k),v(t instanceof Error?t.message:`Failed to load hooks`))}).finally(()=>{e||E(!1)}),()=>{e=!0}},[]);let W=(0,T.useMemo)(()=>g?{title:`Hooks could not be loaded`,body:g}:p.missing?{title:`${p.filePath??`configured hooks file`} not found`,body:`Create the first hook to generate the configured hooks file for this workspace.`}:p.errors.length>0?{title:`Hooks could not be loaded from ${p.filePath??`configured hooks file`}`,body:p.errors[0]??`Unknown registry error`}:null,[p.errors,p.filePath,p.missing,g]),G=(0,T.useMemo)(()=>{let e=L.trim().toLowerCase(),t=B[0],n=p.hooks.filter(t=>R&&t.runtime!==R||z&&j(t)!==z?!1:e?t.name.toLowerCase().includes(e)||t.file.toLowerCase().includes(e)||t.id.toLowerCase().includes(e):!0);return t?[...n].sort((e,n)=>{let r=0;switch(t.id){case`runtime`:r=w(e.runtime).label.localeCompare(w(n.runtime).label);break;case`timeout`:r=e.timeout-n.timeout;break;case`health`:r=M(j(e)).localeCompare(M(j(n)));break;default:r=e.name.localeCompare(n.name);break}return t.desc?r*-1:r}):n},[p.hooks,z,R,L,B]),K=G.length,q=Math.ceil(K/A),J=q>0?Math.min(P,q-1):0,Y=J*A,X=G.slice(Y,Y+A),xe=K>0?Y+1:0,Se=Math.min(Y+A,K);(0,T.useEffect)(()=>{P!==J&&F(J)},[P,J]);let Ce=(0,T.useCallback)(e=>{N(-1),F(0),V(e)},[V]),we=(0,T.useCallback)(e=>{N(-1),F(0),H(e===`all`?``:e)},[H]),Te=(0,T.useCallback)(e=>{N(-1),F(0),U(e===`all`?``:e)},[U]),Z=(0,T.useCallback)((t,n=!1)=>{let r=f.hookView(t.id);if(n){window.open(r,`_blank`);return}e(r)},[e]);me((0,T.useMemo)(()=>{let e=()=>N(e=>Math.min(e+1,X.length-1)),t=()=>N(e=>Math.max(e-1,0));return{j:e,arrowdown:e,k:t,arrowup:t,enter:e=>{D<0||!X[D]||Z(X[D],e.metaKey||e.ctrlKey)}}},[Z,D,X])),(0,T.useEffect)(()=>{if(X.length===0){D!==-1&&N(-1);return}D>=X.length&&N(X.length-1)},[D,X.length]),(0,T.useEffect)(()=>{if(D<0)return;let e=I.current[D];e&&document.activeElement!==e&&e.focus()},[D,X.length]);let Ee=(0,T.useCallback)((e,t)=>{t&&t.preventDefault(),Z(e,!!(t&&(t.metaKey||t.ctrlKey)))},[Z]);function Q(e){N(-1),F(0),be(t=>{let n=t[0];return!n||n.id!==e?[{id:e,desc:!1}]:n.desc?[]:[{id:e,desc:!0}]})}if(y)return(0,O.jsx)(se,{});let De=K===0,$=!p.errors.length&&!g;return(0,O.jsx)(ie,{children:(0,O.jsxs)(`div`,{className:`space-y-6`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Hooks`}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage reusable setup, teardown, and inline hook scripts for this workspace.`})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(le,{children:[(0,O.jsx)(ae,{asChild:!0,children:(0,O.jsx)(m,{variant:`ghost`,size:`icon-sm`,type:`button`,"aria-label":`Keyboard shortcuts`,children:(0,O.jsx)(l,{className:`h-4 w-4`})})}),(0,O.jsx)(re,{side:`bottom`,className:`p-3`,children:(0,O.jsx)(c,{hints:[{key:`J / ↓`,label:`Next row`},{key:`K / ↑`,label:`Previous row`},{key:`Enter`,label:`Open hook`},{key:`⌘+Enter`,label:`Open in new tab`}]})})]}),(0,O.jsxs)(m,{type:`button`,onClick:()=>e(f.hookNew),children:[(0,O.jsx)(u,{className:`h-4 w-4`}),`Create Hook`]})]})]}),W&&(0,O.jsx)(ve,{title:W.title,body:W.body}),(0,O.jsx)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,O.jsx)(ne,{value:L,onChange:e=>Ce(e.currentTarget.value),placeholder:`Search hooks`,className:`lg:max-w-sm`,"aria-label":`Search hooks`}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[(0,O.jsxs)(o,{value:R||`all`,onValueChange:we,children:[(0,O.jsx)(i,{className:`w-full sm:w-44`,"aria-label":`Runtime filter`,children:(0,O.jsx)(a,{placeholder:`Runtime`})}),(0,O.jsxs)(r,{children:[(0,O.jsx)(n,{value:`all`,children:`All runtimes`}),fe.map(e=>(0,O.jsx)(n,{value:e,children:w(e).label},e))]})]}),(0,O.jsxs)(o,{value:z||`all`,onValueChange:Te,children:[(0,O.jsx)(i,{className:`w-full sm:w-44`,"aria-label":`Health filter`,children:(0,O.jsx)(a,{placeholder:`Health`})}),(0,O.jsxs)(r,{children:[(0,O.jsx)(n,{value:`all`,children:`All health`}),(0,O.jsx)(n,{value:`ready`,children:`Ready`}),(0,O.jsx)(n,{value:`file-missing`,children:`File missing`})]})]})]})]})}),De?(0,O.jsx)(pe,{icon:s,title:p.hooks.length===0?`No hooks yet`:`No hooks match your filters`,description:p.hooks.length===0?`Create a hook to add reusable setup, teardown, or inline automation to this workspace.`:`Adjust your search or filters to see more hook records.`,actionLabel:$?`Create Hook`:void 0,onAction:$?()=>e(f.hookNew):void 0}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(te,{className:`rounded-md border`,children:[(0,O.jsxs)(C,{className:`min-w-full`,children:[(0,O.jsx)(ue,{children:(0,O.jsxs)(x,{children:[(0,O.jsx)(b,{className:`w-[40%]`,children:(0,O.jsxs)(m,{type:`button`,variant:`ghost`,className:`-ml-3`,onClick:()=>Q(`name`),children:[`Hook`,(0,O.jsx)(t,{className:`h-4 w-4`})]})}),(0,O.jsx)(b,{children:(0,O.jsxs)(m,{type:`button`,variant:`ghost`,className:`-ml-3`,onClick:()=>Q(`runtime`),children:[`Runtime`,(0,O.jsx)(t,{className:`h-4 w-4`})]})}),(0,O.jsx)(b,{children:(0,O.jsxs)(m,{type:`button`,variant:`ghost`,className:`-ml-3`,onClick:()=>Q(`timeout`),children:[`Timeout / Network`,(0,O.jsx)(t,{className:`h-4 w-4`})]})}),(0,O.jsx)(b,{children:(0,O.jsxs)(m,{type:`button`,variant:`ghost`,className:`-ml-3`,onClick:()=>Q(`health`),children:[`Health`,(0,O.jsx)(t,{className:`h-4 w-4`})]})})]})}),(0,O.jsx)(de,{children:X.map((e,t)=>{let n=t===D;return(0,O.jsxs)(x,{ref:e=>{I.current[t]=e},"data-hooks-row-surface":e.id,tabIndex:n?0:-1,"aria-selected":n,className:ye({isActive:n}),onClick:()=>{N(t),Z(e)},onFocus:()=>N(t),onKeyDown:t=>{t.key===`Enter`&&Ee(e,t)},children:[(0,O.jsx)(S,{className:`max-w-0`,children:(0,O.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,O.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,O.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.file})]})}),(0,O.jsx)(S,{children:(0,O.jsx)(_e,{runtime:e.runtime})}),(0,O.jsx)(S,{children:(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-sm text-foreground`,children:_(e.timeout)}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.network?`Network on`:`Network off`})]})}),(0,O.jsx)(S,{children:(0,O.jsx)(ge,{hook:e})})]},e.id)})})]}),(0,O.jsx)(ee,{orientation:`horizontal`})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-2`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Showing `,xe,`-`,Se,` of `,K]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{N(-1),F(e=>Math.max(e-1,0))},disabled:J===0,children:`Previous`}),(0,O.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{N(-1),F(e=>Math.min(e+1,Math.max(q-1,0)))},disabled:J>=q-1,children:`Next`})]})]})]})]})})}export{N as default};
|