@capagents/forgeqe 3.2.0 → 3.2.2
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/HOW_TO_USE.md +33 -9
- package/dist/docs-site/docs/area-api/index.html +1 -1
- package/dist/docs-site/docs/area-mobile/index.html +28 -8
- package/dist/docs-site/docs/area-quality/index.html +10 -0
- package/dist/docs-site/docs/get-started/index.html +12 -8
- package/dist/docs-site/docs/mobile/index.html +19 -7
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +2 -1
- package/dist/forgeqe.js +1895 -1884
- package/dist/web/assets/{3d-force-graph-Bhmgjf_7.js → 3d-force-graph-CTC0tr_c.js} +1 -1
- package/dist/web/assets/Agent-wRS-AWzy.js +8 -0
- package/dist/web/assets/{AgentWork-D0MS10up.js → AgentWork-GXWfoD_Z.js} +2 -2
- package/dist/web/assets/ApiTests-BH_mbOVX.js +10 -0
- package/dist/web/assets/Browse-B5RXYaB5.js +1 -0
- package/dist/web/assets/Chat-CVF0hHdk.js +3 -0
- package/dist/web/assets/{CommandPalette-rY8rp79k.js → CommandPalette-BipNmH6a.js} +1 -1
- package/dist/web/assets/Compare-FHtKxtLJ.js +1 -0
- package/dist/web/assets/Cost-BDwt86M-.js +1 -0
- package/dist/web/assets/{Data-CFyxbwPS.js → Data-Ctg96el3.js} +4 -4
- package/dist/web/assets/Desktop-B2k0qH7c.js +1 -0
- package/dist/web/assets/DesktopReview-CE65JglI.js +2 -0
- package/dist/web/assets/DeviceScreen-CoArZGyY.js +1 -0
- package/dist/web/assets/{Evidence-BlTkmzfE.js → Evidence-D_90W10z.js} +1 -1
- package/dist/web/assets/{Explore-DyGqAEff.js → Explore-CD7Mq4il.js} +2 -2
- package/dist/web/assets/{Features-BjPR9gCe.js → Features-CLHC2bGL.js} +1 -1
- package/dist/web/assets/Flags-FpR9O_13.js +2 -0
- package/dist/web/assets/Flaky-Bzt9VcYv.js +1 -0
- package/dist/web/assets/Impact-BC8w7uQ5.js +3 -0
- package/dist/web/assets/Jobs-DeBncFIN.js +5 -0
- package/dist/web/assets/KindPage-CJcRnrTe.js +6 -0
- package/dist/web/assets/LiveDevice-BP47IrPa.js +1 -0
- package/dist/web/assets/Migration-BaVfcEYa.js +8 -0
- package/dist/web/assets/Mobile-CLoZlBuq.js +1 -0
- package/dist/web/assets/Observability-CaRIhlKg.js +1 -0
- package/dist/web/assets/PageAgent-C_oSStNT.js +1 -0
- package/dist/web/assets/Product-BdY0j-z8.js +12 -0
- package/dist/web/assets/{Production-C8eGcwCi.js → Production-BhDff1v6.js} +1 -1
- package/dist/web/assets/Quality-EATW3zGE.js +1 -0
- package/dist/web/assets/{Readiness-BWlbiTeu.js → Readiness-D4nY3Nr1.js} +1 -1
- package/dist/web/assets/Record-CIf6M72U.js +1 -0
- package/dist/web/assets/Regression-DhNAgDgD.js +5 -0
- package/dist/web/assets/{RelationGraph-CzR_Hs8A.js → RelationGraph-UXFyQOKO.js} +1 -1
- package/dist/web/assets/Reports-D4-y2w-2.js +2 -0
- package/dist/web/assets/Response-CpHrRtzJ.js +9 -0
- package/dist/web/assets/Responsive-DljiUZXJ.js +3 -0
- package/dist/web/assets/{RunDiff-COaxhvKm.js → RunDiff-DjUiMBsq.js} +1 -1
- package/dist/web/assets/Runs-DC0tJWvX.js +2 -0
- package/dist/web/assets/Settings-CD1RbHXf.js +21 -0
- package/dist/web/assets/{Steps-CN4n8U1I.js → Steps-DG1WYfYK.js} +3 -3
- package/dist/web/assets/{TestCases-BEfJFp5h.js → TestCases-BfZzshUI.js} +1 -1
- package/dist/web/assets/TestData-BoyXYHtp.js +2 -0
- package/dist/web/assets/{TestDebt-DIYhbhjh.js → TestDebt-CX1XT-CA.js} +1 -1
- package/dist/web/assets/TestManagement-BTdMN3Bl.js +4 -0
- package/dist/web/assets/WhatsNew-ZorWOqDL.js +1 -0
- package/dist/web/assets/agents-DPabR9dS.js +1 -0
- package/dist/web/assets/{coverage-DCtiu73T.js → coverage-xSRsKFL6.js} +1 -1
- package/dist/web/assets/dataParts-CeMHTXLx.js +3 -0
- package/dist/web/assets/desktopAppPath-BVJxel_D.js +1 -0
- package/dist/web/assets/{diff-DEgLgw6R.js → diff-BXu8cULX.js} +1 -1
- package/dist/web/assets/{highlight-DSLpJ_Dq.js → highlight-Cd5aQvev.js} +1 -1
- package/dist/web/assets/index-CgpH1pj9.css +2 -0
- package/dist/web/assets/index-F95avSUY.js +64 -0
- package/dist/web/assets/input-BmJ7dt1C.js +1 -0
- package/dist/web/assets/pageBack-BNLSF2VR.js +3 -0
- package/dist/web/assets/palette-BS9ixqiJ.js +1 -0
- package/dist/web/assets/{paletteCommands-fwv5XVOS.js → paletteCommands-DferMQDH.js} +1 -1
- package/dist/web/assets/{parts-CkI14hIv.js → parts-69Ei7EPi.js} +1 -1
- package/dist/web/assets/productParts-PERPm-xD.js +1 -0
- package/dist/web/assets/{qualityParts-8KI3JCY8.js → qualityParts-BRZOCiQs.js} +1 -1
- package/dist/web/assets/{recordTest-kf2ykEQF.js → recordTest-DVJCNI0y.js} +1 -1
- package/dist/web/assets/{stepper-CQSK6KS0.js → stepper-t0O_8eQo.js} +1 -1
- package/dist/web/index.html +6 -6
- package/docs/MOBILE.md +22 -7
- package/docs/WEB_APP.md +2 -1
- package/docs/user-guide.html +51 -17
- package/forgeqe.example.yaml +1 -0
- package/package.json +1 -1
- package/py/forgeqe_engine/copilot_gateway.py +88 -10
- package/py/forgeqe_engine/persona.py +197 -10
- package/py/forgeqe_engine/service.py +2 -2
- package/py/forgeqe_mobile/a11y.py +322 -0
- package/py/forgeqe_mobile/appium_driver.py +16 -0
- package/py/forgeqe_mobile/live.py +225 -0
- package/py/forgeqe_mobile/service.py +102 -4
- package/dist/web/assets/Agent-Dx4aOB_h.js +0 -8
- package/dist/web/assets/ApiTests-DUoEh0nX.js +0 -10
- package/dist/web/assets/Browse-BGgyLuL3.js +0 -1
- package/dist/web/assets/Chat-CEHUI2ty.js +0 -3
- package/dist/web/assets/Compare-B_NCvogR.js +0 -1
- package/dist/web/assets/Cost-sm-6tWRQ.js +0 -1
- package/dist/web/assets/Desktop-A_D4LTis.js +0 -1
- package/dist/web/assets/DesktopReview-CM7xmpHS.js +0 -2
- package/dist/web/assets/Flags-C_DneXS9.js +0 -2
- package/dist/web/assets/Flaky-l5ugC_ER.js +0 -1
- package/dist/web/assets/Impact-7TXQHcsW.js +0 -3
- package/dist/web/assets/Jobs-xRLNI-8l.js +0 -5
- package/dist/web/assets/KindPage-BZu1Zo4S.js +0 -6
- package/dist/web/assets/Migration-DKsyDwDO.js +0 -8
- package/dist/web/assets/Observability-CVwKJ-fI.js +0 -1
- package/dist/web/assets/PageAgent-C1X5ot6v.js +0 -1
- package/dist/web/assets/Product-iHqLyIhD.js +0 -12
- package/dist/web/assets/Quality-BVsN6u0E.js +0 -1
- package/dist/web/assets/Record-C7qgNFqs.js +0 -1
- package/dist/web/assets/Regression-ChleHlqe.js +0 -5
- package/dist/web/assets/Reports-CIcKyoHH.js +0 -2
- package/dist/web/assets/Response-D2ZeO8uW.js +0 -9
- package/dist/web/assets/Responsive-DCfw-Oz3.js +0 -3
- package/dist/web/assets/Runs-3qx2qf56.js +0 -2
- package/dist/web/assets/Settings-DG2k3Lno.js +0 -21
- package/dist/web/assets/TestData-SO2qqaAF.js +0 -2
- package/dist/web/assets/TestManagement-D7q6G3YN.js +0 -4
- package/dist/web/assets/WhatsNew-DqBLhhgk.js +0 -1
- package/dist/web/assets/agents-BUWN-VJv.js +0 -1
- package/dist/web/assets/dataParts-BdmBLsU9.js +0 -3
- package/dist/web/assets/index-DAteDsgB.css +0 -2
- package/dist/web/assets/index-RJ1kEHuo.js +0 -64
- package/dist/web/assets/input-Be3YOEK2.js +0 -1
- package/dist/web/assets/logLevel-Dq8s6DZz.js +0 -3
- package/dist/web/assets/palette-Dcoz5crU.js +0 -1
- package/dist/web/assets/productParts-BOUMBM_H.js +0 -1
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Features-BjPR9gCe.js","assets/rolldown-runtime-XKyaHtl9.js","assets/route-D8G-pTdk.js","assets/jsx-runtime-LKYXHABd.js","assets/input-Be3YOEK2.js","assets/logLevel-Dq8s6DZz.js","assets/palette-Dcoz5crU.js","assets/agents-BUWN-VJv.js","assets/index-RJ1kEHuo.js","assets/index-DAteDsgB.css","assets/WhatsNew-DqBLhhgk.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$n as n,A as r,At as i,Bn as a,C as o,Cr as s,Dr as c,Dt as l,Er as u,Et as d,F as f,Fn as p,Ft as m,G as h,Gn as g,Gr as _,Gt as v,H as y,Hn as b,Hr as x,Ht as S,I as C,K as w,Kr as T,Ln as E,M as D,N as O,O as k,On as ee,Or as te,Pn as A,Pt as ne,Rn as j,Rt as M,Sn as N,St as P,Tr as re,Vn as ie,Vr as ae,Wn as F,Xn as oe,Zn as se,Zt as ce,_t as le,an as ue,ar as de,bt as I,d as fe,er as pe,fn as me,fr as he,g as ge,ht as _e,kr as ve,kt as ye,l as be,lr as xe,lt as Se,mn as L,mt as Ce,n as we,on as Te,ot as Ee,pn as De,qn as Oe,qt as ke,r as R,rr as Ae,s as je,sn as Me,sr as Ne,tr as Pe,u as Fe,ut as Ie,v as Le,xt as Re,zn as ze}from"./route-D8G-pTdk.js";import{D as Be,E as Ve,f as z,g as He,k as Ue,n as We}from"./agents-BUWN-VJv.js";import{t as Ge}from"./jsx-runtime-LKYXHABd.js";import{$ as Ke,A as B,At as qe,H as Je,It as Ye,Lt as Xe,N as Ze,Pt as Qe,Rt as $e,V as et,Vt as tt,W as nt,bt as rt,ct as it,it as at,j as ot,jt as st,l as ct,n as V,ot as lt,pt as ut,r as dt,s as ft,t as H}from"./input-Be3YOEK2.js";import{C as pt,E as mt,S as ht,T as U,a as gt,c as _t,n as vt,o as W,s as yt,t as bt}from"./logLevel-Dq8s6DZz.js";import{A as xt,C as St,D as Ct,E as wt,I as Tt,L as Et,M as Dt,O as Ot,P as kt,S as At,T as jt,_ as Mt,a as Nt,b as Pt,g as Ft,h as It,i as Lt,k as Rt,m as zt,u as Bt,v as Vt,w as Ht,y as Ut}from"./palette-Dcoz5crU.js";import{$t as Wt,B as Gt,Bt as Kt,Ct as qt,Dn as Jt,Dt as Yt,Et as Xt,F as Zt,Ft as Qt,G as $t,H as en,Hn as tn,In as nn,It as rn,Ln as an,On as on,Ot as sn,Rn as cn,S as ln,St as un,Tt as dn,U as fn,Un as G,W as pn,Xt as mn,_ as hn,_n as K,_t as gn,at as _n,bn as q,bt as J,ct as vn,d as yn,dn as bn,fn as xn,g as Sn,gn as Y,gt as Cn,h as wn,hn as Tn,it as En,jt as Dn,kn as On,kt as kn,lt as An,m as jn,mn as Mn,mt as Nn,n as Pn,nt as Fn,ot as In,p as Ln,pn as Rn,rt as zn,st as Bn,t as Vn,tt as Hn,un as Un,v as Wn,vn as Gn,vt as X,wn as Kn,wt as qn,xn as Jn,xt as Yn,y as Xn,yn as Zn,yt as Z,zt as Qn}from"./index-RJ1kEHuo.js";import{C as $n,S as er,_ as tr,a as nr,b as rr,c as ir,d as ar,f as or,g as sr,h as cr,i as lr,l as ur,m as dr,n as fr,o as pr,p as mr,r as hr,s as gr,t as _r,u as vr,v as yr,w as br,x as xr,y as Sr}from"./coverage-DCtiu73T.js";var Q=e(T(),1),$=Ge();function Cr({names:e,max:t=4}){let n=e.slice(0,t);return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[n.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-ink-2`,"data-tip":z(e).name,children:[(0,$.jsx)(Nt,{agent:e,px:16,decorative:!0}),z(e).name]},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`+`,e.length-t,` more`]}),!e.length&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not used by an agent`})]})}function wr({p:e}){return(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-1 text-[13px] font-medium whitespace-nowrap`,e.outdated?`bg-warn-soft text-warn`:e.edited?`bg-accent-soft text-accent-fg`:`bg-surface-strong text-muted`),children:e.outdated?`Edited, older base`:e.edited?`Edited`:`ForgeQE's`})}function Tr(e){let t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{head:t[0],body:e.slice(t[0].length)}:{head:``,body:e}}var Er=e=>e.replace(/\{\{>\s*([\w-]+)\s*\}\}/g,`the shared part $1`);function Dr(e){return e.replace(/^[ \t]*\{\{>\s*([\w-]+)\s*\}\}[ \t]*$/gm,(e,t)=>`> Also includes ForgeQE's shared part: ${t}`)}function Or({label:e,rows:t}){return(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(sn,{label:e,search:!1,empty:`No prompt matches.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Dn,children:`Prompt`}),(0,$.jsx)(`th`,{scope:`col`,className:B(Dn,`hidden @2xl:table-cell`),children:`Used by`}),(0,$.jsx)(`th`,{scope:`col`,className:B(Dn,`text-right`),children:`Status`})]}),children:t.map(e=>(0,$.jsxs)(`tr`,{onClick:e.onOpen,className:`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,$.jsxs)(`td`,{className:B(kn,`min-w-0`),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t=>(t.stopPropagation(),e.onOpen()),className:`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-left`,children:[e.mark,(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink hover:underline`,children:e.name})]}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-[13px] text-muted`,children:e.about})]}),(0,$.jsx)(`td`,{className:B(kn,`hidden w-[34%] @2xl:table-cell`),children:(0,$.jsx)(Cr,{names:e.agents,max:2})}),(0,$.jsx)(`td`,{className:B(kn,`w-[1%] text-right whitespace-nowrap`),children:e.state})]},e.key))})})}function kr({p:e,onOpen:t,agents:n=!0}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Open ${e.name}`,className:`grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(pt,{icon:Re,size:16,className:`text-muted`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:Er(e.description||e.usedBy)}),n?(0,$.jsx)(Cr,{names:e.agents}):e.agents.length>1&&(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Shared with `,ot(e.agents.length-1,`other agent`),`: editing it changes them too`]})]}),(0,$.jsx)(wr,{p:e})]})}function Ar({t:e,onOpen:t}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Edit ${e.name}`,className:`grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(ve,{size:16,strokeWidth:1.8,"aria-hidden":`true`,className:`text-accent-fg`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.description||e.text.split(`
|
|
3
|
-
`)[0]}),(0,$.jsx)(Cr,{names:e.agents})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-pass-soft px-2 py-1 text-[13px] font-medium whitespace-nowrap text-pass`,children:`Yours`})]})}function jr({onChanged:e}){let{data:t,error:n,reload:r}=Nn(Je.prompts),[i,o]=(0,Q.useState)(`all`),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(`read`),[y,b]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),ee=c.toLowerCase().split(/\s+/).filter(Boolean),te=e=>ee.every(t=>e.toLowerCase().includes(t)),A=(0,Q.useMemo)(()=>(t?.prompts||[]).filter(e=>te(`${e.name} ${e.description} ${e.usedBy} ${e.agents.map(e=>z(e).name).join(` `)}`)),[t,c]),ne=(0,Q.useMemo)(()=>(t?.team||[]).filter(e=>te(`${e.name} ${e.description} ${e.text} ${e.agents.map(e=>z(e).name).join(` `)}`)),[t,c]),j=async t=>{D(``);try{let e=await Je.prompt(t);d(e),p(e.text),h(!1),v(`read`)}catch(t){e(t.message)}},M=async t=>{try{let e=await Je.agentPrompt(t);C({agent:t,text:e.text})}catch(t){e(t.message)}},N=async(t,n,i)=>{T(!0),D(``);try{await t(),i(),r(),e(n)}catch(e){D(e.message)}finally{T(!1)}};if(!t)return(0,$.jsx)(En,{error:n,reload:r});let P=t.prompts.find(e=>e.name===u?.name),re=t.agents,ie=[{id:`all`,label:`All prompts`,n:t.prompts.length},{id:`agents`,label:`By agent`,n:re.length},{id:`team`,label:`Your prompts`,n:t.team.length}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Qn,{label:`Show`,value:i,onChange:o,options:ie.map(e=>({id:e.id,label:e.label,n:e.n}))}),(0,$.jsx)(gt,{id:`find-a-prompt`,label:`Find a prompt`,value:c,onChange:l,placeholder:`Find a prompt or agent`}),(0,$.jsxs)(U,{variant:`primary`,"data-tip":`Add a prompt`,onClick:()=>(D(``),b({name:``,description:``,agents:[],text:``})),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),i===`agents`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:re.filter(e=>A.some(t=>t.agents.includes(e.name))||ne.some(t=>t.agents.includes(e.name))).map(e=>{let t=z(e.name),n=A.filter(t=>t.agents.includes(e.name)).sort((t,n)=>t.name===e.prompt?-1:n.name===e.prompt?1:t.name.localeCompare(n.name)),r=ne.filter(t=>t.agents.includes(e.name));return(0,$.jsxs)(`section`,{"aria-labelledby":`agent-${e.name}`,className:`rounded-[14px] card border p-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(Nt,{agent:e.name,px:28,decorative:!0}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{id:`agent-${e.name}`,className:`m-0 text-[16px] font-semibold`,style:{color:t.hue},children:t.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.title})]}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[ot(n.length,`prompt`),r.length?` · ${r.length} yours`:``]}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Full prompt of ${t.name}`,"data-tip":`Full prompt of ${t.name}`,onClick:()=>M(e.name),children:(0,$.jsx)(Ie,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:[n.map(e=>(0,$.jsx)(kr,{p:e,agents:!1,onOpen:()=>j(e.name)},e.name)),r.map(e=>(0,$.jsx)(Ar,{t:e,onOpen:()=>(D(``),b({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))},e.name))]})]},e.name)})}),i===`all`&&(0,$.jsx)(Or,{label:`All prompts`,rows:A.map(e=>({key:e.name,name:e.name,about:Er(e.description||e.usedBy),agents:e.agents,state:(0,$.jsx)(wr,{p:e}),onOpen:()=>j(e.name)}))}),i===`team`&&(t.team.length===0?(0,$.jsx)(yt,{icon:oe,title:`No prompts of your own yet`,action:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add a prompt`,onClick:()=>b({name:``,description:``,agents:[],text:``}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]}),children:`Write instructions once for the agents that should follow them: "Tag every test with its Azure DevOps work item id" for Quill, or "Answer in British English" for Atlas. They are added at the end of those agents' instructions, saved in .forgeqe/prompts/team, and shared with the project.`}):(0,$.jsx)(Or,{label:`Your prompts`,rows:ne.map(e=>({key:e.name,name:e.name,about:e.description||e.text.split(`
|
|
4
|
-
`)[0]||``,agents:e.agents,mark:(0,$.jsx)(ve,{size:15,strokeWidth:1.8,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),state:(0,$.jsx)(`span`,{className:`rounded-full bg-pass-soft px-2 py-1 text-[13px] font-medium whitespace-nowrap text-pass`,children:`Yours`}),onOpen:()=>(D(``),b({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))}))})),(0,$.jsx)(G,{wide:!0,open:!!u,onClose:()=>d(null),title:u?.name||``,description:Er(P?.description||P?.usedBy||``),footer:(0,$.jsxs)($.Fragment,{children:[E&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail`,children:E}),P?.edited&&P.source===`project`&&(0,$.jsxs)(U,{disabled:w,onClick:()=>u&&N(()=>Je.resetPrompt(u.name),`${u.name} is ForgeQE's own prompt again.`,()=>d(null)),className:`mr-auto`,"data-tip":`Reset to ForgeQE's own prompt`,children:[(0,$.jsx)(g,{"aria-hidden":`true`}),`Reset`]}),(0,$.jsxs)(U,{onClick:()=>d(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:w||!u||f===u.text,onClick:()=>u&&N(()=>Je.savePrompt(u.name,f),`Saved your copy of ${u.name}.`,()=>d(null)),children:[(0,$.jsx)(k,{"aria-hidden":`true`}),w?`Saving…`:`Save`]})]}),children:u&&(()=>{let{head:e,body:t}=Tr(f);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Used by`}),(0,$.jsx)(`dd`,{className:`m-0`,children:P?(0,$.jsx)(Cr,{names:P.agents,max:8}):null}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Status`}),(0,$.jsx)(`dd`,{className:`m-0`,children:P?(0,$.jsx)(wr,{p:P}):null})]}),P?.edited&&P.source!==`project`&&(0,$.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2`,children:[`This prompt comes from a `,P.source,` copy; saving here makes a project copy, which the shared folder still wins over.`]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft pt-4`,children:[(0,$.jsx)(Qn,{label:`Show the prompt`,value:_,onChange:v,options:[{id:`read`,label:`Read`},{id:`edit`,label:`Edit`}]}),P?.edited&&(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>h(!m),"data-tip":m?`Hide ForgeQE's original`:`Compare with ForgeQE's original`,className:`inline-flex min-h-10 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[m?(0,$.jsx)(O,{"aria-hidden":`true`}):(0,$.jsx)(le,{"aria-hidden":`true`}),m?`Hide`:`Compare`]})]}),(0,$.jsx)(nn,{open:m,children:(0,$.jsx)(`div`,{className:`max-h-[40vh] overflow-auto rounded-[12px] bg-surface-muted p-4`,children:(0,$.jsx)(ln,{text:Dr(Tr(u.builtin).body),className:`text-[13px]`})})}),_===`read`?(0,$.jsx)(ln,{text:Dr(t),className:`text-[16px]`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`prompt-text`,className:`sr-only`,children:`Prompt`}),(0,$.jsx)(Ln,{id:`prompt-text`,value:t,lang:`markdown`,onChange:t=>p(e+t)}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Saved to `,(0,$.jsxs)(`span`,{className:`font-mono`,children:[`.forgeqe/prompts/`,u.name,`.md`]}),`; new chats and runs use it.`]})]})]})})()}),(0,$.jsx)(G,{wide:!0,open:!!y,onClose:()=>b(null),title:y?.existing?`Edit ${y.existing}`:`Add a prompt`,description:(0,$.jsxs)($.Fragment,{children:[`Added at the end of the chosen agents' instructions, from their next start. Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[`.forgeqe/prompts/team/`,y?.name||`name`,`.md`]}),`, shared with the project.`]}),footer:(0,$.jsxs)($.Fragment,{children:[E&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:E}),y?.existing&&(0,$.jsxs)(U,{disabled:w,onClick:()=>y.existing&&N(()=>Je.deleteTeamPrompt(y.existing),`Removed ${y.existing}.`,()=>b(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(s,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(U,{onClick:()=>b(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:w||!y?.name||!y.agents.length||!y.text.trim(),onClick:()=>y&&N(()=>y.existing?Je.saveTeamPrompt(y.existing,y):Je.addTeamPrompt(y),`${y.existing?`Saved`:`Added`} ${y.name}: ${y.agents.map(e=>z(e).name).join(`, `)} use it from their next start.`,()=>b(null)),children:[y?.existing?(0,$.jsx)(k,{"aria-hidden":`true`}):(0,$.jsx)(a,{"aria-hidden":`true`}),w?`Saving…`:y?.existing?`Save`:`Add`]})]}),children:y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,$.jsx)(H,{value:y.name,disabled:!!y.existing,placeholder:`tag-tests-with-work-items`,onChange:e=>b({...y,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,48)}),className:`font-mono`}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Lowercase letters, digits and dashes.`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`What it is for`}),(0,$.jsx)(H,{value:y.description,maxLength:200,placeholder:`Tests carry the work item they cover`,onChange:e=>b({...y,description:e.target.value})})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 p-0 font-medium`,children:`Agents that follow it`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:re.map(e=>{let t=y.agents.includes(e.name);return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,"data-tip":e.title,onClick:()=>b({...y,agents:t?y.agents.filter(t=>t!==e.name):[...y.agents,e.name]}),className:B(`inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-[8px] border px-4 text-[13px] font-medium`,t?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[(0,$.jsx)(Nt,{agent:e.name,px:18,decorative:!0}),z(e.name).name]},e.name)})})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Instructions`}),(0,$.jsx)(dt,{rows:14,spellCheck:!0,value:y.text,placeholder:`Tag every test with the Azure DevOps work item it covers, as [Property("WorkItem", "1234")].
|
|
5
|
-
If the request names no work item, ask for it.`,onChange:e=>b({...y,text:e.target.value}),className:`leading-[1.6]`}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Plain words, as you would tell a colleague. Use MUST for a rule the agent may never break.`})]})]})}),(0,$.jsx)(G,{wide:!0,open:!!S,onClose:()=>C(null),title:S?`${z(S.agent).name}: full prompt`:``,description:`What the agent starts with now: ForgeQE's prompt (or your edited copy), with the included parts and your prompts for it.`,footer:(0,$.jsxs)(U,{onClick:()=>C(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Close`]}),children:S&&(0,$.jsx)(ln,{text:Dr(Tr(S.text).body),className:`mt-4 text-[16px]`})})]})}var Mr={prebuilt:`ForgeQE's`,project:`This project`,user:`Yours`,external:`Claude / agent skill`,extra:`Shared folder`};function Nr({agents:e,max:t=6}){return(0,$.jsxs)(`span`,{className:`flex items-center -space-x-1`,children:[e.slice(0,t).map(e=>(0,$.jsx)(`span`,{role:`img`,"aria-label":z(e).name,"data-tip":z(e).name,className:`rounded-md bg-bg p-1 ring-1 ring-line-soft`,children:(0,$.jsx)(Nt,{agent:e,px:18,decorative:!0})},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`pl-2 text-[13px] text-muted`,children:[`+`,e.length-t]})]})}function Pr({edit:e}){let{data:n,error:i,reload:o}=Nn(Je.skills),c=Y(e.value,[`skills`,`disable`])||[],l=t=>e.set(q(e.value,[`skills`,`disable`],t.length?t:void 0)),[u,d]=(0,Q.useState)(`all`),[f,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)([]),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,ee]=(0,Q.useState)(``),te=f.toLowerCase().split(/\s+/).filter(Boolean),A=(0,Q.useMemo)(()=>(n?.skills||[]).filter(e=>te.every(t=>`${e.name} ${e.description} ${e.users.map(e=>z(e).name).join(` `)}`.toLowerCase().includes(t))),[n,f]),ne=async(e,t,n)=>{T(!0),D(``);try{await e(),n(),o(),ee(t)}catch(e){D(e.message)}finally{T(!1)}},j=async e=>{try{let t=await Je.skill(e.name);v({name:e.name,text:t.text,editable:t.editable})}catch(e){ee(e.message)}},M=(e,t)=>(b(t?[...y,t]:[]),j(e)),N=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();D(``),v(null),C({name:e.name,description:e.description,agents:e.agents,body:n,existing:e.name})},P=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();D(``),v(null),C({name:e.name,description:e.description,agents:e.agents,body:n,copyOf:e.name})},re=e=>n?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)||``,ie=e=>(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-px text-[13px] font-medium whitespace-nowrap`,e.source===`project`?`bg-pass-soft text-pass`:`bg-surface-strong text-muted`),children:Mr[e.source]||e.source}),ae=e=>{let t=!c.includes(e.name);return(0,$.jsx)(Un,{checked:t,onChange:t=>l(t?c.filter(t=>t!==e.name):[...c,e.name]),label:`Use ${e.name}`})},F=Y(e.value,[`skills`,`enabled`])!==!1,oe=(e,t)=>{let r=!c.includes(e.name);return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 hover:bg-surface-muted`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-label":`Read ${e.name}`,className:`flex min-w-0 cursor-pointer flex-col gap-1 border-0 bg-transparent p-0 text-left`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:B(`font-mono text-[13px] font-medium`,r?`text-ink`:`text-muted line-through`),children:e.name}),(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-px text-[13px] font-medium`,e.source===`project`?`bg-pass-soft text-pass`:`bg-surface-strong text-muted`),children:Mr[e.source]||e.source})]}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.description}),t&&(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,$.jsx)(Nr,{agents:e.users}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:n?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)})]})]}),(0,$.jsx)(Un,{checked:r,onChange:t=>l(t?c.filter(t=>t!==e.name):[...c,e.name]),label:`Use ${e.name}`})]},e.name)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`mb-4 rounded-[14px] card border`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":h,onClick:()=>g(!h),className:`flex min-h-12 w-full cursor-pointer items-center gap-4 rounded-[14px] border-0 bg-transparent px-4 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(Pe,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:`How skills are used`}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[F?`On`:`Off`,` · `,ot(c.length,`turned off`,`turned off`),` · `,String(Y(e.value,[`skills`,`browser_max_chars`])??6e3),` characters a browser run`]}),(0,$.jsx)(r,{size:16,"aria-hidden":`true`,className:B(`text-muted transition-transform`,!h&&`-rotate-90`)})]}),(0,$.jsx)(nn,{open:h,children:(0,$.jsx)(`div`,{className:`border-t border-line-soft px-4 pb-2`,children:(0,$.jsx)(X,{defs:Bn.fields,edit:e,base:Bn.base})})})]}),n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Qn,{label:`Show`,value:u,onChange:d,options:[{id:`agents`,label:`By agent`,n:n.audiences.length},{id:`all`,label:`All skills`,n:n.skills.length}]}),(0,$.jsx)(gt,{id:`find-a-skill`,label:`Find a skill`,value:f,onChange:m,placeholder:`Find a skill or agent`}),(0,$.jsxs)(U,{variant:`primary`,"data-tip":`Add a skill`,onClick:()=>(D(``),C({name:``,description:``,agents:[],body:``})),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),O&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 mb-4 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2`,children:O}),n.skills.length===0&&(0,$.jsx)(zn,{children:`No skills found. Add one for your framework, conventions or app.`}),u===`agents`&&n.audiences.map(e=>{let t=A.filter(t=>t.agents.includes(e.id));return!t.length&&te.length?null:(0,$.jsxs)(`section`,{"aria-labelledby":`aud-${e.id}`,className:`mb-4 rounded-[14px] card border p-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(Nr,{agents:e.agents,max:8}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{id:`aud-${e.id}`,className:`m-0 text-[16px] font-semibold`,children:e.label}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.agents.map(e=>z(e).name).filter((e,t,n)=>n.indexOf(e)===t).join(`, `)})]}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:ot(t.length,`skill`)})]}),(0,$.jsx)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:t.length?t.map(e=>oe(e,!1)):(0,$.jsx)(`p`,{className:`m-0 px-4 py-2 text-[13px] text-muted`,children:`No skills for them yet.`})})]},e.id)}),u===`all`&&n.skills.length>0&&(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(sn,{label:`All skills`,search:!1,empty:`No skill matches.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,className:B(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Who uses it`}),(0,$.jsx)(`th`,{scope:`col`,className:B(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`From`}),(0,$.jsx)(`th`,{scope:`col`,className:B(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`text-right`),children:`On`})]}),children:A.map(e=>{let t=!c.includes(e.name);return(0,$.jsxs)(`tr`,{onClick:()=>M(e),className:`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:t=>(t.stopPropagation(),M(e)),className:B(`cursor-pointer border-0 bg-transparent p-0 text-left font-mono text-[13px] font-medium hover:underline`,t?`text-ink`:`text-muted line-through`),children:e.name}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-[13px] text-muted`,children:e.description})]}),(0,$.jsx)(`td`,{className:B(`px-4 py-2`,`hidden w-[30%] @2xl:table-cell`),children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(Nr,{agents:e.users,max:4}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:re(e)})]})}),(0,$.jsx)(`td`,{className:B(`px-4 py-2`,`hidden w-[1%] @xl:table-cell`),children:ie(e)}),(0,$.jsx)(`td`,{className:B(`px-4 py-2`,`w-[1%] text-right`),onClick:e=>e.stopPropagation(),children:ae(e)})]},e.name)})})}),n.problems.length?(0,$.jsx)(`div`,{role:`alert`,className:`mt-4 rounded-[12px] bg-warn-soft px-4 py-4 text-sm text-warn`,children:n.problems.map(e=>(0,$.jsx)(`p`,{className:`m-0`,children:e},e))}):null]}):(0,$.jsx)(En,{error:i,reload:o}),(0,$.jsx)(G,{wide:!0,open:!!_,onClose:()=>v(null),title:_?.name||``,description:_?.editable?`This project's own skill: you can edit it.`:`ForgeQE's skill: read only. Copy it to edit your own version for this project.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{onClick:()=>v(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Close`]}),_?.editable&&(0,$.jsxs)(U,{variant:`primary`,onClick:()=>_&&n&&N(n.skills.find(e=>e.name===_.name),_.text),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),`Edit`]}),_&&!_.editable&&(0,$.jsxs)(U,{variant:`primary`,"data-tip":`Your copy replaces this skill in this project`,onClick:()=>_&&n&&P(n.skills.find(e=>e.name===_.name),_.text),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Copy to edit`]})]}),children:_&&n&&(()=>{let e=n.skills.find(e=>e.name===_.name),t=y[y.length-1],r=t?n.skills.find(e=>e.name===t):void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[r&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>(b(y.slice(0,-1)),void j(r)),"data-tip":`Back to ${r.name}`,className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[(0,$.jsx)(be,{"aria-hidden":`true`}),`Back`]}),e&&(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_minmax(0,1fr)] items-start gap-x-4 gap-y-2 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Use when`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink-2`,children:e.description.replace(/^Use when\s+/i,``)}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Who uses it`}),(0,$.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(Nr,{agents:e.users,max:8}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:re(e)})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsx)(`dd`,{className:`m-0`,children:ie(e)}),(0,$.jsx)(`dt`,{className:`self-center text-muted`,children:`On`}),(0,$.jsx)(`dd`,{className:`m-0`,children:ae(e)})]}),(0,$.jsx)(`div`,{className:`border-t border-line-soft pt-4`,children:(0,$.jsx)(ln,{text:Dr(Tr(_.text).body),className:`text-[16px]`,refs:{names:n.skills.map(e=>e.name).filter(e=>e!==_.name),open:e=>{let t=n.skills.find(t=>t.name===e);t&&M(t,_.name)}}})})]})})()}),(0,$.jsx)(G,{wide:!0,open:!!S,onClose:()=>C(null),title:S?.existing?`Edit ${S.existing}`:S?.copyOf?`Copy ${S.copyOf}`:`Add a skill`,description:(0,$.jsxs)($.Fragment,{children:[S?.copyOf&&S.name===S.copyOf&&(0,$.jsxs)($.Fragment,{children:[`Replaces ForgeQE's `,S.copyOf,` in this project. `]}),`Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[`.forgeqe/skills/`,S?.name||`name`,`/SKILL.md`]}),`, shared with the project. The agents read a skill when its "use when" matches the work.`]}),footer:(0,$.jsxs)($.Fragment,{children:[E&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:E}),S?.existing&&(0,$.jsxs)(U,{disabled:w,onClick:()=>S.existing&&ne(()=>Je.removeSkill(S.existing),`Removed ${S.existing}.`,()=>C(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(s,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(U,{onClick:()=>C(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:w||!S?.name||!S.description.trim()||!S.agents.length||!!S.existing&&!S.body.trim(),onClick:()=>S&&ne(()=>S.existing?Je.saveSkill(S.existing,S):Je.addSkill(S),S.existing?`Saved ${S.name}.`:S.copyOf&&S.name===S.copyOf?`Copied ${S.name}: yours is used in this project.`:`Added ${S.name}.`,()=>C(null)),children:[S?.existing?(0,$.jsx)(k,{"aria-hidden":`true`}):(0,$.jsx)(a,{"aria-hidden":`true`}),w?`Saving…`:S?.existing?`Save`:S?.copyOf&&S.name===S.copyOf?`Save copy`:`Add`]})]}),children:S&&n&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,$.jsx)(H,{value:S.name,disabled:!!S.existing,placeholder:`sap-fiori`,onChange:e=>C({...S,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,64)}),className:`font-mono`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Use when`}),(0,$.jsx)(H,{value:S.description,placeholder:`Use when the site is SAP Fiori: tiles, smart tables, value help dialogs.`,onChange:e=>C({...S,description:e.target.value})}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The agents choose skills by this line: say when it applies.`})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 p-0 font-medium`,children:`Who it is for`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.audiences.map(e=>{let t=S.agents.includes(e.id);return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,onClick:()=>C({...S,agents:t?S.agents.filter(t=>t!==e.id):[...S.agents,e.id]}),className:B(`inline-flex min-h-10 cursor-pointer items-center gap-2 rounded-[8px] border px-4 text-[13px] font-medium`,t?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[(0,$.jsx)(Nr,{agents:e.agents,max:3}),e.label]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`skill-text`,className:`font-medium`,children:`Instructions`}),(0,$.jsx)(Ln,{id:`skill-text`,value:S.body,lang:`markdown`,onChange:e=>C({...S,body:e})}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[S.existing?``:`Leave it empty to start from ForgeQE's outline for that agent. `,`Markdown; short rules the agent can follow step by step.`]})]})]})})]})}function Fr({checked:e,onSelect:t,label:n}){return(0,$.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":n,onClick:t,className:B(`relative inline-flex size-4 flex-none cursor-pointer items-center justify-center rounded-full border-[1.5px] bg-bg p-0 before:absolute before:-inset-2.5 before:content-['']`,e?`border-accent`:`border-muted`),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,className:B(`size-2 rounded-full`,e?`bg-accent`:`bg-transparent`)})})}function Ir(e,t,n){return e?/^[A-Za-z0-9_-][A-Za-z0-9_.-]*$/.test(e)?e!==t&&n.includes(e)?`There is already an environment called ${e}.`:``:`Letters, digits, dots, dashes and underscores only.`:`Give it a name.`}var Lr=/^[A-Za-z_][A-Za-z0-9_]*$/,Rr=/\.(csv|tsv|json|ya?ml|xlsx|xls|xml|sql|txt)$/i;function zr(e){for(let[t,n]of Object.entries(e)){if(!Lr.test(t))return`${t||`A test data file`}: the name is letters, digits and _`;let e=String(n??``).trim();if(!e)return`${t}: pick its file`;if(!Rr.test(e)||e.startsWith(`/`)||/^[A-Za-z]:/.test(e)||e.split(/[\\/]/).some(e=>e===`..`||e.startsWith(`.`)))return`${t}: a data file of the project (.csv, .json, .yaml, .xlsx…)`}return``}var Br=e=>{if(!(`data`in e))return`data`;for(let t=2;;t++)if(!(`data_${t}`in e))return`data_${t}`},Vr=e=>(e.split(/[\\/]/).pop()||``).replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9_]+/g,`_`).replace(/^(?=\d)/,`_`)||`data`,Hr={azure:{subscription:[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,`a subscription id, a GUID`],tenant:[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,`a tenant id, a GUID`],resource_group:[/^[A-Za-z0-9_.()-]{0,89}[A-Za-z0-9_()-]$/,`a resource group's name`]},aws:{account:[/^\d{12}$/,`a 12-digit account id`],region:[/^[a-z]{2}(?:-[a-z]+){1,2}-\d{1,2}$/,`a region such as eu-west-1`],profile:[/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/,`a profile's name`]},gcp:{project:[/^[a-z][a-z0-9-]{4,28}[a-z0-9]$/,`a project id`],region:[/^[a-z]+-[a-z]+\d{1,2}$/,`a region such as europe-west1`]}},Ur={azure:[`subscription`,`Azure`,`subscription id`],aws:[`account`,`AWS`,`account id`],gcp:[`project`,`Google Cloud`,`project id`]};function Wr(e){for(let[t,n]of Object.entries(e)){let e=Hr[t];if(!e||!n||typeof n!=`object`)continue;let r=n,[i,a,o]=Ur[t];if(Object.values(r).some(e=>String(e??``).trim())&&!String(r[i]??``).trim())return`${a}: give its ${o}`;for(let[t,n]of Object.entries(r)){let r=String(n??``).trim(),i=e[t];if(r&&i&&!i[0].test(r))return`${a}: ${i[1]}`}}return``}var Gr=[[`web`,`Web`],[`api`,`API`],[`desktop`,`Windows desktop`],[`mobile`,`Mobile`]],Kr={web:M,api:pe,desktop:N,mobile:de};function qr(e){let t=String(e.kind||`web`),n=[{key:`kind`,label:`Kind`,type:`select`,default:`web`,options:Gr.map(([e,t])=>({value:e,label:t}))}];return(t===`web`||t===`api`)&&n.push({key:`url`,label:`Address`,type:`url`,placeholder:t===`api`?`https://qa.api.example.com/v1`:`https://qa.shop.example.com`}),t===`desktop`&&n.push({key:`path`,label:`Program`,type:`path`,placeholder:`C:\\Program Files\\Contoso\\Billing\\Billing.exe`},{key:`args`,label:`Arguments`,help:`Comma separated.`,type:`list`,placeholder:`--server, qa-db01`}),t===`mobile`&&n.push({key:`platform`,label:`Platform`,type:`select`,options:[{value:`android`,label:`Android`},{value:`ios`,label:`iOS`}]},{key:`app_id`,label:`App id`,type:`path`,placeholder:`com.contoso.courier`},{key:`activity`,label:`Activity`,help:`Android: the activity to start.`,type:`path`,placeholder:`.MainActivity`},{key:`app`,label:`Build to install`,help:`An .apk or .ipa, an https address, or bs://…`,type:`path`}),n.push({key:`description`,label:`Description`,help:`The agent picks apps by this, so say what the app is for.`,type:`text`}),t===`web`&&n.push({key:`login`,label:`Sign-in`,help:`A sign-in from Sign-ins.`,type:`text`,placeholder:`shop-qa`}),n}function Jr({value:e,onChange:t}){let n=Object.entries(e);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-surface-strong py-4`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Variables`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Plain values tests read as FORGEQE_VAR_NAME. No secrets here: list those under Secrets.`}),n.map(([n,r],i)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(H,{"aria-label":`Variable name`,value:n,spellCheck:!1,onChange:r=>t(Gn(e,n,r.target.value)),className:`max-w-[200px] flex-[1_1_140px] font-mono`}),(0,$.jsx)(H,{"aria-label":`Value of ${n}`,value:String(r??``),onChange:r=>t({...e,[n]:r.target.value}),className:`flex-[2_1_200px]`}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${n}`,"data-tip":`Remove ${n}`,onClick:()=>{let r={...e};delete r[n],t(r)},children:(0,$.jsx)(s,{"aria-hidden":`true`})})]},i)),(0,$.jsx)(`div`,{children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add a variable`,onClick:()=>t({...e,[Tn(e,`name`)]:``}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})})]})}function Yr({value:e,onChange:t}){let n=Array.isArray(e)?e.map(String):[],[r,i]=(0,Q.useState)(``),o=/^[A-Za-z_][A-Za-z0-9_]*$/.test(r.trim());return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-surface-strong py-4`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Secrets`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Passwords and keys this environment's tests and desktop flows read, by name. Their values are kept in your credential store.`}),n.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-line-soft pt-2`,children:[(0,$.jsx)(`code`,{className:`w-full font-mono text-[13px] sm:w-[200px]`,children:e}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(un,{name:e,field:e,compact:!0})}),(0,$.jsx)(qt,{name:e}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Stop using ${e} here`,"data-tip":`Stop using ${e} here`,onClick:()=>t(n.filter(t=>t!==e)),children:(0,$.jsx)(s,{"aria-hidden":`true`})})]},e)),(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&!n.includes(r.trim())&&t([...n,r.trim()]),i(``)},children:[(0,$.jsx)(H,{"aria-label":`Secret's variable name`,value:r,placeholder:`BILLING_PASSWORD_QA`,spellCheck:!1,onChange:e=>i(e.target.value),className:`max-w-[280px] flex-[1_1_200px] font-mono`}),(0,$.jsxs)(U,{size:`sm`,type:`submit`,disabled:!o,"data-tip":`Add a secret`,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]})]})}var Xr=(e,t)=>(t.startsWith(e)?t.slice(e.length).replace(/^[\\/]+/,``):t).replace(/\\/g,`/`);function Zr({envs:e,layout:t,files:n,base:r,onSplit:i,splitBlocked:o,config:c}){let[l,u]=(0,Q.useState)(null),d=t.layout===`dir`?Xr(r,t.dir):``,f=e=>{let t=n.find(t=>t.name===e);return t?Xr(r,t.path):`${d}/${e}.yaml`},m=K(e.value.environments),h=Object.keys(m),g=typeof e.value.default==`string`?e.value.default:h[0]||``;return(0,$.jsxs)($.Fragment,{children:[c&&(0,$.jsx)(`div`,{className:`mb-6`,children:t.layout===`dir`?(0,$.jsx)(gn,{def:{key:`dir`,label:`Environments folder`,help:`One YAML file per environment, named after it. Relative to forgeqe.yaml; read from there after you save.`,type:`path`,placeholder:`./environments`},edit:c,base:[`environments`]}):(0,$.jsx)(gn,{def:{key:`file`,label:`Environments file`,help:`All environments in one YAML file. Relative to forgeqe.yaml; read from there after you save. --env NAME or FORGEQE_ENV picks one for a run.`,type:`path`,default:`./env.yaml`},edit:c,base:[`environments`]})}),t.layout===`file`?(0,$.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-x-4 gap-y-4 rounded-[14px] bg-surface-muted px-6 py-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 flex-[1_1_300px] text-sm leading-relaxed text-ink-2`,children:[`All environments are in one file, `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:Xr(r,t.file)}),`. One file per environment is easier to change and review: each goes into`,` `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:`environments/`}),`, and the old file is left as it is.`,o&&(0,$.jsx)(`span`,{className:`mt-1 block text-muted`,children:o})]}),(0,$.jsxs)(U,{size:`sm`,onClick:i,disabled:!!o,"data-tip":`Split into one file each`,children:[(0,$.jsx)(p,{"aria-hidden":`true`}),`Split`]})]}):(0,$.jsxs)(`p`,{className:`mt-0 mb-4 text-sm leading-relaxed text-ink-2`,children:[`Each environment is its own file in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[d,`/`]}),`. The active one is set in forgeqe.yaml.`]}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`The active one is used when a run names none.`}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add an environment`,onClick:()=>u({mode:`add`,from:``,name:Tn(m,h.length?`new-environment`:`qa`),env:{description:``,apps:{}}}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Active environment`,children:[h.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`No environments yet. Add one with the apps your tests use.`}),h.map(r=>{let i=K(m[r]),a=K(i.apps);return(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Fr,{checked:g===r,onSelect:()=>e.set({...e.value,default:r}),label:`Use ${r}`}),title:r,meta:(0,$.jsxs)($.Fragment,{children:[[i.description,typeof i.file==`string`?`reads ${i.file}`:`${Object.keys(a).length} app${Object.keys(a).length===1?``:`s`}`,Object.keys(K(i.data)).length?`${Object.keys(K(i.data)).length} test data file${Object.keys(K(i.data)).length===1?``:`s`}`:``].filter(Boolean).map(String).join(`, `),t.layout===`dir`&&(0,$.jsxs)(`span`,{className:`block font-mono text-[13px]`,children:[f(r),n.some(e=>e.name===r)?``:` (new)`]})]}),state:g===r?(0,$.jsx)(`span`,{className:`text-sm text-pass`,children:`Active`}):void 0,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${r}`,"data-tip":`Edit ${r}`,onClick:()=>u({mode:`edit`,from:r,name:r,env:i}),children:(0,$.jsx)(p,{"aria-hidden":`true`})}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${r}`,"data-tip":`Remove ${r}`,onClick:()=>{let t={...m};delete t[r];let n={...e.value,environments:t};g===r&&delete n.default,e.set(n)},children:(0,$.jsx)(s,{"aria-hidden":`true`})})]}),children:null},r)})]}),(0,$.jsx)(Qr,{panel:l,setPanel:u,taken:h,vars:e.vars,dirLayout:t.layout===`dir`,onApply:t=>{t.mode===`add`?e.set({...e.value,...h.length?{}:{default:t.name},environments:{...m,[t.name]:t.env}}):e.set({...e.value,...g===t.from&&e.value.default!==void 0?{default:t.name}:{},environments:{...Gn(m,t.from,t.name),[t.name]:t.env}})}})]})}function Qr({panel:e,setPanel:t,taken:n,vars:r,dirLayout:i,onApply:o}){let[c,l]=(0,Q.useState)(``),d=e?K(e.env):{},f=K(d.apps),p=n=>e&&t({...e,env:n}),m={value:d,set:p,vars:r},h=Object.entries(f).filter(([,e])=>(K(e).kind||`web`)===`web`),g=Object.entries(f).filter(([,e])=>K(e).kind===`api`),_=typeof d.file==`string`?String(d.file):``,v=K(d.data),y=e?Ir(e.name,e.from,n):``,b=K(d.cloud),S=zr(v)||Wr(b),[C,w]=(0,Q.useState)([]),T=()=>{t(null),l(``),w([])},E=(e,t)=>{p({...e,...e.data?{}:Object.keys(v).length?{data:v}:{},...e.cloud?{}:Object.keys(b).length?{cloud:b}:{},...!e.description&&d.description?{description:d.description}:{}}),l(``),w(t.length?[`Secret values written in the YAML were left out (${t.join(`, `)}): put each in an environment variable and add its name under Secrets.`]:[])};return(0,$.jsx)(G,{wide:!0,open:!!e,onClose:T,title:e?.mode===`add`?`Add an environment`:`Edit ${e?.from}`,description:`The apps, values and secrets tests use in one place, such as QA or staging. Changes apply when you press the button below; a secret's value goes to your credential store as you type it.`,footer:(0,$.jsxs)($.Fragment,{children:[(y||S)&&(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:y?`Needs a valid name`:S}),(0,$.jsxs)(U,{onClick:T,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!!y||!!S,onClick:()=>{o(e),T()},children:[e?.mode===`add`?(0,$.jsx)(a,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),e?.mode===`add`?`Add`:`Done`]})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Name`,help:y?(0,$.jsx)(`span`,{className:`text-fail`,children:y}):i?`Also its file's name. Pick it with --env NAME or FORGEQE_ENV.`:`Pick it with --env NAME or FORGEQE_ENV.`,htmlFor:`env-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(H,{id:`env-name`,value:e.name,spellCheck:!1,placeholder:`qa`,"aria-invalid":!!y,onChange:n=>t({...e,name:n.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(X,{defs:[{key:`description`,label:`Description`,type:`text`}],edit:m,base:[],stacked:!0}),(0,$.jsx)($r,{name:e.name,linked:_,onFill:E,onLink:e=>p({file:e,...d.description?{description:d.description}:{},...Object.keys(v).length?{data:v}:{},...Object.keys(b).length?{cloud:b}:{}})}),C.map(e=>(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 mb-0 flex items-start gap-2 text-sm leading-relaxed text-warn`,children:[(0,$.jsx)(pt,{icon:u,size:16,className:`mt-1 flex-none`}),e]},e)),_?(0,$.jsx)(ei,{file:_,name:e.name,onCopy:E}):(0,$.jsxs)($.Fragment,{children:[h.length>1&&(0,$.jsx)(gn,{def:{key:`start_app`,label:`Start app`,help:`Where browser runs start when no app or address is given.`,type:`select`,options:h.map(([e])=>({value:e,label:e}))},edit:m,base:[],stacked:!0}),g.length>1&&(0,$.jsx)(gn,{def:{key:`api_app`,label:`API app`,help:`The API that API tests call.`,type:`select`,options:g.map(([e])=>({value:e,label:e}))},edit:m,base:[],stacked:!0}),(0,$.jsx)(Z,{children:`Apps`}),Object.keys(f).length===0&&(0,$.jsx)(`p`,{className:`m-0 pb-2 text-sm text-muted`,children:`No apps yet: add the web pages, APIs and programs tests use here.`}),Object.entries(f).map(([e,t],n)=>{let i=K(t);return(0,$.jsxs)(Cn,{lead:(0,$.jsx)(Kn,{icon:Kr[String(i.kind||`web`)]||M,logo:i.kind===`mobile`?bn[String(i.platform)]:i.kind===`desktop`?bn.windows:void 0}),title:e,meta:[Gr.find(([e])=>e===(i.kind||`web`))?.[1],i.url||i.path||i.app_id].filter(Boolean).map(String).join(`, `),open:c===String(n),onToggle:()=>l(c===String(n)?``:String(n)),actions:(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e}`,"data-tip":`Remove ${e}`,onClick:()=>{let t={...f};delete t[e],p({...d,apps:t})},children:(0,$.jsx)(s,{"aria-hidden":`true`})}),children:[(0,$.jsx)(J,{label:`Name`,htmlFor:`app-${n}`,stacked:!0,children:(0,$.jsx)(H,{id:`app-${n}`,defaultValue:e,spellCheck:!1,onBlur:t=>{let n=t.target.value.trim();n&&n!==e&&/^[A-Za-z0-9_.-]+$/.test(n)&&!(n in f)?p({...d,apps:Gn(f,e,n)}):t.target.value=e},className:`font-mono`})}),(0,$.jsx)(X,{defs:qr(i),edit:{value:i,set:t=>p({...d,apps:{...f,[e]:t}}),vars:r},base:[],stacked:!0})]},n)}),(0,$.jsx)(`div`,{className:`border-t border-line-soft py-4`,children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add an app`,onClick:()=>{p({...d,apps:{...f,[Tn(f,`app`)]:{kind:`web`}}}),l(String(Object.keys(f).length))},children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})}),(0,$.jsx)(Jr,{value:K(d.variables),onChange:e=>p(q(d,[`variables`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(Yr,{value:d.secrets,onChange:e=>p(q(d,[`secrets`],e.length?e:void 0))})]}),(0,$.jsx)(ri,{value:v,onChange:e=>p(q(d,[`data`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(ni,{edit:m})]})})}function $r({name:e,linked:t,onFill:n,onLink:r}){let[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(``),x=(0,Q.useRef)(null),S=(0,Q.useId)(),C=(0,Q.useId)();(0,Q.useEffect)(()=>{i===`link`&&_===null&&at.files(`yaml`).then(e=>v(e.files)).catch(e=>d(e.message))},[i,_]);let w=(e,t)=>{n(K(e.environments[t]),e.literalByEnv[t]||[]),p(null),a(``),s(``)},T=async t=>{l(!0),d(``);try{let n=await at.convert(t,e),r=Object.keys(n.environments);r.length===1?w(n,r[0]):r.includes(e)?w(n,e):(p(n),g(n.default&&r.includes(n.default)?n.default:r[0]))}catch(e){d(e.message)}finally{l(!1)}};return(0,$.jsxs)(`div`,{className:`mt-6 flex flex-col gap-4 rounded-[12px] bg-surface-muted px-4 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] font-medium text-ink`,children:[(0,$.jsx)(pt,{icon:Ce,size:16,className:`text-muted`}),t?`Read from your team's YAML`:`Start from your team's YAML`]}),(0,$.jsx)(`span`,{className:`text-[13px] leading-relaxed text-ink-2`,children:`Any layout works: ForgeQE finds the addresses, programs, values and secret names in it. Secret values are never copied.`})]}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`How to bring the YAML in`,className:`flex flex-wrap gap-2`,children:(0,$.jsx)(vt,{items:[{id:`paste`,label:`Paste`,icon:h},{id:`import`,label:`Import a file`,icon:P},{id:`link`,label:`Link a project file`,icon:Te}],value:i,onChange:e=>{a(i===e?``:e),d(``),p(null)}})}),i===`paste`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:S,className:`text-[13px] text-ink-2`,children:`The environment's YAML, or a file of several`}),(0,$.jsx)(dt,{id:S,rows:8,spellCheck:!1,value:o,placeholder:`base_url: https://qa.shop.example.com
|
|
6
|
-
db_server: qa-db01
|
|
7
|
-
admin_password: \${ADMIN_PASSWORD_QA}`,onChange:e=>s(e.target.value),className:`font-mono leading-[1.6]`}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!o.trim()||c,"data-tip":`Fill in the fields`,onClick:()=>T({text:o}),children:[(0,$.jsx)(k,{"aria-hidden":`true`}),c?`Reading…`:`Fill in`]})})]}),i===`import`&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:`.yaml,.yml,.json`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){if(t.size>262144)return d(`${t.name} is over 256 KB.`);await T({text:await t.text()})}}}),(0,$.jsxs)(U,{size:`sm`,disabled:c,"data-tip":`Choose a YAML file`,onClick:()=>x.current?.click(),children:[(0,$.jsx)(P,{"aria-hidden":`true`}),c?`Reading…`:`Choose`]}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`From anywhere on this computer; its fields are copied here.`})]}),i===`link`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:C,className:`text-[13px] text-ink-2`,children:`A YAML file in the project. ForgeQE reads it every run, so the team keeps changing it there.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(V,{id:C,value:y,onChange:e=>b(e.target.value),disabled:!_?.length,className:`min-w-0 flex-[1_1_280px] font-mono`,children:[(0,$.jsx)(`option`,{value:``,children:_===null?`Looking for YAML files…`:_.length?`Pick a file`:`No YAML files in the project`}),(_||[]).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!y,onClick:()=>{r(y),a(``)},"data-tip":`Link a project file`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),`Link`]})]})]}),f&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`The YAML has `,Object.keys(f.environments).join(`, `),`. Fill in from`]}),(0,$.jsx)(V,{"aria-label":`Which environment to fill in from`,value:m,onChange:e=>g(e.target.value),className:`max-w-[220px] flex-[0_1_200px]`,children:Object.keys(f.environments).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),(0,$.jsxs)(U,{size:`sm`,variant:`primary`,"data-tip":`Fill in from ${m}`,onClick:()=>w(f,m),children:[(0,$.jsx)(k,{"aria-hidden":`true`}),`Fill in`]})]}),u&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail`,children:u})]})}function ei({file:e,name:n,onCopy:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let t=!0;return a(null),s(``),at.convert({file:e},n).then(e=>{let r=K(e.environments[n]??Object.values(e.environments)[0]);t&&a({env:r,literal:e.literalByEnv[n]??Object.values(e.literalByEnv)[0]??[]})}).catch(e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let c=Object.entries(K(i?.env.apps)),l=Object.entries(K(i?.env.variables)),d=Array.isArray(i?.env.secrets)?i.env.secrets.map(String):[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:(0,$.jsxs)($.Fragment,{children:[`Read from `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e}),` every run; change them in that file.`]}),children:`What ForgeQE reads`}),o&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail`,children:o}),!i&&!o&&(0,$.jsxs)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:[`Reading `,e,`…`]}),i&&(0,$.jsxs)(`dl`,{className:`m-0 flex flex-col`,children:[(0,$.jsx)(`dt`,{className:`border-t border-line-soft pt-4 text-[13px] font-medium text-muted`,children:`Apps`}),(0,$.jsxs)(`dd`,{className:`m-0 flex flex-col gap-2 pt-2 pb-4`,children:[c.length===0&&(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`None found`}),c.map(([e,t])=>{let n=K(t);return(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(Kn,{icon:Kr[String(n.kind||`web`)]||M}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e}),(0,$.jsx)(`span`,{className:`text-sm break-all text-muted`,children:[Gr.find(([e])=>e===(n.kind||`web`))?.[1],n.url||n.path||n.app_id].filter(Boolean).map(String).join(`, `)})]})]},e)})]}),(0,$.jsx)(`dt`,{className:`border-t border-line-soft pt-4 text-[13px] font-medium text-muted`,children:`Values`}),(0,$.jsx)(`dd`,{className:`m-0 pt-2 pb-4 text-sm`,children:l.length?(0,$.jsx)(`span`,{className:`flex flex-col gap-1`,children:l.map(([e,t])=>(0,$.jsxs)(`span`,{className:`break-all`,children:[(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e}),` `,(0,$.jsx)(`span`,{className:`text-muted`,children:`=`}),` `,String(t)]},e))}):(0,$.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,$.jsx)(`dt`,{className:`border-t border-line-soft pt-4 text-[13px] font-medium text-muted`,children:`Secrets, by name`}),(0,$.jsx)(`dd`,{className:`m-0 pt-2 pb-4 text-sm`,children:d.length?(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:d.join(`, `)}):(0,$.jsx)(`span`,{className:`text-muted`,children:`None`})})]}),i?.literal.length?(0,$.jsxs)(`p`,{className:`m-0 flex items-start gap-2 text-sm leading-relaxed text-warn`,children:[(0,$.jsx)(pt,{icon:u,size:16,className:`mt-1 flex-none`}),`The file has secret values written in (`,i.literal.join(`, `),`). They are not used: move each to an environment variable.`]}):null,(0,$.jsx)(`div`,{className:`border-t border-line-soft py-4`,children:(0,$.jsxs)(U,{size:`sm`,disabled:!i,"data-tip":`Copy into fields instead`,onClick:()=>i&&r(i.env,i.literal),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Copy`]})})]})}var ti=[{id:`azure`,title:`Azure`,note:`Tests read these as FORGEQE_CLOUD_AZURE_SUBSCRIPTION_ID, _TENANT_ID and _RESOURCE_GROUP.`,fields:[{key:`subscription`,label:`Subscription id`,type:`path`,placeholder:`00000000-0000-0000-0000-000000000000`},{key:`tenant`,label:`Tenant id`,type:`path`,placeholder:`00000000-0000-0000-0000-000000000000`},{key:`resource_group`,label:`Resource group`,type:`path`,placeholder:`rg-shop-qa`}]},{id:`aws`,title:`AWS`,note:`Tests read these as FORGEQE_CLOUD_AWS_ACCOUNT_ID, _REGION and _PROFILE.`,fields:[{key:`account`,label:`Account id`,help:`12 digits.`,type:`path`,placeholder:`123456789012`},{key:`region`,label:`Region`,type:`path`,placeholder:`eu-west-1`},{key:`profile`,label:`Profile`,help:`A profile in ~/.aws/config on the computers that run the tests.`,type:`path`,placeholder:`shop-qa`}]},{id:`gcp`,title:`Google Cloud`,note:`Tests read these as FORGEQE_CLOUD_GCP_PROJECT and _REGION.`,fields:[{key:`project`,label:`Project id`,type:`path`,placeholder:`shop-qa-123`},{key:`region`,label:`Region`,type:`path`,placeholder:`europe-west1`}]}];function ni({edit:e}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:w,help:`Where this environment's cloud resources are, so the agents look in the right account and tests read it instead of a fixed id. Identifiers only: sign-ins stay with each cloud's own tools.`,children:`Cloud accounts`}),ti.map(t=>{let n=Wr({[t.id]:K(K(e.value.cloud)[t.id])});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-surface-strong py-4`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t.title}),n?(0,$.jsx)(`span`,{className:`text-sm text-fail`,children:n}):(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:t.note}),(0,$.jsx)(X,{defs:t.fields,edit:e,base:[`cloud`,t.id],stacked:!0})]},t.id)})]})}function ri({value:e,onChange:t}){let[n,r]=(0,Q.useState)([]),i=(0,Q.useId)();(0,Q.useEffect)(()=>{at.files(`data`).then(e=>r(e.files)).catch(()=>r([]))},[]);let o=Object.entries(e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:I,help:`Files of rows this environment's tests use, so one test reads QA's rows in QA and UAT's in UAT. Each file's path is in FORGEQE_DATA_<NAME>, from the folder of forgeqe.yaml.`,children:`Test data`}),(0,$.jsx)(`datalist`,{id:i,children:n.map(e=>(0,$.jsx)(`option`,{value:e},e))}),o.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-4 text-sm text-muted`,children:`No test data files yet.`}),o.map(([n,r],a)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(H,{"aria-label":`Data name`,value:n,spellCheck:!1,"aria-invalid":!Lr.test(n),onChange:r=>t(Gn(e,n,r.target.value)),className:`max-w-[180px] flex-[1_1_140px] font-mono`}),(0,$.jsx)(H,{"aria-label":`File of ${n}`,list:i,value:String(r??``),spellCheck:!1,placeholder:`test-data/qa/customers.csv`,onChange:r=>{let i=r.target.value,a=/^data(_\d+)?$/.test(n)&&i&&!(Vr(i)in e)?Vr(i):n;t({...Gn(e,n,a),[a]:i})},className:`flex-[2_1_220px] font-mono`}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${n}`,"data-tip":`Remove ${n}`,onClick:()=>{let r={...e};delete r[n],t(r)},children:(0,$.jsx)(s,{"aria-hidden":`true`})})]},a)),(0,$.jsx)(`div`,{className:`border-t border-line-soft py-4`,children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add a data file`,onClick:()=>t({...e,[Br(e)]:``}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})})]})}var ii=[{name:`forgeqe`,label:`Atlas (shell, forgeqe run, forgeqe mcp)`,area:`agent`},{name:`engine`,label:`WebPilot (browser, desktop and mobile runs)`,area:`browser`},{name:`forgeqe-test`,label:`Quill: writes tests`,area:`coding`},{name:`forgeqe-heal`,label:`Mender: heals tests`,area:`coding`},{name:`forgeqe-migrate`,label:`Mover: migrates test suites`,area:`coding`},{name:`forgeqe-tosca`,label:`Bridge: converts Tosca test cases`,area:`coding`},{name:`forgeqe-tosca-assistant`,label:`Guide: sets up a Tosca conversion`,area:`planning`},{name:`forgeqe-api`,label:`Link: writes API and contract tests`,area:`coding`},{name:`forgeqe-review`,label:`Checker: reviews Quill's tests`,area:`review`},{name:`forgeqe-pr-review`,label:`Patch: reviews pull requests`,area:`review`},{name:`forgeqe-judge`,label:`Gavel: judges domain evaluations`,area:`review`},{name:`forgeqe-defect-rca`,label:`Sleuth: root cause of defects`,area:`analysis`},{name:`forgeqe-refine`,label:`Polish: refines requests`,area:`planning`},{name:`forgeqe-find`,label:`Hound: finds the tests a request means`,area:`planning`},{name:`forgeqe-test-plan`,label:`Pathfinder: plans tests recorded by hand`,area:`planning`},{name:`forgeqe-api-plan`,label:`Planner: plans API scenarios`,area:`planning`},{name:`forgeqe-explore-plan`,label:`Rover: plans exploratory charters`,area:`planning`},{name:`forgeqe-data`,label:`Miner: test data`,area:`planning`},{name:`forgeqe-persona`,label:`Mask: business personas`,area:`planning`},{name:`forgeqe-basal`,label:`BASAL: business tests from your question`,area:`planning`},{name:`forgeqe-knowledge-agent`,label:`Librarian: what ForgeQE understood, and corrections`,area:`planning`},{name:`forgeqe-doc-reader`,label:`Skimmer: picks the sections of documents that answer a question`,area:`analysis`},{name:`forgeqe-agent-builder`,label:`Smith: builds custom agents`,area:`planning`},{name:`forgeqe-suite-builder`,label:`Sorter: builds test suites`,area:`planning`},{name:`forgeqe-responsive`,label:`Prism: plans one instruction for every device of a responsive preview`,area:`planning`},{name:`forgeqe-test-linker`,label:`Matchmaker: links test cases to automated tests`,area:`planning`},{name:`forgeqe-bug-report`,label:`Herald: drafts ForgeQE bug reports`,area:`planning`},{name:`forgeqe-knowledge`,label:`Mapper: reads the product into its knowledge graph`,area:`analysis`},{name:`forgeqe-investigate`,label:`Digger: investigates questions about the product`,area:`analysis`},{name:`forgeqe-evidence-acceptance`,label:`Clerk: reads a change against acceptance criteria`,area:`analysis`},{name:`forgeqe-impact-reader`,label:`Ripple: reads what a change does against its pull request`,area:`analysis`},{name:`forgeqe-evidence-content`,label:`Grader: judges an agent's answers`,area:`analysis`},{name:`forgeqe-evidence-scenarios`,label:`Drafter: drafts test scenarios`,area:`analysis`}];ii.map(e=>e.name);var ai={browser:`GitHub sign-in in the browser`,token:`a saved fine-grained token`,gh:`the GitHub CLI's sign-in`,environment:`a token in the environment ForgeQE started in`};function oi({onChanged:e}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),m=(0,Q.useCallback)(()=>{Ke.get().then(t=>{r(t.status),a(n=>(n&&(n.state===`running`||n.state===`waiting`)&&t.signin?.state===`done`&&e?.(),t.signin))},e=>s(e.message))},[e]);(0,Q.useEffect)(m,[m]);let h=i?.state===`running`||i?.state===`waiting`;(0,Q.useEffect)(()=>{if(!h)return;let e=cn(m,1e3);return()=>an(e)},[h,m]);let g=async e=>{s(``),p(``);try{a((await Ke.signIn(e)).signin)}catch(e){s(e.message)}},_=async e=>{if(i?.question){s(``);try{a((await Ke.answer(i.question.id,e)).signin),l(``)}catch(e){s(e.message)}}},v=i?.question;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft py-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-[44px] flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,$.jsx)(Kn,{logo:xn.github_copilot}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`GitHub Copilot`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:n?n.signedIn?`Signed in${n.account?` as ${n.account}`:``}${n.host?` on ${n.host}`:``}, with ${ai[n.how]}.${n.model?` Model: ${n.model}.`:``}`:`Not signed in. The agents can run on your Copilot seat.`:`Reading the sign-in…`})]}),!h&&n&&(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,"data-tip":n.signedIn?`Sign in to GitHub again`:`Sign in with GitHub, in your browser`,onClick:()=>void g(`browser`),children:[(0,$.jsx)(ce,{"aria-hidden":`true`}),`Sign in`]}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Sign in with your company's GitHub Enterprise`,onClick:()=>void g(`enterprise`),children:[(0,$.jsx)(Se,{"aria-hidden":`true`}),`Enterprise`]}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Use a fine-grained GitHub token`,onClick:()=>void g(`token`),children:[(0,$.jsx)(ce,{"aria-hidden":`true`}),`Token`]}),n.signedIn&&n.how!==`environment`&&(0,$.jsxs)(U,{size:`sm`,onClick:async()=>{let e=await Ke.signOut();r(e.status),p(e.message),a(null)},children:[(0,$.jsx)(De,{"aria-hidden":`true`}),`Sign out`]})]})]}),i&&(i.lines.length>0||h||i.link)&&(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(i.link||i.code)&&h&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[i.code&&(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-4 py-2 font-mono text-lg font-semibold tracking-[0.12em]`,children:i.code}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(i.code).then(()=>d(!0)),setTimeout(()=>d(!1),1500)},children:[(0,$.jsx)(t,{"aria-hidden":`true`}),u?`Copied`:`Copy`]})]}),i.link&&(0,$.jsxs)(`a`,{href:i.link,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open GitHub`,className:mt({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(Se,{"aria-hidden":`true`}),`Open`]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:[i.lines.slice(-6).map((e,t)=>(0,$.jsx)(`li`,{className:B(`[overflow-wrap:anywhere]`,e.kind===`err`?`text-fail`:e.kind===`ok`?`text-pass`:`text-ink-2`),children:e.text},t)),i.state===`running`&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for GitHub…`})]}),v?.kind===`choose`&&(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:v.title}),v.detail&&(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:v.detail}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:v.options.map(e=>(0,$.jsx)(U,{size:`sm`,variant:e.id===`cancel`?`outline`:`primary`,onClick:()=>void _(e.id),children:e.label},e.id))})]}),v?.kind===`input`&&(0,$.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),c.trim()&&_(c)},children:[(0,$.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1 text-sm font-medium`,children:[v.label,(0,$.jsx)(H,{type:v.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,value:c,onChange:e=>l(e.target.value)})]}),(0,$.jsxs)(U,{type:`submit`,size:`sm`,variant:`primary`,disabled:!c.trim(),children:[(0,$.jsx)(Fe,{"aria-hidden":`true`}),`Continue`]})]}),h&&(0,$.jsx)(`span`,{children:(0,$.jsxs)(U,{size:`sm`,onClick:async()=>a((await Ke.cancel()).signin),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]})})]}),(o||f)&&(0,$.jsx)(`p`,{className:B(`m-0 text-sm`,o?`text-fail`:`text-ink-2`),children:o||f})]})}var si=[[`openai`,`OpenAI`],[`azure`,`Azure OpenAI`],[`github_copilot`,`GitHub Copilot seat`],[`ollama`,`Ollama on this machine`],[`openai_compatible`,`OpenAI-compatible endpoint`]],ci=e=>si.find(([t])=>t===e)?.[1]||String(e||`No provider`),li={openai:{provider:`openai`,model:`gpt-4o`,api_key_env:`OPENAI_API_KEY`,temperature:.2},azure:{provider:`azure`,model:`gpt-4o`,deployment:`gpt-4o`,api_key_env:`WP_AZURE_API_KEY`,api_version:`2024-05-01-preview`,temperature:.2,deployment_type:`global`},github_copilot:{provider:`github_copilot`,model:`gpt-4.1`},ollama:{provider:`ollama`,model:`llama3.2`,endpoint:`http://127.0.0.1:11434/v1`,context:32768,temperature:.2},openai_compatible:{provider:`openai_compatible`,model:`gpt-4o`,api_key_env:`WP_API_KEY`,temperature:.2}};function ui(e){let t=e.multiplier===0?`included in your plan`:typeof e.multiplier==`number`?`${e.multiplier}x premium requests`:`premium requests`;return`${e.id} (${e.vision?`screenshots`:`no screenshots`}, ${t})`}function di(e,t,n){let r=e.map(e=>({value:e.id,label:ui(e)}));if(typeof t==`string`&&t&&!e.some(e=>e.id===t)){let e=n.find(e=>e.id===t),i=e?e.policy&&e.policy!==`enabled`?`turned off on your seat`:`takes no screenshots`:`not on your seat`;r.push({value:t,label:`${t} (${i})`})}return r}function fi(e){return!e||!e.models&&!e.error?`Reading your seat's models…`:e.error?`Your seat's list could not be read (below); type a Copilot model id, or try again.`:`Your seat has no model turned on: turn one on in GitHub's Copilot settings, or type a Copilot model id.`}function pi(e,t){let n=String(e.provider||``),r=e.auth===`entra`,i=t?.models?.filter(e=>!e.policy||e.policy===`enabled`)||[];if(n===`github_copilot`&&i.length)return[{key:`model`,label:`Model`,help:`Your Copilot seat's models. ForgeQE's agent and Quill use it, and the browser engine too unless Engine model says otherwise.`,type:`select`,options:di(i,e.model,t.models)},{key:`engine_model`,label:`Engine model`,help:`For the browser, desktop and mobile agents, which send screenshots.`,type:`select`,emptyLabel:`Same as the model`,options:di(i.filter(e=>e.vision),e.engine_model,t.models)},{key:`description`,label:`Description`,help:`Shown in the model picker.`,type:`text`}];let a=[{key:`model`,label:`Model`,...n===`github_copilot`?{help:fi(t)}:{},type:`text`,placeholder:n===`ollama`?`llama3.2`:n===`github_copilot`?`gpt-4.1`:`gpt-4o`}];return n===`azure`&&(a.push({key:`endpoint`,label:`Endpoint`,type:`url`,placeholder:`https://YOUR_RESOURCE.openai.azure.com/`},{key:`deployment`,label:`Deployment`,type:`text`,placeholder:`gpt-4o`},{key:`auth`,label:`Sign-in`,help:`Entra ID uses a managed identity, workload identity or az login; no key.`,type:`select`,emptyLabel:`API key`,options:[{value:`entra`,label:`Microsoft Entra ID`}]}),r&&a.push({key:`managed_identity_client_id`,label:`Managed identity client id`,type:`text`})),(n===`ollama`||n===`openai_compatible`)&&a.push({key:`endpoint`,label:`Endpoint`,type:`url`,placeholder:n===`ollama`?`http://127.0.0.1:11434/v1`:`https://your-gateway.example/v1`}),n!==`github_copilot`&&!r&&a.push({key:`api_key_env`,label:`API key`,help:`Kept in your credential store, never in llms.json.`,type:`var`}),a.push({key:`description`,label:`Description`,help:`Shown in the model picker.`,type:`text`}),a}function mi(e){let t=String(e.provider||``),n=[];return t===`azure`&&n.push({key:`api_version`,label:`API version`,type:`text`,placeholder:`2024-05-01-preview`},{key:`deployment_type`,label:`Deployment type`,help:`For prices.`,type:`select`,options:[`global`,`data_zone`].map(e=>({value:e,label:e}))}),t===`ollama`&&n.push({key:`context`,label:`Context window`,help:`Tokens.`,type:`number`,default:32768}),t!==`github_copilot`&&n.push({key:`temperature`,label:`Temperature`,type:`number`,placeholder:`0.2`}),t===`github_copilot`&&n.push({key:`reasoning_effort`,label:`Reasoning effort`,help:`How hard a reasoning model thinks. Sent only to a model that takes it.`,type:`select`,emptyLabel:`The model's default`,options:[`low`,`medium`,`high`,`xhigh`,`max`].map(e=>({value:e,label:e}))}),n}var hi=/^[A-Za-z0-9_.-]+$/;function gi({panel:e,setPanel:t,taken:n,onApply:i,vars:o}){let[s,c]=(0,Q.useState)(!1),l=e?.profile||{},u=l.provider===`github_copilot`,d=(0,Q.useCallback)(()=>u?Ke.models().then(e=>e.models):Promise.resolve(null),[u]),f=Nn(d),p={models:f.data,error:f.error},m=e?.name?hi.test(e.name)?e.name!==e.from&&n(e.name)?`Another model has this name.`:``:`Use letters, digits and _ . -`:``,h=String(l.provider||``),g=[...e&&!e.name?[[``,`a name`]]:[],[`model`,`a model`],...h===`azure`?[[`endpoint`,`an endpoint`],[`deployment`,`a deployment`]]:[],...h===`openai_compatible`?[[`endpoint`,`an endpoint`]]:[]].filter(([e])=>!e||!String(l[e]??``).trim()),_=!!e&&!m&&!g.length,v={value:l,set:n=>e&&t({...e,profile:n}),vars:o},y=()=>{t(null),c(!1)},b=mi(l);return(0,$.jsx)(G,{open:!!e,onClose:y,title:e?.mode===`add`?`Add a model`:`Edit ${e?.from}`,description:`Saved to llms.json, and its key to ${Xt(Yt().store)}, as soon as you add it.`,footer:(0,$.jsxs)($.Fragment,{children:[g.length>0&&(0,$.jsxs)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:[`Needs `,g.map(([,e])=>e).join(` and `)]}),(0,$.jsxs)(U,{onClick:y,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!_,onClick:()=>{i(e),y()},children:[e?.mode===`add`?(0,$.jsx)(a,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),e?.mode===`add`?`Add`:`Done`]})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 pt-6`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Provider`}),(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:si.map(([n,r])=>(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 rounded-[10px] px-4 hover:bg-surface-muted has-[:checked]:bg-surface-strong`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`provider`,checked:l.provider===n,onChange:()=>t({...e,profile:e.mode===`add`?{...li[n],...l.description?{description:l.description}:{}}:{...l,provider:n}})}),(0,$.jsx)(Kn,{icon:j,logo:xn[n]}),r]},n))})]}),(0,$.jsx)(J,{label:`Name`,help:m?(0,$.jsx)(`span`,{className:`text-fail`,children:m}):`How you pick it in chats and with --profile.`,htmlFor:`model-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(H,{id:`model-name`,value:e.name,spellCheck:!1,placeholder:`openai-gpt4o`,"aria-invalid":!!m,onChange:n=>t({...e,name:n.target.value.trim()})})}),(0,$.jsx)(X,{defs:pi(l,p),edit:v,base:[],stacked:!0}),u&&f.error&&(0,$.jsx)(En,{error:`Your Copilot seat's models could not be read: ${f.error}`,reload:f.reload}),b.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),"data-tip":s?`Fewer settings`:`More settings`,className:`mt-2 inline-flex min-h-10 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[s?(0,$.jsx)(O,{"aria-hidden":`true`}):(0,$.jsx)(r,{"aria-hidden":`true`}),s?`Less`:`More`]}),(0,$.jsx)(nn,{open:s,children:(0,$.jsx)(X,{defs:b,edit:v,base:[],stacked:!0})})]})]})})}function _i({config:e,models:t,vars:n,onReload:r,onRename:i}){let[o,c]=(0,Q.useState)(null),l=K(t.value.models),u=Object.keys(l),d=typeof t.value.default==`string`?t.value.default:``,f=String(Y(e.value,[`llm`,`active`])??``);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,children:`Models file`}),(0,$.jsx)(gn,{def:{key:`models_file`,label:`Models file`,help:`Relative to forgeqe.yaml. Kept apart, so it can be shared.`,type:`path`,default:`./llms.json`},edit:e,base:[`llm`]}),(0,$.jsx)(J,{label:`Profile in use`,help:`Empty: the default below. --profile overrides it for one command.`,htmlFor:`llm-active`,yamlKey:e.file?`llm.active`:void 0,children:(0,$.jsxs)(V,{id:`llm-active`,value:f,onChange:t=>e.set(q(e.value,[`llm`,`active`],t.target.value||void 0)),className:`w-full`,children:[(0,$.jsxs)(`option`,{value:``,children:[`The default (`,d||`none`,`)`]}),u.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e)),f&&!u.includes(f)&&(0,$.jsxs)(`option`,{value:f,children:[f,` (not in the file)`]})]})}),(0,$.jsx)(Z,{help:`Signing in adds the Copilot model and makes it the default.`,children:`Sign-ins`}),(0,$.jsx)(oi,{onChanged:r}),(0,$.jsx)(Z,{children:`Default model`}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Default model`,children:[u.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`No models yet. Add one to start.`}),u.map(e=>{let r=K(l[e]),i=typeof r.api_key_env==`string`&&r.auth!==`entra`?r.api_key_env:``;return(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Fr,{checked:d===e,onSelect:()=>t.set({...t.value,default:e}),label:`Make ${e} the default`}),(0,$.jsx)(Kn,{icon:j,logo:xn[String(r.provider)]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:[ci(r.provider),r.model].filter(Boolean).map(String).join(`, `)})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-4`,children:[i&&(0,$.jsx)(Yn,{name:i,vars:n}),d===e&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Default`})]}),(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${e}`,"data-tip":`Edit ${e}`,onClick:()=>c({mode:`edit`,from:e,name:e,profile:r}),children:(0,$.jsx)(p,{"aria-hidden":`true`})}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e}`,"data-tip":`Remove ${e}`,onClick:()=>{let n={...l};delete n[e];let r=d===e?Object.keys(n)[0]||``:d,i={...t.value,models:n};r?i.default=r:delete i.default,t.set(i)},children:(0,$.jsx)(s,{"aria-hidden":`true`})})]})]},e)})]}),(0,$.jsx)(`div`,{className:`pt-4`,children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add a model`,onClick:()=>c({mode:`add`,from:``,name:``,profile:{...li.openai}}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})}),(0,$.jsx)(gi,{panel:o,setPanel:c,taken:e=>e in l,onApply:e=>{let n={...e.mode===`edit`&&e.name!==e.from?Gn(l,e.from,e.name):l,[e.name]:e.profile},r=!d||e.mode===`edit`&&d===e.from?e.name:d;e.mode===`edit`&&e.name!==e.from&&i?.(e.from,e.name),t.set({...t.value,default:r,models:n})},vars:n})]})}var vi=[[`agent`,`Atlas`,`The shell, forgeqe run and forgeqe mcp.`],[`browser`,`Browser, desktop and mobile`,`Only models that take screenshots.`],[`coding`,`Writing and healing tests`,`Best model: a weaker one fails more.`],[`review`,`Reviews and judging`,``],[`analysis`,`Analysis and root cause`,`Best model.`],[`planning`,`Refining and planning`,``]],yi=[[`--profile`,`for one command`],[`The agent's own model`,`under its area below`],[`Its area's models`,`when Routing is Auto`],[`The profile in use`,`on Models`]];function bi({id:e,label:t,names:n,picked:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useCallback)(()=>(s(!1),l(``)),[]),d=c.toLowerCase().split(/\s+/).filter(Boolean),f=n.filter(e=>d.every(t=>e.toLowerCase().includes(t))),p=i.length===0?`Auto: any model good enough`:i.length<=2?i.join(`, `):`${i.slice(0,2).join(`, `)} and ${i.length-2} more`;return(0,$.jsxs)(`div`,{className:`relative w-full`,children:[(0,$.jsxs)(`button`,{id:e,type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o,onClick:()=>s(!o),className:`flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-[8px] border border-line bg-bg px-4 text-left text-sm text-ink hover:border-line-strong`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p}),(0,$.jsx)(r,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`})]}),(0,$.jsxs)(Jn,{open:o,onClose:u,label:`Models for ${t}`,role:`dialog`,align:`stretch`,className:`max-h-[360px] min-w-0`,children:[n.length>6&&(0,$.jsxs)(`label`,{className:`relative mb-1 flex items-center`,children:[(0,$.jsx)(se,{size:14,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 text-muted`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Find a model`}),(0,$.jsx)(H,{value:c,placeholder:`Find a model`,onChange:e=>l(e.target.value),className:`h-9 pl-8 text-[13px]`,autoFocus:!0})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":`Models for ${t}`,className:`flex flex-col`,children:[!c&&(0,$.jsx)(Si,{checked:!i.length,onSelect:()=>a([]),hint:`any model good enough for it`,children:`Auto`}),f.map(e=>(0,$.jsx)(Si,{checked:i.includes(e),onSelect:()=>a(i.includes(e)?i.filter(t=>t!==e):[...i,e]),children:e},e)),c&&!f.length&&(0,$.jsx)(`p`,{className:`m-0 px-4 py-2 text-[13px] text-muted`,children:`No model matches.`})]})]})]})}function xi(e,t){let n=e.toLowerCase().startsWith(`${t.toLowerCase()}:`)?e.slice(t.length+1).trim():e;return n.charAt(0).toUpperCase()+n.slice(1)}function Si({checked:e,onSelect:t,hint:n,children:r}){return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,onClick:t,className:`flex min-h-9 w-full cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-transparent px-4 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:B(`flex size-4 flex-none items-center justify-center rounded-[4px] border text-[13px]`,e?`border-accent bg-accent text-accent-ink`:`border-line-strong bg-bg`),children:e?`✓`:``}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),n&&(0,$.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:n})]})}function Ci({config:e,models:t}){let n=Object.keys(K(t.value.models)),r=String(Y(e.value,[`llm`,`routing`])??`off`),i=Y(e.value,[`llm`,`fallback`])!==!1,a=String(Y(e.value,[`llm`,`strategy`])??`balanced`),o=K(Y(e.value,[`llm`,`routes`])),s=K(Y(e.value,[`llm`,`agents`])),c=t=>e.file?`llm.${t}`:void 0,l=e=>typeof s[e]==`string`?String(s[e]):``,[u,d]=(0,Q.useState)({}),f=e=>{let t=o[e];return t===void 0||t===`auto`?[]:(Array.isArray(t)?t:[t]).map(String)},p=(t,n)=>e.set(q(e.value,[`llm`,`routes`,t],n.length?n:void 0));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,children:`Which model a call gets`}),(0,$.jsx)(`ol`,{"aria-label":`The first that applies wins`,className:`m-0 mb-4 flex list-none flex-col gap-2 p-0 text-[13px]`,children:yi.map(([e,t],n)=>(0,$.jsxs)(`li`,{className:`flex items-baseline gap-4`,children:[(0,$.jsx)(`span`,{className:`flex size-6 flex-none items-center justify-center self-center rounded-full bg-surface-strong text-[13px] font-semibold tabular-nums text-ink`,children:n+1}),(0,$.jsx)(`span`,{className:`font-medium text-ink`,children:e}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:t})]},e))}),(0,$.jsx)(`p`,{className:`m-0 mb-2 text-[13px] text-muted`,children:`The first that applies wins. A model with no key or a refused sign-in falls back to one that works, when Fall back is on.`}),(0,$.jsx)(J,{label:`Routing`,help:`Auto: each area gets a model by the strategy below. Shadow: decides and logs only.`,htmlFor:`llm-routing`,yamlKey:c(`routing`),children:(0,$.jsxs)(V,{id:`llm-routing`,value:r,onChange:t=>e.set(q(e.value,[`llm`,`routing`],t.target.value===`off`?void 0:t.target.value)),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`off`,children:`Off: the profile in use`}),(0,$.jsx)(`option`,{value:`auto`,children:`Auto`}),(0,$.jsx)(`option`,{value:`shadow`,children:`Shadow (log only)`})]})}),(0,$.jsx)(J,{label:`Strategy`,help:`Atlas and the planners, which plan and hand out work, get the most capable model unless this is Cheapest.`,htmlFor:`llm-strategy`,yamlKey:c(`strategy`),children:(0,$.jsxs)(V,{id:`llm-strategy`,value:a,onChange:t=>e.set(q(e.value,[`llm`,`strategy`],t.target.value===`balanced`?void 0:t.target.value)),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`balanced`,children:`Balanced: capability weighed against price`}),(0,$.jsx)(`option`,{value:`capability`,children:`Most capable for every area`}),(0,$.jsx)(`option`,{value:`cost`,children:`Cheapest: good enough for each area`})]})}),(0,$.jsx)(J,{label:`Fall back`,help:`Use a working model when one has no key or its sign-in is refused, Copilot first.`,yamlKey:c(`fallback`),children:(0,$.jsx)(Un,{checked:i,onChange:t=>e.set(q(e.value,[`llm`,`fallback`],t?void 0:!1)),label:`Fall back to a working model`})}),(0,$.jsx)(Z,{help:r===`off`?`Routing is off: an area's models apply once it is Auto. An agent's own model applies always.`:`Auto: any model good enough. One model picked pins the area to it.`,children:`Areas of work`}),n.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-4 text-sm text-muted`,children:`Add models under Models first.`}),n.length>0&&vi.map(([t,r,i])=>{let a=f(t),o=a.filter(e=>!n.includes(e)),s=ii.filter(e=>e.area===t),m=s.filter(e=>l(e.name)).length,h=u[t]??m>0;return(0,$.jsxs)(`div`,{className:`border-t border-line-soft`,children:[(0,$.jsx)(J,{label:r,help:o.length?(0,$.jsxs)(`span`,{className:`text-fail`,children:[`Not in the models file: `,o.join(`, `)]}):i||void 0,yamlKey:c(`routes.${t}`),className:`border-t-0`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,children:(0,$.jsx)(bi,{id:`llm-route-${t}`,label:r,names:n,picked:a,onChange:e=>p(t,e)})})}),(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":h,onClick:()=>d({...u,[t]:!h}),className:`-mt-2 mb-2 inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-transparent px-2 text-[13px] text-ink-2 hover:bg-surface-muted hover:text-ink`,children:[(0,$.jsx)(D,{size:14,"aria-hidden":`true`,className:B(`transition-transform`,h&&`rotate-90`)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center -space-x-1`,children:s.slice(0,5).map(e=>(0,$.jsx)(Nt,{agent:e.name,px:18,decorative:!0,className:`rounded-[5px] ring-2 ring-bg`},e.name))}),s.length,` `,s.length===1?`agent`:`agents`,m>0&&(0,$.jsxs)(`span`,{className:`text-muted`,children:[`· `,m,` with `,m===1?`its`:`their`,` own model`]})]}),(0,$.jsx)(nn,{open:h,children:(0,$.jsx)(`ul`,{className:`m-0 mb-4 flex list-none flex-col p-0 pl-6`,children:s.map(t=>{let r=l(t.name),i=`llm-agent-${t.name}`;return(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-10 gap-y-2 py-2`,children:[(0,$.jsxs)(`label`,{htmlFor:i,"data-tip":c(`agents.${t.name}`),className:`flex min-w-0 flex-[1_1_220px] items-start gap-2 text-[13px] text-ink`,children:[(0,$.jsx)(Nt,{agent:t.name,px:22,decorative:!0,className:`mt-1`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:z(t.name).name}),(0,$.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:xi(t.label,z(t.name).name)}),r&&!n.includes(r)&&(0,$.jsxs)(`span`,{className:`block text-[13px] text-fail`,children:[`Not in the models file: `,r]})]})]}),(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,children:(0,$.jsxs)(V,{id:i,value:r,onChange:n=>e.set(q(e.value,[`llm`,`agents`,t.name],n.target.value||void 0)),className:`w-full`,children:[(0,$.jsx)(`option`,{value:``,children:`The area's model`}),n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e)),r&&!n.includes(r)&&(0,$.jsxs)(`option`,{value:r,children:[r,` (not in the file)`]})]})})]},t.name)})})})]},t)})]})}function wi(e,t){if(!e)return``;let n=e.account?` as ${e.account}`:``,r=[e.via===`azcli`?`Signed in with the Azure CLI${n}`:e.via===`gh`?`Signed in with the GitHub CLI${n}`:e.via===`dataverse`?`Signed in with the Dataverse CLI`:e.via===`token`?`Signed in with a saved key${n}`:e.via?`Signed in${n}`:``,e.browser?`${t}'s MCP server is signed in in the browser`:``].filter(Boolean).join(`; `);return r?`${r}.`:``}function Ti({system:e,label:n,keyless:r,onChanged:i}){let[a,o]=(0,Q.useState)(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),S=(0,Q.useRef)(0),C=(0,Q.useCallback)(()=>{let t=S.current;Qe.get().then(n=>{t===S.current&&(o(n.saved[e]),c(!0),u(e=>(e&&(e.state===`running`||e.state===`waiting`)&&n.signin?.state===`done`&&i?.(),n.signin)))},e=>f(e.message))},[e,i]);(0,Q.useEffect)(C,[C]);let w=l&&l.system===e?l:null,T=w?.state===`running`||w?.state===`waiting`,E=l&&l.system!==e&&(l.state===`running`||l.state===`waiting`);(0,Q.useEffect)(()=>{if(!T)return;let e=cn(C,1e3);return()=>an(e)},[T,C]);let D=async()=>{f(``),m(``),S.current++;try{u((await Qe.start(e)).signin)}catch(e){f(e.message)}},O=async e=>{if(w?.question&&!y){f(``),b(!0),S.current++;try{let t=(await Qe.answer(w.question.id,e)).signin;S.current++,u(t),g(``)}catch(e){f(e.message),C()}finally{b(!1)}}},k=w?.question,ee=k?.kind===`input`&&!k.secret&&/\(empty to [^)]*\)$/.test(k.label),te=w?.link&&/^https:\/\//.test(w.link)?w.link:void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft py-4`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-[44px] flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Sign-in`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:s?wi(a,n)||(r?`Not signed in here. Sign in with ${n}; it takes no key.`:`Not signed in here. Sign in with ${n}, or set its variables below.`):`Reading the sign-in…`})]}),!T&&s&&(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:a?`outline`:`primary`,disabled:!!E,"data-tip":a?`Sign in to ${n} again`:`Sign in with ${n}`,onClick:()=>void D(),children:[(0,$.jsx)(ce,{"aria-hidden":`true`}),`Sign in`]}),a&&(0,$.jsxs)(U,{size:`sm`,onClick:async()=>{try{let t=await Qe.signOut(e);o(t.saved[e]),m(t.message),u(null),i?.()}catch(e){f(e.message)}},children:[(0,$.jsx)(De,{"aria-hidden":`true`}),`Sign out`]})]})]}),E&&(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Another sign-in is running. Finish or cancel it first.`}),w&&(w.lines.length>0||T||te)&&(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(te||w.code)&&T&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[w.code&&(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-4 py-2 font-mono text-lg font-semibold tracking-[0.12em]`,children:w.code}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(w.code).then(()=>v(!0)),setTimeout(()=>v(!1),1500)},children:[(0,$.jsx)(t,{"aria-hidden":`true`}),_?`Copied`:`Copy`]})]}),te&&(0,$.jsxs)(`a`,{href:te,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open ${new URL(te).host}`,className:mt({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(Se,{"aria-hidden":`true`}),`Open`]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:[w.lines.slice(-6).map((e,t)=>(0,$.jsx)(`li`,{className:B(`[overflow-wrap:anywhere]`,e.kind===`err`?`text-fail`:e.kind===`ok`?`text-pass`:`text-ink-2`),children:e.text},t)),w.state===`running`&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`Waiting for `,n,`…`]})]}),k?.kind===`choose`&&(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:k.title}),k.detail&&(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:k.detail}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.options.map(e=>(0,$.jsx)(U,{size:`sm`,variant:e.id===`cancel`?`outline`:`primary`,disabled:y,onClick:()=>void O(e.id),children:e.label},e.id))})]}),k?.kind===`input`&&(0,$.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),(h.trim()||ee)&&O(h)},children:[(0,$.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1 text-sm font-medium`,children:[k.label,(0,$.jsx)(H,{type:k.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,value:h,onChange:e=>g(e.target.value)})]}),(0,$.jsxs)(U,{type:`submit`,size:`sm`,variant:`primary`,disabled:y||!h.trim()&&!ee,children:[(0,$.jsx)(Fe,{"aria-hidden":`true`}),`Continue`]})]}),T&&(0,$.jsx)(`span`,{children:(0,$.jsxs)(U,{size:`sm`,onClick:async()=>{S.current++,u((await Qe.cancel()).signin)},"data-tip":`Cancel sign-in`,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]})})]}),(d||p)&&(0,$.jsx)(`p`,{className:B(`m-0 text-sm`,d?`text-fail`:`text-ink-2`),children:d||p})]})}var Ei=[`Test cases and bugs`,`Browser grids`,`Notifications`,`Other tools`],Di=e=>e.group===`tools`?Ei[3]:Ei[0],Oi={jira:`jira`,azure_devops:`azure_devops`,xray:`xray`,confluence:`confluence`,testrail:`testrail`,zephyr:`zephyr`,qtest:`qtest`,github:`github`,gitlab:`gitlab`,browserstack_mcp:`browserstack`,testmu_mcp:`testmu`,postman:`postman`,azure:`azure`,dataverse:`dataverse`,sentry:`sentry`,browserstack:`browserstack`,testmu:`testmu`},ki=[...sr.map(e=>({id:e.id,kind:`source`,group:Di(e),name:e.name,note:e.note,icon:e.icon,logo:Rn[e.logo||e.id]??xn[e.logo||e.id]})),{id:`browserstack`,kind:`grid`,group:Ei[1],name:`BrowserStack`,note:`Remote browsers and devices`,icon:w,logo:Rn.browserstack},{id:`testmu`,kind:`grid`,group:Ei[1],name:`TestMu AI`,note:`Remote browsers (LambdaTest)`,icon:w,logo:Rn.testmu},{id:`teams`,kind:`teams`,group:Ei[2],name:`Microsoft Teams`,note:`A channel's webhook, for suites, releases and schedules`,icon:L,logo:Mn,many:!0},{id:`email`,kind:`email`,group:Ei[2],name:`Email`,note:`The same alerts by email`,icon:L,many:!0},{id:`mcp`,kind:`mcp`,group:Ei[3],name:`MCP server`,note:`Any other system with an MCP server, as tools for ForgeQE's agent`,icon:ge,many:!0}],Ai={browserstack:[{key:`username_env`,label:`User name variable`,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`access_key_env`,label:`Access key variable`,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`},{key:`browser`,label:`Browser`,help:`ForgeQE drives the browser over CDP: Chrome or Edge.`,type:`select`,default:`chrome`,options:[{value:`chrome`,label:`Chrome`},{value:`edge`,label:`Edge`}]},{key:`browser_version`,label:`Browser version`,type:`text`,default:`latest`},{key:`os`,label:`Operating system`,type:`select`,default:`Windows`,options:[{value:`Windows`,label:`Windows`},{value:`OS X`,label:`macOS`}]},{key:`os_version`,label:`Its version`,type:`text`,placeholder:`11, or Sequoia`},{key:`project`,label:`Project`,type:`text`,placeholder:`ForgeQE`},{key:`build`,label:`Build`,type:`text`,placeholder:`nightly`},{key:`local`,label:`Through BrowserStack Local`,help:`For sites only your network reaches.`,type:`switch`,default:!1}],testmu:[{key:`username_env`,label:`User name variable`,type:`var`,default:`LT_USERNAME`},{key:`access_key_env`,label:`Access key variable`,type:`var`,default:`LT_ACCESS_KEY`},{key:`browser`,label:`Browser`,help:`TestMu AI's CDP endpoint serves Chrome.`,type:`select`,default:`Chrome`,options:[{value:`Chrome`,label:`Chrome`}]},{key:`browser_version`,label:`Browser version`,type:`text`,default:`latest`},{key:`platform`,label:`Platform`,type:`text`,default:`Windows 11`,placeholder:`Windows 11, or macOS Sequoia`},{key:`project`,label:`Project`,type:`text`,placeholder:`ForgeQE`},{key:`build`,label:`Build`,type:`text`,placeholder:`nightly`},{key:`local`,label:`Through the LambdaTest tunnel`,help:`For sites only your network reaches.`,type:`switch`,default:!1}]},ji={browserstack:Ai.browserstack.filter(e=>[`browser`,`browser_version`,`os`,`os_version`].includes(e.key)),testmu:Ai.testmu.filter(e=>[`browser`,`browser_version`,`platform`].includes(e.key))},Mi={browserstack:{provider:`browserstack`,remote:{browser:`chrome`,browser_version:`latest`,os:`Windows`,os_version:`11`,username_env:`BROWSERSTACK_USERNAME`,access_key_env:`BROWSERSTACK_ACCESS_KEY`,project:`ForgeQE`,local:!1}},testmu:{provider:`testmu`,remote:{browser:`Chrome`,browser_version:`latest`,platform:`Windows 11`,username_env:`LT_USERNAME`,access_key_env:`LT_ACCESS_KEY`,project:`ForgeQE`,local:!1}}},Ni=[{key:`host`,label:`Mail server`,type:`text`,placeholder:`smtp.office365.com`},{key:`port`,label:`Port`,help:`587 is STARTTLS; 465 is TLS from the start.`,type:`number`,default:587},{key:`username_env`,label:`User name variable`,type:`var`,placeholder:`SMTP_USERNAME`},{key:`password_env`,label:`Password variable`,type:`var`,placeholder:`SMTP_PASSWORD`},{key:`from`,label:`From`,help:`Empty: the user name.`,type:`text`,placeholder:`ForgeQE <qa-bot@example.com>`},{key:`to`,label:`To`,help:`Comma separated.`,type:`list`,placeholder:`qa-team@example.com`}],Pi=/^[A-Za-z0-9_-][A-Za-z0-9_.-]*$/;function Fi({entry:e,title:t,meta:n,state:r,onEdit:i,onRemove:a,setUp:o}){return(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Kn,{icon:e.icon,logo:e.logo}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:t}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:n}),r]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:o?(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Set up ${t}`,"data-tip":`Set up ${t}`,onClick:i,children:(0,$.jsx)(Pe,{"aria-hidden":`true`})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${t}`,"data-tip":`Edit ${t}`,onClick:i,children:(0,$.jsx)(p,{"aria-hidden":`true`})}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${t}`,"data-tip":`Disconnect ${t}`,onClick:a,children:(0,$.jsx)(ze,{"aria-hidden":`true`})})]})})]})}var Ii=(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set up`}),Li=(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs a sign-in: Edit to sign in`}),Ri=(e,t=``)=>t?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:t}):e.length?(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:e.length===1?`Needs its key or password: Edit to add it`:`Needs ${e.length} values: Edit to add them`}):(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected`}),zi={integrations:[Ei[0],Ei[1]],notifications:[Ei[2]],mcp:[Ei[3]]};function Bi({edit:e,grids:t,setGrids:n,gridPaths:r,view:i=`integrations`}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)({}),d=(0,Q.useCallback)(()=>{Qe.get().then(e=>u(e.saved),()=>{})},[]);(0,Q.useEffect)(d,[d]);let f=e=>{let t=l[Oi[e]||``];return t&&(t.via!==`token`||t.browser)&&wi(t,b(e).name)?`Signed in`:``},p=Yt(),m=e=>dn(p,e),h=e.value,g=e.vars,_=K(Y(h,[`notify`,`channels`])),v=K(h.mcp),y=String(Y(h,[`browser`,`provider`])??`local`),b=e=>ki.find(t=>t.id===e),x=e=>{let t=sr.find(t=>t.id===e),n=Y(h,t.base);return n!==void 0&&n!==!1},S=e=>e.kind===`source`?x(e.id):e.kind===`grid`&&!!t[e.id],C=Object.fromEntries(Ei.map(e=>[e,[]]));for(let t of sr){if(!x(t.id)){t.group===`tools`&&C[Di(t)].push((0,$.jsx)(Fi,{entry:b(t.id),title:t.name,meta:t.note,state:Ii,setUp:!0,onEdit:()=>T(b(t.id))},t.id));continue}let n=K(Y(h,t.base));C[Di(t)].push((0,$.jsx)(Fi,{entry:b(t.id),title:t.name,meta:String(n.url||n.org_url||n.repo||t.note),state:t.signinOnly&&!f(t.id)?Li:Ri(Xn(n,t.vars,t.fields,m),f(t.id)),onEdit:()=>c({step:`form`,entry:b(t.id),mode:`edit`,name:t.id,from:t.id,value:n}),onRemove:()=>e.set(q(h,t.base,void 0))},t.id))}for(let e of[`browserstack`,`testmu`]){let n=t[e];if(!n)continue;let r=K(n.remote),i=b(e),a=[(e=>typeof e==`string`&&e?e[0].toUpperCase()+e.slice(1):e)(r.browser),r.os?`${r.os} ${r.os_version||``}`.trim():r.platform].filter(Boolean).join(`, `);C[Ei[1]].push((0,$.jsx)(Fi,{entry:i,title:i.name,meta:`${a}${y===e?`, used for browser runs`:``}`,state:Ri(Xn(r,[`username_env`,`access_key_env`],Ai[e],m),f(e)),onEdit:()=>c({step:`form`,entry:i,mode:`edit`,name:e,from:e,value:n,useGrid:y===e}),onRemove:()=>w(e)},e))}for(let[t,n]of Object.entries(_)){let r=K(n),i=b(r.teams?`teams`:`email`),a=Array.isArray(r.on)?r.on.length:0,o=[...r.teams?Xn(K(r.teams),[`webhook_env`],[],m):[],...r.email?Xn(K(r.email),[`username_env`,`password_env`],[],m):[]];C[Ei[2]].push((0,$.jsx)(Fi,{entry:i,title:t,meta:`${[r.teams&&`Teams`,r.email&&`Email`].filter(Boolean).join(` and `)||`No way to reach it yet`}, ${a} event${a===1?``:`s`}`,state:Ri(o),onEdit:()=>c({step:`form`,entry:i,mode:`edit`,name:t,from:t,value:r}),onRemove:()=>e.set(q(h,[`notify`,`channels`,t],void 0))},`ch-${t}`))}for(let[t,n]of Object.entries(v)){let r=K(n);C[Ei[3]].push((0,$.jsx)(Fi,{entry:{...b(`mcp`),icon:pe},title:t,meta:String(r.url||r.command||`MCP server`),onEdit:()=>c({step:`form`,entry:b(`mcp`),mode:`edit`,name:t,from:t,value:r}),onRemove:()=>e.set(q(h,[`mcp`,t],void 0))},`mcp-${t}`))}function w(r){let i=q(h,[`browser`,`providers`,r],void 0);y===r&&(i=q(i,[`browser`,`provider`],`local`)),e.set(i),n({...t,[r]:null})}function T(e){if(e.kind===`source`){let t=sr.find(t=>t.id===e.id);c({step:`form`,entry:e,mode:`add`,name:e.id,from:e.id,value:Object.fromEntries(t.fields.filter(e=>e.type===`var`&&e.default).map(e=>[e.key,e.default]))})}else e.kind===`grid`?c({step:`form`,entry:e,mode:`add`,name:e.id,from:e.id,value:Mi[e.id],useGrid:y===`local`}):e.kind===`teams`?c({step:`form`,entry:e,mode:`add`,name:``,from:``,value:{teams:{webhook_env:`TEAMS_WEBHOOK_URL`},on:[`suite_failed`,`job_failed`]}}):e.kind===`email`?c({step:`form`,entry:e,mode:`add`,name:``,from:``,value:{email:{port:587},on:[`suite_failed`,`job_failed`]}}):c({step:`form`,entry:e,mode:`add`,name:``,from:``,value:{url:``}})}function E(i){let a=i.entry.kind;if(a===`source`){let t=sr.find(e=>e.id===i.entry.id);e.set(q(h,t.base,t.signinOnly&&!Object.keys(K(i.value)).length?!0:i.value))}else if(a===`grid`){let a=i.entry.id,o=q(h,[`browser`,`providers`,a],r[a]);i.useGrid?o=q(o,[`browser`,`provider`],a):y===a&&(o=q(o,[`browser`,`provider`],`local`)),e.set(o),n({...t,[a]:i.value})}else{let t=a===`mcp`?[`mcp`]:[`notify`,`channels`],n=h;i.mode===`edit`&&i.from!==i.name&&(n=q(n,[...t,i.from],void 0)),e.set(q(n,[...t,i.name],i.value))}c(null)}let D=zi[i],O=D.filter(e=>C[e].length),k=i===`mcp`?`Add an MCP server`:i===`notifications`?`Add a channel`:`Add an integration`,ee=i===`mcp`?`No other MCP servers yet. The test case systems' own MCP servers are set with each system under Integrations.`:i===`notifications`?`No channels yet: add a Teams channel or an email list, and pick the events it gets.`:`Nothing connected yet.`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:O.length?i===`mcp`?`Their tools show as <name>_<tool>. Sign in from Edit where a server offers it.`:i===`notifications`?`Each channel gets the events it picks.`:`Connected to ForgeQE.`:ee}),(0,$.jsxs)(U,{size:`sm`,"data-tip":k,onClick:()=>i===`mcp`?T(b(`mcp`)):c({step:`catalog`}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),O.map(e=>(0,$.jsxs)(`div`,{children:[D.length>1&&(0,$.jsx)(Z,{children:e}),C[e]]},e)),i===`notifications`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{children:`Links in alerts`}),(0,$.jsx)(gn,{def:{key:`notify.report_url`,label:`Where reports are published`,help:`Teams and email alerts link each report there.`,type:`url`,placeholder:`https://reports.example.com/forgeqe`},edit:e,base:[]})]}),i===`integrations`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{children:`Test case ids`}),(0,$.jsx)(gn,{def:{key:`sources.id_routes`,label:`Which system an id is in`,help:`One line per id pattern: the start of an id and * (or * alone for a plain number) = azure_devops, jira, xray, testrail, zephyr, qtest, github or servicenow. Only needed when more than one system could hold an id; otherwise ForgeQE asks.`,type:`kv`,placeholder:`TA-* = jira
|
|
8
|
-
TST* = servicenow
|
|
9
|
-
* = azure_devops`},edit:e,base:[]}),(0,$.jsx)(Z,{children:`Results and bugs`}),(0,$.jsx)(gn,{def:{key:`sources.write_back`,label:`Post results back`,help:`To the system each test case came from.`,type:`switch`,default:!0},edit:e,base:[]}),(0,$.jsx)(Z,{help:pr.help,children:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(pt,{icon:o,size:18}),pr.title]})}),(0,$.jsx)(X,{defs:pr.fields,edit:e,base:pr.base})]}),(0,$.jsx)(Vi,{panel:s,setPanel:c,isOn:S,onPick:T,onApply:E,vars:g,taken:(e,t)=>t in(e===`mcp`?v:_),groups:D,title:k,onSigned:d})]})}function Vi({panel:e,setPanel:t,isOn:r,onPick:i,onApply:a,vars:o,taken:s,groups:c,title:l,onSigned:u}){let d=Yt(),[f,p]=(0,Q.useState)({busy:!1}),[m,h]=(0,Q.useState)(null),g=e?.step===`form`?`${e.entry.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>{p({busy:!1}),h(null)},[g]);let _=()=>{t(null),p({busy:!1}),h(null)};if(e?.step===`form`){let r=e,i=r.entry.kind,c=e=>t({...r,value:e}),l=i===`teams`||i===`email`||i===`mcp`,g=l&&r.name?Pi.test(r.name)?r.name!==r.from&&s(i,r.name)?`Another one has this name.`:``:`Use letters, digits and _ . -`:``,v=i===`mcp`&&K(r.value).command===void 0,b=(!l||r.name&&!g)&&(i!==`mcp`||String(K(r.value)[v?`url`:`command`]||``).trim()),S=r.mode===`add`?`Connect ${r.entry.name}`:`Edit ${l?r.name:r.entry.name}`,w=!(i===`mcp`&&!v)&&!(i===`source`&&sr.find(e=>e.id===r.entry.id)?.untestable);return(0,$.jsxs)(G,{open:!0,onClose:_,title:S,description:`Saved as soon as you connect it. Keys and passwords you type are kept in ${Xt(d.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[r.mode===`add`&&(0,$.jsxs)(U,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(be,{"aria-hidden":`true`}),`Back`]}),w&&(0,$.jsxs)(U,{onClick:async()=>{p({busy:!0});let e=Object.fromEntries(Object.entries(d.pending).filter(e=>typeof e[1]==`string`));try{let t=await nt.test(i,r.entry.id,r.value,e);p({busy:!1,ok:t.ok,message:t.message})}catch(e){p({busy:!1,ok:!1,message:e.message})}},disabled:f.busy,className:`mr-auto`,"data-tip":i===`teams`||i===`email`?`Send a test message`:`Test the connection`,children:[i===`teams`||i===`email`?(0,$.jsx)(n,{"aria-hidden":`true`}):(0,$.jsx)(j,{"aria-hidden":`true`}),f.busy?`Testing…`:`Test`]}),!w&&(0,$.jsx)(`span`,{className:`mr-auto`}),(0,$.jsxs)(U,{onClick:_,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!b,onClick:()=>a(r),children:[r.mode===`add`?(0,$.jsx)(j,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),r.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(Kn,{icon:r.entry.icon,logo:r.entry.logo,size:`lg`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:r.entry.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:f.message&&(0,$.jsxs)(`p`,{role:f.ok?`status`:`alert`,className:B(`mt-2 mb-1 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,f.ok?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[f.ok?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:f.message})]})}),l&&(0,$.jsx)(J,{label:`Name`,help:g?(0,$.jsx)(`span`,{className:`text-fail`,children:g}):i===`mcp`?`Its tools show as <name>_<tool> to ForgeQE's agent.`:`A short name for the channel, such as qa or release.`,htmlFor:`int-name`,stacked:!0,children:(0,$.jsx)(H,{id:`int-name`,value:r.name,spellCheck:!1,"aria-invalid":!!g,placeholder:i===`mcp`?`xray`:`qa`,onChange:e=>t({...r,name:e.target.value.trim()})})}),(i===`source`||i===`grid`)&&Oi[r.entry.id]&&(r.mode===`edit`?(0,$.jsx)(Ti,{system:Oi[r.entry.id],label:r.entry.name.replace(/ tools$/,``),keyless:i===`source`&&!!sr.find(e=>e.id===r.entry.id)?.signinOnly,onChanged:u}):(0,$.jsxs)(`p`,{className:`m-0 border-t border-line-soft py-4 text-sm text-muted`,children:[`Connect it first; then sign in from Edit, in the browser where `,r.entry.name,` offers that.`]})),i===`source`&&(0,$.jsx)(X,{defs:sr.find(e=>e.id===r.entry.id).fields,edit:{value:r.value,set:c,vars:o},base:[],stacked:!0}),i===`source`&&r.mode===`edit`&&(r.entry.id===`azure_devops`||r.entry.id===`jira`)&&Object.values(K(K(r.value).test_cases)).some(e=>String(e??``).trim())&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Try where existing test cases are: how many cases each line, as typed, finds through the saved connection.`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(K(K(r.value).test_cases)).filter(([,e])=>String(e??``).trim()).map(([e,t])=>(0,$.jsxs)(U,{size:`sm`,disabled:m?.busy,onClick:async()=>{h({key:e,busy:!0});try{let n=await Xe.tryMapping(r.entry.id,e,String(t??``));h({key:e,busy:!1,ok:!0,message:`${e}: ${n.cases} case${n.cases===1?``:`s`}${n.sample.length?`, such as ${n.sample.join(`; `)}`:``}`})}catch(t){h({key:e,busy:!1,ok:!1,message:`${e}: ${t.message}`})}},children:[(0,$.jsx)(E,{"aria-hidden":`true`}),m?.busy&&m.key===e?`Trying…`:`Try ${e}`]},e))}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:m?.message&&(0,$.jsxs)(`p`,{role:m.ok?`status`:`alert`,className:B(`m-0 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,m.ok?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[m.ok?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:m.message})]})})]}),i===`grid`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{defs:Ai[r.entry.id],edit:{value:r.value,set:c,vars:o},base:[`remote`],stacked:!0}),(0,$.jsxs)(`label`,{className:`mt-2 flex min-h-11 cursor-pointer items-center gap-4 text-sm`,children:[(0,$.jsx)(yn,{checked:!!r.useGrid,onCheckedChange:e=>t({...r,useGrid:e})}),`Run browser tests here by default`]}),(0,$.jsx)(Z,{help:(0,$.jsxs)($.Fragment,{children:[`Each one the browser settings above with its own on top. Run on several at once with `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:`--devices`}),`.`]}),children:`Browser devices`}),(0,$.jsx)(hn,{edit:{value:r.value,set:c,vars:o},base:[`devices`],defs:ji[r.entry.id],noun:`browser device`,placeholder:`win11-chrome`,meta:e=>[e.browser,e.browser_version,e.platform||[e.os,e.os_version].filter(Boolean).join(` `)].filter(Boolean).map(String).join(`, `)}),(0,$.jsxs)(`p`,{className:`m-0 border-t border-line-soft py-4 text-sm text-muted`,children:[`Its phones and tablets are in this file too: `,(0,$.jsx)(`a`,{href:R(`settings`,`mobile`),children:`Settings → Mobile`}),`.`]})]}),(i===`teams`||i===`email`)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Hi,{value:r.value,set:c}),i===`teams`||K(r.value).teams?(0,$.jsx)(gn,{def:{key:`teams.webhook_env`,label:`Webhook variable`,help:`The address of a Teams Workflows webhook (post to a channel when a webhook request is received). It is a secret, so it is kept in your credential store.`,type:`var`,placeholder:`TEAMS_WEBHOOK_URL`},edit:{value:r.value,set:c,vars:o},base:[],stacked:!0}):null,i===`email`||K(r.value).email?(0,$.jsx)(X,{defs:Ni,edit:{value:r.value,set:c,vars:o},base:[`email`],stacked:!0}):null]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 py-4`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Where it runs`}),[[!0,`A server at an address`],[!1,`A command on this machine`]].map(([e,t])=>(0,$.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-4 text-sm`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`mcp-kind`,checked:v===e,onChange:()=>c(e?{url:``}:{command:``})}),t]},String(e)))]}),v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(gn,{def:{key:`url`,label:`Address`,type:`url`,placeholder:`https://api.githubcopilot.com/mcp/`},edit:{value:r.value,set:c,vars:o},base:[],stacked:!0}),(0,$.jsx)(Ui,{value:r.value,set:c,vars:o})]}):(0,$.jsx)(gn,{def:{key:`command`,label:`Command`,help:`Started by ForgeQE's agent runtime. Name secrets as {env:NAME}, never their values.`,type:`path`,placeholder:`npx -y @triparc/xray-mcp`},edit:{value:r.value,set:c,vars:o},base:[],stacked:!0})]})]})}return(0,$.jsx)(G,{open:e?.step===`catalog`,onClose:_,title:l,description:`Pick a service to connect.`,footer:(0,$.jsxs)(U,{onClick:_,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Close`]}),children:c.map(e=>(0,$.jsxs)(`div`,{className:`pt-4`,children:[(0,$.jsx)(`h3`,{className:`m-0 mb-1 text-sm font-medium text-muted`,children:e}),ki.filter(t=>t.group===e).map(e=>{let t=!e.many&&r(e);return(0,$.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>i(e),className:B(`flex min-h-14 w-full items-center gap-4 rounded-[12px] border-0 bg-transparent px-2 py-2 text-left text-ink`,t?`cursor-default`:`cursor-pointer hover:bg-surface-muted`),children:[(0,$.jsx)(Kn,{icon:e.icon,logo:e.logo}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:B(`text-[13px]`,t?`text-pass`:`text-accent-fg`),children:t?`Connected`:e.many?`Add`:`Connect`})]},e.id)})]},e))})}function Hi({value:e,set:t}){let n=Array.isArray(e.on)?e.on.map(String):[];return(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 py-4`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Tell it when`}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-x-4 sm:grid-cols-2`,children:Sr.map(([r,i])=>(0,$.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-2 text-sm`,children:[(0,$.jsx)(yn,{checked:n.includes(r),onCheckedChange:i=>t({...e,on:i?[...n,r]:n.filter(e=>e!==r)})}),i]},r))})]})}function Ui({value:e,set:t,vars:n}){let r=String(K(e.headers).Authorization||``),i=/\{env:([A-Za-z_][A-Za-z0-9_]*)\}/.exec(r)?.[1]||``;return(0,$.jsx)(gn,{def:{key:`token`,label:`Token`,help:`Sent as a bearer token. Leave it empty for none.`,type:`var`,placeholder:`MCP_TOKEN`},edit:{value:{token:i},set:n=>{let r=String(n.token||``),i={...K(e.headers)};r?i.Authorization=`Bearer {env:${r}}`:delete i.Authorization,t(Object.keys(i).length?{...e,headers:i}:(({headers:e,...t})=>t)(e))},vars:n},base:[],stacked:!0})}var Wi=[{key:`checks`,label:`Checks`,help:`Test case sources, comma separated: files or folders, jira:…, ado:…, testrail:…`,type:`list`,placeholder:`checks/smoke.yaml, jira:SHOP-12`},{key:`every`,label:`How often`,help:`30s, 15m, 1h or 1h30m; at least 10s.`,type:`text`,default:`15m`},{key:`replay`,label:`Checking a recorded run`,help:`Verify: one model call per check confirms the result. Trust: none.`,type:`select`,default:`verify`,options:[{value:`verify`,label:`Verify`},{value:`trust`,label:`Trust`}]},{key:`parallel`,label:`Checks at once`,type:`number`,default:1},{key:`write_back`,label:`Post each round's results`,help:`To the system each check came from.`,type:`switch`,default:!1}],Gi=[{key:`fail_after`,label:`Failing rounds before the first alert`,help:`2 or more rides out a flaky run.`,type:`number`,default:1},{key:`remind_every`,label:`Remind while it keeps failing`,help:`Every 2h, for example. Empty: never.`,type:`text`,placeholder:`2h`},{key:`report_url`,label:`Where rounds are published`,help:`Alerts link each round's report there.`,type:`url`,placeholder:`https://reports.example.com/monitor`},{key:`keep`,label:`Rounds kept`,help:`Older round folders are deleted.`,type:`number`,default:100},{key:`out_dir`,label:`Round folder`,help:`Rounds and state.json: which checks are failing, and since when.`,type:`path`,default:`./.forgeqe/reports/monitor`}];function Ki({kind:e,settings:t}){let r=Yt(),[i,a]=(0,Q.useState)({busy:!1});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,$.jsxs)(U,{size:`sm`,className:`self-start`,"data-tip":`Send a test message`,disabled:i.busy,onClick:async()=>{a({busy:!0});let n=Object.fromEntries(Object.entries(r.pending).filter(e=>typeof e[1]==`string`));try{let r=await nt.test(e,e,t,n);a({busy:!1,ok:r.ok,message:r.message})}catch(e){a({busy:!1,ok:!1,message:e.message})}},children:[(0,$.jsx)(n,{"aria-hidden":`true`}),i.busy?`Sending…`:`Test`]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:i.message&&(0,$.jsxs)(`p`,{role:i.ok?`status`:`alert`,className:B(`m-0 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,i.ok?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[i.ok?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:i.message})]})})]})}function qi({edit:e}){let t=K(Y(e.value,[`monitor`,`alerts`])),n=(t,n)=>e.set(q(e.value,[`monitor`,`alerts`,t],n));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`mt-0 mb-2 text-sm text-muted`,children:[`Start it with `,(0,$.jsx)(`code`,{className:`rounded-md bg-surface-strong px-2 py-1 font-mono text-[13px]`,children:`forgeqe monitor`}),`, or as a schedule.`]}),(0,$.jsx)(Z,{first:!0,children:`What runs`}),(0,$.jsx)(X,{defs:Wi,edit:e,base:[`monitor`]}),(0,$.jsx)(Z,{children:`When to alert`}),(0,$.jsx)(X,{defs:Gi,edit:e,base:[`monitor`]}),(0,$.jsx)(Z,{help:`The monitor's own alerts: when a check starts failing, keeps failing, or recovers.`,children:`Alerts`}),(0,$.jsx)(J,{label:`Microsoft Teams`,help:`A channel's Workflows webhook.`,children:(0,$.jsx)(Un,{checked:!!t.teams,onChange:e=>n(`teams`,e?{webhook_env:`TEAMS_MONITOR_WEBHOOK_URL`}:void 0),label:`Alert in Microsoft Teams`})}),!!t.teams&&(0,$.jsxs)(`div`,{className:`rounded-[14px] bg-surface-muted px-4 pb-2`,children:[(0,$.jsx)(gn,{def:{key:`teams.webhook_env`,label:`Webhook address`,help:`Kept in your credential store.`,type:`var`,placeholder:`TEAMS_MONITOR_WEBHOOK_URL`},edit:e,base:[`monitor`,`alerts`],stacked:!0}),(0,$.jsx)(Ki,{kind:`teams`,settings:{teams:K(t.teams)}})]}),(0,$.jsx)(J,{label:`Email`,help:`The same alerts by email.`,children:(0,$.jsx)(Un,{checked:!!t.email,onChange:e=>n(`email`,e?{port:587}:void 0),label:`Alert by email`})}),!!t.email&&(0,$.jsxs)(`div`,{className:`rounded-[14px] bg-surface-muted px-4 pb-2`,children:[(0,$.jsx)(X,{defs:Ni,edit:e,base:[`monitor`,`alerts`,`email`],stacked:!0}),(0,$.jsx)(Ki,{kind:`email`,settings:{email:K(t.email)}})]})]})}function Ji(e){return Tr(e).body.replace(/<!--[\s\S]*?(-->|$)/g,``).split(/\r?\n/).filter(e=>/^\s*(?:[-*+]|\d+[.)])\s+\S/.test(e)).length}var Yi=65536;function Xi({rules:e,others:t,onChange:n,onChanged:r}){let{data:i,error:o,reload:c}=Nn(ut.files),[l,u]=(0,Q.useState)(`rules`),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),S=(0,Q.useRef)(null),C=d.toLowerCase().split(/\s+/).filter(Boolean),w=(0,Q.useMemo)(()=>(i?.files||[]).filter(e=>C.every(t=>`${e.name} ${e.description} ${e.text} ${(e.agents||[]).map(e=>z(e).name).join(` `)}`.toLowerCase().includes(t))),[i,d]),T=e=>(v(``),b(``),m(e)),E=()=>({name:``,description:``,every:!0,agents:[],text:``}),D=async(e,t)=>{g(!0),v(``);try{await e(),m(null),c(),r(t)}catch(e){v(e.message)}finally{g(!1)}};if(!i)return(0,$.jsx)(En,{error:o,reload:c});let O=i.agents,ee=[{id:`rules`,label:`All rules`,n:e.length+t.length},{id:`files`,label:`Guardrail files`,n:i.files.length}],A=e=>e?.length?(0,$.jsx)(Cr,{names:e,max:2}):(0,$.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Every agent`}),ne=p?Ji(p.text):0,j=p&&!p.every?p.agents:[],M=p?{name:p.name,description:p.description,agents:j,text:p.text}:null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Qn,{label:`Show`,value:l,onChange:u,options:ee.map(e=>({id:e.id,label:e.label,n:e.n}))}),l===`files`&&(0,$.jsx)(gt,{id:`find-guardrails`,label:`Find guardrails`,value:d,onChange:f,placeholder:`Find guardrails or an agent`}),(0,$.jsxs)(U,{variant:`primary`,"data-tip":`Add guardrails`,onClick:()=>T(E()),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),l===`rules`&&(0,$.jsx)(Sn,{rules:e,others:t,onChange:n}),l===`files`&&(i.files.length===0?(0,$.jsxs)(yt,{icon:Ae,title:`No guardrail files yet`,action:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add guardrails`,onClick:()=>T(E()),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]}),children:[`Paste or upload a Markdown file of rules, one "- rule" line each: "- Never open a production URL" for every agent, or "- Use only the test cards in knowledge/test-data.md" for WebPilot and Quill. Saved in `,i.dir,`, shared with the project.`]}):(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(sn,{label:`Guardrail files`,search:!1,empty:`No guardrails match.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Guardrails`}),(0,$.jsx)(`th`,{scope:`col`,className:B(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Applies to`}),(0,$.jsx)(`th`,{scope:`col`,className:B(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`text-right`),children:`Rules`})]}),children:w.map(e=>{let t=()=>T({name:e.name,description:e.description,every:!e.agents,agents:e.agents||[],text:e.text,existing:e.name});return(0,$.jsxs)(`tr`,{onClick:t,className:`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,$.jsxs)(`td`,{className:B(`px-4 py-2`,`min-w-0`),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:e=>(e.stopPropagation(),t()),className:`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-left`,children:[(0,$.jsx)(Ae,{size:15,strokeWidth:1.8,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink hover:underline`,children:e.name})]}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-[13px] text-muted`,children:e.description||e.text.split(`
|
|
10
|
-
`).find(e=>e.trim())||``})]}),(0,$.jsx)(`td`,{className:B(`px-4 py-2`,`hidden w-[34%] @2xl:table-cell`),children:A(e.agents)}),(0,$.jsx)(`td`,{className:B(`px-4 py-2`,`w-[1%] text-right whitespace-nowrap`),children:(0,$.jsx)(`span`,{className:`rounded-full bg-surface-strong px-2 py-1 text-[13px] font-medium whitespace-nowrap text-muted tabular-nums`,children:ot(e.rules,`rule`)})})]},e.name)})})})),(0,$.jsx)(G,{wide:!0,open:!!p,onClose:()=>m(null),title:p?.existing?`Edit ${p.existing}`:`Add guardrails`,description:(0,$.jsxs)($.Fragment,{children:[`Rules the chosen agents must follow, from their next start. Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[i.dir,`/`,p?.name||`name`,`.md`]}),`, shared with the project.`]}),footer:(0,$.jsxs)($.Fragment,{children:[_&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:_}),p?.existing&&(0,$.jsxs)(U,{disabled:h,onClick:()=>p.existing&&D(()=>ut.remove(p.existing),`Removed ${p.existing}.`),className:`mr-auto text-fail`,children:[(0,$.jsx)(s,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(U,{onClick:()=>m(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:h||!p?.name||!p.every&&!p.agents.length||!ne,onClick:()=>p&&M&&D(()=>p.existing?ut.save(p.existing,M):ut.add(M),`${p.existing?`Saved`:`Added`} ${p.name}: ${ot(ne,`rule`)} for ${p.every?`every agent`:p.agents.map(e=>z(e).name).join(`, `)}, from their next start.`),children:[p?.existing?(0,$.jsx)(k,{"aria-hidden":`true`}):(0,$.jsx)(a,{"aria-hidden":`true`}),h?`Saving…`:p?.existing?`Save`:`Add`]})]}),children:p&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,$.jsx)(H,{value:p.name,disabled:!!p.existing,placeholder:`payments-rules`,onChange:e=>m({...p,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,48)}),className:`font-mono`}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Lowercase letters, digits and dashes.`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`What it is for`}),(0,$.jsx)(H,{value:p.description,maxLength:200,placeholder:`Keep runs off real cards and accounts`,onChange:e=>m({...p,description:e.target.value})})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 p-0 font-medium`,children:`Agents that follow it`}),(0,$.jsx)(Qn,{label:`Agents that follow it`,value:p.every?`every`:`chosen`,onChange:e=>m({...p,every:e===`every`}),options:[{id:`every`,label:`Every agent`},{id:`chosen`,label:`Chosen agents`}]}),!p.every&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:O.map(e=>{let t=p.agents.includes(e.name);return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,"data-tip":e.title,onClick:()=>m({...p,agents:t?p.agents.filter(t=>t!==e.name):[...p.agents,e.name]}),className:B(`inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-[8px] border px-4 text-[13px] font-medium`,t?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[(0,$.jsx)(Nt,{agent:e.name,px:18,decorative:!0}),z(e.name).name]},e.name)})}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:p.every?`Every agent ForgeQE runs, and your custom agents, follow these rules.`:p.agents.length?`${p.agents.length===1?`Only this agent follows`:`Only these ${p.agents.length} agents follow`} these rules. Custom agents follow every guardrail.`:`Pick at least one agent.`})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`guardrails-text`,className:`font-medium`,children:`Rules`}),(0,$.jsx)(`input`,{ref:S,type:`file`,accept:`.md,.markdown,.txt`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,!t)return;if(v(``),t.size>Yi)return v(`${t.name} is over 64 KB.`);let{head:n,body:r}=Tr((await t.text()).replace(/\r\n/g,`
|
|
11
|
-
`)),i=r.trim(),a=e=>RegExp(`^${e}:\\s*(.*?)\\s*$`,`m`).exec(n)?.[1]||``,o=a(`for`).split(/[,\s]+/).filter(e=>O.some(t=>t.name===e)),s=a(`description`).replace(/^"(.*)"$/,`$1`),c=p.name||t.name.replace(/\.[^.]+$/,``).toLowerCase().replace(/[^a-z0-9-]+/g,`-`).replace(/^-+|(?<!-)-+$/g,``).slice(0,48);m({...p,name:p.existing?p.name:c,text:i,description:p.description||s,...o.length?{every:!1,agents:o}:{}}),b(`From ${t.name}: ${ot(Ji(i),`rule`)}${o.length?`, for ${o.map(e=>z(e).name).join(`, `)}`:``}.`)}}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Upload a .md file`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(te,{"aria-hidden":`true`}),`Upload`]})]}),(0,$.jsx)(dt,{id:`guardrails-text`,rows:14,spellCheck:!0,value:p.text,placeholder:`# Payments
|
|
12
|
-
|
|
13
|
-
- Never open a production URL.
|
|
14
|
-
- Use only the test cards in knowledge/test-data.md.`,onChange:e=>(b(``),m({...p,text:e.target.value})),className:`leading-[1.6]`}),(0,$.jsx)(`span`,{role:`status`,className:B(`text-[13px]`,p.text.trim()&&!ne?`text-warn`:`text-muted`),children:y||(p.text.trim()&&!ne?`No rules yet: start each rule on a line of its own with "- ".`:`${ot(ne,`rule`)}. Paste Markdown or upload a .md file: each "- " line is a rule; headings and other lines explain them and are not sent.`)})]})]})})]})}var Zi=e(_(),1),Qi=[{step:`setup`,target:`project-folder`,title:`Your project folder`,body:`The folder of the app or tests ForgeQE works on. Browse to use one you have, or make a new one: its settings, reports and logs are kept there.`},{step:`setup`,target:`repository`,title:`Connect a repository`,body:`A folder with a repository goes on as it is. An empty one can take a clone of a repository you have, or start a new one. Skip it if you don't use git.`},{step:`setup`,target:`forgeqe-in-this-folder`,title:`Set ForgeQE up here`,body:`Writes forgeqe.yaml and its friends into the folder, keeping anything already there. Required: everything else builds on it.`,needs:`init`},{step:`setup`,target:`this-computer`,title:`What this computer needs`,body:`The browser engine and the agent runtime the agents work with. Install downloads a few hundred MB, once. Required.`,needs:`core`},{step:`setup`,target:`features-to-download`,title:`Pick your features`,body:`Talk, mobile, desktop and the knowledge graph each say what they download and how big it is. Tick what you need; nothing downloads until you agree.`},{step:`models`,target:`section`,title:`Choose a model`,body:`The model your agents think with. Pick a provider and add its key, or sign in with GitHub Copilot. Keys go to your credential store, never to a file.`},{step:`evidence`,target:`section`,title:`Teach it your product`,body:`Your product's repositories, where its requirements live and its documents. The agents read them to test what your product is meant to do.`},{step:`appearance`,target:`logo-and-name`,title:`Your logo`,body:`Upload your logo and a small one for the narrow sidebar, and give the app your team's name.`},{step:`appearance`,target:`colours`,title:`Colours and agents`,body:`The sidebar, buttons and page colours, how the agents are drawn (robots, characters or icons), or colours taken from your website.`}],$i=10,ea=()=>Number.parseFloat(getComputedStyle(document.documentElement).zoom||`1`)||1,ta=()=>({vw:window.innerWidth/ea(),vh:window.innerHeight/ea()});function na(e){let t=document.querySelector(`[data-tour="${e}"]`);if(!t)return[];if(e===`section`)return[...t.children];let n=[t];if(t.hasAttribute(`data-group-title`))for(let e=t.nextElementSibling;e&&!e.hasAttribute(`data-group-title`);e=e.nextElementSibling)n.push(e);return n}function ra(e){if(!e.length)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){if(getComputedStyle(a).position===`fixed`)continue;let e=a.getBoundingClientRect();e.width&&e.height&&(t=Math.min(t,e.top),n=Math.min(n,e.left),r=Math.max(r,e.right),i=Math.max(i,e.bottom))}if(t===1/0)return null;let a=ea();return{top:t/a-$i,left:n/a-$i,width:(r-n)/a+20,height:(i-t)/a+20}}function ia(e,t){let[n,r]=(0,Q.useState)(null);return(0,Q.useLayoutEffect)(()=>{let t=document.documentElement;if(!e)return t.classList.remove(`tour-on`),r(null);t.classList.add(`tour-on`);let n=new Set,i=e=>{let t=new Set(e);for(let e of n)t.has(e)||e.classList.remove(`tour-lit`);for(let e of t)e.classList.contains(`tour-lit`)||e.classList.add(`tour-lit`);n=t},a=0,o=()=>{cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let t=na(e);i(t);let n=ra(t);r(e=>n&&e&&Math.abs(n.top-e.top)<.5&&Math.abs(n.left-e.left)<.5&&Math.abs(n.height-e.height)<.5&&Math.abs(n.width-e.width)<.5?e:n)})},s=0,c=()=>{let t=document.querySelector(`[data-tour="${e}"]`);if(!t&&s++<40)return void(l=setTimeout(c,150));t?.scrollIntoView({behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`,block:`start`}),o()},l=setTimeout(c,60),u=new ResizeObserver(o);u.observe(document.body);let d=new MutationObserver(o);return d.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener(`scroll`,o,!0),window.addEventListener(`resize`,o),()=>{for(let e of n)e.classList.remove(`tour-lit`);t.classList.remove(`tour-on`),clearTimeout(l),cancelAnimationFrame(a),u.disconnect(),d.disconnect(),window.removeEventListener(`scroll`,o,!0),window.removeEventListener(`resize`,o)}},[e,t]),n}function aa({box:e}){return e?(0,$.jsx)(`div`,{className:`tour-ring`,style:{top:e.top,left:e.left,width:e.width,height:e.height}}):null}var oa=360;function sa(e,t){let{vw:n,vh:r}=ta(),i=Math.min(oa,n-32);return e?e.left+e.width+24+i<n?{top:(e=>Math.min(Math.max(16,e),r-t-16))(e.top),left:e.left+e.width+24,width:i}:e.top+e.height+16+t<r?{top:e.top+e.height+16,left:Math.min(Math.max(16,e.left),n-i-16),width:i}:e.top-16-t>0?{top:e.top-16-t,left:Math.min(Math.max(16,e.left),n-i-16),width:i}:{top:r-t-16,left:n-i-16,width:i}:{top:Math.max(16,(r-t)/2),left:(n-i)/2,width:i}}var ca=`forgeqe-tour-welcome`,la=()=>{try{sessionStorage.setItem(ca,`1`)}catch{}},ua=()=>{try{return sessionStorage.getItem(ca)===`1`}catch{return!1}},da=()=>{try{sessionStorage.removeItem(ca)}catch{}},fa=!1;function pa({step:e,ready:t,coreReady:n,onGo:r,onSkipAll:i,onFinish:a,note:o,welcome:s,onStart:c}){let l=Qi.map((e,t)=>({...e,i:t})).filter(t=>t.step===e),[u,d]=(0,Q.useState)(()=>fa?l.length-1:0),[f,p]=(0,Q.useState)(()=>s&&e===`setup`&&!fa?`welcome`:`tour`),[m,h]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{fa=!1},[]);let g=l[Math.min(u,l.length-1)],_=ia(f===`tour`&&!m?g.target:void 0,g.i),v=(0,Q.useRef)(null),[y,b]=(0,Q.useState)(220);(0,Q.useLayoutEffect)(()=>{v.current&&b(v.current.offsetHeight)});let S=g.needs===`init`?!t:g.needs===`core`&&!n,C=Qi.length,w=(0,Q.useCallback)(()=>{if(u<l.length-1)return d(u+1);let t=[`setup`,`models`,`evidence`,`appearance`],n=t.indexOf(e);if(n===t.length-1)return p(`finish`);r(t[n+1])},[u,l.length,e,r]);return(0,Q.useEffect)(()=>{let e=e=>{f!==`tour`||m||e.target?.closest?.(`input, textarea, select, [contenteditable]`)||(e.key===`ArrowRight`&&!S&&w(),e.key===`Escape`&&h(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,m,S,w]),m?(0,Zi.createPortal)((0,$.jsxs)(`button`,{type:`button`,onClick:()=>h(!1),className:`tour-card fixed right-6 bottom-6 z-[62] inline-flex min-h-11 cursor-pointer items-center gap-2 rounded-full border-0 bg-accent px-6 text-sm font-medium text-accent-ink shadow-composer`,children:[(0,$.jsx)(Ne,{size:16,"aria-hidden":`true`}),`Resume the tour · `,g.i+1,` of `,C]}),document.body):f===`welcome`?(0,Zi.createPortal)((0,$.jsxs)(ma,{children:[(0,$.jsx)(`div`,{className:`flex size-14 items-center justify-center rounded-[16px] bg-accent-soft text-accent`,children:(0,$.jsx)(F,{size:28,"aria-hidden":`true`})}),(0,$.jsx)(`h2`,{id:`tour-title`,className:`m-0 text-[25px] leading-tight font-semibold tracking-[-0.01em]`,children:`Welcome to ForgeQE`}),(0,$.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:`A few minutes to get you started. We'll light up each part of the app as we go, and you set it up right there.`}),(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:[[`Set up`,`your folder, repository and what to download`,!0],[`Models`,`the AI your agents think with`,!1],[`Product knowledge`,`what your product does`,!1],[`Appearance`,`your logo, colours and agents`,!1]].map(([e,t,n],r)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-4 rounded-[12px] bg-surface-muted px-4 py-2`,style:{animation:`tour-pop 0.4s ${.08*r+.1}s cubic-bezier(0.22,1,0.36,1) both`},children:[(0,$.jsx)(`span`,{className:`inline-flex size-6 flex-none items-center justify-center rounded-full bg-accent text-[13px] font-semibold text-accent-ink tabular-nums`,children:r+1}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-ink`,children:e}),` `,(0,$.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,t]})]}),n?(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:`Required`}):null]},String(e)))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsx)(U,{variant:`ghost`,onClick:()=>(n&&t||p(`tour`),i()),"data-tip":`Skip onboarding: everything but Set up can be done later in Settings`,children:`Skip onboarding`}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsxs)(U,{variant:`primary`,size:`lg`,onClick:()=>{c(),p(`tour`)},"data-autofocus":!0,children:[`Let's go`,(0,$.jsx)(Fe,{"aria-hidden":`true`})]})]})]}),document.body):f===`finish`?(0,Zi.createPortal)((0,$.jsxs)(ma,{children:[(0,$.jsx)(ga,{}),(0,$.jsx)(`div`,{className:`flex size-14 items-center justify-center rounded-[16px] bg-pass-soft text-pass`,children:(0,$.jsx)(k,{size:28,strokeWidth:2.5,"aria-hidden":`true`})}),(0,$.jsx)(`h2`,{id:`tour-title`,className:`m-0 text-[25px] leading-tight font-semibold tracking-[-0.01em]`,children:`You're all set`}),(0,$.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:`ForgeQE is ready to work. Anything you skipped is in Settings whenever you want it, and Settings › Set up can run this tour again.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsxs)(U,{variant:`ghost`,onClick:()=>p(`tour`),children:[(0,$.jsx)(be,{"aria-hidden":`true`}),`Back`]}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsxs)(U,{variant:`primary`,size:`lg`,onClick:a,"data-autofocus":!0,children:[(0,$.jsx)(F,{"aria-hidden":`true`}),`Open ForgeQE`]})]})]}),document.body):(0,Zi.createPortal)((0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(aa,{box:_}),(0,$.jsxs)(`div`,{ref:v,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`tour-card-title`,className:`tour-card fixed z-[62] flex flex-col gap-4 rounded-[16px] border border-line bg-bg p-6 shadow-composer`,style:sa(_,y),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-[13px] font-medium tracking-wide text-accent uppercase`,children:[`Step `,g.i+1,` of `,C]}),g.needs&&(0,$.jsx)(`span`,{className:`rounded-full bg-surface-strong px-2 text-[13px] font-medium text-ink-2`,children:`Required`}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Hide the tour`,"data-tip":`Hide the tour (Esc)`,onClick:()=>h(!0),className:`inline-flex size-8 cursor-pointer items-center justify-center rounded-[8px] border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,$.jsx)(x,{size:16,"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{id:`tour-card-title`,className:`m-0 text-lg leading-snug font-semibold`,children:g.title}),(0,$.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:g.body})]}),o&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] leading-relaxed text-fail`,children:o}),S&&(0,$.jsxs)(`p`,{role:`status`,className:`m-0 flex items-start gap-2 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] leading-relaxed text-warn`,children:[(0,$.jsx)(me,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),g.needs===`init`?`Press Set up in the lit area first: Next opens once it is done.`:`Press Install in the lit area: Next opens once the browser engine and agent runtime are ready.`]}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`flex gap-1`,children:Qi.map((e,t)=>(0,$.jsx)(`span`,{className:B(`h-1 flex-1 rounded-full transition-colors duration-300`,t<g.i?`bg-accent/50`:t===g.i?`bg-accent`:`bg-surface-strong`)},t))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`ghost`,onClick:()=>{if(u>0)return d(u-1);let t=[`setup`,`models`,`evidence`,`appearance`],n=t.indexOf(e);n>0?(fa=!0,r(t[n-1])):p(`welcome`)},children:[(0,$.jsx)(be,{"aria-hidden":`true`}),`Back`]}),(0,$.jsx)(`span`,{className:`flex-1`}),e!==`setup`&&(0,$.jsx)(U,{size:`sm`,onClick:()=>{let t=[`setup`,`models`,`evidence`,`appearance`],n=t.indexOf(e);if(n===t.length-1)return p(`finish`);r(t[n+1],e)},"data-tip":`Skip this step: set it later in Settings`,children:`Skip`}),(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:S,onClick:w,autoFocus:!0,children:[g.i===C-1?`Finish`:`Next`,(0,$.jsx)(Fe,{"aria-hidden":`true`})]})]}),e===`setup`&&(0,$.jsx)(`button`,{type:`button`,onClick:i,className:`-mt-2 cursor-pointer self-start border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:`Skip onboarding`})]},g.i)]}),document.body)}function ma({children:e}){let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=t.current;if(e&&!e.open)return e.showModal(),e.querySelector(`[data-autofocus]`)?.focus(),()=>e.close()},[]),(0,$.jsxs)(`dialog`,{ref:t,"aria-labelledby":`tour-title`,onCancel:e=>e.preventDefault(),className:`fixed inset-0 m-0 h-auto max-h-none w-auto max-w-none overflow-hidden border-0 bg-transparent p-0 text-ink backdrop:bg-transparent`,children:[(0,$.jsx)(`div`,{className:`tour-pane`,style:{inset:0}}),(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center overflow-y-auto p-4`,children:(0,$.jsx)(`div`,{className:`tour-card relative flex w-full max-w-[480px] flex-col gap-4 overflow-hidden rounded-[20px] border border-line bg-bg p-8 shadow-composer`,children:e})})]})}var ha=[`var(--color-accent)`,`var(--color-pass)`,`var(--color-warn)`,`#ec4899`,`#8b5cf6`,`#06b6d4`];function ga(){return(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 top-0 h-0`,children:Array.from({length:28},(e,t)=>(0,$.jsx)(`span`,{className:`tour-confetti`,style:{left:`${t*37%100}%`,background:ha[t%ha.length],animationDelay:`${t%7*.08}s`}},t))})}var _a=`font-mono text-[13px] [overflow-wrap:anywhere]`;function va({ok:e,children:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:B(`m-0 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm leading-relaxed`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(f,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function ya({open:e,start:t,onClose:n,onPick:r}){let[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[u,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),_=(0,Q.useCallback)(async e=>{f(``);try{let t=await st.folders(e);o(t),c(t.path)}catch(e){f(e.message)}},[]);(0,Q.useEffect)(()=>{e?_(t||void 0):(m(null),f(``))},[e,t,_]);let y=async()=>{if(i&&p!==null){f(``);try{let e=await st.newFolder(i.path,p);o(e),c(e.path),m(null)}catch(e){f(e.message)}}};return(0,$.jsxs)(G,{open:e,onClose:n,wide:!0,title:`Choose the project folder`,description:`The folder of the app or test repository ForgeQE works on. Its settings, reports and logs are kept in it.`,footer:(0,$.jsxs)($.Fragment,{children:[i?.project&&(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-pass`,children:`ForgeQE is set up here`}),(0,$.jsxs)(U,{onClick:n,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!i||h,onClick:async()=>{g(!0);try{await r(i.path)}catch(e){f(e.message)}finally{g(!1)}},"data-tip":`Use this folder`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),`Use`]})]}),children:[(0,$.jsxs)(`form`,{className:`flex gap-2 pt-6`,onSubmit:e=>{e.preventDefault(),_(s.trim())},children:[(0,$.jsx)(`label`,{htmlFor:`folder-path`,className:`sr-only`,children:`Folder path`}),(0,$.jsx)(H,{id:`folder-path`,value:s,spellCheck:!1,onChange:e=>c(e.target.value),className:`font-mono`,placeholder:`/Users/you/shop`}),(0,$.jsxs)(U,{size:`sm`,type:`submit`,children:[(0,$.jsx)(Fe,{"aria-hidden":`true`}),`Go`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-4`,children:[(0,$.jsxs)(U,{size:`sm`,disabled:!i?.parent,onClick:()=>i?.parent&&void _(i.parent),children:[(0,$.jsx)(fe,{"aria-hidden":`true`}),`Up`]}),(0,$.jsxs)(U,{size:`sm`,onClick:()=>void _(i?.home),children:[(0,$.jsx)(v,{"aria-hidden":`true`}),`Home`]}),(0,$.jsxs)(U,{size:`sm`,disabled:!i,"data-tip":`New folder`,onClick:()=>m(``),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`New`]})]}),p!==null&&(0,$.jsxs)(`form`,{className:`flex flex-wrap gap-2 pt-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,$.jsx)(`label`,{htmlFor:`new-folder`,className:`sr-only`,children:`New folder's name`}),(0,$.jsx)(H,{id:`new-folder`,autoFocus:!0,value:p,placeholder:`my-shop-tests`,onChange:e=>m(e.target.value),className:`flex-[1_1_200px]`}),(0,$.jsxs)(U,{size:`sm`,type:`submit`,variant:`primary`,disabled:!p.trim(),"data-tip":`Make the folder`,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Create`]}),(0,$.jsxs)(U,{size:`sm`,onClick:()=>m(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,className:`pt-4`,children:u&&(0,$.jsx)(va,{ok:!1,children:u})}),i&&(0,$.jsxs)(`ul`,{"aria-label":`Folders in ${i.path}`,className:`m-0 mt-2 flex list-none flex-col p-0`,children:[i.folders.length===0&&(0,$.jsx)(`li`,{className:`border-t border-line-soft py-4 text-sm text-muted`,children:`No folders in here.`}),i.folders.map(e=>(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void _(e.path),className:`flex min-h-12 w-full cursor-pointer items-center gap-4 border-0 bg-transparent px-2 text-left text-ink hover:bg-surface-muted`,children:[e.project?(0,$.jsx)(l,{size:18,"aria-hidden":`true`,className:`flex-none text-pass`}):(0,$.jsx)(pt,{icon:d,size:18,className:`flex-none text-muted`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e.name}),e.project&&(0,$.jsx)(W,{tone:`pass`,children:`ForgeQE`})]})},e.path))]})]})}function ba({report:e}){let t=[...new Set(e.rows.map(e=>e.group))];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(va,{ok:!e.missing&&!e.outdated,children:e.missing||e.outdated?`${e.missing} missing and ${e.outdated} out of date. Install what's missing puts back the browser engine, the agent runtime and, for a device on this computer, Appium; the others say what installs them.`:`Every package ForgeQE needs now is installed.`}),t.map(t=>(0,$.jsxs)(`ul`,{"aria-label":t,className:`m-0 flex list-none flex-col p-0`,children:[(0,$.jsx)(`li`,{className:`pt-4 pb-1 text-sm font-medium text-ink-2`,children:t}),e.rows.filter(e=>e.group===t).map(e=>(0,$.jsxs)(`li`,{className:`flex min-h-[48px] flex-wrap items-center gap-x-4 gap-y-1 border-t border-line-soft py-2`,children:[(0,$.jsx)(`span`,{className:B(`min-w-0 flex-[1_1_180px]`,_a),children:e.name}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-[2_1_240px] text-sm text-muted [overflow-wrap:anywhere]`,children:[e.status===`ok`?e.installed||`Installed`:e.status===`missing`?`Needs ${e.wanted}`:`${e.installed} installed, needs ${e.wanted}`,e.status!==`ok`&&(0,$.jsxs)($.Fragment,{children:[` · Fix: `,/^forgeqe /.test(e.fix)?(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e.fix}):e.fix]})]}),(0,$.jsx)(W,{tone:e.status===`ok`?`pass`:e.later?`neutral`:`warn`,children:e.status===`ok`?`Installed`:e.later?`When first used`:e.status===`missing`?`Missing`:`Out of date`})]},e.name))]},t))]})}function xa({state:e,onState:t,guide:n=!1}){let[r,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)({busy:!1}),[u,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)({busy:!1}),b=async()=>{y({busy:!0});try{y({busy:!1,report:await st.packages()})}catch(e){y({busy:!1,error:e.message})}},x=(0,Q.useCallback)(()=>{h(``),st.machine().then(p,e=>h(e.message))},[]);(0,Q.useEffect)(x,[x,e.project,e.ready]);let S=!!u?.job?.running;(0,Q.useEffect)(()=>{if(!S)return;let e=cn(x,1500);return()=>an(e)},[S,x]),(0,Q.useEffect)(()=>{!S&&v.report&&b()},[S]);let w=async e=>{let n=await st.open(e);c({busy:!1}),t(n),o(!1)},T=u?.job,E=u?.checks.filter(e=>!/^(Models?\b|Copilot sign-in)/.test(e.name))||[],D=E.filter(e=>!e.ok&&/forgeqe setup/.test(e.fix||``));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,help:`The folder of the project ForgeQE works on: an app, its tests, or both. ForgeQE keeps its settings, reports and logs there.`,children:`1. Project folder`}),(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Kn,{icon:e.ready?l:d}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:B(`font-medium`,_a),children:e.project}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:e.ready?`ForgeQE is set up here (${e.config}).`:`ForgeQE is not set up in this folder yet.`})]}),(0,$.jsxs)(U,{size:`sm`,"data-tip":e.ready?`Open another folder`:`Choose a folder`,onClick:()=>o(!0),children:[(0,$.jsx)(i,{"aria-hidden":`true`}),`Browse`]})]}),e.recent.length>0&&(0,$.jsx)(`ul`,{"aria-label":`Recent projects`,className:`m-0 flex list-none flex-col p-0`,children:e.recent.map(e=>(0,$.jsxs)(`li`,{className:`flex min-h-[56px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-2 pl-14`,children:[(0,$.jsx)(`span`,{className:B(`min-w-0 flex-[1_1_260px] text-ink-2`,_a),children:e}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Open ${e}`,"data-tip":`Open ${e}`,onClick:()=>void w(e).catch(e=>h(e.message)),children:(0,$.jsx)(Fe,{"aria-hidden":`true`})})]},e))}),(0,$.jsx)(Sa,{project:e.project}),(0,$.jsx)(Z,{help:`forgeqe.yaml, llms.json, env.yaml and a .forgeqe folder with prompts, skills and guardrails to change. Files already there are kept.`,children:`3. ForgeQE in this folder`}),(0,$.jsx)(J,{label:e.ready?`Set up`:`Not set up yet`,help:e.ready?`${e.config} is in this folder, so every section of Settings is open.`:`Until it is, the other sections of Settings stay locked: there is nothing for them to change.`,children:e.ready?(0,$.jsx)(W,{tone:`pass`,children:`Done`}):(0,$.jsxs)(U,{size:`sm`,variant:`primary`,"data-tip":`Set up this folder`,disabled:s.busy,onClick:async()=>{c({busy:!0});try{let e=await st.init();c({busy:!1,result:e}),t(e.setup)}catch(e){c({busy:!1,error:e.message})}},children:[(0,$.jsx)(Pe,{"aria-hidden":`true`}),s.busy?`Setting up…`:`Set up`]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2`,children:[s.error&&(0,$.jsx)(va,{ok:!1,children:s.error}),s.result&&(0,$.jsxs)(va,{ok:!s.result.failed.length,children:[s.result.created.length?`Made ${s.result.created.join(`, `)}.`:`Nothing new was needed.`,s.result.failed.length>0&&` Could not write: ${s.result.failed.join(`; `)}.`]})]}),(0,$.jsx)(Z,{help:`What ForgeQE runs with: its browser engine and the agent runtime. Installing them needs no admin rights${u?`. ForgeQE ${u.version}`:``}.`,children:`4. This computer`}),m&&(0,$.jsx)(va,{ok:!1,children:m}),!u&&!m&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Checking this computer…`}),u&&(0,$.jsx)(`ul`,{"aria-label":`What this computer has`,className:`m-0 flex list-none flex-col p-0`,children:E.map(e=>(0,$.jsxs)(`li`,{className:`flex min-h-[56px] items-start gap-4 border-t border-line-soft py-4`,children:[e.ok?(0,$.jsx)(C,{size:18,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,$.jsx)(f,{size:18,"aria-label":`Missing`,className:`mt-1 flex-none text-warn`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsxs)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.detail,!e.ok&&e.fix&&(0,$.jsxs)($.Fragment,{children:[`. `,/forgeqe setup/.test(e.fix)?`Install, below, sets it up.`:e.fix]})]})]})]},e.name))}),u&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft py-4`,children:[(0,$.jsx)(U,{size:`sm`,variant:D.length?`primary`:`outline`,"data-tip":D.length?`Install what's missing`:`Check and repair`,disabled:S||g,onClick:async()=>{_(!0);try{await st.run(),x()}catch(e){h(e.message)}finally{_(!1)}},children:S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ht,{state:`handing`,px:16}),`Installing…`]}):D.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{"aria-hidden":`true`}),`Install`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ae,{"aria-hidden":`true`}),`Repair`]})}),(0,$.jsxs)(U,{size:`sm`,disabled:v.busy,onClick:()=>void b(),"data-tip":`Find missing packages: lists every package ForgeQE installs here, with the version it needs and the one installed`,children:[(0,$.jsx)(se,{"aria-hidden":`true`}),v.busy?`Finding…`:`Find`]}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Install runs forgeqe setup. The first time it downloads a few hundred MB and takes a few minutes.`})]}),(0,$.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2`,children:[v.error&&(0,$.jsx)(va,{ok:!1,children:v.error}),v.report&&(0,$.jsx)(ba,{report:v.report})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!T.running&&(0,$.jsx)(va,{ok:!!T.ok,children:T.ok?`forgeqe setup finished.`:`forgeqe setup stopped with a problem. The last lines below say what.`}),(0,$.jsx)(`pre`,{"aria-label":`forgeqe setup output`,"aria-live":`polite`,className:`m-0 max-h-[280px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:(0,$.jsx)(bt,{text:T.lines.length?T.lines.join(`
|
|
15
|
-
`):`Starting…`})})]}),(0,$.jsx)(Ea,{coreReady:!!u?.engine&&!!u?.runtime,onDone:x}),(0,$.jsx)(Z,{help:`At least one model with its key or sign-in, for the agents to think with.`,children:`6. A model`}),(0,$.jsx)(J,{label:u?.model.ready?`Ready`:`Not yet`,help:u?.model.detail||``,children:e.ready?(0,$.jsxs)(`a`,{className:mt({variant:u?.model.ready?`outline`:`primary`}),href:R(`settings`,`models`),"data-tip":u?.model.ready?`Open Models`:`Add a model`,children:[u?.model.ready?(0,$.jsx)(Fe,{"aria-hidden":`true`}):(0,$.jsx)(a,{"aria-hidden":`true`}),u?.model.ready?`Models`:`Add`]}):(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`After step 3`})}),e.ready&&(0,$.jsx)(oi,{}),!n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Set up, the model, your product's knowledge and how the app looks, one section after another.`,children:`Onboarding`}),(0,$.jsx)(J,{label:`Walk through onboarding`,help:`Starts again from this section, whatever was skipped before.`,children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Walk through onboarding`,onClick:async()=>{try{await rt.save({redo:!0})}finally{la(),location.hash=R(`welcome`,`setup`)}},children:[(0,$.jsx)(F,{"aria-hidden":`true`}),`Start`]})})]}),(0,$.jsx)(ya,{open:r,start:e.project,onClose:()=>o(!1),onPick:w})]})}function Sa({project:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=(0,Q.useCallback)(()=>{rt.repo().then(n,e=>i(e.message))},[]);(0,Q.useEffect)(c,[c,e]);let l=()=>{s(null),c()};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`The git repository your tests live in. A folder that has one goes on as it is; an empty one can take a clone of one you have.`,children:`2. Repository`}),r&&(0,$.jsx)(va,{ok:!1,children:r}),!t&&!r&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Reading the folder…`}),t?.git&&(0,$.jsx)(J,{label:t.remote?(0,$.jsx)(`span`,{className:_a,children:t.remote}):`A repository with no remote`,help:[t.branch&&`On ${t.branch}`,t.commit&&`at ${t.commit}`,t.root&&`inside the repository at ${t.root}`].filter(Boolean).join(` `)||`Add a remote with git when you want to share it; ForgeQE works either way.`,children:(0,$.jsx)(W,{tone:`pass`,children:`Connected`})}),t&&!t.git&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Clone a repository`,help:t.empty?`Copy a repository you have (GitHub, Azure DevOps, GitLab…) into this empty folder.`:`This folder has ${t.entries} ${t.entries===1?`item`:`items`} in it: a clone needs an empty folder. Choose or make one above.`,children:(0,$.jsxs)(U,{size:`sm`,variant:t.empty?`primary`:`outline`,disabled:!t.empty,onClick:()=>s(`clone`),"data-tip":`Clone a repository into this folder`,children:[(0,$.jsx)(m,{"aria-hidden":`true`}),`Clone`]})}),(0,$.jsx)(J,{label:`Start a new repository`,help:`git init in this folder, with your remote's address if you have one. Nothing is pushed.`,children:(0,$.jsxs)(U,{size:`sm`,onClick:()=>s(`new`),"data-tip":`Start a repository here`,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Start`]})})]}),(0,$.jsx)(Ca,{open:o===`clone`,onClose:()=>s(null),onDone:l}),(0,$.jsx)(wa,{open:o===`new`,onClose:()=>s(null),onDone:l})]})}function Ca({open:e,onClose:t,onDone:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{e&&(g(``),rt.tokens().then(e=>c(e.tokens),()=>{}))},[e]);let _=async e=>{m(e),g(``);try{if(e===`test`){let e=await rt.branches(r.trim(),a||void 0);u(e.branches),f(e.head??e.branches[0]??``)}else await rt.clone(r.trim(),d||void 0,a||void 0),n()}catch(e){g(e.message)}finally{m(``)}};return(0,$.jsxs)(G,{open:e,onClose:t,title:`Clone a repository`,description:`Into the project folder. Test first: it checks the repository answers and lists its branches.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{onClick:t,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{disabled:!r.trim()||!!p,onClick:()=>void _(`test`),"data-tip":`Check the repository answers`,children:[p===`test`?(0,$.jsx)(ht,{state:`working`,px:14}):(0,$.jsx)(ne,{"aria-hidden":`true`}),p===`test`?`Testing…`:`Test`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!l||!!p,onClick:()=>void _(`clone`),"data-tip":`Clone into this folder`,children:[p===`clone`?(0,$.jsx)(ht,{state:`working`,px:14}):(0,$.jsx)(Ee,{"aria-hidden":`true`}),p===`clone`?`Cloning…`:`Clone`]})]}),children:[(0,$.jsx)(J,{label:`Address`,help:`https:// or git@. Leave any user name or token out of it.`,htmlFor:`clone-url`,stacked:!0,children:(0,$.jsx)(H,{inputMode:`url`,id:`clone-url`,value:r,spellCheck:!1,placeholder:`https://github.com/org/tests.git`,onChange:e=>(i(e.target.value),u(null)),className:`font-mono`})}),(0,$.jsx)(J,{label:`Token`,help:(0,$.jsxs)($.Fragment,{children:[`For a private repository: a token saved in `,(0,$.jsx)(`a`,{href:R(`settings`,`secrets`),children:`Secrets`}),`, by its name. Used for this clone only, never written into the folder.`]}),htmlFor:`clone-token`,stacked:!0,children:(0,$.jsxs)(V,{id:`clone-token`,value:a,onChange:e=>(o(e.target.value),u(null)),children:[(0,$.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),s.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}),l&&(0,$.jsx)(J,{label:`Branch`,htmlFor:`clone-branch`,stacked:!0,children:(0,$.jsx)(V,{id:`clone-branch`,value:d,onChange:e=>f(e.target.value),children:l.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:h&&(0,$.jsx)(va,{ok:!1,children:h})})]})}function wa({open:e,onClose:t,onDone:n}){let[r,i]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``);return(0,$.jsxs)(G,{open:e,onClose:t,title:`Start a new repository`,description:`git init in the project folder. Nothing is pushed.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{onClick:t,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:o,onClick:async()=>{s(!0),l(``);try{await rt.startRepo(r.trim()||void 0),n()}catch(e){l(e.message)}finally{s(!1)}},children:[o?(0,$.jsx)(ht,{state:`working`,px:14}):(0,$.jsx)(a,{"aria-hidden":`true`}),`Start`]})]}),children:[(0,$.jsx)(J,{label:`Remote address`,help:`Optional: an empty repository you made on GitHub, Azure DevOps or GitLab, to push to later.`,htmlFor:`new-remote`,stacked:!0,children:(0,$.jsx)(H,{inputMode:`url`,id:`new-remote`,value:r,spellCheck:!1,placeholder:`https://github.com/org/new-tests.git`,onChange:e=>i(e.target.value),className:`font-mono`})}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:c&&(0,$.jsx)(va,{ok:!1,children:c})})]})}var Ta=e=>e>=1024?`${(e/1024).toFixed(1)} GB`:`${e} MB`;function Ea({coreReady:e,onDone:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useCallback)(()=>{rt.features().then(r,e=>l(e.message))},[]);(0,Q.useEffect)(u,[u]);let d=!!n?.job?.running;(0,Q.useEffect)(()=>{if(!d)return;let e=cn(u,1500);return()=>an(e)},[d,u]);let[f,p]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{f&&!d&&t(),p(d)},[d]);let m=n?.features??[],h=m.filter(e=>!e.required),g=e=>m.find(t=>t.id===e),_=(e,t)=>a(n=>t?[...new Set([...n,e.id,...e.needs&&!g(e.needs).ready?[e.needs]:[]])]:n.filter(t=>t!==e.id&&g(t).needs!==e.id)),v=m.filter(e=>(i.includes(e.id)||e.required&&i.length>0)&&!e.ready&&e.available),y=v.reduce((e,t)=>e+t.mb,0),b=n?.freeMb??null,x=b!==null&&y>b,S=n?.job;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Pick what you'll use ForgeQE for. Each says what it downloads, about how much and where; nothing downloads until you agree.`,children:`5. Features to download`}),c&&(0,$.jsx)(va,{ok:!1,children:c}),!n&&!c&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Checking this computer…`}),h.map(e=>{let t=S?.failed.find(t=>t.id===e.id);return(0,$.jsx)(J,{label:e.name,htmlFor:`feature-${e.id}`,help:(0,$.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{children:e.gives}),!e.ready&&e.available&&(0,$.jsxs)(`span`,{className:`text-muted`,children:[`Downloads `,e.downloads,`: about `,Ta(e.mb),`, in `,(0,$.jsx)(`span`,{className:`font-mono`,children:e.where}),`.`,e.needs?` Needs ${g(e.needs).name}.`:``]}),e.note&&(0,$.jsx)(`span`,{className:e.available?`text-warn`:`text-muted`,children:e.note}),t&&(0,$.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:t.error})]}),children:S?.current===e.id?(0,$.jsx)(W,{tone:`running`,children:`Installing`}):e.ready?(0,$.jsx)(W,{tone:`pass`,children:`Ready`}):e.available?(0,$.jsx)(yn,{id:`feature-${e.id}`,checked:i.includes(e.id),disabled:d,onCheckedChange:t=>_(e,t)}):(0,$.jsx)(W,{tone:`neutral`,children:`Not offered here`})},e.id)}),n&&(0,$.jsx)(J,{label:v.length?`${v.length} to set up, about ${Ta(y)}`:`Nothing picked`,help:(0,$.jsxs)($.Fragment,{children:[v.length>0&&(0,$.jsxs)($.Fragment,{children:[v.map(e=>e.name).join(`, `),`. `]}),!e&&v.length>0&&`The browser engine comes first: every feature builds on it. `,b!==null&&(0,$.jsxs)($.Fragment,{children:[`This computer has `,Ta(b),` free.`]}),x&&(0,$.jsx)(`span`,{className:`text-fail`,children:` Not enough free space: free some up, or pick fewer.`})]}),children:o?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:d,onClick:async()=>{s(!1),l(``);try{r(await rt.install(i)),a([])}catch(e){l(e.message)}},"data-tip":`Download about ${Ta(y)} and set these up`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),`Download `,Ta(y)]}),(0,$.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,$.jsxs)(U,{size:`sm`,disabled:!v.length||d||x,onClick:()=>s(!0),"data-tip":`Set up the features picked`,children:[d?(0,$.jsx)(ht,{state:`handing`,px:16}):(0,$.jsx)(Ee,{"aria-hidden":`true`}),d?`Installing…`:`Set up`]})}),S&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!S.running&&(0,$.jsx)(va,{ok:!S.failed.length,children:S.failed.length?`${S.done.length} of ${S.picked.length} set up; ${S.failed.length} did not.`:`${S.done.length} of ${S.picked.length} set up.`}),(0,$.jsx)(`pre`,{"aria-label":`Feature set-up output`,"aria-live":`polite`,className:`m-0 max-h-[280px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:(0,$.jsx)(bt,{text:S.lines.length?S.lines.join(`
|
|
16
|
-
`):`Starting…`})})]})]})}var Da={"notify-test":[`Sending a test card`,`Sent a test card`,`working`],"update-check":[`Looking for a new version`,`Looked for a new version`,`searching`],update:[`Updating ForgeQE`,`Updated ForgeQE`,`working`],"eval-domain":[`Checking the agent's domain knowledge`,`Checked the agent's domain knowledge`,`thinking`]};function Oa(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``),i=(0,Q.useCallback)(()=>et.view().then(t,e=>r(e.message)),[]);(0,Q.useEffect)(()=>void i(),[i]);let a=!!e?.job?.running;return(0,Q.useEffect)(()=>{if(!a)return;let e=cn(i,1e3);return()=>an(e)},[a,i]),{view:e,error:n,run:async(e,t={})=>{r(``);try{await et.run(e,t),i()}catch(e){r(e.message)}},running:a,load:i}}function ka({job:e,kinds:t,onStop:n}){let r=(0,Q.useRef)(null);if((0,Q.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e?.lines.length]),!e||!t.includes(e.kind))return null;let[i,a,o]=Da[e.kind];return(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 rounded-[12px] card border p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:e.running?i:a}),(0,$.jsx)(W,{tone:e.running?`running`:e.exitCode===0?`pass`:`fail`,orb:o,children:e.running?`Working`:e.exitCode===0?`Done`:`Did not finish`}),e.running&&(0,$.jsxs)(U,{size:`sm`,variant:`danger`,onClick:n,children:[(0,$.jsx)(xe,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,$.jsx)(`pre`,{ref:r,className:`m-0 max-h-[260px] overflow-auto rounded-[10px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:(0,$.jsx)(bt,{text:e.lines.join(`
|
|
17
|
-
`)||`Starting…`})})]})}function Aa({text:e,note:t,yes:n,icon:r,onYes:i,onNo:a}){return(0,$.jsxs)(`div`,{role:`alertdialog`,"aria-label":e,className:`mt-4 flex flex-col gap-2 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,$.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:t}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`primary`,onClick:i,children:[(0,$.jsx)(r,{"aria-hidden":`true`}),n]}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Not now`,onClick:a,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Later`]})]})]})}var ja=6e4;function Ma({view:e,onError:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1);if(e.pending)return(0,$.jsx)(Na,{view:e,version:e.pending,onError:t});if(!e.running||!e.version||e.running===e.version)return null;let o=async()=>{r(!1);try{await et.restart()}catch(e){t(e.message);return}a(!0);let n=Date.now()+ja;for(;Date.now()<n;){await new Promise(e=>setTimeout(e,1e3));try{if((await et.view()).running!==e.running)return location.reload()}catch{}}a(!1),t(`forgeqe web did not come back. Start it again in its terminal; this page reconnects with the address it prints.`)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Installed`,help:e.restart?`This page runs ${e.running}. Restart forgeqe web to use ${e.version}.`:`This page runs ${e.running}. Start forgeqe web again in its terminal to use ${e.version}.`,children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[16px]`,children:e.version}),e.restart&&(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:i,"data-tip":`Restart forgeqe web`,onClick:()=>r(!0),children:[(0,$.jsx)(b,{"aria-hidden":`true`}),i?`Restarting…`:`Restart`]})]})}),n&&(0,$.jsx)(Aa,{text:`Restart forgeqe web with ${e.version}?`,note:`Open chats close; a message carries each one on. It waits for nothing at work: stop it first. This page reconnects by itself.`,yes:`Restart`,icon:b,onYes:()=>void o(),onNo:()=>r(!1)})]})}function Na({view:e,version:t,onError:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),s=async()=>{i(!1);try{let e=await et.restart();o({log:e.log})}catch(e){n(e.message)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Ready`,help:e.restart?`This page runs ${e.running}. Restart forgeqe web to install ${t}.`:`This page runs ${e.running}. Close forgeqe web, run forgeqe update in a terminal, then start it again.`,children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[16px]`,children:t}),e.restart&&(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!!a,"data-tip":`Restart forgeqe web and install ${t}`,onClick:()=>i(!0),children:[(0,$.jsx)(b,{"aria-hidden":`true`}),a?`Installing…`:`Restart`]})]})}),a&&(0,$.jsxs)(`p`,{role:`status`,className:`mt-2 mb-1 flex items-start gap-2 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`forgeqe web is closing to install `,t,`. When it is done it starts again in a new window and opens a new tab; you can close this one.`,a.log?` What the update does is written to ${a.log}.`:``]})]}),r&&(0,$.jsx)(Aa,{text:`Restart forgeqe web and install ${t}?`,note:`forgeqe web closes, ForgeQE is updated, and forgeqe web starts again in a new window with a new tab. Open chats close; a message carries each one on. It waits for nothing at work: stop it first.`,yes:`Restart`,icon:b,onYes:()=>void s(),onNo:()=>i(!1)})]})}function Pa(){let{view:e,error:t,run:n,running:r}=Oa(),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),c=e?.job,l=c?.kind===`update-check`&&!c.running?c.lines.join(`
|
|
18
|
-
`):``,u=/installs (\d[\w.-]*)/.exec(l)?.[1];return(0,$.jsxs)($.Fragment,{children:[(t||i)&&(0,$.jsx)(`p`,{className:`m-0 mb-4 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:t||i}),(0,$.jsx)(J,{label:`Version`,help:u?`${u} is out.`:l&&/latest/.test(l)?`This is the latest.`:`forgeqe update installs a new one for every forgeqe on this computer (bun, npm, pip).`,className:`border-t-0 pt-0`,children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[16px]`,children:e?e.running||e.version:`…`}),(0,$.jsxs)(U,{size:`sm`,disabled:r,"data-tip":`Check for updates`,onClick:()=>void n(`update-check`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`}),`Check`]}),(0,$.jsxs)(U,{size:`sm`,variant:u?`primary`:`outline`,disabled:r,"data-tip":u?`Update to ${u}`:`Update to the latest version`,onClick:()=>s(!0),children:[(0,$.jsx)(b,{"aria-hidden":`true`}),`Update`]})]})}),o&&(0,$.jsx)(Aa,{text:`Update ForgeQE${u?` to ${u}`:` to the latest version`} on this computer?`,note:`It replaces every forgeqe on PATH. When it is done, restart forgeqe web from here; on Windows it is installed when you restart forgeqe web.`,yes:`Update`,icon:b,onYes:()=>{s(!1),n(`update`,{confirmed:!0})},onNo:()=>s(!1)}),(0,$.jsx)(ka,{job:c,kinds:[`update-check`,`update`],onStop:()=>void et.stop()}),e&&(0,$.jsx)(Ma,{view:e,onError:a}),(0,$.jsx)(Z,{children:`Guides`}),[[`Docs`,`Every feature with examples, setup, settings and commands, with search.`,e?.help.guide],[`Architecture`,`How ForgeQE is built: its agents, the engine and where data goes.`,e?.help.architecture]].map(([e,t,n])=>(0,$.jsx)(J,{label:e,help:t,children:n?(0,$.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:mt({size:`sm`}),children:[(0,$.jsx)(Le,{"aria-hidden":`true`}),`Open`]}):(0,$.jsxs)(U,{size:`sm`,disabled:!0,children:[(0,$.jsx)(Le,{"aria-hidden":`true`}),`Open`]})},e))]})}function Fa(){let{view:e,error:t,run:r,running:i}=Oa(),[a,o]=(0,Q.useState)(``);return e?.channels.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`A card says it is a test and which events each channel gets; nothing else is sent.`,children:`Send a test`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(V,{"aria-label":`Channel`,value:a,onChange:e=>o(e.target.value),className:`w-[220px]`,children:[(0,$.jsx)(`option`,{value:``,children:`Every channel`}),e.channels.map(e=>(0,$.jsx)(`option`,{children:e},e))]}),(0,$.jsxs)(U,{size:`sm`,disabled:i,"data-tip":`Send a test`,onClick:()=>void r(`notify-test`,a?{channel:a}:{}),children:[(0,$.jsx)(n,{"aria-hidden":`true`}),`Test`]})]}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-fail`,children:t}),(0,$.jsx)(ka,{job:e.job,kinds:[`notify-test`],onStop:()=>void et.stop()})]}):null}function Ia(){let{view:e,error:t,run:n,running:r}=Oa(),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1);return e?.evalCases.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Runs stories from ForgeQE's evaluation cases (banking, insurance, lending, privacy) with the domain declared and without, and scores how many domain and regulation expectations the agent's test design meets. It makes model calls for each case.`,children:`Check the agent's domain knowledge`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(V,{"aria-label":`Cases`,value:i,onChange:e=>a(e.target.value),className:`w-[320px] max-w-full`,children:[(0,$.jsxs)(`option`,{value:``,children:[`All `,e.evalCases.length,` cases`]}),e.evalCases.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,$.jsxs)(U,{size:`sm`,disabled:r,"data-tip":`Run the domain check`,onClick:()=>s(!0),children:[(0,$.jsx)(E,{"aria-hidden":`true`}),`Run`]})]}),o&&(0,$.jsx)(Aa,{text:`Run ${i?`one case`:`all ${e.evalCases.length} cases`} of the domain check?`,note:`Each case is a model session with the domain and one without, plus a judge; it takes a few minutes and costs tokens.`,yes:`Run`,icon:E,onYes:()=>{s(!1),n(`eval-domain`,{confirmed:!0,...i?{only:[i]}:{}})},onNo:()=>s(!1)}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-fail`,children:t}),(0,$.jsx)(ka,{job:e.job,kinds:[`eval-domain`],onStop:()=>void et.stop()})]}):null}function La(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``);if((0,Q.useEffect)(()=>{et.generated().then(t,e=>r(e.message))},[]),n)return(0,$.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:n});if(!e)return(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let i=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return e.runs?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`In `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.repo}),`, from .forgeqe/generated.jsonl: every line ForgeQE added, checked against the files as they are now.`]}),(0,$.jsxs)(rn,{label:`Generated code`,children:[(0,$.jsx)(Qt,{label:`Lines written`,value:e.written.toLocaleString(),note:`${ot(e.files,`file`)}: ${e.created} created, ${e.edited} edited`}),(0,$.jsx)(Qt,{label:`Still in the code`,value:i(e.present,e.written),note:`${e.present.toLocaleString()} lines`}),(0,$.jsx)(Qt,{label:`Share of those files`,value:i(e.present,e.totalLines),note:`of ${e.totalLines.toLocaleString()} lines`}),(0,$.jsx)(Qt,{label:`Files it created`,value:String(e.headers.unchanged),note:`as written; ${e.headers.changed} changed, ${e.headers.removed} gone`})]}),(0,$.jsx)(Z,{children:`By run, newest first`}),(0,$.jsx)(vn,{label:`Runs that wrote code`,head:[`Run`,`Files`,`Lines still there`],children:e.byRun.map(e=>(0,$.jsx)(Fn,{cells:[(0,$.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.fq}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[e.run,e.test?` · ${e.test}`:``]})]},`r`),e.files,`${e.present} of ${e.written}`]},e.fq))}),e.missing.length>0&&(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Not found now: `,e.missing.slice(0,10).join(`, `)]})]}):(0,$.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-muted`,children:[(0,$.jsx)(pt,{icon:_e,size:16}),`ForgeQE has not written code in `,!e.repo||e.repo===`.`?`this repository`:(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.repo}),` yet.`]})}var Ra={critical:`Critical: ForgeQE cannot start, or loses or exposes data`,high:`High: a main feature does not work`,medium:`Medium: there is a workaround`,low:`Low: small or cosmetic`},za=3,Ba={done:`finished`,failed:`failed`,stopped:`stopped`,running:`running`};function Va(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),a=(0,Q.useCallback)(()=>it.view(e).then(n,e=>i(e.message)),[e]);(0,Q.useEffect)(()=>void a(),[a]);let o=!!t?.job?.running;return(0,Q.useEffect)(()=>{if(!o)return;let e=cn(a,1e3);return()=>an(e)},[o,a]),{view:t,error:r,setError:i,load:a,running:o}}function Ha({draft:e,areas:t,severities:n,onChange:r}){let i=(0,Q.useId)(),a=(t,n)=>r({...e,[t]:n});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Title`,htmlFor:`${i}-title`,stacked:!0,className:`border-t-0 pt-0`,children:(0,$.jsx)(H,{id:`${i}-title`,value:e.title,maxLength:200,onChange:e=>a(`title`,e.target.value)})}),(0,$.jsx)(J,{label:`What happened`,htmlFor:`${i}-summary`,stacked:!0,children:(0,$.jsx)(dt,{id:`${i}-summary`,rows:4,value:e.summary,maxLength:4e3,onChange:e=>a(`summary`,e.target.value)})}),(0,$.jsx)(J,{label:`Steps to reproduce`,help:`One step on each line.`,htmlFor:`${i}-steps`,stacked:!0,children:(0,$.jsx)(dt,{id:`${i}-steps`,rows:4,value:e.steps.join(`
|
|
19
|
-
`),onChange:e=>a(`steps`,e.target.value.split(`
|
|
20
|
-
`))})}),(0,$.jsx)(J,{label:`Expected result`,htmlFor:`${i}-expected`,stacked:!0,children:(0,$.jsx)(dt,{id:`${i}-expected`,rows:2,value:e.expected,maxLength:2e3,onChange:e=>a(`expected`,e.target.value)})}),(0,$.jsx)(J,{label:`Actual result`,help:`Copy an error message exactly.`,htmlFor:`${i}-actual`,stacked:!0,children:(0,$.jsx)(dt,{id:`${i}-actual`,rows:2,value:e.actual,maxLength:2e3,onChange:e=>a(`actual`,e.target.value)})}),(0,$.jsx)(J,{label:`Severity`,htmlFor:`${i}-severity`,children:(0,$.jsx)(V,{id:`${i}-severity`,value:e.severity,onChange:e=>a(`severity`,e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:Ra[e]??e},e))})}),(0,$.jsx)(J,{label:`Area`,htmlFor:`${i}-area`,children:(0,$.jsx)(V,{id:`${i}-area`,value:e.area,onChange:e=>a(`area`,e.target.value),children:t.map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})})]})}var Ua=e=>e<1024?`${e} bytes`:`${Math.round(e/1024)} KB`;function Wa(){let[e,r]=(0,Q.useState)(null),{view:i,error:o,setError:c,load:l,running:u}=Va(e),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)({}),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)([]),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(``),[A,ne]=(0,Q.useState)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),N=i?.job;(0,Q.useEffect)(()=>{N&&!N.running&&M.current!==N&&(M.current=N,N.error?c(N.error):N.kind===`draft`&&N.result?(h(N.result.draft),_(N.result.questions),y({})):N.kind===`send`&&N.result&&ne(N.result))},[N,c]);let P=i?.attachments??[],re=i?.session??void 0,ie=S??new Set(P.filter(e=>e.picked).map(e=>e.id)),ae=e=>{r(e),C(null)},F=(e,t)=>{let n=new Set(ie);t?n.add(e):n.delete(e),C(n)},oe=async e=>{c(``);try{await it.draft(e),l()}catch(e){c(e.message)}},se=()=>void oe({session:re,description:f,current:m??void 0,answers:g.map(e=>({question:e,answer:v[e]??``}))}),ce=async e=>{c(``);for(let t of Array.from(e??[]).slice(0,za-w.length))try{let e=await tn(t);if(e.type!==`image/png`&&e.type!==`image/jpeg`)throw Error(`${t.name}: use a PNG or JPEG picture.`);T(t=>[...t,{name:e.name,url:`data:${e.type};base64,${e.data}`}])}catch(e){c(e.message)}},le=async()=>{if(m){k(!1),c(``);try{await it.send({session:re,draft:m,attach:[...ie],images:w.map(e=>e.url),contact:E.trim()||void 0,confirmed:!0}),l()}catch(e){c(e.message)}}},ue=async()=>{if(m){c(``);try{let{text:e}=await it.text(m);await navigator.clipboard.writeText(e),te(`Copied. Paste it into an email or a Teams message to the ForgeQE team.`)}catch(e){c(e.message)}}},de=()=>{p(``),r(null),h(null),_([]),y({}),T([]),C(null),ne(null),te(``)};if(!i)return o?(0,$.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let I=i.intake.url&&(i.intake.key||i.intake.entra),fe=A?.url&&/^https:\/\/dev\.azure\.com\/[^\s"<>]+$/.test(A.url)?A.url:null;return A?(0,$.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[A.existing?`This problem was already reported, so your report was added to bug `:`Thank you. The ForgeQE team has your report as bug `,fe?(0,$.jsxs)(`a`,{href:fe,target:`_blank`,rel:`noreferrer noopener`,className:`font-medium text-ink no-underline hover:underline`,children:[`#`,A.id]}):(0,$.jsxs)(`span`,{className:`font-medium`,children:[`#`,A.id]}),` `,`in `,i.target,`.`]}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(U,{size:`sm`,"data-tip":`Report another problem`,onClick:de,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`New`]})})]}):(0,$.jsxs)($.Fragment,{children:[o&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,$.jsx)(Z,{first:!0,help:i.sessions.length?`ForgeQE looked at your recent sessions and picked the one that went wrong. Pick another if that is not the one.`:`ForgeQE has no session on this computer to look at. Say what went wrong in your own words.`,children:`What went wrong`}),i.sessions.length>0&&(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Session to report`,children:i.sessions.map(e=>(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4 first:border-t-0`,children:[(0,$.jsx)(Fr,{checked:i.session===e.name,onSelect:()=>ae(e.name),label:`Report ${e.title}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:[`forgeqe ${e.command}`,mn(e.startedAt),Ba[e.status]].join(` · `)}),e.error&&(0,$.jsx)(`span`,{className:`text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]}),e.problem&&(0,$.jsx)(W,{tone:`fail`,children:`Went wrong`})]},e.name))}),i.findings&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`From the session's log, with secrets removed. The bug is drafted from this. Test cases that failed are your app's results, so they are only counted.`,children:`What ForgeQE found`}),(0,$.jsxs)(`dl`,{className:`m-0 flex flex-col gap-4 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`What was asked or run`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:i.findings.request})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`ForgeQE's errors`}),(0,$.jsx)(`dd`,{className:`m-0`,children:i.findings.errors.length?(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.findings.errors.map(e=>(0,$.jsx)(`li`,{className:`rounded-[10px] bg-surface-muted px-4 py-2 font-mono text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:e},e))}):(0,$.jsx)(`span`,{className:`text-ink-2`,children:`None logged. Say below what went wrong.`})})]}),i.findings.facts.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`Also`}),(0,$.jsx)(`dd`,{className:`m-0`,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-ink-2`,children:i.findings.facts.map(e=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e))})})]})]})]}),(0,$.jsx)(J,{label:i.findings?`Anything to add`:`Describe the problem`,help:i.findings?`Optional: what you were trying to do, or what you expected.`:void 0,htmlFor:`${d}-description`,stacked:!0,className:i.findings?void 0:`border-t-0 pt-0`,children:(0,$.jsx)(dt,{id:`${d}-description`,rows:i.findings?3:5,value:f,maxLength:8e3,placeholder:i.findings?`For example: I expected the run to open the login page.`:`For example: I clicked Run on a test case in the web app and nothing happened for ten minutes.`,onChange:e=>p(e.target.value)})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:m?`outline`:`primary`,disabled:u||!re&&f.trim().length<10,"data-tip":m?`Draft again`:`Draft the bug`,onClick:()=>void oe({session:re,description:f}),children:[(0,$.jsx)(he,{"aria-hidden":`true`}),`Draft`]}),u&&N?.kind===`draft`&&(0,$.jsx)(W,{tone:`running`,orb:`thinking`,children:`Drafting`})]}),g.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Answer what you can, then update the draft. You can leave a question empty.`,children:`Questions`}),g.map((e,t)=>(0,$.jsx)(J,{label:e,htmlFor:`${d}-q${t}`,stacked:!0,className:t===0?`border-t-0 pt-0`:void 0,children:(0,$.jsx)(dt,{id:`${d}-q${t}`,rows:2,value:v[e]??``,maxLength:2e3,onChange:t=>y(n=>({...n,[e]:t.target.value}))})},e)),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsxs)(U,{size:`sm`,disabled:u||!Object.values(v).some(e=>e.trim()),"data-tip":`Update the draft`,onClick:se,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),`Update`]})})]}),m&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Check each field and change what is not right. This is what the ForgeQE team reads.`,children:`The bug`}),(0,$.jsx)(Ha,{draft:m,areas:i.areas,severities:i.severities,onChange:h}),(0,$.jsx)(Z,{help:`Secrets ForgeQE knows are replaced in every file. Open a log first if you are not sure what is in it: it can show addresses and test data of your project.`,children:`What is attached`}),(0,$.jsxs)(`ul`,{"aria-label":`Attachments`,className:`m-0 list-none p-0`,children:[P.map(e=>(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 py-2`,children:[(0,$.jsx)(yn,{checked:ie.has(e.id),onCheckedChange:t=>F(e.id,t)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsxs)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.note,` · `,Ua(e.bytes)]})]})]})},e.id)),w.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex min-h-12 items-center gap-4 border-t border-line-soft py-2`,children:[(0,$.jsx)(`img`,{src:e.url,alt:`Screenshot ${t+1}`,className:`h-10 w-16 rounded-[8px] border border-line-soft bg-surface-muted object-cover`}),(0,$.jsx)(`span`,{className:`flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>T(t=>t.filter(t=>t!==e)),children:(0,$.jsx)(s,{"aria-hidden":`true`})})]},e.url))]}),(0,$.jsxs)(`div`,{className:`pt-2`,children:[(0,$.jsx)(`input`,{ref:j,type:`file`,accept:`image/png,image/jpeg`,multiple:!0,hidden:!0,onChange:e=>void ce(e.target.files).then(()=>e.target.value=``)}),(0,$.jsxs)(U,{size:`sm`,disabled:w.length>=za,"data-tip":`Add a screenshot`,onClick:()=>j.current?.click(),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),(0,$.jsx)(Z,{children:`Send`}),(0,$.jsx)(J,{label:`Your contact`,help:`Optional: an email or a Teams name, so the team can ask you about it.`,htmlFor:`${d}-contact`,className:`border-t-0 pt-0`,children:(0,$.jsx)(H,{id:`${d}-contact`,value:E,maxLength:200,onChange:e=>D(e.target.value)})}),i.intake.url?!I&&(0,$.jsx)(J,{label:`Intake key`,help:`Sign in to your organization with the Azure CLI (az login), or save the key the ForgeQE team gave you. It is kept in your credential store when you save.`,htmlFor:`${d}-key`,children:(0,$.jsx)(un,{id:`${d}-key`,name:i.keyEnv,field:`Intake key`})}):(0,$.jsx)(J,{label:`Not set up yet`,help:`ForgeQE's defect intake is not set up on this computer. Copy the report and send it to the ForgeQE team.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:u||!I||!m.title.trim()||!m.summary.trim(),"data-tip":`Send to the ForgeQE team`,onClick:()=>k(!0),children:[(0,$.jsx)(n,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(U,{size:`sm`,disabled:!m.title.trim()||!m.summary.trim(),"data-tip":`Copy as text`,onClick:()=>void ue(),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Copy`]}),u&&N?.kind===`send`&&(0,$.jsx)(W,{tone:`running`,children:`Sending`})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:ee&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-ink-2`,children:ee})}),O&&(0,$.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Send this bug?`,className:`mt-4 flex flex-col gap-2 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:`Send this bug to the ForgeQE team?`}),(0,$.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`It is filed in `,i.target,` with the fields above`,ie.size+w.length?`, and ${ie.size+w.length} attached file${ie.size+w.length===1?``:`s`}: ${[...P.filter(e=>ie.has(e.id)).map(e=>e.name),...w.map(e=>e.name)].join(`, `)}`:`, with nothing attached`,`.`]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`primary`,onClick:()=>void le(),children:[(0,$.jsx)(n,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Not now`,onClick:()=>k(!1),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Later`]})]})]})]})]})}function Ga({config:e}){let{saved:t,preview:n,reload:r}=Bt(),i=K(Y(e.value,[`agent`,`names`])),a=Ue(i),o=Y(e.value,[`agent`,`app_name`]),s=typeof o==`string`?o:``,c=Be(s),l=JSON.stringify([a,c]);return(0,Q.useEffect)(()=>n({...t,agentNames:a,appName:c}),[l,t]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:je,help:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`What the web app calls ForgeQE itself: in every page, message and tab title, and in the reports and documents it writes. Commands, files and settings keep forgeqe. Empty keeps ForgeQE.`}),children:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`ForgeQE's name`})}),(0,$.jsx)(J,{label:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`App name`}),help:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`Instead of ForgeQE, for everyone who opens this project.`}),htmlFor:`agent-app-name`,yamlKey:`agent.app_name`,children:(0,$.jsx)(H,{id:`agent-app-name`,"data-keep-name":!0,value:s,maxLength:40,placeholder:`ForgeQE`,onChange:t=>e.set(q(e.value,[`agent`,`app_name`],t.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})}),(0,$.jsx)(Z,{icon:ve,help:`Call each agent what your team calls it: the name shows in chats, on the Agents page and in the terminal, for everyone who opens this project. What it does and may do stay the same. Empty keeps ForgeQE's name.`,children:`Agent names`}),Ve.map(t=>{let n=He(t).name,r=`agent-name-${t}`,a=typeof i[t]==`string`?i[t]:``;return(0,$.jsx)(J,{label:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Nt,{agent:t,px:22,decorative:!0}),n]}),help:t,htmlFor:r,yamlKey:`agent.names.${t}`,children:(0,$.jsx)(H,{id:r,value:a,maxLength:40,placeholder:n,onChange:n=>e.set(q(e.value,[`agent`,`names`,t],n.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})},t)})]})}var Ka=524288,qa=[`image/png`,`image/jpeg`,`image/webp`,`image/svg+xml`];async function Ja(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function Ya({children:e,className:t}){return(0,$.jsx)(`div`,{className:B(`flex w-full flex-wrap items-center gap-2 sm:justify-end`,t),children:e})}function Xa({colour:e,label:t}){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-ink-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 flex-none rounded-[4px] border border-line`,style:{background:e}}),t&&(0,$.jsx)(`span`,{className:`text-muted`,children:t}),(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]})}function Za({onUse:e}){let t=(0,Q.useId)(),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);return(0,$.jsx)(J,{label:`From a website`,help:`Suggests its sidebar, button and page colours. Nothing changes until you use them.`,htmlFor:t,children:(0,$.jsxs)(Ya,{children:[(0,$.jsxs)(`form`,{className:`flex w-full items-center gap-2`,onSubmit:async e=>{e.preventDefault(),a(!0),s(``),l(null),d(!1);try{l(await $e.fromUrl(n.trim()))}catch(e){s(e.message)}finally{a(!1)}},children:[(0,$.jsx)(H,{id:t,type:`url`,value:n,placeholder:`https://www.example.com`,spellCheck:!1,onChange:e=>r(e.target.value),className:`min-w-0 flex-1`}),(0,$.jsxs)(U,{size:`sm`,type:`submit`,disabled:!n.trim()||i,"data-tip":`Read the site's colours`,children:[(0,$.jsx)(te,{"aria-hidden":`true`}),i?`Importing…`:`Import`]})]}),o&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 w-full text-[13px] text-fail sm:text-right`,children:o}),c&&(0,$.jsxs)(`div`,{role:`status`,className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`From `,new URL(c.url).host]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[c.primary&&(0,$.jsx)(Xa,{colour:c.primary,label:`Sidebar`}),c.gradient&&(0,$.jsx)(Xa,{colour:c.gradient,label:`Gradient`}),c.secondary&&(0,$.jsx)(Xa,{colour:c.secondary,label:`Buttons`}),c.background&&(0,$.jsx)(Xa,{colour:c.background,label:`Page`})]}),(0,$.jsxs)(U,{size:`sm`,variant:`primary`,onClick:()=>{e(c),d(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),u?`Used`:`Use`]}),c.palette.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 sm:justify-end`,children:[(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Others:`}),c.palette.map(e=>(0,$.jsx)(Xa,{colour:e},e))]})]})]})})}var Qa={deep:`Deep sidebar, white text`,light:`Pale sidebar, dark text`};function $a({start:e,onUse:t}){let n=(0,Q.useId)(),[r,i]=(0,Q.useState)(e),[a,o]=(0,Q.useState)(`deep`),[s,c]=(0,Q.useState)(!1),l=wt(r),u=kt(l),d=jt(l,a),f=r.trim()!==``&&!l?`Write a colour as #rrggbb, for example #0e7490.`:``,p=e=>(i(e),c(!1));return(0,$.jsx)(J,{label:`From one colour`,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):`Makes a family of shades of one colour for the sidebar, buttons and page, so they belong together. Nothing changes until you use them.`,htmlFor:n,children:(0,$.jsxs)(Ya,{children:[(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`From one colour: pick a colour`,value:l||It,onChange:e=>p(e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(H,{id:n,value:r,spellCheck:!1,placeholder:`#0e7490`,"aria-invalid":!!f,onChange:e=>p(e.target.value),className:`min-w-0 flex-1 font-mono`})]}),(0,$.jsx)(V,{"aria-label":`Where the sidebar sits in the family`,value:a,onChange:e=>(o(e.target.value),c(!1)),className:`w-full`,children:Ft.map(e=>(0,$.jsx)(`option`,{value:e,children:Qa[e]},e))}),u&&d&&(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsx)(`span`,{"aria-label":`Shades 50 to 950 of ${l}`,className:`flex w-full overflow-hidden rounded-[8px] border border-line`,children:At.map(e=>(0,$.jsx)(`span`,{"data-tip":`${e} ${u[e]}`,className:`h-6 min-w-0 flex-1`,style:{background:u[e]}},e))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[(0,$.jsx)(Xa,{colour:d.primary,label:`Sidebar`}),(0,$.jsx)(Xa,{colour:d.gradient,label:`Gradient`}),(0,$.jsx)(Xa,{colour:d.secondary,label:`Buttons`}),(0,$.jsx)(Xa,{colour:d.background,label:`Page`})]}),(0,$.jsxs)(U,{size:`sm`,variant:`primary`,onClick:()=>{t(d),c(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),s?`Used`:`Use`]})]})]})})}function eo({label:e,help:t,yamlKey:n,value:r,fallback:i,check:a,onChange:o}){let s=(0,Q.useId)(),[c,l]=(0,Q.useState)(r);(0,Q.useEffect)(()=>l(r),[r]);let u=wt(c),d=c.trim()!==``&&!u?`Write a colour as #rrggbb, for example #0b1f3a.`:u&&a?a(u):``;return(0,$.jsx)(J,{label:e,help:d?(0,$.jsx)(`span`,{className:`text-fail`,children:d}):t,htmlFor:s,yamlKey:n,children:(0,$.jsxs)(Ya,{className:`flex-nowrap`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`${e}: pick a colour`,value:wt(r)||i||`#ffffff`,onChange:e=>o(a?.(e.target.value)?``:e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(H,{id:s,value:c,spellCheck:!1,placeholder:i?`${i} (default)`:`None`,"aria-invalid":!!d,onChange:e=>{l(e.target.value);let t=wt(e.target.value);(t&&!a?.(t)||!e.target.value.trim())&&o(t||``)},className:`min-w-0 flex-1 font-mono`})]})})}function to({which:e,label:t,yamlKey:n,value:r,url:i,savedError:a,onChange:o}){let[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),m=e===`mark`?`small logo`:`logo`;return(0,$.jsx)(J,{label:t,help:c||r&&!i&&a?(0,$.jsx)(`span`,{className:`text-fail`,children:c||a}):e===`mark`?`For the narrow sidebar. Square or round works best.`:`In the sidebar, reports and documents. PNG, JPEG or WebP (a large one is made smaller), or SVG up to 512 KB; an empty margin round it is cut off.`,yamlKey:n,children:(0,$.jsxs)(Ya,{children:[i&&(0,$.jsx)(`span`,{className:B(`theme-side flex h-12 items-center justify-center rounded-[8px] border border-line`,e===`mark`?`w-12`:`min-w-16 px-4`),children:(0,$.jsx)(`img`,{src:i,alt:`The ${m}`,className:B(`block object-contain`,e===`mark`?`max-h-9 max-w-9`:`max-h-8 max-w-[140px]`)})}),(0,$.jsx)(`input`,{ref:f,type:`file`,accept:`.png,.jpg,.jpeg,.webp,.svg`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async t=>{let n=t.target.files?.[0];if(t.target.value=``,n){if(l(``),!qa.includes(n.type))return l(`A ${m} is a PNG, JPEG, WebP or SVG image.`);if(n.type===`image/svg+xml`&&n.size>Ka)return l(`${n.name} is over 512 KB.`);if(n.size>20971520)return l(`${n.name} is over ${pn/1024/1024} MB: save a smaller copy and upload that.`);d(!0);try{let t=await $t(n,Ka),r=await $e.uploadLogo(await Ja(t),t.type,e);o(r.file,(e===`mark`?r.view.logoMark:r.view.logo)||``)}catch(e){l(e.message)}finally{d(!1)}}}}),(0,$.jsxs)(U,{size:`sm`,disabled:u,"data-tip":i?`Change the ${m}`:`Upload a ${m}`,onClick:()=>f.current?.click(),children:[i?(0,$.jsx)(p,{"aria-hidden":`true`}):(0,$.jsx)(te,{"aria-hidden":`true`}),u?`Uploading…`:i?`Change`:`Upload`]}),r&&(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove the ${m}`,"data-tip":`Remove the ${m}`,onClick:()=>o(``),children:(0,$.jsx)(s,{"aria-hidden":`true`})})]})})}var no={auto:`Auto (recommended)`,plain:`Plain`,tiles:`On tiles`,outline:`Outlined`,mono:`One colour`};function ro(e){for(let{item:t}of _t)if(t.icon===e||Et[t.id]===e)return t.label;for(let t of We)if(z(t.agent).icon===e)return z(t.agent).name;return e}function io({draft:e,value:t,onChange:n}){let{mode:r}=Bt(),i=Rt(e,void 0,r),a=xt(e)!==`3d`,o=!a&&t!==`mono`&&t!==`outline`&&i.lowest<2,s=o?`${i.faint.length||`Some`} ${i.faint.length===1?`icon is`:`icons are`} hard to see on this colour${i.faint.length?` (${i.faint.slice(0,2).map(e=>ro(e.icon)).join(`, `)}${i.faint.length>2?`, …`:``})`:``}. Try Auto or On tiles.`:!a&&t===`auto`&&i.style!==`plain`?`Auto put them on tiles: this colour hides some of them.`:``;return(0,$.jsx)(J,{label:`Sidebar icons`,help:a?`For the 3D icons. Flat icons take the Icon colour above.`:`Auto puts them on tiles when the sidebar's colour hides any.`,htmlFor:`theme-icons`,yamlKey:`theme.icon_style`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsx)(V,{id:`theme-icons`,value:t,disabled:a,onChange:e=>n(e.target.value),className:`w-full`,children:Vt.map(e=>(0,$.jsx)(`option`,{value:e,children:no[e]},e))}),!a&&(0,$.jsx)(ao,{}),s&&(0,$.jsx)(`span`,{className:B(`w-full text-[13px] sm:text-right`,o?`text-warn`:`text-muted`),children:s})]})})}function ao(){let e=[`record`,`data`,`jobs`,`guardrails`].map(e=>Et[e]).concat([`orchestrator`,`healer`,`browser-agent`]);return(0,$.jsx)(`span`,{"aria-label":`How the sidebar's icons look`,className:`theme-side flex w-full items-center justify-between rounded-[10px] border border-line-soft px-4 py-2`,children:e.map(e=>(0,$.jsx)(ct,{name:e,px:18},e))})}var oo={phosphor:`Phosphor Duotone (default)`,solar:`Solar Bold Duotone`,lucide:`Lucide (buttons and menus too)`,"3d":`3D (ForgeQE's pixel icons)`};function so({value:e,onChange:t}){return(0,$.jsx)(J,{label:`Icons`,help:`Flat icons are black, or the Icon colour below, so they show on any sidebar.`,htmlFor:`theme-icon-set`,yamlKey:`theme.icon_set`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsx)(V,{id:`theme-icon-set`,value:e,onChange:e=>t(e.target.value),className:`w-full`,children:Mt.map(e=>(0,$.jsx)(`option`,{value:e,children:oo[e]},e))}),(0,$.jsx)(ao,{})]})})}function co(){return(0,$.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,"aria-hidden":`true`,children:[`forgeqe`,`engine`,`forgeqe-test`,`forgeqe-heal`,`forgeqe-pr-review`,`forgeqe-data`].map(e=>(0,$.jsx)(Nt,{agent:e,px:40,decorative:!0},e))})}var lo={visor:`Robots (default)`,classic:`Characters`,icons:`Icons`},uo={soft:`Soft pastel (default)`,original:`Each agent's own`};function fo({value:e,colours:t,onChange:n,onColours:r}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Agents`,help:`Robots and characters follow your cursor, show what they are doing and react to how it went. Sidebars and lists keep the icons.`,htmlFor:`theme-mascot`,yamlKey:`theme.mascot`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsx)(V,{id:`theme-mascot`,value:e,onChange:e=>n(e.target.value),className:`w-full`,children:Ut.map(e=>(0,$.jsx)(`option`,{value:e,children:lo[e]},e))}),(0,$.jsx)(co,{})]})}),(0,$.jsx)(J,{label:`Agent colours`,help:e===`icons`?`For robots and characters.`:`Pastels from one family, or each agent's colour as the rest of the app shows it.`,htmlFor:`theme-mascot-colours`,yamlKey:`theme.mascot_colours`,children:(0,$.jsx)(Ya,{children:(0,$.jsx)(V,{id:`theme-mascot-colours`,value:t,disabled:e===`icons`,onChange:e=>r(e.target.value),className:`w-full`,children:Pt.map(e=>(0,$.jsx)(`option`,{value:e,children:uo[e]},e))})})})]})}var po={text:`Black, white in dark mode (default)`,accent:`The buttons' colour`,custom:`A colour of their own`};function mo({draft:e,value:t,onChange:n}){let{mode:r}=Bt(),i=Ct({iconColour:t}),a=xt(e)!==`3d`,[o,s]=(0,Q.useState)(i===`custom`?t:``);(0,Q.useEffect)(()=>s(i===`custom`?t:``),[t,i]);let c=i===`custom`&&o.trim()!==``&&!wt(o)?`Write a colour as #rrggbb, for example #7c3aed.`:``,l=a?Ot(e,r).moved:[],u=l.length?`Made ${r===`dark`?`lighter`:`darker`} on the ${l.join(` and the `)} so the icons show.`:``;return(0,$.jsx)(J,{label:`Icon colour`,help:c?(0,$.jsx)(`span`,{className:`text-fail`,children:c}):a?`For the flat icons of the pages and agents: their lines take the colour, and their second tone its palest shade.`:`For the flat icons. The 3D icons keep their own colours.`,htmlFor:`theme-icon-colour`,yamlKey:`theme.icon_colour`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsx)(V,{id:`theme-icon-colour`,value:i,disabled:!a,onChange:t=>{let r=t.target.value;n(r===`accent`?`accent`:r===`custom`?wt(e.secondary)||It:``)},className:`w-full`,children:Object.keys(po).map(e=>(0,$.jsx)(`option`,{value:e,children:po[e]},e))}),a&&i===`custom`&&(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`Icon colour: pick a colour`,value:wt(t)||It,onChange:e=>n(e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(H,{id:`theme-icon-colour-hex`,"aria-label":`Icon colour`,value:o,spellCheck:!1,placeholder:`#7c3aed`,"aria-invalid":!!c,onChange:e=>{s(e.target.value);let t=wt(e.target.value);(t||!e.target.value.trim())&&n(t||``)},className:`min-w-0 flex-1 font-mono`})]}),u&&(0,$.jsx)(`span`,{className:`w-full text-[13px] text-warn sm:text-right`,children:u})]})})}function ho(){let{choice:e,setChoice:t}=Bt();return(0,$.jsx)(J,{label:`Colour mode`,help:`Only for you, in this browser.`,children:(0,$.jsx)(Ya,{children:(0,$.jsx)(Qn,{label:`Colour mode`,value:e,onChange:t,options:[{id:`system`,label:`System`},{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}].map(e=>({id:e.id,label:e.label}))})})})}var go=[`primary`,`gradient`,`secondary`,`background`,`icon_style`,`icon_set`,`icon_colour`,`mascot`,`mascot_colours`];function _o({theme:e,value:t,onReset:n}){let{choice:r,setChoice:i}=Bt(),a=go.some(t=>e[t]!==void 0)||r!==`system`;return(0,$.jsxs)(U,{size:`sm`,disabled:!a,"data-tip":`Reset colours: ForgeQE's own colours and icons, and System mode. The logo and name stay.`,onClick:()=>{let e=t;for(let t of go)e=q(e,[`theme`,t],void 0);n(e),i(`system`)},children:[(0,$.jsx)(g,{"aria-hidden":`true`}),`Reset`]})}var vo=e=>Dt(e)<.75?`Choose a light colour: dark mode gives the dark page.`:``;function yo({config:e}){let{saved:t,preview:n,reload:r}=Bt(),i=K(e.value.theme),a=e=>typeof i[e]==`string`?i[e]:``,o=(t,n)=>e.set(q(e.value,[`theme`,t],n||void 0)),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),_=(0,Q.useRef)(null),v=s&&s.file===a(`logo`)?s.url:t.logoFile===a(`logo`)?t.logo:void 0,y=l&&l.file===a(`logo_mark`)?l.url:t.logoMarkFile===a(`logo_mark`)?t.logoMark:void 0,b=[`plain`,`rounded`,`circle`,`tile`].find(e=>e===a(`logo_frame`)),x=a(`logo_size`)===`large`||a(`logo_size`)===`standard`?a(`logo_size`):void 0,S=Vt.find(e=>e===a(`icon_style`)),C=Mt.find(e=>e===a(`icon_set`)),w=Ut.find(e=>e===a(`mascot`)),T=Pt.find(e=>e===a(`mascot_colours`)),E=Ue(Y(e.value,[`agent`,`names`])),D={...Object.keys(E).length?{agentNames:E}:{},logoSize:x,name:a(`name`)||void 0,primary:wt(a(`primary`)),gradient:wt(a(`gradient`)),secondary:wt(a(`secondary`)),background:wt(a(`background`)),logo:a(`logo`)?v:void 0,logoMark:a(`logo_mark`)?y:void 0,logoFrame:b,iconStyle:S,iconSet:C,mascot:w,mascotColours:T,iconColour:a(`icon_colour`)===`accent`?`accent`:wt(a(`icon_colour`))},O=JSON.stringify(D);(0,Q.useEffect)(()=>n(D),[O]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]);let k=Tt(D).filter(e=>!e.ok);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:ke,first:!0,children:`Logo and name`}),(0,$.jsx)(to,{which:`logo`,label:`Logo`,yamlKey:`theme.logo`,value:a(`logo`),url:v,savedError:t.logoError,onChange:(e,t)=>(c(t?{file:e,url:t}:null),o(`logo`,e))}),(0,$.jsx)(to,{which:`mark`,label:`Small logo`,yamlKey:`theme.logo_mark`,value:a(`logo_mark`),url:y,savedError:t.logoMarkError,onChange:(e,t)=>(u(t?{file:e,url:t}:null),o(`logo_mark`,e))}),(0,$.jsx)(J,{label:`Logo frame`,help:`A circle suits a square logo; a white tile, a dark logo on a dark sidebar.`,htmlFor:`theme-frame`,yamlKey:`theme.logo_frame`,children:(0,$.jsx)(Ya,{children:(0,$.jsxs)(V,{id:`theme-frame`,value:b||`plain`,onChange:e=>o(`logo_frame`,e.target.value===`plain`?``:e.target.value),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`plain`,children:`As it is`}),(0,$.jsx)(`option`,{value:`rounded`,children:`Rounded corners`}),(0,$.jsx)(`option`,{value:`circle`,children:`Circle`}),(0,$.jsx)(`option`,{value:`tile`,children:`On a white tile`})]})})}),(0,$.jsx)(J,{label:`Logo size`,help:`Fit automatically sizes the logo from its shape, so its words can be read. Large spreads a wide logo across the top of the sidebar.`,htmlFor:`theme-size`,yamlKey:`theme.logo_size`,children:(0,$.jsx)(Ya,{children:(0,$.jsxs)(V,{id:`theme-size`,value:x||`auto`,onChange:e=>o(`logo_size`,e.target.value===`large`||e.target.value===`standard`?e.target.value:``),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`auto`,children:`Fit automatically`}),(0,$.jsx)(`option`,{value:`standard`,children:`Standard`}),(0,$.jsx)(`option`,{value:`large`,children:`Large`})]})})}),(0,$.jsx)(J,{label:`Name`,help:`Beside a square logo, or instead of one. Screen readers say it.`,htmlFor:`theme-name`,yamlKey:`theme.name`,children:(0,$.jsx)(Ya,{children:(0,$.jsx)(H,{id:`theme-name`,value:a(`name`),maxLength:40,placeholder:`ForgeQE`,onChange:e=>o(`name`,e.target.value),className:`w-full`})})}),(0,$.jsx)(J,{label:`Preview`,help:m?(0,$.jsx)(`span`,{className:`text-warn`,children:`The logo is close to the sidebar's colour, so it sits on a plate. A different sidebar colour sets it off without one.`}):`The sidebar's top, wide and narrow.`,children:(0,$.jsxs)(Ya,{className:`flex-nowrap`,children:[(0,$.jsx)(`span`,{"aria-label":`How the sidebar's top looks`,className:`theme-side flex min-h-14 min-w-0 flex-1 items-center rounded-[10px] border border-line-soft px-4 text-base font-semibold`,children:(0,$.jsx)(en,{theme:D,onPlate:h})}),(0,$.jsx)(`span`,{"aria-label":`How the narrow sidebar's top looks`,className:`theme-side flex size-14 flex-none items-center justify-center rounded-[10px] border border-line-soft`,children:(0,$.jsx)(fn,{theme:D})})]})}),(0,$.jsx)(Z,{icon:ee,help:`Leave a colour empty to keep ForgeQE's own.`,children:`Colours`}),(0,$.jsx)(ho,{}),(0,$.jsx)(eo,{label:`Sidebar`,help:`Light mode. Its text turns white on a dark colour.`,yamlKey:`theme.primary`,value:a(`primary`),fallback:zt,onChange:e=>o(`primary`,e)}),(0,$.jsx)(eo,{label:`Sidebar gradient`,help:`The sidebar fades into it, top to bottom.`,yamlKey:`theme.gradient`,value:a(`gradient`),onChange:e=>o(`gradient`,e)}),(0,$.jsx)(eo,{label:`Buttons and links`,help:`Also selected tabs and filters and the sidebar entry you are on, with shades made from it. Left empty, it is the icon colour when that is a colour of its own, so the app has one brand colour.`,yamlKey:`theme.secondary`,value:a(`secondary`),fallback:St({...D,secondary:void 0})||It,onChange:e=>o(`secondary`,e)}),(0,$.jsx)(eo,{label:`Page background`,help:`Light mode, a light colour. Dark mode keeps its dark page.`,yamlKey:`theme.background`,value:a(`background`),fallback:`#ffffff`,check:vo,onChange:e=>o(`background`,e)}),(0,$.jsx)(so,{value:C||`phosphor`,onChange:e=>o(`icon_set`,e===`phosphor`?``:e)}),(0,$.jsx)(mo,{draft:D,value:a(`icon_colour`),onChange:e=>o(`icon_colour`,e)}),(0,$.jsx)(io,{draft:D,value:S||`auto`,onChange:e=>o(`icon_style`,e===`auto`?``:e)}),(0,$.jsx)(fo,{value:w||`visor`,colours:T||`soft`,onChange:e=>o(`mascot`,e===`visor`?``:e),onColours:e=>o(`mascot_colours`,e===`soft`?``:e)}),(0,$.jsx)(J,{label:`Preview`,help:k.length?(0,$.jsx)(`span`,{className:`flex flex-col gap-1 text-warn`,children:k.map(e=>(0,$.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(f,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),e.label,` is hard to read (`,e.ratio,`:1, 4.5:1 needed).`]},e.label))}):`Every text reads on these colours.`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsxs)(`span`,{className:`flex w-full items-center justify-end gap-4 rounded-[10px] border border-line-soft bg-bg p-4`,children:[(0,$.jsx)(`a`,{href:`#appearance-preview`,onClick:e=>e.preventDefault(),className:`text-sm`,children:`A link`}),(0,$.jsx)(U,{variant:`primary`,size:`sm`,tabIndex:-1,"aria-hidden":`true`,className:`pointer-events-none`,children:`A button`})]}),(0,$.jsx)(_o,{theme:i,onReset:t=>e.set(t),value:e.value})]})}),(0,$.jsx)(Z,{icon:M,children:`Import colours`}),(0,$.jsx)($a,{start:wt(a(`secondary`))||wt(a(`primary`))||``,onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=q(n,[`theme`,e],t[e]);e.set(n)}}),(0,$.jsx)(Za,{onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=q(n,[`theme`,e],t[e]||void 0);e.set(n)}}),(0,$.jsx)(J,{label:`From a DESIGN.md`,help:d?(0,$.jsx)(`span`,{role:`status`,className:`text-ink-2`,children:d}):`Reads the lines that name primary, secondary, gradient and background.`,children:(0,$.jsxs)(Ya,{children:[(0,$.jsx)(`input`,{ref:_,type:`file`,accept:`.md,.markdown,.txt,.css`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async t=>{let n=t.target.files?.[0];if(t.target.value=``,!n)return;if(n.size>262144)return p(`${n.name} is over 256 KB.`);let r=Ht(await n.text()),i=Object.entries(r).map(([e,t])=>`${e} ${t}`);if(!i.length)return p(`No primary, secondary, gradient or background colour in ${n.name}.`);let a=e.value;for(let[e,t]of Object.entries(r))a=q(a,[`theme`,e],t);e.set(a),p(`From ${n.name}: ${i.join(`, `)}.`)}}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Choose a DESIGN.md`,onClick:()=>_.current?.click(),children:[(0,$.jsx)(P,{"aria-hidden":`true`}),`Choose`]})]})}),(0,$.jsx)(J,{label:`Reset all`,help:`The logo, name and colours back to ForgeQE's own.`,children:(0,$.jsx)(Ya,{children:(0,$.jsxs)(U,{size:`sm`,disabled:!Object.keys(i).length,"data-tip":`The logo, name and colours back to ForgeQE's own`,onClick:()=>e.set(q(e.value,[`theme`],void 0)),children:[(0,$.jsx)(g,{"aria-hidden":`true`}),`Reset all`]})})})]})}function bo({ok:e,children:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:B(`m-0 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm leading-relaxed`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(f,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function xo({label:e,value:t,options:n,onPick:r}){return(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Qn,{label:e,value:t,onChange:r,options:n.map(e=>({id:e.id,label:e.label}))})})}var So=[{id:`eager`,label:`Briefly`},{id:`normal`,label:`A moment`},{id:`patient`,label:`Longer`}],Co=e=>e>=1e9?`${(e/1e9).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1e6))} MB`;function wo(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(on()),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let n=!0,i=()=>On(!0).then(e=>n&&t(e)).catch(e=>n&&r(e.message));i();let a=cn(()=>e?.setup.running&&void i(),1500);return()=>{n=!1,an(a)}},[e?.setup.running]);let u=async()=>{r(``),s(!0),l(!0);try{t(await tt.setup())}catch(e){r(e.message)}finally{l(!1)}},d=e,f=!!d?.setup.running;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,help:`Listening and speaking run on this computer. Only the words go to your model, as typed words do.`,children:`Speech on this computer`}),(0,$.jsx)(J,{label:d?d.ready?`Set up`:f?`Setting up`:`Not set up yet`:`Speech`,help:d?.ready?`Talk, at the foot of the right panel or beside Refine in a chat, opens a conversation with Atlas. Talk over it any time: it stops and listens. English only for now.`:`A one-time download of open speech models${d?`, about ${Co(d.setup.bytes)}`:``}, into ForgeQE's folder.`,children:d?d.ready?(0,$.jsx)(W,{tone:`pass`,children:`Ready`}):f?(0,$.jsx)(W,{tone:`running`,children:`Setting up`}):(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:c,onClick:()=>void u(),"data-tip":`Download the speech models once: nothing is sent anywhere`,children:[c?(0,$.jsx)(ht,{state:`handing`,px:16}):(0,$.jsx)(Ee,{"aria-hidden":`true`}),c?`Starting…`:`Install (${Co(d.setup.bytes)})`]}):(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Reading…`})}),(f||o&&d&&d.setup.lines.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!f&&d&&(0,$.jsx)(bo,{ok:d.ready,children:d.ready?`Speech is set up.`:d.setup.error||`The setup stopped with a problem. The last lines below say what.`}),(0,$.jsx)(`pre`,{"aria-label":`Speech setup output`,"aria-live":`polite`,className:`m-0 max-h-[280px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:(0,$.jsx)(bt,{text:d?.setup.lines.length?d.setup.lines.join(`
|
|
21
|
-
`):`Starting…`})})]}),n&&(0,$.jsx)(bo,{ok:!1,children:n}),d?.ready&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Voice`,help:`An open voice that runs on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Ready`})}),(0,$.jsx)(J,{label:`Listening`,help:`Writes down what you say, on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:d.hearing?.model??`None`})})]}),(0,$.jsx)(Z,{help:`How Talk takes turns with you. Yours alone: kept in this browser.`,children:`Conversation`}),(0,$.jsx)(J,{label:`It waits for you`,help:i===`eager`?`Answers soon after you pause: quick, but it may cut in.`:i===`patient`?`Waits longer when you pause mid-thought.`:`Waits a moment when you sound unfinished.`,children:(0,$.jsx)(xo,{label:`How long it waits for you`,value:i,options:So,onPick:e=>(a(e),Jt(e))})})]})}function To({text:e}){return(0,$.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e})}function Eo({text:e}){return(0,$.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass [overflow-wrap:anywhere]`,children:e})}var Do=[{id:`metrics`,label:`Metrics`},{id:`traces`,label:`Spans too`},{id:`traces+errors`,label:`Errors too`}],Oo={metrics:`Counts, durations, tokens and cost, every minute and at the end of a session. No spans.`,traces:`Also a trace for each session: its turns, runs, model calls and tool calls, with their durations.`,"traces+errors":`Also, on an error, its kind (such as timeout or not reachable), never its message.`},ko=e=>{let t=e.settings,n=t?.headers[0];return{endpoint:t?.endpoint??``,header:n?.name??`Authorization`,variable:n?.variable??``,level:t?.level??`traces`,service:t?.service??`forgeqe`,only:!!t&&t.projects!==`all`,protocol:t?.protocol??`json`,logs:t?.logs??!1}},Ao=e=>e?new Date(e).toLocaleString():``;function jo(){let[e,t]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(``),[s,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),g=e=>{t(e),i(ko(e))};(0,Q.useEffect)(()=>{Ye.view().then(g,e=>o(e.message))},[]);let _=async(e,t)=>{o(``),l(``),d(e);try{let e=await t();return typeof e==`string`?l(e):g(e),!0}catch(e){return o(e.message),!1}finally{d(``)}};if(!e||!r)return a?(0,$.jsx)(To,{text:a}):(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let v=e.settings,y=!!v?.approved&&v.approved.host===v.host,b=v?v.headers.slice(1):[],C=ko(e),w=JSON.stringify(r)!==JSON.stringify(C),T=e=>i({...r,...e}),E=v?v.enabled&&y?e.exports?(0,$.jsx)(W,{tone:`pass`,children:`On`}):(0,$.jsx)(W,{tone:`warn`,children:`Not sending`}):y?(0,$.jsx)(W,{tone:`neutral`,children:`Off`}):(0,$.jsx)(W,{tone:`warn`,children:`Not turned on`}):(0,$.jsx)(W,{tone:`neutral`,children:`Not set up`}),D=e.status,O=()=>_(`save`,async()=>{let t=await Ye.save({endpoint:r.endpoint,headers:[...r.variable.trim()?[{name:r.header.trim(),variable:r.variable.trim()}]:[],...b.map(e=>({name:e.name,variable:e.variable}))],level:r.level,service:r.service,projects:r.only?[e.project]:`all`,protocol:r.protocol,logs:r.logs});return l(t.settings?.enabled?`Saved.`:`Saved. Nothing is sent until you turn it on.`),t}).then(()=>void 0);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,icon:S,help:`Kept on this computer, in ForgeQE's folder. A project cannot turn it on or change where it sends.`,children:`The export`}),e.problem&&(0,$.jsx)(To,{text:e.problem}),(0,$.jsx)(J,{label:`Status`,help:v?.enabled&&y?e.exports?`Sending to ${v.host}.`:e.why:v?y?`Turned off: nothing is sent.`:`Nothing is sent until you turn it on for ${v.host}.`:`Give a collector's address below and save, then turn it on.`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:justify-end`,children:[E,v&&e.exports&&(0,$.jsxs)(U,{size:`sm`,disabled:!!u,onClick:()=>void _(`test`,async()=>{let e=await Ye.test();if(!e.ok)throw Error(`Not sent: ${e.problem}.`);return`A test span reached ${v.host}.`}),"data-tip":`Send one span named forgeqe.telemetry.test now`,children:[(0,$.jsx)(n,{"aria-hidden":`true`}),u===`test`?`Sending…`:`Send a test span`]}),v&&v.enabled&&y?(0,$.jsxs)(U,{size:`sm`,disabled:!!u,onClick:()=>void _(`off`,async()=>{let e=await Ye.off();return l(`Turned off. Nothing is sent from now on.`),e}),"data-tip":`Stop sending; the settings stay`,children:[(0,$.jsx)(A,{"aria-hidden":`true`}),`Turn off`]}):v&&(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!!u||w,onClick:()=>(h(``),p(`on`)),"data-tip":w?`Save your changes first`:`See what would be sent, then type the host to turn it on`,children:[(0,$.jsx)(ie,{"aria-hidden":`true`}),`Turn on…`]})]})}),(0,$.jsx)(J,{label:`This project`,help:e.exports?`Its sessions are sent, grouped by this id: a salted fingerprint of its folder, never its name or path.`:`Its id in the export: a salted fingerprint of its folder, never its name or path.`,children:(0,$.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:e.project})}),D&&(0,$.jsx)(J,{label:`Last result`,help:D.problem?`${D.problem}${D.failingSince?`, since ${Ao(D.failingSince)}`:``}.`:void 0,children:(0,$.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[D.lastSent?`Sent ${Ao(D.lastSent)}`:`Nothing sent yet`,`: `,D.sent,` spans, `,D.points??0,` metric points, `,D.logs??0,` log records`,D.dropped+(D.pointsDropped??0)+(D.logsDropped??0)?`, ${D.dropped+(D.pointsDropped??0)+(D.logsDropped??0)} dropped`:``]})}),a&&(0,$.jsx)(To,{text:a}),s&&(0,$.jsx)(Eo,{text:s}),(0,$.jsx)(Z,{icon:pe,help:`Your OpenTelemetry collector's OTLP/HTTP address: Grafana, Datadog, Honeycomb, Jaeger, Azure Monitor and others take it.`,children:`Collector`}),(0,$.jsx)(J,{label:`Address`,htmlFor:`otel-endpoint`,help:`https, or http only for a collector on this computer. A new host must be turned on again.`,children:(0,$.jsx)(H,{id:`otel-endpoint`,className:`w-full sm:w-[360px]`,value:r.endpoint,placeholder:`https://otel.example.com:4318`,spellCheck:!1,autoComplete:`off`,onChange:e=>T({endpoint:e.target.value})})}),(0,$.jsx)(J,{label:`Token header`,htmlFor:`otel-variable`,help:(0,$.jsxs)($.Fragment,{children:[`The header and the name of the secret it sends, such as OTEL_COLLECTOR_TOKEN. Save its value in `,(0,$.jsx)(`a`,{href:R(`settings`,`secrets`),children:`Secrets`}),`; it never comes to this page.`,v?.headers[0]&&!v.headers[0].set&&v.headers[0].variable===r.variable.trim()&&(0,$.jsxs)(`span`,{className:`text-warn`,children:[` `,v.headers[0].variable,` has no value saved yet.`]}),b.length>0&&` ${b.length} more ${b.length===1?`header`:`headers`} set with forgeqe telemetry set ${b.length===1?`is`:`are`} kept.`]}),children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsx)(H,{"aria-label":`Header name`,className:`w-full sm:w-[200px]`,value:r.header,spellCheck:!1,autoComplete:`off`,onChange:e=>T({header:e.target.value})}),(0,$.jsx)(H,{id:`otel-variable`,className:`w-full sm:w-[200px]`,value:r.variable,placeholder:`OTEL_COLLECTOR_TOKEN`,spellCheck:!1,autoComplete:`off`,onChange:e=>T({variable:e.target.value})})]})}),(0,$.jsx)(J,{label:`What to send`,help:Oo[r.level],children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Qn,{label:`What to send`,value:r.level,onChange:e=>T({level:e}),options:Do})})}),(0,$.jsx)(J,{label:`Problems as log records`,help:r.logs?`Errors and warnings (a failed turn, a failed tool call, a failed run) go to /v1/logs: a severity and the event's kind, tied to the session's trace. Never their text.`:`Off: problems are counted in the metrics and marked on the spans only.`,children:(0,$.jsx)(Un,{checked:r.logs,onChange:e=>T({logs:e}),label:`Send problems as log records`})}),(0,$.jsx)(J,{label:`Format`,help:r.protocol===`protobuf`?`OTLP protobuf (application/x-protobuf), for a collector that takes only that. The sample below shows it as JSON.`:`OTLP JSON, which every collector takes.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Qn,{label:`Format`,value:r.protocol,onChange:e=>T({protocol:e}),options:[{id:`json`,label:`JSON`},{id:`protobuf`,label:`Protobuf`}]})})}),(0,$.jsx)(J,{label:`Service name`,htmlFor:`otel-service`,help:`How the collector names ForgeQE: letters, digits, dots, dashes or underscores.`,children:(0,$.jsx)(H,{id:`otel-service`,className:`w-full sm:w-[200px]`,value:r.service,spellCheck:!1,autoComplete:`off`,onChange:e=>T({service:e.target.value})})}),(0,$.jsx)(J,{label:`Projects`,help:r.only?`Only this project (${e.project}) is sent. A project whose forgeqe.yaml says telemetry: off is never sent.`:`Every project on this computer, except one whose forgeqe.yaml says telemetry: off.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Qn,{label:`Projects`,value:r.only?`this`:`all`,onChange:e=>T({only:e===`this`}),options:[{id:`all`,label:`Every project`},{id:`this`,label:`Only this one`}]})})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 py-4`,children:[(0,$.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!!u||!w||!r.endpoint.trim(),onClick:()=>void O(),"data-tip":`Save to ForgeQE's folder on this computer; nothing is turned on`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),u===`save`?`Saving…`:`Save`]}),w&&v&&(0,$.jsxs)(U,{size:`sm`,onClick:()=>i(C),disabled:!!u,"data-tip":`Discard your changes`,children:[(0,$.jsx)(c,{"aria-hidden":`true`}),`Discard`]})]}),(0,$.jsx)(Z,{icon:n,help:`Shapes, never content: each attribute is a name of ForgeQE's own list, a number or a yes or no.`,children:`What is sent`}),(0,$.jsx)(J,{label:`Attributes`,help:`The whole list. Anything else is left out before it leaves this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.attributes.join(`, `)})}),(0,$.jsx)(J,{label:`Metrics`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.metrics.join(`, `)})}),(0,$.jsx)(J,{label:`Never sent`,children:(0,$.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[e.neverSent[0].toUpperCase()+e.neverSent.slice(1),`.`]})}),(0,$.jsx)(J,{label:`A sample`,help:`What would be sent for ${e.sample.from}.`,children:(0,$.jsxs)(U,{size:`sm`,onClick:()=>p(`sample`),"data-tip":`The real JSON, as the collector would get it`,children:[(0,$.jsx)(Ie,{"aria-hidden":`true`}),`Show the sample`]})}),(0,$.jsx)(G,{wide:!0,open:!!f,onClose:()=>p(null),title:f===`on`&&v?`Turn on the export to ${v.host}`:`What would be sent`,description:`For ${e.sample.from}.`,footer:f===`on`&&v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{onClick:()=>p(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!!u||m.trim()!==v.host,onClick:()=>void _(`on`,async()=>{let e=await Ye.on(m);return p(null),l(`On. ForgeQE sends to ${v.host} from its next command.`),e}),children:[(0,$.jsx)(ie,{"aria-hidden":`true`}),u===`on`?`Turning on…`:`Turn on`]})]}):(0,$.jsxs)(U,{onClick:()=>p(null),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[f===`on`&&v&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[v.level===`metrics`?`Metrics`:`Each session's spans and its metrics`,v.logs?`, and problems as log records,`:``,` go to `,v.endpoint,` as `,v.protocol===`protobuf`?`protobuf (shown here as JSON)`:`JSON`,`, with only the attributes below. Never sent: `,e.neverSent,`. Turn it off here at any time.`]}),(0,$.jsxs)(`label`,{htmlFor:`otel-confirm`,className:`text-[13px] font-medium text-ink-2`,children:[`Type `,v.host,` to confirm`]}),(0,$.jsx)(H,{id:`otel-confirm`,value:m,placeholder:v.host,spellCheck:!1,autoComplete:`off`,onChange:e=>h(e.target.value)}),a&&(0,$.jsx)(To,{text:a})]}),e.sample.traces&&(0,$.jsx)(Wt,{level:3,icon:Oe,title:`Spans, to /v1/traces`,children:(0,$.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[12px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed break-all whitespace-pre-wrap text-ink-2`,children:e.sample.traces})}),e.sample.logs&&(0,$.jsx)(Wt,{level:3,icon:oe,title:`Log records, to /v1/logs`,children:(0,$.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[12px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed break-all whitespace-pre-wrap text-ink-2`,children:e.sample.logs})}),e.sample.metrics&&(0,$.jsx)(Wt,{level:3,icon:re,title:`Metrics, to /v1/metrics`,children:(0,$.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[12px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed break-all whitespace-pre-wrap text-ink-2`,children:e.sample.metrics})})]})})]})}var Mo=[{id:`github`,name:`GitHub`,note:`github.com, or GitHub Enterprise at your own address.`,logo:Rn.github,tokenEnv:`GITHUB_TOKEN`,cloud:!0,cli:{system:`github`,label:`GitHub`}},{id:`azure-devops`,name:`Azure DevOps`,note:`An organization on dev.azure.com, or Azure DevOps Server.`,logo:Rn.azure_devops,tokenEnv:`ADO_PAT`,cloud:!0,org:`Organization`,cli:{system:`azure_devops`,label:`Azure DevOps`}},{id:`gitlab`,name:`GitLab`,note:`gitlab.com, or GitLab at your own address.`,logo:Rn.gitlab,tokenEnv:`GITLAB_TOKEN`,cloud:!0},{id:`bitbucket-cloud`,name:`Bitbucket Cloud`,note:`bitbucket.org: a workspace's repositories, or every one you can read.`,logo:Rn.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!0,org:`Workspace`},{id:`bitbucket-server`,name:`Bitbucket Data Center`,note:`Bitbucket Server or Data Center at your own address.`,logo:Rn.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!1}],No=e=>Mo.find(t=>t.id===e),Po=/^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;function Fo(e,t){let n=!t.url||Io(e?.id,String(t.url)).cloud;return e?.id===`github`?n?`cli`:`gh-host`:e?.id===`azure-devops`&&n?`cli`:`git`}function Io(e,t){let n;try{n=new URL(t.trim())}catch{return{cloud:!1}}let r=n.hostname.toLowerCase(),i=we(n.pathname).split(`/`).filter(Boolean)[0],a=i&&/^[A-Za-z0-9][A-Za-z0-9 ._-]{0,99}$/.test(i)?i:void 0;if(e===`azure-devops`){if(r===`dev.azure.com`)return{cloud:!0,org:a};let e=/^([a-z0-9][a-z0-9-]{0,62})\.visualstudio\.com$/.exec(r);return e?{cloud:!0,org:e[1]}:{cloud:!1}}return e===`bitbucket-cloud`?r===`bitbucket.org`?{cloud:!0,org:a}:{cloud:!1}:e===`github`?{cloud:r===`github.com`}:e===`gitlab`?{cloud:r===`gitlab.com`}:{cloud:!1}}function Lo({logo:e,icon:t,title:n,meta:r,state:i,actions:a}){return(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Kn,{icon:t,logo:e}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:r}),i]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:a})]})}function Ro({ok:e,message:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:B(`mt-2 mb-1 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(C,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function zo({title:e,help:t}){return(0,$.jsxs)(`div`,{className:`mt-8 mb-2 flex flex-col gap-1`,children:[(0,$.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),t&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:t})]})}var Bo=({children:e})=>(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:e}),Vo=e=>Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`));function Ho(e,t,n){let r=K(Y(e,[`product`,`repos`])),i=e;for(let[e,a]of Object.entries(r))K(a).account===t&&(i=q(i,[`product`,`repos`,e,`account`],n));return i}function Uo({edit:e}){let t=e.value,n=K(Y(t,[`product`,`accounts`])),r=K(Y(t,[`product`,`repos`])),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)({}),f=(0,Q.useCallback)(()=>{Qe.get().then(e=>d(e.saved),()=>{})},[]);(0,Q.useEffect)(f,[f]);let m=Yt(),h=e=>Object.values(r).filter(t=>K(t).account===e).length,g=(e,t)=>{let n=No(t.host),r=h(e),i=`${r} ${r===1?`repository`:`repositories`} connected`;if(t.auth===`token`)return dn(m,String(t.token_env||``))?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected with a token, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs its token: Edit to add it`});let a=Fo(n,t),o=u[n.cli.system];return a===`cli`?o&&(o.via!==`token`||o.browser)&&wi(o,n.name)?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs a sign-in: Edit to sign in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`${a===`gh-host`?`The GitHub CLI's`:`Git Credential Manager's`} sign-in, ${i}`})};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{first:!0,help:`Sign in to where your code is, then pick the repositories ForgeQE reads into the product graph.`,children:`1. Repositories`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:Object.keys(n).length?`Your accounts. Pick more repositories from one with Repositories.`:`No account yet: add GitHub, Azure DevOps, GitLab or Bitbucket.`}),(0,$.jsxs)(U,{size:`sm`,"data-tip":`Add an account`,onClick:()=>s({step:`catalog`}),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add`]})]}),Object.entries(n).map(([n,r])=>{let a=K(r),o=No(a.host);return(0,$.jsx)(Lo,{logo:o?.logo,icon:ye,title:n,meta:[o?.name||`Unknown host`,a.org,a.url].filter(Boolean).map(String).join(`, `),state:g(n,a),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Repositories of ${n}`,"data-tip":`Repositories of ${n}`,disabled:!o,onClick:()=>l(n),children:(0,$.jsx)(i,{"aria-hidden":`true`})}),o&&(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${n}`,"data-tip":`Edit ${n}`,onClick:()=>s({step:`form`,host:o,mode:`edit`,name:n,from:n,value:a}),children:(0,$.jsx)(p,{"aria-hidden":`true`})}),(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${n}`,"data-tip":`Disconnect ${n}`,onClick:()=>e.set(Ho(q(t,[`product`,`accounts`,n],void 0),n,void 0)),children:(0,$.jsx)(ze,{"aria-hidden":`true`})})]})},n)}),(0,$.jsx)(zo,{title:`Connected repositories`,help:`Each one a repository the graph reads: connected from an account, or a local clone or a link added by hand.`}),(0,$.jsx)(hn,{edit:e,base:[`product`,`repos`],defs:er,noun:`repository by hand`,placeholder:`web`,meta:e=>typeof e.git==`string`&&e.git?`${e.git}${typeof e.branch==`string`&&e.branch?` (${e.branch})`:``}${typeof e.account==`string`?`, from ${e.account}`:``}`:typeof e.path==`string`?e.path:``}),(0,$.jsx)(Yo,{edit:e}),(0,$.jsx)(Qo,{edit:e}),(0,$.jsx)(Z,{help:dr[0].help,children:`4. The product and its knowledge`}),(0,$.jsx)(X,{defs:dr[0].fields,edit:e,base:dr[0].base}),dr.slice(1).map(t=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(zo,{title:t.title,help:t.help}),(0,$.jsx)(X,{defs:t.fields,edit:e,base:t.base})]},t.title)),(0,$.jsx)(Z,{help:mr[0].help,children:`5. ${mr[0].title}`}),(0,$.jsx)(X,{defs:mr[0].fields,edit:e,base:mr[0].base}),(0,$.jsx)(Wo,{sheet:o,setSheet:s,taken:e=>e in n,onSigned:f,onApply:n=>{let r=t;n.mode===`edit`&&n.from!==n.name&&(r=Ho(q(r,[`product`,`accounts`,n.from],void 0),n.from,n.name)),e.set(q(r,[`product`,`accounts`,n.name],n.value)),s(null),n.mode===`add`&&l(n.name)}}),(0,$.jsx)(Go,{id:c,account:c?K(n[c]):{},repos:r,onClose:()=>l(null),onConnect:n=>e.set(q(t,[`product`,`repos`],{...r,...n}))})]})}function Wo({sheet:e,setSheet:t,taken:n,onApply:r,onSigned:i}){let a=Yt(),[o,s]=(0,Q.useState)({busy:!1}),c=e?.step===`form`?`${e.host.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>s({busy:!1}),[c]);let l=()=>t(null);if(e?.step===`form`){let c=e,u=c.value,d=e=>t({...c,value:e}),f=c.name?Po.test(c.name)?c.name!==c.from&&n(c.name)?`Another account has this name.`:``:`Letters, digits, - and _.`:``,p=!u.url||Io(c.host.id,String(u.url)).cloud,m=c.host.id===`azure-devops`&&p&&!(u.url&&Io(c.host.id,String(u.url)).org),h=(()=>{let e=String(u.url||``).trim();if(!e)return``;try{let t=new URL(e);return t.protocol===`https:`?t.username||t.password?`No user name or password in the address: the token goes in its own field.`:``:`The address is https.`}catch{return`That is not an address.`}})(),g=!!c.name&&!f&&!h&&(c.host.cloud||!!String(u.url||``).trim())&&(!m||!!String(u.org||``).trim())&&(u.auth!==`token`||!!String(u.token_env||``).trim()),_=Fo(c.host,u),v=async e=>{s({busy:!0});try{if(e===`signin`){let e=await lt.signIn(c.name||`account`,u);s({busy:!1,ok:e.ok,message:e.message})}else{let e=await lt.repos(c.name||`account`,u,Vo(a.pending),[]);s({busy:!1,ok:e.ok,message:e.ok?`Signed in: ${e.repos.length} ${e.repos.length===1?`repository`:`repositories`} to pick from${e.truncated?` (the first ones)`:``}.`:e.message})}}catch(e){s({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(G,{open:!0,onClose:l,title:c.mode===`add`?`Connect ${c.host.name}`:`Edit ${c.name}`,description:`Then pick its repositories. A token you type is kept in ${Xt(a.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[c.mode===`add`&&(0,$.jsxs)(U,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(be,{"aria-hidden":`true`}),`Back`]}),(0,$.jsxs)(U,{onClick:()=>v(`list`),disabled:o.busy||!g,className:`mr-auto`,"data-tip":`Test the connection`,children:[(0,$.jsx)(j,{"aria-hidden":`true`}),o.busy?`Testing…`:`Test`]}),(0,$.jsxs)(U,{onClick:l,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!g,onClick:()=>r(c),children:[c.mode===`add`?(0,$.jsx)(j,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),c.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(Kn,{logo:c.host.logo,icon:ye,size:`lg`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:c.host.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:o.message&&(0,$.jsx)(Ro,{ok:!!o.ok,message:o.message})}),(0,$.jsx)(J,{label:`Name`,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):`A short name for the account, such as work.`,htmlFor:`acct-name`,stacked:!0,children:(0,$.jsx)(H,{id:`acct-name`,value:c.name,spellCheck:!1,"aria-invalid":!!f,placeholder:`work`,onChange:e=>t({...c,name:e.target.value.trim()})})}),(0,$.jsx)(J,{label:c.host.cloud?`Address of your own server`:`Address`,help:h?(0,$.jsx)(`span`,{className:`text-fail`,children:h}):c.host.cloud?`Empty: ${c.host.name}'s cloud.`:`https, the server's address.`,htmlFor:`acct-url`,stacked:!0,children:(0,$.jsx)(H,{id:`acct-url`,"aria-invalid":!!h,value:String(u.url||``),spellCheck:!1,placeholder:c.host.cloud?``:`https://bitbucket.acme.example`,onChange:e=>d(q(u,[`url`],e.target.value.trim()||void 0))})}),c.host.org&&(0,$.jsx)(J,{label:c.host.org,help:m?`Its name, as in dev.azure.com/<organization>.`:`Empty: every repository you can read.`,htmlFor:`acct-org`,stacked:!0,children:(0,$.jsx)(H,{id:`acct-org`,value:String(u.org||``),spellCheck:!1,placeholder:`acme`,onChange:e=>d(q(u,[`org`],e.target.value.trim()||void 0))})}),(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 py-4`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Sign in`}),[[`browser`,_===`git`?`In the browser, with Git Credential Manager`:c.host.id===`github`?`In the browser, with the GitHub CLI`:`In the browser, with Microsoft (the Azure CLI)`],[`token`,`With a personal access token`]].map(([e,t])=>(0,$.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-4 text-sm`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`acct-auth`,checked:u.auth===`token`==(e===`token`),onChange:()=>d(e===`token`?{...u,auth:`token`,token_env:u.token_env||c.host.tokenEnv}:{...u,auth:`browser`,token_env:void 0,user:void 0})}),t]},e))]}),u.auth===`token`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Token`,help:`Read access to the repositories (code: read).`,htmlFor:`account-token`,stacked:!0,children:(0,$.jsx)(un,{id:`account-token`,name:String(u.token_env||c.host.tokenEnv),field:`token`,onRename:e=>d({...u,token_env:e})})}),(c.host.id===`bitbucket-cloud`||c.host.id===`bitbucket-server`)&&(0,$.jsx)(J,{label:`User name for the token`,help:`With a Bitbucket app password. Empty: an access token.`,htmlFor:`acct-user`,stacked:!0,children:(0,$.jsx)(H,{id:`acct-user`,value:String(u.user||``),spellCheck:!1,onChange:e=>d(q(u,[`user`],e.target.value.trim()||void 0))})})]}):_===`cli`?(0,$.jsx)(Ti,{system:c.host.cli.system,label:c.host.cli.label,keyless:!0,onChanged:i}):_===`gh-host`?(0,$.jsx)(J,{label:`Sign in with the GitHub CLI`,help:`In a terminal: gh auth login --web --hostname ${(()=>{try{return new URL(String(u.url)).hostname}catch{return`<your server>`}})()}. Then Test.`,stacked:!0}):(0,$.jsx)(J,{label:`Sign in with the browser`,help:`Git Credential Manager opens the sign-in on this computer and keeps it for git, which fetches the repositories with it.`,stacked:!0,children:(0,$.jsxs)(U,{onClick:()=>v(`signin`),disabled:o.busy||!g,"data-tip":`Sign in with the browser`,children:[(0,$.jsx)(ce,{"aria-hidden":`true`}),o.busy?`Signing in…`:`Sign in`]})})]})}return(0,$.jsx)(G,{open:e?.step===`catalog`,onClose:l,title:`Add an account`,description:`Pick where your code is.`,footer:(0,$.jsxs)(U,{onClick:l,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsx)(`div`,{className:`pt-4`,children:Mo.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({step:`form`,host:e,mode:`add`,name:``,from:``,value:{host:e.id,auth:`browser`}}),className:`flex min-h-14 w-full cursor-pointer items-center gap-4 rounded-[12px] border-0 bg-transparent px-2 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,$.jsx)(Kn,{logo:e.logo,icon:ye}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:`text-[13px] text-accent-fg`,children:`Add`})]},e.id))})})}function Go({id:e,account:t,repos:n,onClose:r,onConnect:i}){let a=Yt(),[o,s]=(0,Q.useState)({busy:!1}),[c,l]=(0,Q.useState)(new Set),[u,d]=(0,Q.useState)(``),f=(0,Q.useMemo)(()=>new Set(Object.values(n).map(e=>String(K(e).git||``))),[n]);(0,Q.useEffect)(()=>{e&&(l(new Set),d(``),s({busy:!0}),lt.repos(e,t,Vo(a.pending),Object.keys(n)).then(e=>s(e.ok?{busy:!1,repos:e.repos,truncated:e.truncated,skipped:e.skipped}:{busy:!1,message:e.message}),e=>s({busy:!1,message:e.message})))},[e]);let p=(o.repos||[]).filter(e=>!u||e.fullName.toLowerCase().includes(u.toLowerCase()));return(0,$.jsxs)(G,{open:!!e,onClose:r,wide:!0,title:`Repositories of ${e||``}`,description:`Pick the ones ForgeQE reads into the product graph. They are fetched into ForgeQE's own cache, never your workspace.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-sm text-muted`,children:c.size?`${c.size} picked`:``}),(0,$.jsxs)(U,{onClick:r,children:[(0,$.jsx)(x,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(U,{variant:`primary`,disabled:!c.size,onClick:()=>{let e={};for(let t of o.repos||[])c.has(t.git)&&(e[t.key]=t.entry);i(e),r()},"data-tip":c.size>1?`Connect ${c.size} repositories`:void 0,children:[(0,$.jsx)(j,{"aria-hidden":`true`}),c.size>1?`Connect (${c.size})`:`Connect`]})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[o.busy&&(0,$.jsx)(Bo,{children:`Reading the account's repositories…`}),o.message&&(0,$.jsx)(Ro,{ok:!1,message:o.message})]}),o.repos&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`repo-find`,stacked:!0,children:(0,$.jsx)(H,{id:`repo-find`,value:u,placeholder:`shop`,onChange:e=>d(e.target.value)})}),!p.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:o.repos.length?`None matches.`:`None yet: the account can read no repository.`}),(0,$.jsx)(`ul`,{"aria-label":`Repositories`,className:`m-0 list-none p-0`,children:p.map(e=>{let t=f.has(e.git);return(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:B(`flex min-h-12 items-center gap-4 py-2`,t?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(yn,{disabled:t,checked:t||c.has(e.git),onCheckedChange:t=>l(n=>{let r=new Set(n);return t?r.add(e.git):r.delete(e.git),r})}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.fullName}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.branch,e.private?`private`:e.private===!1?`public`:``,e.description].filter(Boolean).join(` · `)})]}),t&&(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected`})]})},e.git)})}),(o.truncated||!!o.skipped)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[o.truncated?`The first 2,000 are listed: find narrows them.`:``,o.skipped?`${o.skipped} left out: their links are not of this host, or not https.`:``].filter(Boolean).join(` `)})]})]})}var Ko=e=>e.url?`url`:e.mcp?`mcp`:e.command?`command`:e.documents?`documents`:`none`,qo=cr[0].fields,Jo=e=>e.map(e=>qo.find(t=>t.key===e));function Yo({edit:e}){let t=Yt(),n=K(e.value.rag),r=Ko(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)({busy:!1}),u=JSON.stringify(n),d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>a(r===`none`&&d.current?.rag===u?d.current.kind:r),[r,u]);let f=t=>{a(t),l({busy:!1});let r={top_k:n.top_k,timeout_seconds:n.timeout_seconds},i=t===`none`?{}:Object.fromEntries(Object.entries({...r,...t===`url`?{url:n.url,token_env:n.token_env}:t===`mcp`?{mcp:n.mcp}:t===`documents`?{documents:n.documents&&typeof n.documents==`object`?n.documents:{reasoning:!1}}:{command:n.command}}).filter(([,e])=>e!==void 0));d.current={kind:t,rag:JSON.stringify(Object.keys(i).length?i:{})},e.set(q(e.value,[`rag`],Object.keys(i).length?i:void 0))},p=Object.keys(K(e.value.mcp)),m=async()=>{l({busy:!0});try{let r=await lt.testSearch(n,K(e.value.mcp),o,Vo(t.pending));l({busy:!1,...r})}catch(e){l({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`Where your requirements, specs and wiki are searched (a RAG index): checking a test case or a story adds the passages it finds.`,children:`2. Search service`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`The search service`,className:`mb-2`,children:[[`none`,`None`,`Test cases and stories are checked without passages from your documents.`],[`documents`,`This project's documents`,`Built in, no vectors: searches the folders you name.`],[`url`,`A service at an address`,`Your own RAG service, at its address.`],[`mcp`,`A tool of one of your MCP servers`,`A search tool of a server set up under MCP servers.`],[`command`,`A command on this machine`,`A program that prints the passages it finds.`]].map(([e,t,n])=>(0,$.jsxs)(`div`,{onClick:t=>i!==e&&!t.target.closest(`[role=radio]`)&&f(e),className:`flex min-h-[68px] cursor-pointer flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4 first:border-t-0`,children:[(0,$.jsx)(Fr,{checked:i===e,onSelect:()=>i!==e&&f(e),label:`Use ${t}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:n})]})]},e))}),i===`url`&&(0,$.jsx)(X,{defs:Jo([`url`,`token_env`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{defs:Jo([`mcp.server`,`mcp.tool`,`mcp.query_arg`,`mcp.top_k_arg`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-4 text-[13px] text-muted`,children:p.length?`MCP servers set up: ${p.join(`, `)}.`:`No MCP server is set up yet: add one under MCP servers, then name it here.`})]}),i===`command`&&(0,$.jsx)(X,{defs:Jo([`command`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`documents`&&(0,$.jsx)(X,{defs:Jo([`documents.folders`,`documents.reasoning`,`top_k`]),edit:e,base:[`rag`]}),i!==`none`&&(0,$.jsx)(J,{label:`Try a search`,help:i===`command`?`A command runs on the next real search, not from this page.`:i===`documents`?`Searched by keywords only on this page; the model is asked on a real search. Nothing is saved.`:`What a test case would search for. Nothing is saved.`,htmlFor:`rag-query`,children:(0,$.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,$.jsx)(H,{id:`rag-query`,value:o,placeholder:`refunds over 500 EUR`,onChange:e=>s(e.target.value),onKeyDown:e=>Lt(e)&&o.trim()&&m(),className:`min-w-0 flex-1`}),(0,$.jsxs)(U,{size:`sm`,disabled:c.busy||!o.trim(),onClick:m,children:[(0,$.jsx)(se,{"aria-hidden":`true`}),c.busy?`Searching…`:`Search`]})]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[c.message&&(0,$.jsx)(Ro,{ok:!!c.ok,message:c.message}),!!c.passages?.length&&(0,$.jsx)(`ul`,{"aria-label":`Passages found`,className:`m-0 list-none p-0`,children:c.passages.map((e,t)=>(0,$.jsxs)(`li`,{className:`border-t border-line-soft py-2 text-sm [overflow-wrap:anywhere]`,children:[e.source&&(0,$.jsxs)(`span`,{className:`font-medium`,children:[e.source,`: `]}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:e.text})]},t))})]})]})}var Xo=/^[A-Za-z0-9][A-Za-z0-9 _.()-]{0,99}\.(md|markdown|txt)$/i,Zo=e=>e<1024?`${e} bytes`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Qo({edit:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{lt.documents().then(e=>n(e.documents),e=>i({ok:!1,message:e.message}))},[]);let l=async e=>{if(!e?.length)return;o(!0),i(null);let r=[];try{for(let i of Array.from(e)){if(!Xo.test(i.name))throw Error(`${i.name}: only a .md, .markdown or .txt file with a plain name.`);if(i.size>1e6)throw Error(`${i.name} is over 1 MB.`);let e=t?.some(e=>e.name===i.name)??!1,a=await lt.addDocument(i.name,await i.text(),e);n(a.documents),r.push(i.name)}i({ok:!0,message:`Added ${r.join(`, `)}. forgeqe knowledge build reads them with the other documents.`})}catch(e){i({ok:!1,message:e.message})}finally{o(!1),c.current&&(c.current.value=``)}},u=async e=>{try{n((await lt.removeDocument(e)).documents)}catch(e){i({ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{help:`What the graph reads beside the code: Markdown files you add here, folders on this computer, links, Confluence spaces, and the pages ForgeQE remembers of a web app.`,children:`3. Documents`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Added here: kept in .forgeqe/documents, read as the source uploaded.`}),(0,$.jsxs)(U,{size:`sm`,disabled:a,"data-tip":`Add Markdown files`,onClick:()=>c.current?.click(),children:[(0,$.jsx)(te,{"aria-hidden":`true`}),a?`Uploading…`:`Upload`]}),(0,$.jsx)(`input`,{ref:c,type:`file`,accept:`.md,.markdown,.txt,text/markdown,text/plain`,multiple:!0,hidden:!0,onChange:e=>l(e.target.files)})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:r&&(0,$.jsx)(Ro,{ok:r.ok,message:r.message})}),!t&&!r&&(0,$.jsx)(Bo,{children:`Reading the documents…`}),t&&!t.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet.`}),t?.map(e=>(0,$.jsx)(Lo,{icon:Re,title:e.title,meta:`${e.name}, ${Zo(e.bytes)}`,actions:(0,$.jsx)(U,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>u(e.name),children:(0,$.jsx)(s,{"aria-hidden":`true`})})},e.name)),(0,$.jsx)(zo,{title:`Documents and links`,help:`Each one a folder of documents, a link, a Confluence space, or a web app whose pages ForgeQE remembers, by a name no repository has.`}),(0,$.jsx)(hn,{edit:e,base:[`product`,`docs`],defs:or,noun:`source`,placeholder:`help`,meta:e=>String(e.path||e.url||(e.confluence?`Confluence ${e.confluence}`:e.app?`app ${e.app}`:``))})]})}var $o=/^[A-Z][A-Z0-9_]{1,63}$/,es=/^(PATH|PATHEXT|HOME|SHELL|USER|USERNAME|LOGNAME|PWD|TMPDIR|TEMP|TMP|LANG|LC_\w+|TERM|COMSPEC|SYSTEMROOT|WINDIR|APPDATA|LOCALAPPDATA|USERPROFILE|NODE_\w+|BUN_\w+|NPM_\w+|PYTHON\w*|VIRTUAL_ENV|UV_\w+|LD_\w+|DYLD_\w+|SSL_CERT_\w+|REQUESTS_CA_BUNDLE|CURL_CA_BUNDLE|(HTTPS?|ALL|NO)_PROXY|GIT_\w+|SSH_\w+|GNUPGHOME|EDITOR|VISUAL|PAGER|FORGEQE_\w+|WEBPILOT_\w+|WP_CONFIG|WP_LLMS_JSON|WP_LLM_PROFILE)$/i,ts=/(TOKEN|PAT)$/,ns=(e,t=`SHOP_PASSWORD`)=>$o.test(e)?es.test(e)?`${e} changes how programs start: pick another name.`:``:`Capital letters, digits and _, such as ${t}.`,rs=[{id:`azure`,label:`Azure Key Vault`,where:`Key vault`,whereHelp:`Its name, as in https://<name>.vault.azure.net.`,placeholder:`shop-qa-kv`,cli:`Microsoft, in the browser (az login)`},{id:`gcp`,label:`Google Secret Manager`,where:`Project`,whereHelp:`The Google Cloud project's id.`,placeholder:`shop-qa-123456`,cli:`Google, in the browser (gcloud auth login)`},{id:`aws`,label:`AWS Secrets Manager`,where:`Region`,whereHelp:`Where its secrets are, such as eu-west-1.`,placeholder:`eu-west-1`,cli:`AWS SSO, in the browser (aws sso login)`}],is={tenant:`Tenant id`,clientId:`Client id`,clientSecret:`Client secret`,serviceAccount:`Service account key (JSON)`,accessKeyId:`Access key id`,secretAccessKey:`Secret access key`,sessionToken:`Session token (optional)`},as=e=>e?.length?`Used by ${e.slice(0,2).join(`, `)}${e.length>2?` and ${e.length-2} more`:``}`:``,os=()=>qe.list();function ss({show:e}){let{data:t,error:n,reload:r}=Nn(os),[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`sec-saved`),[l,u]=(0,Q.useState)(e||`all`);(0,Q.useEffect)(()=>{e&&c(`sec-saved`),u(e||`all`)},[e]);let[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[ee,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)({}),N=i??t,P=(N?.vaults||[]).filter(e=>e.auth===`cli`).map(e=>e.id).join(`,`),re=e=>{M(t=>({...t,[e]:`checking`})),qe.check(e).then(t=>M(n=>({...n,[e]:t})),t=>M(n=>({...n,[e]:{signedIn:!1,problem:t.message}})))};(0,Q.useEffect)(()=>{if(s===`sec-vaults`)for(let e of P.split(`,`).filter(Boolean))j[e]||re(e)},[s,P]),(0,Q.useEffect)(()=>{if(ee?.state!==`running`)return;let e=setTimeout(()=>{qe.signinState().then(e=>{A(e.signin),e.signin&&e.signin.state!==`running`&&re(e.signin.vault)},()=>{})},1e3);return()=>clearTimeout(e)},[ee]);let ie=async e=>{f(``),m(``);try{A(await qe.signIn(e))}catch(e){m(e.message)}},ae=async(e,t,n)=>{C(!0),k(``);try{o(await e()),n(),f(t)}catch(e){k(e.message)}finally{C(!1)}},F=e=>{k(``),f(``),e()};if(!N)return(0,$.jsx)(En,{error:n,reload:r});let oe=N.secrets.filter(e=>e.from===`vault`&&!e.pending).length,se=async()=>{f(``),m(``);try{let e=await qe.exportVaults(),t=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json;charset=utf-8`})),n=document.createElement(`a`);n.href=t,n.download=`forgeqe-vaults.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3),f(`Exported the vault connections: no value is in the file. A teammate imports it here and pulls with their own sign-in.`)}catch(e){m(e.message)}},le=async e=>{let t=e?.[0];if(t){if(f(``),m(``),t.size>262144)return m(`${t.name} is over 256 KB.`);C(!0),D(!0);try{let e=await qe.importVaults(await t.text());o(e.view);let n=[e.added.length?`Added ${e.added.length===1?`the vault`:`${e.added.length} vaults:`} ${e.added.join(`, `)}.`:`No new vault.`,e.toPull.length?`${e.toPull.length===1?`1 secret is`:`${e.toPull.length} secrets are`} ready to pull on Saved: sign in, then Pull.`:``];f(n.filter(Boolean).join(` `)),e.skipped.length&&m(`Not imported: ${e.skipped.map(e=>`${e.id} (${e.why})`).join(`; `)}`)}catch(e){m(e.message)}finally{C(!1),D(!1)}}},ue=N.secrets.filter(e=>e.token),de=l===`tokens`?ue:N.secrets,I=(e=N.suggestedTokens[0]||`REPO_TOKEN`)=>F(()=>g({mode:`add`,name:e,value:``,token:!0})),fe=async e=>{C(!0),f(``),m(``);try{let t=await qe.pullAgain(e);o(t.view),t.failed.length?m(`Not pulled: ${t.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`):f(`Pulled ${e}.`)}catch(e){m(e.message)}finally{C(!1)}},pe=async()=>{C(!0),f(``),m(``);try{let e=await qe.pullAgain();o(e.view),f(`Pulled ${e.pulled.length} again from their vaults.`),m(e.failed.length?`Not pulled: ${e.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`:``)}catch(e){m(e.message)}finally{C(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Kt,{label:`Secrets`,current:s,onPick:e=>{c(e),f(``),m(``)},tabs:[{id:`sec-saved`,label:`Saved (${N.secrets.length})`},{id:`sec-vaults`,label:`Vaults (${N.vaults.length})`}]}),d&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 mb-4 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:d}),p&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:p}),s===`sec-saved`?(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-saved`,"aria-labelledby":`tab-sec-saved`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":`Show`,children:(0,$.jsx)(vt,{value:l,onChange:e=>{u(e),f(``)},items:[{id:`all`,label:`All`,n:N.secrets.length},{id:`tokens`,label:`Repository tokens`,n:ue.length+N.neededTokens.length}]})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[oe>0&&(0,$.jsxs)(U,{size:`sm`,disabled:S,onClick:()=>void pe(),children:[(0,$.jsx)(b,{"aria-hidden":`true`}),S?`Pulling…`:`Pull all again`]}),l===`tokens`?(0,$.jsxs)(U,{size:`sm`,onClick:()=>I(),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add a token`]}):(0,$.jsxs)(U,{size:`sm`,onClick:()=>F(()=>g({mode:`add`,name:``,value:``})),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add a secret`]})]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:l===`tokens`?`The tokens ForgeQE clones and reads git repositories with: one for each git host or account. A clone picks one by its name.`:`Agents and tests use a secret by its name: in a sign-in, an environment's secrets, or a test's variables.`}),N.neededTokens.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Kn,{icon:ne}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:`${as(e.usedBy)}. It has no value here yet.`,state:(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:(0,$.jsx)(U,{size:`sm`,"aria-label":`Add ${e.name}`,onClick:()=>I(e.name),children:`Add`}),children:null},`needed-${e.name}`)),de.length===0&&!N.neededTokens.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:l===`tokens`?`No repository tokens yet. Add one for each git host or account.`:`None yet. Add one, or pull one from a vault.`}),de.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Kn,{icon:e.from===`vault`?w:e.from===`sign-in`?ce:e.token?ne:me}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:[e.from===`vault`&&e.vault?`From ${e.vault.provider} ${e.vault.id}: ${e.vault.secret}${e.vault.key?` › ${e.vault.key}`:``} · ${e.pending?`not pulled yet`:`pulled ${mn(e.vault.at)}`}`:e.from===`sign-in`?`From the ${e.system} sign-in: sign out of it to remove it.`:e.from===`shell`?`Set in your shell: change or remove it there.`:`Saved in Settings`,e.token?as(e.usedBy)||`Not used yet`:``].filter(Boolean).join(` · `),state:e.from===`shell`?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Set in the environment`}):e.set?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Saved`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:e.pending?(0,$.jsx)(U,{size:`sm`,"aria-label":`Pull ${e.name}`,disabled:S,onClick:()=>void fe(e.name),children:`Pull`}):e.from===`sign-in`||e.from===`shell`?void 0:(0,$.jsx)(U,{size:`sm`,"aria-label":`Edit ${e.name}`,onClick:()=>F(()=>g({mode:`edit`,name:e.name,value:``,row:e,...e.token?{token:!0}:{}})),children:`Edit`}),children:null},e.name)),(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:[`Kept in `,Xt(N.store),`. ForgeQE never shows a value again, and the agents see only names.`,l===`tokens`?` Give each token read access to the repositories it clones, nothing more.`:``]})]}):(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-vaults`,"aria-labelledby":`tab-sec-vaults`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[N.vaults.length>0&&(0,$.jsxs)(U,{size:`sm`,onClick:()=>void se(),"data-tip":`A file of the connections, without values, for a teammate to import`,children:[(0,$.jsx)(Ee,{"aria-hidden":`true`}),`Export`]}),(0,$.jsxs)(U,{size:`sm`,disabled:S,onClick:()=>T.current?.click(),"data-tip":`Connections a teammate exported`,children:[(0,$.jsx)(te,{"aria-hidden":`true`}),E?`Importing…`:`Import`]}),(0,$.jsx)(`input`,{ref:T,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>(le(e.target.files),e.target.value=``)}),(0,$.jsxs)(U,{size:`sm`,onClick:()=>F(()=>v({mode:`add`,v:{id:``,provider:`azure`,where:``,auth:`cli`}})),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Add a vault`]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:`Where ForgeQE pulls secrets from. It reads a value only when you pull that secret.`}),ee&&(0,$.jsx)(ds,{s:ee,onCancel:()=>void qe.cancelSignin().then(e=>A(e.signin),()=>{}),onClose:()=>A(null)}),N.vaults.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet. Add Azure Key Vault, Google Secret Manager or AWS Secrets Manager.`}),N.vaults.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Kn,{icon:w}),title:e.id,meta:`${e.providerLabel} · ${e.where} · ${e.auth===`cli`?`signs in with your browser${e.profile?`, profile ${e.profile}`:``}`:`signs in with saved keys`}${e.pulled?` · ${e.pulled} pulled`:``}${e.missing.length?` · not saved yet: ${e.missing.join(`, `)}`:``}`,state:e.auth===`cli`?j[e.id]===`checking`||!j[e.id]?(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Checking the sign-in…`}):j[e.id].signedIn?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":j[e.id].problem,children:`Not signed in`}):e.missing.length?(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":e.missing.join(`, `),children:e.missing.length===1?`Needs ${e.missing[0]}`:`Needs ${e.missing.length} variables`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.pulled===1?`1 secret pulled`:`${e.pulled} secrets pulled`}),actions:(0,$.jsxs)($.Fragment,{children:[e.auth===`cli`&&j[e.id]!==`checking`&&j[e.id]&&!j[e.id].signedIn?(0,$.jsxs)(U,{size:`sm`,variant:`primary`,"aria-label":`Sign in to ${e.id}`,disabled:ee?.state===`running`,onClick:()=>void ie(e.id),children:[(0,$.jsx)(ce,{"aria-hidden":`true`}),`Sign in`]}):(0,$.jsx)(U,{size:`sm`,"aria-label":`Browse ${e.id}`,disabled:e.missing.length>0||e.auth===`cli`&&j[e.id]===`checking`,onClick:()=>F(()=>x(e)),children:`Browse`}),(0,$.jsx)(U,{size:`sm`,"aria-label":`Edit ${e.id}`,onClick:()=>F(()=>v({mode:`edit`,v:{id:e.id,provider:e.provider,where:e.where,auth:e.auth,...e.profile?{profile:e.profile}:{},...e.keys?{keys:e.keys}:{}}})),children:`Edit`})]}),children:null},e.id)),(0,$.jsx)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:`Vaults are kept on this computer for this project, never in the repository: share them with Export and Import, which carry no value. Give ForgeQE's sign-in read access to the secrets it needs, nothing more.`})]}),(0,$.jsx)(cs,{panel:h,setPanel:g,busy:S,error:O,onSave:e=>void ae(()=>qe.save(e.name,e.value),`${e.mode===`add`?`Added`:`Saved`} ${e.name}.`,()=>g(null)),onRemove:e=>void ae(()=>qe.remove(e),`Removed ${e}.`,()=>g(null)),onPull:e=>void ae(async()=>{let t=await qe.pullAgain(e);if(t.failed.length)throw Error(t.failed[0].error);return t.view},`Pulled ${e} again.`,()=>g(null)),taken:new Set(N.secrets.map(e=>e.name))}),(0,$.jsx)(ls,{panel:_,setPanel:v,busy:S,error:O,roles:N.keyRoles,taken:new Set(N.vaults.map(e=>e.id)),missing:N.vaults.find(e=>e.id===_?.v.id)?.missing,onSave:e=>void ae(()=>qe.saveVault(e.v,e.mode===`edit`),`${e.mode===`add`?`Added`:`Saved`} the vault ${e.v.id}.${e.v.auth===`cli`?` Sign in on its row if it says Not signed in.`:``}`,()=>{v(null),M(t=>{let{[e.v.id]:n,...r}=t;return r})}),onRemove:e=>void ae(()=>qe.removeVault(e),`Removed the vault ${e}. The secrets pulled from it stay saved.`,()=>v(null))}),(0,$.jsx)(us,{vault:y,onClose:()=>x(null),taken:new Set(N.secrets.map(e=>e.name)),onPulled:(e,t,n)=>{o(e),x(null),c(`sec-saved`),f(`Pulled ${n} as ${t}. Agents and tests can use it by that name.`)}})]})}function cs({panel:e,setPanel:t,busy:n,error:r,onSave:i,onRemove:a,onPull:o,taken:s}){let c=e?.mode===`add`?ns(e.name,e.token?`GITHUB_TOKEN`:void 0)||(s.has(e.name)?`${e.name} is already in the list: edit it there.`:``)||(e.token&&!ts.test(e.name)?`A token's name ends in TOKEN or PAT, such as GITHUB_TOKEN.`:``):``,l=e?.row?.from===`vault`,[u,d]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>d(!1),[!!e]),(0,$.jsx)(G,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${e.name}`:e?.token?`Add a repository token`:`Add a secret`,description:`The value goes to your credential store when you press the button below. ForgeQE never shows it again, and the agents see only its name.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):c?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(U,{disabled:n,onClick:()=>a(e.name),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(U,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(U,{variant:`primary`,disabled:n||!!c||!e?.value.trim(),onClick:()=>e&&i(e),children:n?`Saving…`:e?.mode===`add`?e.token?`Add token`:`Add secret`:e?.token?`Save token`:`Save secret`})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[e.mode===`add`&&(0,$.jsx)(J,{label:`Name`,help:c?(0,$.jsx)(`span`,{className:`text-fail`,children:c}):e.token?`The variable a clone signs in with: one per host or account.`:`The variable agents and tests read it by.`,htmlFor:`sh-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(H,{id:`sh-name`,value:e.name,spellCheck:!1,maxLength:64,placeholder:e.token?`GITHUB_TOKEN`:`SHOP_PASSWORD`,"aria-invalid":!!c,onChange:n=>t({...e,name:n.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),l&&e.row?.vault&&(0,$.jsx)(J,{label:`From a vault`,help:`${e.row.vault.provider} ${e.row.vault.id}: ${e.row.vault.secret}${e.row.vault.key?` › ${e.row.vault.key}`:``}, pulled ${mn(e.row.vault.at)}. Pull it again for the vault's newest value; a value typed below replaces it and is no longer the vault's.`,className:`mt-4`,stacked:!0,children:(0,$.jsxs)(U,{size:`sm`,disabled:n,onClick:()=>o(e.name),children:[(0,$.jsx)(b,{"aria-hidden":`true`}),`Pull again`]})}),(0,$.jsx)(J,{label:e.mode===`edit`?`New value`:e.token?`Token`:`Value`,help:e.token?`A personal access token with read access to the repositories (GitHub: Contents read; Azure DevOps: Code read; GitLab: read_repository).`:(0,$.jsxs)($.Fragment,{children:[`At most 16 KB.`,` `,(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:u?`One line, hidden`:`Several lines (shown as you type), such as a JSON key`})]}),htmlFor:`sh-value`,className:e.mode===`edit`&&!l?`mt-4`:void 0,stacked:!0,children:u&&!e.token?(0,$.jsx)(dt,{id:`sh-value`,rows:6,autoComplete:`off`,spellCheck:!1,value:e.value,onChange:n=>t({...e,value:n.target.value}),className:`font-mono`}):(0,$.jsx)(H,{id:`sh-value`,type:`password`,autoComplete:`off`,value:e.value,onChange:n=>t({...e,value:n.target.value})})})]})})}function ls({panel:e,setPanel:t,busy:n,error:r,roles:i,taken:a,missing:o,onSave:s,onRemove:c}){let l=e?.v,u=rs.find(e=>e.id===l?.provider)??rs[0],d=n=>e&&t({...e,v:{...e.v,...n}}),f=l?.auth===`keys`?Object.entries(i[l.provider]).map(([e,t])=>[e,ns(l.keys?.[e]??t)]).filter(([,e])=>e):[],p=e?.mode===`add`?/^[a-z][a-z0-9-]{0,39}$/.test(l?.id||``)?a.has(l.id)?`A vault is already named ${l.id}.`:``:`Lower case letters, digits and -, such as qa-kv.`:``;return(0,$.jsx)(G,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${l?.id}`:`Add a vault`,description:`Where ForgeQE pulls secrets from, and how it signs in. Kept on this computer for this project. Nothing is read until you pull a secret.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):p||f.length?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(U,{disabled:n,onClick:()=>c(l.id),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(U,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(U,{variant:`primary`,disabled:n||!!p||f.length>0||!l?.where.trim(),onClick:()=>e&&s(e),children:n?`Saving…`:e?.mode===`add`?`Add vault`:`Save vault`})]}),children:e&&l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Provider`,htmlFor:`vt-provider`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(V,{id:`vt-provider`,value:l.provider,disabled:e.mode===`edit`,onChange:e=>d({provider:e.target.value,where:``,keys:void 0,profile:void 0}),children:rs.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),e.mode===`add`&&(0,$.jsx)(J,{label:`Name`,help:p?(0,$.jsx)(`span`,{className:`text-fail`,children:p}):`What this project calls it.`,htmlFor:`vt-id`,stacked:!0,children:(0,$.jsx)(H,{id:`vt-id`,value:l.id,spellCheck:!1,maxLength:40,placeholder:`qa-kv`,"aria-invalid":!!p,onChange:e=>d({id:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`)}),className:`font-mono`})}),(0,$.jsx)(J,{label:u.where,help:u.whereHelp,htmlFor:`vt-where`,stacked:!0,children:(0,$.jsx)(H,{id:`vt-where`,value:l.where,spellCheck:!1,maxLength:64,placeholder:u.placeholder,onChange:e=>d({where:e.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(J,{label:`Sign in with`,help:l.auth===`cli`?`Your own account, in your browser: Sign in on the vault's row after you add it. The cloud's CLI keeps the sign-in and renews it; ForgeQE saves nothing.`:`For a computer with nobody to sign in, such as a build agent.`,htmlFor:`vt-auth`,stacked:!0,children:(0,$.jsxs)(V,{id:`vt-auth`,value:l.auth,onChange:e=>d({auth:e.target.value,keys:e.target.value===`keys`?{...i[l.provider]}:void 0}),children:[(0,$.jsxs)(`option`,{value:`cli`,children:[u.cli,` (recommended)`]}),(0,$.jsx)(`option`,{value:`keys`,children:l.provider===`azure`?`A service principal's keys, saved as secrets (no browser)`:l.provider===`gcp`?`A service account's key, saved as a secret (no browser)`:`Access keys, saved as secrets (no browser)`})]})}),l.provider===`aws`&&l.auth===`cli`&&(0,$.jsx)(J,{label:`Profile (optional)`,help:`An SSO profile of ~/.aws/config (set one up once with aws configure sso). Empty: the default.`,htmlFor:`vt-profile`,stacked:!0,children:(0,$.jsx)(H,{id:`vt-profile`,value:l.profile||``,spellCheck:!1,maxLength:64,placeholder:`qa`,onChange:e=>d({profile:e.target.value.trim()||void 0}),className:`font-mono`})}),l.auth===`keys`&&Object.entries(i[l.provider]).map(([e,t])=>(0,$.jsx)(J,{label:is[e]||e,help:(()=>{let n=l.keys?.[e]??t,r=ns(n);return r?(0,$.jsx)(`span`,{className:`text-fail`,children:r}):o?.includes(n)?(0,$.jsx)(`span`,{className:`text-warn`,children:`Not saved yet: add ${n} on the Saved tab.`}):`The secret that holds it, saved on the Saved tab as ${n}.`})(),htmlFor:`vt-${e}`,stacked:!0,children:(0,$.jsx)(H,{id:`vt-${e}`,"aria-invalid":!!ns(l.keys?.[e]??t),value:l.keys?.[e]??t,spellCheck:!1,maxLength:64,onChange:t=>d({keys:{...l.keys||i[l.provider],[e]:t.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}}),className:`font-mono`})},e))]})})}function us({vault:e,onClose:t,taken:n,onPulled:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=()=>{e&&(a(null),s(``),qe.names(e.id).then(a,e=>s(e.message)))};(0,Q.useEffect)(()=>{d(null),l(``),h(``),g()},[e?.id]);let _=(i?.names||[]).filter(e=>e.toLowerCase().includes(c.trim().toLowerCase())),v=_.slice(0,200),y=u?ns(u.name):``,b=async()=>{if(e&&u){p(!0),h(``);try{r(await qe.pull({vault:e.id,secret:u.secret,name:u.name,...u.key.trim()?{key:u.key.trim()}:{}}),u.name,u.secret)}catch(e){h(e.message)}finally{p(!1)}}};return(0,$.jsxs)(G,{open:!!e,onClose:t,wide:!0,title:e?`Secrets of ${e.id}`:`Secrets`,description:e?`The names in ${e.providerLabel} ${e.where}. Pick one to pull its value into your credential store under a variable's name; ForgeQE never shows the value.`:void 0,footer:(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:m}):(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:u?y?`Needs a valid name`:`${u.secret} as ${u.name}`:``}),(0,$.jsx)(U,{onClick:t,children:`Cancel`}),(0,$.jsx)(U,{variant:`primary`,disabled:f||!u||!!y,onClick:()=>void b(),children:f?`Pulling…`:`Pull secret`})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[!i&&!o&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Reading the vault's names…`}),o&&(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(En,{error:o,reload:g})})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`br-find`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(H,{id:`br-find`,value:c,placeholder:`password`,onChange:e=>l(e.target.value)})}),!_.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:i.total?`None matches.`:`None yet: ForgeQE's sign-in can see no secret in this vault.`}),(0,$.jsx)(`ul`,{"aria-label":`Secrets in the vault`,className:`m-0 list-none p-0`,children:v.map(e=>{let t=u?.secret===e;return(0,$.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 py-2`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`br-secret`,checked:t,onChange:()=>d({secret:e,name:e.toUpperCase().replace(/[^A-Z0-9_]/g,`_`).replace(/^([^A-Z])/,`S_$1`).slice(0,64),key:``})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e})]}),t&&u&&(0,$.jsxs)(`div`,{className:`mb-4 ml-8 flex flex-col gap-4 rounded-[12px] bg-surface-muted p-4`,children:[(0,$.jsx)(J,{label:`Save as`,help:y?(0,$.jsx)(`span`,{className:`text-fail`,children:y}):n.has(u.name)?`${u.name} is saved already: pulling replaces its value.`:`The variable agents and tests read it by.`,htmlFor:`br-name`,stacked:!0,className:`py-0`,children:(0,$.jsx)(H,{id:`br-name`,value:u.name,spellCheck:!1,maxLength:64,"aria-invalid":!!y,onChange:e=>d({...u,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),(0,$.jsx)(J,{label:`JSON field (optional)`,help:`When the secret holds JSON, the one field to keep, such as password.`,htmlFor:`br-key`,stacked:!0,className:`py-0`,children:(0,$.jsx)(H,{id:`br-key`,value:u.key,spellCheck:!1,maxLength:128,placeholder:`password`,onChange:e=>d({...u,key:e.target.value}),className:`font-mono`})})]})]},e)})}),(_.length>v.length||i.total>i.names.length)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[_.length>v.length?`The first ${v.length} of ${_.length} are shown: find narrows them.`:``,i.total>i.names.length?`The first ${i.names.length.toLocaleString()} of the vault's names are listed.`:``].filter(Boolean).join(` `)})]})]})}function ds({s:e,onCancel:n,onClose:r}){let[i,a]=(0,Q.useState)(!1),o=e.state===`running`,s=e.link&&/^https:\/\//.test(e.link)?e.link:void 0;return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`mb-4 flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Signing in to `,e.vault]}),(s||e.code)&&o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.code&&(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-4 py-2 font-mono text-lg font-semibold tracking-[0.12em]`,children:e.code}),(0,$.jsxs)(U,{size:`sm`,"aria-label":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(e.code).then(()=>a(!0)),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(t,{"aria-hidden":`true`}),i?`Copied`:`Copy`]})]}),s&&(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer noopener`,className:mt({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(Se,{"aria-hidden":`true`}),`Open `,new URL(s).host]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:[e.lines.slice(-6).map((t,n)=>(0,$.jsx)(`li`,{className:B(`[overflow-wrap:anywhere]`,n===e.lines.slice(-6).length-1&&e.state===`done`?`text-pass`:n===e.lines.slice(-6).length-1&&e.state===`failed`?`text-fail`:`text-ink-2`),children:t},n)),o&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for you to finish in the browser…`})]}),(0,$.jsx)(`div`,{children:o?(0,$.jsx)(U,{size:`sm`,onClick:n,children:`Cancel`}):(0,$.jsx)(U,{size:`sm`,onClick:r,children:`Close`})})]})}var fs={testmu:`TestMu AI`,browserstack:`BrowserStack`},ps={testmu:{provider:`testmu`,remote:{username_env:`LT_USERNAME`,access_key_env:`LT_ACCESS_KEY`}},browserstack:{provider:`browserstack`,remote:{username_env:`BROWSERSTACK_USERNAME`,access_key_env:`BROWSERSTACK_ACCESS_KEY`}}},ms=(...e)=>e.map(([e,t])=>({value:e,label:t})),hs={testmu:[{key:`type`,label:`Type`,type:`select`,default:`real`,options:ms([`real`,`Real device`],[`virtual`,`Emulator or simulator`])},{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:ms([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As TestMu AI names it.`,type:`text`,placeholder:`Galaxy S23`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}],browserstack:[{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:ms([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As BrowserStack names it. Real devices only.`,type:`text`,placeholder:`Google Pixel 7`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13.0`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}]},gs=`Kept in your credential store; the file has only the variable's name. The same sign-in as its browsers.`,_s={testmu:[{key:`remote.username_env`,label:`TestMu AI user`,help:gs,type:`var`,default:`LT_USERNAME`},{key:`remote.access_key_env`,label:`TestMu AI key`,help:gs,type:`var`,default:`LT_ACCESS_KEY`},{key:`mobile.region`,label:`Region for devices`,type:`text`,placeholder:`us`}],browserstack:[{key:`remote.username_env`,label:`BrowserStack user`,help:gs,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`remote.access_key_env`,label:`BrowserStack key`,help:gs,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`}]};function vs(e){return[e.type===`virtual`?e.platform===`ios`?`simulator`:`emulator`:`real device`,`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`,e.model,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}function ys({grids:e,setGrids:t,paths:n,vars:r}){return(0,$.jsx)($.Fragment,{children:[`testmu`,`browserstack`].map(i=>{let a=fs[i],o={value:e[i]??ps[i],set:n=>t({...e,[i]:n}),vars:r,file:n[i]};return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Z,{help:(0,$.jsxs)($.Fragment,{children:[`Kept in `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:n[i]}),`, `,a,`'s own file`,e[i]?``:`, made when you add a device`,`. Its browsers and their devices are in the same file:`,` `,(0,$.jsxs)(`a`,{href:R(`settings`,`integrations`),children:[`Integrations → `,a]}),`.`]}),children:`${a} devices`}),(0,$.jsx)(hn,{edit:o,base:[`mobile`,`devices`],defs:hs[i],noun:`${a} device`,placeholder:i===`testmu`?`galaxy-s23`:`pixel7`,start:i===`testmu`?{type:`real`,platform:`android`}:{platform:`android`},meta:vs}),(0,$.jsx)(X,{defs:_s[i],edit:o,base:[]})]},i)})})}var bs=(0,Q.lazy)(()=>ft(()=>import(`./Features-BjPR9gCe.js`).then(e=>({default:()=>(0,$.jsx)(e.Features,{embedded:!0})})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),xs=(0,Q.lazy)(()=>ft(()=>import(`./WhatsNew-DqBLhhgk.js`).then(e=>({default:()=>(0,$.jsx)(e.WhatsNew,{embedded:!0})})),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),Ss=Vn.filter(e=>!Pn.includes(e.id)),Cs=[...new Set(Ss.map(e=>e.group))],ws=[`setup`,`environments`,`signins`,`secrets`,`integrations`,`notifications`,`appearance`,`voice`,`models`,`databases`,`features`,`whats-new`,`report`,`about`],Ts=`forgeqe-settings-more`,Es={config:`forgeqe.yaml`,models:`llms.json`,environments:`the environment files`,guardrails:`guardrails.md`,grids:`the browser grid files`,secrets:`keys and passwords`};function Ds(e,t){let n=e.paths.base.replace(/(?<![\\/])[\\/]+$/,``);return t.startsWith(`${n}/`)||t.startsWith(`${n}\\`)?`./${t.slice(n.length+1).replace(/\\/g,`/`)}`:t}function Os(e){return{config:e.config,models:e.models,environments:e.environments,guardrails:e.guardrails.filter(e=>e.editable).map(e=>e.text),grids:{browserstack:e.grids.browserstack.linked?e.grids.browserstack.value:null,testmu:e.grids.testmu.linked?e.grids.testmu.value:null},secrets:{}}}var ks={local:`This computer`,browserstack:`BrowserStack`,testmu:`TestMu AI`};function As(e){let t=ks[String(e.runs_on??`local`)]??String(e.runs_on),n=e.type===`real`||e.type===void 0&&e.runs_on!==void 0&&e.runs_on!==`local`?`real device`:e.platform===`ios`?`simulator`:`emulator`,r=`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`;return[`${t}, ${n}`,r,e.model||e.udid,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}var js=[{id:`setup`,label:`Set up`},{id:`models`,label:`Models`},{id:`evidence`,label:`Product knowledge`},{id:`appearance`,label:`Appearance`}],Ms=e=>js.find(t=>t.id===e)?.id??`setup`;function Ns({section:e,only:t,guide:n}){let r=n===void 0?void 0:Ms(n),i=r??t??e,{theme:a}=Bt(),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[h,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(null),T=(0,Q.useCallback)(()=>{f(``),nt.settings().then(e=>{s(e),u(Os(e))},e=>f(e.message))},[]),E=(0,Q.useCallback)(()=>{f(``),st.state().then(e=>{w(e),e.ready&&T()},e=>f(e.message))},[T]);(0,Q.useEffect)(E,[E]);let D=e=>{e.project===C?.project&&e.ready||(s(null),u(null)),w(e),e.ready&&T()},O=!!C?.ready,[ee,te]=(0,Q.useState)(null),[A,ne]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),re=(0,Q.useCallback)(async()=>{if(!(await st.state()).ready)return!1;let e=await st.machine();return e.engine&&e.runtime},[]);(0,Q.useEffect)(()=>{r!==void 0&&rt.status().then(e=>{te(e.state),ne(!0)},()=>ne(!0))},[r]),(0,Q.useEffect)(()=>{r!==void 0&&re().then(M,()=>M(!1))},[r,C,re]),(0,Q.useEffect)(()=>P(``),[r]),(0,Q.useEffect)(()=>{if(r!==`setup`||j)return;let e=cn(()=>void re().then(M,()=>{}),2500);return()=>an(e)},[r,j,re]);let ie=async(e,t)=>{P(``);try{if(e===`done`){await rt.save({done:!0,step:`done`,...t?{skip:t}:{}}),location.hash=R();return}let n=await rt.save({step:e,...t?{skip:t}:{}});te(n.state),location.hash=R(`welcome`,e)}catch(e){P(e.message)}},ae=async()=>{if(await re().catch(()=>!1))return ie(`done`);r!==`setup`&&(location.hash=R(`welcome`,`setup`)),P(`Set up is the one step that cannot be skipped: ForgeQE needs it to run. Once it is done, you can leave onboarding.`)};(0,Q.useEffect)(()=>{r===void 0?C&&!O&&i!==`setup`?location.replace(R(`settings`,`setup`)):!t&&i&&Pn.includes(i)&&location.replace(R(i)):r!==`setup`&&C&&!O&&location.replace(R(`welcome`,`setup`))},[C,O,i]);let F=(C&&!O?Vn[0]:Vn.find(e=>e.id===(i===`repo-tokens`?`secrets`:i)))||Vn.find(e=>e.id===`models`),[oe,se]=(0,Q.useState)(()=>{try{return localStorage.getItem(Ts)===`open`}catch{return!1}}),ce=e=>{se(e);try{localStorage.setItem(Ts,e?`open`:`closed`)}catch{}};(0,Q.useEffect)(()=>{_(``),m(``),S(!1)},[F.id]);let le=o?Os(o):null,ue=e=>!!l&&!!le&&!Zn(l[e],le[e]),de=Object.keys(Es).filter(ue);(0,Q.useEffect)(()=>{if(!de.length)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[de.length]);let I=e=>({value:l[e],set:t=>{_(``),u(n=>({...n,[e]:t}))},vars:o.variables,...e===`config`?{file:`forgeqe.yaml`}:{}}),fe=(0,Q.useRef)(l);fe.current=l;let pe=(0,Q.useRef)(o);pe.current=o;let[he,ge]=(0,Q.useState)(``),_e=(0,Q.useRef)({}),ve=(0,Q.useCallback)((e,t)=>{let n=_e.current,r=Object.keys(n).find(t=>n[t]===e)??e;r===t?delete n[r]:n[r]=t},[]),ye=(0,Q.useCallback)(async()=>{let e=fe.current,t=pe.current;if(!e||!t)return;let n=Os(t),r=Object.keys(Es).filter(t=>!Zn(e[t],n[t]));if(!r.length)return;y(!0),m(``),S(!1);let i=t,a=(t,n)=>u(r=>{if(!r)return r;let i=Os(t),a={...r};for(let t of Object.keys(Es))if(t===`secrets`){if(!n)continue;a.secrets=Object.fromEntries(Object.entries(r.secrets).filter(([t,n])=>e.secrets[t]!==n))}else(n?Zn(r[t],e[t]):Zn(r[t],i[t]))&&(a[t]=i[t]);return a});try{for(let a of r)if(a===`secrets`)i=await nt.saveSecrets(e.secrets);else if(a===`grids`)for(let[r,a]of Object.entries(e.grids))a&&!Zn(a,n.grids[r])&&(i=await nt.saveGrid(r,a,t.versions[`grid:${r}`]));else if(a===`models`){let r=n.models.models,o=e.models.models,s=Object.fromEntries(Object.entries(_e.current).filter(([e,t])=>r&&o&&e in r&&!(e in o)&&t in o));i=await nt.save(a,e[a],t.versions[a],s),_e.current={}}else i=a===`guardrails`?await nt.saveGuardrails(e.guardrails,t.versions.guardrails):await nt.save(a,e[a],t.versions[a]);s(i),a(i,!0),ge(``),_(`Saved`)}catch(n){m(n.message),S(n instanceof Ze&&n.status===409),ge(JSON.stringify(e)),i!==t&&(s(i),a(i,!1))}finally{y(!1)}},[]);(0,Q.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>_(``),4e3);return()=>clearTimeout(e)},[h]);let be=l?JSON.stringify(l):``;(0,Q.useEffect)(()=>{if(!de.length||v||x||he&&he===be)return;let e=de.every(e=>e===`secrets`),t=setTimeout(ye,e?2e3:1e3);return()=>clearTimeout(t)},[be,v,x,he]);let xe=async()=>{m(``);try{let e=await nt.splitEnvironments();s(e),u(Os(e)),_(`Each environment is now its own file in environments/. The old file is left as it is; ForgeQE no longer reads it.`)}catch(e){m(e.message)}},Se=async(e,t,n)=>{m(``);try{let r=await nt.saveText(e,t,n,o?.versions[e]);return s(r),u(Os(r)),_(`Saved ${Es[e]}.`),!0}catch(e){return m(e.message),!1}},L=null;if(F.id===`setup`)L=C&&(0,$.jsx)(xa,{state:C,onState:D,guide:r!==void 0});else if(o&&l){let e=(F.id===`models`||F.id===`routing`?[`models`,`config`]:F.id===`environments`?[`environments`,`config`]:[`files`,`guardrails`,`prompts`,`logs`,`audit`,`generated`,`about`,`report`,`features`,`whats-new`].includes(F.id)?[]:[`config`]).find(e=>o.errors[e]);switch(F.id){case`models`:L=(0,$.jsx)(_i,{config:I(`config`),models:I(`models`),vars:o.variables,onReload:T,onRename:ve});break;case`environments`:L=(0,$.jsx)(Zr,{envs:I(`environments`),layout:o.paths.environments,files:o.raw.environments,base:o.paths.base,onSplit:xe,config:I(`config`),splitBlocked:ue(`environments`)||ue(`config`)?`Save or discard your changes to the environments and forgeqe.yaml first.`:``});break;case`browser`:L=(0,$.jsx)(wn,{groups:nr,edit:I(`config`)});break;case`appearance`:L=(0,$.jsx)(yo,{config:I(`config`)});break;case`voice`:L=(0,$.jsx)(wo,{});break;case`observability`:L=(0,$.jsx)(jo,{});break;case`routing`:L=(0,$.jsx)(Ci,{config:I(`config`),models:I(`models`)});break;case`generated`:L=(0,$.jsx)(La,{});break;case`about`:L=(0,$.jsx)(Pa,{});break;case`features`:case`whats-new`:L=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Opening…`}),children:F.id===`features`?(0,$.jsx)(bs,{}):(0,$.jsx)(xs,{})});break;case`report`:L=(0,$.jsx)(Wa,{});break;case`notifications`:case`mcp`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bi,{view:F.id,edit:I(`config`),grids:l.grids,setGrids:e=>u(t=>({...t,grids:e})),gridPaths:{browserstack:Ds(o,o.grids.browserstack.file),testmu:Ds(o,o.grids.testmu.file)}}),F.id===`notifications`&&(0,$.jsx)(Fa,{})]});break;case`parallel`:L=(0,$.jsx)(wn,{groups:rr,edit:I(`config`)});break;case`mobile`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wn,{groups:tr,edit:I(`config`)}),(0,$.jsx)(Z,{help:`Phones, tablets, emulators and simulators connected to this computer. Every device in use, here and on the clouds below, runs each replay and set of Maestro flows; ForgeQE sets up Appium, Maestro and the cloud for each.`,children:`Devices on this computer`}),(0,$.jsx)(hn,{edit:I(`config`),base:[`mobile`,`devices`],defs:ar,noun:`device`,placeholder:`pixel8`,start:{type:`virtual`,platform:`android`},meta:As}),(0,$.jsx)(ys,{grids:l.grids,setGrids:e=>{_(``),u(t=>({...t,grids:e}))},paths:{browserstack:Ds(o,o.grids.browserstack.file),testmu:Ds(o,o.grids.testmu.file)},vars:o.variables}),(0,$.jsx)(wn,{groups:yr,edit:I(`config`),continued:!0})]});break;case`desktop`:L=(0,$.jsx)(wn,{groups:vr,edit:I(`config`)});break;case`containers`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wn,{groups:ir.slice(0,1),edit:I(`config`)}),(0,$.jsx)(Z,{help:`Each one ForgeQE may start, stop and read: a database, a queue, the API under test.`,children:`Services`}),(0,$.jsx)(hn,{edit:I(`config`),base:[`containers`,`services`],defs:br,noun:`service`,placeholder:`db`,meta:e=>[e.image,Array.isArray(e.ports)?`ports ${e.ports.join(`, `)}`:``].filter(Boolean).map(String).join(`, `)}),(0,$.jsx)(wn,{groups:ir.slice(1),edit:I(`config`),continued:!0})]});break;case`databases`:L=(0,$.jsx)(hn,{edit:I(`config`),base:[`databases`],defs:ur,noun:`database`,placeholder:`orders`,meta:e=>[e.description,e.engine,e.url_env?`from ${e.url_env}`:e.host,e.writable?`writable`:`read only`].filter(Boolean).map(String).join(`, `)});break;case`signins`:L=(0,$.jsx)(Wn,{edit:I(`config`)});break;case`secrets`:L=(0,$.jsx)(ss,{show:i===`repo-tokens`?`tokens`:void 0});break;case`integrations`:L=(0,$.jsx)(Bi,{edit:I(`config`),grids:l.grids,setGrids:e=>{_(``),u(t=>({...t,grids:e}))},gridPaths:{browserstack:Ds(o,o.grids.browserstack.file),testmu:Ds(o,o.grids.testmu.file)}});break;case`tests`:L=(0,$.jsx)(wn,{groups:gr,edit:I(`config`)});break;case`runs`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wn,{groups:$n,edit:I(`config`)}),(0,$.jsx)(wn,{groups:hr,edit:I(`config`),continued:!0}),(0,$.jsx)(Z,{help:`Each one a table of the project report: forgeqe.<name>.`,children:`Report datasets`}),(0,$.jsx)(hn,{edit:I(`config`),base:[`bi`,`datasets`],defs:lr,noun:`dataset`,placeholder:`open_bugs`,meta:e=>[e.title,e.kind===`jira_jql`?`Jira`:e.kind===`ado_wiql`?`Azure DevOps`:``].filter(Boolean).map(String).join(`, `)})]});break;case`quality`:L=(0,$.jsx)(wn,{groups:xr,edit:I(`config`)});break;case`evidence`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uo,{edit:I(`config`)}),(0,$.jsx)(Ia,{})]});break;case`agents`:L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wn,{groups:fr,edit:I(`config`)}),(0,$.jsx)(Ga,{config:I(`config`)})]});break;case`guardrails`:L=(0,$.jsx)(Xi,{rules:l.guardrails,others:o.guardrails.filter(e=>!e.editable),onChange:e=>u({...l,guardrails:e}),onChanged:e=>(_(e),nt.settings().then(s,()=>{}))});break;case`monitor`:L=(0,$.jsx)(qi,{edit:I(`config`)});break;case`skills`:L=(0,$.jsx)(Pr,{edit:I(`config`)});break;case`prompts`:L=(0,$.jsx)(jr,{onChanged:_});break;case`registry`:L=(0,$.jsx)(In,{edit:I(`config`)});break;case`logs`:L=(0,$.jsx)(_n,{});break;case`audit`:L=(0,$.jsx)(Hn,{});break;case`tokenomics`:L=(0,$.jsx)(An,{edit:I(`config`)});break;case`files`:L=(0,$.jsx)(jn,{snap:o,dirty:{config:ue(`config`),models:ue(`models`),environments:ue(`environments`)},onSave:Se})}e&&(L=(0,$.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail`,children:[e===`environments`?`An environment file`:Es[e],` does not parse, so the form cannot show it: `,o.errors[e],`. Fix it in `,(0,$.jsx)(`a`,{href:R(`settings`,`files`),children:`Settings as text`}),`.`]}))}let Ce=p?(0,$.jsxs)(`div`,{role:`alert`,className:`flex w-full flex-wrap items-center gap-4 rounded-[14px] border border-fail-soft bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail shadow-composer`,children:[(0,$.jsx)(`span`,{className:`flex-[1_1_260px] [overflow-wrap:anywhere]`,children:p}),x?(0,$.jsxs)(U,{size:`sm`,onClick:()=>{S(!1),m(``),ge(``),E()},"data-tip":`Reload, and lose my unsaved changes`,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),`Reload`]}):(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[de.length>0&&(0,$.jsxs)(U,{size:`sm`,onClick:()=>{u(le),_e.current={},m(``),ge(``)},"data-tip":`Undo my change`,children:[(0,$.jsx)(c,{"aria-hidden":`true`}),`Undo`]}),(0,$.jsxs)(U,{size:`sm`,onClick:()=>{m(``),ge(``),ye()},children:[(0,$.jsx)(g,{"aria-hidden":`true`}),`Retry`]})]})]}):null,we={pending:l?.secrets||{},set:(e,t)=>{_(``),u(n=>{let r={...n.secrets};return t===void 0?delete r[e]:r[e]=t,{...n,secrets:r}})},saved:new Set(o?.saved||[]),vars:o?.variables||{},store:o?.store||`the credential store`};return(0,$.jsx)(qn.Provider,{value:we,children:(0,$.jsxs)(`div`,{className:`settings-fields flex min-h-(--screen) flex-col`,children:[(0,$.jsx)(Gt,{}),(0,$.jsxs)(`main`,{className:B(`box-border flex w-full flex-auto flex-col items-stretch sm:flex-row sm:items-start`,t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[(0,$.jsx)(`div`,{className:B(`theme-side theme-side--wide w-full flex-col gap-4 border-line px-4 pt-6 pb-4 sm:sticky sm:top-0 sm:h-(--screen) sm:w-[248px] sm:flex-none sm:overflow-y-auto sm:border-r sm:bg-surface-muted`,t?`hidden`:`flex`),children:r===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Zt,{href:R(),label:a.name||`ForgeQE`,className:`px-2`}),(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Settings`}),(0,$.jsx)(Rs,{ready:O}),(0,$.jsx)(`label`,{htmlFor:`section-pick`,className:`sr-only`,children:`Section`}),(0,$.jsx)(V,{id:`section-pick`,value:F.id,onChange:e=>location.hash=R(`settings`,e.target.value),className:`sm:hidden`,children:Cs.map(e=>(0,$.jsx)(`optgroup`,{label:e,children:Ss.filter(t=>t.group===e).map(e=>(0,$.jsx)(`option`,{value:e.id,disabled:!O&&e.id!==`setup`,children:e.label},e.id))},e))}),(0,$.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`hidden flex-col gap-4 sm:flex`,children:[(0,$.jsx)(Is,{sections:Ss.filter(e=>ws.includes(e.id)),current:F.id,locked:!!C&&!O}),(0,$.jsx)(Ls,{open:oe||!ws.includes(F.id),onToggle:()=>ce(!oe),children:(0,$.jsx)(Is,{sections:Ss.filter(e=>!ws.includes(e.id)),current:F.id,locked:!!C&&!O})})]})]}):(0,$.jsx)(Fs,{step:r,skipped:ee?.skipped??[],open:j,onSkip:()=>void ae()})}),(0,$.jsxs)(`section`,{"aria-labelledby":`sec-h`,className:B(`flex min-w-0 flex-1 flex-col`,!t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[t?(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-4`,children:[(0,$.jsx)(Kn,{icon:F.icon,pixel:Et[F.id],size:`lg`}),(0,$.jsx)(`h1`,{id:`sec-h`,className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:F.label})]}):(0,$.jsxs)(`h1`,{id:`sec-h`,className:`m-0 mb-2 flex items-center gap-4 text-[25px] leading-tight font-semibold tracking-[-0.01em]`,children:[(0,$.jsx)(pt,{icon:F.icon,size:22,className:`flex-none text-muted`}),F.label]}),(0,$.jsxs)(`p`,{className:`mt-0 mb-10 text-[13px] leading-relaxed text-ink-2`,children:[F.intro,F.file&&o&&(0,$.jsxs)($.Fragment,{children:[` `,`Saved in `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:F.file}),`.`]})]}),d&&(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-4 border-t border-line pt-6`,children:[(0,$.jsx)(`p`,{className:`m-0 leading-relaxed text-ink-2`,children:d}),(0,$.jsxs)(U,{size:`sm`,onClick:E,children:[(0,$.jsx)(g,{"aria-hidden":`true`}),`Retry`]})]}),C&&!O&&(0,$.jsxs)(`p`,{className:`mt-0 mb-6 flex items-start gap-2 rounded-[12px] bg-surface-muted px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[(0,$.jsx)(me,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`The other sections open once ForgeQE is set up in a project folder: choose the folder, then Set up.`]}),!d&&(!C||F.id!==`setup`&&!o)&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading settings…`}),(0,$.jsx)(`div`,{"data-tour":`section`,className:`flex flex-col`,children:L}),r!==void 0&&C&&A&&(0,$.jsx)(pa,{welcome:ee===null||ua(),onStart:Ps,step:r,ready:O,coreReady:j,onGo:(e,t)=>void ie(e,t),onSkipAll:()=>void ae(),onFinish:()=>void ie(`done`),note:N},r),(0,$.jsxs)(`div`,{className:`sticky bottom-4 z-10 mt-8 flex flex-col items-end gap-2`,children:[Ce,(0,$.jsx)(`div`,{"aria-live":`polite`,className:`contents`,children:!p&&(de.length>0||v||h)&&(0,$.jsx)(`span`,{className:B(`inline-flex min-h-9 items-center gap-2 rounded-full border border-line bg-bg px-4 text-[13px] shadow-composer`,de.length||v?`text-ink-2`:`text-pass`),children:de.length||v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ht,{state:`working`,px:16}),`Saving…`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{size:14,"aria-hidden":`true`}),h]})})})]})]})]})]})})}var Ps=()=>{da(),rt.save({step:`setup`}).catch(()=>{})};function Fs({step:e,skipped:t,open:n,onSkip:r}){let i=js.findIndex(t=>t.id===e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Getting started`}),(0,$.jsx)(`p`,{className:`m-0 px-2 text-[13px] leading-relaxed text-ink-2`,children:`A few steps to start. Everything but Set up can be skipped and changed later in Settings.`}),(0,$.jsx)(`nav`,{"aria-label":`Onboarding steps`,children:(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:js.map((r,a)=>{let o=Vn.find(e=>e.id===r.id),s=a>0&&!n,c=r.id===e,l=a<i&&!t.includes(r.id);return(0,$.jsx)(`li`,{children:s?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`After Set up`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(pt,{icon:o.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),(0,$.jsx)(me,{size:13,"aria-label":`Locked`,className:`flex-none`})]}):(0,$.jsxs)(`a`,{href:R(`welcome`,r.id),"aria-current":c?`step`:void 0,className:B(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,c?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(pt,{icon:o.icon,size:16,className:B(`flex-none`,c?`text-ink`:`text-muted group-hover:text-ink`)}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),l&&(0,$.jsx)(k,{size:13,"aria-label":`Done`,className:`flex-none text-pass`}),t.includes(r.id)&&!c&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Skipped`})]})},r.id)})})}),(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start rounded-[7px] border-0 bg-transparent px-2 text-[13px] text-ink-2 hover:bg-surface-strong hover:text-ink`,children:[(0,$.jsx)(x,{size:14,"aria-hidden":`true`}),`Skip onboarding`]})]})}function Is({sections:e,current:t,locked:n}){let r=[...new Set(e.map(e=>e.group))];return(0,$.jsx)($.Fragment,{children:r.map(r=>{let i=`group-${r}-${e[0]?.id}`;return(0,$.jsxs)(`div`,{role:`group`,"aria-labelledby":i,className:`flex flex-col gap-px`,children:[(0,$.jsx)(`span`,{id:i,className:`px-2 pt-1 pb-1 text-[13px] font-medium text-muted`,children:r}),e.filter(e=>e.group===r).map(e=>n&&e.id!==`setup`?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`Set up ForgeQE in a project folder first`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(pt,{icon:e.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,$.jsx)(me,{size:13,"aria-label":`Locked`,className:`flex-none`})]},e.id):(0,$.jsxs)(`a`,{href:R(`settings`,e.id),"aria-current":t===e.id?`page`:void 0,className:B(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,t===e.id?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(pt,{icon:e.icon,size:16,className:B(`flex-none`,t===e.id?`text-ink`:`text-muted group-hover:text-ink`)}),e.label]},e.id))]},r)})})}function Ls({open:e,onToggle:t,children:n}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":`settings-more`,onClick:t,className:`flex h-7 cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] font-medium text-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:`More settings`}),(0,$.jsx)(D,{size:14,strokeWidth:2,"aria-hidden":`true`,className:B(`flex-none transition-transform duration-200`,e&&`rotate-90`)})]}),(0,$.jsx)(nn,{open:e,id:`settings-more`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})})]})}function Rs({ready:e}){let[t,n]=(0,Q.useState)(``),r=t.toLowerCase().split(/\s+/).filter(Boolean),i=e=>Vn.find(t=>t.id===e)?.label||e,a=r.length?_r.filter(e=>r.every(t=>`${e.label} ${e.key} ${i(e.section)}`.toLowerCase().includes(t))).slice(0,12):[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`label`,{htmlFor:`find-setting`,className:`sr-only`,children:`Find a setting`}),(0,$.jsx)(H,{size:`sm`,id:`find-setting`,type:`search`,value:t,disabled:!e,placeholder:`Search settings`,className:`bg-bg`,"data-tip":`By its name or its forgeqe.yaml key: max attempts, memory.dir`,onChange:e=>n(e.target.value)}),r.length>0&&(0,$.jsxs)(`ul`,{"aria-label":`Settings found`,className:`m-0 flex list-none flex-col p-0`,children:[a.length===0&&(0,$.jsx)(`li`,{className:`px-2 py-2 text-[13px] text-muted`,children:`Nothing called that. Every key can also be edited in Settings as text.`}),a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`a`,{href:R(`settings`,e.section),onClick:()=>n(``),className:`flex flex-col rounded-[10px] px-2 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`text-sm`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i(e.section),` · `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e.key})]})]})},`${e.section}:${e.key}`))]})]})}export{ws as COMMON_SECTIONS,js as GUIDE_STEPS,Vn as SECTIONS,Pn as SIDEBAR_SECTIONS,Ns as Settings};
|