@capagents/forgeqe 3.1.6 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forgeqe.js +1753 -1752
- package/dist/web/assets/{3d-force-graph-DhjnuSZ7.js → 3d-force-graph-OeCdKJJ-.js} +1 -1
- package/dist/web/assets/{Agent-BvZNnkYO.js → Agent-DrdDwck4.js} +1 -1
- package/dist/web/assets/{AgentWork-CXqq9ihT.js → AgentWork-wNaA-i2T.js} +1 -1
- package/dist/web/assets/ApiTests-B3X6NIn8.js +10 -0
- package/dist/web/assets/{Browse-DU423cZs.js → Browse-Cd1DEgYR.js} +1 -1
- package/dist/web/assets/{Chat-D128NJm9.js → Chat-4GknHS5Z.js} +1 -1
- package/dist/web/assets/{CommandPalette-CqHeNMlz.js → CommandPalette-zRrrp6F_.js} +1 -1
- package/dist/web/assets/{Compare-Cfhl9eEb.js → Compare-DJVhkzqO.js} +1 -1
- package/dist/web/assets/{Cost-BZ34Hxth.js → Cost-CbKnuQuB.js} +1 -1
- package/dist/web/assets/{Data-BQx6Yjyt.js → Data-Bt5yqqvq.js} +1 -1
- package/dist/web/assets/{Desktop-XvNM9FOF.js → Desktop-CPDo3Ir-.js} +1 -1
- package/dist/web/assets/{DesktopReview-hvUm15-5.js → DesktopReview-CCaqTSu5.js} +1 -1
- package/dist/web/assets/{Evidence-Cfk59P10.js → Evidence-BAuIgj1h.js} +1 -1
- package/dist/web/assets/{Explore-BDyb5dKe.js → Explore-BqzEPdP7.js} +1 -1
- package/dist/web/assets/{Features-XIqYxKc1.js → Features-DFuPCW9x.js} +1 -1
- package/dist/web/assets/{Flags-CdHPrNp4.js → Flags-UBakvqIq.js} +1 -1
- package/dist/web/assets/{Flaky-DwDQRut-.js → Flaky-DUzdfQW4.js} +1 -1
- package/dist/web/assets/{Impact-t9iOQDtS.js → Impact-jLZqUzz9.js} +1 -1
- package/dist/web/assets/{Jobs-48PdEMgf.js → Jobs-De3NyY5s.js} +1 -1
- package/dist/web/assets/{KindPage-Dy0J7L-M.js → KindPage-DWznWcLB.js} +1 -1
- package/dist/web/assets/{Migration-0HYN_JZm.js → Migration-BdOq6RO6.js} +1 -1
- package/dist/web/assets/{PageAgent-DY8YEIdr.js → PageAgent-dVvZtNoB.js} +1 -1
- package/dist/web/assets/{Product-Ba9C8kLQ.js → Product-ByZ8Qr3i.js} +3 -3
- package/dist/web/assets/{Production-DzfDMnnj.js → Production-D8L2TchK.js} +1 -1
- package/dist/web/assets/{Quality-CnURaQom.js → Quality-CSZEuhZo.js} +1 -1
- package/dist/web/assets/{Readiness-DlwnwSJ8.js → Readiness-bBu_84mx.js} +1 -1
- package/dist/web/assets/{Record-CrJyzp8u.js → Record-DWJEDj2C.js} +1 -1
- package/dist/web/assets/{Regression-D-qjvr44.js → Regression-D2VkPIhZ.js} +1 -1
- package/dist/web/assets/{Reports-BspqEzVg.js → Reports-dF-O5HTI.js} +1 -1
- package/dist/web/assets/{Response-BxvDBStv.js → Response-D4JW3pwi.js} +1 -1
- package/dist/web/assets/{Responsive-C4chhZcc.js → Responsive-CLX9S27s.js} +1 -1
- package/dist/web/assets/{RunDiff-D8NBOHwI.js → RunDiff-BuL_-GwF.js} +1 -1
- package/dist/web/assets/{Runs-Bb2krvLN.js → Runs-DyyaAiyA.js} +1 -1
- package/dist/web/assets/{Settings-D2Byn_Va.js → Settings-DnG6_QQj.js} +3 -3
- package/dist/web/assets/{Steps-CymeLF90.js → Steps-C-0zwG7T.js} +1 -1
- package/dist/web/assets/{TestCases-DYTIR2LB.js → TestCases-DXk9qsEL.js} +1 -1
- package/dist/web/assets/{TestData-UNmAG8Wi.js → TestData-D4al7-3Z.js} +1 -1
- package/dist/web/assets/{TestDebt-CQOYiRaK.js → TestDebt-BzOVDuS8.js} +1 -1
- package/dist/web/assets/{TestManagement-DWNUDF7y.js → TestManagement-T-NIlhc9.js} +1 -1
- package/dist/web/assets/{Tosca-BJsofAG8.js → Tosca-D7tqMGK0.js} +1 -1
- package/dist/web/assets/{WhatsNew-Gs-_0But.js → WhatsNew-DBViE2Qt.js} +1 -1
- package/dist/web/assets/{dataParts-DV44YXP9.js → dataParts-D56_9p6T.js} +1 -1
- package/dist/web/assets/{fold-CdtPs-3w.js → fold-UP5ihvz-.js} +1 -1
- package/dist/web/assets/{head-EHQVlLa5.js → head-BpR3dGRT.js} +1 -1
- package/dist/web/assets/{highlight-DIktyogB.js → highlight--Ayfy7Gy.js} +1 -1
- package/dist/web/assets/{index-Cq2sihjc.js → index-CljX5dI4.js} +5 -5
- package/dist/web/assets/{logos-B1BhmXnA.js → logos-B4e5nBuL.js} +1 -1
- package/dist/web/assets/{paletteCommands-w1UNWBRa.js → paletteCommands-ar4wAGok.js} +1 -1
- package/dist/web/assets/{qualityParts-B8bouYKy.js → qualityParts-D_U5zhKC.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/prompts/test-plan.md +1 -1
- package/prompts/test-reviewer.md +1 -1
- package/prompts/test-rules.md +6 -1
- package/py/forgeqe_engine/brand.py +45 -27
- package/py/forgeqe_engine/browser.py +34 -1
- package/py/forgeqe_engine/browserlaunch.py +16 -3
- package/py/forgeqe_engine/orb_assets.py +30 -0
- package/py/forgeqe_engine/profilename.py +168 -0
- package/py/forgeqe_engine/pwlaunch.mjs +3 -2
- package/py/forgeqe_engine/service.py +7 -1
- package/py/forgeqe_engine/settings.py +17 -0
- package/skills/bdd-gherkin/SKILL.md +3 -0
- package/dist/web/assets/ApiTests-B26ezscO.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{AmbientLight as n,ArrayCamera as r,Box3 as i,BoxGeometry as a,BufferAttribute as o,BufferGeometry as s,ByteType as c,ClampToEdgeWrapping as l,Color as u,ColorManagement as d,Compatibility as f,ConeGeometry as p,Controls as m,CubeCamera as h,CubeDepthTexture as g,CubeTexture as _,CubicBezierCurve3 as v,CylinderGeometry as y,DataArrayTexture as b,DataTexture as x,DecrementStencilOp as S,DecrementWrapStencilOp as C,DepthFormat as ee,DepthStencilFormat as te,DepthTexture as w,DirectionalLight as ne,DynamicDrawUsage as re,EllipseCurve as ie,EventDispatcher as ae,Float16BufferAttribute as oe,Float32BufferAttribute as se,FloatType as ce,FramebufferTexture as le,Frustum as ue,FrustumArray as de,GridHelper as fe,Group as pe,HalfFloatType as me,HemisphereLight as he,IncrementStencilOp as ge,IncrementWrapStencilOp as _e,InstancedBufferAttribute as ve,InstancedInterleavedBuffer as ye,IntType as be,InterleavedBuffer as xe,InterleavedBufferAttribute as Se,InvertStencilOp as Ce,KeepStencilOp as we,LightProbe as Te,Line as Ee,LineBasicMaterial as De,LineDashedMaterial as Oe,LinearFilter as ke,LinearMipmapLinearFilter as Ae,LinearMipmapNearestFilter as je,LinearSRGBColorSpace as Me,LinearTransfer as Ne,MOUSE as Pe,Material as Fe,MathUtils as Ie,Matrix2 as Le,Matrix3 as Re,Matrix4 as ze,Mesh as Be,MeshBasicMaterial as Ve,MeshLambertMaterial as He,MeshMatcapMaterial as Ue,MeshNormalMaterial as We,MeshPhongMaterial as Ge,MeshPhysicalMaterial as Ke,MeshStandardMaterial as qe,MeshToonMaterial as Je,MirroredRepeatWrapping as Ye,NearestFilter as Xe,NearestMipmapLinearFilter as Ze,NearestMipmapNearestFilter as Qe,OrthographicCamera as $e,PerspectiveCamera as et,Plane as tt,PlaneGeometry as nt,PointLight as rt,PointsMaterial as it,QuadraticBezierCurve3 as at,Quaternion as ot,R11_EAC_Format as st,RED_GREEN_RGTC2_Format as ct,RED_RGTC1_Format as lt,RG11_EAC_Format as ut,RGBAFormat as dt,RGBAIntegerFormat as ft,RGBA_ASTC_10x10_Format as pt,RGBA_ASTC_10x5_Format as mt,RGBA_ASTC_10x6_Format as ht,RGBA_ASTC_10x8_Format as gt,RGBA_ASTC_12x10_Format as _t,RGBA_ASTC_12x12_Format as vt,RGBA_ASTC_4x4_Format as yt,RGBA_ASTC_5x4_Format as bt,RGBA_ASTC_5x5_Format as xt,RGBA_ASTC_6x5_Format as St,RGBA_ASTC_6x6_Format as Ct,RGBA_ASTC_8x5_Format as wt,RGBA_ASTC_8x6_Format as Tt,RGBA_ASTC_8x8_Format as Et,RGBA_BPTC_Format as Dt,RGBA_ETC2_EAC_Format as Ot,RGBA_S3TC_DXT1_Format as kt,RGBA_S3TC_DXT3_Format as At,RGBA_S3TC_DXT5_Format as jt,RGBFormat as Mt,RGBIntegerFormat as Nt,RGB_BPTC_SIGNED_Format as Pt,RGB_BPTC_UNSIGNED_Format as Ft,RGB_ETC1_Format as It,RGB_ETC2_Format as Lt,RGB_S3TC_DXT1_Format as Rt,RGFormat as zt,RGIntegerFormat as Bt,Ray as Vt,Raycaster as Ht,RectAreaLight as Ut,RedFormat as Wt,RedIntegerFormat as Gt,RenderObjectRefreshType as Kt,RenderTarget as qt,RepeatWrapping as Jt,ReplaceStencilOp as Yt,SIGNED_R11_EAC_Format as Xt,SIGNED_RED_GREEN_RGTC2_Format as Zt,SIGNED_RED_RGTC1_Format as Qt,SIGNED_RG11_EAC_Format as $t,SRGBColorSpace as en,Scene as tn,ShaderMaterial as nn,ShadowMaterial as rn,ShortType as an,Sphere as on,SphereGeometry as sn,Spherical as cn,SpotLight as ln,SpriteMaterial as un,StaticDrawUsage as dn,TOUCH as fn,Texture as pn,TextureLoader as mn,Timer as hn,TimestampQuery as gn,TubeGeometry as _n,Uint16BufferAttribute as vn,Uint32BufferAttribute as yn,UniformsUtils as bn,UnsignedByteType as xn,UnsignedInt101111Type as Sn,UnsignedInt248Type as Cn,UnsignedInt5999Type as wn,UnsignedIntType as Tn,UnsignedShortType as En,Vector2 as T,Vector3 as E,Vector4 as Dn,WebGLCoordinateSystem as On,WebGLRenderTarget as kn,WebGLRenderer as An,WebGPUCoordinateSystem as jn,WebXRController as Mn,a as Nn,createCanvasElement as Pn,error as D,i as Fn,log as In,n as Ln,r as Rn,t as zn,warn as O,warnOnce as Bn}from"./three.module-D480w7q4.js";import{g as Vn,h as Hn,m as Un}from"./RelationGraph-q5H4bYjq.js";import{a as Wn,i as Gn,n as Kn,o as qn,r as Jn,s as Yn}from"./Product-Ba9C8kLQ.js";var Xn=new tt,Zn=new T,Qn=new E,$n=new T,er=new T,tr=new E,nr=new E,rr=new ze,ir=new E,ar=new E,or=null,sr=null,cr=[],lr={NONE:-1,PAN:0,ROTATE:1},ur=class extends m{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new Ht,this.mouseButtons={LEFT:Pe.PAN,MIDDLE:Pe.PAN,RIGHT:Pe.ROTATE},this.touches={ONE:fn.PAN},this._onPointerMove=dr.bind(this),this._onPointerDown=fr.bind(this),this._onPointerCancel=pr.bind(this),this._onContextMenu=mr.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointerup`,this._onPointerCancel),this.domElement.addEventListener(`pointerleave`,this._onPointerCancel),this.domElement.addEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointerup`,this._onPointerCancel),this.domElement.removeEventListener(`pointerleave`,this._onPointerCancel),this.domElement.removeEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=``,this.domElement.style.cursor=``}dispose(){this.disconnect()}_updatePointer(e){let t=this.domElement.getBoundingClientRect();Zn.x=(e.clientX-t.left)/t.width*2-1,Zn.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType===`touch`)t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Pe.PAN:case fn.PAN:this.state=lr.PAN;break;case Pe.ROTATE:case fn.ROTATE:this.state=lr.ROTATE;break;default:this.state=lr.NONE}}};function dr(e){let t=this.object,n=this.domElement,r=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(e),r.setFromCamera(Zn,t),or)this.state===lr.PAN?r.ray.intersectPlane(Xn,tr)&&(or.position.copy(tr.sub(Qn).applyMatrix4(rr)),this.dispatchEvent({type:`drag`,object:or})):this.state===lr.ROTATE&&($n.subVectors(Zn,er).multiplyScalar(this.rotateSpeed),or.rotateOnWorldAxis(ir,$n.x),or.rotateOnWorldAxis(ar.normalize(),-$n.y),this.dispatchEvent({type:`drag`,object:or})),er.copy(Zn);else if(e.pointerType===`mouse`||e.pointerType===`pen`){if(cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0){let e=cr[0].object;Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(e.matrixWorld)),sr!==e&&sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null),sr!==e&&(this.dispatchEvent({type:`hoveron`,object:e}),n.style.cursor=`pointer`,sr=e)}else sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null)}er.copy(Zn)}}function fr(e){let t=this.object,n=this.domElement,r=this.raycaster;this.enabled!==!1&&(this._updatePointer(e),this._updateState(e),cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0&&(or=this.transformGroup===!0?hr(cr[0].object):cr[0].object,Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(or.matrixWorld)),r.ray.intersectPlane(Xn,tr)&&(this.state===lr.PAN?(rr.copy(or.parent.matrixWorld).invert(),Qn.copy(tr).sub(nr.setFromMatrixPosition(or.matrixWorld)),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})):this.state===lr.ROTATE&&(ir.set(0,1,0).applyQuaternion(t.quaternion).normalize(),ar.set(1,0,0).applyQuaternion(t.quaternion).normalize(),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})))),er.copy(Zn))}function pr(){this.enabled!==!1&&(or&&=(this.dispatchEvent({type:`dragend`,object:or}),null),this.domElement.style.cursor=sr?`pointer`:`auto`,this.state=lr.NONE)}function mr(e){this.enabled!==!1&&e.preventDefault()}function hr(e,t=null){return e.isGroup&&(t=e),e.parent===null?t:hr(e.parent,t)}function gr(e,t,n){var r,i=1;e??=0,t??=0,n??=0;function a(){var a,o=r.length,s,c=0,l=0,u=0;for(a=0;a<o;++a)s=r[a],c+=s.x||0,l+=s.y||0,u+=s.z||0;for(c=(c/o-e)*i,l=(l/o-t)*i,u=(u/o-n)*i,a=0;a<o;++a)s=r[a],c&&(s.x-=c),l&&(s.y-=l),u&&(s.z-=u)}return a.initialize=function(e){r=e},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(e){return arguments.length?(t=+e,a):t},a.z=function(e){return arguments.length?(n=+e,a):n},a.strength=function(e){return arguments.length?(i=+e,a):i},a}function _r(e){let t=+this._x.call(null,e);return vr(this.cover(t),t,e)}function vr(e,t,n){if(isNaN(t))return e;var r,i=e._root,a={data:n},o=e._x0,s=e._x1,c,l,u,d,f;if(!i)return e._root=a,e;for(;i.length;)if((u=t>=(c=(o+s)/2))?o=c:s=c,r=i,!(i=i[d=+u]))return r[d]=a,e;if(l=+e._x.call(null,i.data),t===l)return a.next=i,r?r[d]=a:e._root=a,e;do r=r?r[d]=[,,]:e._root=[,,],(u=t>=(c=(o+s)/2))?o=c:s=c;while((d=+u)==(f=+(l>=c)));return r[f]=i,r[d]=a,e}function yr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=1/0,i=-1/0;for(let a=0,o;a<t;++a)isNaN(o=+this._x.call(null,e[a]))||(n[a]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<t;++r)vr(this,n[r],e[r]);return this}function br(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,a,o;t>e||e>=n;)switch(o=+(e<t),a=[,,],a[o]=i,i=a,r*=2,o){case 0:n=t+r;break;case 1:t=n-r}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function xr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Sr(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Cr(e,t,n){this.node=e,this.x0=t,this.x1=n}function wr(e,t){var n,r=this._x0,i,a,o=this._x1,s=[],c=this._root,l,u;for(c&&s.push(new Cr(c,r,o)),t==null?t=1/0:(r=e-t,o=e+t);l=s.pop();)if(!(!(c=l.node)||(i=l.x0)>o||(a=l.x1)<r)){if(c.length){var d=(i+a)/2;s.push(new Cr(c[1],d,a),new Cr(c[0],i,d)),(u=+(e>=d))&&(l=s[s.length-1],s[s.length-1]=s[s.length-1-u],s[s.length-1-u]=l)}else{var f=Math.abs(e-+this._x.call(null,c.data));f<t&&(t=f,r=e-f,o=e+f,n=c.data)}}return n}function Tr(e){if(isNaN(c=+this._x.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._x1,c,l,u,d,f;if(!n)return this;if(n.length)for(;;){if((u=c>=(l=(o+s)/2))?o=l:s=l,t=n,!(n=n[d=+u]))return this;if(!n.length)break;t[d+1&1]&&(r=t,f=d)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[d]=a:delete t[d],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[f]=n:this._root=n),this):(this._root=a,this)}function Er(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Dr(){return this._root}function Or(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function kr(e){var t=[],n,r=this._root,i,a,o;for(r&&t.push(new Cr(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.x1)&&r.length){var s=(a+o)/2;(i=r[1])&&t.push(new Cr(i,s,o)),(i=r[0])&&t.push(new Cr(i,a,s))}return this}function Ar(e){var t=[],n=[],r;for(this._root&&t.push(new Cr(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.x1,c=(o+s)/2;(a=i[0])&&t.push(new Cr(a,o,c)),(a=i[1])&&t.push(new Cr(a,c,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function jr(e){return e[0]}function Mr(e){return arguments.length?(this._x=e,this):this._x}function Nr(e,t){var n=new Pr(t??jr,NaN,NaN);return e==null?n:n.addAll(e)}function Pr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Fr(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ir=Nr.prototype=Pr.prototype;Ir.copy=function(){var e=new Pr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Fr(t),e;for(n=[{source:t,target:e._root=[,,]}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,]}):t.target[i]=Fr(r));return e},Ir.add=_r,Ir.addAll=yr,Ir.cover=br,Ir.data=xr,Ir.extent=Sr,Ir.find=wr,Ir.remove=Tr,Ir.removeAll=Er,Ir.root=Dr,Ir.size=Or,Ir.visit=kr,Ir.visitAfter=Ar,Ir.x=Mr;function Lr(e){let t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Rr(this.cover(t,n,r),t,n,r,e)}function Rr(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var a,o=e._root,s={data:i},c=e._x0,l=e._y0,u=e._z0,d=e._x1,f=e._y1,p=e._z1,m,h,g,_,v,y,b,x,S,C,ee;if(!o)return e._root=s,e;for(;o.length;)if((b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g,a=o,!(o=o[C=S<<2|x<<1|b]))return a[C]=s,e;if(_=+e._x.call(null,o.data),v=+e._y.call(null,o.data),y=+e._z.call(null,o.data),t===_&&n===v&&r===y)return s.next=o,a?a[C]=s:e._root=s,e;do a=a?a[C]=Array(8):e._root=Array(8),(b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g;while((C=S<<2|x<<1|b)==(ee=(y>=g)<<2|(v>=h)<<1|_>=m));return a[ee]=o,a[C]=s,e}function zr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let d=0,f,p,m,h;d<t;++d)isNaN(p=+this._x.call(null,f=e[d]))||isNaN(m=+this._y.call(null,f))||isNaN(h=+this._z.call(null,f))||(n[d]=p,r[d]=m,i[d]=h,p<a&&(a=p),p>c&&(c=p),m<o&&(o=m),m>l&&(l=m),h<s&&(s=h),h>u&&(u=h));if(a>c||o>l||s>u)return this;this.cover(a,o,s).cover(c,l,u);for(let a=0;a<t;++a)Rr(this,n[a],r[a],i[a],e[a]);return this}function Br(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,a=this._z0,o=this._x1,s=this._y1,c=this._z1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,c=(a=Math.floor(n))+1;else{for(var l=o-r||1,u=this._root,d,f;r>e||e>=o||i>t||t>=s||a>n||n>=c;)switch(f=(n<a)<<2|(t<i)<<1|e<r,d=Array(8),d[f]=u,u=d,l*=2,f){case 0:o=r+l,s=i+l,c=a+l;break;case 1:r=o-l,s=i+l,c=a+l;break;case 2:o=r+l,i=s-l,c=a+l;break;case 3:r=o-l,i=s-l,c=a+l;break;case 4:o=r+l,s=i+l,a=c-l;break;case 5:r=o-l,s=i+l,a=c-l;break;case 6:o=r+l,i=s-l,a=c-l;break;case 7:r=o-l,i=s-l,a=c-l}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this}function Vr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Hr(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ur(e,t,n,r,i,a,o){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=a,this.z1=o}function Wr(e,t,n,r){var i,a=this._x0,o=this._y0,s=this._z0,c,l,u,d,f,p,m=this._x1,h=this._y1,g=this._z1,_=[],v=this._root,y,b;for(v&&_.push(new Ur(v,a,o,s,m,h,g)),r==null?r=1/0:(a=e-r,o=t-r,s=n-r,m=e+r,h=t+r,g=n+r,r*=r);y=_.pop();)if(!(!(v=y.node)||(c=y.x0)>m||(l=y.y0)>h||(u=y.z0)>g||(d=y.x1)<a||(f=y.y1)<o||(p=y.z1)<s)){if(v.length){var x=(c+d)/2,S=(l+f)/2,C=(u+p)/2;_.push(new Ur(v[7],x,S,C,d,f,p),new Ur(v[6],c,S,C,x,f,p),new Ur(v[5],x,l,C,d,S,p),new Ur(v[4],c,l,C,x,S,p),new Ur(v[3],x,S,u,d,f,C),new Ur(v[2],c,S,u,x,f,C),new Ur(v[1],x,l,u,d,S,C),new Ur(v[0],c,l,u,x,S,C)),(b=(n>=C)<<2|(t>=S)<<1|e>=x)&&(y=_[_.length-1],_[_.length-1]=_[_.length-1-b],_[_.length-1-b]=y)}else{var ee=e-+this._x.call(null,v.data),te=t-+this._y.call(null,v.data),w=n-+this._z.call(null,v.data),ne=ee*ee+te*te+w*w;if(ne<r){var re=Math.sqrt(r=ne);a=e-re,o=t-re,s=n-re,m=e+re,h=t+re,g=n+re,i=v.data}}}return i}var Gr=(e,t,n,r,i,a)=>Math.sqrt((e-r)**2+(t-i)**2+(n-a)**2);function Kr(e,t,n,r){let i=[],a=e-r,o=t-r,s=n-r,c=e+r,l=t+r,u=n+r;return this.visit((d,f,p,m,h,g,_)=>{if(!d.length)do{let a=d.data;Gr(e,t,n,this._x(a),this._y(a),this._z(a))<=r&&i.push(a)}while(d=d.next);return f>c||p>l||m>u||h<a||g<o||_<s}),i}function qr(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(m=+this._z.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._z0,l=this._x1,u=this._y1,d=this._z1,f,p,m,h,g,_,v,y,b,x,S;if(!n)return this;if(n.length)for(;;){if((v=f>=(h=(o+l)/2))?o=h:l=h,(y=p>=(g=(s+u)/2))?s=g:u=g,(b=m>=(_=(c+d)/2))?c=_:d=_,t=n,!(n=n[x=b<<2|y<<1|v]))return this;if(!n.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(r=t,S=x)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[x]=a:delete t[x],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[S]=n:this._root=n),this):(this._root=a,this)}function Jr(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Yr(){return this._root}function Xr(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zr(e){var t=[],n,r=this._root,i,a,o,s,c,l,u;for(r&&t.push(new Ur(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.z0,c=n.x1,l=n.y1,u=n.z1)&&r.length){var d=(a+c)/2,f=(o+l)/2,p=(s+u)/2;(i=r[7])&&t.push(new Ur(i,d,f,p,c,l,u)),(i=r[6])&&t.push(new Ur(i,a,f,p,d,l,u)),(i=r[5])&&t.push(new Ur(i,d,o,p,c,f,u)),(i=r[4])&&t.push(new Ur(i,a,o,p,d,f,u)),(i=r[3])&&t.push(new Ur(i,d,f,s,c,l,p)),(i=r[2])&&t.push(new Ur(i,a,f,s,d,l,p)),(i=r[1])&&t.push(new Ur(i,d,o,s,c,f,p)),(i=r[0])&&t.push(new Ur(i,a,o,s,d,f,p))}return this}function Qr(e){var t=[],n=[],r;for(this._root&&t.push(new Ur(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.z0,l=r.x1,u=r.y1,d=r.z1,f=(o+l)/2,p=(s+u)/2,m=(c+d)/2;(a=i[0])&&t.push(new Ur(a,o,s,c,f,p,m)),(a=i[1])&&t.push(new Ur(a,f,s,c,l,p,m)),(a=i[2])&&t.push(new Ur(a,o,p,c,f,u,m)),(a=i[3])&&t.push(new Ur(a,f,p,c,l,u,m)),(a=i[4])&&t.push(new Ur(a,o,s,m,f,p,d)),(a=i[5])&&t.push(new Ur(a,f,s,m,l,p,d)),(a=i[6])&&t.push(new Ur(a,o,p,m,f,u,d)),(a=i[7])&&t.push(new Ur(a,f,p,m,l,u,d))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function $r(e){return e[0]}function ei(e){return arguments.length?(this._x=e,this):this._x}function ti(e){return e[1]}function ni(e){return arguments.length?(this._y=e,this):this._y}function ri(e){return e[2]}function ii(e){return arguments.length?(this._z=e,this):this._z}function ai(e,t,n,r){var i=new oi(t??$r,n??ti,r??ri,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function oi(e,t,n,r,i,a,o,s,c){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ci=ai.prototype=oi.prototype;ci.copy=function(){var e=new oi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=Array(8)}):t.target[i]=si(r));return e},ci.add=Lr,ci.addAll=zr,ci.cover=Br,ci.data=Vr,ci.extent=Hr,ci.find=Wr,ci.findAllWithinRadius=Kr,ci.remove=qr,ci.removeAll=Jr,ci.root=Yr,ci.size=Xr,ci.visit=Zr,ci.visitAfter=Qr,ci.x=ei,ci.y=ni,ci.z=ii;function li(e){return function(){return e}}function ui(e){return(e()-.5)*1e-6}function di(e){return e.index}function fi(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function pi(e){var t=di,n=f,r,i=li(30),a,o,s,c,l,u,d=1;e??=[];function f(e){return 1/Math.min(c[e.source.index],c[e.target.index])}function p(t){for(var n=0,i=e.length;n<d;++n)for(var o=0,c,f,p,m=0,h=0,g=0,_,v;o<i;++o)c=e[o],f=c.source,p=c.target,m=p.x+p.vx-f.x-f.vx||ui(u),s>1&&(h=p.y+p.vy-f.y-f.vy||ui(u)),s>2&&(g=p.z+p.vz-f.z-f.vz||ui(u)),_=Math.sqrt(m*m+h*h+g*g),_=(_-a[o])/_*t*r[o],m*=_,h*=_,g*=_,p.vx-=m*(v=l[o]),s>1&&(p.vy-=h*v),s>2&&(p.vz-=g*v),f.vx+=m*(v=1-v),s>1&&(f.vy+=h*v),s>2&&(f.vz+=g*v)}function m(){if(o){var n,i=o.length,s=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,c=Array(i);n<s;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=fi(u,d.source)),typeof d.target!=`object`&&(d.target=fi(u,d.target)),c[d.source.index]=(c[d.source.index]||0)+1,c[d.target.index]=(c[d.target.index]||0)+1;for(n=0,l=Array(s);n<s;++n)d=e[n],l[n]=c[d.source.index]/(c[d.source.index]+c[d.target.index]);r=Array(s),h(),a=Array(s),g()}}function h(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function g(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return p.initialize=function(e,...t){o=e,u=t.find(e=>typeof e==`function`)||Math.random,s=t.find(e=>[1,2,3].includes(e))||2,m()},p.links=function(t){return arguments.length?(e=t,m(),p):e},p.id=function(e){return arguments.length?(t=e,p):t},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.strength=function(e){return arguments.length?(n=typeof e==`function`?e:li(+e),h(),p):n},p.distance=function(e){return arguments.length?(i=typeof e==`function`?e:li(+e),g(),p):i},p}var mi=1664525,hi=1013904223,gi=4294967296;function _i(){let e=1;return()=>(e=(mi*e+hi)%gi)/gi}var vi=3;function yi(e){return e.x}function bi(e){return e.y}function xi(e){return e.z}var Si=10,Ci=Math.PI*(3-Math.sqrt(5)),wi=Math.PI*20/(9+Math.sqrt(221));function Ti(e,t){t||=2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,i=1,a=.001,o=1-a**(1/300),s=0,c=.6,l=new Map,u=Un(p),d=Hn(`tick`,`end`),f=_i();e??=[];function p(){m(),d.call(`tick`,r),i<a&&(u.stop(),d.call(`end`,r))}function m(t){var a,u=e.length,d;t===void 0&&(t=1);for(var f=0;f<t;++f)for(i+=(s-i)*o,l.forEach(function(e){e(i)}),a=0;a<u;++a)d=e[a],d.fx==null?d.x+=d.vx*=c:(d.x=d.fx,d.vx=0),n>1&&(d.fy==null?d.y+=d.vy*=c:(d.y=d.fy,d.vy=0)),n>2&&(d.fz==null?d.z+=d.vz*=c:(d.z=d.fz,d.vz=0));return r}function h(){for(var t=0,r=e.length,i;t<r;++t){if(i=e[t],i.index=t,i.fx!=null&&(i.x=i.fx),i.fy!=null&&(i.y=i.fy),i.fz!=null&&(i.z=i.fz),isNaN(i.x)||n>1&&isNaN(i.y)||n>2&&isNaN(i.z)){var a=Si*(n>2?Math.cbrt(.5+t):n>1?Math.sqrt(.5+t):t),o=t*Ci,s=t*wi;n===1?i.x=a:n===2?(i.x=a*Math.cos(o),i.y=a*Math.sin(o)):(i.x=a*Math.sin(o)*Math.cos(s),i.y=a*Math.cos(o),i.z=a*Math.sin(o)*Math.sin(s))}(isNaN(i.vx)||n>1&&isNaN(i.vy)||n>2&&isNaN(i.vz))&&(i.vx=0,n>1&&(i.vy=0),n>2&&(i.vz=0))}}function g(t){return t.initialize&&t.initialize(e,f,n),t}return h(),r={tick:m,restart:function(){return u.restart(p),r},stop:function(){return u.stop(),r},numDimensions:function(e){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(e))),l.forEach(g),r):n},nodes:function(t){return arguments.length?(e=t,h(),l.forEach(g),r):e},alpha:function(e){return arguments.length?(i=+e,r):i},alphaMin:function(e){return arguments.length?(a=+e,r):a},alphaDecay:function(e){return arguments.length?(o=+e,r):+o},alphaTarget:function(e){return arguments.length?(s=+e,r):s},velocityDecay:function(e){return arguments.length?(c=1-e,r):1-c},randomSource:function(e){return arguments.length?(f=e,l.forEach(g),r):f},force:function(e,t){return arguments.length>1?(t==null?l.delete(e):l.set(e,g(t)),r):l.get(e)},find:function(){var t=Array.prototype.slice.call(arguments),r=t.shift()||0,i=(n>1?t.shift():null)||0,a=(n>2?t.shift():null)||0,o=t.shift()||1/0,s=0,c=e.length,l,u,d,f,p,m;for(o*=o,s=0;s<c;++s)p=e[s],l=r-p.x,u=i-(p.y||0),d=a-(p.z||0),f=l*l+u*u+d*d,f<o&&(m=p,o=f);return m},on:function(e,t){return arguments.length>1?(d.on(e,t),r):d.on(e)}}}function Ei(){var e,t,n,r,i,a=li(-30),o,s=1,c=1/0,l=.81;function u(r){var a,o=e.length,s=(t===1?Nr(e,yi):t===2?Vn(e,yi,bi):t===3?ai(e,yi,bi,xi):null).visitAfter(f);for(i=r,a=0;a<o;++a)n=e[a],s.visit(p)}function d(){if(e){var t,n=e.length,r;for(o=Array(n),t=0;t<n;++t)r=e[t],o[r.index]=+a(r,t,e)}}function f(e){var n=0,r,i,a=0,s,c,l,u,d=e.length;if(d){for(s=c=l=u=0;u<d;++u)(r=e[u])&&(i=Math.abs(r.value))&&(n+=r.value,a+=i,s+=i*(r.x||0),c+=i*(r.y||0),l+=i*(r.z||0));n*=Math.sqrt(4/d),e.x=s/a,t>1&&(e.y=c/a),t>2&&(e.z=l/a)}else{r=e,r.x=r.data.x,t>1&&(r.y=r.data.y),t>2&&(r.z=r.data.z);do n+=o[r.data.index];while(r=r.next)}e.value=n}function p(e,a,u,d,f){if(!e.value)return!0;var p=[u,d,f][t-1],m=e.x-n.x,h=t>1?e.y-n.y:0,g=t>2?e.z-n.z:0,_=p-a,v=m*m+h*h+g*g;if(_*_/l<v)return v<c&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)),n.vx+=m*e.value*i/v,t>1&&(n.vy+=h*e.value*i/v),t>2&&(n.vz+=g*e.value*i/v)),!0;if(!(e.length||v>=c)){(e.data!==n||e.next)&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)));do e.data!==n&&(_=o[e.data.index]*i/v,n.vx+=m*_,t>1&&(n.vy+=h*_),t>2&&(n.vz+=g*_));while(e=e.next)}}return u.initialize=function(n,...i){e=n,r=i.find(e=>typeof e==`function`)||Math.random,t=i.find(e=>[1,2,3].includes(e))||2,d()},u.strength=function(e){return arguments.length?(a=typeof e==`function`?e:li(+e),d(),u):a},u.distanceMin=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.distanceMax=function(e){return arguments.length?(c=e*e,u):Math.sqrt(c)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u}function Di(e,t,n,r){var i,a,o=li(.1),s,c;typeof e!=`function`&&(e=li(+e)),t??=0,n??=0,r??=0;function l(e){for(var o=0,l=i.length;o<l;++o){var u=i[o],d=u.x-t||1e-6,f=(u.y||0)-n||1e-6,p=(u.z||0)-r||1e-6,m=Math.sqrt(d*d+f*f+p*p),h=(c[o]-m)*s[o]*e/m;u.vx+=d*h,a>1&&(u.vy+=f*h),a>2&&(u.vz+=p*h)}}function u(){if(i){var t,n=i.length;for(s=Array(n),c=Array(n),t=0;t<n;++t)c[t]=+e(i[t],t,i),s[t]=isNaN(c[t])?0:+o(i[t],t,i)}}return l.initialize=function(e,...t){i=e,a=t.find(e=>[1,2,3].includes(e))||2,u()},l.strength=function(e){return arguments.length?(o=typeof e==`function`?e:li(+e),u(),l):o},l.radius=function(t){return arguments.length?(e=typeof t==`function`?t:li(+t),u(),l):e},l.x=function(e){return arguments.length?(t=+e,l):t},l.y=function(e){return arguments.length?(n=+e,l):n},l.z=function(e){return arguments.length?(r=+e,l):r},l}function Oi(e){Ai(e);let t=ki(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function ki(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!=`function`)throw Error(`callback is expected to be a function`);let a=t[n];return a||=t[n]=[],a.push({callback:r,ctx:i}),e},off:function(n,r){if(n===void 0)return t=Object.create(null),e;if(t[n]){if(typeof r!=`function`)delete t[n];else{let e=t[n];for(let t=0;t<e.length;++t)e[t].callback===r&&e.splice(t,1)}}return e},fire:function(n){let r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let e=0;e<r.length;++e){let t=r[e];t.callback.apply(t.ctx,i)}return e}}}function Ai(e){if(!e)throw Error(`Eventify cannot use falsy object as events subject`);let t=[`on`,`fire`,`off`];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw Error(`Subject cannot be eventified, since it already has property '`+t[n]+`'`)}var ji=Mi;function Mi(e){if(e||={},`uniqueLinkId`in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{AmbientLight as n,ArrayCamera as r,Box3 as i,BoxGeometry as a,BufferAttribute as o,BufferGeometry as s,ByteType as c,ClampToEdgeWrapping as l,Color as u,ColorManagement as d,Compatibility as f,ConeGeometry as p,Controls as m,CubeCamera as h,CubeDepthTexture as g,CubeTexture as _,CubicBezierCurve3 as v,CylinderGeometry as y,DataArrayTexture as b,DataTexture as x,DecrementStencilOp as S,DecrementWrapStencilOp as C,DepthFormat as ee,DepthStencilFormat as te,DepthTexture as w,DirectionalLight as ne,DynamicDrawUsage as re,EllipseCurve as ie,EventDispatcher as ae,Float16BufferAttribute as oe,Float32BufferAttribute as se,FloatType as ce,FramebufferTexture as le,Frustum as ue,FrustumArray as de,GridHelper as fe,Group as pe,HalfFloatType as me,HemisphereLight as he,IncrementStencilOp as ge,IncrementWrapStencilOp as _e,InstancedBufferAttribute as ve,InstancedInterleavedBuffer as ye,IntType as be,InterleavedBuffer as xe,InterleavedBufferAttribute as Se,InvertStencilOp as Ce,KeepStencilOp as we,LightProbe as Te,Line as Ee,LineBasicMaterial as De,LineDashedMaterial as Oe,LinearFilter as ke,LinearMipmapLinearFilter as Ae,LinearMipmapNearestFilter as je,LinearSRGBColorSpace as Me,LinearTransfer as Ne,MOUSE as Pe,Material as Fe,MathUtils as Ie,Matrix2 as Le,Matrix3 as Re,Matrix4 as ze,Mesh as Be,MeshBasicMaterial as Ve,MeshLambertMaterial as He,MeshMatcapMaterial as Ue,MeshNormalMaterial as We,MeshPhongMaterial as Ge,MeshPhysicalMaterial as Ke,MeshStandardMaterial as qe,MeshToonMaterial as Je,MirroredRepeatWrapping as Ye,NearestFilter as Xe,NearestMipmapLinearFilter as Ze,NearestMipmapNearestFilter as Qe,OrthographicCamera as $e,PerspectiveCamera as et,Plane as tt,PlaneGeometry as nt,PointLight as rt,PointsMaterial as it,QuadraticBezierCurve3 as at,Quaternion as ot,R11_EAC_Format as st,RED_GREEN_RGTC2_Format as ct,RED_RGTC1_Format as lt,RG11_EAC_Format as ut,RGBAFormat as dt,RGBAIntegerFormat as ft,RGBA_ASTC_10x10_Format as pt,RGBA_ASTC_10x5_Format as mt,RGBA_ASTC_10x6_Format as ht,RGBA_ASTC_10x8_Format as gt,RGBA_ASTC_12x10_Format as _t,RGBA_ASTC_12x12_Format as vt,RGBA_ASTC_4x4_Format as yt,RGBA_ASTC_5x4_Format as bt,RGBA_ASTC_5x5_Format as xt,RGBA_ASTC_6x5_Format as St,RGBA_ASTC_6x6_Format as Ct,RGBA_ASTC_8x5_Format as wt,RGBA_ASTC_8x6_Format as Tt,RGBA_ASTC_8x8_Format as Et,RGBA_BPTC_Format as Dt,RGBA_ETC2_EAC_Format as Ot,RGBA_S3TC_DXT1_Format as kt,RGBA_S3TC_DXT3_Format as At,RGBA_S3TC_DXT5_Format as jt,RGBFormat as Mt,RGBIntegerFormat as Nt,RGB_BPTC_SIGNED_Format as Pt,RGB_BPTC_UNSIGNED_Format as Ft,RGB_ETC1_Format as It,RGB_ETC2_Format as Lt,RGB_S3TC_DXT1_Format as Rt,RGFormat as zt,RGIntegerFormat as Bt,Ray as Vt,Raycaster as Ht,RectAreaLight as Ut,RedFormat as Wt,RedIntegerFormat as Gt,RenderObjectRefreshType as Kt,RenderTarget as qt,RepeatWrapping as Jt,ReplaceStencilOp as Yt,SIGNED_R11_EAC_Format as Xt,SIGNED_RED_GREEN_RGTC2_Format as Zt,SIGNED_RED_RGTC1_Format as Qt,SIGNED_RG11_EAC_Format as $t,SRGBColorSpace as en,Scene as tn,ShaderMaterial as nn,ShadowMaterial as rn,ShortType as an,Sphere as on,SphereGeometry as sn,Spherical as cn,SpotLight as ln,SpriteMaterial as un,StaticDrawUsage as dn,TOUCH as fn,Texture as pn,TextureLoader as mn,Timer as hn,TimestampQuery as gn,TubeGeometry as _n,Uint16BufferAttribute as vn,Uint32BufferAttribute as yn,UniformsUtils as bn,UnsignedByteType as xn,UnsignedInt101111Type as Sn,UnsignedInt248Type as Cn,UnsignedInt5999Type as wn,UnsignedIntType as Tn,UnsignedShortType as En,Vector2 as T,Vector3 as E,Vector4 as Dn,WebGLCoordinateSystem as On,WebGLRenderTarget as kn,WebGLRenderer as An,WebGPUCoordinateSystem as jn,WebXRController as Mn,a as Nn,createCanvasElement as Pn,error as D,i as Fn,log as In,n as Ln,r as Rn,t as zn,warn as O,warnOnce as Bn}from"./three.module-D480w7q4.js";import{g as Vn,h as Hn,m as Un}from"./RelationGraph-q5H4bYjq.js";import{a as Wn,i as Gn,n as Kn,o as qn,r as Jn,s as Yn}from"./Product-ByZ8Qr3i.js";var Xn=new tt,Zn=new T,Qn=new E,$n=new T,er=new T,tr=new E,nr=new E,rr=new ze,ir=new E,ar=new E,or=null,sr=null,cr=[],lr={NONE:-1,PAN:0,ROTATE:1},ur=class extends m{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new Ht,this.mouseButtons={LEFT:Pe.PAN,MIDDLE:Pe.PAN,RIGHT:Pe.ROTATE},this.touches={ONE:fn.PAN},this._onPointerMove=dr.bind(this),this._onPointerDown=fr.bind(this),this._onPointerCancel=pr.bind(this),this._onContextMenu=mr.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointerup`,this._onPointerCancel),this.domElement.addEventListener(`pointerleave`,this._onPointerCancel),this.domElement.addEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointerup`,this._onPointerCancel),this.domElement.removeEventListener(`pointerleave`,this._onPointerCancel),this.domElement.removeEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=``,this.domElement.style.cursor=``}dispose(){this.disconnect()}_updatePointer(e){let t=this.domElement.getBoundingClientRect();Zn.x=(e.clientX-t.left)/t.width*2-1,Zn.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType===`touch`)t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Pe.PAN:case fn.PAN:this.state=lr.PAN;break;case Pe.ROTATE:case fn.ROTATE:this.state=lr.ROTATE;break;default:this.state=lr.NONE}}};function dr(e){let t=this.object,n=this.domElement,r=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(e),r.setFromCamera(Zn,t),or)this.state===lr.PAN?r.ray.intersectPlane(Xn,tr)&&(or.position.copy(tr.sub(Qn).applyMatrix4(rr)),this.dispatchEvent({type:`drag`,object:or})):this.state===lr.ROTATE&&($n.subVectors(Zn,er).multiplyScalar(this.rotateSpeed),or.rotateOnWorldAxis(ir,$n.x),or.rotateOnWorldAxis(ar.normalize(),-$n.y),this.dispatchEvent({type:`drag`,object:or})),er.copy(Zn);else if(e.pointerType===`mouse`||e.pointerType===`pen`){if(cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0){let e=cr[0].object;Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(e.matrixWorld)),sr!==e&&sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null),sr!==e&&(this.dispatchEvent({type:`hoveron`,object:e}),n.style.cursor=`pointer`,sr=e)}else sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null)}er.copy(Zn)}}function fr(e){let t=this.object,n=this.domElement,r=this.raycaster;this.enabled!==!1&&(this._updatePointer(e),this._updateState(e),cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0&&(or=this.transformGroup===!0?hr(cr[0].object):cr[0].object,Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(or.matrixWorld)),r.ray.intersectPlane(Xn,tr)&&(this.state===lr.PAN?(rr.copy(or.parent.matrixWorld).invert(),Qn.copy(tr).sub(nr.setFromMatrixPosition(or.matrixWorld)),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})):this.state===lr.ROTATE&&(ir.set(0,1,0).applyQuaternion(t.quaternion).normalize(),ar.set(1,0,0).applyQuaternion(t.quaternion).normalize(),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})))),er.copy(Zn))}function pr(){this.enabled!==!1&&(or&&=(this.dispatchEvent({type:`dragend`,object:or}),null),this.domElement.style.cursor=sr?`pointer`:`auto`,this.state=lr.NONE)}function mr(e){this.enabled!==!1&&e.preventDefault()}function hr(e,t=null){return e.isGroup&&(t=e),e.parent===null?t:hr(e.parent,t)}function gr(e,t,n){var r,i=1;e??=0,t??=0,n??=0;function a(){var a,o=r.length,s,c=0,l=0,u=0;for(a=0;a<o;++a)s=r[a],c+=s.x||0,l+=s.y||0,u+=s.z||0;for(c=(c/o-e)*i,l=(l/o-t)*i,u=(u/o-n)*i,a=0;a<o;++a)s=r[a],c&&(s.x-=c),l&&(s.y-=l),u&&(s.z-=u)}return a.initialize=function(e){r=e},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(e){return arguments.length?(t=+e,a):t},a.z=function(e){return arguments.length?(n=+e,a):n},a.strength=function(e){return arguments.length?(i=+e,a):i},a}function _r(e){let t=+this._x.call(null,e);return vr(this.cover(t),t,e)}function vr(e,t,n){if(isNaN(t))return e;var r,i=e._root,a={data:n},o=e._x0,s=e._x1,c,l,u,d,f;if(!i)return e._root=a,e;for(;i.length;)if((u=t>=(c=(o+s)/2))?o=c:s=c,r=i,!(i=i[d=+u]))return r[d]=a,e;if(l=+e._x.call(null,i.data),t===l)return a.next=i,r?r[d]=a:e._root=a,e;do r=r?r[d]=[,,]:e._root=[,,],(u=t>=(c=(o+s)/2))?o=c:s=c;while((d=+u)==(f=+(l>=c)));return r[f]=i,r[d]=a,e}function yr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=1/0,i=-1/0;for(let a=0,o;a<t;++a)isNaN(o=+this._x.call(null,e[a]))||(n[a]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<t;++r)vr(this,n[r],e[r]);return this}function br(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,a,o;t>e||e>=n;)switch(o=+(e<t),a=[,,],a[o]=i,i=a,r*=2,o){case 0:n=t+r;break;case 1:t=n-r}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function xr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Sr(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Cr(e,t,n){this.node=e,this.x0=t,this.x1=n}function wr(e,t){var n,r=this._x0,i,a,o=this._x1,s=[],c=this._root,l,u;for(c&&s.push(new Cr(c,r,o)),t==null?t=1/0:(r=e-t,o=e+t);l=s.pop();)if(!(!(c=l.node)||(i=l.x0)>o||(a=l.x1)<r)){if(c.length){var d=(i+a)/2;s.push(new Cr(c[1],d,a),new Cr(c[0],i,d)),(u=+(e>=d))&&(l=s[s.length-1],s[s.length-1]=s[s.length-1-u],s[s.length-1-u]=l)}else{var f=Math.abs(e-+this._x.call(null,c.data));f<t&&(t=f,r=e-f,o=e+f,n=c.data)}}return n}function Tr(e){if(isNaN(c=+this._x.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._x1,c,l,u,d,f;if(!n)return this;if(n.length)for(;;){if((u=c>=(l=(o+s)/2))?o=l:s=l,t=n,!(n=n[d=+u]))return this;if(!n.length)break;t[d+1&1]&&(r=t,f=d)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[d]=a:delete t[d],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[f]=n:this._root=n),this):(this._root=a,this)}function Er(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Dr(){return this._root}function Or(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function kr(e){var t=[],n,r=this._root,i,a,o;for(r&&t.push(new Cr(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.x1)&&r.length){var s=(a+o)/2;(i=r[1])&&t.push(new Cr(i,s,o)),(i=r[0])&&t.push(new Cr(i,a,s))}return this}function Ar(e){var t=[],n=[],r;for(this._root&&t.push(new Cr(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.x1,c=(o+s)/2;(a=i[0])&&t.push(new Cr(a,o,c)),(a=i[1])&&t.push(new Cr(a,c,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function jr(e){return e[0]}function Mr(e){return arguments.length?(this._x=e,this):this._x}function Nr(e,t){var n=new Pr(t??jr,NaN,NaN);return e==null?n:n.addAll(e)}function Pr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Fr(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ir=Nr.prototype=Pr.prototype;Ir.copy=function(){var e=new Pr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Fr(t),e;for(n=[{source:t,target:e._root=[,,]}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,]}):t.target[i]=Fr(r));return e},Ir.add=_r,Ir.addAll=yr,Ir.cover=br,Ir.data=xr,Ir.extent=Sr,Ir.find=wr,Ir.remove=Tr,Ir.removeAll=Er,Ir.root=Dr,Ir.size=Or,Ir.visit=kr,Ir.visitAfter=Ar,Ir.x=Mr;function Lr(e){let t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Rr(this.cover(t,n,r),t,n,r,e)}function Rr(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var a,o=e._root,s={data:i},c=e._x0,l=e._y0,u=e._z0,d=e._x1,f=e._y1,p=e._z1,m,h,g,_,v,y,b,x,S,C,ee;if(!o)return e._root=s,e;for(;o.length;)if((b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g,a=o,!(o=o[C=S<<2|x<<1|b]))return a[C]=s,e;if(_=+e._x.call(null,o.data),v=+e._y.call(null,o.data),y=+e._z.call(null,o.data),t===_&&n===v&&r===y)return s.next=o,a?a[C]=s:e._root=s,e;do a=a?a[C]=Array(8):e._root=Array(8),(b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g;while((C=S<<2|x<<1|b)==(ee=(y>=g)<<2|(v>=h)<<1|_>=m));return a[ee]=o,a[C]=s,e}function zr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let d=0,f,p,m,h;d<t;++d)isNaN(p=+this._x.call(null,f=e[d]))||isNaN(m=+this._y.call(null,f))||isNaN(h=+this._z.call(null,f))||(n[d]=p,r[d]=m,i[d]=h,p<a&&(a=p),p>c&&(c=p),m<o&&(o=m),m>l&&(l=m),h<s&&(s=h),h>u&&(u=h));if(a>c||o>l||s>u)return this;this.cover(a,o,s).cover(c,l,u);for(let a=0;a<t;++a)Rr(this,n[a],r[a],i[a],e[a]);return this}function Br(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,a=this._z0,o=this._x1,s=this._y1,c=this._z1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,c=(a=Math.floor(n))+1;else{for(var l=o-r||1,u=this._root,d,f;r>e||e>=o||i>t||t>=s||a>n||n>=c;)switch(f=(n<a)<<2|(t<i)<<1|e<r,d=Array(8),d[f]=u,u=d,l*=2,f){case 0:o=r+l,s=i+l,c=a+l;break;case 1:r=o-l,s=i+l,c=a+l;break;case 2:o=r+l,i=s-l,c=a+l;break;case 3:r=o-l,i=s-l,c=a+l;break;case 4:o=r+l,s=i+l,a=c-l;break;case 5:r=o-l,s=i+l,a=c-l;break;case 6:o=r+l,i=s-l,a=c-l;break;case 7:r=o-l,i=s-l,a=c-l}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this}function Vr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Hr(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ur(e,t,n,r,i,a,o){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=a,this.z1=o}function Wr(e,t,n,r){var i,a=this._x0,o=this._y0,s=this._z0,c,l,u,d,f,p,m=this._x1,h=this._y1,g=this._z1,_=[],v=this._root,y,b;for(v&&_.push(new Ur(v,a,o,s,m,h,g)),r==null?r=1/0:(a=e-r,o=t-r,s=n-r,m=e+r,h=t+r,g=n+r,r*=r);y=_.pop();)if(!(!(v=y.node)||(c=y.x0)>m||(l=y.y0)>h||(u=y.z0)>g||(d=y.x1)<a||(f=y.y1)<o||(p=y.z1)<s)){if(v.length){var x=(c+d)/2,S=(l+f)/2,C=(u+p)/2;_.push(new Ur(v[7],x,S,C,d,f,p),new Ur(v[6],c,S,C,x,f,p),new Ur(v[5],x,l,C,d,S,p),new Ur(v[4],c,l,C,x,S,p),new Ur(v[3],x,S,u,d,f,C),new Ur(v[2],c,S,u,x,f,C),new Ur(v[1],x,l,u,d,S,C),new Ur(v[0],c,l,u,x,S,C)),(b=(n>=C)<<2|(t>=S)<<1|e>=x)&&(y=_[_.length-1],_[_.length-1]=_[_.length-1-b],_[_.length-1-b]=y)}else{var ee=e-+this._x.call(null,v.data),te=t-+this._y.call(null,v.data),w=n-+this._z.call(null,v.data),ne=ee*ee+te*te+w*w;if(ne<r){var re=Math.sqrt(r=ne);a=e-re,o=t-re,s=n-re,m=e+re,h=t+re,g=n+re,i=v.data}}}return i}var Gr=(e,t,n,r,i,a)=>Math.sqrt((e-r)**2+(t-i)**2+(n-a)**2);function Kr(e,t,n,r){let i=[],a=e-r,o=t-r,s=n-r,c=e+r,l=t+r,u=n+r;return this.visit((d,f,p,m,h,g,_)=>{if(!d.length)do{let a=d.data;Gr(e,t,n,this._x(a),this._y(a),this._z(a))<=r&&i.push(a)}while(d=d.next);return f>c||p>l||m>u||h<a||g<o||_<s}),i}function qr(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(m=+this._z.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._z0,l=this._x1,u=this._y1,d=this._z1,f,p,m,h,g,_,v,y,b,x,S;if(!n)return this;if(n.length)for(;;){if((v=f>=(h=(o+l)/2))?o=h:l=h,(y=p>=(g=(s+u)/2))?s=g:u=g,(b=m>=(_=(c+d)/2))?c=_:d=_,t=n,!(n=n[x=b<<2|y<<1|v]))return this;if(!n.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(r=t,S=x)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[x]=a:delete t[x],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[S]=n:this._root=n),this):(this._root=a,this)}function Jr(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Yr(){return this._root}function Xr(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zr(e){var t=[],n,r=this._root,i,a,o,s,c,l,u;for(r&&t.push(new Ur(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.z0,c=n.x1,l=n.y1,u=n.z1)&&r.length){var d=(a+c)/2,f=(o+l)/2,p=(s+u)/2;(i=r[7])&&t.push(new Ur(i,d,f,p,c,l,u)),(i=r[6])&&t.push(new Ur(i,a,f,p,d,l,u)),(i=r[5])&&t.push(new Ur(i,d,o,p,c,f,u)),(i=r[4])&&t.push(new Ur(i,a,o,p,d,f,u)),(i=r[3])&&t.push(new Ur(i,d,f,s,c,l,p)),(i=r[2])&&t.push(new Ur(i,a,f,s,d,l,p)),(i=r[1])&&t.push(new Ur(i,d,o,s,c,f,p)),(i=r[0])&&t.push(new Ur(i,a,o,s,d,f,p))}return this}function Qr(e){var t=[],n=[],r;for(this._root&&t.push(new Ur(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.z0,l=r.x1,u=r.y1,d=r.z1,f=(o+l)/2,p=(s+u)/2,m=(c+d)/2;(a=i[0])&&t.push(new Ur(a,o,s,c,f,p,m)),(a=i[1])&&t.push(new Ur(a,f,s,c,l,p,m)),(a=i[2])&&t.push(new Ur(a,o,p,c,f,u,m)),(a=i[3])&&t.push(new Ur(a,f,p,c,l,u,m)),(a=i[4])&&t.push(new Ur(a,o,s,m,f,p,d)),(a=i[5])&&t.push(new Ur(a,f,s,m,l,p,d)),(a=i[6])&&t.push(new Ur(a,o,p,m,f,u,d)),(a=i[7])&&t.push(new Ur(a,f,p,m,l,u,d))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function $r(e){return e[0]}function ei(e){return arguments.length?(this._x=e,this):this._x}function ti(e){return e[1]}function ni(e){return arguments.length?(this._y=e,this):this._y}function ri(e){return e[2]}function ii(e){return arguments.length?(this._z=e,this):this._z}function ai(e,t,n,r){var i=new oi(t??$r,n??ti,r??ri,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function oi(e,t,n,r,i,a,o,s,c){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ci=ai.prototype=oi.prototype;ci.copy=function(){var e=new oi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=Array(8)}):t.target[i]=si(r));return e},ci.add=Lr,ci.addAll=zr,ci.cover=Br,ci.data=Vr,ci.extent=Hr,ci.find=Wr,ci.findAllWithinRadius=Kr,ci.remove=qr,ci.removeAll=Jr,ci.root=Yr,ci.size=Xr,ci.visit=Zr,ci.visitAfter=Qr,ci.x=ei,ci.y=ni,ci.z=ii;function li(e){return function(){return e}}function ui(e){return(e()-.5)*1e-6}function di(e){return e.index}function fi(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function pi(e){var t=di,n=f,r,i=li(30),a,o,s,c,l,u,d=1;e??=[];function f(e){return 1/Math.min(c[e.source.index],c[e.target.index])}function p(t){for(var n=0,i=e.length;n<d;++n)for(var o=0,c,f,p,m=0,h=0,g=0,_,v;o<i;++o)c=e[o],f=c.source,p=c.target,m=p.x+p.vx-f.x-f.vx||ui(u),s>1&&(h=p.y+p.vy-f.y-f.vy||ui(u)),s>2&&(g=p.z+p.vz-f.z-f.vz||ui(u)),_=Math.sqrt(m*m+h*h+g*g),_=(_-a[o])/_*t*r[o],m*=_,h*=_,g*=_,p.vx-=m*(v=l[o]),s>1&&(p.vy-=h*v),s>2&&(p.vz-=g*v),f.vx+=m*(v=1-v),s>1&&(f.vy+=h*v),s>2&&(f.vz+=g*v)}function m(){if(o){var n,i=o.length,s=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,c=Array(i);n<s;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=fi(u,d.source)),typeof d.target!=`object`&&(d.target=fi(u,d.target)),c[d.source.index]=(c[d.source.index]||0)+1,c[d.target.index]=(c[d.target.index]||0)+1;for(n=0,l=Array(s);n<s;++n)d=e[n],l[n]=c[d.source.index]/(c[d.source.index]+c[d.target.index]);r=Array(s),h(),a=Array(s),g()}}function h(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function g(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return p.initialize=function(e,...t){o=e,u=t.find(e=>typeof e==`function`)||Math.random,s=t.find(e=>[1,2,3].includes(e))||2,m()},p.links=function(t){return arguments.length?(e=t,m(),p):e},p.id=function(e){return arguments.length?(t=e,p):t},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.strength=function(e){return arguments.length?(n=typeof e==`function`?e:li(+e),h(),p):n},p.distance=function(e){return arguments.length?(i=typeof e==`function`?e:li(+e),g(),p):i},p}var mi=1664525,hi=1013904223,gi=4294967296;function _i(){let e=1;return()=>(e=(mi*e+hi)%gi)/gi}var vi=3;function yi(e){return e.x}function bi(e){return e.y}function xi(e){return e.z}var Si=10,Ci=Math.PI*(3-Math.sqrt(5)),wi=Math.PI*20/(9+Math.sqrt(221));function Ti(e,t){t||=2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,i=1,a=.001,o=1-a**(1/300),s=0,c=.6,l=new Map,u=Un(p),d=Hn(`tick`,`end`),f=_i();e??=[];function p(){m(),d.call(`tick`,r),i<a&&(u.stop(),d.call(`end`,r))}function m(t){var a,u=e.length,d;t===void 0&&(t=1);for(var f=0;f<t;++f)for(i+=(s-i)*o,l.forEach(function(e){e(i)}),a=0;a<u;++a)d=e[a],d.fx==null?d.x+=d.vx*=c:(d.x=d.fx,d.vx=0),n>1&&(d.fy==null?d.y+=d.vy*=c:(d.y=d.fy,d.vy=0)),n>2&&(d.fz==null?d.z+=d.vz*=c:(d.z=d.fz,d.vz=0));return r}function h(){for(var t=0,r=e.length,i;t<r;++t){if(i=e[t],i.index=t,i.fx!=null&&(i.x=i.fx),i.fy!=null&&(i.y=i.fy),i.fz!=null&&(i.z=i.fz),isNaN(i.x)||n>1&&isNaN(i.y)||n>2&&isNaN(i.z)){var a=Si*(n>2?Math.cbrt(.5+t):n>1?Math.sqrt(.5+t):t),o=t*Ci,s=t*wi;n===1?i.x=a:n===2?(i.x=a*Math.cos(o),i.y=a*Math.sin(o)):(i.x=a*Math.sin(o)*Math.cos(s),i.y=a*Math.cos(o),i.z=a*Math.sin(o)*Math.sin(s))}(isNaN(i.vx)||n>1&&isNaN(i.vy)||n>2&&isNaN(i.vz))&&(i.vx=0,n>1&&(i.vy=0),n>2&&(i.vz=0))}}function g(t){return t.initialize&&t.initialize(e,f,n),t}return h(),r={tick:m,restart:function(){return u.restart(p),r},stop:function(){return u.stop(),r},numDimensions:function(e){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(e))),l.forEach(g),r):n},nodes:function(t){return arguments.length?(e=t,h(),l.forEach(g),r):e},alpha:function(e){return arguments.length?(i=+e,r):i},alphaMin:function(e){return arguments.length?(a=+e,r):a},alphaDecay:function(e){return arguments.length?(o=+e,r):+o},alphaTarget:function(e){return arguments.length?(s=+e,r):s},velocityDecay:function(e){return arguments.length?(c=1-e,r):1-c},randomSource:function(e){return arguments.length?(f=e,l.forEach(g),r):f},force:function(e,t){return arguments.length>1?(t==null?l.delete(e):l.set(e,g(t)),r):l.get(e)},find:function(){var t=Array.prototype.slice.call(arguments),r=t.shift()||0,i=(n>1?t.shift():null)||0,a=(n>2?t.shift():null)||0,o=t.shift()||1/0,s=0,c=e.length,l,u,d,f,p,m;for(o*=o,s=0;s<c;++s)p=e[s],l=r-p.x,u=i-(p.y||0),d=a-(p.z||0),f=l*l+u*u+d*d,f<o&&(m=p,o=f);return m},on:function(e,t){return arguments.length>1?(d.on(e,t),r):d.on(e)}}}function Ei(){var e,t,n,r,i,a=li(-30),o,s=1,c=1/0,l=.81;function u(r){var a,o=e.length,s=(t===1?Nr(e,yi):t===2?Vn(e,yi,bi):t===3?ai(e,yi,bi,xi):null).visitAfter(f);for(i=r,a=0;a<o;++a)n=e[a],s.visit(p)}function d(){if(e){var t,n=e.length,r;for(o=Array(n),t=0;t<n;++t)r=e[t],o[r.index]=+a(r,t,e)}}function f(e){var n=0,r,i,a=0,s,c,l,u,d=e.length;if(d){for(s=c=l=u=0;u<d;++u)(r=e[u])&&(i=Math.abs(r.value))&&(n+=r.value,a+=i,s+=i*(r.x||0),c+=i*(r.y||0),l+=i*(r.z||0));n*=Math.sqrt(4/d),e.x=s/a,t>1&&(e.y=c/a),t>2&&(e.z=l/a)}else{r=e,r.x=r.data.x,t>1&&(r.y=r.data.y),t>2&&(r.z=r.data.z);do n+=o[r.data.index];while(r=r.next)}e.value=n}function p(e,a,u,d,f){if(!e.value)return!0;var p=[u,d,f][t-1],m=e.x-n.x,h=t>1?e.y-n.y:0,g=t>2?e.z-n.z:0,_=p-a,v=m*m+h*h+g*g;if(_*_/l<v)return v<c&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)),n.vx+=m*e.value*i/v,t>1&&(n.vy+=h*e.value*i/v),t>2&&(n.vz+=g*e.value*i/v)),!0;if(!(e.length||v>=c)){(e.data!==n||e.next)&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)));do e.data!==n&&(_=o[e.data.index]*i/v,n.vx+=m*_,t>1&&(n.vy+=h*_),t>2&&(n.vz+=g*_));while(e=e.next)}}return u.initialize=function(n,...i){e=n,r=i.find(e=>typeof e==`function`)||Math.random,t=i.find(e=>[1,2,3].includes(e))||2,d()},u.strength=function(e){return arguments.length?(a=typeof e==`function`?e:li(+e),d(),u):a},u.distanceMin=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.distanceMax=function(e){return arguments.length?(c=e*e,u):Math.sqrt(c)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u}function Di(e,t,n,r){var i,a,o=li(.1),s,c;typeof e!=`function`&&(e=li(+e)),t??=0,n??=0,r??=0;function l(e){for(var o=0,l=i.length;o<l;++o){var u=i[o],d=u.x-t||1e-6,f=(u.y||0)-n||1e-6,p=(u.z||0)-r||1e-6,m=Math.sqrt(d*d+f*f+p*p),h=(c[o]-m)*s[o]*e/m;u.vx+=d*h,a>1&&(u.vy+=f*h),a>2&&(u.vz+=p*h)}}function u(){if(i){var t,n=i.length;for(s=Array(n),c=Array(n),t=0;t<n;++t)c[t]=+e(i[t],t,i),s[t]=isNaN(c[t])?0:+o(i[t],t,i)}}return l.initialize=function(e,...t){i=e,a=t.find(e=>[1,2,3].includes(e))||2,u()},l.strength=function(e){return arguments.length?(o=typeof e==`function`?e:li(+e),u(),l):o},l.radius=function(t){return arguments.length?(e=typeof t==`function`?t:li(+t),u(),l):e},l.x=function(e){return arguments.length?(t=+e,l):t},l.y=function(e){return arguments.length?(n=+e,l):n},l.z=function(e){return arguments.length?(r=+e,l):r},l}function Oi(e){Ai(e);let t=ki(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function ki(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!=`function`)throw Error(`callback is expected to be a function`);let a=t[n];return a||=t[n]=[],a.push({callback:r,ctx:i}),e},off:function(n,r){if(n===void 0)return t=Object.create(null),e;if(t[n]){if(typeof r!=`function`)delete t[n];else{let e=t[n];for(let t=0;t<e.length;++t)e[t].callback===r&&e.splice(t,1)}}return e},fire:function(n){let r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let e=0;e<r.length;++e){let t=r[e];t.callback.apply(t.ctx,i)}return e}}}function Ai(e){if(!e)throw Error(`Eventify cannot use falsy object as events subject`);let t=[`on`,`fire`,`off`];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw Error(`Subject cannot be eventified, since it already has property '`+t[n]+`'`)}var ji=Mi;function Mi(e){if(e||={},`uniqueLinkId`in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
2
2
|
`,`Note: there is also change in default behavior: From now on each graph
|
|
3
3
|
is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!=`function`)throw Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},i=0,a=e.multigraph?b:y,o=[],s=ce,c=ce,l=ce,u=ce,d={version:20,addNode:h,addLink:v,removeLink:ee,removeNode:_,getNode:g,getNodeCount:x,getLinkCount:S,getEdgeCount:S,getLinksCount:S,getNodesCount:x,getLinks:C,forEachNode:de,forEachLinkedNode:ae,forEachLink:ie,beginUpdate:l,endUpdate:u,clear:re,hasLink:w,hasNode:g,getLink:w,getLinkById:ne};return Oi(d),f(),d;function f(){var e=d.on;d.on=t;function t(){return d.beginUpdate=l=le,d.endUpdate=u=ue,s=p,c=m,d.on=e,e.apply(d,arguments)}}function p(e,t){o.push({link:e,changeType:t})}function m(e,t){o.push({node:e,changeType:t})}function h(e,n){if(e===void 0)throw Error(`Invalid node identifier`);l();var r=g(e);return r?(r.data=n,c(r,`update`)):(r=new Ni(e,n),c(r,`add`)),t.set(e,r),u(),r}function g(e){return t.get(e)}function _(e){var n=g(e);if(!n)return!1;l();var r=n.links;return r&&(r.forEach(te),n.links=null),t.delete(e),c(n,`remove`),u(),!0}function v(e,t,r){l();var i=g(e)||h(e),o=g(t)||h(t),c=a(e,t,r),d=n.has(c.id);return n.set(c.id,c),Pi(i,c),e!==t&&Pi(o,c),s(c,d?`update`:`add`),u(),c}function y(e,t,r){var i=Ii(e,t),a=n.get(i);return a?(a.data=r,a):new Fi(e,t,r,i)}function b(e,t,n){var i=Ii(e,t),a=r.hasOwnProperty(i);if(a||w(e,t)){a||(r[i]=0);var o=`@`+ ++r[i];i=Ii(e+o,t+o)}return new Fi(e,t,n,i)}function x(){return t.size}function S(){return n.size}function C(e){var t=g(e);return t?t.links:null}function ee(e,t){return t!==void 0&&(e=w(e,t)),te(e)}function te(e){if(!e||!n.get(e.id))return!1;l(),n.delete(e.id);var t=g(e.fromId),r=g(e.toId);return t&&t.links.delete(e),r&&r.links.delete(e),s(e,`remove`),u(),!0}function w(e,t){if(e!==void 0&&t!==void 0)return n.get(Ii(e,t))}function ne(e){if(e!==void 0)return n.get(e)}function re(){l(),de(function(e){_(e.id)}),u()}function ie(e){if(typeof e==`function`)for(var t=n.values(),r=t.next();!r.done;){if(e(r.value))return!0;r=t.next()}}function ae(e,t,n){var r=g(e);if(r&&r.links&&typeof t==`function`)return n?se(r.links,e,t):oe(r.links,e,t)}function oe(e,n,r){for(var i,a=e.values(),o=a.next();!o.done;){var s=o.value,c=s.fromId===n?s.toId:s.fromId;if(i=r(t.get(c),s),i)return!0;o=a.next()}}function se(e,n,r){for(var i,a=e.values(),o=a.next();!o.done;){var s=o.value;if(s.fromId===n&&(i=r(t.get(s.toId),s),i))return!0;o=a.next()}}function ce(){}function le(){i+=1}function ue(){--i,i===0&&o.length>0&&(d.fire(`changed`,o),o.length=0)}function de(e){if(typeof e!=`function`)throw Error(`Function is expected to iterate over graph nodes. You passed `+e);for(var n=t.values(),r=n.next();!r.done;){if(e(r.value))return!0;r=n.next()}}}function Ni(e,t){this.id=e,this.links=null,this.data=t}function Pi(e,t){e.links?e.links.add(t):e.links=new Set([t])}function Fi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Ii(e,t){return e.toString()+`👉 `+t.toString()}var Li=t(((e,t)=>{t.exports=function(e){return e===0?`x`:e===1?`y`:e===2?`z`:`c`+(e+1)}})),Ri=t(((e,t)=>{var n=Li();t.exports=function(e){return t;function t(t,r){let i=r&&r.indent||0,a=r&&r.join!==void 0?r.join:`
|
|
4
4
|
`,o=Array(i+1).join(` `),s=[];for(let r=0;r<e;++r){let e=n(r),i=r===0?``:o;s.push(i+t.replace(/{var}/g,e))}return s.join(a)}}})),zi=t(((e,t)=>{var n=Ri();t.exports=r,t.exports.generateCreateBodyFunctionBody=i,t.exports.getVectorCode=o,t.exports.getBodyCode=a;function r(e,t){let n=i(e,t),{Body:r}=Function(n)();return r}function i(e,t){return`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$n as n,A as r,Bn as i,Er as a,Fn as o,Hr as s,I as c,L as l,M as u,Mr as d,Nn as f,O as p,Rn as m,Rr as h,Tr as g,Un as _,V as v,W as y,Yn as b,ar as x,ir as S,jn as C,kr as ee,l as w,n as T,ot as E,r as D,sr as te,tr as ne,u as O,ur as re,ut as k,v as A,wr as j,xr as M}from"./route-Dg53WdFu.js";import{C as N,S as ie,T as ae,b as oe,c as se,l as ce,o as le,s as ue,v as de,w as fe,y as P}from"./agents-C0Jg2pN8.js";import{t as pe}from"./jsx-runtime-LKYXHABd.js";import{A as F,F as me,I as he,J as I,K as ge,L as _e,R as ve,St as L,Y as ye,Z as be,et as R,j as z,l as xe,n as B,r as Se,t as V}from"./input-D7iHeNXz.js";import{a as H,c as Ce,d as U,f as we,i as Te,l as W,o as G,r as Ee,t as De}from"./filters-Culzq1j1.js";import{B as Oe,H as ke,N as Ae,V as je,a as Me,u as Ne,z as Pe}from"./palette-lUno7fso.js";import{Bn as Fe,Bt as Ie,Et as K,F as Le,Fn as Re,Ft as ze,G as Be,Gt as Ve,Hn as He,In as Ue,It as We,K as Ge,Kn as Ke,Ln as qe,Lt as Je,P as Ye,Pt as Xe,Rn as Ze,Rt as Qe,Tt as q,U as $e,Ut as et,Vn as tt,Wn as nt,Xn as rt,_t as it,a as at,an as ot,c as st,cn as ct,d as lt,g as ut,i as dt,in as ft,l as pt,ln as mt,m as ht,nn as gt,o as _t,qt as vt,r as yt,s as bt,sn as xt,u as St,un as Ct,vt as wt,y as Tt}from"./index-Cq2sihjc.js";import{i as Et,r as Dt,t as Ot}from"./RelationGraph-q5H4bYjq.js";import{t as kt}from"./diff-cbn6NGtL.js";import{c as At}from"./dataParts-DV44YXP9.js";var J=e(s(),1),Y=pe();function jt({value:e,onChange:t,id:n}){let i=fe(e),a=typeof e==`string`?e.trim().replace(/\s+/g,` `):``,o=!i&&a?a.slice(0,60):``,s=fe(e)?e:o?null:``,{theme:c}=Ne(),l=Ae(c)===`icons`?`No icon: the Helper's face`:`No icon: its mascot`,[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(10),[m,h]=(0,J.useState)(()=>!!(Pe(`ph:robot`)||Pe(`lucide:bot`)));(0,J.useEffect)(()=>{Oe().then(()=>h(!0))},[]),(0,J.useEffect)(()=>{p(10)},[u]);let g=!!u.trim(),{hits:_,total:v}=(0,J.useMemo)(()=>g?je(u,f,0):je(``,f,oe.length),[u,f,g]),y=ke.length,x=g?v>f:f<y,S=g?Math.max(0,v-f):Math.max(0,y-f);return(0,Y.jsxs)(`div`,{id:n,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(b,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted`}),(0,Y.jsx)(V,{value:u,onChange:e=>d(e.target.value),placeholder:`Search Phosphor and Lucide icons…`,"aria-label":`Search icons`,className:`pl-10`,spellCheck:!1})]}),o&&(0,Y.jsxs)(`p`,{className:`text-[13px] text-warn`,children:[`This agent names an icon ForgeQE does not have: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:o}),`. Pick one below, or No icon.`]}),!g&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:`No icon`}),(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`No icon`,className:`flex flex-wrap gap-2`,children:(0,Y.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":s===``,"aria-label":`No icon`,"data-tip":l,className:Mt(s===``),onClick:()=>t(``),children:(0,Y.jsx)(Me,{agent:`custom`,px:28,decorative:!0})})})]}),!g&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:`ForgeQE faces`}),(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`ForgeQE faces`,className:`flex flex-wrap gap-2`,children:oe.map(e=>(0,Y.jsx)(Nt,{icon:e,label:ie(e),selected:e===s,ready:!0,onPick:t},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:g?`Top matches (${v})`:`Library icons (Phosphor and Lucide)`}),(0,Y.jsxs)(`div`,{role:`listbox`,"aria-label":g?`Icon search results`:`Library icons`,className:`flex flex-wrap gap-2`,children:[_.map(e=>(0,Y.jsx)(Nt,{icon:e.id,label:e.label,selected:e.id===s,ready:m||e.kind===`face`,onPick:t},e.id)),_.length===0&&(0,Y.jsx)(`p`,{className:`text-[13px] text-muted`,children:`No icons match that search.`})]}),x&&(0,Y.jsxs)(`button`,{type:`button`,className:`mt-4 inline-flex items-center gap-1 text-[13px] font-medium text-accent underline-offset-4 hover:underline`,"data-tip":`Show ${Math.min(10,S)} of ${S} more`,onClick:()=>p(e=>e+10),children:[(0,Y.jsx)(r,{size:14,"aria-hidden":`true`}),`More (`,S,`)`]})]}),s&&ae(s)&&(0,Y.jsxs)(`p`,{className:`text-[13px] text-muted`,children:[`Selected `,(0,Y.jsx)(`span`,{className:`font-mono text-fg`,children:s})]})]})}var Mt=e=>F(`inline-flex size-11 cursor-pointer items-center justify-center rounded-[10px] border bg-bg text-fg transition-colors disabled:cursor-wait disabled:opacity-50`,e?`border-accent ring-2 ring-accent/30`:`border-line-soft hover:border-line`);function Nt({icon:e,label:t,selected:n,ready:r,onPick:i}){return(0,Y.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":n,"aria-label":t,"data-tip":t,disabled:!r&&!!ae(e),className:Mt(n),onClick:()=>i(e),children:N(e)?(0,Y.jsx)(xe,{name:e,px:28}):(0,Y.jsx)(Me,{agent:`custom`,icon:e,px:28,decorative:!0})})}var Pt=[{label:`Defect retest`,about:`Each morning, retests the defects resolved since yesterday and says which are really fixed.`,text:`Every morning, find the defects resolved in our tracker since yesterday, retest each one on QA by rerunning its test or following its steps in a real browser, and tell me which are really fixed and which still fail, with screenshots. Add the result as a comment on each defect.`},{label:`Nightly smoke`,about:`Each night, runs the critical flows on QA and tells the team what broke and why.`,text:`Every night, run our critical flows (sign-in, search, checkout) on QA in a real browser, and tell the team in our channel what broke, with screenshots and the likely cause.`},{label:`Pull request test check`,about:`Reviews a pull request's tests, runs the ones it touches, and says what is missing or risky.`,text:`When I give it a pull request, review its tests and changes, run the automated tests it touches, and tell me what is missing or risky before I merge.`},{label:`Release readiness`,about:`Runs a release's regression pack and says whether it is ready to ship and what blocks it.`,text:`For a release I name, run its regression pack on QA, look at its test cases' results and its open defects, and tell me if it is ready to ship and what blocks it.`},{label:`API contracts`,about:`Checks an API against its contracts after each deploy and explains any break.`,text:`Check our order API against its contracts after each deploy and explain any break`},{label:`Test case quality`,about:`Reviews a story's test cases and says what is missing or vague.`,text:`Review a story's test cases and tell me what is missing or vague`}];function Ft(){let[e,t]=(0,J.useState)(``),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),d=vt(r);(0,J.useEffect)(()=>{ye.list().then(e=>c(e.sessions.filter(e=>!e.saved)),()=>{}),R.templates().then(e=>u(e.templates),()=>{})},[]);let f=async()=>{if(e.trim()){i(!0),o(``);try{let t=await ye.start(e.trim());location.hash=D(`agents`,`custom`,`build`,t.sid)}catch(e){o(e.message),i(!1)}}};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsxs)(`header`,{className:`flex items-center gap-1 px-6 py-4`,children:[(0,Y.jsx)(Be,{}),(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex min-h-9 items-center gap-2 text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]})]}),(0,Y.jsx)(`main`,{className:`flex flex-auto flex-col items-center justify-center px-6 pt-6 pb-30`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-[780px] flex-col items-center gap-10`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Y.jsx)(Ce,{state:r?`waiting`:d,px:112,label:r?`Starting the builder`:`ForgeQE is ready to build an agent`,className:`mb-1`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[31px] leading-tight font-semibold tracking-[-0.015em] text-ink`,children:`What should your agent do?`}),(0,Y.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:`Say it in your own words. ForgeQE works out what it needs from what your project has, asks only what it cannot decide, and builds it with you step by step.`})]}),(0,Y.jsx)(He,{id:`build-goal`,label:`What your agent should do`,value:e,onChange:e=>{t(e),o(``)},onSend:()=>void f(),busy:r,disabled:r,placeholder:`An agent that checks the checkout on QA and tells me what broke…`}),a&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 -mt-6 text-sm text-fail`,children:a}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-starters`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-starters`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Or start from one of these, and change it to fit`}),(0,Y.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2`,children:Pt.map(n=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":e===n.text,onClick:()=>{t(n.text),o(``),document.getElementById(`build-goal`)?.focus()},className:F(`flex h-full w-full cursor-pointer flex-col items-start gap-1 rounded-[12px] border px-4 py-2 text-left hover:bg-surface-muted`,e===n.text?`border-accent bg-accent-soft`:`border-line-soft bg-transparent`),children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium text-ink`,children:n.label}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:n.about})]})},n.label))})]}),s.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`build-resume`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-resume`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Pick up where you left off`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-2`,children:s.slice(0,5).map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`build`,e.sid),className:`flex min-h-11 items-center gap-4 rounded-[8px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.goal}),(0,Y.jsxs)(`span`,{className:`flex-none text-[13px] text-muted`,children:[It[e.step].label,` · `,ut(e.updatedAt)]})]})},e.sid))})]}),l.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`build-templates`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-templates`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Or start from a template, and review it before you save`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-2`,children:l.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`new`,`template`,e.id),className:`flex min-h-11 items-center gap-4 rounded-[8px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`flex-none text-[13px]`,children:e.title}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] text-muted`,children:e.why||e.about})]})},e.id))})]}),(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`new`,`form`),className:`inline-flex items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(n,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]})})]})}var It={understand:{label:`Understand`,title:`Let's understand your requirements`,next:`Make the plan`,working:`Working out the plan…`,thinking:`Reading what you want, and what your project has…`},plan:{label:`Plan`,title:`Here's how your agent will work`,next:`Set its boundaries`,working:`Working out what it may do…`,thinking:`Planning how your agent will do it, step by step…`},boundaries:{label:`Boundaries`,title:`Where it works and what it may do`,next:`Choose what it knows`,working:`Looking for what it should know…`,thinking:``},knowledge:{label:`Knowledge`,title:`What it should know`,next:`Review it`,working:`Putting it together…`,thinking:``},review:{label:`Review`,title:`Your agent`,next:`Save it as a draft`,working:`Saving it…`,thinking:`Naming it, and writing its instructions…`},try:{label:`Try`,title:`Try it, then approve it`,next:``,working:``,thinking:``}};function Lt({sid:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);if((0,J.useEffect)(()=>{ye.view(e).then(e=>{n(e),o(Math.min(e.reached,e.steps.length-1))},e=>i(e.message))},[e]),(0,J.useEffect)(()=>{if(!t?.working)return;let r=setTimeout(()=>{ye.view(e).then(n,()=>{})},1500);return()=>clearTimeout(r)},[t,e]),r&&!t)return(0,Y.jsx)(Rt,{children:(0,Y.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:[r,` `,(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,`new`),children:`Start again`})]})});if(!t||a===null)return(0,Y.jsx)(Rt,{children:(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})});let l=t.steps[a].id,u=It[l],d=s||t.working===l,f=async(t,r=!1)=>{if(l!==`try`){c(!0),i(``);try{let i=await ye.answer(e,l,t);if(r&&i.saved){location.hash=D(`agents`,`custom`,i.saved,`edit`);return}n(i),o(Math.min(a+1,i.steps.length-1)),window.scrollTo({top:0})}catch(e){i(e.message),window.scrollTo({top:0})}finally{c(!1)}}};return(0,Y.jsxs)(Rt,{children:[(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex items-center gap-2 self-start text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`New agent`}),(0,Y.jsxs)(`p`,{className:`m-0 text-[16px] text-ink-2 [overflow-wrap:anywhere]`,children:[`“`,t.goal,`”`]})]}),(0,Y.jsx)(zt,{v:t,at:a,onGo:e=>!s&&o(e)}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-step`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Y.jsx)(Ce,{state:d?`working`:`idle`,px:36,label:d?u.working:`ForgeQE`,className:`flex-none`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsx)(`h1`,{id:`build-step`,className:`m-0 text-[20px] font-semibold tracking-[-0.01em]`,children:u.title}),(0,Y.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:d?t.working===l?It[l].thinking:u.working:t.says[l]}),!d&&t.source?.[l]&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:t.source[l]===`model`?`Worked out by ForgeQE's model from what you said and what your project has.`:t.note||`Worked out by ForgeQE's rules: no model is set up.`})]})]}),r&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),t.working===l?null:l===`understand`&&(0,Y.jsx)(Ht,{v:t,busy:s,onNext:f,next:u.next},`u-${t.updatedAt}`),t.working!==l&&l===`plan`&&(0,Y.jsx)(Wt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`p-${t.updatedAt}`),l===`boundaries`&&(0,Y.jsx)(Gt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`b-${t.updatedAt}`),l===`knowledge`&&(0,Y.jsx)(Kt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`k-${t.updatedAt}`),t.working!==l&&l===`review`&&(0,Y.jsx)(qt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`r-${t.updatedAt}`),l===`try`&&(0,Y.jsx)(Jt,{v:t})]})]})}function Rt({children:e}){return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(Ge,{}),(0,Y.jsx)(`main`,{className:F($e,`max-w-[920px] flex-auto gap-6`),children:e})]})}function zt({v:e,at:t,onGo:n}){return(0,Y.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-x-1 gap-y-2 p-0`,children:e.steps.map((r,i)=>{let a=i<=e.reached,o=i===t;return(0,Y.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:!a,"aria-current":o?`step`:void 0,onClick:()=>n(i),className:F(`inline-flex min-h-9 items-center gap-2 rounded-[8px] border-0 px-2 text-[13px] font-medium`,o?`bg-accent-soft text-ink`:a?`cursor-pointer bg-transparent text-ink-2 hover:bg-surface-strong`:`bg-transparent text-muted`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:F(`inline-flex size-5 items-center justify-center rounded-full text-[13px] tabular-nums`,r.done&&!o?`bg-pass-soft text-pass`:o?`bg-accent text-accent-ink`:`bg-surface-strong text-muted`),children:r.done&&!o?(0,Y.jsx)(p,{size:12,strokeWidth:3}):i+1}),It[r.id].label]}),i<e.steps.length-1&&(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-px w-4 bg-line`})]},r.id)})})})}function Bt({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){let o=n.startsWith(`Save`);return(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Y.jsxs)(U,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),`Back`]}),(0,Y.jsxs)(U,{variant:`primary`,disabled:e||i,onClick:r,"data-tip":n,children:[o?(0,Y.jsx)(p,{"aria-hidden":`true`}):(0,Y.jsx)(O,{"aria-hidden":`true`}),o?`Save`:`Next`]})]})}function Vt({on:e,label:t,why:n,recommended:r,onToggle:i}){return(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:i,className:F(`flex min-h-11 w-full cursor-pointer items-start gap-4 rounded-[12px] border px-4 py-2 text-left`,e?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:F(`mt-1 inline-flex size-4 flex-none items-center justify-center rounded-[4px] border`,e?`border-accent bg-accent text-accent-ink`:`border-muted`),children:e&&(0,Y.jsx)(p,{size:12,strokeWidth:3})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] font-medium text-ink`,children:[t,r&&(0,Y.jsx)(H,{tone:`running`,icon:!1,children:`Recommended`})]}),n&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})]})}function Ht({v:e,busy:t,onNext:n,next:r}){let[i,a]=(0,J.useState)(()=>Object.fromEntries(e.questions.map(e=>[e.id,e.answer]))),[o,s]=(0,J.useState)([]),l=(e,t,n)=>a(r=>{let i=r[e]||[];return{...r,[e]:t===`one`?[n]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}});return(0,Y.jsxs)(Y.Fragment,{children:[e.questions.map(e=>{let t=e.assumed&&!o.includes(e.id);return(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.text}),t?(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm text-ink-2`,children:[(0,Y.jsx)(W,{icon:c,size:16,className:`text-pass`}),e.assumed,!(i[e.id]||[]).every(t=>e.assumed?.includes(t))&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`(`,i[e.id]?.join(`, `),`)`]}),(0,Y.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>s([...o,e.id]),"aria-label":`Change the answer`,"data-tip":`Change the answer`,children:(0,Y.jsx)(f,{"aria-hidden":`true`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.why}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:e.options.map(t=>(0,Y.jsx)(Vt,{on:(i[e.id]||[]).includes(t.id),label:t.label,why:t.why,recommended:t.recommended,onToggle:()=>l(e.id,e.kind,t.id)},t.id))})]})]},e.id)}),(0,Y.jsx)(Bt,{busy:t,next:r,onNext:()=>n({answers:i}),disabled:e.questions.some(e=>e.id===`environment`&&!(i[e.id]||[]).length),aside:e.environments.length===0?(0,Y.jsx)(`span`,{className:`text-fail`,children:`Add a test environment in Settings first: an agent needs one to work in.`}):void 0})]})}var Ut={ready:{icon:c,label:`Ready`,tone:`text-pass`},partial:{icon:l,label:`Partly set up`,tone:`text-warn`},needs_setup:{icon:v,label:`Not set up here yet`,tone:`text-muted`}};function Wt({v:e,busy:t,onNext:n,onBack:r,next:i}){let[a,o]=(0,J.useState)(()=>e.plan.filter(e=>e.on).map(e=>e.capability)),[s,c]=(0,J.useState)(!1),l=a.map(t=>e.plan.find(e=>e.capability===t)).filter(Boolean),u=e.plan.filter(e=>!a.includes(e.capability));return(0,Y.jsxs)(Y.Fragment,{children:[e.planSteps&&e.planSteps.length>0&&(0,Y.jsx)(`ol`,{"aria-label":`How it will work`,className:`m-0 flex list-none flex-col gap-0 rounded-[14px] card border p-0`,children:e.planSteps.map((t,n)=>(0,Y.jsxs)(`li`,{className:F(`flex items-start gap-4 px-4 py-4`,n>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex size-7 flex-none items-center justify-center rounded-full bg-accent-soft text-[13px] font-semibold text-accent-fg tabular-nums`,children:n+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:t.title}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:t.why}),t.without&&(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Without it: `,t.without]}),(0,Y.jsx)(`span`,{className:`flex flex-wrap gap-2 pt-1`,children:t.uses.map(t=>{let n=e.plan.find(e=>e.capability===t);return(0,Y.jsx)(`span`,{className:`rounded-[6px] bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,children:n?.title||t},t)})})]})]},n))}),e.planSteps&&e.planSteps.length>0&&(0,Y.jsx)(`h2`,{className:`m-0 mt-2 text-[13px] font-semibold text-muted`,children:`What it uses`}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:l.map((e,t)=>{let n=Ut[e.state];return(0,Y.jsxs)(`li`,{className:`flex items-start gap-4 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex size-7 flex-none items-center justify-center rounded-full bg-accent-soft text-[13px] font-semibold text-accent-fg tabular-nums`,children:t+1}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.title}),e.why&&(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.why}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary}),(0,Y.jsxs)(`span`,{className:F(`flex items-center gap-2 text-[13px]`,n.tone),children:[(0,Y.jsx)(W,{icon:n.icon,size:14}),n.label,e.state!==`ready`&&e.gaps.length?`: ${e.gaps.join(`; `)}`:``]})]}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Leave out ${e.title}`,"data-tip":`Leave out ${e.title}`,onClick:()=>o(a.filter(t=>t!==e.capability)),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},e.capability)})}),s?(0,Y.jsxs)(`section`,{"aria-labelledby":`build-add`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-add`,className:`m-0 text-[13px] font-semibold`,children:`What else should it do?`}),(0,Y.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2`,children:u.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o([...a,e.capability]),className:`flex h-full w-full cursor-pointer items-start gap-2 rounded-[10px] border border-line-soft bg-bg px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,Y.jsx)(m,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.title}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]})]})},e.capability))})]}):(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>c(!0),"data-tip":`Add something it should also do`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({capabilities:a}),disabled:!a.length})]})}function X({text:e,help:t,on:n,onChange:r,locked:i}){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 border-t border-line-soft py-4 first:border-t-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-ink`,children:e}),(t||i)&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:i||t})]}),i?(0,Y.jsx)(ne,{size:18,"aria-label":`Always`,className:`mt-1 flex-none text-muted`}):(0,Y.jsx)(Ct,{checked:n,onChange:e=>r?.(e),label:e})]})}function Gt({v:e,busy:t,onNext:n,onBack:r,next:i}){let a=e.boundaries,[o,s]=(0,J.useState)(a.environments),[c,l]=(0,J.useState)(a.actions),[u,d]=(0,J.useState)(a.approve),[f,p]=(0,J.useState)(a.shell),[m,h]=(0,J.useState)(a.repository),[g,_]=(0,J.useState)(a.unattended),[v,y]=(0,J.useState)(a.trust||[]),[b,x]=(0,J.useState)((a.production||[]).includes(`run`)),S=o.some(t=>e.production.includes(t)),C=(e,t)=>y(t?[...new Set([...v,e])]:v.filter(t=>t!==e)),ee=e.plan.filter(e=>e.on&&e.capability.startsWith(`system:`)),w=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],T=e=>c.includes(e),E=(e,t)=>l(t?[...new Set([...c,e])]:c.filter(t=>t!==e)),D=(e,t)=>d(t?[...new Set([...u,e])]:u.filter(t=>t!==e)),te=o.join(` and `)||`its environments`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`Where it works`}),(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:`Where it works`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Every run, test and call goes only here. In production it reads without asking, and a person approves every change.`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Y.jsx)(Ee,{items:e.environments.map(t=>({id:t,label:t,...e.production.includes(t)&&!/prod/i.test(t)?{note:`production`,noteClass:`text-warn`}:{}})),value:o,onChange:s})}),S&&(0,Y.jsx)(`span`,{className:`text-[13px] text-warn`,children:`In production, it reads without asking; a person approves every change there, on a schedule too (it waits, and the team is told). Before a step that could reach real customers, it asks you itself.`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-may`,className:`flex flex-col rounded-[14px] card border px-4 py-1`,children:[(0,Y.jsx)(`h2`,{id:`build-may`,className:`sr-only`,children:`What it may do`}),(0,Y.jsx)(X,{text:`Read test cases, runs, reports and your systems' data`,on:!0,locked:`Always: it cannot work without it, and it changes nothing.`}),e.needs?.run&&(0,Y.jsx)(X,{text:`Run tests and apps in ${te}`,help:`Browser runs, tests, API calls and database queries.`,on:T(`run`),onChange:e=>E(`run`,e)}),e.needs?.run&&T(`run`)&&(0,Y.jsx)(X,{text:`Ask me before each run`,help:`Recommended while it is new; turn it off once you trust it.`,on:u.includes(`run`),onChange:e=>D(`run`,e)}),e.needs?.run&&T(`run`)&&S&&(0,Y.jsx)(X,{text:`Ask me before each run in production`,help:`Off: browser runs, tests and API calls there go ahead without asking. Each question also offers to allow the rest of the run.`,on:!b,onChange:e=>x(!e)}),(0,Y.jsx)(X,{text:`Change test assets on this computer`,help:`Regression packs, API contracts, page memory, recordings. Off unless its job is to make them.`,on:T(`change`),onChange:e=>E(`change`,e)}),T(`change`)&&(0,Y.jsx)(X,{text:`Ask me before each change`,on:u.includes(`change`),onChange:e=>D(`change`,e)}),e.needs?.external&&(0,Y.jsx)(X,{text:`Change other systems as you asked`,help:`Work items or the team's channel, as you chose.`,on:T(`external`),onChange:e=>E(`external`,e)}),T(`external`)&&(0,Y.jsx)(X,{text:`Ask me before each change to another system`,help:`Recommended. Off: it comments, updates and attaches as its job says, without asking.`,on:!v.includes(`external`),onChange:e=>C(`external`,!e)}),e.needs?.repository&&(0,Y.jsx)(X,{text:`Change your repository to write or heal tests`,help:`A coding agent does it on this computer.`,on:m===`write`,onChange:e=>(h(e?`write`:`read`),e&&E(`change`,!0))}),e.needs?.repository&&m===`write`&&(0,Y.jsx)(X,{text:`Ask me before the coding agent works`,help:`Off: it writes and heals tests without asking. The tests it runs can reach any address, so ForgeQE first looks in your test project's config and env files, and asks you when they name an address outside its environments.`,on:!v.includes(`coding`),onChange:e=>C(`coding`,!e)}),(0,Y.jsx)(X,{text:`Use the shell`,help:`Commands on this computer, and fetching web pages. A person approves each one; ForgeQE's secrets stay out of reach.`,on:f,onChange:p})]}),e.schedule&&(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`What it may do alone`}),(0,Y.jsxs)(`span`,{className:`text-[16px] font-semibold`,children:[`When it runs `,e.schedule.toLowerCase(),`, with nobody watching`]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`What it may do without asking. Anything else waits for a person: the team is told, and no answer in four hours is a no. It may always ask a person itself.`}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:[T(`run`)&&(0,Y.jsx)(Vt,{on:g.includes(`run`),label:`Run tests and apps`,why:`Recommended: what it is there to do.`,recommended:!0,onToggle:()=>_(w(g,`run`))}),T(`change`)&&(0,Y.jsx)(Vt,{on:g.includes(`change`),label:`Change test assets`,onToggle:()=>_(w(g,`change`))}),m===`write`&&v.includes(`coding`)&&(0,Y.jsx)(Vt,{on:g.includes(`coding`),label:`Write or heal tests`,why:`The coding agent, when its test project names no address outside its environments.`,onToggle:()=>_(w(g,`coding`))}),ee.map(e=>(0,Y.jsx)(Vt,{on:g.includes(`${e.capability.slice(7)}_*`),label:`Change ${e.title.replace(/^Work with /,``)}`,why:`Comment, update states, attach evidence, without a person approving each.`,onToggle:()=>_(w(g,`${e.capability.slice(7)}_*`))},e.capability))]})]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({environments:o,actions:c,approve:u,repository:m,shell:f,unattended:g,trust:v,production:b?[`run`]:[]}),disabled:!o.length})]})}function Kt({v:e,busy:t,onNext:n,onBack:r,next:i}){let a=e.knowledge,[o,s]=(0,J.useState)(a.files.filter(e=>e.on).map(e=>e.file)),[c,l]=(0,J.useState)(a.skills.filter(e=>e.on).map(e=>e.name)),[u,d]=(0,J.useState)(a.notes),f=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],p=e=>e.toSorted((e,t)=>Number(!!t.why)-Number(!!e.why));return(0,Y.jsxs)(Y.Fragment,{children:[(a.files.length>0||a.skills.length>0)&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:[p(a.files).map(e=>(0,Y.jsx)(Vt,{on:o.includes(e.file),label:e.title,why:e.why||e.file,recommended:e.on,onToggle:()=>s(f(o,e.file))},e.file)),p(a.skills).map(e=>(0,Y.jsx)(Vt,{on:c.includes(e.name),label:`Skill: ${e.name}`,why:e.why||e.about,recommended:e.on,onToggle:()=>l(f(c,e.name))},e.name))]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:`Anything else it should know?`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Business rules, what “done” looks like, which test accounts to use (never passwords). It is kept as this agent's own knowledge.`}),(0,Y.jsx)(Se,{rows:5,value:u,maxLength:2e4,onChange:e=>d(e.target.value),placeholder:`A declined card shows “Payment failed” and keeps the basket.`})]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({files:o,skills:c,notes:u})})]})}function qt({v:e,busy:t,onNext:r,onBack:i,next:a}){let o=e.review,[s,c]=(0,J.useState)(o.name),[l,u]=(0,J.useState)(o.id),[d,f]=(0,J.useState)(o.description),[p,m]=(0,J.useState)(o.icon||``),[h,g]=(0,J.useState)(o.starters[0]?.text||e.goal),[_,v]=(0,J.useState)(o.model||``),[y,b]=(0,J.useState)(o.maxTokens?String(o.maxTokens):``),[x,S]=(0,J.useState)(o.maxMinutes?String(o.maxMinutes):``),C=[y&&!(Number.isInteger(Number(y))&&Number(y)>=1e3&&Number(y)<=1e8)?`The budget per run is a whole number of tokens, from 1,000 to 100,000,000.`:``,x&&!(Number.isInteger(Number(x))&&Number(x)>=1&&Number(x)<=1440)?`The time limit per run is a whole number of minutes, from 1 to 1440.`:``,_&&!(e.models||[]).some(e=>e.name===_)?`${_} is no longer in llms.json: pick another model, or ForgeQE's choice.`:``].filter(Boolean).join(` `),ee={..._?{model:_}:{},...y?{maxTokens:Math.round(Number(y))}:{},...x?{maxMinutes:Math.round(Number(x))}:{}},w=e.plan.filter(e=>e.on),T=e.boundaries,E=e.knowledge,te=[[`It works in`,T.environments.join(`, `)],[`It does`,w.map(e=>e.title).join(`; `)],[`It may`,[T.actions.includes(`run`)?`run tests and apps${T.approve.includes(`run`)?` (asking you first)`:``}`:``,T.actions.includes(`change`)?`change test assets`:``,T.actions.includes(`external`)?`change other systems${(T.trust||[]).includes(`external`)?` (without asking)`:` (asking you first)`}`:``,T.repository===`write`?`write or heal tests${(T.trust||[]).includes(`coding`)?` (without asking, unless its test project names an address outside its environments)`:` (asking you first)`}`:``].filter(Boolean).join(`; `)||`only read`],[`Runs by itself`,e.schedule?`${e.schedule.toLowerCase()}, with nobody watching${T.unattended.length?`; alone it may ${T.unattended.map(e=>e===`run`?`run tests and apps`:e===`change`?`change test assets`:e===`coding`?`write or heal tests`:`change ${e.replace(/_\*$/,``).replace(/_/g,` `)}`).join(`, `)}`:``}`:`no: you, your team or Atlas start it`],...T.shell?[[`Shell`,`yes, a person approves each command`]]:[],[`It knows`,[...E.files.filter(e=>e.on).map(e=>e.title),...E.skills.filter(e=>e.on).map(e=>e.name),...E.notes.trim()?[`your notes`]:[]].join(`, `)||`nothing extra`]];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,Y.jsx)(V,{value:s,maxLength:60,onChange:e=>c(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Id`}),(0,Y.jsx)(V,{value:l,maxLength:40,spellCheck:!1,disabled:!!e.saved,onChange:e=>u(e.target.value.toLowerCase())})]})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`What it is for`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`One line. Atlas reads it to know when to hand it work.`}),(0,Y.jsx)(V,{value:d,maxLength:300,onChange:e=>f(e.target.value)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Icon`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`What it wears on the Agents page: its mascot, or one of ForgeQE's agent icons.`}),(0,Y.jsx)(jt,{value:p,onChange:m})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Budget per run`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The most model tokens one run may use, 1,000 or more; it stops there. Empty: no limit.`}),(0,Y.jsx)(V,{type:`number`,min:1e3,step:1e3,value:y,placeholder:`No limit`,onChange:e=>b(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Time limit per run`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`In minutes, 1 to 1440. Empty: no limit when someone is watching, 120 when nobody is (a schedule, a trigger, another agent).`}),(0,Y.jsx)(V,{type:`number`,min:1,max:1440,value:x,placeholder:`Minutes`,onChange:e=>S(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Model`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The model profile of llms.json its runs use.`}),(0,Y.jsxs)(B,{value:_,onChange:e=>v(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`ForgeQE's choice`}),(e.models||[]).map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.model,`)`]},e.name)),_&&!(e.models||[]).some(e=>e.name===_)&&(0,Y.jsxs)(`option`,{value:_,children:[_,` (not in llms.json)`]})]})]})]}),C&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail`,children:C}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Its first request`}),(0,Y.jsx)(V,{value:h,maxLength:500,onChange:e=>g(e.target.value)})]}),(0,Y.jsx)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-2 rounded-[14px] bg-surface-muted px-4 py-4 text-sm sm:grid-cols-[140px_1fr]`,children:te.map(([e,t])=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Y.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:t})]},e))}),e.advice.filter(e=>e.blocking).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.advice.filter(e=>e.blocking).map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-[12px] bg-warn-soft px-4 py-4 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-warn`,children:e.about}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.fix})]},t))}),(0,Y.jsx)(Bt,{busy:t,onBack:i,next:e.saved?`Save the changes`:a,onNext:()=>r({name:s,id:l,description:d,icon:p,starters:[{label:`Run it now`,text:h}],...ee}),disabled:!s.trim()||!l.trim()||!!C,aside:e.saved?(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,e.saved,`edit`),className:`inline-flex items-center gap-2`,children:[(0,Y.jsx)(n,{size:14,"aria-hidden":`true`}),`Open every setting`]}):(0,Y.jsxs)(U,{size:`sm`,variant:`ghost`,disabled:t||!s.trim()||!l.trim()||!!C,onClick:()=>r({name:s,id:l,description:d,icon:p,starters:[{label:`Run it now`,text:h}],...ee},!0),"data-tip":`Save it as a draft, then open every setting`,children:[(0,Y.jsx)(n,{"aria-hidden":`true`}),`Save and open every setting`]})})]})}function Jt({v:e}){let t=e.saved,[n,r]=(0,J.useState)(e.review?.starters[0]?.text||e.goal),[i,a]=(0,J.useState)(``),[s,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1),m=async()=>{l(!0);try{let{id:e}=await be.start(n.trim(),{agent:t,try:!0});location.hash=D(`chats`,e)}catch(e){d(e.message),l(!1)}},h=async()=>{l(!0),d(``);try{await R.act(t,`approve`,{confirm:i,note:`Made with the agent builder`}),p(!0)}catch(e){d(e.message)}finally{l(!1)}};return f?(0,Y.jsxs)(`div`,{className:`flex flex-col items-start gap-4 rounded-[14px] bg-pass-soft px-4 py-4`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-[16px] font-semibold text-pass`,children:[(0,Y.jsx)(c,{size:18,"aria-hidden":`true`}),P(e.review?.name||`agent`,!0),` is ready.`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`You, your team and Atlas can hand it work now.`}),(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,t),className:F(we({variant:`primary`,size:`sm`}),`no-underline`),"data-tip":`Open the agent`,children:[(0,Y.jsx)(O,{"aria-hidden":`true`}),`Open`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`build-try`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-try`,className:`m-0 text-[16px] font-semibold`,children:`1. Try it on a real request`}),(0,Y.jsx)(Se,{rows:2,"aria-label":`What to try`,value:n,onChange:e=>r(e.target.value)}),(0,Y.jsxs)(U,{variant:`primary`,size:`sm`,className:`self-start`,disabled:s||!n.trim(),onClick:()=>void m(),"data-tip":`Try it in a chat`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Try`]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`It opens as a chat. Come back here to approve it: Agents, Custom agents, then this agent.`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-approve`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-approve`,className:`m-0 text-[16px] font-semibold`,children:`2. Approve it`}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Only an approved version runs. Type its id to confirm: `,t]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Type ${t} to confirm`,className:`w-[260px]`,value:i,spellCheck:!1,autoComplete:`off`,onChange:e=>a(e.target.value),placeholder:t}),(0,Y.jsxs)(U,{size:`sm`,disabled:s||i!==t,onClick:()=>void h(),children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Approve`]})]})]}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:u}),(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,t),className:`self-start text-[13px]`,children:`Open its page`})]})}function Yt({text:e,file:t}){let n=e.replace(/\n$/,``).split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$n as n,A as r,Bn as i,Er as a,Fn as o,Hr as s,I as c,L as l,M as u,Mr as d,Nn as f,O as p,Rn as m,Rr as h,Tr as g,Un as _,V as v,W as y,Yn as b,ar as x,ir as S,jn as C,kr as ee,l as w,n as T,ot as E,r as D,sr as te,tr as ne,u as O,ur as re,ut as k,v as A,wr as j,xr as M}from"./route-Dg53WdFu.js";import{C as N,S as ie,T as ae,b as oe,c as se,l as ce,o as le,s as ue,v as de,w as fe,y as P}from"./agents-C0Jg2pN8.js";import{t as pe}from"./jsx-runtime-LKYXHABd.js";import{A as F,F as me,I as he,J as I,K as ge,L as _e,R as ve,St as L,Y as ye,Z as be,et as R,j as z,l as xe,n as B,r as Se,t as V}from"./input-D7iHeNXz.js";import{a as H,c as Ce,d as U,f as we,i as Te,l as W,o as G,r as Ee,t as De}from"./filters-Culzq1j1.js";import{B as Oe,H as ke,N as Ae,V as je,a as Me,u as Ne,z as Pe}from"./palette-lUno7fso.js";import{Bn as Fe,Bt as Ie,Et as K,F as Le,Fn as Re,Ft as ze,G as Be,Gt as Ve,Hn as He,In as Ue,It as We,K as Ge,Kn as Ke,Ln as qe,Lt as Je,P as Ye,Pt as Xe,Rn as Ze,Rt as Qe,Tt as q,U as $e,Ut as et,Vn as tt,Wn as nt,Xn as rt,_t as it,a as at,an as ot,c as st,cn as ct,d as lt,g as ut,i as dt,in as ft,l as pt,ln as mt,m as ht,nn as gt,o as _t,qt as vt,r as yt,s as bt,sn as xt,u as St,un as Ct,vt as wt,y as Tt}from"./index-CljX5dI4.js";import{i as Et,r as Dt,t as Ot}from"./RelationGraph-q5H4bYjq.js";import{t as kt}from"./diff-cbn6NGtL.js";import{c as At}from"./dataParts-D56_9p6T.js";var J=e(s(),1),Y=pe();function jt({value:e,onChange:t,id:n}){let i=fe(e),a=typeof e==`string`?e.trim().replace(/\s+/g,` `):``,o=!i&&a?a.slice(0,60):``,s=fe(e)?e:o?null:``,{theme:c}=Ne(),l=Ae(c)===`icons`?`No icon: the Helper's face`:`No icon: its mascot`,[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(10),[m,h]=(0,J.useState)(()=>!!(Pe(`ph:robot`)||Pe(`lucide:bot`)));(0,J.useEffect)(()=>{Oe().then(()=>h(!0))},[]),(0,J.useEffect)(()=>{p(10)},[u]);let g=!!u.trim(),{hits:_,total:v}=(0,J.useMemo)(()=>g?je(u,f,0):je(``,f,oe.length),[u,f,g]),y=ke.length,x=g?v>f:f<y,S=g?Math.max(0,v-f):Math.max(0,y-f);return(0,Y.jsxs)(`div`,{id:n,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(b,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted`}),(0,Y.jsx)(V,{value:u,onChange:e=>d(e.target.value),placeholder:`Search Phosphor and Lucide icons…`,"aria-label":`Search icons`,className:`pl-10`,spellCheck:!1})]}),o&&(0,Y.jsxs)(`p`,{className:`text-[13px] text-warn`,children:[`This agent names an icon ForgeQE does not have: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:o}),`. Pick one below, or No icon.`]}),!g&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:`No icon`}),(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`No icon`,className:`flex flex-wrap gap-2`,children:(0,Y.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":s===``,"aria-label":`No icon`,"data-tip":l,className:Mt(s===``),onClick:()=>t(``),children:(0,Y.jsx)(Me,{agent:`custom`,px:28,decorative:!0})})})]}),!g&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:`ForgeQE faces`}),(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`ForgeQE faces`,className:`flex flex-wrap gap-2`,children:oe.map(e=>(0,Y.jsx)(Nt,{icon:e,label:ie(e),selected:e===s,ready:!0,onPick:t},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-[13px] text-muted`,children:g?`Top matches (${v})`:`Library icons (Phosphor and Lucide)`}),(0,Y.jsxs)(`div`,{role:`listbox`,"aria-label":g?`Icon search results`:`Library icons`,className:`flex flex-wrap gap-2`,children:[_.map(e=>(0,Y.jsx)(Nt,{icon:e.id,label:e.label,selected:e.id===s,ready:m||e.kind===`face`,onPick:t},e.id)),_.length===0&&(0,Y.jsx)(`p`,{className:`text-[13px] text-muted`,children:`No icons match that search.`})]}),x&&(0,Y.jsxs)(`button`,{type:`button`,className:`mt-4 inline-flex items-center gap-1 text-[13px] font-medium text-accent underline-offset-4 hover:underline`,"data-tip":`Show ${Math.min(10,S)} of ${S} more`,onClick:()=>p(e=>e+10),children:[(0,Y.jsx)(r,{size:14,"aria-hidden":`true`}),`More (`,S,`)`]})]}),s&&ae(s)&&(0,Y.jsxs)(`p`,{className:`text-[13px] text-muted`,children:[`Selected `,(0,Y.jsx)(`span`,{className:`font-mono text-fg`,children:s})]})]})}var Mt=e=>F(`inline-flex size-11 cursor-pointer items-center justify-center rounded-[10px] border bg-bg text-fg transition-colors disabled:cursor-wait disabled:opacity-50`,e?`border-accent ring-2 ring-accent/30`:`border-line-soft hover:border-line`);function Nt({icon:e,label:t,selected:n,ready:r,onPick:i}){return(0,Y.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":n,"aria-label":t,"data-tip":t,disabled:!r&&!!ae(e),className:Mt(n),onClick:()=>i(e),children:N(e)?(0,Y.jsx)(xe,{name:e,px:28}):(0,Y.jsx)(Me,{agent:`custom`,icon:e,px:28,decorative:!0})})}var Pt=[{label:`Defect retest`,about:`Each morning, retests the defects resolved since yesterday and says which are really fixed.`,text:`Every morning, find the defects resolved in our tracker since yesterday, retest each one on QA by rerunning its test or following its steps in a real browser, and tell me which are really fixed and which still fail, with screenshots. Add the result as a comment on each defect.`},{label:`Nightly smoke`,about:`Each night, runs the critical flows on QA and tells the team what broke and why.`,text:`Every night, run our critical flows (sign-in, search, checkout) on QA in a real browser, and tell the team in our channel what broke, with screenshots and the likely cause.`},{label:`Pull request test check`,about:`Reviews a pull request's tests, runs the ones it touches, and says what is missing or risky.`,text:`When I give it a pull request, review its tests and changes, run the automated tests it touches, and tell me what is missing or risky before I merge.`},{label:`Release readiness`,about:`Runs a release's regression pack and says whether it is ready to ship and what blocks it.`,text:`For a release I name, run its regression pack on QA, look at its test cases' results and its open defects, and tell me if it is ready to ship and what blocks it.`},{label:`API contracts`,about:`Checks an API against its contracts after each deploy and explains any break.`,text:`Check our order API against its contracts after each deploy and explain any break`},{label:`Test case quality`,about:`Reviews a story's test cases and says what is missing or vague.`,text:`Review a story's test cases and tell me what is missing or vague`}];function Ft(){let[e,t]=(0,J.useState)(``),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),d=vt(r);(0,J.useEffect)(()=>{ye.list().then(e=>c(e.sessions.filter(e=>!e.saved)),()=>{}),R.templates().then(e=>u(e.templates),()=>{})},[]);let f=async()=>{if(e.trim()){i(!0),o(``);try{let t=await ye.start(e.trim());location.hash=D(`agents`,`custom`,`build`,t.sid)}catch(e){o(e.message),i(!1)}}};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsxs)(`header`,{className:`flex items-center gap-1 px-6 py-4`,children:[(0,Y.jsx)(Be,{}),(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex min-h-9 items-center gap-2 text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]})]}),(0,Y.jsx)(`main`,{className:`flex flex-auto flex-col items-center justify-center px-6 pt-6 pb-30`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-[780px] flex-col items-center gap-10`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Y.jsx)(Ce,{state:r?`waiting`:d,px:112,label:r?`Starting the builder`:`ForgeQE is ready to build an agent`,className:`mb-1`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[31px] leading-tight font-semibold tracking-[-0.015em] text-ink`,children:`What should your agent do?`}),(0,Y.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:`Say it in your own words. ForgeQE works out what it needs from what your project has, asks only what it cannot decide, and builds it with you step by step.`})]}),(0,Y.jsx)(He,{id:`build-goal`,label:`What your agent should do`,value:e,onChange:e=>{t(e),o(``)},onSend:()=>void f(),busy:r,disabled:r,placeholder:`An agent that checks the checkout on QA and tells me what broke…`}),a&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 -mt-6 text-sm text-fail`,children:a}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-starters`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-starters`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Or start from one of these, and change it to fit`}),(0,Y.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2`,children:Pt.map(n=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":e===n.text,onClick:()=>{t(n.text),o(``),document.getElementById(`build-goal`)?.focus()},className:F(`flex h-full w-full cursor-pointer flex-col items-start gap-1 rounded-[12px] border px-4 py-2 text-left hover:bg-surface-muted`,e===n.text?`border-accent bg-accent-soft`:`border-line-soft bg-transparent`),children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium text-ink`,children:n.label}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:n.about})]})},n.label))})]}),s.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`build-resume`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-resume`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Pick up where you left off`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-2`,children:s.slice(0,5).map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`build`,e.sid),className:`flex min-h-11 items-center gap-4 rounded-[8px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.goal}),(0,Y.jsxs)(`span`,{className:`flex-none text-[13px] text-muted`,children:[It[e.step].label,` · `,ut(e.updatedAt)]})]})},e.sid))})]}),l.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`build-templates`,className:`flex w-full flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`build-templates`,className:`m-0 text-[13px] font-semibold text-muted`,children:`Or start from a template, and review it before you save`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-2`,children:l.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`new`,`template`,e.id),className:`flex min-h-11 items-center gap-4 rounded-[8px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`flex-none text-[13px]`,children:e.title}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] text-muted`,children:e.why||e.about})]})},e.id))})]}),(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,`new`,`form`),className:`inline-flex items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(n,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]})})]})}var It={understand:{label:`Understand`,title:`Let's understand your requirements`,next:`Make the plan`,working:`Working out the plan…`,thinking:`Reading what you want, and what your project has…`},plan:{label:`Plan`,title:`Here's how your agent will work`,next:`Set its boundaries`,working:`Working out what it may do…`,thinking:`Planning how your agent will do it, step by step…`},boundaries:{label:`Boundaries`,title:`Where it works and what it may do`,next:`Choose what it knows`,working:`Looking for what it should know…`,thinking:``},knowledge:{label:`Knowledge`,title:`What it should know`,next:`Review it`,working:`Putting it together…`,thinking:``},review:{label:`Review`,title:`Your agent`,next:`Save it as a draft`,working:`Saving it…`,thinking:`Naming it, and writing its instructions…`},try:{label:`Try`,title:`Try it, then approve it`,next:``,working:``,thinking:``}};function Lt({sid:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1);if((0,J.useEffect)(()=>{ye.view(e).then(e=>{n(e),o(Math.min(e.reached,e.steps.length-1))},e=>i(e.message))},[e]),(0,J.useEffect)(()=>{if(!t?.working)return;let r=setTimeout(()=>{ye.view(e).then(n,()=>{})},1500);return()=>clearTimeout(r)},[t,e]),r&&!t)return(0,Y.jsx)(Rt,{children:(0,Y.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:[r,` `,(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,`new`),children:`Start again`})]})});if(!t||a===null)return(0,Y.jsx)(Rt,{children:(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})});let l=t.steps[a].id,u=It[l],d=s||t.working===l,f=async(t,r=!1)=>{if(l!==`try`){c(!0),i(``);try{let i=await ye.answer(e,l,t);if(r&&i.saved){location.hash=D(`agents`,`custom`,i.saved,`edit`);return}n(i),o(Math.min(a+1,i.steps.length-1)),window.scrollTo({top:0})}catch(e){i(e.message),window.scrollTo({top:0})}finally{c(!1)}}};return(0,Y.jsxs)(Rt,{children:[(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex items-center gap-2 self-start text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`New agent`}),(0,Y.jsxs)(`p`,{className:`m-0 text-[16px] text-ink-2 [overflow-wrap:anywhere]`,children:[`“`,t.goal,`”`]})]}),(0,Y.jsx)(zt,{v:t,at:a,onGo:e=>!s&&o(e)}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-step`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Y.jsx)(Ce,{state:d?`working`:`idle`,px:36,label:d?u.working:`ForgeQE`,className:`flex-none`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsx)(`h1`,{id:`build-step`,className:`m-0 text-[20px] font-semibold tracking-[-0.01em]`,children:u.title}),(0,Y.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:d?t.working===l?It[l].thinking:u.working:t.says[l]}),!d&&t.source?.[l]&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:t.source[l]===`model`?`Worked out by ForgeQE's model from what you said and what your project has.`:t.note||`Worked out by ForgeQE's rules: no model is set up.`})]})]}),r&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),t.working===l?null:l===`understand`&&(0,Y.jsx)(Ht,{v:t,busy:s,onNext:f,next:u.next},`u-${t.updatedAt}`),t.working!==l&&l===`plan`&&(0,Y.jsx)(Wt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`p-${t.updatedAt}`),l===`boundaries`&&(0,Y.jsx)(Gt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`b-${t.updatedAt}`),l===`knowledge`&&(0,Y.jsx)(Kt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`k-${t.updatedAt}`),t.working!==l&&l===`review`&&(0,Y.jsx)(qt,{v:t,busy:s,onNext:f,onBack:()=>o(a-1),next:u.next},`r-${t.updatedAt}`),l===`try`&&(0,Y.jsx)(Jt,{v:t})]})]})}function Rt({children:e}){return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(Ge,{}),(0,Y.jsx)(`main`,{className:F($e,`max-w-[920px] flex-auto gap-6`),children:e})]})}function zt({v:e,at:t,onGo:n}){return(0,Y.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-x-1 gap-y-2 p-0`,children:e.steps.map((r,i)=>{let a=i<=e.reached,o=i===t;return(0,Y.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:!a,"aria-current":o?`step`:void 0,onClick:()=>n(i),className:F(`inline-flex min-h-9 items-center gap-2 rounded-[8px] border-0 px-2 text-[13px] font-medium`,o?`bg-accent-soft text-ink`:a?`cursor-pointer bg-transparent text-ink-2 hover:bg-surface-strong`:`bg-transparent text-muted`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:F(`inline-flex size-5 items-center justify-center rounded-full text-[13px] tabular-nums`,r.done&&!o?`bg-pass-soft text-pass`:o?`bg-accent text-accent-ink`:`bg-surface-strong text-muted`),children:r.done&&!o?(0,Y.jsx)(p,{size:12,strokeWidth:3}):i+1}),It[r.id].label]}),i<e.steps.length-1&&(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`h-px w-4 bg-line`})]},r.id)})})})}function Bt({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){let o=n.startsWith(`Save`);return(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Y.jsxs)(U,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),`Back`]}),(0,Y.jsxs)(U,{variant:`primary`,disabled:e||i,onClick:r,"data-tip":n,children:[o?(0,Y.jsx)(p,{"aria-hidden":`true`}):(0,Y.jsx)(O,{"aria-hidden":`true`}),o?`Save`:`Next`]})]})}function Vt({on:e,label:t,why:n,recommended:r,onToggle:i}){return(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:i,className:F(`flex min-h-11 w-full cursor-pointer items-start gap-4 rounded-[12px] border px-4 py-2 text-left`,e?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:F(`mt-1 inline-flex size-4 flex-none items-center justify-center rounded-[4px] border`,e?`border-accent bg-accent text-accent-ink`:`border-muted`),children:e&&(0,Y.jsx)(p,{size:12,strokeWidth:3})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] font-medium text-ink`,children:[t,r&&(0,Y.jsx)(H,{tone:`running`,icon:!1,children:`Recommended`})]}),n&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})]})}function Ht({v:e,busy:t,onNext:n,next:r}){let[i,a]=(0,J.useState)(()=>Object.fromEntries(e.questions.map(e=>[e.id,e.answer]))),[o,s]=(0,J.useState)([]),l=(e,t,n)=>a(r=>{let i=r[e]||[];return{...r,[e]:t===`one`?[n]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}});return(0,Y.jsxs)(Y.Fragment,{children:[e.questions.map(e=>{let t=e.assumed&&!o.includes(e.id);return(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.text}),t?(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-sm text-ink-2`,children:[(0,Y.jsx)(W,{icon:c,size:16,className:`text-pass`}),e.assumed,!(i[e.id]||[]).every(t=>e.assumed?.includes(t))&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`(`,i[e.id]?.join(`, `),`)`]}),(0,Y.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>s([...o,e.id]),"aria-label":`Change the answer`,"data-tip":`Change the answer`,children:(0,Y.jsx)(f,{"aria-hidden":`true`})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.why}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:e.options.map(t=>(0,Y.jsx)(Vt,{on:(i[e.id]||[]).includes(t.id),label:t.label,why:t.why,recommended:t.recommended,onToggle:()=>l(e.id,e.kind,t.id)},t.id))})]})]},e.id)}),(0,Y.jsx)(Bt,{busy:t,next:r,onNext:()=>n({answers:i}),disabled:e.questions.some(e=>e.id===`environment`&&!(i[e.id]||[]).length),aside:e.environments.length===0?(0,Y.jsx)(`span`,{className:`text-fail`,children:`Add a test environment in Settings first: an agent needs one to work in.`}):void 0})]})}var Ut={ready:{icon:c,label:`Ready`,tone:`text-pass`},partial:{icon:l,label:`Partly set up`,tone:`text-warn`},needs_setup:{icon:v,label:`Not set up here yet`,tone:`text-muted`}};function Wt({v:e,busy:t,onNext:n,onBack:r,next:i}){let[a,o]=(0,J.useState)(()=>e.plan.filter(e=>e.on).map(e=>e.capability)),[s,c]=(0,J.useState)(!1),l=a.map(t=>e.plan.find(e=>e.capability===t)).filter(Boolean),u=e.plan.filter(e=>!a.includes(e.capability));return(0,Y.jsxs)(Y.Fragment,{children:[e.planSteps&&e.planSteps.length>0&&(0,Y.jsx)(`ol`,{"aria-label":`How it will work`,className:`m-0 flex list-none flex-col gap-0 rounded-[14px] card border p-0`,children:e.planSteps.map((t,n)=>(0,Y.jsxs)(`li`,{className:F(`flex items-start gap-4 px-4 py-4`,n>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex size-7 flex-none items-center justify-center rounded-full bg-accent-soft text-[13px] font-semibold text-accent-fg tabular-nums`,children:n+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:t.title}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:t.why}),t.without&&(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Without it: `,t.without]}),(0,Y.jsx)(`span`,{className:`flex flex-wrap gap-2 pt-1`,children:t.uses.map(t=>{let n=e.plan.find(e=>e.capability===t);return(0,Y.jsx)(`span`,{className:`rounded-[6px] bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,children:n?.title||t},t)})})]})]},n))}),e.planSteps&&e.planSteps.length>0&&(0,Y.jsx)(`h2`,{className:`m-0 mt-2 text-[13px] font-semibold text-muted`,children:`What it uses`}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:l.map((e,t)=>{let n=Ut[e.state];return(0,Y.jsxs)(`li`,{className:`flex items-start gap-4 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex size-7 flex-none items-center justify-center rounded-full bg-accent-soft text-[13px] font-semibold text-accent-fg tabular-nums`,children:t+1}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.title}),e.why&&(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.why}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary}),(0,Y.jsxs)(`span`,{className:F(`flex items-center gap-2 text-[13px]`,n.tone),children:[(0,Y.jsx)(W,{icon:n.icon,size:14}),n.label,e.state!==`ready`&&e.gaps.length?`: ${e.gaps.join(`; `)}`:``]})]}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Leave out ${e.title}`,"data-tip":`Leave out ${e.title}`,onClick:()=>o(a.filter(t=>t!==e.capability)),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},e.capability)})}),s?(0,Y.jsxs)(`section`,{"aria-labelledby":`build-add`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-add`,className:`m-0 text-[13px] font-semibold`,children:`What else should it do?`}),(0,Y.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2`,children:u.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o([...a,e.capability]),className:`flex h-full w-full cursor-pointer items-start gap-2 rounded-[10px] border border-line-soft bg-bg px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,Y.jsx)(m,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.title}),(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]})]})},e.capability))})]}):(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>c(!0),"data-tip":`Add something it should also do`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({capabilities:a}),disabled:!a.length})]})}function X({text:e,help:t,on:n,onChange:r,locked:i}){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 border-t border-line-soft py-4 first:border-t-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] text-ink`,children:e}),(t||i)&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:i||t})]}),i?(0,Y.jsx)(ne,{size:18,"aria-label":`Always`,className:`mt-1 flex-none text-muted`}):(0,Y.jsx)(Ct,{checked:n,onChange:e=>r?.(e),label:e})]})}function Gt({v:e,busy:t,onNext:n,onBack:r,next:i}){let a=e.boundaries,[o,s]=(0,J.useState)(a.environments),[c,l]=(0,J.useState)(a.actions),[u,d]=(0,J.useState)(a.approve),[f,p]=(0,J.useState)(a.shell),[m,h]=(0,J.useState)(a.repository),[g,_]=(0,J.useState)(a.unattended),[v,y]=(0,J.useState)(a.trust||[]),[b,x]=(0,J.useState)((a.production||[]).includes(`run`)),S=o.some(t=>e.production.includes(t)),C=(e,t)=>y(t?[...new Set([...v,e])]:v.filter(t=>t!==e)),ee=e.plan.filter(e=>e.on&&e.capability.startsWith(`system:`)),w=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],T=e=>c.includes(e),E=(e,t)=>l(t?[...new Set([...c,e])]:c.filter(t=>t!==e)),D=(e,t)=>d(t?[...new Set([...u,e])]:u.filter(t=>t!==e)),te=o.join(` and `)||`its environments`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`Where it works`}),(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:`Where it works`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Every run, test and call goes only here. In production it reads without asking, and a person approves every change.`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Y.jsx)(Ee,{items:e.environments.map(t=>({id:t,label:t,...e.production.includes(t)&&!/prod/i.test(t)?{note:`production`,noteClass:`text-warn`}:{}})),value:o,onChange:s})}),S&&(0,Y.jsx)(`span`,{className:`text-[13px] text-warn`,children:`In production, it reads without asking; a person approves every change there, on a schedule too (it waits, and the team is told). Before a step that could reach real customers, it asks you itself.`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-may`,className:`flex flex-col rounded-[14px] card border px-4 py-1`,children:[(0,Y.jsx)(`h2`,{id:`build-may`,className:`sr-only`,children:`What it may do`}),(0,Y.jsx)(X,{text:`Read test cases, runs, reports and your systems' data`,on:!0,locked:`Always: it cannot work without it, and it changes nothing.`}),e.needs?.run&&(0,Y.jsx)(X,{text:`Run tests and apps in ${te}`,help:`Browser runs, tests, API calls and database queries.`,on:T(`run`),onChange:e=>E(`run`,e)}),e.needs?.run&&T(`run`)&&(0,Y.jsx)(X,{text:`Ask me before each run`,help:`Recommended while it is new; turn it off once you trust it.`,on:u.includes(`run`),onChange:e=>D(`run`,e)}),e.needs?.run&&T(`run`)&&S&&(0,Y.jsx)(X,{text:`Ask me before each run in production`,help:`Off: browser runs, tests and API calls there go ahead without asking. Each question also offers to allow the rest of the run.`,on:!b,onChange:e=>x(!e)}),(0,Y.jsx)(X,{text:`Change test assets on this computer`,help:`Regression packs, API contracts, page memory, recordings. Off unless its job is to make them.`,on:T(`change`),onChange:e=>E(`change`,e)}),T(`change`)&&(0,Y.jsx)(X,{text:`Ask me before each change`,on:u.includes(`change`),onChange:e=>D(`change`,e)}),e.needs?.external&&(0,Y.jsx)(X,{text:`Change other systems as you asked`,help:`Work items or the team's channel, as you chose.`,on:T(`external`),onChange:e=>E(`external`,e)}),T(`external`)&&(0,Y.jsx)(X,{text:`Ask me before each change to another system`,help:`Recommended. Off: it comments, updates and attaches as its job says, without asking.`,on:!v.includes(`external`),onChange:e=>C(`external`,!e)}),e.needs?.repository&&(0,Y.jsx)(X,{text:`Change your repository to write or heal tests`,help:`A coding agent does it on this computer.`,on:m===`write`,onChange:e=>(h(e?`write`:`read`),e&&E(`change`,!0))}),e.needs?.repository&&m===`write`&&(0,Y.jsx)(X,{text:`Ask me before the coding agent works`,help:`Off: it writes and heals tests without asking. The tests it runs can reach any address, so ForgeQE first looks in your test project's config and env files, and asks you when they name an address outside its environments.`,on:!v.includes(`coding`),onChange:e=>C(`coding`,!e)}),(0,Y.jsx)(X,{text:`Use the shell`,help:`Commands on this computer, and fetching web pages. A person approves each one; ForgeQE's secrets stay out of reach.`,on:f,onChange:p})]}),e.schedule&&(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`What it may do alone`}),(0,Y.jsxs)(`span`,{className:`text-[16px] font-semibold`,children:[`When it runs `,e.schedule.toLowerCase(),`, with nobody watching`]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`What it may do without asking. Anything else waits for a person: the team is told, and no answer in four hours is a no. It may always ask a person itself.`}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:[T(`run`)&&(0,Y.jsx)(Vt,{on:g.includes(`run`),label:`Run tests and apps`,why:`Recommended: what it is there to do.`,recommended:!0,onToggle:()=>_(w(g,`run`))}),T(`change`)&&(0,Y.jsx)(Vt,{on:g.includes(`change`),label:`Change test assets`,onToggle:()=>_(w(g,`change`))}),m===`write`&&v.includes(`coding`)&&(0,Y.jsx)(Vt,{on:g.includes(`coding`),label:`Write or heal tests`,why:`The coding agent, when its test project names no address outside its environments.`,onToggle:()=>_(w(g,`coding`))}),ee.map(e=>(0,Y.jsx)(Vt,{on:g.includes(`${e.capability.slice(7)}_*`),label:`Change ${e.title.replace(/^Work with /,``)}`,why:`Comment, update states, attach evidence, without a person approving each.`,onToggle:()=>_(w(g,`${e.capability.slice(7)}_*`))},e.capability))]})]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({environments:o,actions:c,approve:u,repository:m,shell:f,unattended:g,trust:v,production:b?[`run`]:[]}),disabled:!o.length})]})}function Kt({v:e,busy:t,onNext:n,onBack:r,next:i}){let a=e.knowledge,[o,s]=(0,J.useState)(a.files.filter(e=>e.on).map(e=>e.file)),[c,l]=(0,J.useState)(a.skills.filter(e=>e.on).map(e=>e.name)),[u,d]=(0,J.useState)(a.notes),f=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],p=e=>e.toSorted((e,t)=>Number(!!t.why)-Number(!!e.why));return(0,Y.jsxs)(Y.Fragment,{children:[(a.files.length>0||a.skills.length>0)&&(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:[p(a.files).map(e=>(0,Y.jsx)(Vt,{on:o.includes(e.file),label:e.title,why:e.why||e.file,recommended:e.on,onToggle:()=>s(f(o,e.file))},e.file)),p(a.skills).map(e=>(0,Y.jsx)(Vt,{on:c.includes(e.name),label:`Skill: ${e.name}`,why:e.why||e.about,recommended:e.on,onToggle:()=>l(f(c,e.name))},e.name))]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[16px] font-semibold`,children:`Anything else it should know?`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Business rules, what “done” looks like, which test accounts to use (never passwords). It is kept as this agent's own knowledge.`}),(0,Y.jsx)(Se,{rows:5,value:u,maxLength:2e4,onChange:e=>d(e.target.value),placeholder:`A declined card shows “Payment failed” and keeps the basket.`})]}),(0,Y.jsx)(Bt,{busy:t,onBack:r,next:i,onNext:()=>n({files:o,skills:c,notes:u})})]})}function qt({v:e,busy:t,onNext:r,onBack:i,next:a}){let o=e.review,[s,c]=(0,J.useState)(o.name),[l,u]=(0,J.useState)(o.id),[d,f]=(0,J.useState)(o.description),[p,m]=(0,J.useState)(o.icon||``),[h,g]=(0,J.useState)(o.starters[0]?.text||e.goal),[_,v]=(0,J.useState)(o.model||``),[y,b]=(0,J.useState)(o.maxTokens?String(o.maxTokens):``),[x,S]=(0,J.useState)(o.maxMinutes?String(o.maxMinutes):``),C=[y&&!(Number.isInteger(Number(y))&&Number(y)>=1e3&&Number(y)<=1e8)?`The budget per run is a whole number of tokens, from 1,000 to 100,000,000.`:``,x&&!(Number.isInteger(Number(x))&&Number(x)>=1&&Number(x)<=1440)?`The time limit per run is a whole number of minutes, from 1 to 1440.`:``,_&&!(e.models||[]).some(e=>e.name===_)?`${_} is no longer in llms.json: pick another model, or ForgeQE's choice.`:``].filter(Boolean).join(` `),ee={..._?{model:_}:{},...y?{maxTokens:Math.round(Number(y))}:{},...x?{maxMinutes:Math.round(Number(x))}:{}},w=e.plan.filter(e=>e.on),T=e.boundaries,E=e.knowledge,te=[[`It works in`,T.environments.join(`, `)],[`It does`,w.map(e=>e.title).join(`; `)],[`It may`,[T.actions.includes(`run`)?`run tests and apps${T.approve.includes(`run`)?` (asking you first)`:``}`:``,T.actions.includes(`change`)?`change test assets`:``,T.actions.includes(`external`)?`change other systems${(T.trust||[]).includes(`external`)?` (without asking)`:` (asking you first)`}`:``,T.repository===`write`?`write or heal tests${(T.trust||[]).includes(`coding`)?` (without asking, unless its test project names an address outside its environments)`:` (asking you first)`}`:``].filter(Boolean).join(`; `)||`only read`],[`Runs by itself`,e.schedule?`${e.schedule.toLowerCase()}, with nobody watching${T.unattended.length?`; alone it may ${T.unattended.map(e=>e===`run`?`run tests and apps`:e===`change`?`change test assets`:e===`coding`?`write or heal tests`:`change ${e.replace(/_\*$/,``).replace(/_/g,` `)}`).join(`, `)}`:``}`:`no: you, your team or Atlas start it`],...T.shell?[[`Shell`,`yes, a person approves each command`]]:[],[`It knows`,[...E.files.filter(e=>e.on).map(e=>e.title),...E.skills.filter(e=>e.on).map(e=>e.name),...E.notes.trim()?[`your notes`]:[]].join(`, `)||`nothing extra`]];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,Y.jsx)(V,{value:s,maxLength:60,onChange:e=>c(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Id`}),(0,Y.jsx)(V,{value:l,maxLength:40,spellCheck:!1,disabled:!!e.saved,onChange:e=>u(e.target.value.toLowerCase())})]})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`What it is for`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`One line. Atlas reads it to know when to hand it work.`}),(0,Y.jsx)(V,{value:d,maxLength:300,onChange:e=>f(e.target.value)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Icon`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`What it wears on the Agents page: its mascot, or one of ForgeQE's agent icons.`}),(0,Y.jsx)(jt,{value:p,onChange:m})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Budget per run`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The most model tokens one run may use, 1,000 or more; it stops there. Empty: no limit.`}),(0,Y.jsx)(V,{type:`number`,min:1e3,step:1e3,value:y,placeholder:`No limit`,onChange:e=>b(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Time limit per run`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`In minutes, 1 to 1440. Empty: no limit when someone is watching, 120 when nobody is (a schedule, a trigger, another agent).`}),(0,Y.jsx)(V,{type:`number`,min:1,max:1440,value:x,placeholder:`Minutes`,onChange:e=>S(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Model`}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The model profile of llms.json its runs use.`}),(0,Y.jsxs)(B,{value:_,onChange:e=>v(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`ForgeQE's choice`}),(e.models||[]).map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.model,`)`]},e.name)),_&&!(e.models||[]).some(e=>e.name===_)&&(0,Y.jsxs)(`option`,{value:_,children:[_,` (not in llms.json)`]})]})]})]}),C&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail`,children:C}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Its first request`}),(0,Y.jsx)(V,{value:h,maxLength:500,onChange:e=>g(e.target.value)})]}),(0,Y.jsx)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-2 rounded-[14px] bg-surface-muted px-4 py-4 text-sm sm:grid-cols-[140px_1fr]`,children:te.map(([e,t])=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Y.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:t})]},e))}),e.advice.filter(e=>e.blocking).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.advice.filter(e=>e.blocking).map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-[12px] bg-warn-soft px-4 py-4 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-warn`,children:e.about}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.fix})]},t))}),(0,Y.jsx)(Bt,{busy:t,onBack:i,next:e.saved?`Save the changes`:a,onNext:()=>r({name:s,id:l,description:d,icon:p,starters:[{label:`Run it now`,text:h}],...ee}),disabled:!s.trim()||!l.trim()||!!C,aside:e.saved?(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,e.saved,`edit`),className:`inline-flex items-center gap-2`,children:[(0,Y.jsx)(n,{size:14,"aria-hidden":`true`}),`Open every setting`]}):(0,Y.jsxs)(U,{size:`sm`,variant:`ghost`,disabled:t||!s.trim()||!l.trim()||!!C,onClick:()=>r({name:s,id:l,description:d,icon:p,starters:[{label:`Run it now`,text:h}],...ee},!0),"data-tip":`Save it as a draft, then open every setting`,children:[(0,Y.jsx)(n,{"aria-hidden":`true`}),`Save and open every setting`]})})]})}function Jt({v:e}){let t=e.saved,[n,r]=(0,J.useState)(e.review?.starters[0]?.text||e.goal),[i,a]=(0,J.useState)(``),[s,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1),m=async()=>{l(!0);try{let{id:e}=await be.start(n.trim(),{agent:t,try:!0});location.hash=D(`chats`,e)}catch(e){d(e.message),l(!1)}},h=async()=>{l(!0),d(``);try{await R.act(t,`approve`,{confirm:i,note:`Made with the agent builder`}),p(!0)}catch(e){d(e.message)}finally{l(!1)}};return f?(0,Y.jsxs)(`div`,{className:`flex flex-col items-start gap-4 rounded-[14px] bg-pass-soft px-4 py-4`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-[16px] font-semibold text-pass`,children:[(0,Y.jsx)(c,{size:18,"aria-hidden":`true`}),P(e.review?.name||`agent`,!0),` is ready.`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`You, your team and Atlas can hand it work now.`}),(0,Y.jsxs)(`a`,{href:D(`agents`,`custom`,t),className:F(we({variant:`primary`,size:`sm`}),`no-underline`),"data-tip":`Open the agent`,children:[(0,Y.jsx)(O,{"aria-hidden":`true`}),`Open`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`build-try`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-try`,className:`m-0 text-[16px] font-semibold`,children:`1. Try it on a real request`}),(0,Y.jsx)(Se,{rows:2,"aria-label":`What to try`,value:n,onChange:e=>r(e.target.value)}),(0,Y.jsxs)(U,{variant:`primary`,size:`sm`,className:`self-start`,disabled:s||!n.trim(),onClick:()=>void m(),"data-tip":`Try it in a chat`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Try`]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:`It opens as a chat. Come back here to approve it: Agents, Custom agents, then this agent.`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`build-approve`,className:`flex flex-col gap-2 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{id:`build-approve`,className:`m-0 text-[16px] font-semibold`,children:`2. Approve it`}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Only an approved version runs. Type its id to confirm: `,t]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Type ${t} to confirm`,className:`w-[260px]`,value:i,spellCheck:!1,autoComplete:`off`,onChange:e=>a(e.target.value),placeholder:t}),(0,Y.jsxs)(U,{size:`sm`,disabled:s||i!==t,onClick:()=>void h(),children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Approve`]})]})]}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:u}),(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,t),className:`self-start text-[13px]`,children:`Open its page`})]})}function Yt({text:e,file:t}){let n=e.replace(/\n$/,``).split(`
|
|
2
2
|
`);return(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-manifest`,className:`flex w-full flex-col gap-2 text-left`,children:[(0,Y.jsxs)(`h2`,{id:`ca-manifest`,className:`m-0 text-[13px] font-semibold text-muted`,children:[`Its manifest, as it is in `,(0,Y.jsx)(`span`,{className:`font-mono`,children:t})]}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Read only: fix it in that file, or start a new agent from the form and delete this one.`}),(0,Y.jsx)(`pre`,{tabIndex:0,"aria-label":`The manifest in ${t}`,className:`m-0 max-h-[50vh] overflow-auto rounded-[12px] card border px-4 py-4 font-mono text-[13px] leading-relaxed`,children:n.map((e,t)=>(0,Y.jsxs)(`span`,{className:`block pl-12 -indent-12 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mr-4 inline-block w-8 text-right text-muted select-none`,children:t+1}),e]},t))})]})}function Xt(e,t){let n=e.endedAt?Date.parse(e.endedAt)-Date.parse(e.startedAt):NaN,r=Number.isFinite(n)&&n>=0?n>=6e4?`${Math.floor(n/6e4)} min`:`${Math.max(1,Math.floor(n/1e3))}s`:``;return[e.model||``,e.usage?t.usage(e.usage):``,r,e.cost?`about ${t.money(e.cost.amount,e.cost.currency)}`:``].filter(Boolean).join(` · `)}var Zt=[`text`,`environment`,`choice`],Qt=/[\u0000-\u001f\u007f\u2028\u2029]/,$t=/\{([a-z][a-z0-9_]{0,31})\}/g;function en(e){return[...new Set([...e.matchAll($t)].map(e=>e[1]))]}function tn(e,t,n){return typeof t!=`string`||!t.trim()?`${e.label} needs a value.`:t.length>200?`${e.label} is longer than 200 characters.`:Qt.test(t)?`${e.label} must be one line of text.`:t.trim().startsWith(`-`)?`${e.label} cannot start with a dash.`:e.kind===`environment`&&!n.includes(t)?`${e.label}: "${t.slice(0,40)}" is not one of its environments.`:e.kind===`choice`&&!(e.options||[]).includes(t)?`${e.label}: "${t.slice(0,40)}" is not one of its options.`:``}function nn(e,t,n,r){let i=[];for(let a of en(e)){let e=t.find(e=>e.name===a);if(!e)i.push(`{${a}} is not one of its inputs.`);else{let t=tn(e,Object.hasOwn(n,a)?n[a]:void 0,r);t&&i.push(t)}}if(i.length)throw Error(i.join(` `));let a=e.replace($t,(e,t)=>n[t].trim());if(a.trim().startsWith(`-`))throw Error(`The request cannot start with a dash.`);return a}var rn=(e,t,n,r)=>r.map(([r,i,a])=>({file:`${n}/${r}`,url:`https://huggingface.co/${e}/resolve/${t}/${r}`,bytes:i,sha256:a}));Object.freeze(`anyio==4.15.1 ; sys_platform != 'emscripten',attrs==26.1.0,av==19.0.2,click==8.5.0,cloudpickle==3.1.2,colorama==0.4.6 ; sys_platform == 'win32',ctranslate2==4.8.4,dlinfo==2.0.0,espeakng-loader==0.2.4,faster-whisper==1.2.1,filelock==4.2.6,flatbuffers==25.12.19,fsspec==2026.9.0,h11==0.16.0 ; sys_platform != 'emscripten',hf-xet==1.8.0 ; platform_machine == 'AMD64' or platform_machine == 'ARM64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64',httpcore2==2.16.0 ; sys_platform != 'emscripten',httpx2==2.16.0,httpx2-jsfetch==1.0 ; sys_platform == 'emscripten',huggingface-hub==2.4.0,idna==3.20,joblib==1.6.0,kokoro-onnx==0.6.1,numpy==2.5.4,onnxruntime==1.31.1,packaging==26.3,phonemizer==3.4.0,protobuf==7.36.2,pyyaml==6.0.3,tokenizers==0.23.3,tqdm==4.70.1,truststore==0.10.5 ; sys_platform != 'emscripten',typing-extensions==4.16.0`.split(`,`));var an=`https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0`,on=Object.freeze([{file:`kokoro-onnx/kokoro-v1.0.onnx`,url:`${an}/kokoro-v1.0.onnx`,bytes:325532387,sha256:`7d5df8ecf7d4b1878015a32686053fd0eebe2bc377234608764cc0ef3636a6c5`},{file:`kokoro-onnx/voices-v1.0.bin`,url:`${an}/voices-v1.0.bin`,bytes:28214398,sha256:`bca610b8308e8d99f32e6fe4197e7ec01679264efed0cac9140fe9c29f1fbf7d`}]),sn=`https://huggingface.co/Systran/faster-whisper-base.en/resolve/3d3d5dee26484f91867d81cb899cfcf72b96be6c`,cn=Object.freeze([{file:`whisper-base.en/config.json`,url:`${sn}/config.json`,bytes:2227,sha256:`f3bc3821e9fc76a27bae538e11ae5b677dcdd352b4600429ce7951d398569aeb`},{file:`whisper-base.en/tokenizer.json`,url:`${sn}/tokenizer.json`,bytes:2128466,sha256:`929c5252409436dce1b38a75d1abbcb5e132d170d8e324e4e04ed915fa2d22df`},{file:`whisper-base.en/vocabulary.txt`,url:`${sn}/vocabulary.txt`,bytes:422309,sha256:`ff77588746d3a2595d32ab5b69ffd7b95ce2441ac57533cb66fc3eb575a115cf`},{file:`whisper-base.en/model.bin`,url:`${sn}/model.bin`,bytes:145216508,sha256:`2a166925539a16005f14ff328359f9b9adb9dc4fb631bb3b227526862e93e2ef`}]),ln=Object.freeze(rn(`onnx-community/silero-vad`,`e71cae966052b992a7eca6b17738916ce0eca4ec`,`silero-vad`,[[`onnx/model.onnx`,2243022,`a4a068cd6cf1ea8355b84327595838ca748ec29a25bc91fc82e6c299ccdc5808`]])),un=Object.freeze(rn(`pipecat-ai/smart-turn-v3`,`f766f81d3cfdf7737ac64aad813d91bbfd56bf93`,`smart-turn-v3`,[[`smart-turn-v3.2-cpu.onnx`,8679182,`2bb026316b14a660486a75b1733cd3fbab8c2fd0314dc9af7be49f8cca967e4f`]])),dn=Object.freeze([...ln,...un]);Object.freeze([...on,...cn,...dn]),Object.freeze({en:Object.freeze([`af_heart`,`am_michael`])}),Object.freeze({en:`af_heart`});var fn=Object.freeze([`light`,`deep`]);Object.freeze({en:{light:`af_heart`,deep:`am_michael`}});var pn=[`suite_failed`,`suite_passed`,`job_failed`,`job_recovered`,`eval_failed`,`pr_opened`,`pr_updated`,`push`],mn=[`pr_opened`,`pr_updated`,`push`],hn=[`number`,`text`,`yes_no`],gn={id:``,name:``,version:`1.0.0`,description:``,instructions:``,scope:{agents:[],capabilities:[],skills:[],knowledge:[],environments:[]},permissions:{repository:`read`,actions:[`read`],approve:[]},runtime:{maxDelegationDepth:1},policies:[],starters:[]};function _n(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^[^a-z]+/,``).replace(/(?<!-)-+$/,``).slice(0,40).replace(/(?<!-)-+$/,``)}var vn={read:{label:`Read`,help:`Test cases, runs, reports, the repository, systems' data. Changes nothing.`},run:{label:`Run`,help:`Browser runs, tests, API calls and database queries, in its environments only.`},change:{label:`Change files`,help:`Test assets on this computer: packs, contracts, page memory, recordings.`},external:{label:`Change other systems`,help:`Work items, pull requests, pipelines, channels.`}},yn=6,bn={number:`A number`,text:`One line of text`,yes_no:`Yes or no`},xn=mn,Sn={suite_failed:`A suite failed`,suite_passed:`A suite passed`,job_failed:`A schedule failed`,job_recovered:`A schedule recovered`,eval_failed:`An eval failed`,pr_opened:`A pull request opened`,pr_updated:`A pull request updated`,push:`A branch pushed to`},Cn={text:`Text`,environment:`One of its environments`,choice:`One of a list`},wn={read:`Read`,run:`Run`,change:`Change files`,external:`Change other systems`,schedule:`Schedule work`};function Tn(e){let t=e.schedule?.with;if(!e.schedule||!t)return e;let n=new Set(en(e.schedule.request)),r=Object.fromEntries(Object.entries(t).filter(([t,r])=>{let i=(e.inputs||[]).find(e=>e.name===t);return!i||!n.has(t)?!1:i.kind===`choice`?(i.options||[]).map(e=>e.trim()).includes(r.trim()):i.kind!==`environment`||e.scope.environments.includes(r)}));if(Object.keys(r).length===Object.keys(t).length)return e;let{with:i,...a}=e.schedule;return{...e,schedule:{...a,...Object.keys(r).length?{with:r}:{}}}}function En(e,t){let n=e.permissions.deny||[];if(!n.length)return e;let r=new Set(t.flatMap(e=>(e.usable||[]).map(e=>e.name))),i=new Set(t.filter(t=>e.scope.capabilities.includes(t.id)).flatMap(e=>(e.usable||[]).map(e=>e.name))),a=n.filter(e=>!r.has(e)||i.has(e));return a.length===n.length?e:{...e,permissions:{...e.permissions,deny:a}}}var Dn={ready:{icon:c,label:`Ready`,cls:`text-pass`},partial:{icon:l,label:`Partly set up`,cls:`text-warn`},needs_setup:{icon:v,label:`Needs setup`,cls:`text-muted`}},On=e=>e?e.cron===void 0?`every`:`cron`:``,kn=e=>e.replace(/\s+MCP\s*$/i,``);function An(e,t,n=[]){let r=e.permissions,i=r.repository===`write`?n.filter(e=>(r.trust||[]).includes(e)):[],a=[...r.actions.includes(`run`)?[{key:`run`,ids:[`run`],label:`Run tests and apps`}]:[],...r.actions.includes(`change`)?[{key:`change`,ids:[`change`],label:`Change test assets`}]:[],...i.length?[{key:`coding`,ids:i,label:`Write or heal tests`}]:[],...(e.scope.systems||[]).map(e=>({key:`${e}_*`,ids:[`${e}_*`],label:`Change ${kn(t.find(t=>t.name===e)?.label||e)}`}))],o=new Set(a.flatMap(e=>e.ids)),s={external:`Change other systems`,schedule:`Schedule work`};return[...a,...(r.unattended||[]).filter(e=>!o.has(e)).map(e=>({key:e,ids:[e],label:s[e]||e.replace(/_\*$/,` (all its tools)`).replace(/_/g,` `)}))]}function jn(e,t=[],n=t){let r=e.permissions,i=new Set(e.scope.systems||[]),a=new Set([`run`,`change`,`external`,`schedule`]),o=(r.unattended||[]).filter(e=>a.has(e)?r.actions.includes(e):e.endsWith(`_*`)?i.has(e.slice(0,-2)):!t.includes(e)||n.includes(e)&&r.repository===`write`&&(r.trust||[]).includes(e));return o.length===(r.unattended||[]).length?e:{...e,permissions:{...r,unattended:o}}}var Z=(e,t,n)=>n?[...new Set([...e,t])]:e.filter(e=>e!==t);function Q({checked:e,onChange:t,disabled:n,children:r,help:i}){return(0,Y.jsxs)(`label`,{className:F(`flex items-start gap-2 text-sm`,n?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,Y.jsx)(St,{checked:e,disabled:n,onCheckedChange:t,className:`mt-1`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-ink`,children:r}),i&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:i})]})]})}function Mn({id:e,label:t,options:n,onChange:r,placeholder:i=`checkout, search`,max:a=12,mono:o=!1}){let[s,c]=(0,J.useState)(n.join(`, `)),l=e=>[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))].slice(0,a);return(0,J.useEffect)(()=>{l(s).join(`\0`)!==n.join(`\0`)&&c(n.join(`, `))},[n.join(`\0`)]),(0,Y.jsx)(V,{id:e,"aria-label":t,className:F(`min-w-0 flex-[1_1_200px]`,o&&`font-mono`),value:s,placeholder:i,maxLength:a*122,spellCheck:!o,onChange:e=>{let t=o?e.target.value.toLowerCase():e.target.value;c(t),r(l(t))}})}function Nn({id:e,input:t,environments:n,value:r,onChange:i}){let a=t.kind===`environment`?n:t.kind===`choice`?t.options||[]:null;return a?(0,Y.jsxs)(B,{id:e,value:r,className:`w-[200px]`,onChange:e=>i(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Pick one`}),a.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}):(0,Y.jsx)(V,{id:e,value:r,maxLength:200,className:`w-[200px]`,onChange:e=>i(e.target.value)})}function Pn({id:e,template:t}){let n=!e,[r,i]=(0,J.useState)(n&&!t?gn:null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(``),[f,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)([]),[b,x]=(0,J.useState)([]),[S,C]=(0,J.useState)(!1),[ee,T]=(0,J.useState)(!1),[E,te]=(0,J.useState)(!1);(0,J.useEffect)(()=>{R.choices().then(c,e=>d(e.message)),t&&R.template(t).then(e=>{o(e),i({...gn,...e.fields,scope:{...gn.scope,...e.fields.scope},permissions:{...gn.permissions,...e.fields.permissions}}),te(!0)},e=>d(e.message)),e&&R.view(e).then(t=>(h(t.approvedVersion||``),t.form?i({...gn,...t.form,runtime:{...t.form.runtime}}):t.manifestText===void 0?d(`${e} has no manifest the editor can read (it may have been removed). Its page says what it has.`):(_({text:t.manifestText,file:t.manifestFile||`.forgeqe/agents/${e}.yaml`,problems:t.problems.working}),d(`${e}'s manifest is not one the editor can read. Fix it in ${t.manifestFile||`.forgeqe/agents/${e}.yaml`}; what is wrong, and the file as it is, are below.`))),e=>d(e.message))},[e,t]);let ne=(0,J.useRef)(0);(0,J.useEffect)(()=>{if(!r)return;let e=++ne.current;C(!0);let t=setTimeout(()=>{R.validate(Tn(r)).then(t=>e===ne.current&&(y(t.problems||[]),x(t.advice||[]),C(!1)),t=>e===ne.current&&(y([t.message]),C(!1)))},350);return()=>clearTimeout(t)},[r]);let O=e=>i(t=>t&&{...t,...e}),re=s?.coding||[],k=e=>re.filter(t=>(s?.capabilities||[]).some(n=>e.scope.capabilities.includes(n.id)&&n.tools.includes(t))),A=e=>En(jn(e,re,k(e)),s?.capabilities||[]),j=e=>i(t=>t&&A({...t,scope:{...t.scope,...e}})),N=e=>i(t=>t&&{...t,voice:e?{sound:e}:void 0}),ie=e=>i(t=>t&&A({...t,permissions:{...t.permissions,...e}})),ae=e=>i(t=>{if(!t)return t;let n=t.schedule?.request??t.starters[0]?.text??``;if(!e)return{...t,schedule:void 0,...(t.triggers||[]).length?{}:{permissions:{...t.permissions,unattended:[]}}};let r=t.schedule?.with?{with:t.schedule.with}:{};return{...t,schedule:e===`every`?{every:t.schedule?.every??`1d`,request:n,...r}:{cron:t.schedule?.cron??`0 7 * * 1-5`,request:n,...r}}}),oe=e=>i(t=>t?.schedule?{...t,schedule:{...t.schedule,...e}}:t),se=r?.schedule,ce=[...se&&On(se)===`every`&&!se.every?.trim()?[`Say how often it runs: 15m, 1h, 1d.`]:[],...se&&On(se)===`cron`&&!se.cron?.trim()?[`Give its cron schedule: 0 7 * * 1-5.`]:[],...se&&!se.request.trim()?[`Say what it is asked each time it runs by itself.`]:[],...(r?.triggers||[]).flatMap((e,t)=>e.request.trim()?[]:[`Say what trigger ${t+1} asks it (${Sn[e.on].toLowerCase()}).`])],le=[...ce,...v],ue=(0,J.useMemo)(()=>{let e=new Map;for(let t of s?.capabilities||[])e.set(t.area,[...e.get(t.area)||[],t]);return[...e]},[s]),de=async()=>{if(r){T(!0),d(``);try{let t=await R.save(Tn(r),n?{create:!0}:{id:e});location.hash=D(`agents`,`custom`,t.id)}catch(e){d(e.message),T(!1)}}},fe=e?D(`agents`,`custom`,e):D(`agents`,`custom`,`new`);return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(Ge,{}),(0,Y.jsxs)(`main`,{className:F($e,`settings-fields flex-auto gap-2`),children:[(0,Y.jsxs)(`a`,{href:fe,className:`mb-2 inline-flex items-center gap-2 self-start text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),e?`Back to the agent`:`Back to the builder`]}),(0,Y.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:n?`New custom agent`:`Edit ${r?.name||e}`}),(0,Y.jsx)(`p`,{className:`m-0 mb-2 text-sm leading-relaxed text-ink-2`,children:n?a?`ForgeQE's ${a.title} template, filled from this project. Read every setting and change what does not fit: it is saved as a draft, and runs once a person has tried and approved it.`:`An agent for one job your team repeats. It uses ForgeQE's own agents, tools, skills and knowledge, and is held to the environments and actions you pick here, on every call. It runs once a person has tried and approved it.`:`Saving changes its manifest only. The approved version keeps running until this change is approved on its page.`}),l&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}),a&&s&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-template`,className:`mb-2 flex flex-col gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`ca-template`,className:`m-0 text-base font-semibold`,children:[`From the `,a.title,` template`]}),(0,Y.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:[a.systems.length>0&&(0,Y.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-[12px] bg-surface-muted px-4 py-4 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-ink`,children:[`It uses the tools of `,a.systems.map(e=>kn(s?.systems.find(t=>t.name===e)?.label||e)).join(`, `)]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Through ForgeQE, which checks every call against what this agent may do. Change them under Systems it works with.`})]}),a.notes.map(e=>(0,Y.jsx)(`li`,{className:`flex flex-col gap-1 rounded-[12px] bg-surface-muted px-4 py-4 text-sm`,children:(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:e})},e))]})]}),n&&!t&&(0,Y.jsx)(`p`,{className:`m-0 mb-2 text-sm`,children:(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,`new`),children:`Or say what it should do, and let ForgeQE build it with you`})}),g&&(0,Y.jsxs)(Y.Fragment,{children:[g.problems.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[12px] bg-fail-soft px-4 py-4 text-sm text-fail`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Its manifest needs fixing before it can be edited here:`}),(0,Y.jsx)(`ul`,{className:`m-0 list-disc pl-6 [overflow-wrap:anywhere]`,children:g.problems.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))})]}),(0,Y.jsx)(Yt,{text:g.text,file:g.file})]}),!r||!s?!l&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{first:!0,children:`What it is`}),(0,Y.jsx)(K,{label:`Name`,help:`What it does, then “agent”: Checkout guard agent.`,htmlFor:`ca-name`,children:(0,Y.jsx)(V,{id:`ca-name`,value:r.name,maxLength:60,onChange:e=>O({name:e.target.value,...n&&!E?{id:_n(e.target.value)}:{}})})}),(0,Y.jsx)(K,{label:`Id`,help:n?`Its file name and address: lower-case words and hyphens. It cannot change later.`:`It cannot change. Make a new agent for another id.`,htmlFor:`ca-id`,children:(0,Y.jsx)(V,{id:`ca-id`,value:r.id,maxLength:40,disabled:!n,spellCheck:!1,onChange:e=>(te(!0),O({id:e.target.value.toLowerCase()}))})}),(0,Y.jsx)(K,{label:`Version`,help:`${f?`${f} is approved and runs now. `:``}Raise it for each change you approve: 1.0.0, then 1.1.0. A change saved under a version already approved is raised to the next free one, so each version names one set of settings.`,htmlFor:`ca-version`,children:(0,Y.jsx)(V,{id:`ca-version`,value:r.version,maxLength:14,onChange:e=>O({version:e.target.value})})}),(0,Y.jsx)(K,{label:`Description`,help:`One line: what it is for. Atlas reads it to know when to hand it work.`,htmlFor:`ca-desc`,stacked:!0,children:(0,Y.jsx)(V,{id:`ca-desc`,value:r.description,maxLength:300,onChange:e=>O({description:e.target.value})})}),(0,Y.jsx)(K,{label:`Icon`,help:`What it wears on the Agents page and its own page: its mascot, or one of ForgeQE's agent icons.`,htmlFor:`ca-icon`,stacked:!0,children:(0,Y.jsx)(jt,{id:`ca-icon`,value:r.icon,onChange:e=>O({icon:e})})}),(0,Y.jsx)(K,{label:`Voice`,help:`How it sounds when you talk with it. Default is ForgeQE's own voice; ForgeQE picks each from the speech set up on that computer.`,children:(0,Y.jsx)(Ve,{label:`Voice`,value:r.voice?.sound??``,onChange:e=>N(e),options:[{id:``,label:`Default`},...fn.map(e=>({id:e,label:e[0].toUpperCase()+e.slice(1)}))]})}),(0,Y.jsx)(K,{label:`Instructions`,help:`Its focus and how to work, in plain words. Guidance for the model: the limits below are what holds it.`,htmlFor:`ca-instr`,stacked:!0,children:(0,Y.jsx)(Se,{id:`ca-instr`,rows:5,value:r.instructions,maxLength:8e3,onChange:e=>O({instructions:e.target.value})})}),(0,Y.jsx)(q,{help:`Where its runs, tests and calls may go. In an environment named like production, reads go ahead, runs are asked unless you say otherwise, and every change is approved by a person.`,children:`Where it works`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-4`,children:[s.environments.length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No environments in env.yaml yet. Add them in Settings, Environments.`}),s.environments.map(e=>(0,Y.jsx)(Q,{checked:r.scope.environments.includes(e.name),onChange:t=>j({environments:Z(r.scope.environments,e.name,t)}),help:e.production?`Production: reads go ahead; a person approves every change there.`:void 0,children:e.name},e.name))]}),(0,Y.jsx)(q,{help:`ForgeQE's capabilities it may use: their tools, and only theirs. Each says whether it is set up here.`,children:`What it can do`}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-4 py-4`,children:ue.map(([e,t])=>{let n=t.filter(e=>r.scope.capabilities.includes(e.id)).length;return(0,Y.jsxs)(`details`,{open:n>0||void 0,className:`group rounded-[12px] card border px-4 py-2`,children:[(0,Y.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 py-1 text-[13px] font-medium`,children:[(0,Y.jsx)(u,{size:14,"aria-hidden":`true`,className:`flex-none text-muted transition-transform duration-200 group-open:rotate-90`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:e}),(0,Y.jsx)(`span`,{className:`text-[13px] font-normal text-muted tabular-nums`,children:n?`${n} of ${t.length} picked`:`${t.length}`})]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 pt-2 pb-1 pl-6`,children:t.map(e=>{let t=Dn[e.state];return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsx)(Q,{checked:r.scope.capabilities.includes(e.id),onChange:t=>j({capabilities:Z(r.scope.capabilities,e.id,t)}),help:(0,Y.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(W,{icon:t.icon,size:13,className:F(`mt-1 flex-none`,t.cls)}),(0,Y.jsxs)(`span`,{children:[t.label,e.gaps.length?`: ${e.gaps.join(`; `)}`:``]})]}),children:(0,Y.jsx)(`span`,{"data-tip":e.summary,children:e.title})}),r.scope.capabilities.includes(e.id)&&((e.usable||[]).length>1||(e.usable||[]).some(e=>(r.permissions.deny||[]).includes(e.name)))&&(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0 pl-6`,children:[(0,Y.jsxs)(`legend`,{className:`sr-only`,children:[`Tools of `,e.title,` it uses`]}),(e.usable||[]).map(t=>(0,Y.jsx)(Q,{checked:!(r.permissions.deny||[]).includes(t.name),disabled:!(r.permissions.deny||[]).includes(t.name)&&(e.usable||[]).filter(e=>!(r.permissions.deny||[]).includes(e.name)).length===1,onChange:e=>ie({deny:Z(r.permissions.deny||[],t.name,!e)}),help:(wn[t.action]||t.action)+(!(r.permissions.deny||[]).includes(t.name)&&(e.usable||[]).filter(e=>!(r.permissions.deny||[]).includes(e.name)).length===1?`. Its last tool: untick the capability instead.`:``),children:(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:t.name})},t.name))]})]},e.id)})})]},e)})}),(0,Y.jsx)(q,{help:`ForgeQE's agents it may start: a capability that needs one (a browser run needs WebPilot) is refused without it.`,children:`Agents it may use`}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 py-4`,children:s.agents.map(e=>(0,Y.jsx)(Q,{checked:r.scope.agents.includes(e.name),onChange:t=>j({agents:Z(r.scope.agents,e.name,t)}),help:(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name}),children:e.title},e.name))}),(0,Y.jsx)(q,{help:`Your team's other custom agents it may hand a request to. Each runs its approved version within its own limits and this one's, never more; one already working on the request is not handed it again. It needs Hands work on of 1 level or more.`,children:`Custom agents it may hand work to`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-4`,children:[(s.customAgents||[]).filter(e=>e.id!==r.id).length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No other custom agents in this project yet.`}),(s.customAgents||[]).filter(e=>e.id!==r.id).map(e=>(0,Y.jsx)(Q,{checked:(r.scope.customAgents||[]).includes(e.id),onChange:t=>j({customAgents:Z(r.scope.customAgents||[],e.id,t)}),help:(0,Y.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[e.id,e.approved?``:` · not approved yet: it is handed nothing until it is`]}),children:e.name},e.id))]}),(0,Y.jsx)(q,{help:`Other systems' MCP servers this project has set up. It uses their tools through ForgeQE, which checks every call; a change in them is asked unless you lift it under What it may do.`,children:`Systems it works with`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-4`,children:[s.systems.length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`None set up yet. Add them in Settings, MCP servers.`}),s.systems.map(e=>(0,Y.jsx)(Q,{checked:(r.scope.systems||[]).includes(e.name),onChange:t=>j({systems:Z(r.scope.systems||[],e.name,t)}),help:e.about.slice(0,160),children:kn(e.label)},e.name))]}),(0,Y.jsx)(q,{help:`Only these are loaded for it.`,children:`Skills and knowledge`}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 py-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Y.jsx)(`legend`,{className:`mb-1 p-0 text-[13px] font-semibold text-muted`,children:`Skills`}),s.skills.length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`None in this project yet.`}),s.skills.map(e=>(0,Y.jsx)(Q,{checked:r.scope.skills.includes(e.name),onChange:t=>j({skills:Z(r.scope.skills,e.name,t)}),help:e.about,children:e.name},e.name))]}),(0,Y.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Y.jsx)(`legend`,{className:`mb-1 p-0 text-[13px] font-semibold text-muted`,children:`Knowledge files`}),s.knowledge.length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`None in .forgeqe/knowledge yet.`}),s.knowledge.map(e=>(0,Y.jsx)(Q,{checked:r.scope.knowledge.includes(e.file),onChange:t=>j({knowledge:Z(r.scope.knowledge,e.file,t)}),help:e.title===e.file?void 0:e.title,children:e.file},e.file))]})]}),(0,Y.jsx)(q,{help:`Enforced on every call. Ask first: a person approves each such call in the chat. In production, every call is asked.`,children:`What it may do`}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 py-4`,children:s.actions.map(e=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-1`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-[1_1_320px]`,children:(0,Y.jsx)(Q,{checked:r.permissions.actions.includes(e),onChange:t=>ie({actions:Z(r.permissions.actions,e,t)}),help:vn[e]?.help,children:vn[e]?.label||e})}),(0,Y.jsx)(Q,{checked:e===`external`?!(r.permissions.trust||[]).includes(`external`):r.permissions.approve.includes(e),disabled:!r.permissions.actions.includes(e),onChange:t=>ie(e===`external`?{trust:Z(r.permissions.trust||[],`external`,!t)}:{approve:Z(r.permissions.approve,e,t)}),children:`Ask first`})]},e))}),(0,Y.jsx)(K,{label:`Repository`,help:`Whether it may change files in the repository (with Change files).`,children:(0,Y.jsx)(Ve,{label:`Repository`,value:r.permissions.repository,onChange:e=>ie({repository:e}),options:[{id:`read`,label:`Read only`},{id:`write`,label:`May change files`}]})}),r.scope.environments.some(e=>s.environments.some(t=>t.name===e&&t.production))&&r.permissions.actions.includes(`run`)&&(0,Y.jsx)(K,{label:`Production`,help:`Reads there go ahead without asking; every change there is approved by a person.`,children:(0,Y.jsx)(Q,{checked:!(r.permissions.production||[]).includes(`run`),onChange:e=>ie({production:e?[]:[`run`]}),children:`Ask before each run`})}),r.permissions.repository===`write`&&(()=>{let e=(s.coding||[]).filter(e=>s.capabilities.some(t=>r.scope.capabilities.includes(t.id)&&t.tools.includes(e)));if(!e.length)return null;let t=e.every(e=>(r.permissions.trust||[]).includes(e));return(0,Y.jsx)(K,{label:`Quill`,help:`The tests it runs can reach any address. Without asking, ForgeQE first looks in the test project's config and env files, and asks when they name an address outside its environments.`,children:(0,Y.jsx)(Q,{checked:!t,onChange:t=>ie({trust:t?(r.permissions.trust||[]).filter(t=>!e.includes(t)):[...new Set([...r.permissions.trust||[],...e])]}),children:`Ask first`})})})(),(0,Y.jsx)(K,{label:`Shell`,help:`Commands on this computer, and fetching web pages. A person approves each one; ForgeQE's secrets stay out of reach.`,children:(0,Y.jsx)(Q,{checked:r.permissions.shell===!0,onChange:e=>ie({shell:e}),children:`Use the shell`})}),(0,Y.jsx)(K,{label:`Hands work on`,help:`How many levels deep it may give part of a task to a helper.`,htmlFor:`ca-depth`,children:(0,Y.jsxs)(B,{id:`ca-depth`,value:String(r.runtime.maxDelegationDepth),onChange:e=>O({runtime:{...r.runtime,maxDelegationDepth:Number(e.target.value)}}),className:`w-[200px]`,children:[(0,Y.jsx)(`option`,{value:`0`,children:`Never`}),(0,Y.jsx)(`option`,{value:`1`,children:`1 level`}),(0,Y.jsx)(`option`,{value:`2`,children:`2 levels`}),(0,Y.jsx)(`option`,{value:`3`,children:`3 levels`})]})}),(0,Y.jsx)(K,{label:`Budget per run`,help:`The most model tokens one run may use; it stops there. Empty: no limit.`,htmlFor:`ca-budget`,children:(0,Y.jsx)(V,{id:`ca-budget`,type:`number`,min:1e3,step:1e3,className:`w-[200px]`,value:r.runtime.maxTokens??``,placeholder:`No limit`,onChange:e=>{let{maxTokens:t,...n}=r.runtime;O({runtime:{...n,...e.target.value?{maxTokens:Math.max(0,Math.round(Number(e.target.value)))}:{}}})}})}),(0,Y.jsx)(K,{label:`Time limit per run`,help:`In minutes (1 to 1440): the longest one run may take; it stops there. Empty: no limit when someone is watching, 120 minutes when nobody is (a schedule, a trigger, another agent).`,htmlFor:`ca-minutes`,children:(0,Y.jsx)(V,{id:`ca-minutes`,type:`number`,min:1,max:1440,className:`w-[200px]`,value:r.runtime.maxMinutes??``,placeholder:`Minutes`,onChange:e=>{let{maxMinutes:t,...n}=r.runtime;O({runtime:{...n,...e.target.value?{maxMinutes:Math.max(1,Math.round(Number(e.target.value)))}:{}}})}})}),(0,Y.jsx)(K,{label:`Model`,help:`The model profile of llms.json its runs use. ForgeQE's choice: the model ForgeQE's agent would use.`,htmlFor:`ca-model`,children:(0,Y.jsxs)(B,{id:`ca-model`,value:r.runtime.model??``,className:`w-[200px]`,onChange:e=>{let{model:t,...n}=r.runtime;O({runtime:{...n,...e.target.value?{model:e.target.value}:{}}})},children:[(0,Y.jsx)(`option`,{value:``,children:`ForgeQE's choice`}),(s.models||[]).map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.model,`)`]},e.name)),r.runtime.model&&!(s.models||[]).some(e=>e.name===r.runtime.model)&&(0,Y.jsxs)(`option`,{value:r.runtime.model,children:[r.runtime.model,` (not in llms.json)`]})]})}),(0,Y.jsx)(q,{help:`On a schedule it runs the approved version with nobody watching: it does alone only what you tick under What it may do alone, and anything else waits for a person.`,children:`Runs by itself`}),(0,Y.jsx)(K,{label:`When`,children:(0,Y.jsx)(Ve,{label:`When`,value:On(r.schedule),onChange:ae,options:[{id:``,label:`Only when asked`},{id:`every`,label:`Every`},{id:`cron`,label:`On a cron schedule`}]})}),(0,Y.jsx)(K,{label:`Tell the team`,help:`How a run with nobody watching (on its schedule, a trigger, or started with --unattended) ended, on the notification channels that take custom agents' runs (Settings, Notifications).`,htmlFor:`ca-notify`,children:(0,Y.jsxs)(B,{id:`ca-notify`,value:r.runtime.notify??`failed`,className:`w-[200px]`,onChange:e=>{let{notify:t,...n}=r.runtime;O({runtime:{...n,...e.target.value===`failed`?{}:{notify:e.target.value}}})},children:[(0,Y.jsx)(`option`,{value:`failed`,children:`When it does not finish`}),(0,Y.jsx)(`option`,{value:`always`,children:`Each time it ends`}),(0,Y.jsx)(`option`,{value:`never`,children:`Never`})]})}),(s.channels||[]).length>0&&(0,Y.jsx)(K,{label:`Its notices go to`,help:`The notification channels its notices go to, each still only for the events it takes (Settings, Notifications). None ticked: every channel that takes them.`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.channels.map(e=>(0,Y.jsx)(Q,{checked:(r.runtime.channels||[]).includes(e.name),onChange:t=>O({runtime:{...r.runtime,channels:Z(r.runtime.channels||[],e.name,t)}}),help:e.on.some(e=>e.startsWith(`agent_`))?void 0:`It takes no custom agent's events: tick them for it in Settings, Notifications.`,children:e.name},e.name))})}),r.schedule&&(0,Y.jsxs)(Y.Fragment,{children:[On(r.schedule)===`every`?(0,Y.jsx)(K,{label:`Every`,help:`15m, 1h, 1d.`,htmlFor:`ca-every`,children:(0,Y.jsx)(V,{id:`ca-every`,value:r.schedule.every??``,placeholder:`30m`,spellCheck:!1,className:`max-w-[120px] font-mono`,onChange:e=>oe({every:e.target.value})})}):(0,Y.jsx)(K,{label:`Cron`,help:`Five fields, this machine's time: 0 7 * * 1-5 is weekdays at 07:00.`,htmlFor:`ca-cron`,children:(0,Y.jsx)(V,{id:`ca-cron`,value:r.schedule.cron??``,spellCheck:!1,className:`max-w-[180px] font-mono`,onChange:e=>oe({cron:e.target.value})})}),(0,Y.jsx)(K,{label:`Request`,help:`What it is asked each time it runs by itself. {name} uses one of its inputs, filled with the value below.`,htmlFor:`ca-request`,stacked:!0,children:(0,Y.jsx)(V,{id:`ca-request`,value:r.schedule.request,maxLength:500,placeholder:`Run the checkout pack on qa`,onChange:e=>oe({request:e.target.value})})}),en(r.schedule.request).map(e=>(r.inputs||[]).find(t=>t.name===e)).filter(e=>!!e).map(e=>(0,Y.jsx)(K,{label:e.label||`{${e.name}}`,help:`The value of {${e.name}} when it runs by itself.`,htmlFor:`ca-with-${e.name}`,children:(0,Y.jsx)(Nn,{id:`ca-with-${e.name}`,input:e,environments:r.scope.environments,value:r.schedule?.with?.[e.name]??``,onChange:t=>oe({with:{...r.schedule?.with||{},[e.name]:t}})})},e.name))]}),(0,Y.jsx)(q,{help:`Something that happens in ForgeQE, or a pull request or push on GitHub or Azure DevOps, can start its approved version too, with nobody watching. A schedule's name narrows it to that schedule; a custom agent's own schedules never start anything. A pull request or push needs the repository's webhook to reach ForgeQE, signed with the webhook secret (Settings, Secrets, FORGEQE_WEBHOOK_SECRET); the agent is told only the pull request's number, repository and branches, never its title or description.`,children:`Starts when something happens`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(r.triggers||[]).map((e,t)=>{let n=e=>O({triggers:(r.triggers||[]).map((n,r)=>r===t?{...n,...e}:n)});return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(B,{"aria-label":`Trigger ${t+1} event`,className:`w-[200px]`,value:e.on,onChange:t=>{let r=t.target.value,i=xn.includes(r);n({on:r,...r.startsWith(`job_`)?{}:{job:void 0},...i?{source:e.source||`github`}:{source:void 0,repo:void 0,branch:void 0}})},children:pn.map(e=>(0,Y.jsx)(`option`,{value:e,children:Sn[e]},e))}),xn.includes(e.on)&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(B,{"aria-label":`Trigger ${t+1} host`,className:`w-[200px]`,value:e.source||`github`,onChange:e=>n({source:e.target.value}),children:[(0,Y.jsx)(`option`,{value:`github`,children:`GitHub`}),(0,Y.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`})]}),(0,Y.jsx)(V,{"aria-label":`Trigger ${t+1} repository`,className:`w-[200px] font-mono`,maxLength:201,spellCheck:!1,value:e.repo??``,placeholder:e.source===`azure_devops`?`project/repository`:`owner/name`,onChange:e=>n({repo:e.target.value||void 0})}),(0,Y.jsx)(V,{"aria-label":`Trigger ${t+1}: which branch, empty for any`,className:`w-[140px] font-mono`,maxLength:200,spellCheck:!1,value:e.branch??``,placeholder:e.on===`push`?`any branch`:`any target`,onChange:e=>n({branch:e.target.value||void 0})})]}),e.on.startsWith(`job_`)&&(0,Y.jsx)(V,{"aria-label":`Trigger ${t+1}: which schedule, empty for any`,className:`w-[140px] font-mono`,maxLength:40,spellCheck:!1,value:e.job??``,placeholder:`any schedule`,onChange:e=>n({job:e.target.value||void 0})}),(0,Y.jsx)(V,{"aria-label":`Trigger ${t+1} request`,className:`min-w-0 flex-[1_1_280px]`,maxLength:500,value:e.request,placeholder:`What it is asked then (no {name}: nobody gives a value)`,onChange:e=>n({request:e.target.value})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Remove trigger ${t+1}`,"data-tip":`Remove trigger ${t+1}`,onClick:()=>{let e=(r.triggers||[]).filter((e,n)=>n!==t);O({triggers:e,...!e.length&&!r.schedule?{permissions:{...r.permissions,unattended:[]}}:{}})},children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},t)}),(r.triggers||[]).length<4&&(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>O({triggers:[...r.triggers||[],{on:`suite_failed`,request:``}]}),"data-tip":`Add a trigger`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]})]}),(r.schedule||(r.triggers||[]).length>0)&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{help:`With nobody watching, it does only these without asking. Anything else waits for a person: the team is told, and no answer in time is a no.`,children:`What it may do alone`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-4`,children:[An(r,s.systems,k(r)).length===0&&(0,Y.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Only reading: allow more under What it may do, or pick Systems it works with, first.`}),An(r,s.systems,k(r)).map(e=>(0,Y.jsx)(Q,{checked:e.ids.every(e=>(r.permissions.unattended||[]).includes(e)),onChange:t=>ie({unattended:t?[...new Set([...r.permissions.unattended||[],...e.ids])]:(r.permissions.unattended||[]).filter(t=>!e.ids.includes(t))}),children:e.label},e.key))]})]}),(0,Y.jsx)(q,{help:`One per line: what it should keep in mind. Guidance for the model, never a limit.`,children:`Guidance`}),(0,Y.jsx)(Se,{"aria-label":`Guidance, one per line`,rows:3,value:r.policies.join(`
|
|
3
3
|
`),onChange:e=>O({policies:e.target.value.split(`
|
|
4
4
|
`).map(e=>e.slice(0,300))})}),(0,Y.jsx)(q,{help:`What its starters and its schedule leave open, at most 6. Write {name} in a starter or the schedule's request (not a trigger's: nobody is there to give the value); its page asks for the value (one line of text, or a pick from its list) before the starter fills the message.`,children:`Inputs`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(r.inputs||[]).map((e,t)=>{let n=e=>O({inputs:(r.inputs||[]).map((n,r)=>r===t?{...n,...e}:n)});return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Input ${t+1} name`,className:`w-[140px] font-mono`,maxLength:32,spellCheck:!1,value:e.name,placeholder:`name`,onChange:e=>n({name:e.target.value.toLowerCase()})}),(0,Y.jsx)(V,{"aria-label":`Input ${t+1} label`,className:`w-[200px]`,maxLength:40,value:e.label,placeholder:`Label`,onChange:e=>n({label:e.target.value})}),(0,Y.jsx)(B,{"aria-label":`Input ${t+1} kind`,className:`w-[200px]`,value:e.kind,onChange:t=>{let r=t.target.value;n(r===`choice`?{kind:r,options:e.options||[]}:{kind:r,options:void 0})},children:Zt.map(e=>(0,Y.jsx)(`option`,{value:e,children:Cn[e]},e))}),e.kind===`choice`&&(0,Y.jsx)(Mn,{label:`Input ${t+1} options, separated by commas`,options:e.options||[],onChange:e=>n({options:e})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Remove input ${t+1}`,"data-tip":`Remove input ${t+1}`,onClick:()=>O({inputs:(r.inputs||[]).filter((e,n)=>n!==t)}),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},t)}),(r.inputs||[]).length<6&&(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>O({inputs:[...r.inputs||[],{name:``,label:``,kind:`text`}]}),"data-tip":`Add an input`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsx)(q,{help:`Requests its page offers to start from (at most ${yn}). {name} uses one of its inputs.`,children:`Starters`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[r.starters.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Starter ${t+1} label`,className:`w-[200px]`,maxLength:40,value:e.label,placeholder:`Label`,onChange:e=>O({starters:r.starters.map((n,r)=>r===t?{...n,label:e.target.value}:n)})}),(0,Y.jsx)(V,{"aria-label":`Starter ${t+1} request`,className:`min-w-0 flex-[1_1_280px]`,maxLength:500,value:e.text,placeholder:`The request`,onChange:e=>O({starters:r.starters.map((n,r)=>r===t?{...n,text:e.target.value}:n)})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Remove starter ${t+1}`,"data-tip":`Remove starter ${t+1}`,onClick:()=>O({starters:r.starters.filter((e,n)=>n!==t)}),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},t)),r.starters.length<yn&&(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>O({starters:[...r.starters,{label:``,text:``}]}),"data-tip":`Add a starter`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsx)(q,{help:`Short facts it keeps between runs with its remember tool and reads back with recall: what it found, never instructions. You can read and forget them on its page, under Details, Memory.`,children:`Memory`}),(0,Y.jsx)(K,{label:`Notes it keeps`,htmlFor:`ca-notes`,help:`At most 200; past that the oldest go. None: it starts every run knowing only its manifest.`,children:(0,Y.jsxs)(B,{id:`ca-notes`,className:`w-[200px]`,value:String(r.memory?.notes||0),onChange:e=>O({memory:Number(e.target.value)?{notes:Number(e.target.value)}:void 0}),children:[(0,Y.jsx)(`option`,{value:`0`,children:`No memory`}),[20,50,100,200].map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Up to `,e,` notes`]},e)),r.memory&&![20,50,100,200].includes(r.memory.notes)&&(0,Y.jsxs)(`option`,{value:r.memory.notes,children:[`Up to `,r.memory.notes,` notes`]})]})}),(0,Y.jsx)(q,{help:`Who approves a version before it runs. ForgeQE knows a person by git's user name on their computer, so this is an agreement the history keeps, not a sign-in. A change is approved under the stricter of this and the version that runs.`,children:`Approval`}),(0,Y.jsx)(K,{label:`People who approve`,htmlFor:`ca-people`,help:`How many different people approve a version. Each but the last signs it; it runs once the last approves.`,children:(0,Y.jsx)(B,{id:`ca-people`,className:`w-[200px]`,value:String(r.approval?.people||1),onChange:e=>O({approval:{people:Number(e.target.value),owners:r.approval?.owners||[]}}),children:[1,2,3].map(e=>(0,Y.jsx)(`option`,{value:e,children:e===1?`One person`:`${e} different people`},e))})}),(0,Y.jsx)(K,{label:`Who may approve`,htmlFor:`ca-owners`,help:`People's names as git knows them (user.name, or user.email). None: anyone who can approve agents in this project.`,children:(0,Y.jsx)(Mn,{id:`ca-owners`,label:`Who may approve, separated by commas`,placeholder:`Ann Lee, Bo Chen`,max:20,options:r.approval?.owners||[],onChange:e=>O({approval:{people:r.approval?.people||1,owners:e}})})}),(0,Y.jsx)(q,{help:`Requests to try it on before it is approved, at most 8: forgeqe agent test runs them on the manifest as it is and grades each by code from the run (how it ended, words its reply holds or not, tools it used or never called). A version whose checks have not all passed is approved only when a person says so.`,children:`Checks`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 py-2`,children:[(r.checks||[]).map((e,t)=>{let n=e=>O({checks:(r.checks||[]).map((n,r)=>r===t?{...n,...e}:n)}),i=t=>n({expect:{...e.expect,...t}});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Check ${t+1} name`,className:`w-[200px] font-mono`,maxLength:40,spellCheck:!1,value:e.name,placeholder:`basket-total`,onChange:e=>n({name:e.target.value.toLowerCase()})}),(0,Y.jsx)(V,{"aria-label":`Check ${t+1} request`,className:`min-w-0 flex-[1_1_280px]`,maxLength:500,value:e.request,placeholder:`The request it is tried on`,onChange:e=>n({request:e.target.value})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Remove check ${t+1}`,"data-tip":`Remove check ${t+1}`,onClick:()=>O({checks:(r.checks||[]).filter((e,n)=>n!==t)}),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pl-6`,children:[(0,Y.jsxs)(B,{"aria-label":`Check ${t+1} ends`,className:`w-[200px]`,value:e.expect.outcome,onChange:e=>i({outcome:e.target.value}),children:[(0,Y.jsx)(`option`,{value:`done`,children:`Ends done`}),(0,Y.jsx)(`option`,{value:`needs_input`,children:`Ends needing a person`}),(0,Y.jsx)(`option`,{value:`failed`,children:`Ends failed`})]}),(0,Y.jsx)(Mn,{label:`Check ${t+1}: words its reply says, separated by commas`,placeholder:`Its reply says…`,max:16,options:e.expect.says,onChange:e=>i({says:e})}),(0,Y.jsx)(Mn,{label:`Check ${t+1}: words its reply never says, separated by commas`,placeholder:`…and never says`,max:16,options:e.expect.neverSays,onChange:e=>i({neverSays:e})}),(0,Y.jsx)(Mn,{label:`Check ${t+1}: tools it uses, separated by commas`,placeholder:`Tools it uses`,max:16,mono:!0,options:e.expect.uses,onChange:e=>i({uses:e})}),(0,Y.jsx)(Mn,{label:`Check ${t+1}: tools it never calls, separated by commas`,placeholder:`Tools it never calls`,max:16,mono:!0,options:e.expect.neverUses,onChange:e=>i({neverUses:e})}),(r.output?.verdicts.length||0)>0&&(0,Y.jsxs)(B,{"aria-label":`Check ${t+1} verdict`,className:`w-[200px]`,value:e.expect.verdict||``,onChange:e=>i({verdict:e.target.value||void 0}),children:[(0,Y.jsx)(`option`,{value:``,children:`Any verdict`}),r.output.verdicts.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Verdict `,e]},e))]})]})]},t)}),(r.checks||[]).length<8&&(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>O({checks:[...r.checks||[],{name:``,request:``,expect:{outcome:`done`,says:[],neverSays:[],uses:[],neverUses:[]}}]}),"data-tip":`Add a check`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsx)(q,{help:`What its reply ends with, read by ForgeQE, not by a model: a verdict of your words (at most 8) and named values (at most 12). Each run keeps them, checks can expect a verdict, a verdict you count as a failure tells the team as a failure, and forgeqe agent run exits 1 on it.`,children:`Output`}),(0,Y.jsx)(K,{label:`Verdicts`,htmlFor:`ca-verdicts`,help:`Words for how a run came out, such as passed, failed, blocked. Lower-case letters, digits and underscores.`,children:(0,Y.jsx)(Mn,{id:`ca-verdicts`,label:`Verdicts, separated by commas`,placeholder:`passed, failed, blocked`,max:8,mono:!0,options:r.output?.verdicts||[],onChange:e=>O({output:{verdicts:e,failOn:(r.output?.failOn||[]).filter(t=>e.includes(t)),fields:r.output?.fields||[]}})})}),(r.output?.verdicts.length||0)>0&&(0,Y.jsx)(K,{label:`Counts as a failure`,help:`A run with one of these verdicts, or with none, tells the team as a failure. Its checks still grade what they expect.`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.output.verdicts.map(e=>(0,Y.jsx)(Q,{checked:r.output.failOn.includes(e),onChange:t=>O({output:{...r.output,failOn:Z(r.output.failOn,e,t)}}),children:e},e))})}),(0,Y.jsx)(K,{label:`Fields`,stacked:!0,help:`Named values its reply reports, each of a kind. Leave a field out of the reply when it could not be found out.`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(r.output?.fields||[]).map((e,t)=>{let n=r.output||{verdicts:[],failOn:[],fields:[]},i=e=>O({output:{...n,fields:n.fields.map((n,r)=>r===t?{...n,...e}:n)}});return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(V,{"aria-label":`Field ${t+1} name`,className:`w-[200px] font-mono`,maxLength:40,spellCheck:!1,value:e.name,placeholder:`defects_found`,onChange:e=>i({name:e.target.value.toLowerCase()})}),(0,Y.jsx)(B,{"aria-label":`Field ${t+1} kind`,className:`w-[200px]`,value:e.kind,onChange:e=>i({kind:e.target.value}),children:hn.map(e=>(0,Y.jsx)(`option`,{value:e,children:bn[e]},e))}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,"aria-label":`Remove field ${t+1}`,"data-tip":`Remove field ${t+1}`,onClick:()=>O({output:{...n,fields:n.fields.filter((e,n)=>n!==t)}}),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},t)}),(r.output?.fields.length||0)<12&&(0,Y.jsxs)(U,{size:`sm`,className:`self-start`,onClick:()=>O({output:{verdicts:r.output?.verdicts||[],failOn:r.output?.failOn||[],fields:[...r.output?.fields||[],{name:``,kind:`text`}]}}),"data-tip":`Add a field`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Add`]})]})}),b.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-advice`,className:`mt-6 flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`ca-advice`,className:`m-0 text-base font-semibold`,children:`What it still needs`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:b.map((e,t)=>(0,Y.jsxs)(`li`,{className:F(`flex flex-col gap-1 rounded-[12px] px-4 py-4 text-sm`,e.blocking?`bg-warn-soft`:`bg-surface-muted`),children:[(0,Y.jsx)(`span`,{className:F(`font-medium`,e.blocking?`text-warn`:`text-ink`),children:e.about}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.why}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.fix})]},t))})]}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 mt-4 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,Y.jsx)(`div`,{role:`status`,className:`min-w-0 flex-[1_1_320px] text-[13px]`,children:S?(0,Y.jsx)(`span`,{className:`text-muted`,children:`Checking…`}):le.length?(0,Y.jsxs)(`ul`,{className:`m-0 list-disc pl-6 text-fail [overflow-wrap:anywhere]`,children:[le.slice(0,4).map((e,t)=>(0,Y.jsx)(`li`,{children:e},t)),le.length>4&&(0,Y.jsxs)(`li`,{children:[`and `,le.length-4,` more`]})]}):(0,Y.jsx)(`span`,{className:`text-pass`,children:`Ready to save. It can be tried once saved.`})}),(0,Y.jsx)(`a`,{href:fe,className:`text-sm`,children:`Cancel`}),(0,Y.jsxs)(U,{variant:`primary`,disabled:ee||!r.id||!r.name||ce.length>0,onClick:()=>void de(),"data-tip":n?`Save the agent`:`Save changes`,children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Save`]})]})]})]})]})}function Fn({id:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),s=(0,J.useCallback)(()=>{R.view(e).then(e=>{de([{id:e.id,icon:e.icon}]),n(e),i(``)},e=>i(e.message))},[e]);(0,J.useEffect)(()=>s(),[s]);let[c,l]=(0,J.useState)(null);return le.test(e)?(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[t?(0,Y.jsx)(Rn,{view:t,detailsOpen:a,onDetails:o}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`header`,{className:`flex items-center gap-1 px-6 py-4 short:py-2`,children:[(0,Y.jsx)(Be,{}),(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex min-h-9 items-center gap-2 text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]})]}),(0,Y.jsx)(`main`,{className:`flex flex-auto flex-col items-center justify-center px-6 py-10`,children:r?(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}):(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})})]}),t&&c&&(0,Y.jsx)(cr,{view:t,action:c.action,to:c.to,onClose:()=>l(null),onDone:e=>{`deleted`in e?(l(null),location.hash=D(`agents`,`category`,`custom`)):(n(e),l(null))}}),t&&(0,Y.jsx)(Jn,{view:t,open:a,onClose:()=>o(!1),onAct:l,onReload:s})]}):(0,Y.jsx)(In,{})}function In(){return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(`header`,{className:`flex items-center gap-1 px-6 py-4`,children:(0,Y.jsx)(Be,{})}),(0,Y.jsxs)(`p`,{className:`m-0 px-6 py-10 text-sm text-muted`,children:[`There is no such agent. `,(0,Y.jsx)(`a`,{href:D(`agents`),children:`See every agent`}),`.`]})]})}var Ln=e=>e.length?e.join(`, `):`none`;function Rn({view:e,detailsOpen:n,onDetails:r}){let i=rt(),a=[...e.problems.working,...e.problems.active,...e.problems.other],s=e.state===`active`||e.state===`changed`,c=!!e.working,l=pt[e.state],[u,d]=(0,J.useState)(e.starters[0]&&!en(e.starters[0].text).length?e.starters[0].text:``),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)({}),_=(e.active||e.working)?.environments||[];(0,J.useEffect)(()=>m(null),[e.active?.digest,e.working?.digest]);let[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[ee,T]=(0,J.useState)(!0),[te,ne]=(0,J.useState)(!1),[O,re]=(0,J.useState)(!1),k=mt(),{setup:A}=k,j=`custom-agent-${e.id}`,M=nt(u,e=>{d(e),y(``)},j,{code:k.tools.code}),N=Ze(`custom-${e.id}`,e=>{d(e),qe(j)}),ie=async()=>{x(``);try{let t=await R.pack(e.id),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.id}.forgeqe-agent.zip`,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3),T(!0),x(`Zip downloaded. A teammate imports it as a draft, then edits and approves it.`)}catch(e){T(!1),x(e.message)}},ae=async()=>{if(!te){ne(!0),x(``);try{let t=await R.duplicate(e.id);location.hash=D(`agents`,`custom`,t.id,`edit`)}catch(e){T(!1),x(e.message),ne(!1)}}},oe=async(t,n=u)=>{if(!(O||!n.trim()&&!M.hasFiles)&&(t||s)&&(!t||c)){re(!0),y(``);try{let r=await M.wrap(n.trim());if(!r.trim()){re(!1);return}let{id:i}=await be.start(r,{...k.choice,agent:e.id,...t||!s?{try:!0}:{}});M.reset({keep:!0}),location.hash=D(`chats`,i)}catch(e){y(e.message),re(!1)}}},se=!s&&!c,ce=(s?e.active:e.working)?.model;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`header`,{className:`flex items-center gap-1 px-6 py-4 short:py-2`,children:[(0,Y.jsx)(Be,{}),(0,Y.jsxs)(`a`,{href:D(`agents`,`category`,`custom`),className:`inline-flex min-h-9 items-center gap-2 text-sm`,children:[(0,Y.jsx)(w,{size:16,"aria-hidden":`true`}),`Custom agents`]}),(0,Y.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,Y.jsx)(H,{tone:l.tone,children:l.label}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,onClick:()=>void ae(),disabled:te||e.state===`invalid`,"aria-label":e.state===`invalid`?`Duplicate (fix its manifest first)`:`Duplicate`,"data-tip":e.state===`invalid`?`Duplicate (fix its manifest first)`:`Duplicate`,children:(0,Y.jsx)(t,{size:18,"aria-hidden":`true`})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,onClick:()=>void ie(),"aria-label":`Export to share`,"data-tip":`Export to share`,children:(0,Y.jsx)(E,{size:18,"aria-hidden":`true`})}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,onClick:()=>r(!n),"aria-label":`Details`,"aria-pressed":n,"data-tip":`Details`,children:(0,Y.jsx)(C,{size:18,"aria-hidden":`true`})}),(0,Y.jsx)(`a`,{href:D(`agents`,`custom`,e.id,`edit`),className:F(we({variant:`icon`,size:`icon`}),`no-underline`),"aria-label":`Edit`,"data-tip":`Edit`,children:(0,Y.jsx)(f,{size:18,"aria-hidden":`true`})})]})]}),(0,Y.jsx)(`main`,{className:`flex flex-auto flex-col items-center justify-center px-6 pt-6 pb-30 short:pt-0 short:pb-8`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-[780px] flex-col items-center gap-10 short:gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center short:gap-2`,children:[(0,Y.jsx)(Me,{agent:e.id,icon:e.icon,px:i?64:96,decorative:!0,working:O,className:`mb-1`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[31px] leading-tight font-semibold tracking-[-0.015em] text-ink short:text-[25px] [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:e.description||(s?`Ask ${P(e.name)}. It runs version ${e.approvedVersion}, within its limits.`:e.state===`drifted`?`${e.name} ${e.approvedVersion} does not run until a person approves it again: what it knows changed. A try runs its manifest as it is.`:c?`Try ${P(e.name)}. It has no approved version yet: a try runs its manifest as it is.`:`Fix ${P(e.name)}'s manifest before it can be tried or approved.`)})]}),b&&(0,Y.jsx)(`p`,{role:`status`,className:F(`m-0 -mt-4 text-center text-[13px]`,ee?`text-muted`:`text-fail`),children:b}),a.length>0&&(0,Y.jsxs)(`div`,{role:`alert`,className:`flex w-full flex-col gap-1 rounded-[12px] bg-fail-soft px-4 py-4 text-left text-sm text-fail`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:e.state===`invalid`?`Its manifest needs fixing before it can be tried or approved:`:`It cannot run as it is:`}),(0,Y.jsx)(`ul`,{className:`m-0 list-disc pl-6 [overflow-wrap:anywhere]`,children:a.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))})]}),e.manifestText!==void 0&&(0,Y.jsx)(Yt,{text:e.manifestText,file:e.manifestFile||``}),(0,Y.jsx)(Wn,{agent:e.id}),e.state===`drifted`&&e.drift&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-drift`,role:`alert`,className:`flex w-full flex-col gap-2 rounded-[12px] bg-warn-soft px-4 py-4 text-left text-sm`,children:[(0,Y.jsxs)(`h2`,{id:`ca-drift`,className:`m-0 text-[13px] font-semibold text-warn`,children:[`What `,e.approvedVersion,` knows changed since it was approved`]}),(0,Y.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-ink-2`,children:e.drift.map(e=>(0,Y.jsx)(`li`,{children:e},e))}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`It does not run (for you, your team, Atlas, its schedule or another agent) until a person reads the change and approves it again`,e.working?` under Details, Versions`:`: its manifest was removed, so put it back first`,`.`,e.changes.length>0?` Its manifest was also changed since: that change is below, and approving takes it too.`:``]})]}),e.changes.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-changes`,className:`flex w-full flex-col gap-2 text-left`,children:[(0,Y.jsxs)(`h2`,{id:`ca-changes`,className:`m-0 text-[13px] font-semibold text-muted`,children:[`Changed since `,e.approvedVersion,` was approved`]}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[e.state===`changed`?`The approved version keeps running until this change is approved.`:`Approving takes this change too.`,` Approve or discard it under Details, Versions.`]}),(0,Y.jsx)(kt,{diff:e.changes})]}),se?(0,Y.jsx)(`p`,{className:`m-0 text-center text-sm text-muted`,children:e.manifestText===void 0?`See what is wrong above, or Edit the agent.`:`Fix what is listed above in its file, then come back.`}):(0,Y.jsxs)(Y.Fragment,{children:[A&&!A.ready&&(0,Y.jsx)(ct,{project:A.project}),A?.ready&&(0,Y.jsx)(xt,{c:k}),(0,Y.jsx)(He,{id:j,label:`Message ${P(e.name)}`,value:u,onChange:e=>{d(e),y(``)},onSend:()=>void oe(!s),disabled:O||!!A&&!A.ready||N.running,canSend:!!u.trim()||M.hasFiles,onEdit:M.onEdit,onKey:M.onKeyDown,onFiles:M.onFiles,dropping:M.dropping,drop:M.drop,mentions:M.mentions,combo:M.combo,placeholder:`Ask ${P(e.name)} to…`,top:(0,Y.jsxs)(Y.Fragment,{children:[M.chips,N.state&&(0,Y.jsx)(Ue,{state:N.state,onStop:()=>void N.stop(),onUndo:N.undo,onClose:N.close})]}),left:(0,Y.jsxs)(Y.Fragment,{children:[M.fileInput,(0,Y.jsx)(ft,{attach:{pick:M.pick},choice:k}),(0,Y.jsx)(Re,{running:N.running,disabled:!u.trim()||O||!!A&&!A.ready,onClick:()=>void N.start(u)})]}),right:ce?(0,Y.jsxs)(U,{variant:`ghost`,className:`max-w-[46vw] min-w-0 px-2 text-[16px] sm:px-2`,disabled:!0,"aria-label":`Model: ${ce}, as its manifest says`,"data-tip":`It runs on ${ce}, as its manifest says${s&&c&&e.working?.model!==ce?`; a try runs on ${e.working?.model||`ForgeQE's choice`}`:``}`,children:[(0,Y.jsx)(S,{"aria-hidden":`true`,className:`size-4`}),(0,Y.jsx)(`span`,{className:`hidden truncate sm:inline`,children:ce})]}):(0,Y.jsx)(ot,{c:k})}),(0,Y.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:F(`-mt-6 m-0 text-center text-sm text-ink-2 short:-mt-4`,!(v||M.error)&&`sr-only`),children:(0,Y.jsx)(`span`,{className:M.error&&!v?`text-fail`:``,children:v||M.error||``})}),p&&(0,Y.jsx)(zn,{starter:p,inputs:e.inputs||[],environments:_,values:h,onChange:g,onUse:e=>{d(e),m(null),document.getElementById(j)?.focus()},onCancel:()=>{let t=e.starters.findIndex(e=>e.label===p.label);m(null),t>=0&&requestAnimationFrame(()=>document.getElementById(`${j}-starter-${t}`)?.focus())}},p.label),(0,Y.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-4`,children:[e.starters.map((e,t)=>(0,Y.jsx)(U,{id:`${j}-starter-${t}`,"aria-expanded":en(e.text).length?p?.label===e.label:void 0,onClick:()=>{y(``),en(e.text).length?(m(p?.label===e.label?null:e),g({})):(m(null),d(e.text),document.getElementById(j)?.focus())},children:e.label},e.label)),s&&c&&(0,Y.jsxs)(U,{disabled:O||!u.trim(),onClick:()=>void oe(!0),"data-tip":`Try the manifest`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Try`]})]})]}),(0,Y.jsx)(Un,{view:e}),(0,Y.jsx)(Bn,{view:e})]})})]})}function zn({starter:e,inputs:t,environments:n,values:r,onChange:i,onUse:a,onCancel:o}){let s=en(e.text),c=s.map(e=>t.find(t=>t.name===e)).filter(e=>!!e),l=s.filter(e=>!t.some(t=>t.name===e)),[u,d]=(0,J.useState)(``),f=(0,J.useId)();(0,J.useEffect)(()=>{c[0]?document.getElementById(`starter-${c[0].name}`)?.focus():document.getElementById(f)?.focus()},[e.label]);let p=()=>{try{a(nn(e.text,t,r,n))}catch(e){d(e.message)}};return(0,Y.jsxs)(`form`,{"aria-label":`Values for ${e.label}`,className:`flex w-full flex-col gap-4 rounded-[12px] card border px-4 py-4 text-left`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),o())},onSubmit:e=>{e.preventDefault(),p()},children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:e.label}),c.map(e=>(0,Y.jsxs)(`label`,{htmlFor:`starter-${e.name}`,className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-sm`,children:[(0,Y.jsx)(`span`,{className:`min-w-[140px] text-ink-2`,children:e.label}),(0,Y.jsx)(Nn,{id:`starter-${e.name}`,input:e,environments:n,value:r[e.name]??``,onChange:t=>(i({...r,[e.name]:t}),d(``))})]},e.name)),l.length>0&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:l.map(e=>`{${e}} is not one of its inputs, so this starter cannot be filled. Edit the agent.`).join(` `)}),u&&!l.length&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:u}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Y.jsx)(U,{type:`submit`,variant:`primary`,size:`sm`,children:`Use`}),(0,Y.jsx)(U,{id:f,type:`button`,variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`})]})]})}function Bn({view:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let t=!1;return be.list().then(r=>!t&&n(ht(r.chats.filter(t=>t.agent===e.id))),e=>!t&&(i(e.message),n([]))),()=>{t=!0}},[e.id,e.runs.length]);let s=t?a?t:t.slice(0,Vn):[];return(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-conversations`,className:`flex w-full flex-col gap-2 text-left`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`h2`,{id:`ca-conversations`,className:`m-0 flex-1 text-[13px] font-semibold text-muted`,children:`Conversations`}),t&&t.length>Vn&&(0,Y.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>o(!a),"aria-expanded":a,children:a?`Fewer`:`All ${t.length} conversations`})]}),r&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),t===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Reading the conversations…`}):t.length===0?!r&&(0,Y.jsxs)(G,{className:`py-4`,children:[`No conversations with `,P(e.name),` yet. Ask it above to start one.`]}):(0,Y.jsx)(`div`,{className:`@container rounded-[12px] card border`,children:(0,Y.jsx)(`ul`,{"aria-label":`Conversations with ${P(e.name)}`,className:`m-0 flex list-none flex-col p-2`,children:s.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(lt,{c:e})},e.id))})})]})}var Vn=5;function Hn({view:e,onDone:t}){let n=e.memory?.kept||[],[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),d=(0,J.useId)(),f=()=>{i(!1),o(``),setTimeout(()=>document.getElementById(d)?.focus(),0)},p=async n=>{c(!0),u(``);try{await R.forget(e.id,n),i(!1),o(``),t()}catch(e){u(e.message)}finally{c(!1)}};return(0,Y.jsxs)(Yn,{id:`ca-memory`,title:`Memory · ${n.length} of ${e.memory?.notes||n.length} notes`,aside:n.length>0&&!r?(0,Y.jsxs)(U,{id:d,size:`sm`,variant:`danger`,onClick:()=>i(!0),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),`Forget all`]}):void 0,children:[r&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-warn-soft px-4 py-4 text-sm`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-2`,children:[(0,Y.jsxs)(`span`,{children:[`Type `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.id}),` to forget all `,n.length,` notes`]}),(0,Y.jsx)(V,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Y.jsx)(U,{variant:`ghost`,onClick:f,children:`Cancel`}),(0,Y.jsx)(U,{variant:`destructive`,disabled:s||a!==e.id,onClick:()=>void p({all:!0,confirm:a}),children:`Forget all`})]}),l&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:l}),n.length===0?(0,Y.jsxs)(G,{className:`py-4`,children:[P(e.name,!0),` has noted nothing yet. It keeps short facts it finds, to recall in later runs.`]}):(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:n.map((e,t)=>(0,Y.jsxs)(`li`,{className:F(`flex items-start gap-2 px-4 py-2 text-[13px]`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e.text}),(0,Y.jsx)(`span`,{className:`flex-none text-muted tabular-nums`,children:ut(e.at)}),(0,Y.jsx)(U,{variant:`icon`,size:`icon`,disabled:s,"aria-label":`Forget note ${t+1}`,"data-tip":`Forget this note (cannot be undone)`,onClick:()=>void p({at:e.at,text:e.text}),children:(0,Y.jsx)(M,{"aria-hidden":`true`})})]},`${e.at}-${t}`))})]})}function Un({view:e}){let t=e.capabilities;if(!t.length)return null;let n=t.some(e=>e.state===`needs_setup`)?`needs_setup`:t.some(e=>e.state===`partial`)?`partial`:`ready`,r=n===`ready`?`pass`:n===`partial`?`warn`:`neutral`,i=n===`ready`?`Ready`:n===`partial`?`Partly set up`:`Needs setup`,a=t.filter(e=>e.state!==`ready`);return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-6 pt-2 text-left`,children:[a.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-needs`,className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h2`,{id:`ca-needs`,className:`m-0 text-[13px] font-semibold text-muted`,children:`What it needs`}),(0,Y.jsx)(H,{tone:r,children:i})]}),(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:n===`needs_setup`?`${P(e.name,!0)} cannot work until these are set up.`:`${P(e.name,!0)} works, without the parts below.`}),(0,Y.jsx)(`ul`,{"aria-label":`What ${P(e.name)} needs`,className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:a.map((e,t)=>(0,Y.jsxs)(`li`,{className:F(`flex items-center gap-4 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(W,{icon:qn[e.state].icon,size:16,className:F(`flex-none`,qn[e.state].cls)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.title}),(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.gaps.join(`; `)||qn[e.state].label})]})]},e.id))})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-caps`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`ca-caps`,className:`m-0 text-[13px] font-semibold text-muted`,children:`What it can use`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:t.map((e,t)=>{let n=qn[e.state];return(0,Y.jsxs)(`li`,{className:F(`flex items-start gap-4 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(W,{icon:n.icon,size:16,className:F(`mt-1 flex-none`,n.cls)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.title}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[n.label,e.gaps.length?`: ${e.gaps.join(`; `)}`:``]})]})]},e.id)})})]})]})}function Wn({agent:e}){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),s=(0,J.useCallback)(()=>{ge.list().then(t=>n(t.approvals.filter(t=>t.agent===e&&t.state===`waiting`)),()=>{})},[e]);if((0,J.useEffect)(()=>{s();let e=tt(s,15e3);return()=>Fe(e)},[s]),!t.length)return null;let c=async(t,n)=>{i(t.id),o(``);try{await ge.answer(e,t.id,n),s()}catch(e){o(e.message)}finally{i(``)}};return(0,Y.jsxs)(`section`,{"aria-labelledby":`ca-waiting`,className:`flex w-full flex-col gap-2 rounded-[14px] border border-warn bg-warn-soft p-4 text-left`,children:[(0,Y.jsx)(`h2`,{id:`ca-waiting`,className:`m-0 text-base font-semibold text-warn`,children:`Waiting for you`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-start gap-4 rounded-[12px] bg-bg px-4 py-4`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:e.title}),e.detail&&(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.detail}),(e.lines||[]).map((e,t)=>(0,Y.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t)),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Asked `,ut(e.createdAt),`; no answer by `,e.until.slice(0,16).replace(`T`,` `),` UTC is a no.`]})]}),(0,Y.jsxs)(`span`,{className:`flex gap-2`,children:[(0,Y.jsxs)(U,{size:`sm`,variant:`primary`,disabled:!!r,onClick:()=>void c(e,`allow`),children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Allow`]}),e.forRun&&(0,Y.jsxs)(U,{size:`sm`,variant:`outline`,disabled:!!r,onClick:()=>void c(e,`allow_run`),"data-tip":`Allow for the rest of this run`,children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Allow run`]}),(0,Y.jsxs)(U,{size:`sm`,variant:`ghost`,disabled:!!r,onClick:()=>void c(e,`deny`),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Deny`]})]})]},e.id))}),a&&(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:a})]})}var Gn={approved:`Approved`,signed:`Signed`,disabled:`Disabled`,enabled:`Enabled`,"rolled-back":`Rolled back to`};function Kn(e){let t=/\s*\(web\)$/i.test(e),n=e.replace(/\s*\(web\)$/i,``).trim(),r=/^(?:\d+\+)?([^@\s]+)@users\.noreply\.github\.com$/i.exec(n);return r?n=r[1]:n.includes(`@`)&&n.length>24&&(n=n.slice(0,n.indexOf(`@`))),t?`${n} · web`:n}var qn={ready:{icon:c,label:`Ready`,cls:`text-pass`},partial:{icon:l,label:`Partly set up`,cls:`text-warn`},needs_setup:{icon:v,label:`Needs setup`,cls:`text-muted`}};function Jn({view:e,open:t,onClose:n,onAct:r,onReload:i}){let a=e.active||e.working,o=!!e.working&&(e.state===`draft`||e.state===`changed`||e.state===`drifted`||e.state===`broken`&&e.working!==void 0);return(0,Y.jsx)(Ke,{open:t,onClose:n,wide:!0,title:`Details`,description:`${e.name} · ${e.id}`,footer:(0,Y.jsxs)(U,{variant:`ghost`,onClick:n,children:[(0,Y.jsx)(h,{"aria-hidden":`true`}),`Close`]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a&&(0,Y.jsx)(Xn,{spec:a,view:e}),(e.checkResults||[]).length>0&&(0,Y.jsx)(er,{view:e,onDone:i}),((e.memory?.notes||0)>0||(e.memory?.kept.length||0)>0)&&(0,Y.jsx)(Hn,{view:e,onDone:i}),(0,Y.jsx)(Zn,{view:e,approvable:o,onAct:r}),(0,Y.jsx)(or,{view:e})]})})}function Yn({id:e,title:t,children:n,aside:r}){return(0,Y.jsxs)(`section`,{"aria-labelledby":e,className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`h2`,{id:e,className:`m-0 flex-1 text-[13px] font-semibold text-muted`,children:t}),r]}),n]})}function Xn({spec:e,view:t}){let n=(t.active?t.describe?.active:t.describe?.working)||[],r=[...n.length?n.map(n=>[n.label,n.label===`Agents it may start`?Ln(e.agents.map(e=>t.agentNames[e]||e)):n.text]):[[`Environments`,Ln(e.environments)],[`Agents it may start`,Ln(e.agents.map(e=>t.agentNames[e]||e))],[`It may`,Ln(e.actions.map(e=>Qn[e]||e))],[`A person approves first`,Ln(e.approve.map(e=>Qn[e]||e))],[`Repository`,e.repository===`write`?`may change files`:`read only`]],...n.some(e=>e.label===`Runs by itself`)?[]:[[`Runs by itself`,e.schedule?`${e.schedule.every?`every ${e.schedule.every}`:`at ${e.schedule.cron}`}: “${e.schedule.request}”`:`no: you, your team or Atlas start it`]],[`Skills`,Ln(e.skills)],[`Knowledge`,Ln(e.knowledge)]];return(0,Y.jsxs)(Yn,{id:`ca-reach`,title:t.active?`What version ${t.approvedVersion} may reach`:`What its manifest may reach`,children:[(0,Y.jsx)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-2 rounded-[12px] card border px-4 py-4 text-sm sm:grid-cols-[160px_1fr]`,children:r.map(([e,t])=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Y.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:t})]},e))}),e.policies.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Guidance it is given (not a limit): `,e.policies.join(`; `)]})]})}function Zn({view:e,approvable:t,onAct:n}){let[r,i]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),s(null);try{let t=await R.library.publish(e.id);s({ok:!0,text:`Published ${e.approvedVersion} to your library: another project on this computer installs it from Import.${t.warnings.length?` ${t.warnings.join(`; `)}.`:``}`})}catch(e){s({ok:!1,text:e.message})}finally{u(!1)}};return(0,Y.jsxs)(Y.Fragment,{children:[r&&(0,Y.jsx)(nr,{view:e,at:r.ref,canGoBack:r.canGoBack,onClose:()=>i(null),onAct:n}),(0,Y.jsxs)(Yn,{id:`ca-versions`,title:`Versions`,aside:(0,Y.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[t&&(e.approval?.signed.length||0)>0&&(0,Y.jsxs)(`span`,{className:`self-center text-[13px] text-muted`,children:[`Signed by `,e.approval.signed.map(e=>e.by).join(`, `),`; needs `,e.approval.people-e.approval.signed.length,` more`]}),t&&(0,Y.jsxs)(U,{size:`sm`,onClick:()=>n({action:`approve`}),"data-tip":`Approve ${e.manifestVersion}`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`}),`Approve`]}),e.changes.length>0&&(0,Y.jsxs)(U,{size:`sm`,variant:`danger`,onClick:()=>n({action:`discard`}),"data-tip":`Back to ${e.approvedVersion}`,children:[(0,Y.jsx)(g,{"aria-hidden":`true`}),`Discard the change`]}),e.approvedVersion&&(0,Y.jsxs)(U,{size:`sm`,variant:`ghost`,onClick:()=>n({action:e.disabled?`enable`:`disable`}),children:[e.disabled?(0,Y.jsx)(c,{"aria-hidden":`true`}):(0,Y.jsx)(v,{"aria-hidden":`true`}),e.disabled?`Enable`:`Disable`]}),e.approvedVersion&&(0,Y.jsxs)(U,{size:`sm`,variant:`ghost`,disabled:l,onClick:()=>void d(),"data-tip":`Publish ${e.approvedVersion} to your library`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`}),`Publish`]}),(0,Y.jsxs)(U,{size:`sm`,variant:`danger`,onClick:()=>n({action:`delete`}),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),`Delete`]})]}),children:[o&&(0,Y.jsx)(`p`,{role:o.ok?`status`:`alert`,className:F(`m-0 rounded-[12px] px-4 py-2 text-[13px] [overflow-wrap:anywhere]`,o.ok?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:o.text}),e.tried&&e.manifestVersion&&(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Last try of manifest `,e.manifestVersion,`: `,e.tried.outcome,`.`]}),e.events.length===0?(0,Y.jsx)(G,{className:`py-4`,children:`No version has been approved yet. Try it, then approve it: only an approved version runs, for you, your team and Atlas.`}):(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-2`,children:e.events.toReversed().map((t,r)=>{let a=t.event===`approved`||t.event===`rolled-back`?t.version===e.approvedVersion:!1,o=t.event===`approved`&&t.version!==e.approvedVersion&&!e.events.slice(e.events.indexOf(t)+1).some(e=>e.event===`approved`&&e.version===t.version);return(0,Y.jsxs)(`li`,{className:`flex min-h-11 flex-wrap items-center gap-4 rounded-[8px] px-4 py-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] font-medium`,children:[(0,Y.jsxs)(`span`,{children:[Gn[t.event],` `,t.version]}),a&&r===0?(0,Y.jsx)(H,{tone:`pass`,children:`Running`}):null]}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[Kn(t.by),` · `,ut(t.at),t.note?` · ${t.note}`:``,t.tried?` · tried: ${t.tried.outcome}`:``]})]}),t.event===`approved`&&(0,Y.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>i({ref:t.digest.slice(0,16),canGoBack:o}),"aria-label":`Read version ${t.version}`,"data-tip":`Read version ${t.version}`,children:(0,Y.jsx)(k,{"aria-hidden":`true`})}),o&&(0,Y.jsx)(U,{size:`sm`,variant:`ghost`,onClick:()=>n({action:`rollback`,to:t.version}),"aria-label":`Roll back to ${t.version}`,"data-tip":`Roll back to ${t.version}`,children:(0,Y.jsx)(_,{"aria-hidden":`true`})})]},`${t.at}-${r}`)})})]})]})}var Qn={read:`read`,run:`run tests and apps`,change:`change files`,external:`change other systems`,schedule:`schedule work`},$n={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},not_run:{label:`Not run on this version`,tone:`neutral`}};function er({view:e,onDone:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),s=n&&n.target===e.id?n:null,c=!!n?.running,l=(0,J.useRef)(null),u=(0,J.useRef)(``),d=n=>{n&&n.target===e.id&&!n.running&&u.current!==n.startedAt&&(u.current=n.startedAt,t())},f=e=>{r(e),d(e)};(0,J.useEffect)(()=>{R.checks.job().then(e=>f(e.job),e=>a(e.message))},[e.id]),(0,J.useEffect)(()=>{if(!c)return;let e=tt(()=>{R.checks.job().then(e=>(a(``),f(e.job)),e=>a(e.message))},2e3);return()=>Fe(e)},[c]),(0,J.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[s?.lines.length]);let p=e=>{a(``),e.then(e=>f(e.job),e=>a(e.message))};return(0,Y.jsxs)(Yn,{id:`ca-checks`,title:`Checks`,aside:s?.running?(0,Y.jsxs)(U,{size:`sm`,variant:`danger`,onClick:()=>p(R.checks.stop()),children:[(0,Y.jsx)(te,{"aria-hidden":`true`}),`Stop`]}):(0,Y.jsxs)(U,{size:`sm`,onClick:()=>p(R.checks.start(e.id)),disabled:c,"data-tip":`Try each check on ${e.manifestVersion}`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),`Run checks`]}),children:[c&&!s&&(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Another agent's checks are running: Run checks waits for them to end.`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:e.checkResults.map((e,t)=>(0,Y.jsxs)(`li`,{className:F(`flex flex-col gap-1 px-4 py-2 text-sm`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name}),(0,Y.jsx)(H,{tone:$n[e.state].tone,children:$n[e.state].label}),e.at&&(0,Y.jsx)(`span`,{className:`text-[13px] text-muted`,children:ut(e.at)})]}),(0,Y.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.request}),e.state===`failed`&&(e.reasons||[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.reasons.map(e=>(0,Y.jsx)(`li`,{children:e},e))})]},e.name))}),i&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),s&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`details`,{open:s.running,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,s.lines.length,` lines)`]}),(0,Y.jsx)(`pre`,{ref:l,className:`mt-2 max-h-[300px] overflow-auto rounded-[10px] bg-surface-muted p-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:s.lines.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Hr as t,O as n,Rr as r,r as i}from"./route-Dg53WdFu.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o,Z as s}from"./input-D7iHeNXz.js";import{c}from"./filters-Culzq1j1.js";import{$ as l,O as u,Q as d}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Hr as t,O as n,Rr as r,r as i}from"./route-Dg53WdFu.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o,Z as s}from"./input-D7iHeNXz.js";import{c}from"./filters-Culzq1j1.js";import{$ as l,O as u,Q as d}from"./index-CljX5dI4.js";var f=e(t(),1),p=a(),m=e=>new Promise(t=>setTimeout(t,e));function h({id:e,onEnd:t,label:a=`The agent at work`,done:h=`Done.`,failed:g=`It could not finish.`}){let[_,v]=(0,f.useState)([]),[y,b]=(0,f.useState)(`starting`);(0,f.useEffect)(()=>{let t=!1,n=0,r=[];return(async()=>{for(;!t;)try{let i=await s.events(e,n,!0);if(t||(i.events.length&&(r.push(...i.events),n=i.events.at(-1).n,v([...r])),b(i.state),i.state===`closed`||i.state===`failed`))return}catch{await m(2e3)}})(),()=>{t=!0}},[e]);let x=l(_),S=x.turns.at(-1),C=!!S?.outcome||y===`failed`||y===`closed`,w=S&&!C?d(S):null,T=S?.outcome===`done`,E=C&&!T&&(S?.error||x.fatal||x.ended?.message)||``;return(0,f.useEffect)(()=>{C&&t?.()},[C]),(0,p.jsxs)(`section`,{"aria-label":a,className:`flex flex-col gap-2 border-t border-line-soft pt-4 text-sm`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w||!C?(0,p.jsx)(c,{state:w?.orb??`thinking`,px:16}):T?(0,p.jsx)(n,{size:16,"aria-hidden":`true`,className:`text-pass`}):(0,p.jsx)(r,{size:16,"aria-hidden":`true`,className:`text-fail`}),(0,p.jsx)(`span`,{className:o(`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,C&&!T&&`text-fail`),children:w?w.text:C?T?h:S?.outcome===`stopped`?`It was stopped.`:g:`Starting…`}),(0,p.jsx)(`a`,{href:i(`chats`,e),className:`text-[13px]`,children:`Open the chat`})]}),E&&(0,p.jsx)(`p`,{className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:E.split(`
|
|
2
2
|
`).slice(0,3).join(` `)}),S&&S.steps.length>0&&(0,p.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-muted`,children:S.steps.slice(-6).map(e=>(0,p.jsxs)(`li`,{className:o(`[overflow-wrap:anywhere]`,e.status===`fail`&&`text-fail`),children:[e.status===`running`?`… `:e.status===`fail`?`✗ `:`✓ `,e.label,e.arg?`: ${e.arg}`:``]},e.key))}),S&&S.changes.length>0&&(0,p.jsxs)(`p`,{className:`m-0 text-[13px] [overflow-wrap:anywhere]`,children:[`Changed: `,S.changes.map(e=>`${e.path} (+${e.added} −${e.removed})`).join(`, `)]}),S&&S.asks.some(e=>e.answer===void 0)&&(0,p.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`It is asking something: `,(0,p.jsx)(`a`,{href:i(`chats`,e),children:`answer it in the chat`}),`.`]}),S?.reply&&C&&(0,p.jsx)(u,{text:S.reply,className:`text-[13px]`})]})}export{h as t};
|