ripplo 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/dist/index.js +91 -90
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,47 +1,47 @@
1
1
  #!/usr/bin/env node
2
- var ec=Object.create;var Nn=Object.defineProperty;var tc=Object.getOwnPropertyDescriptor;var nc=Object.getOwnPropertyNames;var rc=Object.getPrototypeOf,oc=Object.prototype.hasOwnProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var Nt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ac=(e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})},ic=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nc(t))!oc.call(e,o)&&o!==n&&Nn(e,o,{get:()=>t[o],enumerable:!(r=tc(t,o))||r.enumerable});return e};var To=(e,t,n)=>(n=e!=null?ec(rc(e)):{},ic(t||!e||!e.__esModule?Nn(n,"default",{value:e,enumerable:!0}):n,e));import Tn from"fs/promises";import Rn from"path";import{z as Tt}from"zod";import{z as Ro}from"zod";import{z as _e}from"zod";import{z as Le}from"zod";import{z as Ie}from"zod";import{z as Rt}from"zod";import{z as y}from"zod";import{z as ge}from"zod";import{z as Uo}from"zod";import{z as F}from"zod";import{z as Z}from"zod";import{z as ye}from"zod";function Lt(e){return xo({legacy:void 0,migrators:[],name:e,schemas:[]})}function dc(e,t){let n=JSON.parse(t);return e.decode(n)}function xo(e){return{initial:t=>Ln(t,{...e,schemas:[t]}),legacy:t=>xo({...e,legacy:t})}}function Ln(e,t){return{build:()=>pc(e,t),legacy:n=>Ln(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Ln(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function pc(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>uc(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function uc(e,t,n){let{data:r,version:o}=mc(t,n),a=Po(t,r,o);return e.parse(a)}function mc(e,t){let n=sc.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new cc({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function Po(e,t,n){let r=e.schemas.length;if(n>r)throw new lc({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return Po(e,i(a),n+1)}function jo(e){return{graph:e.graph,tests:e.tests.map(t=>({description:t.description,expectedOutcome:t.expectedOutcome,implemented:t.implemented,name:t.name,slug:t.slug,spec:t.spec}))}}function Cn(e){let t=Io.encode(e);return`${JSON.stringify(t,hd(t),2)}
3
- `}async function Ct({cwd:e}){let t=Rn.join(e,de),n=await yd(t);return n==null?null:dc(Io,n)}async function he({cwd:e,result:t}){let n=jo(t),r=Rn.join(e,de);await Tn.mkdir(Rn.dirname(r),{recursive:!0}),await Tn.writeFile(r,Cn(n),"utf8")}function vt({compiled:e,existing:t}){if(t==null)return"missing";let n=Cn(jo(e)),r=Cn(t);return n===r?"match":"stale"}async function yd(e){try{return await Tn.readFile(e,"utf8")}catch(t){if(gd(t)&&t.code==="ENOENT")return null;throw t}}function gd(e){return e instanceof Error&&"code"in e}function hd(e){return function(n,r){return r===e||!Sd(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[a])=>o.localeCompare(a)))}}function Sd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sc,lc,cc,fc,Eo,yc,Lo,gc,Co,Oo,hc,Sc,U,tt,kc,Ac,vn,wc,ce,bc,Nc,C,vo,Tc,Rc,Lc,Cc,vc,xc,Pc,Ec,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,Wc,qc,Fc,Mc,zc,Jc,Xc,Gc,Hc,Kc,Qc,Yc,Zc,ed,td,nd,rd,od,ad,id,sd,_o,ld,cd,dd,pd,Xh,Gh,Hh,de,ud,md,fd,Io,je=f(()=>{"use strict";sc=Tt.object({__codec:Tt.string().min(1),data:Tt.unknown(),version:Tt.number().int().positive()}),lc=class extends Error{codec;currentVersion;gotVersion;constructor(e){super(`Unsupported ${e.codec} version ${String(e.gotVersion)} (current ${String(e.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=e.codec,this.currentVersion=e.currentVersion,this.gotVersion=e.gotVersion}},cc=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};fc=Le.object({from:Le.string().min(1).describe("Key of the source state in the states record"),requiresKeys:Le.record(Le.string(),Le.string()).optional().describe("Maps workflow variable namespace to precondition name. Used by the runtime to namespace batch precondition data into dot-namespaced variables (e.g. { project: 'data:project' } maps projectId \u2192 project.projectId)."),to:Le.string().min(1).describe("Key of the target state in the states record"),workflow:Le.string().min(1).describe("Filename (without .json) of the workflow in .ripplo/workflows/ that executes this edge")}).describe("A directed edge between two states, executed by a workflow"),Eo=Ie.object({depends:Ie.array(Ie.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Ie.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Ie.array(Ie.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name."),yc=Rt.object({preconditions:Rt.array(Rt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:Rt.string().min(1).describe("URL pattern with {{placeholders}} for dynamic segments, e.g. '/projects/{{projectId}}/settings'")}).describe("A distinct application state \u2014 a unique combination of location, auth context, and data conditions"),Lo=1e3,gc=5e3,Co=500,Oo=_e.object({edges:_e.array(fc).max(gc).describe("Directed edges between states, each executed by a workflow"),preconditions:_e.record(_e.string().max(200),Eo).refine(e=>Object.keys(e).length<=Co,`Graph has more than ${String(Co)} preconditions`).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:_e.record(_e.string().max(200),yc).refine(e=>Object.keys(e).length<=Lo,`Graph has more than ${String(Lo)} states`).describe("States keyed by stable ID (kebab-case)")}).describe("Ripplo State Graph \u2014 models application states, edges, and executable preconditions"),hc=ge.object({by:ge.literal("testId"),value:ge.string().min(1)}),Sc=ge.object({by:ge.literal("role"),name:ge.string().optional(),role:ge.string().min(1)}),U=ge.discriminatedUnion("by",[hc,Sc]),tt=Uo.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),kc=Uo.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Ac=F.object({type:F.literal("static"),value:F.union([F.string(),F.number(),F.boolean()])}),vn=F.object({name:F.string().min(1),type:F.literal("variable")}),wc=F.discriminatedUnion("type",[Ac,vn]),ce=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.string()}),vn]),bc=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.number().int().nonnegative()}),vn]),Nc=Z.discriminatedUnion("type",[Z.object({default:Z.string().optional(),type:Z.literal("string")}),Z.object({default:Z.number().optional(),type:Z.literal("number")}),Z.object({default:Z.boolean().optional(),type:Z.literal("boolean")}),Z.object({key:Z.string().min(1),type:Z.literal("env")})]),C={comment:y.string().max(2e3).optional(),id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),timeout:y.number().int().positive().optional()},vo=500,Tc=y.object({...C,type:y.literal("goto"),url:ce}),Rc=y.object({...C,locator:U,type:y.literal("click")}),Lc=y.object({...C,locator:U,type:y.literal("fill"),value:ce}),Cc=y.object({...C,locator:U,type:y.literal("select"),value:ce}),vc=y.object({...C,locator:U,type:y.literal("hover")}),xc=y.object({...C,key:y.string().min(1),locator:U.optional(),type:y.literal("press")}),Pc=y.object({...C,locator:U,type:y.literal("check")}),Ec=y.object({...C,locator:U,type:y.literal("uncheck")}),Oc=y.object({...C,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),Uc=y.object({...C,message:y.string().min(1),type:y.literal("fail")}),_c=y.object({...C,type:y.literal("setVariable"),value:wc,variable:y.string().min(1)}),Ic=y.object({...C,locator:U,type:y.literal("extractText"),variable:y.string().min(1)}),jc=y.object({...C,files:y.array(y.string()).min(1),locator:U,type:y.literal("upload")}),$c=y.object({...C,locator:U,type:y.literal("dblclick")}),Bc=y.object({...C,source:U,target:U,type:y.literal("drag")}),Dc=y.object({...C,locator:U,type:y.literal("scrollIntoView")}),Vc=y.object({...C,locator:U,type:y.literal("type"),value:ce}),Wc=y.object({...C,locator:U,type:y.literal("focus")}),qc=y.object({...C,locator:U,type:y.literal("clear")}),Fc=y.object({...C,locator:U,type:y.literal("rightClick")}),Mc=y.object({...C,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),zc=y.object({...C,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:ce.optional(),variable:y.string().min(1).optional()}),Jc=y.object({...C,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Xc=y.object({...C,locator:U,type:y.literal("assertVisible")}),Gc=y.object({...C,locator:U,type:y.literal("assertNotVisible")}),Hc=y.object({...C,expected:ce,locator:U,operator:tt,type:y.literal("assertText")}),Kc=y.object({...C,expected:ce,operator:tt,type:y.literal("assertUrl")}),Qc=y.object({...C,expected:bc,locator:U,operator:kc,type:y.literal("assertCount")}),Yc=y.object({...C,expected:ce,locator:U,operator:tt,type:y.literal("assertValue")}),Zc=y.object({...C,attribute:y.string().min(1),expected:ce,locator:U,operator:tt,type:y.literal("assertAttribute")}),ed=y.object({...C,locator:U,type:y.literal("assertEnabled")}),td=y.object({...C,locator:U,type:y.literal("assertDisabled")}),nd=y.object({...C,expected:ce,operator:tt,type:y.literal("assertTitle")}),rd=y.object({...C,locator:U,type:y.literal("assertChecked")}),od=y.object({...C,locator:U,type:y.literal("assertNotChecked")}),ad=y.object({...C,locator:U,type:y.literal("assertFocused")}),id=y.object({...C,locator:U,type:y.literal("assertNotFocused")}),sd=y.discriminatedUnion("type",[Tc,Rc,Lc,Cc,vc,xc,Pc,Ec,Xc,Gc,Hc,Kc,Qc,Yc,Zc,ed,td,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,Wc,qc,Fc,Mc,zc,Jc,nd,rd,od,ad,id]),_o=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),sd).refine(e=>Object.keys(e).length<=vo,`Workflow has more than ${String(vo)} nodes`),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),Nc).optional()}),ld=Ro.record(Ro.string().max(200),Eo),cd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},dd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"edges"in e&&"states"in e&&"preconditions"in e},pd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Xh=Lt("workflow-spec").legacy(cd).initial(_o).build(),Gh=Lt("state-graph").legacy(dd).initial(Oo).build(),Hh=Lt("precondition-map").legacy(pd).initial(ld).build(),de=".ripplo/ripplo.lock",ud=5e3,md=ye.object({description:ye.string().max(2e3),expectedOutcome:ye.string().max(2e3),implemented:ye.boolean(),name:ye.string().max(200),slug:ye.string().max(200),spec:_o}),fd=ye.object({graph:Oo,tests:ye.array(md).max(ud)}),Io=Lt("ripplo-lockfile").initial(fd).build()});function $o(e){return e.data}function Bo(e){return{as(t){return{data:{label:t,node:e}}}}}var xt=f(()=>{"use strict"});function Pt(e){let t=e.getPreconditions(),n=e.getTests();kd(n);let r=n.map(a=>Ad(a)),o=Td(t,n);return{config:e.getConfig(),graph:o,tests:r}}function kd(e){let t=new Map;e.forEach(n=>{let r=t.get(n.id);if(r!=null)throw new Error(`Duplicate test id "${n.id}" used by "${r}" and "${n.name}"`);t.set(n.id,n.name)})}function Ad(e){let t=e.id,{accessedKeys:n,vars:r}=Do(e.requiresKeys),o=e.startsAtFn==null?void 0:e.startsAtFn(r),a=e.stepsFn==null?[]:e.stepsFn(r),i=o==null?a:[wd(o),...a],l=bd(i,n,e.requiresKeys),s=[];return Object.keys(e.requiresKeys).length>0&&n.size===0&&e.implemented&&s.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()"),{additionalChecks:[],description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,slug:t,spec:l,warnings:s}}function wd(e){return Bo({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function Do(e){let t=new Set,n={};return Object.keys(e).forEach(r=>{n[r]=new Proxy({},{get(o,a){if(typeof a=="string"){let i=`${r}.${a}`;return t.add(i),`{{${i}}}`}}})}),{accessedKeys:t,vars:n}}function bd(e,t,n){let r={};e.forEach((i,l)=>{let s=`step-${String(l)}`,c=l<e.length-1?`step-${String(l+1)}`:void 0;r[s]=Nd(i,s,c)});let o={};t.forEach(i=>{o[i]={default:`test-${i}`,type:"string"}});let a={...n};return{entryNode:"step-0",nodes:r,variableNamespaces:a,variables:o}}function Nd(e,t,n){let{label:r,node:o}=$o(e);return{...o,id:t,label:r,next:n}}function Td(e,t){let n={};e.forEach(a=>{n[a.name]={depends:[...a.dependsOn],description:a.description,returns:[...a.returns]}});let r={},o=[];return t.forEach(a=>{if(!a.implemented||a.startsAtFn==null)return;let i=Rd(a.requires,e),{vars:l}=Do(a.requiresKeys),s=a.startsAtFn(l),c=Ld(i,s);r[c]={preconditions:[...i],route:s},o.push({from:c,requiresKeys:a.requiresKeys,to:c,workflow:a.id})}),{edges:o,preconditions:n,states:r}}function Rd(e,t){let n=new Map(t.map(i=>[i.name,i])),r=[],o=new Set;function a(i){o.has(i)||(o.add(i),n.get(i)?.dependsOn.forEach(l=>{a(l)}),r.push(i))}return e.forEach(i=>{a(i)}),r}function Ld(e,t){let n=e.toSorted((r,o)=>r.localeCompare(o));return Cd(`${n.join("-")}-${t}`)}function Cd(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}var xn=f(()=>{"use strict";xt()});var Vo=f(()=>{"use strict";xn();xt()});import vd from"path";import{createJiti as xd}from"jiti";async function D(e){let t=vd.join(e,".ripplo","index.ts");try{let r=await xd(import.meta.url,{moduleCache:!1}).import(t),a=r!=null&&typeof r=="object"&&"default"in r?r.default:r,i=Pt(a);return{builder:a,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var pe=f(()=>{"use strict";Vo()});function En(e){return typeof e=="function"}function Ed(e){return Be(e)?"array":typeof e}function Pn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qo(e,t){return e!=null&&typeof e=="object"&&t in e}function Od(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function _d(e,t){return Ud.call(e,t)}function jd(e){return!_d(Id,e)}function Bd(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return $d[n]})}function Fd(e,t){if(!e)return[];var n=!1,r=[],o=[],a=[],i=!1,l=!1,s="",c=0;function p(){if(i&&!l)for(;a.length;)delete o[a.pop()];else a=[];i=!1,l=!1}var u,d,m;function h(_){if(typeof _=="string"&&(_=_.split(Vd,2)),!Be(_)||_.length!==2)throw new Error("Invalid tags: "+_);u=new RegExp(Pn(_[0])+"\\s*"),d=new RegExp("\\s*"+Pn(_[1])),m=new RegExp("\\s*"+Pn("}"+_[1]))}h(t||ie.tags);for(var k=new rt(e),S,A,w,x,R,T;!k.eos();){if(S=k.pos,w=k.scanUntil(u),w)for(var P=0,B=w.length;P<B;++P)x=w.charAt(P),jd(x)?(a.push(o.length),s+=x):(l=!0,n=!0,s+=" "),o.push(["text",x,S,S+1]),S+=1,x===`
4
- `&&(p(),s="",c=0,n=!1);if(!k.scan(u))break;if(i=!0,A=k.scan(qd)||"name",k.scan(Dd),A==="="?(w=k.scanUntil(Fo),k.scan(Fo),k.scanUntil(d)):A==="{"?(w=k.scanUntil(m),k.scan(Wd),k.scanUntil(d),A="&"):w=k.scanUntil(d),!k.scan(d))throw new Error("Unclosed tag at "+k.pos);if(A==">"?R=[A,w,S,k.pos,s,c,n]:R=[A,w,S,k.pos],c++,o.push(R),A==="#"||A==="^")r.push(R);else if(A==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+w+'" at '+S);if(T[1]!==w)throw new Error('Unclosed section "'+T[1]+'" at '+S)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&h(w)}if(p(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+k.pos);return zd(Md(o))}function Md(e){for(var t=[],n,r,o=0,a=e.length;o<a;++o)n=e[o],n&&(n[0]==="text"&&r&&r[0]==="text"?(r[1]+=n[1],r[3]=n[3]):(t.push(n),r=n));return t}function zd(e){for(var t=[],n=t,r=[],o,a,i=0,l=e.length;i<l;++i)switch(o=e[i],o[0]){case"#":case"^":n.push(o),r.push(o),n=o[4]=[];break;case"/":a=r.pop(),a[5]=o[2],n=r.length>0?r[r.length-1][4]:t;break;default:n.push(o)}return t}function rt(e){this.string=e,this.tail=e,this.pos=0}function $e(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function X(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var Pd,Be,Ud,Id,$d,Dd,Vd,Fo,Wd,qd,ie,nt,Mo,zo=f(()=>{"use strict";Pd=Object.prototype.toString,Be=Array.isArray||function(t){return Pd.call(t)==="[object Array]"};Ud=RegExp.prototype.test;Id=/\S/;$d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};Dd=/\s*/,Vd=/\s+/,Fo=/\s*=/,Wd=/\s*\}/,qd=/#|\^|\/|>|\{|&|=|!/;rt.prototype.eos=function(){return this.tail===""};rt.prototype.scan=function(t){var n=this.tail.match(t);if(!n||n.index!==0)return"";var r=n[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};rt.prototype.scanUntil=function(t){var n=this.tail.search(t),r;switch(n){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=r.length,r};$e.prototype.push=function(t){return new $e(t,this)};$e.prototype.lookup=function(t){var n=this.cache,r;if(n.hasOwnProperty(t))r=n[t];else{for(var o=this,a,i,l,s=!1;o;){if(t.indexOf(".")>0)for(a=o.view,i=t.split("."),l=0;a!=null&&l<i.length;)l===i.length-1&&(s=qo(a,i[l])||Od(a,i[l])),a=a[i[l++]];else a=o.view[t],s=qo(o.view,t);if(s){r=a;break}o=o.parent}n[t]=r}return En(r)&&(r=r.call(this.view)),r};X.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};X.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||ie.tags).join(":"),a=typeof r<"u",i=a?r.get(o):void 0;return i==null&&(i=Fd(t,n),a&&r.set(o,i)),i};X.prototype.render=function(t,n,r,o){var a=this.getConfigTags(o),i=this.parse(t,a),l=n instanceof $e?n:new $e(n,void 0);return this.renderTokens(i,l,r,t,o)};X.prototype.renderTokens=function(t,n,r,o,a){for(var i="",l,s,c,p=0,u=t.length;p<u;++p)c=void 0,l=t[p],s=l[0],s==="#"?c=this.renderSection(l,n,r,o,a):s==="^"?c=this.renderInverted(l,n,r,o,a):s===">"?c=this.renderPartial(l,n,r,a):s==="&"?c=this.unescapedValue(l,n):s==="name"?c=this.escapedValue(l,n,a):s==="text"&&(c=this.rawValue(l)),c!==void 0&&(i+=c);return i};X.prototype.renderSection=function(t,n,r,o,a){var i=this,l="",s=n.lookup(t[1]);function c(d){return i.render(d,n,r,a)}if(s){if(Be(s))for(var p=0,u=s.length;p<u;++p)l+=this.renderTokens(t[4],n.push(s[p]),r,o,a);else if(typeof s=="object"||typeof s=="string"||typeof s=="number")l+=this.renderTokens(t[4],n.push(s),r,o,a);else if(En(s)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");s=s.call(n.view,o.slice(t[3],t[5]),c),s!=null&&(l+=s)}else l+=this.renderTokens(t[4],n,r,o,a);return l}};X.prototype.renderInverted=function(t,n,r,o,a){var i=n.lookup(t[1]);if(!i||Be(i)&&i.length===0)return this.renderTokens(t[4],n,r,o,a)};X.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),a=t.split(`
2
+ var Zl=Object.create;var Rn=Object.defineProperty;var ec=Object.getOwnPropertyDescriptor;var tc=Object.getOwnPropertyNames;var nc=Object.getPrototypeOf,rc=Object.prototype.hasOwnProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var Tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oc=(e,t)=>{for(var n in t)Rn(e,n,{get:t[n],enumerable:!0})},ac=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tc(t))!rc.call(e,o)&&o!==n&&Rn(e,o,{get:()=>t[o],enumerable:!(r=ec(t,o))||r.enumerable});return e};var Ro=(e,t,n)=>(n=e!=null?Zl(nc(e)):{},ac(t||!e||!e.__esModule?Rn(n,"default",{value:e,enumerable:!0}):n,e));import Ln from"fs/promises";import Cn from"path";import{z as Rt}from"zod";import{z as Lo}from"zod";import{z as Ie}from"zod";import{z as xe}from"zod";import{z as je}from"zod";import{z as Lt}from"zod";import{z as y}from"zod";import{z as he}from"zod";import{z as _o}from"zod";import{z as q}from"zod";import{z as ee}from"zod";import{z as $e}from"zod";function Ct(e){return Po({legacy:void 0,migrators:[],name:e,schemas:[]})}function cc(e,t){let n=JSON.parse(t);return e.decode(n)}function Po(e){return{initial:t=>vn(t,{...e,schemas:[t]}),legacy:t=>Po({...e,legacy:t})}}function vn(e,t){return{build:()=>dc(e,t),legacy:n=>vn(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return vn(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function dc(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>pc(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function pc(e,t,n){let{data:r,version:o}=uc(t,n),a=Eo(t,r,o);return e.parse(a)}function uc(e,t){let n=ic.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new lc({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function Eo(e,t,n){let r=e.schemas.length;if(n>r)throw new sc({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return Eo(e,i(a),n+1)}function $o(e){return{graph:e.graph,tests:e.tests.filter(t=>t.implemented).map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,slug:t.slug,spec:t.spec}))}}function xn(e){let t=jo.encode(e);return`${JSON.stringify(t,gd(t),2)}
3
+ `}async function vt({cwd:e}){let t=Cn.join(e,ue),n=await fd(t);return n==null?null:cc(jo,n)}async function Se({cwd:e,result:t}){let n=$o(t),r=Cn.join(e,ue);await Ln.mkdir(Cn.dirname(r),{recursive:!0}),await Ln.writeFile(r,xn(n),"utf8")}function xt({compiled:e,existing:t}){if(t==null)return"missing";let n=xn($o(e)),r=xn(t);return n===r?"match":"stale"}async function fd(e){try{return await Ln.readFile(e,"utf8")}catch(t){if(yd(t)&&t.code==="ENOENT")return null;throw t}}function yd(e){return e instanceof Error&&"code"in e}function gd(e){return function(n,r){return r===e||!hd(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[a])=>o.localeCompare(a)))}}function hd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ic,sc,lc,mc,Oo,fc,Co,yc,vo,Uo,gc,hc,_,tt,Sc,kc,Pn,Ac,pe,wc,bc,C,xo,Nc,Tc,Rc,Lc,Cc,vc,xc,Pc,Ec,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,Wc,Fc,qc,Mc,zc,Jc,Xc,Gc,Hc,Kc,Yc,Qc,Zc,ed,td,nd,rd,od,ad,id,Io,sd,ld,cd,dd,eS,tS,nS,ue,pd,ud,md,jo,Be=f(()=>{"use strict";ic=Rt.object({__codec:Rt.string().min(1),data:Rt.unknown(),version:Rt.number().int().positive()}),sc=class extends Error{codec;currentVersion;gotVersion;constructor(e){super(`Unsupported ${e.codec} version ${String(e.gotVersion)} (current ${String(e.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=e.codec,this.currentVersion=e.currentVersion,this.gotVersion=e.gotVersion}},lc=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};mc=xe.object({from:xe.string().min(1).describe("Key of the source state in the states record"),requiresKeys:xe.record(xe.string(),xe.string()).optional().describe("Maps workflow variable namespace to precondition name. Used by the runtime to namespace batch precondition data into dot-namespaced variables (e.g. { project: 'data:project' } maps projectId \u2192 project.projectId)."),to:xe.string().min(1).describe("Key of the target state in the states record"),workflow:xe.string().min(1).describe("Filename (without .json) of the workflow in .ripplo/workflows/ that executes this edge")}).describe("A directed edge between two states, executed by a workflow"),Oo=je.object({depends:je.array(je.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:je.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:je.array(je.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name."),fc=Lt.object({preconditions:Lt.array(Lt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:Lt.string().min(1).describe("URL pattern with {{placeholders}} for dynamic segments, e.g. '/projects/{{projectId}}/settings'")}).describe("A distinct application state \u2014 a unique combination of location, auth context, and data conditions"),Co=1e3,yc=5e3,vo=500,Uo=Ie.object({edges:Ie.array(mc).max(yc).describe("Directed edges between states, each executed by a workflow"),preconditions:Ie.record(Ie.string().max(200),Oo).refine(e=>Object.keys(e).length<=vo,`Graph has more than ${String(vo)} preconditions`).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:Ie.record(Ie.string().max(200),fc).refine(e=>Object.keys(e).length<=Co,`Graph has more than ${String(Co)} states`).describe("States keyed by stable ID (kebab-case)")}).describe("Ripplo State Graph \u2014 models application states, edges, and executable preconditions"),gc=he.object({by:he.literal("testId"),value:he.string().min(1)}),hc=he.object({by:he.literal("role"),name:he.string().optional(),role:he.string().min(1)}),_=he.discriminatedUnion("by",[gc,hc]),tt=_o.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Sc=_o.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),kc=q.object({type:q.literal("static"),value:q.union([q.string(),q.number(),q.boolean()])}),Pn=q.object({name:q.string().min(1),type:q.literal("variable")}),Ac=q.discriminatedUnion("type",[kc,Pn]),pe=q.discriminatedUnion("type",[q.object({type:q.literal("static"),value:q.string()}),Pn]),wc=q.discriminatedUnion("type",[q.object({type:q.literal("static"),value:q.number().int().nonnegative()}),Pn]),bc=ee.discriminatedUnion("type",[ee.object({default:ee.string().optional(),type:ee.literal("string")}),ee.object({default:ee.number().optional(),type:ee.literal("number")}),ee.object({default:ee.boolean().optional(),type:ee.literal("boolean")}),ee.object({key:ee.string().min(1),type:ee.literal("env")})]),C={comment:y.string().max(2e3).optional(),id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),timeout:y.number().int().positive().optional()},xo=500,Nc=y.object({...C,type:y.literal("goto"),url:pe}),Tc=y.object({...C,locator:_,type:y.literal("click")}),Rc=y.object({...C,locator:_,type:y.literal("fill"),value:pe}),Lc=y.object({...C,locator:_,type:y.literal("select"),value:pe}),Cc=y.object({...C,locator:_,type:y.literal("hover")}),vc=y.object({...C,key:y.string().min(1),locator:_.optional(),type:y.literal("press")}),xc=y.object({...C,locator:_,type:y.literal("check")}),Pc=y.object({...C,locator:_,type:y.literal("uncheck")}),Ec=y.object({...C,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),Oc=y.object({...C,message:y.string().min(1),type:y.literal("fail")}),Uc=y.object({...C,type:y.literal("setVariable"),value:Ac,variable:y.string().min(1)}),_c=y.object({...C,locator:_,type:y.literal("extractText"),variable:y.string().min(1)}),Ic=y.object({...C,files:y.array(y.string()).min(1),locator:_,type:y.literal("upload")}),jc=y.object({...C,locator:_,type:y.literal("dblclick")}),$c=y.object({...C,source:_,target:_,type:y.literal("drag")}),Bc=y.object({...C,locator:_,type:y.literal("scrollIntoView")}),Dc=y.object({...C,locator:_,type:y.literal("type"),value:pe}),Vc=y.object({...C,locator:_,type:y.literal("focus")}),Wc=y.object({...C,locator:_,type:y.literal("clear")}),Fc=y.object({...C,locator:_,type:y.literal("rightClick")}),qc=y.object({...C,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),Mc=y.object({...C,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:pe.optional(),variable:y.string().min(1).optional()}),zc=y.object({...C,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Jc=y.object({...C,locator:_,type:y.literal("assertVisible")}),Xc=y.object({...C,locator:_,type:y.literal("assertNotVisible")}),Gc=y.object({...C,expected:pe,locator:_,operator:tt,type:y.literal("assertText")}),Hc=y.object({...C,expected:pe,operator:tt,type:y.literal("assertUrl")}),Kc=y.object({...C,expected:wc,locator:_,operator:Sc,type:y.literal("assertCount")}),Yc=y.object({...C,expected:pe,locator:_,operator:tt,type:y.literal("assertValue")}),Qc=y.object({...C,attribute:y.string().min(1),expected:pe,locator:_,operator:tt,type:y.literal("assertAttribute")}),Zc=y.object({...C,locator:_,type:y.literal("assertEnabled")}),ed=y.object({...C,locator:_,type:y.literal("assertDisabled")}),td=y.object({...C,expected:pe,operator:tt,type:y.literal("assertTitle")}),nd=y.object({...C,locator:_,type:y.literal("assertChecked")}),rd=y.object({...C,locator:_,type:y.literal("assertNotChecked")}),od=y.object({...C,locator:_,type:y.literal("assertFocused")}),ad=y.object({...C,locator:_,type:y.literal("assertNotFocused")}),id=y.discriminatedUnion("type",[Nc,Tc,Rc,Lc,Cc,vc,xc,Pc,Jc,Xc,Gc,Hc,Kc,Yc,Qc,Zc,ed,Ec,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,Wc,Fc,qc,Mc,zc,td,nd,rd,od,ad]),Io=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),id).refine(e=>Object.keys(e).length<=xo,`Workflow has more than ${String(xo)} nodes`),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),bc).optional()}),sd=Lo.record(Lo.string().max(200),Oo),ld={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},cd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"edges"in e&&"states"in e&&"preconditions"in e},dd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},eS=Ct("workflow-spec").legacy(ld).initial(Io).build(),tS=Ct("state-graph").legacy(cd).initial(Uo).build(),nS=Ct("precondition-map").legacy(dd).initial(sd).build(),ue=".ripplo/ripplo.lock",pd=5e3,ud=$e.object({expectedOutcome:$e.string().max(2e3),name:$e.string().max(200),slug:$e.string().max(200),spec:Io}),md=$e.object({graph:Uo,tests:$e.array(ud).max(pd)}),jo=Ct("ripplo-lockfile").initial(md).build()});function Bo(e){return e.data}function Do(e){return{as(t){return{data:{label:t,node:e}}}}}var Pt=f(()=>{"use strict"});function Et(e){let t=e.getPreconditions(),n=e.getTests();Sd(n);let r=n.map(a=>kd(a)),o=Nd(t,n);return{config:e.getConfig(),graph:o,tests:r}}function Sd(e){let t=new Map;e.forEach(n=>{let r=t.get(n.id);if(r!=null)throw new Error(`Duplicate test id "${n.id}" used by "${r}" and "${n.name}"`);t.set(n.id,n.name)})}function kd(e){let t=e.id,{accessedKeys:n,vars:r}=Vo(e.requiresKeys),o=e.startsAtFn==null?void 0:e.startsAtFn(r),a=e.stepsFn==null?[]:e.stepsFn(r),i=o==null?a:[Ad(o),...a],l=wd(i,n,e.requiresKeys),s=[];return Object.keys(e.requiresKeys).length>0&&n.size===0&&e.implemented&&s.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()"),{additionalChecks:[],description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,slug:t,spec:l,warnings:s}}function Ad(e){return Do({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function Vo(e){let t=new Set,n={};return Object.keys(e).forEach(r=>{n[r]=new Proxy({},{get(o,a){if(typeof a=="string"){let i=`${r}.${a}`;return t.add(i),`{{${i}}}`}}})}),{accessedKeys:t,vars:n}}function wd(e,t,n){let r={};e.forEach((i,l)=>{let s=`step-${String(l)}`,c=l<e.length-1?`step-${String(l+1)}`:void 0;r[s]=bd(i,s,c)});let o={};t.forEach(i=>{o[i]={default:`test-${i}`,type:"string"}});let a={...n};return{entryNode:"step-0",nodes:r,variableNamespaces:a,variables:o}}function bd(e,t,n){let{label:r,node:o}=Bo(e);return{...o,id:t,label:r,next:n}}function Nd(e,t){let n={};e.forEach(a=>{n[a.name]={depends:[...a.dependsOn],description:a.description,returns:[...a.returns]}});let r={},o=[];return t.forEach(a=>{if(!a.implemented||a.startsAtFn==null)return;let i=Td(a.requires,e),{vars:l}=Vo(a.requiresKeys),s=a.startsAtFn(l),c=Rd(i,s);r[c]={preconditions:[...i],route:s},o.push({from:c,requiresKeys:a.requiresKeys,to:c,workflow:a.id})}),{edges:o,preconditions:n,states:r}}function Td(e,t){let n=new Map(t.map(i=>[i.name,i])),r=[],o=new Set;function a(i){o.has(i)||(o.add(i),n.get(i)?.dependsOn.forEach(l=>{a(l)}),r.push(i))}return e.forEach(i=>{a(i)}),r}function Rd(e,t){let n=e.toSorted((r,o)=>r.localeCompare(o));return Ld(`${n.join("-")}-${t}`)}function Ld(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}var En=f(()=>{"use strict";Pt()});var Wo=f(()=>{"use strict";En();Pt()});import Cd from"path";import{createJiti as vd}from"jiti";async function V(e){let t=Cd.join(e,".ripplo","index.ts");try{let r=await vd(import.meta.url,{moduleCache:!1}).import(t),a=r!=null&&typeof r=="object"&&"default"in r?r.default:r,i=Et(a);return{builder:a,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var me=f(()=>{"use strict";Wo()});function Un(e){return typeof e=="function"}function Pd(e){return Ve(e)?"array":typeof e}function On(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qo(e,t){return e!=null&&typeof e=="object"&&t in e}function Ed(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function Ud(e,t){return Od.call(e,t)}function Id(e){return!Ud(_d,e)}function $d(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return jd[n]})}function Fd(e,t){if(!e)return[];var n=!1,r=[],o=[],a=[],i=!1,l=!1,s="",c=0;function p(){if(i&&!l)for(;a.length;)delete o[a.pop()];else a=[];i=!1,l=!1}var u,d,m;function h(L){if(typeof L=="string"&&(L=L.split(Dd,2)),!Ve(L)||L.length!==2)throw new Error("Invalid tags: "+L);u=new RegExp(On(L[0])+"\\s*"),d=new RegExp("\\s*"+On(L[1])),m=new RegExp("\\s*"+On("}"+L[1]))}h(t||se.tags);for(var k=new rt(e),S,A,w,P,E,T;!k.eos();){if(S=k.pos,w=k.scanUntil(u),w)for(var I=0,x=w.length;I<x;++I)P=w.charAt(I),Id(P)?(a.push(o.length),s+=P):(l=!0,n=!0,s+=" "),o.push(["text",P,S,S+1]),S+=1,P===`
4
+ `&&(p(),s="",c=0,n=!1);if(!k.scan(u))break;if(i=!0,A=k.scan(Wd)||"name",k.scan(Bd),A==="="?(w=k.scanUntil(Mo),k.scan(Mo),k.scanUntil(d)):A==="{"?(w=k.scanUntil(m),k.scan(Vd),k.scanUntil(d),A="&"):w=k.scanUntil(d),!k.scan(d))throw new Error("Unclosed tag at "+k.pos);if(A==">"?E=[A,w,S,k.pos,s,c,n]:E=[A,w,S,k.pos],c++,o.push(E),A==="#"||A==="^")r.push(E);else if(A==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+w+'" at '+S);if(T[1]!==w)throw new Error('Unclosed section "'+T[1]+'" at '+S)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&h(w)}if(p(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+k.pos);return Md(qd(o))}function qd(e){for(var t=[],n,r,o=0,a=e.length;o<a;++o)n=e[o],n&&(n[0]==="text"&&r&&r[0]==="text"?(r[1]+=n[1],r[3]=n[3]):(t.push(n),r=n));return t}function Md(e){for(var t=[],n=t,r=[],o,a,i=0,l=e.length;i<l;++i)switch(o=e[i],o[0]){case"#":case"^":n.push(o),r.push(o),n=o[4]=[];break;case"/":a=r.pop(),a[5]=o[2],n=r.length>0?r[r.length-1][4]:t;break;default:n.push(o)}return t}function rt(e){this.string=e,this.tail=e,this.pos=0}function De(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function H(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var xd,Ve,Od,_d,jd,Bd,Dd,Mo,Vd,Wd,se,nt,zo,Jo=f(()=>{"use strict";xd=Object.prototype.toString,Ve=Array.isArray||function(t){return xd.call(t)==="[object Array]"};Od=RegExp.prototype.test;_d=/\S/;jd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};Bd=/\s*/,Dd=/\s+/,Mo=/\s*=/,Vd=/\s*\}/,Wd=/#|\^|\/|>|\{|&|=|!/;rt.prototype.eos=function(){return this.tail===""};rt.prototype.scan=function(t){var n=this.tail.match(t);if(!n||n.index!==0)return"";var r=n[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};rt.prototype.scanUntil=function(t){var n=this.tail.search(t),r;switch(n){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=r.length,r};De.prototype.push=function(t){return new De(t,this)};De.prototype.lookup=function(t){var n=this.cache,r;if(n.hasOwnProperty(t))r=n[t];else{for(var o=this,a,i,l,s=!1;o;){if(t.indexOf(".")>0)for(a=o.view,i=t.split("."),l=0;a!=null&&l<i.length;)l===i.length-1&&(s=qo(a,i[l])||Ed(a,i[l])),a=a[i[l++]];else a=o.view[t],s=qo(o.view,t);if(s){r=a;break}o=o.parent}n[t]=r}return Un(r)&&(r=r.call(this.view)),r};H.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};H.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||se.tags).join(":"),a=typeof r<"u",i=a?r.get(o):void 0;return i==null&&(i=Fd(t,n),a&&r.set(o,i)),i};H.prototype.render=function(t,n,r,o){var a=this.getConfigTags(o),i=this.parse(t,a),l=n instanceof De?n:new De(n,void 0);return this.renderTokens(i,l,r,t,o)};H.prototype.renderTokens=function(t,n,r,o,a){for(var i="",l,s,c,p=0,u=t.length;p<u;++p)c=void 0,l=t[p],s=l[0],s==="#"?c=this.renderSection(l,n,r,o,a):s==="^"?c=this.renderInverted(l,n,r,o,a):s===">"?c=this.renderPartial(l,n,r,a):s==="&"?c=this.unescapedValue(l,n):s==="name"?c=this.escapedValue(l,n,a):s==="text"&&(c=this.rawValue(l)),c!==void 0&&(i+=c);return i};H.prototype.renderSection=function(t,n,r,o,a){var i=this,l="",s=n.lookup(t[1]);function c(d){return i.render(d,n,r,a)}if(s){if(Ve(s))for(var p=0,u=s.length;p<u;++p)l+=this.renderTokens(t[4],n.push(s[p]),r,o,a);else if(typeof s=="object"||typeof s=="string"||typeof s=="number")l+=this.renderTokens(t[4],n.push(s),r,o,a);else if(Un(s)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");s=s.call(n.view,o.slice(t[3],t[5]),c),s!=null&&(l+=s)}else l+=this.renderTokens(t[4],n,r,o,a);return l}};H.prototype.renderInverted=function(t,n,r,o,a){var i=n.lookup(t[1]);if(!i||Ve(i)&&i.length===0)return this.renderTokens(t[4],n,r,o,a)};H.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),a=t.split(`
5
5
  `),i=0;i<a.length;i++)a[i].length&&(i>0||!r)&&(a[i]=o+a[i]);return a.join(`
6
- `)};X.prototype.renderPartial=function(t,n,r,o){if(r){var a=this.getConfigTags(o),i=En(r)?r(t[1]):r[t[1]];if(i!=null){var l=t[6],s=t[5],c=t[4],p=i;s==0&&c&&(p=this.indentPartial(i,c,l));var u=this.parse(p,a);return this.renderTokens(u,n,r,p,o)}}};X.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};X.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||ie.escape,a=n.lookup(t[1]);if(a!=null)return typeof a=="number"&&o===ie.escape?String(a):o(a)};X.prototype.rawValue=function(t){return t[1]};X.prototype.getConfigTags=function(t){return Be(t)?t:t&&typeof t=="object"?t.tags:void 0};X.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Be(t))return t.escape};ie={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){nt.templateCache=e},get templateCache(){return nt.templateCache}},nt=new X;ie.clearCache=function(){return nt.clearCache()};ie.parse=function(t,n){return nt.parse(t,n)};ie.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ed(t)+'" was given as the first argument for mustache#render(template, view, partials)');return nt.render(t,n,r,o)};ie.escape=Bd;ie.Scanner=rt;ie.Context=$e;ie.Writer=X;Mo=ie});function ot({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Xd({def:n,name:t})]))}function Xd({def:e,name:t}){if(e.type==="env"){let n=process.env[e.key];if(n==null)throw new Error(`Environment variable "${e.key}" not set for variable "${t}"`);return n}return e.default??Jd[e.type]??""}function at({ref:e,variables:t}){if(e.type==="static")return e.value;let n=t[e.name];if(n==null||typeof n=="object")throw new Error(`Variable "${e.name}" is not defined`);return n}function H({ref:e,variables:t}){let n=String(at({ref:e,variables:t}));return On({raw:n,variables:t})}function On({raw:e,variables:t}){return Mo.render(e,t,{},{escape:n=>n})}function Un({ref:e,variables:t}){let n=at({ref:e,variables:t});if(typeof n=="number")return n;let r=Number(n);if(Number.isNaN(r))throw new TypeError(`Cannot convert "${String(n)}" to number`);return r}function De({name:e,store:t,value:n}){return{...t,[e]:n}}var Jd,Se=f(()=>{"use strict";zo();Jd={boolean:!1,number:0,string:""}});function $({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Jo(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Jo(e.name,n)})}}function Jo(e,t){return t==null?e:On({raw:e,variables:t})}var Ve=f(()=>{"use strict";Se()});async function Xo({node:e,page:t,timeout:n}){await $({locator:e.source,page:t,variables:void 0}).dragTo($({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function Go({node:e,page:t,timeout:n}){await $({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Ho({node:e,page:t,variables:n}){return t.once("dialog",async r=>{e.action==="accept"?await r.accept(e.promptText??void 0):await r.dismiss()}),{variables:n}}async function Ko({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=H({ref:e.value,variables:n}),a=JSON.stringify(o);return await t.evaluate(`navigator.clipboard.writeText(${a})`),{variables:n}}if(e.variable==null)throw new Error("clipboard read requires a variable name to store the result");let r=String(await t.evaluate("navigator.clipboard.readText()"));return{variables:De({name:e.variable,store:n,value:r})}}async function Qo({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Yo=f(()=>{"use strict";Ve();Se()});async function _n({node:e,page:t,timeout:n,variables:r}){switch(e.type){case"click":case"check":case"uncheck":case"clear":case"dblclick":case"focus":case"hover":case"scrollIntoView":return Hd({node:e,page:t,timeout:n,variables:r});case"rightClick":return await Go({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=H({ref:e.url,variables:r});return await t.goto(o,{timeout:n,waitUntil:"domcontentloaded"}),await t.waitForLoadState("load",{timeout:n}),await t.waitForFunction("document.body != null && document.body.childElementCount > 0 && (document.body.textContent?.trim().length ?? 0) > 0",void 0,{timeout:n}),await t.evaluate("new Promise((resolve) => { requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined))); })"),{variables:r}}case"fill":return Qd({node:e,page:t,timeout:n,variables:r});case"select":return Yd({node:e,page:t,timeout:n,variables:r});case"type":return Zd({node:e,page:t,timeout:n,variables:r});case"press":return await Kd({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Xo({node:e,page:t,timeout:n}),{variables:r};case"upload":return ep({node:e,page:t,timeout:n,variables:r});case"extractText":return tp({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=at({ref:e.value,variables:r});return{variables:De({name:e.variable,store:r,value:o})}}case"fail":throw new Error(e.message);case"setViewport":return await t.setViewportSize({height:e.height,width:e.width}),{variables:r};case"handleDialog":return Ho({node:e,page:t,variables:r});case"clipboard":return Ko({node:e,page:t,variables:r});case"setPermission":return await Qo({node:e,page:t}),{variables:r}}}async function Hd({node:e,page:t,timeout:n,variables:r}){return await $({locator:e.locator,page:t,variables:r})[Gd[e.type]]({timeout:n}),{variables:r}}async function Kd({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await $({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Qd({node:e,page:t,timeout:n,variables:r}){let o=H({ref:e.value,variables:r});return await $({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Yd({node:e,page:t,timeout:n,variables:r}){let o=H({ref:e.value,variables:r});return await $({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function Zd({node:e,page:t,timeout:n,variables:r}){let o=H({ref:e.value,variables:r});return await $({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function ep({node:e,page:t,timeout:n,variables:r}){return await $({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function tp({node:e,page:t,timeout:n,variables:r}){let o=await $({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:De({name:e.variable,store:r,value:o})}}var Gd,In=f(()=>{"use strict";Yo();Ve();Se();Gd={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function ke({page:e,runStartTime:t,targets:n}){let r=e.viewportSize();if(r==null)throw new Error("Page has no viewport set");let[o,a]=await Promise.all([e.screenshot({type:"png"}),rp(n)]),i=o.toString("base64");return{annotations:a,screenshotBase64:i,snapshotTimestamp:Math.round(performance.now()-t),url:e.url(),viewportHeight:r.height,viewportWidth:r.width}}function np(e){return"locator"in e}async function rp(e){return(await Promise.all(e.map(n=>op(n)))).filter(n=>n!=null)}async function op(e){if(!np(e))return{height:0,label:e.label,type:e.type,width:0,x:0,y:0};if(!await e.locator.isVisible().catch(()=>!1))return;let n=await e.locator.boundingBox().catch(()=>null);if(n!=null)return{height:Math.round(n.height),label:e.label,type:e.type,width:Math.round(n.width),x:Math.round(n.x),y:Math.round(n.y)}}function Et({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=$({locator:e.source,page:t,variables:void 0}),a=$({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:a,type:"action"}]}if(!ap(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=$({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function ap(e){return"locator"in e&&e.locator!=null}var it=f(()=>{"use strict";Ve()});import{z as ip}from"zod";function N({description:e,execute:t,name:n,schema:r}){let o=ip.toJSONSchema(r,{target:"draft-2020-12"});return{anthropicTool:{description:e,input_schema:{...o,type:"object"},name:n},name:n,async execute(a,i){let l=r.parse(i);return{...await Promise.resolve(t(a,l)),kind:"action"}}}}async function L(e){let t=e.specNode==null?[]:Et({node:e.specNode,page:e.page}),n=await ke({page:e.page,runStartTime:e.runStartTime,targets:t}),r=[...e.assertions],o={annotations:n.annotations,assertions:r,detail:e.detail,duration:Math.round(e.duration),nodeId:`agent-step-${String(e.stepIndex)}`,nodeType:e.nodeType,screenshotBase64:n.screenshotBase64,snapshotTimestamp:n.snapshotTimestamp,status:e.status,stepIndex:e.stepIndex,title:e.title,url:n.url,viewportHeight:n.viewportHeight,viewportWidth:n.viewportWidth},a=r.length>0?r.map(i=>`${i.status}: ${i.description} \u2014 ${i.detail??""}`).join(`
7
- `):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:a}}var O=f(()=>{"use strict";it()});import{z as Zo}from"zod";var sp,ea,ta=f(()=>{"use strict";O();sp=Zo.object({selector:Zo.string().describe("CSS selector for the checkbox or radio button")}),ea=N({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:sp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isChecked().catch(()=>!1),o=r?"passed":"failed",a=[{description:`Element ${t.selector} is checked`,detail:r?void 0:"Element is not checked",status:o}];return L({assertions:a,detail:r?"Element is checked":"Element is not checked",duration:performance.now()-n,nodeType:"assertChecked",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:o,stepIndex:e.stepIndex,title:`Assert checked: ${t.selector}`})}})});import{z as na}from"zod";var lp,ra,oa=f(()=>{"use strict";O();lp=na.object({selector:na.string().describe("CSS selector for the element to check focus on")}),ra=N({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:lp,execute:async(e,t)=>{let n=performance.now(),o=!!await e.page.locator(t.selector).evaluate("(el) => document.activeElement === el").catch(()=>!1),a=o?"passed":"failed",i=[{description:`Element ${t.selector} is focused`,detail:o?void 0:"Element does not have focus",status:a}];return L({assertions:i,detail:o?"Element is focused":"Element does not have focus",duration:performance.now()-n,nodeType:"assertFocused",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:a,stepIndex:e.stepIndex,title:`Assert focused: ${t.selector}`})}})});import{z as jn}from"zod";var cp,aa,ia=f(()=>{"use strict";O();cp=jn.object({expected:jn.string().describe("The expected text content"),selector:jn.string().describe("CSS selector for the element to check")}),aa=N({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:cp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).textContent({timeout:5e3}).catch(()=>null),o=r!=null&&r.includes(t.expected),a=o?"passed":"failed",i=[{description:`Text contains "${t.expected}"`,detail:`Actual: "${r??"(not found)"}"`,status:a}];return L({assertions:i,detail:o?`Text matches: "${t.expected}"`:`Expected "${t.expected}", got "${r??"(not found)"}"`,duration:performance.now()-n,nodeType:"assertText",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:a,stepIndex:e.stepIndex,title:`Assert text: ${t.selector}`})}})});import{z as $n}from"zod";function pp({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="contains"?e.includes(t):n==="startsWith"?e.startsWith(t):n==="endsWith"?e.endsWith(t):!1}var dp,sa,la=f(()=>{"use strict";O();dp=$n.object({expected:$n.string().describe("Expected page title or substring"),operator:$n.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),sa=N({description:"Assert that the page title matches an expected value",name:"assert_title",schema:dp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=pp({actual:r,expected:t.expected,operator:t.operator}),a=o?"passed":"failed",i=[{description:`Title ${t.operator} "${t.expected}"`,detail:o?void 0:`Got: "${r}"`,status:a}],l=`agent-step-${String(e.stepIndex)}`,s={expected:{type:"static",value:t.expected},id:l,operator:t.operator,type:"assertTitle"};return L({assertions:i,detail:o?"Title matches":`Expected title ${t.operator} "${t.expected}", got "${r}"`,duration:performance.now()-n,nodeType:"assertTitle",page:e.page,runStartTime:e.runStartTime,specNode:s,status:a,stepIndex:e.stepIndex,title:`Assert title ${t.operator} "${t.expected}"`})}})});import{z as ca}from"zod";var up,da,pa=f(()=>{"use strict";O();up=ca.object({selector:ca.string().describe("CSS selector for the element to check")}),da=N({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:up,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isVisible().catch(()=>!1),o=r?"passed":"failed",a=[{description:`Element ${t.selector} is visible`,detail:r?"Element is visible":"Element is not visible",status:o}];return L({assertions:a,detail:r?"Element is visible":"Element is not visible",duration:performance.now()-n,nodeType:"assertVisible",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:o,stepIndex:e.stepIndex,title:`Assert visible: ${t.selector}`})}})});import{z as ua}from"zod";var mp,ma,fa=f(()=>{"use strict";O();mp=ua.object({selector:ua.string().describe("CSS selector for the checkbox to check")}),ma=N({description:"Check a checkbox matching the CSS selector",name:"check",schema:mp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),L({assertions:[],detail:`Checked ${t.selector}`,duration:performance.now()-n,nodeType:"check",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Check ${t.selector}`})}})});import{z as ya}from"zod";var fp,ga,ha=f(()=>{"use strict";O();fp=ya.object({selector:ya.string().describe("CSS selector for the input to clear")}),ga=N({description:"Clear the contents of an input field",name:"clear",schema:fp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),L({assertions:[],detail:`Cleared ${t.selector}`,duration:performance.now()-n,nodeType:"clear",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Clear ${t.selector}`})}})});import{z as Sa}from"zod";var yp,ka,Aa=f(()=>{"use strict";O();yp=Sa.object({selector:Sa.string().describe("CSS selector for the element to click")}),ka=N({description:"Click an element matching the CSS selector",name:"click",schema:yp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),L({assertions:[],detail:`Clicked ${t.selector}`,duration:performance.now()-n,nodeType:"click",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Click ${t.selector}`})}})});import{z as Bn}from"zod";var gp,wa,ba=f(()=>{"use strict";O();gp=Bn.object({action:Bn.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Bn.string().optional().describe("Text to write (required for write action)")}),wa=N({description:"Read from or write to the browser clipboard. For write, provide the text value. For read, the clipboard contents are returned.",name:"clipboard",schema:gp,execute:async(e,t)=>{let n=performance.now(),r=`agent-step-${String(e.stepIndex)}`;if(t.action==="write"){if(t.value==null)throw new Error("clipboard write requires a value");let i=JSON.stringify(t.value);await e.page.evaluate(`navigator.clipboard.writeText(${i})`);let l={action:"write",id:r,type:"clipboard",value:{type:"static",value:t.value}};return L({assertions:[],detail:`Wrote to clipboard: "${t.value}"`,duration:performance.now()-n,nodeType:"clipboard",page:e.page,runStartTime:e.runStartTime,specNode:l,status:"passed",stepIndex:e.stepIndex,title:"Clipboard write"})}let o=String(await e.page.evaluate("navigator.clipboard.readText()")),a={action:"read",id:r,type:"clipboard"};return L({assertions:[],detail:`Clipboard contents: "${o}"`,duration:performance.now()-n,nodeType:"clipboard",page:e.page,runStartTime:e.runStartTime,specNode:a,status:"passed",stepIndex:e.stepIndex,title:"Clipboard read"})}})});import{z as Ot}from"zod";var Na,Ta,Ra=f(()=>{"use strict";Na=Ot.object({summary:Ot.string().describe("This is the ONLY output the user sees. If the agent profile specifies an Output format, follow those instructions exactly. Otherwise, provide a summary of your findings."),verdict:Ot.enum(["pass","fail"]).describe("Whether the test passed or failed. If the agent profile defines Success Criteria, base this verdict on whether those criteria were met.")}),Ta={anthropicTool:{description:"Call this tool when you have finished your evaluation. If the agent profile defines an Output section, the summary MUST follow those output instructions exactly. Otherwise, summarize your findings.",input_schema:{...Ot.toJSONSchema(Na,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Na.parse(t),r={kind:"verdict",summary:n.summary,toolOutput:`Verdict: ${n.verdict}
8
- ${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as La}from"zod";var hp,Ca,va=f(()=>{"use strict";O();hp=La.object({selector:La.string().describe("CSS selector for the element to extract text from")}),Ca=N({description:"Extract the text content of an element matching the CSS selector. Returns the text so you can use it in assertions or decisions.",name:"extract_text",schema:hp,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return L({assertions:[],detail:`Extracted text: "${o}"`,duration:performance.now()-n,nodeType:"extractText",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Extract text from ${t.selector}`})}})});import{z as Dn}from"zod";var Sp,xa,Pa=f(()=>{"use strict";O();Sp=Dn.object({selector:Dn.string().describe("CSS selector for the input element"),value:Dn.string().describe("The text to type into the element")}),xa=N({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Sp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),L({assertions:[],detail:`Filled ${t.selector} with "${t.value}"`,duration:performance.now()-n,nodeType:"fill",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Fill ${t.selector}`})}})});import{z as Ea}from"zod";function Ap(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var kp,Oa,Ua=f(()=>{"use strict";O();kp=Ea.object({level:Ea.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),Oa=N({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:kp,execute:(e,t)=>{let n=t.level==="all"?e.monitor.consoleEntries:e.monitor.consoleEntries.filter(o=>o.level===t.level);if(n.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No console ${t.level==="all"?"messages":t.level+" messages"} recorded.`};let r=n.map(o=>Ap(o)).join(`
6
+ `)};H.prototype.renderPartial=function(t,n,r,o){if(r){var a=this.getConfigTags(o),i=Un(r)?r(t[1]):r[t[1]];if(i!=null){var l=t[6],s=t[5],c=t[4],p=i;s==0&&c&&(p=this.indentPartial(i,c,l));var u=this.parse(p,a);return this.renderTokens(u,n,r,p,o)}}};H.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};H.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||se.escape,a=n.lookup(t[1]);if(a!=null)return typeof a=="number"&&o===se.escape?String(a):o(a)};H.prototype.rawValue=function(t){return t[1]};H.prototype.getConfigTags=function(t){return Ve(t)?t:t&&typeof t=="object"?t.tags:void 0};H.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Ve(t))return t.escape};se={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){nt.templateCache=e},get templateCache(){return nt.templateCache}},nt=new H;se.clearCache=function(){return nt.clearCache()};se.parse=function(t,n){return nt.parse(t,n)};se.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Pd(t)+'" was given as the first argument for mustache#render(template, view, partials)');return nt.render(t,n,r,o)};se.escape=$d;se.Scanner=rt;se.Context=De;se.Writer=H;zo=se});function ot({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Jd({def:n,name:t})]))}function Jd({def:e,name:t}){if(e.type==="env"){let n=process.env[e.key];if(n==null)throw new Error(`Environment variable "${e.key}" not set for variable "${t}"`);return n}return e.default??zd[e.type]??""}function at({ref:e,variables:t}){if(e.type==="static")return e.value;let n=t[e.name];if(n==null||typeof n=="object")throw new Error(`Variable "${e.name}" is not defined`);return n}function Y({ref:e,variables:t}){let n=String(at({ref:e,variables:t}));return _n({raw:n,variables:t})}function _n({raw:e,variables:t}){return zo.render(e,t,{},{escape:n=>n})}function In({ref:e,variables:t}){let n=at({ref:e,variables:t});if(typeof n=="number")return n;let r=Number(n);if(Number.isNaN(r))throw new TypeError(`Cannot convert "${String(n)}" to number`);return r}function We({name:e,store:t,value:n}){return{...t,[e]:n}}var zd,ke=f(()=>{"use strict";Jo();zd={boolean:!1,number:0,string:""}});function D({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Xo(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Xo(e.name,n)})}}function Xo(e,t){return t==null?e:_n({raw:e,variables:t})}var Fe=f(()=>{"use strict";ke()});async function Go({node:e,page:t,timeout:n}){await D({locator:e.source,page:t,variables:void 0}).dragTo(D({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function Ho({node:e,page:t,timeout:n}){await D({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Ko({node:e,page:t,variables:n}){return t.once("dialog",async r=>{e.action==="accept"?await r.accept(e.promptText??void 0):await r.dismiss()}),{variables:n}}async function Yo({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=Y({ref:e.value,variables:n}),a=JSON.stringify(o);return await t.evaluate(`navigator.clipboard.writeText(${a})`),{variables:n}}if(e.variable==null)throw new Error("clipboard read requires a variable name to store the result");let r=String(await t.evaluate("navigator.clipboard.readText()"));return{variables:We({name:e.variable,store:n,value:r})}}async function Qo({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Zo=f(()=>{"use strict";Fe();ke()});async function jn({node:e,page:t,timeout:n,variables:r}){switch(e.type){case"click":case"check":case"uncheck":case"clear":case"dblclick":case"focus":case"hover":case"scrollIntoView":return Gd({node:e,page:t,timeout:n,variables:r});case"rightClick":return await Ho({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=Y({ref:e.url,variables:r});return await t.goto(o,{timeout:n,waitUntil:"domcontentloaded"}),await t.waitForLoadState("load",{timeout:n}),await t.waitForFunction("document.body != null && document.body.childElementCount > 0 && (document.body.textContent?.trim().length ?? 0) > 0",void 0,{timeout:n}),await t.evaluate("new Promise((resolve) => { requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined))); })"),{variables:r}}case"fill":return Kd({node:e,page:t,timeout:n,variables:r});case"select":return Yd({node:e,page:t,timeout:n,variables:r});case"type":return Qd({node:e,page:t,timeout:n,variables:r});case"press":return await Hd({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Go({node:e,page:t,timeout:n}),{variables:r};case"upload":return Zd({node:e,page:t,timeout:n,variables:r});case"extractText":return ep({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=at({ref:e.value,variables:r});return{variables:We({name:e.variable,store:r,value:o})}}case"fail":throw new Error(e.message);case"setViewport":return await t.setViewportSize({height:e.height,width:e.width}),{variables:r};case"handleDialog":return Ko({node:e,page:t,variables:r});case"clipboard":return Yo({node:e,page:t,variables:r});case"setPermission":return await Qo({node:e,page:t}),{variables:r}}}async function Gd({node:e,page:t,timeout:n,variables:r}){return await D({locator:e.locator,page:t,variables:r})[Xd[e.type]]({timeout:n}),{variables:r}}async function Hd({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await D({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Kd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await D({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Yd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await D({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function Qd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await D({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Zd({node:e,page:t,timeout:n,variables:r}){return await D({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function ep({node:e,page:t,timeout:n,variables:r}){let o=await D({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:We({name:e.variable,store:r,value:o})}}var Xd,$n=f(()=>{"use strict";Zo();Fe();ke();Xd={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function Ae({page:e,runStartTime:t,targets:n}){let r=e.viewportSize();if(r==null)throw new Error("Page has no viewport set");let[o,a]=await Promise.all([e.screenshot({type:"png"}),np(n)]),i=o.toString("base64");return{annotations:a,screenshotBase64:i,snapshotTimestamp:Math.round(performance.now()-t),url:e.url(),viewportHeight:r.height,viewportWidth:r.width}}function tp(e){return"locator"in e}async function np(e){return(await Promise.all(e.map(n=>rp(n)))).filter(n=>n!=null)}async function rp(e){if(!tp(e))return{height:0,label:e.label,type:e.type,width:0,x:0,y:0};if(!await e.locator.isVisible().catch(()=>!1))return;let n=await e.locator.boundingBox().catch(()=>null);if(n!=null)return{height:Math.round(n.height),label:e.label,type:e.type,width:Math.round(n.width),x:Math.round(n.x),y:Math.round(n.y)}}function Ot({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=D({locator:e.source,page:t,variables:void 0}),a=D({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:a,type:"action"}]}if(!op(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=D({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function op(e){return"locator"in e&&e.locator!=null}var it=f(()=>{"use strict";Fe()});import{z as ap}from"zod";function N({description:e,execute:t,name:n,schema:r}){let o=ap.toJSONSchema(r,{target:"draft-2020-12"});return{anthropicTool:{description:e,input_schema:{...o,type:"object"},name:n},name:n,async execute(a,i){let l=r.parse(i);return{...await Promise.resolve(t(a,l)),kind:"action"}}}}async function R(e){let t=e.specNode==null?[]:Ot({node:e.specNode,page:e.page}),n=await Ae({page:e.page,runStartTime:e.runStartTime,targets:t}),r=[...e.assertions],o={annotations:n.annotations,assertions:r,detail:e.detail,duration:Math.round(e.duration),nodeId:`agent-step-${String(e.stepIndex)}`,nodeType:e.nodeType,screenshotBase64:n.screenshotBase64,snapshotTimestamp:n.snapshotTimestamp,status:e.status,stepIndex:e.stepIndex,title:e.title,url:n.url,viewportHeight:n.viewportHeight,viewportWidth:n.viewportWidth},a=r.length>0?r.map(i=>`${i.status}: ${i.description} \u2014 ${i.detail??""}`).join(`
7
+ `):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:a}}var U=f(()=>{"use strict";it()});import{z as ea}from"zod";var ip,ta,na=f(()=>{"use strict";U();ip=ea.object({selector:ea.string().describe("CSS selector for the checkbox or radio button")}),ta=N({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:ip,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isChecked().catch(()=>!1),o=r?"passed":"failed",a=[{description:`Element ${t.selector} is checked`,detail:r?void 0:"Element is not checked",status:o}];return R({assertions:a,detail:r?"Element is checked":"Element is not checked",duration:performance.now()-n,nodeType:"assertChecked",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:o,stepIndex:e.stepIndex,title:`Assert checked: ${t.selector}`})}})});import{z as ra}from"zod";var sp,oa,aa=f(()=>{"use strict";U();sp=ra.object({selector:ra.string().describe("CSS selector for the element to check focus on")}),oa=N({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:sp,execute:async(e,t)=>{let n=performance.now(),o=!!await e.page.locator(t.selector).evaluate("(el) => document.activeElement === el").catch(()=>!1),a=o?"passed":"failed",i=[{description:`Element ${t.selector} is focused`,detail:o?void 0:"Element does not have focus",status:a}];return R({assertions:i,detail:o?"Element is focused":"Element does not have focus",duration:performance.now()-n,nodeType:"assertFocused",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:a,stepIndex:e.stepIndex,title:`Assert focused: ${t.selector}`})}})});import{z as Bn}from"zod";var lp,ia,sa=f(()=>{"use strict";U();lp=Bn.object({expected:Bn.string().describe("The expected text content"),selector:Bn.string().describe("CSS selector for the element to check")}),ia=N({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:lp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).textContent({timeout:5e3}).catch(()=>null),o=r!=null&&r.includes(t.expected),a=o?"passed":"failed",i=[{description:`Text contains "${t.expected}"`,detail:`Actual: "${r??"(not found)"}"`,status:a}];return R({assertions:i,detail:o?`Text matches: "${t.expected}"`:`Expected "${t.expected}", got "${r??"(not found)"}"`,duration:performance.now()-n,nodeType:"assertText",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:a,stepIndex:e.stepIndex,title:`Assert text: ${t.selector}`})}})});import{z as Dn}from"zod";function dp({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="contains"?e.includes(t):n==="startsWith"?e.startsWith(t):n==="endsWith"?e.endsWith(t):!1}var cp,la,ca=f(()=>{"use strict";U();cp=Dn.object({expected:Dn.string().describe("Expected page title or substring"),operator:Dn.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),la=N({description:"Assert that the page title matches an expected value",name:"assert_title",schema:cp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=dp({actual:r,expected:t.expected,operator:t.operator}),a=o?"passed":"failed",i=[{description:`Title ${t.operator} "${t.expected}"`,detail:o?void 0:`Got: "${r}"`,status:a}],l=`agent-step-${String(e.stepIndex)}`,s={expected:{type:"static",value:t.expected},id:l,operator:t.operator,type:"assertTitle"};return R({assertions:i,detail:o?"Title matches":`Expected title ${t.operator} "${t.expected}", got "${r}"`,duration:performance.now()-n,nodeType:"assertTitle",page:e.page,runStartTime:e.runStartTime,specNode:s,status:a,stepIndex:e.stepIndex,title:`Assert title ${t.operator} "${t.expected}"`})}})});import{z as da}from"zod";var pp,pa,ua=f(()=>{"use strict";U();pp=da.object({selector:da.string().describe("CSS selector for the element to check")}),pa=N({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:pp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isVisible().catch(()=>!1),o=r?"passed":"failed",a=[{description:`Element ${t.selector} is visible`,detail:r?"Element is visible":"Element is not visible",status:o}];return R({assertions:a,detail:r?"Element is visible":"Element is not visible",duration:performance.now()-n,nodeType:"assertVisible",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:o,stepIndex:e.stepIndex,title:`Assert visible: ${t.selector}`})}})});import{z as ma}from"zod";var up,fa,ya=f(()=>{"use strict";U();up=ma.object({selector:ma.string().describe("CSS selector for the checkbox to check")}),fa=N({description:"Check a checkbox matching the CSS selector",name:"check",schema:up,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),R({assertions:[],detail:`Checked ${t.selector}`,duration:performance.now()-n,nodeType:"check",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Check ${t.selector}`})}})});import{z as ga}from"zod";var mp,ha,Sa=f(()=>{"use strict";U();mp=ga.object({selector:ga.string().describe("CSS selector for the input to clear")}),ha=N({description:"Clear the contents of an input field",name:"clear",schema:mp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),R({assertions:[],detail:`Cleared ${t.selector}`,duration:performance.now()-n,nodeType:"clear",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Clear ${t.selector}`})}})});import{z as ka}from"zod";var fp,Aa,wa=f(()=>{"use strict";U();fp=ka.object({selector:ka.string().describe("CSS selector for the element to click")}),Aa=N({description:"Click an element matching the CSS selector",name:"click",schema:fp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),R({assertions:[],detail:`Clicked ${t.selector}`,duration:performance.now()-n,nodeType:"click",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Click ${t.selector}`})}})});import{z as Vn}from"zod";var yp,ba,Na=f(()=>{"use strict";U();yp=Vn.object({action:Vn.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Vn.string().optional().describe("Text to write (required for write action)")}),ba=N({description:"Read from or write to the browser clipboard. For write, provide the text value. For read, the clipboard contents are returned.",name:"clipboard",schema:yp,execute:async(e,t)=>{let n=performance.now(),r=`agent-step-${String(e.stepIndex)}`;if(t.action==="write"){if(t.value==null)throw new Error("clipboard write requires a value");let i=JSON.stringify(t.value);await e.page.evaluate(`navigator.clipboard.writeText(${i})`);let l={action:"write",id:r,type:"clipboard",value:{type:"static",value:t.value}};return R({assertions:[],detail:`Wrote to clipboard: "${t.value}"`,duration:performance.now()-n,nodeType:"clipboard",page:e.page,runStartTime:e.runStartTime,specNode:l,status:"passed",stepIndex:e.stepIndex,title:"Clipboard write"})}let o=String(await e.page.evaluate("navigator.clipboard.readText()")),a={action:"read",id:r,type:"clipboard"};return R({assertions:[],detail:`Clipboard contents: "${o}"`,duration:performance.now()-n,nodeType:"clipboard",page:e.page,runStartTime:e.runStartTime,specNode:a,status:"passed",stepIndex:e.stepIndex,title:"Clipboard read"})}})});import{z as Ut}from"zod";var Ta,Ra,La=f(()=>{"use strict";Ta=Ut.object({summary:Ut.string().describe("This is the ONLY output the user sees. If the agent profile specifies an Output format, follow those instructions exactly. Otherwise, provide a summary of your findings."),verdict:Ut.enum(["pass","fail"]).describe("Whether the test passed or failed. If the agent profile defines Success Criteria, base this verdict on whether those criteria were met.")}),Ra={anthropicTool:{description:"Call this tool when you have finished your evaluation. If the agent profile defines an Output section, the summary MUST follow those output instructions exactly. Otherwise, summarize your findings.",input_schema:{...Ut.toJSONSchema(Ta,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Ta.parse(t),r={kind:"verdict",summary:n.summary,toolOutput:`Verdict: ${n.verdict}
8
+ ${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as Ca}from"zod";var gp,va,xa=f(()=>{"use strict";U();gp=Ca.object({selector:Ca.string().describe("CSS selector for the element to extract text from")}),va=N({description:"Extract the text content of an element matching the CSS selector. Returns the text so you can use it in assertions or decisions.",name:"extract_text",schema:gp,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return R({assertions:[],detail:`Extracted text: "${o}"`,duration:performance.now()-n,nodeType:"extractText",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Extract text from ${t.selector}`})}})});import{z as Wn}from"zod";var hp,Pa,Ea=f(()=>{"use strict";U();hp=Wn.object({selector:Wn.string().describe("CSS selector for the input element"),value:Wn.string().describe("The text to type into the element")}),Pa=N({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:hp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),R({assertions:[],detail:`Filled ${t.selector} with "${t.value}"`,duration:performance.now()-n,nodeType:"fill",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Fill ${t.selector}`})}})});import{z as Oa}from"zod";function kp(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Sp,Ua,_a=f(()=>{"use strict";U();Sp=Oa.object({level:Oa.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),Ua=N({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:Sp,execute:(e,t)=>{let n=t.level==="all"?e.monitor.consoleEntries:e.monitor.consoleEntries.filter(o=>o.level===t.level);if(n.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No console ${t.level==="all"?"messages":t.level+" messages"} recorded.`};let r=n.map(o=>kp(o)).join(`
9
9
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
10
- ${r}`}}})});import{z as _a}from"zod";var Vn,wp,Ia,ja=f(()=>{"use strict";O();Vn=50,wp=_a.object({urlFilter:_a.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),Ia=N({description:"Get a summary of network requests/responses. Shows method, URL, status code, and content type. Optionally filter by URL regex.",name:"get_network_log",schema:wp,execute:(e,t)=>{let n=t.urlFilter.length>0?new RegExp(t.urlFilter,"i"):void 0,r=n==null?e.monitor.networkEntries:e.monitor.networkEntries.filter(l=>n.test(l.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No network requests recorded."};let o=r.slice(-Vn),a=o.map(l=>{let s=l.statusCode==null?"pending":String(l.statusCode),c=l.responseHeaders["content-type"]??"";return`${l.method} ${s} ${l.url} [${c}]`}).join(`
11
- `),i=r.length>Vn?`
12
- (showing last ${String(Vn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${i}
13
- ${a}`}}})});import{z as $a}from"zod";var bp,Ba,Da=f(()=>{"use strict";O();bp=$a.object({urlPattern:$a.string().describe("Regex pattern to match the request URL")}),Ba=N({description:"Get the full response body for a specific network request matching the URL pattern. Returns the most recent match.",name:"get_network_response",schema:bp,execute:(e,t)=>{let n=new RegExp(t.urlPattern,"i"),r=e.monitor.networkEntries.filter(s=>n.test(s.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let o=r.at(-1);if(o==null)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let a=o.statusCode==null?"pending":String(o.statusCode),i=Object.entries(o.responseHeaders).map(([s,c])=>` ${s}: ${c}`).join(`
10
+ ${r}`}}})});import{z as Ia}from"zod";var Fn,Ap,ja,$a=f(()=>{"use strict";U();Fn=50,Ap=Ia.object({urlFilter:Ia.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),ja=N({description:"Get a summary of network requests/responses. Shows method, URL, status code, and content type. Optionally filter by URL regex.",name:"get_network_log",schema:Ap,execute:(e,t)=>{let n=t.urlFilter.length>0?new RegExp(t.urlFilter,"i"):void 0,r=n==null?e.monitor.networkEntries:e.monitor.networkEntries.filter(l=>n.test(l.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No network requests recorded."};let o=r.slice(-Fn),a=o.map(l=>{let s=l.statusCode==null?"pending":String(l.statusCode),c=l.responseHeaders["content-type"]??"";return`${l.method} ${s} ${l.url} [${c}]`}).join(`
11
+ `),i=r.length>Fn?`
12
+ (showing last ${String(Fn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${i}
13
+ ${a}`}}})});import{z as Ba}from"zod";var wp,Da,Va=f(()=>{"use strict";U();wp=Ba.object({urlPattern:Ba.string().describe("Regex pattern to match the request URL")}),Da=N({description:"Get the full response body for a specific network request matching the URL pattern. Returns the most recent match.",name:"get_network_response",schema:wp,execute:(e,t)=>{let n=new RegExp(t.urlPattern,"i"),r=e.monitor.networkEntries.filter(s=>n.test(s.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let o=r.at(-1);if(o==null)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let a=o.statusCode==null?"pending":String(o.statusCode),i=Object.entries(o.responseHeaders).map(([s,c])=>` ${s}: ${c}`).join(`
14
14
  `),l=o.responseBody??"(no body captured)";return{specNode:void 0,stepResult:void 0,toolOutput:`${o.method} ${a} ${o.url}
15
15
 
16
16
  Response Headers:
17
17
  ${i}
18
18
 
19
19
  Body:
20
- ${l}`}}})});import{z as Va}from"zod";var Np,Wa,qa=f(()=>{"use strict";O();Np=Va.object({selector:Va.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),Wa=N({description:"Get the accessibility tree (ARIA snapshot) of the current page or a specific element. Use this to verify ARIA roles, labels, states, and the semantic structure of the page.",name:"get_accessibility_tree",schema:Np,execute:async(e,t)=>{let n=t.selector==null?e.page.locator(":root"):e.page.locator(t.selector);try{return{specNode:void 0,stepResult:void 0,toolOutput:await n.ariaSnapshot()}}catch{return{specNode:void 0,stepResult:void 0,toolOutput:"(unable to capture accessibility tree)"}}}})});import{z as Tp}from"zod";var Rp,Fa,Ma=f(()=>{"use strict";O();Rp=Tp.object({}),Fa=N({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:Rp,execute:async(e,t)=>{let n=await e.page.locator("body").textContent({timeout:5e3}),r=e.page.url(),o=await e.page.title();return{specNode:void 0,stepResult:void 0,toolOutput:`URL: ${r}
20
+ ${l}`}}})});import{z as Wa}from"zod";var bp,Fa,qa=f(()=>{"use strict";U();bp=Wa.object({selector:Wa.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),Fa=N({description:"Get the accessibility tree (ARIA snapshot) of the current page or a specific element. Use this to verify ARIA roles, labels, states, and the semantic structure of the page.",name:"get_accessibility_tree",schema:bp,execute:async(e,t)=>{let n=t.selector==null?e.page.locator(":root"):e.page.locator(t.selector);try{return{specNode:void 0,stepResult:void 0,toolOutput:await n.ariaSnapshot()}}catch{return{specNode:void 0,stepResult:void 0,toolOutput:"(unable to capture accessibility tree)"}}}})});import{z as Np}from"zod";var Tp,Ma,za=f(()=>{"use strict";U();Tp=Np.object({}),Ma=N({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:Tp,execute:async(e,t)=>{let n=await e.page.locator("body").textContent({timeout:5e3}),r=e.page.url(),o=await e.page.title();return{specNode:void 0,stepResult:void 0,toolOutput:`URL: ${r}
21
21
  Title: ${o}
22
22
 
23
- ${n??""}`}}})});import{z as Lp}from"zod";var Cp,za,Ja=f(()=>{"use strict";O();Cp=Lp.object({}),za=N({description:"Get uncaught JavaScript exceptions (page errors) that have occurred. These are runtime errors thrown in the browser that were not caught by error handlers.",name:"get_page_errors",schema:Cp,execute:(e,t)=>{if(e.monitor.pageErrors.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No page errors recorded."};let n=e.monitor.pageErrors.map((r,o)=>`--- Error ${String(o+1)} ---
23
+ ${n??""}`}}})});import{z as Rp}from"zod";var Lp,Ja,Xa=f(()=>{"use strict";U();Lp=Rp.object({}),Ja=N({description:"Get uncaught JavaScript exceptions (page errors) that have occurred. These are runtime errors thrown in the browser that were not caught by error handlers.",name:"get_page_errors",schema:Lp,execute:(e,t)=>{if(e.monitor.pageErrors.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No page errors recorded."};let n=e.monitor.pageErrors.map((r,o)=>`--- Error ${String(o+1)} ---
24
24
  ${r}`).join(`
25
25
 
26
26
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(e.monitor.pageErrors.length)} page errors:
27
27
 
28
- ${n}`}}})});import{z as Xa}from"zod";async function xp(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
28
+ ${n}`}}})});import{z as Ga}from"zod";async function vp(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
29
29
  (none)`;let n=t.map(r=>` ${r.name}=${r.value} (domain=${r.domain}, httpOnly=${String(r.httpOnly)}, secure=${String(r.secure)}, sameSite=${r.sameSite})`);return`## Cookies (${String(t.length)})
30
30
  ${n.join(`
31
- `)}`}async function Ga(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
- ${String(n)}`}var vp,Ha,Ka=f(()=>{"use strict";O();vp=Xa.object({type:Xa.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),Ha=N({description:"Get browser storage state: cookies (with httpOnly, secure, sameSite flags), localStorage, and/or sessionStorage. Useful for verifying authentication state, security cookie flags, and stored data.",name:"get_storage",schema:vp,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await xp(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await Ga(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await Ga(e.page,"sessionStorage")]:[]].join(`
31
+ `)}`}async function Ha(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
+ ${String(n)}`}var Cp,Ka,Ya=f(()=>{"use strict";U();Cp=Ga.object({type:Ga.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),Ka=N({description:"Get browser storage state: cookies (with httpOnly, secure, sameSite flags), localStorage, and/or sessionStorage. Useful for verifying authentication state, security cookie flags, and stored data.",name:"get_storage",schema:Cp,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await vp(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await Ha(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await Ha(e.page,"sessionStorage")]:[]].join(`
33
33
 
34
- `)})})});import{z as Wn}from"zod";var Pp,Qa,Ya=f(()=>{"use strict";O();Pp=Wn.object({action:Wn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:Wn.string().optional().describe("Text to enter for prompt dialogs")}),Qa=N({description:"Set up a handler for the next browser dialog (alert, confirm, prompt). Call this BEFORE the action that triggers the dialog.",name:"handle_dialog",schema:Pp,execute:(e,t)=>{let n=performance.now();e.page.once("dialog",async a=>{t.action==="accept"?await a.accept(t.promptText??void 0):await a.dismiss()});let r=`agent-step-${String(e.stepIndex)}`,o={action:t.action,id:r,type:"handleDialog"};return L({assertions:[],detail:`Dialog handler set: ${t.action}`,duration:performance.now()-n,nodeType:"handleDialog",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Handle dialog: ${t.action}`})}})});import{z as Za}from"zod";var Ep,ei,ti=f(()=>{"use strict";O();Ep=Za.object({selector:Za.string().describe("CSS selector for the element to hover over")}),ei=N({description:"Hover over an element matching the CSS selector",name:"hover",schema:Ep,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),L({assertions:[],detail:`Hovered over ${t.selector}`,duration:performance.now()-n,nodeType:"hover",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Hover ${t.selector}`})}})});import{z as qn}from"zod";var Op,ni,ri=f(()=>{"use strict";O();Op=qn.object({permission:qn.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:qn.enum(["granted","prompt"]).describe("Permission state to set")}),ni=N({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:Op,execute:async(e,t)=>{let n=performance.now(),r=e.page.context();t.state==="granted"?await r.grantPermissions([t.permission]):await r.clearPermissions();let a={id:`agent-step-${String(e.stepIndex)}`,permission:t.permission,state:t.state,type:"setPermission"};return L({assertions:[],detail:`Set ${t.permission} to ${t.state}`,duration:performance.now()-n,nodeType:"setPermission",page:e.page,runStartTime:e.runStartTime,specNode:a,status:"passed",stepIndex:e.stepIndex,title:`Set permission: ${t.permission} \u2192 ${t.state}`})}})});import{z as oi}from"zod";var Up,ai,ii=f(()=>{"use strict";O();Up=oi.object({url:oi.string().describe("The URL to navigate to")}),ai=N({description:"Navigate the browser to a URL",name:"navigate",schema:Up,execute:async(e,t)=>{let n=performance.now();await e.page.goto(t.url,{waitUntil:"domcontentloaded"});let o={id:`agent-step-${String(e.stepIndex)}`,type:"goto",url:{type:"static",value:t.url}};return L({assertions:[],detail:`Navigated to ${t.url}`,duration:performance.now()-n,nodeType:"goto",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Navigate to ${t.url}`})}})});import{z as si}from"zod";var _p,li,ci=f(()=>{"use strict";O();_p=si.object({key:si.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),li=N({description:"Press a keyboard key",name:"press",schema:_p,execute:async(e,t)=>{let n=performance.now();await e.page.keyboard.press(t.key);let o={id:`agent-step-${String(e.stepIndex)}`,key:t.key,type:"press"};return L({assertions:[],detail:`Pressed ${t.key}`,duration:performance.now()-n,nodeType:"press",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Press ${t.key}`})}})});import{z as Fn}from"zod";var Ip,di,pi=f(()=>{"use strict";O();Ip=Fn.object({height:Fn.number().int().positive().describe("Viewport height in pixels"),width:Fn.number().int().positive().describe("Viewport width in pixels")}),di=N({description:"Resize the browser viewport to the specified dimensions. Use this to test responsive layouts at different screen sizes (e.g. mobile: 375x812, tablet: 768x1024, desktop: 1440x900).",name:"resize_viewport",schema:Ip,execute:async(e,t)=>{let n=performance.now();await e.page.setViewportSize({height:t.height,width:t.width});let r=`agent-step-${String(e.stepIndex)}`,o={height:t.height,id:r,type:"setViewport",width:t.width};return L({assertions:[],detail:`Resized viewport to ${String(t.width)}x${String(t.height)}`,duration:performance.now()-n,nodeType:"setViewport",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Resize viewport to ${String(t.width)}x${String(t.height)}`})}})});import{z as ui}from"zod";var jp,mi,fi=f(()=>{"use strict";O();jp=ui.object({selector:ui.string().describe("CSS selector for the element to right-click")}),mi=N({description:"Right-click an element to open the context menu",name:"right_click",schema:jp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),L({assertions:[],detail:`Right-clicked ${t.selector}`,duration:performance.now()-n,nodeType:"rightClick",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Right-click ${t.selector}`})}})});import{z as yi}from"zod";function Bp(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var $p,gi,hi=f(()=>{"use strict";O();$p=yi.object({pattern:yi.string().describe("Regex pattern to search console log messages")}),gi=N({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:$p,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.consoleEntries.filter(a=>n.test(a.text));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No console messages matching: ${t.pattern}`};let o=r.map(a=>Bp(a)).join(`
34
+ `)})})});import{z as qn}from"zod";var xp,Qa,Za=f(()=>{"use strict";U();xp=qn.object({action:qn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:qn.string().optional().describe("Text to enter for prompt dialogs")}),Qa=N({description:"Set up a handler for the next browser dialog (alert, confirm, prompt). Call this BEFORE the action that triggers the dialog.",name:"handle_dialog",schema:xp,execute:(e,t)=>{let n=performance.now();e.page.once("dialog",async a=>{t.action==="accept"?await a.accept(t.promptText??void 0):await a.dismiss()});let r=`agent-step-${String(e.stepIndex)}`,o={action:t.action,id:r,type:"handleDialog"};return R({assertions:[],detail:`Dialog handler set: ${t.action}`,duration:performance.now()-n,nodeType:"handleDialog",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Handle dialog: ${t.action}`})}})});import{z as ei}from"zod";var Pp,ti,ni=f(()=>{"use strict";U();Pp=ei.object({selector:ei.string().describe("CSS selector for the element to hover over")}),ti=N({description:"Hover over an element matching the CSS selector",name:"hover",schema:Pp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),R({assertions:[],detail:`Hovered over ${t.selector}`,duration:performance.now()-n,nodeType:"hover",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Hover ${t.selector}`})}})});import{z as Mn}from"zod";var Ep,ri,oi=f(()=>{"use strict";U();Ep=Mn.object({permission:Mn.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:Mn.enum(["granted","prompt"]).describe("Permission state to set")}),ri=N({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:Ep,execute:async(e,t)=>{let n=performance.now(),r=e.page.context();t.state==="granted"?await r.grantPermissions([t.permission]):await r.clearPermissions();let a={id:`agent-step-${String(e.stepIndex)}`,permission:t.permission,state:t.state,type:"setPermission"};return R({assertions:[],detail:`Set ${t.permission} to ${t.state}`,duration:performance.now()-n,nodeType:"setPermission",page:e.page,runStartTime:e.runStartTime,specNode:a,status:"passed",stepIndex:e.stepIndex,title:`Set permission: ${t.permission} \u2192 ${t.state}`})}})});import{z as ai}from"zod";var Op,ii,si=f(()=>{"use strict";U();Op=ai.object({url:ai.string().describe("The URL to navigate to")}),ii=N({description:"Navigate the browser to a URL",name:"navigate",schema:Op,execute:async(e,t)=>{let n=performance.now();await e.page.goto(t.url,{waitUntil:"domcontentloaded"});let o={id:`agent-step-${String(e.stepIndex)}`,type:"goto",url:{type:"static",value:t.url}};return R({assertions:[],detail:`Navigated to ${t.url}`,duration:performance.now()-n,nodeType:"goto",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Navigate to ${t.url}`})}})});import{z as li}from"zod";var Up,ci,di=f(()=>{"use strict";U();Up=li.object({key:li.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),ci=N({description:"Press a keyboard key",name:"press",schema:Up,execute:async(e,t)=>{let n=performance.now();await e.page.keyboard.press(t.key);let o={id:`agent-step-${String(e.stepIndex)}`,key:t.key,type:"press"};return R({assertions:[],detail:`Pressed ${t.key}`,duration:performance.now()-n,nodeType:"press",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Press ${t.key}`})}})});import{z as zn}from"zod";var _p,pi,ui=f(()=>{"use strict";U();_p=zn.object({height:zn.number().int().positive().describe("Viewport height in pixels"),width:zn.number().int().positive().describe("Viewport width in pixels")}),pi=N({description:"Resize the browser viewport to the specified dimensions. Use this to test responsive layouts at different screen sizes (e.g. mobile: 375x812, tablet: 768x1024, desktop: 1440x900).",name:"resize_viewport",schema:_p,execute:async(e,t)=>{let n=performance.now();await e.page.setViewportSize({height:t.height,width:t.width});let r=`agent-step-${String(e.stepIndex)}`,o={height:t.height,id:r,type:"setViewport",width:t.width};return R({assertions:[],detail:`Resized viewport to ${String(t.width)}x${String(t.height)}`,duration:performance.now()-n,nodeType:"setViewport",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Resize viewport to ${String(t.width)}x${String(t.height)}`})}})});import{z as mi}from"zod";var Ip,fi,yi=f(()=>{"use strict";U();Ip=mi.object({selector:mi.string().describe("CSS selector for the element to right-click")}),fi=N({description:"Right-click an element to open the context menu",name:"right_click",schema:Ip,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),R({assertions:[],detail:`Right-clicked ${t.selector}`,duration:performance.now()-n,nodeType:"rightClick",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Right-click ${t.selector}`})}})});import{z as gi}from"zod";function $p(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var jp,hi,Si=f(()=>{"use strict";U();jp=gi.object({pattern:gi.string().describe("Regex pattern to search console log messages")}),hi=N({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:jp,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.consoleEntries.filter(a=>n.test(a.text));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No console messages matching: ${t.pattern}`};let o=r.map(a=>$p(a)).join(`
35
35
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
36
- ${o}`}}})});import{z as Si}from"zod";var Dp,ki,Ai=f(()=>{"use strict";O();Dp=Si.object({pattern:Si.string().describe("Regex pattern to search across network request URLs and response bodies")}),ki=N({description:"Search network requests and response bodies for a regex pattern. Useful for finding API calls, tokens, or specific data in responses.",name:"search_network",schema:Dp,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.networkEntries.filter(a=>n.test(a.url)||a.responseBody!=null&&n.test(a.responseBody));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network entries matching: ${t.pattern}`};let o=r.map(a=>{let i=a.statusCode==null?"pending":String(a.statusCode),l=n.test(a.url)?" [URL match]":"",s=a.responseBody!=null&&n.test(a.responseBody)?" [body match]":"";return`${a.method} ${i} ${a.url}${l}${s}`}).join(`
36
+ ${o}`}}})});import{z as ki}from"zod";var Bp,Ai,wi=f(()=>{"use strict";U();Bp=ki.object({pattern:ki.string().describe("Regex pattern to search across network request URLs and response bodies")}),Ai=N({description:"Search network requests and response bodies for a regex pattern. Useful for finding API calls, tokens, or specific data in responses.",name:"search_network",schema:Bp,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.networkEntries.filter(a=>n.test(a.url)||a.responseBody!=null&&n.test(a.responseBody));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network entries matching: ${t.pattern}`};let o=r.map(a=>{let i=a.statusCode==null?"pending":String(a.statusCode),l=n.test(a.url)?" [URL match]":"",s=a.responseBody!=null&&n.test(a.responseBody)?" [body match]":"";return`${a.method} ${i} ${a.url}${l}${s}`}).join(`
37
37
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching network entries:
38
- ${o}`}}})});import{z as wi}from"zod";function Fp({contextLines:e,lines:t,maxResults:n,pattern:r}){let o=new RegExp(r,"i"),a=[];return t.forEach((i,l)=>{if(a.length>=n||!o.test(i))return;let s=Math.max(0,l-e),c=Math.min(t.length-1,l+e),p=t.slice(s,c+1).map((u,d)=>{let m=s+d+1;return`${s+d===l?">":" "} ${String(m)}: ${u}`}).join(`
39
- `);a.push(p)}),a}var Vp,Wp,qp,bi,Ni=f(()=>{"use strict";O();Vp=20,Wp=2,qp=wi.object({pattern:wi.string().describe("Regex pattern to search for in the page HTML")}),bi=N({description:"Search the current page's full HTML/DOM for a regex pattern. Returns matching lines with context. Useful for finding elements, attributes, text content, or hidden data without reading the entire page.",name:"search_page",schema:qp,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
- `),o=Fp({contextLines:Wp,lines:r,maxResults:Vp,pattern:t.pattern});return o.length===0?{specNode:void 0,stepResult:void 0,toolOutput:`No matches found for pattern: ${t.pattern}`}:{specNode:void 0,stepResult:void 0,toolOutput:o.join(`
38
+ ${o}`}}})});import{z as bi}from"zod";function Fp({contextLines:e,lines:t,maxResults:n,pattern:r}){let o=new RegExp(r,"i"),a=[];return t.forEach((i,l)=>{if(a.length>=n||!o.test(i))return;let s=Math.max(0,l-e),c=Math.min(t.length-1,l+e),p=t.slice(s,c+1).map((u,d)=>{let m=s+d+1;return`${s+d===l?">":" "} ${String(m)}: ${u}`}).join(`
39
+ `);a.push(p)}),a}var Dp,Vp,Wp,Ni,Ti=f(()=>{"use strict";U();Dp=20,Vp=2,Wp=bi.object({pattern:bi.string().describe("Regex pattern to search for in the page HTML")}),Ni=N({description:"Search the current page's full HTML/DOM for a regex pattern. Returns matching lines with context. Useful for finding elements, attributes, text content, or hidden data without reading the entire page.",name:"search_page",schema:Wp,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
+ `),o=Fp({contextLines:Vp,lines:r,maxResults:Dp,pattern:t.pattern});return o.length===0?{specNode:void 0,stepResult:void 0,toolOutput:`No matches found for pattern: ${t.pattern}`}:{specNode:void 0,stepResult:void 0,toolOutput:o.join(`
41
41
  ---
42
- `)}}})});import{z as Mn}from"zod";var Mp,Ti,Ri=f(()=>{"use strict";O();Mp=Mn.object({selector:Mn.string().describe("CSS selector for the select element"),value:Mn.string().describe("The option value to select")}),Ti=N({description:"Select an option from a dropdown/select element",name:"select",schema:Mp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),L({assertions:[],detail:`Selected "${t.value}" in ${t.selector}`,duration:performance.now()-n,nodeType:"select",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Select ${t.value}`})}})});import{z as Li}from"zod";var zp,Ci,vi=f(()=>{"use strict";O();zp=Li.object({selector:Li.string().describe("CSS selector for the checkbox to uncheck")}),Ci=N({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:zp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),L({assertions:[],detail:`Unchecked ${t.selector}`,duration:performance.now()-n,nodeType:"uncheck",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Uncheck ${t.selector}`})}})});function st(e){let t=[],n=[],r=[],o=new Map;function a(u){t.push({level:u.type(),text:u.text(),timestamp:Date.now(),url:u.location().url})}function i(u){let d=new Ut(u);o.set(u,d),n.push(d)}function l(u){let d=o.get(u.request());d!=null&&(o.delete(u.request()),d.applyResponse(u))}function s(u){r.push(`${u.message}
43
- ${u.stack??""}`)}function c(u){let d=u.failure(),m=new Ut(u);m.responseBody=`(request failed: ${d?.errorText??"unknown"})`,n.push(m)}e.on("console",a),e.on("request",i),e.on("response",l),e.on("pageerror",s),e.on("requestfailed",c);function p(){e.off("console",a),e.off("request",i),e.off("response",l),e.off("pageerror",s),e.off("requestfailed",c)}return{consoleEntries:t,detach:p,networkEntries:n,pageErrors:r}}var Ut,zn=f(()=>{"use strict";Ut=class{method;requestHeaders;requestPostData;timestamp;url;responseBody=void 0;responseHeaders={};statusCode=void 0;constructor(t){this.method=t.method(),this.requestHeaders=t.headers(),this.requestPostData=t.postData()??void 0,this.timestamp=Date.now(),this.url=t.url()}applyResponse(t){this.statusCode=t.status(),this.responseHeaders=t.headers(),t.text().then(n=>{this.responseBody=n.length>1e5?`${n.slice(0,1e5)}... (truncated)`:n}).catch(()=>{this.responseBody="(unable to read body)"})}}});async function Pi({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:a}){let i=Jp.get(n);if(i==null)throw new Error(`Unknown agent tool: ${n}`);return i.execute({monitor:t,page:r,runStartTime:o,stepIndex:a},e)}var Jn,Jp,Xn,xi,Ei=f(()=>{"use strict";ta();oa();ia();la();pa();fa();ha();Aa();ba();Ra();va();Pa();Ua();ja();Da();qa();Ma();Ja();Ka();Ya();ti();ri();ii();ci();pi();fi();hi();Ai();Ni();Ri();vi();zn();Jn=[ai,ka,xa,li,ma,Ci,Ti,ei,Fa,bi,ga,mi,Qa,wa,ni,da,aa,sa,ea,ra,Oa,Ia,Ba,za,Wa,Ha,gi,ki,di,Ca,Ta],Jp=new Map(Jn.map(e=>[e.name,e])),Xn=Jn.map(e=>e.anthropicTool),xi=Jn.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
- `)});import Oi from"fs";import Xp from"path";import Gn from"pino";function Hn({filePath:e}){let t=Xp.dirname(e);Oi.mkdirSync(t,{recursive:!0}),Oi.writeFileSync(e,"");let n=Gn.destination({dest:e,sync:!0}),r=Gn({level:"info"},n);b.info=r.info.bind(r),b.warn=r.warn.bind(r),b.error=r.error.bind(r),b.debug=r.debug.bind(r),b.fatal=r.fatal.bind(r),b.trace=r.trace.bind(r)}var b,G=f(()=>{"use strict";b=Gn({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Gp from"@anthropic-ai/sdk";async function Kn({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:a,serverUrl:i,spec:l,systemPrompt:s,token:c,workflowContext:p}){let u=new Gp({apiKey:"ripplo",baseURL:`${i}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":a}}),d=performance.now(),m=st(o);await ru({baseUrl:e,page:o});let h=Yp({extraVariables:n,spec:l}),k=eu({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),S=tu({baseUrl:e,spec:l,variables:h}),w=[{content:nu({page:o,startUrl:S}),role:"user"}],x=[],R=[],T={findings:"",stepIndex:0,verdict:void 0};T=await Kp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:R,state:T,steps:x,system:k}),T.verdict==null&&(T=await Qp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:R,state:T,steps:x,system:k}));let P=au(R);return{findings:T.findings,generatedSpec:P,monitor:m,steps:x,verdict:T.verdict??"fail"}}function _i({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Kp({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:c}){let p=l;for(let u=0;u<Hp;u++){b.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:Ui,messages:t,model:"server-controlled",system:c,tools:Xn}),m=await Ii({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:a,specNodes:i,stepIndex:p.stepIndex,steps:s});if(p=_i({result:m,state:p}),!m.continueLoop)break}return p}async function Qp({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:c}){b.warn("Agent exited without calling complete_test \u2014 forcing completion"),t.push({content:"You must call the complete_test tool now with your verdict and summary. Do not perform any more actions \u2014 just call complete_test.",role:"user"});let p=await e.messages.create({max_tokens:Ui,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:Xn}),u=await Ii({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:a,specNodes:i,stepIndex:l.stepIndex,steps:s});return _i({result:u,state:l})}function Yp({extraVariables:e,spec:t}){let n=Zp(e,t?.variableNamespaces);return{...ot({defs:t?.variables}),...n}}function Zp(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,a])=>{n.set(a,o)});let r={};return Object.entries(e).forEach(([o,a])=>{let i=n.get(o);Object.entries(a).forEach(([l,s])=>{r[i==null?l:`${i}.${l}`]=s})}),r}function eu({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:a}){let i=a==null?"":[`
42
+ `)}}})});import{z as Jn}from"zod";var qp,Ri,Li=f(()=>{"use strict";U();qp=Jn.object({selector:Jn.string().describe("CSS selector for the select element"),value:Jn.string().describe("The option value to select")}),Ri=N({description:"Select an option from a dropdown/select element",name:"select",schema:qp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),R({assertions:[],detail:`Selected "${t.value}" in ${t.selector}`,duration:performance.now()-n,nodeType:"select",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Select ${t.value}`})}})});import{z as Ci}from"zod";var Mp,vi,xi=f(()=>{"use strict";U();Mp=Ci.object({selector:Ci.string().describe("CSS selector for the checkbox to uncheck")}),vi=N({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:Mp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),R({assertions:[],detail:`Unchecked ${t.selector}`,duration:performance.now()-n,nodeType:"uncheck",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Uncheck ${t.selector}`})}})});function st(e){let t=[],n=[],r=[],o=new Map;function a(u){t.push({level:u.type(),text:u.text(),timestamp:Date.now(),url:u.location().url})}function i(u){let d=new _t(u);o.set(u,d),n.push(d)}function l(u){let d=o.get(u.request());d!=null&&(o.delete(u.request()),d.applyResponse(u))}function s(u){r.push(`${u.message}
43
+ ${u.stack??""}`)}function c(u){let d=u.failure(),m=new _t(u);m.responseBody=`(request failed: ${d?.errorText??"unknown"})`,n.push(m)}e.on("console",a),e.on("request",i),e.on("response",l),e.on("pageerror",s),e.on("requestfailed",c);function p(){e.off("console",a),e.off("request",i),e.off("response",l),e.off("pageerror",s),e.off("requestfailed",c)}return{consoleEntries:t,detach:p,networkEntries:n,pageErrors:r}}var _t,Xn=f(()=>{"use strict";_t=class{method;requestHeaders;requestPostData;timestamp;url;responseBody=void 0;responseHeaders={};statusCode=void 0;constructor(t){this.method=t.method(),this.requestHeaders=t.headers(),this.requestPostData=t.postData()??void 0,this.timestamp=Date.now(),this.url=t.url()}applyResponse(t){this.statusCode=t.status(),this.responseHeaders=t.headers(),t.text().then(n=>{this.responseBody=n.length>1e5?`${n.slice(0,1e5)}... (truncated)`:n}).catch(()=>{this.responseBody="(unable to read body)"})}}});async function Ei({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:a}){let i=zp.get(n);if(i==null)throw new Error(`Unknown agent tool: ${n}`);return i.execute({monitor:t,page:r,runStartTime:o,stepIndex:a},e)}var Gn,zp,Hn,Pi,Oi=f(()=>{"use strict";na();aa();sa();ca();ua();ya();Sa();wa();Na();La();xa();Ea();_a();$a();Va();qa();za();Xa();Ya();Za();ni();oi();si();di();ui();yi();Si();wi();Ti();Li();xi();Xn();Gn=[ii,Aa,Pa,ci,fa,vi,Ri,ti,Ma,Ni,ha,fi,Qa,ba,ri,pa,ia,la,ta,oa,Ua,ja,Da,Ja,Fa,Ka,hi,Ai,pi,va,Ra],zp=new Map(Gn.map(e=>[e.name,e])),Hn=Gn.map(e=>e.anthropicTool),Pi=Gn.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
+ `)});import Ui from"fs";import Jp from"path";import Kn from"pino";function Yn({filePath:e}){let t=Jp.dirname(e);Ui.mkdirSync(t,{recursive:!0}),Ui.writeFileSync(e,"");let n=Kn.destination({dest:e,sync:!0}),r=Kn({level:"info"},n);b.info=r.info.bind(r),b.warn=r.warn.bind(r),b.error=r.error.bind(r),b.debug=r.debug.bind(r),b.fatal=r.fatal.bind(r),b.trace=r.trace.bind(r)}var b,K=f(()=>{"use strict";b=Kn({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Xp from"@anthropic-ai/sdk";async function Qn({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:a,serverUrl:i,spec:l,systemPrompt:s,token:c,workflowContext:p}){let u=new Xp({apiKey:"ripplo",baseURL:`${i}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":a}}),d=performance.now(),m=st(o);await nu({baseUrl:e,page:o});let h=Yp({extraVariables:n,spec:l}),k=Zp({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),S=eu({baseUrl:e,spec:l,variables:h}),w=[{content:tu({page:o,startUrl:S}),role:"user"}],P=[],E=[],T={findings:"",stepIndex:0,verdict:void 0};T=await Hp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:E,state:T,steps:P,system:k}),T.verdict==null&&(T=await Kp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:E,state:T,steps:P,system:k}));let I=ou(E);return{findings:T.findings,generatedSpec:I,monitor:m,steps:P,verdict:T.verdict??"fail"}}function Ii({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Hp({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:c}){let p=l;for(let u=0;u<Gp;u++){b.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:_i,messages:t,model:"server-controlled",system:c,tools:Hn}),m=await ji({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:a,specNodes:i,stepIndex:p.stepIndex,steps:s});if(p=Ii({result:m,state:p}),!m.continueLoop)break}return p}async function Kp({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:c}){b.warn("Agent exited without calling complete_test \u2014 forcing completion"),t.push({content:"You must call the complete_test tool now with your verdict and summary. Do not perform any more actions \u2014 just call complete_test.",role:"user"});let p=await e.messages.create({max_tokens:_i,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:Hn}),u=await ji({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:a,specNodes:i,stepIndex:l.stepIndex,steps:s});return Ii({result:u,state:l})}function Yp({extraVariables:e,spec:t}){let n=Qp(e,t?.variableNamespaces);return{...ot({defs:t?.variables}),...n}}function Qp(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,a])=>{n.set(a,o)});let r={};return Object.entries(e).forEach(([o,a])=>{let i=n.get(o);Object.entries(a).forEach(([l,s])=>{r[i==null?l:`${i}.${l}`]=s})}),r}function Zp({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:a}){let i=a==null?"":[`
45
45
 
46
46
  ## Workflow Under Test`,`**Name:** ${a.name}`,`**Description:** ${a.description}`,`**Expected Outcome:** ${a.expectedOutcome}`,`
47
47
  Focus your testing ONLY on this specific workflow. Do not test unrelated parts of the application.`].join(`
@@ -62,50 +62,50 @@ Do not repeat any of these steps.`,p=Object.entries(o),u=p.map(([m,h])=>`- **${m
62
62
 
63
63
  ## Resolved Variables
64
64
  ${u}`;return[`You are testing the application at: ${e}`,"Use the provided tools to navigate, interact with, and assert things about the page.","Use get_page_content to inspect the page when you need to understand what's on screen.","Follow the workflow steps to complete the task.",`
65
- ## Available Tools`,xi,i,c,l,d,`
65
+ ## Available Tools`,Pi,i,c,l,d,`
66
66
  ## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
67
- `)}function tu({baseUrl:e,spec:t,variables:n}){if(t==null)return e;let r=t.nodes[t.entryNode];if(r==null||r.type!=="goto"||r.url.type!=="static")return e;let a=r.url.value.replaceAll(/\{\{(\w+)\}\}/g,(i,l)=>{let s=n[l];return s==null?`{{${l}}}`:typeof s=="object"?JSON.stringify(s):String(s)});return a.startsWith("http")?a:`${e}${a.startsWith("/")?"":"/"}${a}`}function nu({page:e,startUrl:t}){let n=e.url();return n!=="about:blank"&&n.length>0?`You are already on the page at ${n}. Begin testing from this page \u2014 do not navigate away unless the workflow requires it.`:`Navigate to ${t} and begin testing.`}async function ru({baseUrl:e,page:t}){let n=new URL(e).origin;await t.route("**/*",r=>{let o=r.request();return o.isNavigationRequest()&&new URL(o.url()).origin!==n?(b.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function Ii({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:a,specNodes:i,stepIndex:l,steps:s}){let c=o.content.filter(S=>S.type==="text").map(S=>S.text),p=o.content.filter(S=>S.type==="tool_use");if(p.length===0)return{continueLoop:!1,newFindings:c.join(`
68
- `),nextStepIndex:l,verdict:void 0};let u=[],d=l,m,h;for(let S of p){let A=await ou({block:S,monitor:t,onStep:n,page:r,runStartTime:a,specNodes:i,stepIndex:d,steps:s});u.push(A.toolResult),d=A.nextStepIndex,A.verdict!=null&&(m=A.verdict,h=A.summary)}e.push({content:o.content,role:"assistant"},{content:u,role:"user"});let k=h??c.join(`
69
- `);return{continueLoop:m==null&&o.stop_reason==="tool_use",newFindings:k,nextStepIndex:d,verdict:m}}async function ou({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:a,stepIndex:i,steps:l}){try{let s=await Pi({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:i}),c={content:s.toolOutput,tool_use_id:e.id,type:"tool_result"};return s.kind==="verdict"?(b.info(" [%d] %s \u2014 verdict: %s",i,e.name,s.verdict),{nextStepIndex:i,summary:s.summary,toolResult:c,verdict:s.verdict}):(s.specNode!=null&&a.push(s.specNode),s.stepResult!=null?(l.push(s.stepResult),n?.(s.stepResult),b.info(" [%d] %s \u2014 %s",i,e.name,s.stepResult.status),{nextStepIndex:i+1,summary:void 0,toolResult:c,verdict:void 0}):(b.info(" [%d] %s \u2014 info",i,e.name),{nextStepIndex:i,summary:void 0,toolResult:c,verdict:void 0}))}catch(s){let c=s instanceof Error?s.message:"Unknown error";b.error(" [%d] %s \u2014 error: %s",i,e.name,c);let p=await ke({page:r,runStartTime:o,targets:[]}),u={annotations:p.annotations,assertions:[],detail:`Error: ${c}`,duration:0,nodeId:`agent-step-${String(i)}`,nodeType:"click",screenshotBase64:p.screenshotBase64,snapshotTimestamp:p.snapshotTimestamp,status:"failed",stepIndex:i,title:`${e.name} (error)`,url:p.url,viewportHeight:p.viewportHeight,viewportWidth:p.viewportWidth};return l.push(u),n?.(u),{nextStepIndex:i+1,summary:void 0,toolResult:{content:`Error: ${c}`,is_error:!0,tool_use_id:e.id,type:"tool_result"},verdict:void 0}}}function au(e){if(e.length===0)return{entryNode:"",nodes:{}};let t={};e.forEach((r,o)=>{let a=e[o+1],i=a==null?r:{...r,next:a.id};t[r.id]=i});let n=e[0];if(n==null)throw new Error("Expected at least one spec node after length check");return{entryNode:n.id,nodes:t}}var Hp,Ui,Qn=f(()=>{"use strict";Ei();G();it();Se();Hp=50,Ui=16384});function Yn({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
67
+ `)}function eu({baseUrl:e,spec:t,variables:n}){if(t==null)return e;let r=t.nodes[t.entryNode];if(r==null||r.type!=="goto"||r.url.type!=="static")return e;let a=r.url.value.replaceAll(/\{\{(\w+)\}\}/g,(i,l)=>{let s=n[l];return s==null?`{{${l}}}`:typeof s=="object"?JSON.stringify(s):String(s)});return a.startsWith("http")?a:`${e}${a.startsWith("/")?"":"/"}${a}`}function tu({page:e,startUrl:t}){let n=e.url();return n!=="about:blank"&&n.length>0?`You are already on the page at ${n}. Begin testing from this page \u2014 do not navigate away unless the workflow requires it.`:`Navigate to ${t} and begin testing.`}async function nu({baseUrl:e,page:t}){let n=new URL(e).origin;await t.route("**/*",r=>{let o=r.request();return o.isNavigationRequest()&&new URL(o.url()).origin!==n?(b.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function ji({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:a,specNodes:i,stepIndex:l,steps:s}){let c=o.content.filter(S=>S.type==="text").map(S=>S.text),p=o.content.filter(S=>S.type==="tool_use");if(p.length===0)return{continueLoop:!1,newFindings:c.join(`
68
+ `),nextStepIndex:l,verdict:void 0};let u=[],d=l,m,h;for(let S of p){let A=await ru({block:S,monitor:t,onStep:n,page:r,runStartTime:a,specNodes:i,stepIndex:d,steps:s});u.push(A.toolResult),d=A.nextStepIndex,A.verdict!=null&&(m=A.verdict,h=A.summary)}e.push({content:o.content,role:"assistant"},{content:u,role:"user"});let k=h??c.join(`
69
+ `);return{continueLoop:m==null&&o.stop_reason==="tool_use",newFindings:k,nextStepIndex:d,verdict:m}}async function ru({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:a,stepIndex:i,steps:l}){try{let s=await Ei({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:i}),c={content:s.toolOutput,tool_use_id:e.id,type:"tool_result"};return s.kind==="verdict"?(b.info(" [%d] %s \u2014 verdict: %s",i,e.name,s.verdict),{nextStepIndex:i,summary:s.summary,toolResult:c,verdict:s.verdict}):(s.specNode!=null&&a.push(s.specNode),s.stepResult!=null?(l.push(s.stepResult),n?.(s.stepResult),b.info(" [%d] %s \u2014 %s",i,e.name,s.stepResult.status),{nextStepIndex:i+1,summary:void 0,toolResult:c,verdict:void 0}):(b.info(" [%d] %s \u2014 info",i,e.name),{nextStepIndex:i,summary:void 0,toolResult:c,verdict:void 0}))}catch(s){let c=s instanceof Error?s.message:"Unknown error";b.error(" [%d] %s \u2014 error: %s",i,e.name,c);let p=await Ae({page:r,runStartTime:o,targets:[]}),u={annotations:p.annotations,assertions:[],detail:`Error: ${c}`,duration:0,nodeId:`agent-step-${String(i)}`,nodeType:"click",screenshotBase64:p.screenshotBase64,snapshotTimestamp:p.snapshotTimestamp,status:"failed",stepIndex:i,title:`${e.name} (error)`,url:p.url,viewportHeight:p.viewportHeight,viewportWidth:p.viewportWidth};return l.push(u),n?.(u),{nextStepIndex:i+1,summary:void 0,toolResult:{content:`Error: ${c}`,is_error:!0,tool_use_id:e.id,type:"tool_result"},verdict:void 0}}}function ou(e){if(e.length===0)return{entryNode:"",nodes:{}};let t={};e.forEach((r,o)=>{let a=e[o+1],i=a==null?r:{...r,next:a.id};t[r.id]=i});let n=e[0];if(n==null)throw new Error("Expected at least one spec node after length check");return{entryNode:n.id,nodes:t}}var Gp,_i,Zn=f(()=>{"use strict";Oi();K();it();ke();Gp=50,_i=16384});function er({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
70
70
  ${e}`];t!=null&&t.length>0&&r.push(`## Output
71
71
  ${t}`),n!=null&&n.length>0&&r.push(`## Success Criteria
72
- ${n}`);let o=["## Completing Your Evaluation",'When you finish your evaluation, you MUST call the `complete_test` tool with your verdict ("pass" or "fail") and a `summary` string.',iu({hasSuccessCriteria:n!=null&&n.length>0}),su({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
72
+ ${n}`);let o=["## Completing Your Evaluation",'When you finish your evaluation, you MUST call the `complete_test` tool with your verdict ("pass" or "fail") and a `summary` string.',au({hasSuccessCriteria:n!=null&&n.length>0}),iu({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
73
73
  `)),r.join(`
74
74
 
75
- `)}function iu({hasSuccessCriteria:e}){return e?"Base your verdict strictly on the Success Criteria defined above. A test passes ONLY if all success criteria are met, and fails if any criterion is not met. Individual step failures during exploration do not necessarily mean the test failed, but the success criteria are the ultimate authority for your verdict.":"Base your verdict on whether the workflow worked correctly. Individual step failures during exploration do not necessarily mean the test failed."}function su({hasOutput:e}){return e?'The `summary` parameter is the ONLY output the user will see. You MUST use the `summary` field for EXACTLY the output described in the "Output" section above \u2014 nothing else. Do not describe what you did, do not list steps, do not add a test summary. The `summary` must contain ONLY what the Output section asks for, word for word if it specifies exact text.':"Include a brief summary of what you found in the `summary` parameter."}var Zn=f(()=>{"use strict"});import{execFile as lu}from"child_process";import{createRequire as cu}from"module";import ji from"fs";import $i from"path";import{chromium as er}from"playwright";async function Ae({headed:e}){b.info("Browser executable: %s",er.executablePath());try{return await er.launch({headless:!e})}catch(t){throw du(t)?new Error(`Playwright browsers are not installed. Run:
75
+ `)}function au({hasSuccessCriteria:e}){return e?"Base your verdict strictly on the Success Criteria defined above. A test passes ONLY if all success criteria are met, and fails if any criterion is not met. Individual step failures during exploration do not necessarily mean the test failed, but the success criteria are the ultimate authority for your verdict.":"Base your verdict on whether the workflow worked correctly. Individual step failures during exploration do not necessarily mean the test failed."}function iu({hasOutput:e}){return e?'The `summary` parameter is the ONLY output the user will see. You MUST use the `summary` field for EXACTLY the output described in the "Output" section above \u2014 nothing else. Do not describe what you did, do not list steps, do not add a test summary. The `summary` must contain ONLY what the Output section asks for, word for word if it specifies exact text.':"Include a brief summary of what you found in the `summary` parameter."}var tr=f(()=>{"use strict"});import{execFile as su}from"child_process";import{createRequire as lu}from"module";import $i from"fs";import Bi from"path";import{chromium as nr}from"playwright";async function we({headed:e}){b.info("Browser executable: %s",nr.executablePath());try{return await nr.launch({headless:!e})}catch(t){throw cu(t)?new Error(`Playwright browsers are not installed. Run:
76
76
 
77
77
  npx playwright install chromium
78
- `):t}}async function tr(){let e=er.executablePath();if(ji.existsSync(e))return;b.info("Chromium not found. Installing via Playwright...");let t=cu(import.meta.url),n=$i.dirname(t.resolve("playwright/package.json")),r=$i.join(n,"cli.js");if(await new Promise((o,a)=>{lu(process.execPath,[r,"install","chromium"],i=>{if(i!=null){a(new Error(`Playwright install failed: ${i.message}`));return}o()})}),!ji.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
78
+ `):t}}async function rr(){let e=nr.executablePath();if($i.existsSync(e))return;b.info("Chromium not found. Installing via Playwright...");let t=lu(import.meta.url),n=Bi.dirname(t.resolve("playwright/package.json")),r=Bi.join(n,"cli.js");if(await new Promise((o,a)=>{su(process.execPath,[r,"install","chromium"],i=>{if(i!=null){a(new Error(`Playwright install failed: ${i.message}`));return}o()})}),!$i.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
79
79
 
80
80
  npx playwright install chromium
81
- `);b.info("\u2713 Chromium installed")}function du(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var lt=f(()=>{"use strict";G()});import{mkdir as nr,writeFile as se}from"fs/promises";import K from"path";async function _t({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let a=K.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await nr(a,{recursive:!0});let i={annotations:o.annotations,assertions:o.assertions,detail:o.detail,duration:o.duration,nodeId:o.nodeId,nodeType:o.nodeType,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth};await Promise.all([se(K.join(a,"info.json"),JSON.stringify(i,null,2)),se(K.join(a,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),pu({context:e,page:t,stepDir:a})])}catch(a){let i=a instanceof Error?a.message:String(a);b.warn("Failed to write step debug data for step %d: %s",r,i)}}async function pu({context:e,page:t,stepDir:n}){let[r,o,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),uu(t),mu({context:e,page:t})]);await Promise.all([se(K.join(n,"dom.html"),r),se(K.join(n,"accessibility-tree.txt"),o),se(K.join(n,"storage.json"),JSON.stringify(a,null,2))])}async function uu(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function mu({context:e,page:t}){let[n,r]=await Promise.all([t.evaluate(()=>({localStorage:Object.fromEntries(Array.from({length:localStorage.length},(o,a)=>{let i=localStorage.key(a);return i==null?void 0:[i,localStorage.getItem(i)??""]}).filter(o=>o!=null)),sessionStorage:Object.fromEntries(Array.from({length:sessionStorage.length},(o,a)=>{let i=sessionStorage.key(a);return i==null?void 0:[i,sessionStorage.getItem(i)??""]}).filter(o=>o!=null))})).catch(()=>({localStorage:{},sessionStorage:{}})),e.cookies().catch(()=>[])]);return{cookies:r,localStorage:n.localStorage,sessionStorage:n.sessionStorage}}async function It({monitor:e,runId:t,steps:n,summary:r}){try{let o=K.join(process.cwd(),".ripplo","debug",t);await nr(o,{recursive:!0}),await Promise.all([se(K.join(o,"summary.txt"),fu({steps:n,summary:r})),se(K.join(o,"console.log"),yu(e.consoleEntries)),se(K.join(o,"network.jsonl"),gu(e.networkEntries)),se(K.join(o,"page-errors.log"),e.pageErrors.join(`
81
+ `);b.info("\u2713 Chromium installed")}function cu(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var lt=f(()=>{"use strict";K()});import{mkdir as or,writeFile as le}from"fs/promises";import Q from"path";async function It({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let a=Q.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await or(a,{recursive:!0});let i={annotations:o.annotations,assertions:o.assertions,detail:o.detail,duration:o.duration,nodeId:o.nodeId,nodeType:o.nodeType,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth};await Promise.all([le(Q.join(a,"info.json"),JSON.stringify(i,null,2)),le(Q.join(a,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),du({context:e,page:t,stepDir:a})])}catch(a){let i=a instanceof Error?a.message:String(a);b.warn("Failed to write step debug data for step %d: %s",r,i)}}async function du({context:e,page:t,stepDir:n}){let[r,o,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),pu(t),uu({context:e,page:t})]);await Promise.all([le(Q.join(n,"dom.html"),r),le(Q.join(n,"accessibility-tree.txt"),o),le(Q.join(n,"storage.json"),JSON.stringify(a,null,2))])}async function pu(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function uu({context:e,page:t}){let[n,r]=await Promise.all([t.evaluate(()=>({localStorage:Object.fromEntries(Array.from({length:localStorage.length},(o,a)=>{let i=localStorage.key(a);return i==null?void 0:[i,localStorage.getItem(i)??""]}).filter(o=>o!=null)),sessionStorage:Object.fromEntries(Array.from({length:sessionStorage.length},(o,a)=>{let i=sessionStorage.key(a);return i==null?void 0:[i,sessionStorage.getItem(i)??""]}).filter(o=>o!=null))})).catch(()=>({localStorage:{},sessionStorage:{}})),e.cookies().catch(()=>[])]);return{cookies:r,localStorage:n.localStorage,sessionStorage:n.sessionStorage}}async function jt({monitor:e,runId:t,steps:n,summary:r}){try{let o=Q.join(process.cwd(),".ripplo","debug",t);await or(o,{recursive:!0}),await Promise.all([le(Q.join(o,"summary.txt"),mu({steps:n,summary:r})),le(Q.join(o,"console.log"),fu(e.consoleEntries)),le(Q.join(o,"network.jsonl"),yu(e.networkEntries)),le(Q.join(o,"page-errors.log"),e.pageErrors.join(`
82
82
  ---
83
- `))]),b.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write run debug summary: %s",a)}}function fu({steps:e,summary:t}){return[`Run ID: ${t.runId}`,`Workflow: ${t.workflowName}`,`Status: ${t.status}`,`Duration: ${String(t.duration)}ms`,`Passed: ${String(t.passCount)}`,`Failed: ${String(t.failCount)}`,"","Steps:",...e.map(r=>` [${String(r.stepIndex)}] ${r.status==="passed"?"\u2713":"\u2717"} ${r.title} (${String(r.duration)}ms) \u2014 ${r.detail??"ok"}`)].join(`
84
- `)}function yu(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
- `)}function gu(e){return e.map(t=>JSON.stringify(t)).join(`
86
- `)}async function Bi({error:e,runId:t,stack:n,workflowName:r}){try{let o=K.join(process.cwd(),".ripplo","debug",t);await nr(o,{recursive:!0});let a=n==null?e:`${e}
83
+ `))]),b.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write run debug summary: %s",a)}}function mu({steps:e,summary:t}){return[`Run ID: ${t.runId}`,`Workflow: ${t.workflowName}`,`Status: ${t.status}`,`Duration: ${String(t.duration)}ms`,`Passed: ${String(t.passCount)}`,`Failed: ${String(t.failCount)}`,"","Steps:",...e.map(r=>` [${String(r.stepIndex)}] ${r.status==="passed"?"\u2713":"\u2717"} ${r.title} (${String(r.duration)}ms) \u2014 ${r.detail??"ok"}`)].join(`
84
+ `)}function fu(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
+ `)}function yu(e){return e.map(t=>JSON.stringify(t)).join(`
86
+ `)}async function Di({error:e,runId:t,stack:n,workflowName:r}){try{let o=Q.join(process.cwd(),".ripplo","debug",t);await or(o,{recursive:!0});let a=n==null?e:`${e}
87
87
 
88
88
  ${n}`,i=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
89
89
  ${n}`].join(`
90
- `);await Promise.all([se(K.join(o,"error.txt"),a),se(K.join(o,"summary.txt"),i)]),b.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write error debug artifacts: %s",a)}}var jt=f(()=>{"use strict";G()});async function rr({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:a,serverUrl:i,spec:l,streaming:s,systemPrompt:c,token:p,workflowContext:u}){let d=await Ae({headed:o}),m=await d.newContext({baseURL:e});t.length>0&&(await m.addCookies([...t]),b.info("Injected %d cookies from preconditions",t.length));let h=await m.newPage();try{let S=function(P){s.enqueueStep(P),s.flushSteps(),_t({context:m,page:h,runId:a,stepIndex:P.stepIndex,stepResult:P})};var k=S;let A=await Kn({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:S,page:h,runId:a,serverUrl:i,spec:l,systemPrompt:c,token:p,workflowContext:u}),w=A.verdict==="pass"?"passed":"failed";await s.complete({statusOverride:w,steps:A.steps,summary:A.findings});let x=A.steps.filter(P=>P.status==="passed").length,R=A.steps.filter(P=>P.status==="failed").length,T={duration:A.steps.reduce((P,B)=>P+B.duration,0),failCount:R,passCount:x,runId:a,status:w,workflowName:u.name};await It({monitor:A.monitor,runId:a,steps:A.steps,summary:T}),b.info("Agent test complete: %d passed, %d failed",x,R),b.info(`
90
+ `);await Promise.all([le(Q.join(o,"error.txt"),a),le(Q.join(o,"summary.txt"),i)]),b.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write error debug artifacts: %s",a)}}var $t=f(()=>{"use strict";K()});async function ar({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:a,serverUrl:i,spec:l,streaming:s,systemPrompt:c,token:p,workflowContext:u}){let d=await we({headed:o}),m=await d.newContext({baseURL:e});t.length>0&&(await m.addCookies([...t]),b.info("Injected %d cookies from preconditions",t.length));let h=await m.newPage();try{let S=function(I){s.enqueueStep(I),s.flushSteps(),It({context:m,page:h,runId:a,stepIndex:I.stepIndex,stepResult:I})};var k=S;let A=await Qn({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:S,page:h,runId:a,serverUrl:i,spec:l,systemPrompt:c,token:p,workflowContext:u}),w=A.verdict==="pass"?"passed":"failed";await s.complete({statusOverride:w,steps:A.steps,summary:A.findings});let P=A.steps.filter(I=>I.status==="passed").length,E=A.steps.filter(I=>I.status==="failed").length,T={duration:A.steps.reduce((I,x)=>I+x.duration,0),failCount:E,passCount:P,runId:a,status:w,workflowName:u.name};await jt({monitor:A.monitor,runId:a,steps:A.steps,summary:T}),b.info("Agent test complete: %d passed, %d failed",P,E),b.info(`
91
91
  === Agent Summary ===
92
- %s`,A.findings)}finally{await d.close()}}var or=f(()=>{"use strict";lt();Qn();jt();G()});async function ar({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return ct({actual:o??"",expected:e,label:"Text",operator:n})}function $t({expected:e,operator:t,url:n}){return ct({actual:n,expected:e,label:"URL",operator:t})}async function ir({expected:e,locator:t,operator:n}){let r=await t.count();return Ji({actual:r,expected:e,label:"Count",operator:n})}async function sr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return ct({actual:o,expected:e,label:"Value",operator:n})}async function lr({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),{description:"Element is visible",detail:void 0,status:"passed"}}catch{return{description:"Element is visible",detail:"Element not visible",status:"failed"}}}async function cr({locator:e,timeout:t}){try{return await e.waitFor({state:"hidden",timeout:t}),{description:"Element is not visible",detail:void 0,status:"passed"}}catch{return{description:"Element is not visible",detail:"Element still visible",status:"failed"}}}async function Di({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let a=await n.getAttribute(e,{timeout:o});return ct({actual:a??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Vi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isEnabled()?{description:"Element is enabled",detail:void 0,status:"passed"}:{description:"Element is enabled",detail:"Element is disabled",status:"failed"}}catch{return{description:"Element is enabled",detail:"Element not found",status:"failed"}}}async function Wi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isDisabled()?{description:"Element is disabled",detail:void 0,status:"passed"}:{description:"Element is disabled",detail:"Element is enabled",status:"failed"}}catch{return{description:"Element is disabled",detail:"Element not found",status:"failed"}}}async function qi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isChecked()?{description:"Element is checked",detail:void 0,status:"passed"}:{description:"Element is checked",detail:"Element is not checked",status:"failed"}}catch{return{description:"Element is checked",detail:"Element not found",status:"failed"}}}async function Fi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isChecked()?{description:"Element is not checked",detail:"Element is checked",status:"failed"}:{description:"Element is not checked",detail:void 0,status:"passed"}}catch{return{description:"Element is not checked",detail:"Element not found",status:"failed"}}}async function Mi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),!await e.evaluate("(el) => document.activeElement === el")?{description:"Element is focused",detail:"Element is not focused",status:"failed"}:{description:"Element is focused",detail:void 0,status:"passed"}}catch{return{description:"Element is focused",detail:"Element not found",status:"failed"}}}async function zi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),!!await e.evaluate("(el) => document.activeElement === el")?{description:"Element is not focused",detail:"Element is focused",status:"failed"}:{description:"Element is not focused",detail:void 0,status:"passed"}}catch{return{description:"Element is not focused",detail:"Element not found",status:"failed"}}}function ct(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=hu(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function hu({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="notEquals"?e!==t:n==="contains"?e.includes(t):n==="startsWith"?e.startsWith(t):n==="endsWith"?e.endsWith(t):new RegExp(t).test(e)}function Ji(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Su(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Su({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="notEquals"?e!==t:n==="greaterThan"?e>t:n==="greaterThanOrEqual"?e>=t:n==="lessThan"?e<t:e<=t}var dr=f(()=>{"use strict"});async function J({fn:e,label:t}){let n=performance.now(),r=await e();return b.info("%s: %dms",t,Math.round(performance.now()-n)),r}var We=f(()=>{"use strict";G()});async function pr({headed:e,size:t}){let n=await J({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>Ae({headed:e})))}),r=new Set,o=[];function a(){let s=n.pop();return s!=null?(r.add(s),Promise.resolve(s)):new Promise(c=>{o.push(p=>{r.add(p),c(p)})})}function i(s){if(r.delete(s),!s.isConnected()){b.warn("Released browser is disconnected, launching replacement"),Ae({headed:e}).then(p=>{i(p)});return}let c=o.shift();if(c!=null){c(s);return}n.push(s)}async function l(){let s=[...n,...r];n.length=0,r.clear(),await Promise.allSettled(s.map(c=>c.close()))}return{acquire:a,closeAll:l,release:i}}var Xi=f(()=>{"use strict";lt();G();We()});import{print as ku}from"graphql";async function W(e){let t=ku(e.document),n=JSON.stringify({query:t,variables:e.variables}),r=`${e.config.ripploServerUrl}/graphql`,o;try{o=await fetch(r,{body:n,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(Au)})}catch(i){let l=i instanceof Error?i.message:String(i);throw new Error(`Failed to connect to Ripplo server at ${e.config.ripploServerUrl}. Make sure \`npx ripplo\` is running and your internet connection is active. Details: ${l}`)}let a=await o.json();if(!wu(a))throw new Error("Invalid GraphQL response");if(bu(a))throw new Error(a.errors.map(i=>i.message).join(", "));if(a.data==null)throw new Error("No data returned from server");return a.data}function wu(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function bu(e){return Array.isArray(e.errors)&&e.errors.length>0}var Au,dt=f(()=>{"use strict";Au=15e3});import{readdir as Nu,rm as Tu,stat as Ru}from"fs/promises";import Ow from"os";import Ki from"path";import{graphql as Lu}from"gql.tada";async function ur({maxRuns:e}){try{let n=(await Nu(Gi,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=Ki.join(Gi,c.name),u=await Ru(p);return{dirPath:p,mtime:u.mtimeMs}})),a=o.filter(c=>r-c.mtime>Hi),l=o.filter(c=>r-c.mtime<=Hi).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...a,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>Tu(c.dirPath,{force:!0,recursive:!0}))),b.info("Pruned %d old debug run(s)",s.length)}catch{b.warn("Debug run pruning failed, ignoring")}}var Gi,Hi,$w,Qi=f(()=>{"use strict";dt();G();Gi=Ki.join(process.cwd(),".ripplo","debug"),Hi=360*60*1e3,$w=Lu(`
92
+ %s`,A.findings)}finally{await d.close()}}var ir=f(()=>{"use strict";lt();Zn();$t();K()});async function sr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return ct({actual:o??"",expected:e,label:"Text",operator:n})}function Bt({expected:e,operator:t,url:n}){return ct({actual:n,expected:e,label:"URL",operator:t})}async function lr({expected:e,locator:t,operator:n}){let r=await t.count();return Xi({actual:r,expected:e,label:"Count",operator:n})}async function cr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return ct({actual:o,expected:e,label:"Value",operator:n})}async function dr({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),{description:"Element is visible",detail:void 0,status:"passed"}}catch{return{description:"Element is visible",detail:"Element not visible",status:"failed"}}}async function pr({locator:e,timeout:t}){try{return await e.waitFor({state:"hidden",timeout:t}),{description:"Element is not visible",detail:void 0,status:"passed"}}catch{return{description:"Element is not visible",detail:"Element still visible",status:"failed"}}}async function Vi({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let a=await n.getAttribute(e,{timeout:o});return ct({actual:a??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Wi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isEnabled()?{description:"Element is enabled",detail:void 0,status:"passed"}:{description:"Element is enabled",detail:"Element is disabled",status:"failed"}}catch{return{description:"Element is enabled",detail:"Element not found",status:"failed"}}}async function Fi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isDisabled()?{description:"Element is disabled",detail:void 0,status:"passed"}:{description:"Element is disabled",detail:"Element is enabled",status:"failed"}}catch{return{description:"Element is disabled",detail:"Element not found",status:"failed"}}}async function qi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isChecked()?{description:"Element is checked",detail:void 0,status:"passed"}:{description:"Element is checked",detail:"Element is not checked",status:"failed"}}catch{return{description:"Element is checked",detail:"Element not found",status:"failed"}}}async function Mi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),await e.isChecked()?{description:"Element is not checked",detail:"Element is checked",status:"failed"}:{description:"Element is not checked",detail:void 0,status:"passed"}}catch{return{description:"Element is not checked",detail:"Element not found",status:"failed"}}}async function zi({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),!await e.evaluate("(el) => document.activeElement === el")?{description:"Element is focused",detail:"Element is not focused",status:"failed"}:{description:"Element is focused",detail:void 0,status:"passed"}}catch{return{description:"Element is focused",detail:"Element not found",status:"failed"}}}async function Ji({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),!!await e.evaluate("(el) => document.activeElement === el")?{description:"Element is not focused",detail:"Element is focused",status:"failed"}:{description:"Element is not focused",detail:void 0,status:"passed"}}catch{return{description:"Element is not focused",detail:"Element not found",status:"failed"}}}function ct(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=gu(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function gu({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="notEquals"?e!==t:n==="contains"?e.includes(t):n==="startsWith"?e.startsWith(t):n==="endsWith"?e.endsWith(t):new RegExp(t).test(e)}function Xi(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=hu(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function hu({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="notEquals"?e!==t:n==="greaterThan"?e>t:n==="greaterThanOrEqual"?e>=t:n==="lessThan"?e<t:e<=t}var ur=f(()=>{"use strict"});async function X({fn:e,label:t}){let n=performance.now(),r=await e();return b.info("%s: %dms",t,Math.round(performance.now()-n)),r}var qe=f(()=>{"use strict";K()});async function mr({headed:e,size:t}){let n=await X({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>we({headed:e})))}),r=new Set,o=[];function a(){let s=n.pop();return s!=null?(r.add(s),Promise.resolve(s)):new Promise(c=>{o.push(p=>{r.add(p),c(p)})})}function i(s){if(r.delete(s),!s.isConnected()){b.warn("Released browser is disconnected, launching replacement"),we({headed:e}).then(p=>{i(p)});return}let c=o.shift();if(c!=null){c(s);return}n.push(s)}async function l(){let s=[...n,...r];n.length=0,r.clear(),await Promise.allSettled(s.map(c=>c.close()))}return{acquire:a,closeAll:l,release:i}}var Gi=f(()=>{"use strict";lt();K();qe()});import{print as Su}from"graphql";async function F(e){let t=Su(e.document),n=JSON.stringify({query:t,variables:e.variables}),r=`${e.config.ripploServerUrl}/graphql`,o;try{o=await fetch(r,{body:n,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(ku)})}catch(i){let l=i instanceof Error?i.message:String(i);throw new Error(`Failed to connect to Ripplo server at ${e.config.ripploServerUrl}. Make sure \`npx ripplo\` is running and your internet connection is active. Details: ${l}`)}let a=await o.json();if(!Au(a))throw new Error("Invalid GraphQL response");if(wu(a))throw new Error(a.errors.map(i=>i.message).join(", "));if(a.data==null)throw new Error("No data returned from server");return a.data}function Au(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function wu(e){return Array.isArray(e.errors)&&e.errors.length>0}var ku,dt=f(()=>{"use strict";ku=15e3});import{readdir as bu,rm as Nu,stat as Tu}from"fs/promises";import Dw from"os";import Yi from"path";import{graphql as Ru}from"gql.tada";async function fr({maxRuns:e}){try{let n=(await bu(Hi,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=Yi.join(Hi,c.name),u=await Tu(p);return{dirPath:p,mtime:u.mtimeMs}})),a=o.filter(c=>r-c.mtime>Ki),l=o.filter(c=>r-c.mtime<=Ki).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...a,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>Nu(c.dirPath,{force:!0,recursive:!0}))),b.info("Pruned %d old debug run(s)",s.length)}catch{b.warn("Debug run pruning failed, ignoring")}}var Hi,Ki,Mw,Qi=f(()=>{"use strict";dt();K();Hi=Yi.join(process.cwd(),".ripplo","debug"),Ki=360*60*1e3,Mw=Ru(`
93
93
  mutation RevokeCurrentCliToken {
94
94
  revokeCurrentCliToken
95
95
  }
96
- `)});async function mr({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Cu)})}catch(t){let n=t instanceof Error?t.message:String(t);throw b.debug("App URL reachability check failed: %s",n),new Error([`Could not reach your dev server at ${e}.`,"","Troubleshooting:",` 1. Make sure your app is running at ${e}`," 2. Check the appUrl in your createRipplo() config"," 3. If your app runs on a different port, update appUrl in .ripplo/ripplo.ts"].join(`
97
- `))}}var Cu,fr=f(()=>{"use strict";G();Cu=5e3});import pt from"fs";import yr from"path";function ut(e){let t=yr.join(e,".ripplo",".token");if(!pt.existsSync(t))return null;let n=pt.readFileSync(t,"utf8").trim();return n.length===0?null:n}function gr(e,t){let n=yr.join(e,".ripplo");pt.existsSync(n)||pt.mkdirSync(n,{recursive:!0}),pt.writeFileSync(yr.join(n,".token"),t+`
98
- `)}var Yi=f(()=>{"use strict"});import{z as Bt}from"zod";function mt(e){return Zi({legacy:void 0,migrators:[],name:e,schemas:[]})}function Zi(e){return{initial:t=>hr(t,{...e,schemas:[t]}),legacy:t=>Zi({...e,legacy:t})}}function hr(e,t){return{build:()=>xu(e,t),legacy:n=>hr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return hr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function xu(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Pu(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Pu(e,t,n){let{data:r,version:o}=Eu(t,n),a=es(t,r,o);return e.parse(a)}function Eu(e,t){let n=vu.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Vt({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function es(e,t,n){let r=e.schemas.length;if(n>r)throw new Dt({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return es(e,i(a),n+1)}var vu,Dt,Vt,Sr=f(()=>{"use strict";vu=Bt.object({__codec:Bt.string().min(1),data:Bt.unknown(),version:Bt.number().int().positive()}),Dt=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Vt=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as Ce}from"zod";var kr,Ar=f(()=>{"use strict";kr=Ce.object({from:Ce.string().min(1).describe("Key of the source state in the states record"),requiresKeys:Ce.record(Ce.string(),Ce.string()).optional().describe("Maps workflow variable namespace to precondition name. Used by the runtime to namespace batch precondition data into dot-namespaced variables (e.g. { project: 'data:project' } maps projectId \u2192 project.projectId)."),to:Ce.string().min(1).describe("Key of the target state in the states record"),workflow:Ce.string().min(1).describe("Filename (without .json) of the workflow in .ripplo/workflows/ that executes this edge")}).describe("A directed edge between two states, executed by a workflow")});import{z as qe}from"zod";var ft,Wt=f(()=>{"use strict";ft=qe.object({depends:qe.array(qe.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:qe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:qe.array(qe.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name.")});import{z as qt}from"zod";var wr,br=f(()=>{"use strict";wr=qt.object({preconditions:qt.array(qt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:qt.string().min(1).describe("URL pattern with {{placeholders}} for dynamic segments, e.g. '/projects/{{projectId}}/settings'")}).describe("A distinct application state \u2014 a unique combination of location, auth context, and data conditions")});import{z as Fe}from"zod";var ts,Ou,ns,Ft,Mt=f(()=>{"use strict";Ar();Wt();br();ts=1e3,Ou=5e3,ns=500,Ft=Fe.object({edges:Fe.array(kr).max(Ou).describe("Directed edges between states, each executed by a workflow"),preconditions:Fe.record(Fe.string().max(200),ft).refine(e=>Object.keys(e).length<=ns,`Graph has more than ${String(ns)} preconditions`).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:Fe.record(Fe.string().max(200),wr).refine(e=>Object.keys(e).length<=ts,`Graph has more than ${String(ts)} states`).describe("States keyed by stable ID (kebab-case)")}).describe("Ripplo State Graph \u2014 models application states, edges, and executable preconditions")});import{z as we}from"zod";var Uu,_u,E,Nr=f(()=>{"use strict";Uu=we.object({by:we.literal("testId"),value:we.string().min(1)}),_u=we.object({by:we.literal("role"),name:we.string().optional(),role:we.string().min(1)}),E=we.discriminatedUnion("by",[Uu,_u])});import{z as rs}from"zod";var be,zt,Tr=f(()=>{"use strict";be=rs.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),zt=rs.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as M}from"zod";var Iu,Rr,Jt,ee,Xt,Lr=f(()=>{"use strict";Iu=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),Rr=M.object({name:M.string().min(1),type:M.literal("variable")}),Jt=M.discriminatedUnion("type",[Iu,Rr]),ee=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),Rr]),Xt=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),Rr])});import{z as te}from"zod";var Gt,Cr=f(()=>{"use strict";Gt=te.discriminatedUnion("type",[te.object({default:te.string().optional(),type:te.literal("string")}),te.object({default:te.number().optional(),type:te.literal("number")}),te.object({default:te.boolean().optional(),type:te.literal("boolean")}),te.object({key:te.string().min(1),type:te.literal("env")})])});import{z as g}from"zod";var v,os,ju,$u,Bu,Du,Vu,Wu,qu,Fu,Mu,zu,Ju,Xu,Gu,Hu,Ku,Qu,Yu,Zu,em,tm,nm,rm,om,am,im,sm,lm,cm,dm,pm,um,mm,fm,ym,gm,hm,Sm,as,Ht,Kt=f(()=>{"use strict";Nr();Tr();Lr();Cr();Nr();Tr();Lr();Cr();v={comment:g.string().max(2e3).optional(),id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),timeout:g.number().int().positive().optional()},os=500,ju=g.object({...v,type:g.literal("goto"),url:ee}),$u=g.object({...v,locator:E,type:g.literal("click")}),Bu=g.object({...v,locator:E,type:g.literal("fill"),value:ee}),Du=g.object({...v,locator:E,type:g.literal("select"),value:ee}),Vu=g.object({...v,locator:E,type:g.literal("hover")}),Wu=g.object({...v,key:g.string().min(1),locator:E.optional(),type:g.literal("press")}),qu=g.object({...v,locator:E,type:g.literal("check")}),Fu=g.object({...v,locator:E,type:g.literal("uncheck")}),Mu=g.object({...v,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),zu=g.object({...v,message:g.string().min(1),type:g.literal("fail")}),Ju=g.object({...v,type:g.literal("setVariable"),value:Jt,variable:g.string().min(1)}),Xu=g.object({...v,locator:E,type:g.literal("extractText"),variable:g.string().min(1)}),Gu=g.object({...v,files:g.array(g.string()).min(1),locator:E,type:g.literal("upload")}),Hu=g.object({...v,locator:E,type:g.literal("dblclick")}),Ku=g.object({...v,source:E,target:E,type:g.literal("drag")}),Qu=g.object({...v,locator:E,type:g.literal("scrollIntoView")}),Yu=g.object({...v,locator:E,type:g.literal("type"),value:ee}),Zu=g.object({...v,locator:E,type:g.literal("focus")}),em=g.object({...v,locator:E,type:g.literal("clear")}),tm=g.object({...v,locator:E,type:g.literal("rightClick")}),nm=g.object({...v,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),rm=g.object({...v,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:ee.optional(),variable:g.string().min(1).optional()}),om=g.object({...v,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),am=g.object({...v,locator:E,type:g.literal("assertVisible")}),im=g.object({...v,locator:E,type:g.literal("assertNotVisible")}),sm=g.object({...v,expected:ee,locator:E,operator:be,type:g.literal("assertText")}),lm=g.object({...v,expected:ee,operator:be,type:g.literal("assertUrl")}),cm=g.object({...v,expected:Xt,locator:E,operator:zt,type:g.literal("assertCount")}),dm=g.object({...v,expected:ee,locator:E,operator:be,type:g.literal("assertValue")}),pm=g.object({...v,attribute:g.string().min(1),expected:ee,locator:E,operator:be,type:g.literal("assertAttribute")}),um=g.object({...v,locator:E,type:g.literal("assertEnabled")}),mm=g.object({...v,locator:E,type:g.literal("assertDisabled")}),fm=g.object({...v,expected:ee,operator:be,type:g.literal("assertTitle")}),ym=g.object({...v,locator:E,type:g.literal("assertChecked")}),gm=g.object({...v,locator:E,type:g.literal("assertNotChecked")}),hm=g.object({...v,locator:E,type:g.literal("assertFocused")}),Sm=g.object({...v,locator:E,type:g.literal("assertNotFocused")}),as=g.discriminatedUnion("type",[ju,$u,Bu,Du,Vu,Wu,qu,Fu,am,im,sm,lm,cm,dm,pm,um,mm,Mu,zu,Ju,Xu,Gu,Hu,Ku,Qu,Yu,Zu,em,tm,nm,rm,om,fm,ym,gm,hm,Sm]),Ht=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),as).refine(e=>Object.keys(e).length<=os,`Workflow has more than ${String(os)} nodes`),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),Gt).optional()})});import{z as is}from"zod";var km,Am,wm,bm,vr,Nm,Tm,ss=f(()=>{"use strict";Sr();Mt();Wt();Kt();km=is.record(is.string().max(200),ft),Am={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},wm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"edges"in e&&"states"in e&&"preconditions"in e},bm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},vr=mt("workflow-spec").legacy(Am).initial(Ht).build(),Nm=mt("state-graph").legacy(wm).initial(Ft).build(),Tm=mt("precondition-map").legacy(bm).initial(km).build()});var ls=f(()=>{"use strict";Mt()});var cs=f(()=>{"use strict";Kt()});var ds=f(()=>{"use strict";Sr();ss();Ar();Mt();ls();Wt();Kt();br();cs()});async function xr({failFast:e,onStep:t,page:n,spec:r,variables:o}){let a=performance.now();return Cm({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:a,spec:r,variables:o})}function Lm({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Cm({currentId:e,failFast:t,onStep:n,page:r,runStartTime:o,spec:a,variables:i}){let l=[],s=i,c=e;for(;c!=null;){let p=a.nodes[c];if(p==null)throw new Error(`Node "${c}" not found in spec`);let u=c,d=p.label??`${p.type} (${c})`;b.info("Executing node: %s [%s]",d,p.type);let m=await vm({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(Lm({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function vm({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let a=performance.now(),i=e.label??`${e.type} (${e.id})`,l=e.timeout??Rm,s=Et({node:e,page:n});try{let c=await xm({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-a),u=c.assertions.some(m=>m.status==="failed"),d=await J({label:`Snapshot [${i}]`,fn:()=>ke({page:n,runStartTime:r,targets:s})});return{annotations:d.annotations,assertions:c.assertions,detail:void 0,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:u?"failed":"passed",stepIndex:0,title:i,url:d.url,variables:c.variables,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}catch(c){let p=Math.round(performance.now()-a),u=c instanceof Error?c.message:String(c),d=await J({label:`Snapshot [${i}] (error)`,fn:()=>ke({page:n,runStartTime:r,targets:s})});return{annotations:d.annotations,assertions:[],detail:u,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:"failed",stepIndex:0,title:i,url:d.url,variables:o,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}}async function xm({node:e,page:t,timeout:n,variables:r}){if(Pm(e)){let a=await _n({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:a.variables}}return{assertions:await Om({node:e,page:t,timeout:n,variables:r}),variables:r}}function Pm(e){return["goto","click","dblclick","fill","select","hover","press","check","uncheck","clear","rightClick","handleDialog","clipboard","setPermission","setViewport","fail","setVariable","extractText","upload","drag","scrollIntoView","type","focus"].includes(e.type)}function Em(e){return e.type.startsWith("assert")}async function Om({node:e,page:t,timeout:n,variables:r}){if(!Em(e))throw new Error(`Unknown node type: ${e.type}`);let o=e;switch(o.type){case"assertVisible":case"assertNotVisible":case"assertEnabled":case"assertDisabled":case"assertChecked":case"assertNotChecked":case"assertFocused":case"assertNotFocused":return _m({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let a=H({ref:o.expected,variables:r});return[await ar({expected:a,locator:$({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertUrl":{let a=H({ref:o.expected,variables:r});return[$t({expected:a,operator:o.operator,url:t.url()})]}case"assertTitle":{let a=H({ref:o.expected,variables:r});return[$t({expected:a,operator:o.operator,url:await t.title()})]}case"assertCount":{let a=Un({ref:o.expected,variables:r});return[await ir({expected:a,locator:$({locator:o.locator,page:t,variables:r}),operator:o.operator})]}case"assertValue":{let a=H({ref:o.expected,variables:r});return[await sr({expected:a,locator:$({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertAttribute":{let a=H({ref:o.expected,variables:r});return[await Di({attribute:o.attribute,expected:a,locator:$({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function _m({assertNode:e,page:t,timeout:n,variables:r}){let o=Um[e.type];return[await o({locator:$({locator:e.locator,page:t,variables:r}),timeout:n})]}var Rm,Um,Pr=f(()=>{"use strict";In();dr();Ve();G();We();it();Se();Rm=1e4;Um={assertChecked:qi,assertDisabled:Wi,assertEnabled:Vi,assertFocused:Mi,assertNotChecked:Fi,assertNotFocused:zi,assertNotVisible:cr,assertVisible:lr}});async function Er({baseUrl:e,browser:t,cookies:n,extraVariables:r,onStep:o,runId:a,spec:i}){let l=await t.newContext({baseURL:e});b.info("Browser context created"),n.length>0&&await l.addCookies(n);let s=await l.newPage();b.info("Page created");let c=st(s),p=[];function u(w){o?.(w),p.push(_t({context:l,page:s,runId:a,stepIndex:w.stepIndex,stepResult:w}))}let d=Im(r,i.variableNamespaces),m={...ot({defs:i.variables}),...d};b.info("Starting graph execution (entry: %s)",i.entryNode);let h=await xr({failFast:!0,onStep:u,page:s,spec:i,variables:m});await Promise.allSettled(p);let k=h.steps.filter(w=>w.status==="passed").length,S=h.steps.filter(w=>w.status==="failed").length,A={duration:h.steps.reduce((w,x)=>w+x.duration,0),failCount:S,passCount:k,runId:a,status:S>0?"failed":"passed",workflowName:""};return await It({monitor:c,runId:a,steps:h.steps,summary:A}),await l.close(),h.steps}function Im(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,a])=>{n.set(a,o)});let r={};return Object.entries(e).forEach(([o,a])=>{let i=n.get(o);i!=null&&(r[i]={...r[i],...a})}),r}var Or=f(()=>{"use strict";zn();jt();Pr();G();Se()});var us=Nt(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.timingSafeEqual=void 0;function ps(e,t=""){if(!e)throw new Error(t)}function jm(e,t){if(e.byteLength!==t.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),ps(e instanceof DataView),ps(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}Qt.timingSafeEqual=jm});var ys=Nt(ne=>{"use strict";var $m=ne&&ne.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(ne,"__esModule",{value:!0});var V=256,Ur=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var n="",r=0;r<t.length-2;r+=3){var o=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),n+=this._encodeByte(o>>>6&63),n+=this._encodeByte(o>>>0&63)}var a=t.length-r;if(a>0){var o=t[r]<<16|(a===2?t[r+1]<<8:0);n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),a===2?n+=this._encodeByte(o>>>6&63):n+=this._paddingCharacter||"",n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var n=this._getPaddingLength(t),r=t.length-n,o=new Uint8Array(this.maxDecodedLength(r)),a=0,i=0,l=0,s=0,c=0,p=0,u=0;i<r-4;i+=4)s=this._decodeChar(t.charCodeAt(i+0)),c=this._decodeChar(t.charCodeAt(i+1)),p=this._decodeChar(t.charCodeAt(i+2)),u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=s<<2|c>>>4,o[a++]=c<<4|p>>>2,o[a++]=p<<6|u,l|=s&V,l|=c&V,l|=p&V,l|=u&V;if(i<r-1&&(s=this._decodeChar(t.charCodeAt(i)),c=this._decodeChar(t.charCodeAt(i+1)),o[a++]=s<<2|c>>>4,l|=s&V,l|=c&V),i<r-2&&(p=this._decodeChar(t.charCodeAt(i+2)),o[a++]=c<<4|p>>>2,l|=p&V),i<r-3&&(u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=p<<6|u,l|=u&V),l!==0)throw new Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=V;return n+=(42-t&t-44)>>>8&-V+t-43+62,n+=(46-t&t-48)>>>8&-V+t-47+63,n+=(47-t&t-58)>>>8&-V+t-48+52,n+=(64-t&t-91)>>>8&-V+t-65+0,n+=(96-t&t-123)>>>8&-V+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0&&t[r]===this._paddingCharacter;r--)n++;if(t.length<4||n>2)throw new Error("Base64Coder: incorrect padding")}return n},e})();ne.Coder=Ur;var yt=new Ur;function Bm(e){return yt.encode(e)}ne.encode=Bm;function Dm(e){return yt.decode(e)}ne.decode=Dm;var ms=(function(e){$m(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=V;return r+=(44-n&n-46)>>>8&-V+n-45+62,r+=(94-n&n-96)>>>8&-V+n-95+63,r+=(47-n&n-58)>>>8&-V+n-48+52,r+=(64-n&n-91)>>>8&-V+n-65+0,r+=(96-n&n-123)>>>8&-V+n-97+26,r},t})(Ur);ne.URLSafeCoder=ms;var fs=new ms;function Vm(e){return fs.encode(e)}ne.encodeURLSafe=Vm;function Wm(e){return fs.decode(e)}ne.decodeURLSafe=Wm;ne.encodedLength=function(e){return yt.encodedLength(e)};ne.maxDecodedLength=function(e){return yt.maxDecodedLength(e)};ne.decodedLength=function(e){return yt.decodedLength(e)}});var hs=Nt((gs,Yt)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof Yt=="object"&&typeof Yt.exports=="object"?Yt.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(gs,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(u,d,m,h,k){for(var S,A,w,x,R,T,P,B,_,q,Ze,et,bt;k>=64;){for(S=d[0],A=d[1],w=d[2],x=d[3],R=d[4],T=d[5],P=d[6],B=d[7],q=0;q<16;q++)Ze=h+q*4,u[q]=(m[Ze]&255)<<24|(m[Ze+1]&255)<<16|(m[Ze+2]&255)<<8|m[Ze+3]&255;for(q=16;q<64;q++)_=u[q-2],et=(_>>>17|_<<15)^(_>>>19|_<<13)^_>>>10,_=u[q-15],bt=(_>>>7|_<<25)^(_>>>18|_<<14)^_>>>3,u[q]=(et+u[q-7]|0)+(bt+u[q-16]|0);for(q=0;q<64;q++)et=(((R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&T^~R&P)|0)+(B+(t[q]+u[q]|0)|0)|0,bt=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&A^S&w^A&w)|0,B=P,P=T,T=R,R=x+et|0,x=w,w=A,A=S,S=et+bt|0;d[0]+=S,d[1]+=A,d[2]+=w,d[3]+=x,d[4]+=R,d[5]+=T,d[6]+=P,d[7]+=B,h+=64,k-=64}return h}var r=(function(){function u(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return u.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},u.prototype.clean=function(){for(var d=0;d<this.buffer.length;d++)this.buffer[d]=0;for(var d=0;d<this.temp.length;d++)this.temp[d]=0;this.reset()},u.prototype.update=function(d,m){if(m===void 0&&(m=d.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=m,this.bufferLength>0){for(;this.bufferLength<64&&m>0;)this.buffer[this.bufferLength++]=d[h++],m--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(m>=64&&(h=n(this.temp,this.state,d,h,m),m%=64);m>0;)this.buffer[this.bufferLength++]=d[h++],m--;return this},u.prototype.finish=function(d){if(!this.finished){var m=this.bytesHashed,h=this.bufferLength,k=m/536870912|0,S=m<<3,A=m%64<56?64:128;this.buffer[h]=128;for(var w=h+1;w<A-8;w++)this.buffer[w]=0;this.buffer[A-8]=k>>>24&255,this.buffer[A-7]=k>>>16&255,this.buffer[A-6]=k>>>8&255,this.buffer[A-5]=k>>>0&255,this.buffer[A-4]=S>>>24&255,this.buffer[A-3]=S>>>16&255,this.buffer[A-2]=S>>>8&255,this.buffer[A-1]=S>>>0&255,n(this.temp,this.state,this.buffer,0,A),this.finished=!0}for(var w=0;w<8;w++)d[w*4+0]=this.state[w]>>>24&255,d[w*4+1]=this.state[w]>>>16&255,d[w*4+2]=this.state[w]>>>8&255,d[w*4+3]=this.state[w]>>>0&255;return this},u.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},u.prototype._saveState=function(d){for(var m=0;m<this.state.length;m++)d[m]=this.state[m]},u.prototype._restoreState=function(d,m){for(var h=0;h<this.state.length;h++)this.state[h]=d[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},u})();e.Hash=r;var o=(function(){function u(d){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(d.length>this.blockSize)new r().update(d).finish(m).clean();else for(var h=0;h<d.length;h++)m[h]=d[h];for(var h=0;h<m.length;h++)m[h]^=54;this.inner.update(m);for(var h=0;h<m.length;h++)m[h]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<m.length;h++)m[h]=0}return u.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},u.prototype.clean=function(){for(var d=0;d<this.istate.length;d++)this.ostate[d]=this.istate[d]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(d){return this.inner.update(d),this},u.prototype.finish=function(d){return this.outer.finished?this.outer.finish(d):(this.inner.finish(d),this.outer.update(d,this.digestLength).finish(d)),this},u.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},u})();e.HMAC=o;function a(u){var d=new r().update(u),m=d.digest();return d.clean(),m}e.hash=a,e.default=a;function i(u,d){var m=new o(u).update(d),h=m.digest();return m.clean(),h}e.hmac=i;function l(u,d,m,h){var k=h[0];if(k===0)throw new Error("hkdf: cannot expand more");d.reset(),k>1&&d.update(u),m&&d.update(m),d.update(h),d.finish(u),h[0]++}var s=new Uint8Array(e.digestLength);function c(u,d,m,h){d===void 0&&(d=s),h===void 0&&(h=32);for(var k=new Uint8Array([1]),S=i(d,u),A=new o(S),w=new Uint8Array(A.digestLength),x=w.length,R=new Uint8Array(h),T=0;T<h;T++)x===w.length&&(l(w,A,m,k),x=0),R[T]=w[x++];return A.clean(),w.fill(0),k.fill(0),R}e.hkdf=c;function p(u,d,m,h){for(var k=new o(u),S=k.digestLength,A=new Uint8Array(4),w=new Uint8Array(S),x=new Uint8Array(S),R=new Uint8Array(h),T=0;T*S<h;T++){var P=T+1;A[0]=P>>>24&255,A[1]=P>>>16&255,A[2]=P>>>8&255,A[3]=P>>>0&255,k.reset(),k.update(d),k.update(A),k.finish(x);for(var B=0;B<S;B++)w[B]=x[B];for(var B=2;B<=m;B++){k.reset(),k.update(x).finish(x);for(var _=0;_<S;_++)w[_]^=x[_]}for(var B=0;B<S&&T*S+B<h;B++)R[T*S+B]=w[B]}for(var T=0;T<S;T++)w[T]=x[T]=0;for(var T=0;T<4;T++)A[T]=0;return k.clean(),R}e.pbkdf2=p})});var Ir=Nt(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.Webhook=Me.WebhookVerificationError=void 0;var qm=us(),Ss=ys(),Fm=hs(),ks=300,_r=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},Ne=class e extends _r{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Me.WebhookVerificationError=Ne;var Zt=class e{constructor(t,n){if(!t)throw new Error("Secret can't be empty.");if(n?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,r=>r.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=Ss.decode(t)}}verify(t,n){let r={};for(let d of Object.keys(n))r[d.toLowerCase()]=n[d];let o=r["webhook-id"],a=r["webhook-signature"],i=r["webhook-timestamp"];if(!a||!o||!i)throw new Ne("Missing required headers");let l=this.verifyTimestamp(i),c=this.sign(o,l,t).split(",")[1],p=a.split(" "),u=new globalThis.TextEncoder;for(let d of p){let[m,h]=d.split(",");if(m==="v1"&&(0,qm.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new Ne("No matching signature found")}sign(t,n,r){if(typeof r!="string")if(r.constructor.name==="Buffer")r=r.toString();else throw new Error("Expected payload to be of type string or Buffer.");let o=new TextEncoder,a=Math.floor(n.getTime()/1e3),i=o.encode(`${t}.${a}.${r}`);return`v1,${Ss.encode(Fm.hmac(this.key,i))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new Ne("Invalid Signature Headers");if(n-r>ks)throw new Ne("Message timestamp too old");if(r>n+ks)throw new Ne("Message timestamp too new");return new Date(r*1e3)}};Me.Webhook=Zt;Zt.prefix="whsec_"});import As from"crypto";function ze({body:e,secret:t}){let n=new ws.Webhook(t),r=`msg_${As.randomUUID()}`,o=new Date,a=n.sign(r,o,e),i=Math.floor(o.getTime()/1e3);return{"webhook-id":r,"webhook-signature":a,"webhook-timestamp":String(i)}}function jr(){return`whsec_${As.randomBytes(24).toString("base64")}`}var ws,$r=f(()=>{"use strict";ws=To(Ir(),1)});import{parseSetCookie as Mm}from"set-cookie-parser";import{z as re}from"zod";async function Br({baseUrl:e,project:t,webhookSecret:n,workflowSlug:r}){let o={apiUrl:void 0,cookies:[],data:{},executed:[]},a=t.stateGraph;if(a==null)return o;let i=(a.edges??[]).find(c=>c.workflowSlug===r);if(i?.sourceState==null)return o;let l=Ts({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),s=i.sourceState.preconditions;return s.length===0?{...o,apiUrl:l}:l==null?o:Ns({apiUrl:l,preconditionNames:s,webhookSecret:n})}async function Dr({apiUrl:e,cookies:t,data:n,executed:r,webhookSecret:o}){if(r.length!==0)try{let a=JSON.stringify({data:n,preconditions:r}),i=await fetch(`${e}/teardown`,{body:a,headers:{"Content-Type":"application/json",...Hm({cookies:t}),...ze({body:a,secret:o})},method:"PUT",signal:AbortSignal.timeout(bs)});i.ok||b.error("Teardown returned %s",String(i.status))}catch{b.error("Teardown request failed")}}async function Ns({apiUrl:e,preconditionNames:t,webhookSecret:n}){let r=performance.now(),o=JSON.stringify({preconditions:t}),a=await fetch(`${e}/execute-batch`,{body:o,headers:{"Content-Type":"application/json",...ze({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(bs)});if(!a.ok){let c=await Xm(a);throw new Error(`execute-batch returned ${String(a.status)}: ${c}`)}let i=await a.json(),l=zm.safeParse(i);if(!l.success)throw new Error(`execute-batch response has invalid shape: ${l.error.message}`);if(!l.data.success){let c=l.data.error??"no error detail";throw new Error(`Precondition batch failed: ${c}`)}let s=Km({domain:new URL(e).hostname,res:a});return b.info("Preconditions resolved: %s (%dms)",l.data.executed.join(", "),Math.round(performance.now()-r)),{apiUrl:e,cookies:s,data:l.data.data,executed:l.data.executed}}async function Xm(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=Gm(t),r=n==null?null:Jm.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function Gm(e){try{return JSON.parse(e)}catch{return null}}function Hm({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Km({domain:e,res:t}){let n=t.headers.getSetCookie();return Mm(n,{decodeValues:!1}).map(o=>Qm({cookie:o,domain:e}))}function Qm({cookie:e,domain:t}){let n={domain:e.domain??t,httpOnly:e.httpOnly??!1,name:e.name,path:e.path??"/",secure:e.secure??!1,value:e.value};return e.sameSite!=null&&(n.sameSite=Zm({raw:e.sameSite})),e.expires!=null?n.expires=Math.floor(e.expires.getTime()/1e3):e.maxAge!=null&&(n.expires=Math.floor(Date.now()/1e3)+e.maxAge),n}function Zm({raw:e}){return Ym[e.toLowerCase()]??"Lax"}async function Vr({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Ts({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Ns({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Ts({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var bs,zm,Jm,Ym,Wr=f(()=>{"use strict";G();$r();bs=3e4,zm=re.object({data:re.record(re.string(),re.record(re.string(),re.string())),error:re.string().optional(),executed:re.array(re.string()),runId:re.string(),success:re.boolean()});Jm=re.object({error:re.string()});Ym={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as qr}from"gql.tada";async function Fr({agentProfileId:e,config:t,runId:n}){let r=await W({config:t,document:tf,variables:{agentProfileId:e??null,platform:"chromium",runId:n}});if(r.startRun==null)throw new Error("Failed to start run");let o=r.startRun.id,a=[];function i(c){let p=ef({config:t,runResultId:o,steps:[c]}).catch(u=>{b.error(u,"Failed to submit step %d",c.stepIndex)});a.push(p)}async function l(){await Promise.all(a)}async function s({statusOverride:c,steps:p,summary:u}){await J({label:`flushSteps (${String(a.length)} steps)`,fn:()=>Promise.all(a)});let d=p.filter(S=>S.status==="passed").length,m=p.filter(S=>S.status==="failed").length,h=p.reduce((S,A)=>S+A.duration,0),k=c??(m>0?"failed":"passed");await J({label:"completeRun",fn:()=>W({config:t,document:rf,variables:{duration:h,failCount:m,passCount:d,runResultId:o,status:k,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:i,flushSteps:l,runResultId:o}}async function ef({config:e,runResultId:t,steps:n}){let r=n.map(o=>({annotations:o.annotations.map(a=>({height:a.height,label:a.label,type:a.type,width:a.width,x:a.x,y:a.y})),assertions:o.assertions.map(a=>({description:a.description,detail:a.detail,status:a.status})),detail:o.detail,duration:o.duration,nodeType:o.nodeType,screenshotBase64:o.screenshotBase64,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth}));await W({config:e,document:nf,variables:{runResultId:t,steps:r}})}var tf,nf,rf,Mr=f(()=>{"use strict";dt();G();We();tf=qr(`
96
+ `)});async function yr({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Lu)})}catch(t){let n=t instanceof Error?t.message:String(t);throw b.debug("App URL reachability check failed: %s",n),new Error([`Could not reach your dev server at ${e}.`,"","Troubleshooting:",` 1. Make sure your app is running at ${e}`," 2. Check the appUrl in your createRipplo() config"," 3. If your app runs on a different port, update appUrl in .ripplo/ripplo.ts"].join(`
97
+ `))}}var Lu,gr=f(()=>{"use strict";K();Lu=5e3});import pt from"fs";import hr from"path";function ut(e){let t=hr.join(e,".ripplo",".token");if(!pt.existsSync(t))return null;let n=pt.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Sr(e,t){let n=hr.join(e,".ripplo");pt.existsSync(n)||pt.mkdirSync(n,{recursive:!0}),pt.writeFileSync(hr.join(n,".token"),t+`
98
+ `)}var Zi=f(()=>{"use strict"});import{z as Dt}from"zod";function mt(e){return es({legacy:void 0,migrators:[],name:e,schemas:[]})}function es(e){return{initial:t=>kr(t,{...e,schemas:[t]}),legacy:t=>es({...e,legacy:t})}}function kr(e,t){return{build:()=>vu(e,t),legacy:n=>kr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return kr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function vu(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>xu(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function xu(e,t,n){let{data:r,version:o}=Pu(t,n),a=ts(t,r,o);return e.parse(a)}function Pu(e,t){let n=Cu.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Wt({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function ts(e,t,n){let r=e.schemas.length;if(n>r)throw new Vt({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return ts(e,i(a),n+1)}var Cu,Vt,Wt,Ar=f(()=>{"use strict";Cu=Dt.object({__codec:Dt.string().min(1),data:Dt.unknown(),version:Dt.number().int().positive()}),Vt=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Wt=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as Pe}from"zod";var wr,br=f(()=>{"use strict";wr=Pe.object({from:Pe.string().min(1).describe("Key of the source state in the states record"),requiresKeys:Pe.record(Pe.string(),Pe.string()).optional().describe("Maps workflow variable namespace to precondition name. Used by the runtime to namespace batch precondition data into dot-namespaced variables (e.g. { project: 'data:project' } maps projectId \u2192 project.projectId)."),to:Pe.string().min(1).describe("Key of the target state in the states record"),workflow:Pe.string().min(1).describe("Filename (without .json) of the workflow in .ripplo/workflows/ that executes this edge")}).describe("A directed edge between two states, executed by a workflow")});import{z as Me}from"zod";var ft,Ft=f(()=>{"use strict";ft=Me.object({depends:Me.array(Me.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Me.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Me.array(Me.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name.")});import{z as qt}from"zod";var Nr,Tr=f(()=>{"use strict";Nr=qt.object({preconditions:qt.array(qt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:qt.string().min(1).describe("URL pattern with {{placeholders}} for dynamic segments, e.g. '/projects/{{projectId}}/settings'")}).describe("A distinct application state \u2014 a unique combination of location, auth context, and data conditions")});import{z as ze}from"zod";var ns,Eu,rs,Mt,zt=f(()=>{"use strict";br();Ft();Tr();ns=1e3,Eu=5e3,rs=500,Mt=ze.object({edges:ze.array(wr).max(Eu).describe("Directed edges between states, each executed by a workflow"),preconditions:ze.record(ze.string().max(200),ft).refine(e=>Object.keys(e).length<=rs,`Graph has more than ${String(rs)} preconditions`).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:ze.record(ze.string().max(200),Nr).refine(e=>Object.keys(e).length<=ns,`Graph has more than ${String(ns)} states`).describe("States keyed by stable ID (kebab-case)")}).describe("Ripplo State Graph \u2014 models application states, edges, and executable preconditions")});import{z as be}from"zod";var Ou,Uu,O,Rr=f(()=>{"use strict";Ou=be.object({by:be.literal("testId"),value:be.string().min(1)}),Uu=be.object({by:be.literal("role"),name:be.string().optional(),role:be.string().min(1)}),O=be.discriminatedUnion("by",[Ou,Uu])});import{z as os}from"zod";var Ne,Jt,Lr=f(()=>{"use strict";Ne=os.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Jt=os.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as M}from"zod";var _u,Cr,Xt,te,Gt,vr=f(()=>{"use strict";_u=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),Cr=M.object({name:M.string().min(1),type:M.literal("variable")}),Xt=M.discriminatedUnion("type",[_u,Cr]),te=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),Cr]),Gt=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),Cr])});import{z as ne}from"zod";var Ht,xr=f(()=>{"use strict";Ht=ne.discriminatedUnion("type",[ne.object({default:ne.string().optional(),type:ne.literal("string")}),ne.object({default:ne.number().optional(),type:ne.literal("number")}),ne.object({default:ne.boolean().optional(),type:ne.literal("boolean")}),ne.object({key:ne.string().min(1),type:ne.literal("env")})])});import{z as g}from"zod";var v,as,Iu,ju,$u,Bu,Du,Vu,Wu,Fu,qu,Mu,zu,Ju,Xu,Gu,Hu,Ku,Yu,Qu,Zu,em,tm,nm,rm,om,am,im,sm,lm,cm,dm,pm,um,mm,fm,ym,gm,hm,is,Kt,Yt=f(()=>{"use strict";Rr();Lr();vr();xr();Rr();Lr();vr();xr();v={comment:g.string().max(2e3).optional(),id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),timeout:g.number().int().positive().optional()},as=500,Iu=g.object({...v,type:g.literal("goto"),url:te}),ju=g.object({...v,locator:O,type:g.literal("click")}),$u=g.object({...v,locator:O,type:g.literal("fill"),value:te}),Bu=g.object({...v,locator:O,type:g.literal("select"),value:te}),Du=g.object({...v,locator:O,type:g.literal("hover")}),Vu=g.object({...v,key:g.string().min(1),locator:O.optional(),type:g.literal("press")}),Wu=g.object({...v,locator:O,type:g.literal("check")}),Fu=g.object({...v,locator:O,type:g.literal("uncheck")}),qu=g.object({...v,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),Mu=g.object({...v,message:g.string().min(1),type:g.literal("fail")}),zu=g.object({...v,type:g.literal("setVariable"),value:Xt,variable:g.string().min(1)}),Ju=g.object({...v,locator:O,type:g.literal("extractText"),variable:g.string().min(1)}),Xu=g.object({...v,files:g.array(g.string()).min(1),locator:O,type:g.literal("upload")}),Gu=g.object({...v,locator:O,type:g.literal("dblclick")}),Hu=g.object({...v,source:O,target:O,type:g.literal("drag")}),Ku=g.object({...v,locator:O,type:g.literal("scrollIntoView")}),Yu=g.object({...v,locator:O,type:g.literal("type"),value:te}),Qu=g.object({...v,locator:O,type:g.literal("focus")}),Zu=g.object({...v,locator:O,type:g.literal("clear")}),em=g.object({...v,locator:O,type:g.literal("rightClick")}),tm=g.object({...v,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),nm=g.object({...v,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:te.optional(),variable:g.string().min(1).optional()}),rm=g.object({...v,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),om=g.object({...v,locator:O,type:g.literal("assertVisible")}),am=g.object({...v,locator:O,type:g.literal("assertNotVisible")}),im=g.object({...v,expected:te,locator:O,operator:Ne,type:g.literal("assertText")}),sm=g.object({...v,expected:te,operator:Ne,type:g.literal("assertUrl")}),lm=g.object({...v,expected:Gt,locator:O,operator:Jt,type:g.literal("assertCount")}),cm=g.object({...v,expected:te,locator:O,operator:Ne,type:g.literal("assertValue")}),dm=g.object({...v,attribute:g.string().min(1),expected:te,locator:O,operator:Ne,type:g.literal("assertAttribute")}),pm=g.object({...v,locator:O,type:g.literal("assertEnabled")}),um=g.object({...v,locator:O,type:g.literal("assertDisabled")}),mm=g.object({...v,expected:te,operator:Ne,type:g.literal("assertTitle")}),fm=g.object({...v,locator:O,type:g.literal("assertChecked")}),ym=g.object({...v,locator:O,type:g.literal("assertNotChecked")}),gm=g.object({...v,locator:O,type:g.literal("assertFocused")}),hm=g.object({...v,locator:O,type:g.literal("assertNotFocused")}),is=g.discriminatedUnion("type",[Iu,ju,$u,Bu,Du,Vu,Wu,Fu,om,am,im,sm,lm,cm,dm,pm,um,qu,Mu,zu,Ju,Xu,Gu,Hu,Ku,Yu,Qu,Zu,em,tm,nm,rm,mm,fm,ym,gm,hm]),Kt=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),is).refine(e=>Object.keys(e).length<=as,`Workflow has more than ${String(as)} nodes`),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),Ht).optional()})});import{z as ss}from"zod";var Sm,km,Am,wm,Pr,bm,Nm,ls=f(()=>{"use strict";Ar();zt();Ft();Yt();Sm=ss.record(ss.string().max(200),ft),km={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Am={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"edges"in e&&"states"in e&&"preconditions"in e},wm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Pr=mt("workflow-spec").legacy(km).initial(Kt).build(),bm=mt("state-graph").legacy(Am).initial(Mt).build(),Nm=mt("precondition-map").legacy(wm).initial(Sm).build()});var cs=f(()=>{"use strict";zt()});var ds=f(()=>{"use strict";Yt()});var ps=f(()=>{"use strict";Ar();ls();br();zt();cs();Ft();Yt();Tr();ds()});async function Er({failFast:e,onStep:t,page:n,spec:r,variables:o}){let a=performance.now();return Lm({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:a,spec:r,variables:o})}function Rm({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Lm({currentId:e,failFast:t,onStep:n,page:r,runStartTime:o,spec:a,variables:i}){let l=[],s=i,c=e;for(;c!=null;){let p=a.nodes[c];if(p==null)throw new Error(`Node "${c}" not found in spec`);let u=c,d=p.label??`${p.type} (${c})`;b.info("Executing node: %s [%s]",d,p.type);let m=await Cm({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(Rm({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function Cm({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let a=performance.now(),i=e.label??`${e.type} (${e.id})`,l=e.timeout??Tm,s=Ot({node:e,page:n});try{let c=await vm({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-a),u=c.assertions.some(m=>m.status==="failed"),d=await X({label:`Snapshot [${i}]`,fn:()=>Ae({page:n,runStartTime:r,targets:s})});return{annotations:d.annotations,assertions:c.assertions,detail:void 0,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:u?"failed":"passed",stepIndex:0,title:i,url:d.url,variables:c.variables,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}catch(c){let p=Math.round(performance.now()-a),u=c instanceof Error?c.message:String(c),d=await X({label:`Snapshot [${i}] (error)`,fn:()=>Ae({page:n,runStartTime:r,targets:s})});return{annotations:d.annotations,assertions:[],detail:u,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:"failed",stepIndex:0,title:i,url:d.url,variables:o,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}}async function vm({node:e,page:t,timeout:n,variables:r}){if(xm(e)){let a=await jn({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:a.variables}}return{assertions:await Em({node:e,page:t,timeout:n,variables:r}),variables:r}}function xm(e){return["goto","click","dblclick","fill","select","hover","press","check","uncheck","clear","rightClick","handleDialog","clipboard","setPermission","setViewport","fail","setVariable","extractText","upload","drag","scrollIntoView","type","focus"].includes(e.type)}function Pm(e){return e.type.startsWith("assert")}async function Em({node:e,page:t,timeout:n,variables:r}){if(!Pm(e))throw new Error(`Unknown node type: ${e.type}`);let o=e;switch(o.type){case"assertVisible":case"assertNotVisible":case"assertEnabled":case"assertDisabled":case"assertChecked":case"assertNotChecked":case"assertFocused":case"assertNotFocused":return Um({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let a=Y({ref:o.expected,variables:r});return[await sr({expected:a,locator:D({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertUrl":{let a=Y({ref:o.expected,variables:r});return[Bt({expected:a,operator:o.operator,url:t.url()})]}case"assertTitle":{let a=Y({ref:o.expected,variables:r});return[Bt({expected:a,operator:o.operator,url:await t.title()})]}case"assertCount":{let a=In({ref:o.expected,variables:r});return[await lr({expected:a,locator:D({locator:o.locator,page:t,variables:r}),operator:o.operator})]}case"assertValue":{let a=Y({ref:o.expected,variables:r});return[await cr({expected:a,locator:D({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertAttribute":{let a=Y({ref:o.expected,variables:r});return[await Vi({attribute:o.attribute,expected:a,locator:D({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function Um({assertNode:e,page:t,timeout:n,variables:r}){let o=Om[e.type];return[await o({locator:D({locator:e.locator,page:t,variables:r}),timeout:n})]}var Tm,Om,Or=f(()=>{"use strict";$n();ur();Fe();K();qe();it();ke();Tm=1e4;Om={assertChecked:qi,assertDisabled:Fi,assertEnabled:Wi,assertFocused:zi,assertNotChecked:Mi,assertNotFocused:Ji,assertNotVisible:pr,assertVisible:dr}});async function Ur({baseUrl:e,browser:t,cookies:n,extraVariables:r,onStep:o,runId:a,spec:i}){let l=await t.newContext({baseURL:e});b.info("Browser context created"),n.length>0&&await l.addCookies(n);let s=await l.newPage();b.info("Page created");let c=st(s),p=[];function u(w){o?.(w),p.push(It({context:l,page:s,runId:a,stepIndex:w.stepIndex,stepResult:w}))}let d=_m(r,i.variableNamespaces),m={...ot({defs:i.variables}),...d};b.info("Starting graph execution (entry: %s)",i.entryNode);let h=await Er({failFast:!0,onStep:u,page:s,spec:i,variables:m});await Promise.allSettled(p);let k=h.steps.filter(w=>w.status==="passed").length,S=h.steps.filter(w=>w.status==="failed").length,A={duration:h.steps.reduce((w,P)=>w+P.duration,0),failCount:S,passCount:k,runId:a,status:S>0?"failed":"passed",workflowName:""};return await jt({monitor:c,runId:a,steps:h.steps,summary:A}),await l.close(),h.steps}function _m(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,a])=>{n.set(a,o)});let r={};return Object.entries(e).forEach(([o,a])=>{let i=n.get(o);i!=null&&(r[i]={...r[i],...a})}),r}var _r=f(()=>{"use strict";Xn();$t();Or();K();ke()});var ms=Tt(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.timingSafeEqual=void 0;function us(e,t=""){if(!e)throw new Error(t)}function Im(e,t){if(e.byteLength!==t.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),us(e instanceof DataView),us(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}Qt.timingSafeEqual=Im});var gs=Tt(re=>{"use strict";var jm=re&&re.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(re,"__esModule",{value:!0});var W=256,Ir=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var n="",r=0;r<t.length-2;r+=3){var o=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),n+=this._encodeByte(o>>>6&63),n+=this._encodeByte(o>>>0&63)}var a=t.length-r;if(a>0){var o=t[r]<<16|(a===2?t[r+1]<<8:0);n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),a===2?n+=this._encodeByte(o>>>6&63):n+=this._paddingCharacter||"",n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var n=this._getPaddingLength(t),r=t.length-n,o=new Uint8Array(this.maxDecodedLength(r)),a=0,i=0,l=0,s=0,c=0,p=0,u=0;i<r-4;i+=4)s=this._decodeChar(t.charCodeAt(i+0)),c=this._decodeChar(t.charCodeAt(i+1)),p=this._decodeChar(t.charCodeAt(i+2)),u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=s<<2|c>>>4,o[a++]=c<<4|p>>>2,o[a++]=p<<6|u,l|=s&W,l|=c&W,l|=p&W,l|=u&W;if(i<r-1&&(s=this._decodeChar(t.charCodeAt(i)),c=this._decodeChar(t.charCodeAt(i+1)),o[a++]=s<<2|c>>>4,l|=s&W,l|=c&W),i<r-2&&(p=this._decodeChar(t.charCodeAt(i+2)),o[a++]=c<<4|p>>>2,l|=p&W),i<r-3&&(u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=p<<6|u,l|=u&W),l!==0)throw new Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=W;return n+=(42-t&t-44)>>>8&-W+t-43+62,n+=(46-t&t-48)>>>8&-W+t-47+63,n+=(47-t&t-58)>>>8&-W+t-48+52,n+=(64-t&t-91)>>>8&-W+t-65+0,n+=(96-t&t-123)>>>8&-W+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0&&t[r]===this._paddingCharacter;r--)n++;if(t.length<4||n>2)throw new Error("Base64Coder: incorrect padding")}return n},e})();re.Coder=Ir;var yt=new Ir;function $m(e){return yt.encode(e)}re.encode=$m;function Bm(e){return yt.decode(e)}re.decode=Bm;var fs=(function(e){jm(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=W;return r+=(44-n&n-46)>>>8&-W+n-45+62,r+=(94-n&n-96)>>>8&-W+n-95+63,r+=(47-n&n-58)>>>8&-W+n-48+52,r+=(64-n&n-91)>>>8&-W+n-65+0,r+=(96-n&n-123)>>>8&-W+n-97+26,r},t})(Ir);re.URLSafeCoder=fs;var ys=new fs;function Dm(e){return ys.encode(e)}re.encodeURLSafe=Dm;function Vm(e){return ys.decode(e)}re.decodeURLSafe=Vm;re.encodedLength=function(e){return yt.encodedLength(e)};re.maxDecodedLength=function(e){return yt.maxDecodedLength(e)};re.decodedLength=function(e){return yt.decodedLength(e)}});var Ss=Tt((hs,Zt)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof Zt=="object"&&typeof Zt.exports=="object"?Zt.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(hs,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(u,d,m,h,k){for(var S,A,w,P,E,T,I,x,L,$,ve,et,Nt;k>=64;){for(S=d[0],A=d[1],w=d[2],P=d[3],E=d[4],T=d[5],I=d[6],x=d[7],$=0;$<16;$++)ve=h+$*4,u[$]=(m[ve]&255)<<24|(m[ve+1]&255)<<16|(m[ve+2]&255)<<8|m[ve+3]&255;for($=16;$<64;$++)L=u[$-2],et=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,L=u[$-15],Nt=(L>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,u[$]=(et+u[$-7]|0)+(Nt+u[$-16]|0);for($=0;$<64;$++)et=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&T^~E&I)|0)+(x+(t[$]+u[$]|0)|0)|0,Nt=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&A^S&w^A&w)|0,x=I,I=T,T=E,E=P+et|0,P=w,w=A,A=S,S=et+Nt|0;d[0]+=S,d[1]+=A,d[2]+=w,d[3]+=P,d[4]+=E,d[5]+=T,d[6]+=I,d[7]+=x,h+=64,k-=64}return h}var r=(function(){function u(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return u.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},u.prototype.clean=function(){for(var d=0;d<this.buffer.length;d++)this.buffer[d]=0;for(var d=0;d<this.temp.length;d++)this.temp[d]=0;this.reset()},u.prototype.update=function(d,m){if(m===void 0&&(m=d.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=m,this.bufferLength>0){for(;this.bufferLength<64&&m>0;)this.buffer[this.bufferLength++]=d[h++],m--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(m>=64&&(h=n(this.temp,this.state,d,h,m),m%=64);m>0;)this.buffer[this.bufferLength++]=d[h++],m--;return this},u.prototype.finish=function(d){if(!this.finished){var m=this.bytesHashed,h=this.bufferLength,k=m/536870912|0,S=m<<3,A=m%64<56?64:128;this.buffer[h]=128;for(var w=h+1;w<A-8;w++)this.buffer[w]=0;this.buffer[A-8]=k>>>24&255,this.buffer[A-7]=k>>>16&255,this.buffer[A-6]=k>>>8&255,this.buffer[A-5]=k>>>0&255,this.buffer[A-4]=S>>>24&255,this.buffer[A-3]=S>>>16&255,this.buffer[A-2]=S>>>8&255,this.buffer[A-1]=S>>>0&255,n(this.temp,this.state,this.buffer,0,A),this.finished=!0}for(var w=0;w<8;w++)d[w*4+0]=this.state[w]>>>24&255,d[w*4+1]=this.state[w]>>>16&255,d[w*4+2]=this.state[w]>>>8&255,d[w*4+3]=this.state[w]>>>0&255;return this},u.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},u.prototype._saveState=function(d){for(var m=0;m<this.state.length;m++)d[m]=this.state[m]},u.prototype._restoreState=function(d,m){for(var h=0;h<this.state.length;h++)this.state[h]=d[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},u})();e.Hash=r;var o=(function(){function u(d){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var m=new Uint8Array(this.blockSize);if(d.length>this.blockSize)new r().update(d).finish(m).clean();else for(var h=0;h<d.length;h++)m[h]=d[h];for(var h=0;h<m.length;h++)m[h]^=54;this.inner.update(m);for(var h=0;h<m.length;h++)m[h]^=106;this.outer.update(m),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<m.length;h++)m[h]=0}return u.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},u.prototype.clean=function(){for(var d=0;d<this.istate.length;d++)this.ostate[d]=this.istate[d]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(d){return this.inner.update(d),this},u.prototype.finish=function(d){return this.outer.finished?this.outer.finish(d):(this.inner.finish(d),this.outer.update(d,this.digestLength).finish(d)),this},u.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},u})();e.HMAC=o;function a(u){var d=new r().update(u),m=d.digest();return d.clean(),m}e.hash=a,e.default=a;function i(u,d){var m=new o(u).update(d),h=m.digest();return m.clean(),h}e.hmac=i;function l(u,d,m,h){var k=h[0];if(k===0)throw new Error("hkdf: cannot expand more");d.reset(),k>1&&d.update(u),m&&d.update(m),d.update(h),d.finish(u),h[0]++}var s=new Uint8Array(e.digestLength);function c(u,d,m,h){d===void 0&&(d=s),h===void 0&&(h=32);for(var k=new Uint8Array([1]),S=i(d,u),A=new o(S),w=new Uint8Array(A.digestLength),P=w.length,E=new Uint8Array(h),T=0;T<h;T++)P===w.length&&(l(w,A,m,k),P=0),E[T]=w[P++];return A.clean(),w.fill(0),k.fill(0),E}e.hkdf=c;function p(u,d,m,h){for(var k=new o(u),S=k.digestLength,A=new Uint8Array(4),w=new Uint8Array(S),P=new Uint8Array(S),E=new Uint8Array(h),T=0;T*S<h;T++){var I=T+1;A[0]=I>>>24&255,A[1]=I>>>16&255,A[2]=I>>>8&255,A[3]=I>>>0&255,k.reset(),k.update(d),k.update(A),k.finish(P);for(var x=0;x<S;x++)w[x]=P[x];for(var x=2;x<=m;x++){k.reset(),k.update(P).finish(P);for(var L=0;L<S;L++)w[L]^=P[L]}for(var x=0;x<S&&T*S+x<h;x++)E[T*S+x]=w[x]}for(var T=0;T<S;T++)w[T]=P[T]=0;for(var T=0;T<4;T++)A[T]=0;return k.clean(),E}e.pbkdf2=p})});var $r=Tt(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Webhook=Je.WebhookVerificationError=void 0;var Wm=ms(),ks=gs(),Fm=Ss(),As=300,jr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},Te=class e extends jr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Je.WebhookVerificationError=Te;var en=class e{constructor(t,n){if(!t)throw new Error("Secret can't be empty.");if(n?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,r=>r.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=ks.decode(t)}}verify(t,n){let r={};for(let d of Object.keys(n))r[d.toLowerCase()]=n[d];let o=r["webhook-id"],a=r["webhook-signature"],i=r["webhook-timestamp"];if(!a||!o||!i)throw new Te("Missing required headers");let l=this.verifyTimestamp(i),c=this.sign(o,l,t).split(",")[1],p=a.split(" "),u=new globalThis.TextEncoder;for(let d of p){let[m,h]=d.split(",");if(m==="v1"&&(0,Wm.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new Te("No matching signature found")}sign(t,n,r){if(typeof r!="string")if(r.constructor.name==="Buffer")r=r.toString();else throw new Error("Expected payload to be of type string or Buffer.");let o=new TextEncoder,a=Math.floor(n.getTime()/1e3),i=o.encode(`${t}.${a}.${r}`);return`v1,${ks.encode(Fm.hmac(this.key,i))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new Te("Invalid Signature Headers");if(n-r>As)throw new Te("Message timestamp too old");if(r>n+As)throw new Te("Message timestamp too new");return new Date(r*1e3)}};Je.Webhook=en;en.prefix="whsec_"});import ws from"crypto";function Xe({body:e,secret:t}){let n=new bs.Webhook(t),r=`msg_${ws.randomUUID()}`,o=new Date,a=n.sign(r,o,e),i=Math.floor(o.getTime()/1e3);return{"webhook-id":r,"webhook-signature":a,"webhook-timestamp":String(i)}}function Br(){return`whsec_${ws.randomBytes(24).toString("base64")}`}var bs,Dr=f(()=>{"use strict";bs=Ro($r(),1)});import{parseSetCookie as qm}from"set-cookie-parser";import{z as oe}from"zod";async function Vr({baseUrl:e,project:t,webhookSecret:n,workflowSlug:r}){let o={apiUrl:void 0,cookies:[],data:{},executed:[]},a=t.stateGraph;if(a==null)return o;let i=(a.edges??[]).find(c=>c.workflowSlug===r);if(i?.sourceState==null)return o;let l=Rs({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),s=i.sourceState.preconditions;return s.length===0?{...o,apiUrl:l}:l==null?o:Ts({apiUrl:l,preconditionNames:s,webhookSecret:n})}async function Wr({apiUrl:e,cookies:t,data:n,executed:r,webhookSecret:o}){if(r.length!==0)try{let a=JSON.stringify({data:n,preconditions:r}),i=await fetch(`${e}/teardown`,{body:a,headers:{"Content-Type":"application/json",...Gm({cookies:t}),...Xe({body:a,secret:o})},method:"PUT",signal:AbortSignal.timeout(Ns)});i.ok||b.error("Teardown returned %s",String(i.status))}catch{b.error("Teardown request failed")}}async function Ts({apiUrl:e,preconditionNames:t,webhookSecret:n}){let r=performance.now(),o=JSON.stringify({preconditions:t}),a=await fetch(`${e}/execute-batch`,{body:o,headers:{"Content-Type":"application/json",...Xe({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(Ns)});if(!a.ok){let c=await Jm(a);throw new Error(`execute-batch returned ${String(a.status)}: ${c}`)}let i=await a.json(),l=Mm.safeParse(i);if(!l.success)throw new Error(`execute-batch response has invalid shape: ${l.error.message}`);if(!l.data.success){let c=l.data.error??"no error detail";throw new Error(`Precondition batch failed: ${c}`)}let s=Hm({domain:new URL(e).hostname,res:a});return b.info("Preconditions resolved: %s (%dms)",l.data.executed.join(", "),Math.round(performance.now()-r)),{apiUrl:e,cookies:s,data:l.data.data,executed:l.data.executed}}async function Jm(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=Xm(t),r=n==null?null:zm.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function Xm(e){try{return JSON.parse(e)}catch{return null}}function Gm({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Hm({domain:e,res:t}){let n=t.headers.getSetCookie();return qm(n,{decodeValues:!1}).map(o=>Km({cookie:o,domain:e}))}function Km({cookie:e,domain:t}){let n={domain:e.domain??t,httpOnly:e.httpOnly??!1,name:e.name,path:e.path??"/",secure:e.secure??!1,value:e.value};return e.sameSite!=null&&(n.sameSite=Qm({raw:e.sameSite})),e.expires!=null?n.expires=Math.floor(e.expires.getTime()/1e3):e.maxAge!=null&&(n.expires=Math.floor(Date.now()/1e3)+e.maxAge),n}function Qm({raw:e}){return Ym[e.toLowerCase()]??"Lax"}async function Fr({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Rs({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Ts({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Rs({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var Ns,Mm,zm,Ym,qr=f(()=>{"use strict";K();Dr();Ns=3e4,Mm=oe.object({data:oe.record(oe.string(),oe.record(oe.string(),oe.string())),error:oe.string().optional(),executed:oe.array(oe.string()),runId:oe.string(),success:oe.boolean()});zm=oe.object({error:oe.string()});Ym={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as Mr}from"gql.tada";async function zr({agentProfileId:e,config:t,runId:n}){let r=await F({config:t,document:ef,variables:{agentProfileId:e??null,platform:"chromium",runId:n}});if(r.startRun==null)throw new Error("Failed to start run");let o=r.startRun.id,a=[];function i(c){let p=Zm({config:t,runResultId:o,steps:[c]}).catch(u=>{b.error(u,"Failed to submit step %d",c.stepIndex)});a.push(p)}async function l(){await Promise.all(a)}async function s({statusOverride:c,steps:p,summary:u}){await X({label:`flushSteps (${String(a.length)} steps)`,fn:()=>Promise.all(a)});let d=p.filter(S=>S.status==="passed").length,m=p.filter(S=>S.status==="failed").length,h=p.reduce((S,A)=>S+A.duration,0),k=c??(m>0?"failed":"passed");await X({label:"completeRun",fn:()=>F({config:t,document:nf,variables:{duration:h,failCount:m,passCount:d,runResultId:o,status:k,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:i,flushSteps:l,runResultId:o}}async function Zm({config:e,runResultId:t,steps:n}){let r=n.map(o=>({annotations:o.annotations.map(a=>({height:a.height,label:a.label,type:a.type,width:a.width,x:a.x,y:a.y})),assertions:o.assertions.map(a=>({description:a.description,detail:a.detail,status:a.status})),detail:o.detail,duration:o.duration,nodeType:o.nodeType,screenshotBase64:o.screenshotBase64,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth}));await F({config:e,document:tf,variables:{runResultId:t,steps:r}})}var ef,tf,nf,Jr=f(()=>{"use strict";dt();K();qe();ef=Mr(`
99
99
  mutation StartRunCLI($runId: String!, $platform: String!, $agentProfileId: String) {
100
100
  startRun(runId: $runId, platform: $platform, agentProfileId: $agentProfileId) {
101
101
  id
102
102
  }
103
103
  }
104
- `),nf=qr(`
104
+ `),tf=Mr(`
105
105
  mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
106
106
  submitRunSteps(runResultId: $runResultId, steps: $steps)
107
107
  }
108
- `),rf=qr(`
108
+ `),nf=Mr(`
109
109
  mutation CompleteRunCLI(
110
110
  $runResultId: String!
111
111
  $status: String!
@@ -128,14 +128,14 @@ ${n}`].join(`
128
128
  status
129
129
  }
130
130
  }
131
- `)});import{z as of}from"zod";import{graphql as en,readFragment as zr}from"gql.tada";async function Xr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:a,preconditionNames:i,runId:l,webhookSecret:s,workflowId:c}){let p="unknown",u,d,m=!1;try{m=r==null,d=cf({externalBrowser:r,headed:a});let h=i==null?void 0:J({label:"Preconditions resolved",fn:()=>Vr({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:i,webhookSecret:s})}),[{project:k,workflow:S},A]=await Promise.all([J({label:"Run context resolved",fn:()=>ff({config:o,workflowId:c})}),J({label:"Streaming run started",fn:()=>Fr({agentProfileId:t,config:o,runId:l})}),mr({appUrl:n})]);p=S.name,u=A;let w=gf(S.spec);b.info("Executing workflow: %s",S.name),await kf(pf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:d,config:o,headed:a,ownsBrowser:m,preconditionPromise:h,project:k,runId:l,specData:w,streaming:u,webhookSecret:s,workflow:S}),Sf())}catch(h){throw await df({browserPromise:d,error:h,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),h}}function cf({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):J({label:"Browser launched",fn:()=>Ae({headed:t})})}async function df({browserPromise:e,error:t,ownsBrowser:n,runId:r,streaming:o,workflowName:a}){let i=t instanceof Error?t.message:String(t),l=t instanceof Error?t.stack:void 0;await Bi({error:i,runId:r,stack:l,workflowName:a}),o!=null&&await o.complete({statusOverride:"failed",steps:[],summary:i}).catch(()=>{}),n&&e!=null&&await(await e.catch(()=>{}))?.close()}async function pf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:a,ownsBrowser:i,preconditionPromise:l,project:s,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m}){let h=l??J({label:"Preconditions resolved",fn:()=>Br({baseUrl:n,project:s,webhookSecret:d,workflowSlug:m.slug})}),[k,S]=await Promise.all([h,r]);if(t!=null){i&&await S.close(),await uf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:a,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m});return}await mf({baseUrl:n,browser:S,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d})}async function uf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:a,runId:i,specData:l,streaming:s,webhookSecret:c,workflow:p}){let u=e!=null&&e.length>0?e:await yf({config:r,profileId:t});await rr({baseUrl:n,cookies:a.cookies,executedPreconditions:a.executed,extraVariables:a.data,headed:o,runId:i,serverUrl:r.ripploServerUrl,spec:l,streaming:s,systemPrompt:u,token:r.token,workflowContext:{description:p.name,expectedOutcome:p.name,name:p.name}}),await Ls({preconditionResult:a,webhookSecret:c})}async function mf({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:a,webhookSecret:i}){let l=await J({label:"Spec executed",fn:()=>Er({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:a.enqueueStep,runId:r,spec:o})});await Ls({preconditionResult:n,webhookSecret:i}),await a.complete({statusOverride:void 0,steps:l,summary:void 0});let s=l.filter(p=>p.status==="passed").length,c=l.filter(p=>p.status==="failed").length;b.info("Run complete: %d passed, %d failed",s,c)}async function Ls({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await Dr({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function ff({config:e,workflowId:t}){let n=await W({config:e,document:sf,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...zr(Rs,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},i=(o.workflows??[]).find(s=>zr(Jr,s).id===t);if(i==null)throw new Error(`Workflow ${t} not found`);let l=zr(Jr,i);return{project:o,workflow:l}}async function yf({config:e,profileId:t}){let n=await W({config:e,document:lf,variables:{id:t}});if(n.agentProfile==null)throw new Error(`Agent profile not found: ${t}`);let r=n.agentProfile,o=r.description;if(o==null||o.length===0)throw new Error(`Agent profile "${r.name}" has no description`);return b.info("Using agent profile: %s",r.name),Yn({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function gf(e){if(e==null)throw new Error("Workflow has no spec");return vr.decode(e)}function Sf(){return hf.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function kf(e,t){let n,r=new Promise((o,a)=>{n=setTimeout(()=>{a(new Error(`Run timed out after ${String(t)}ms`))},t)});try{await Promise.race([e,r])}finally{n!=null&&clearTimeout(n)}}var af,Jr,Rs,sf,lf,hf,Cs=f(()=>{"use strict";ds();Zn();or();lt();fr();dt();jt();Or();G();We();Wr();Mr();af=12e4,Jr=en(`
131
+ `)});import{z as rf}from"zod";import{graphql as tn,readFragment as Xr}from"gql.tada";async function Hr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:a,preconditionNames:i,runId:l,webhookSecret:s,workflowId:c}){let p="unknown",u,d,m=!1;try{m=r==null,d=lf({externalBrowser:r,headed:a});let h=i==null?void 0:X({label:"Preconditions resolved",fn:()=>Fr({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:i,webhookSecret:s})}),[{project:k,workflow:S},A]=await Promise.all([X({label:"Run context resolved",fn:()=>mf({config:o,workflowId:c})}),X({label:"Streaming run started",fn:()=>zr({agentProfileId:t,config:o,runId:l})}),yr({appUrl:n})]);p=S.name,u=A;let w=yf(S.spec);b.info("Executing workflow: %s",S.name),await Sf(df({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:d,config:o,headed:a,ownsBrowser:m,preconditionPromise:h,project:k,runId:l,specData:w,streaming:u,webhookSecret:s,workflow:S}),hf())}catch(h){throw await cf({browserPromise:d,error:h,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),h}}function lf({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):X({label:"Browser launched",fn:()=>we({headed:t})})}async function cf({browserPromise:e,error:t,ownsBrowser:n,runId:r,streaming:o,workflowName:a}){let i=t instanceof Error?t.message:String(t),l=t instanceof Error?t.stack:void 0;await Di({error:i,runId:r,stack:l,workflowName:a}),o!=null&&await o.complete({statusOverride:"failed",steps:[],summary:i}).catch(()=>{}),n&&e!=null&&await(await e.catch(()=>{}))?.close()}async function df({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:a,ownsBrowser:i,preconditionPromise:l,project:s,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m}){let h=l??X({label:"Preconditions resolved",fn:()=>Vr({baseUrl:n,project:s,webhookSecret:d,workflowSlug:m.slug})}),[k,S]=await Promise.all([h,r]);if(t!=null){i&&await S.close(),await pf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:a,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m});return}await uf({baseUrl:n,browser:S,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d})}async function pf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:a,runId:i,specData:l,streaming:s,webhookSecret:c,workflow:p}){let u=e!=null&&e.length>0?e:await ff({config:r,profileId:t});await ar({baseUrl:n,cookies:a.cookies,executedPreconditions:a.executed,extraVariables:a.data,headed:o,runId:i,serverUrl:r.ripploServerUrl,spec:l,streaming:s,systemPrompt:u,token:r.token,workflowContext:{description:p.name,expectedOutcome:p.name,name:p.name}}),await Cs({preconditionResult:a,webhookSecret:c})}async function uf({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:a,webhookSecret:i}){let l=await X({label:"Spec executed",fn:()=>Ur({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:a.enqueueStep,runId:r,spec:o})});await Cs({preconditionResult:n,webhookSecret:i}),await a.complete({statusOverride:void 0,steps:l,summary:void 0});let s=l.filter(p=>p.status==="passed").length,c=l.filter(p=>p.status==="failed").length;b.info("Run complete: %d passed, %d failed",s,c)}async function Cs({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await Wr({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function mf({config:e,workflowId:t}){let n=await F({config:e,document:af,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...Xr(Ls,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},i=(o.workflows??[]).find(s=>Xr(Gr,s).id===t);if(i==null)throw new Error(`Workflow ${t} not found`);let l=Xr(Gr,i);return{project:o,workflow:l}}async function ff({config:e,profileId:t}){let n=await F({config:e,document:sf,variables:{id:t}});if(n.agentProfile==null)throw new Error(`Agent profile not found: ${t}`);let r=n.agentProfile,o=r.description;if(o==null||o.length===0)throw new Error(`Agent profile "${r.name}" has no description`);return b.info("Using agent profile: %s",r.name),er({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function yf(e){if(e==null)throw new Error("Workflow has no spec");return Pr.decode(e)}function hf(){return gf.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Sf(e,t){let n,r=new Promise((o,a)=>{n=setTimeout(()=>{a(new Error(`Run timed out after ${String(t)}ms`))},t)});try{await Promise.race([e,r])}finally{n!=null&&clearTimeout(n)}}var of,Gr,Ls,af,sf,gf,vs=f(()=>{"use strict";ps();tr();ir();lt();gr();dt();$t();_r();K();qe();qr();Jr();of=12e4,Gr=tn(`
132
132
  fragment WorkflowRun on Workflow {
133
133
  id
134
134
  slug
135
135
  name
136
136
  spec
137
137
  }
138
- `),Rs=en(`
138
+ `),Ls=tn(`
139
139
  fragment ProjectRun on Project {
140
140
  id
141
141
  baseUrl
@@ -154,13 +154,13 @@ ${n}`].join(`
154
154
  ...WorkflowRun
155
155
  }
156
156
  }
157
- `,[Jr]),sf=en(`
157
+ `,[Gr]),af=tn(`
158
158
  query ProjectRun($projectId: String!) {
159
159
  project(id: $projectId) {
160
160
  ...ProjectRun
161
161
  }
162
162
  }
163
- `,[Rs]),lf=en(`
163
+ `,[Ls]),sf=tn(`
164
164
  query AgentProfileRun($id: String!) {
165
165
  agentProfile(id: $id) {
166
166
  id
@@ -170,7 +170,7 @@ ${n}`].join(`
170
170
  successCriteria
171
171
  }
172
172
  }
173
- `);hf=of.coerce.number().int().positive().catch(af)});var ue=f(()=>{"use strict";In();Qn();Zn();or();dr();lt();Xi();Qi();fr();dt();Yi();Cs();Or();Pr();Ve();G();We();Wr();$r();it();Mr();Se()});import{z as Ds}from"zod";function rn(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return St().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return St().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return St().RIPPLO_SERVER_URL;let r=iy[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function St(){return Vs??=sy.parse(process.env),Vs}var ry,oy,ay,iy,sy,Vs,on=f(()=>{"use strict";ry="https://ripplo.ai",oy="https://ripplo-dev.up.railway.app",ay="https://localhost:3001",iy={dev:oy,local:ay};sy=Ds.object({RIPPLO_SERVER_URL:Ds.string().min(1).default(ry)})});import Gs from"crypto";import Yr from"fs";import Hs from"path";import{watch as jy}from"chokidar";import{graphql as $y}from"gql.tada";async function Ks(e){return Wy(e)}function Zr({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let a=Hs.join(t,By),i=n,l="",s,c=!1,p=!1,u=jy(a,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(k,S)=>{if(S.endsWith(".ts")){if(c){p=!0;return}s!=null&&clearTimeout(s),s=setTimeout(()=>{m()},200)}}),u.on("error",k=>{let S=k instanceof Error?k.message:String(k);b.error("File watcher error: %s",S)});function d(){p=!1,s=setTimeout(()=>{m()},200)}async function m(){c=!0,p=!1;try{await h()}catch(k){let S=k instanceof Error?k.message:"Unknown error";b.error("Sync failed: %s",S),r(S)}finally{c=!1,p&&d()}}async function h(){let k=Vy(a);if(k===l)return;l=k;let S=await D(t);if(!S.ok){r(S.error);return}await he({cwd:t,result:S.result});let A=Ys(S.result),w=Zs(A);if(w===i)return;i=w;let x=await el({config:e,payload:A});b.info("Dev session synced (%d test(s))",S.result.tests.length),o({devSessionId:x.devSessionId,hash:x.hash})}return function(){s!=null&&clearTimeout(s),u.close()}}function Vy(e){let t=Gs.createHash("sha256");return Qs(t,e),t.digest("hex")}function Qs(e,t){if(!Yr.existsSync(t))return;Yr.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Hs.join(t,r.name);r.isDirectory()?Qs(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(Yr.readFileSync(o)))})}function Ys(e){return{graphSpec:JSON.stringify(e.graph),workflows:e.tests.map(t=>({description:t.description,expectedOutcome:t.expectedOutcome,name:t.name,slug:t.slug,spec:JSON.stringify(t.spec)}))}}function Zs(e){return Gs.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Wy(e){let t=await D(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Ys(t.result);return b.info("Synced %d test(s) + graph to dev session",t.result.tests.length),el({config:e.config,payload:n})}async function el({config:e,payload:t}){let n=Zs(t),r=await W({config:e,document:Dy,variables:{graphSpec:t.graphSpec,projectId:e.projectId,workflows:[...t.workflows]}});if(r.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:r.syncDevSession.id,hash:n}}function tl(e){return!1}function nl(e){return!1}var By,Dy,eo=f(()=>{"use strict";je();ue();pe();By=".ripplo",Dy=$y(`
173
+ `);gf=rf.coerce.number().int().positive().catch(of)});var fe=f(()=>{"use strict";$n();Zn();tr();ir();ur();lt();Gi();Qi();gr();dt();Zi();vs();_r();Or();Fe();K();qe();qr();Dr();it();Jr();ke()});import{z as Vs}from"zod";function on(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return St().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return St().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return St().RIPPLO_SERVER_URL;let r=ay[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function St(){return Ws??=iy.parse(process.env),Ws}var ny,ry,oy,ay,iy,Ws,an=f(()=>{"use strict";ny="https://ripplo.ai",ry="https://ripplo-dev.up.railway.app",oy="https://localhost:3001",ay={dev:ry,local:oy};iy=Vs.object({RIPPLO_SERVER_URL:Vs.string().min(1).default(ny)})});import Hs from"crypto";import eo from"fs";import Ks from"path";import{watch as Iy}from"chokidar";import{graphql as jy}from"gql.tada";async function Ys(e){return Vy(e)}function to({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let a=Ks.join(t,$y),i=n,l="",s,c=!1,p=!1,u=Iy(a,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(k,S)=>{if(S.endsWith(".ts")){if(c){p=!0;return}s!=null&&clearTimeout(s),s=setTimeout(()=>{m()},200)}}),u.on("error",k=>{let S=k instanceof Error?k.message:String(k);b.error("File watcher error: %s",S)});function d(){p=!1,s=setTimeout(()=>{m()},200)}async function m(){c=!0,p=!1;try{await h()}catch(k){let S=k instanceof Error?k.message:"Unknown error";b.error("Sync failed: %s",S),r(S)}finally{c=!1,p&&d()}}async function h(){let k=Dy(a);if(k===l)return;l=k;let S=await V(t);if(!S.ok){r(S.error);return}await Se({cwd:t,result:S.result});let A=Zs(S.result),w=el(A);if(w===i)return;i=w;let P=await tl({config:e,payload:A});b.info("Dev session synced (%d test(s))",S.result.tests.length),o({devSessionId:P.devSessionId,hash:P.hash})}return function(){s!=null&&clearTimeout(s),u.close()}}function Dy(e){let t=Hs.createHash("sha256");return Qs(t,e),t.digest("hex")}function Qs(e,t){if(!eo.existsSync(t))return;eo.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Ks.join(t,r.name);r.isDirectory()?Qs(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(eo.readFileSync(o)))})}function Zs(e){return{graphSpec:JSON.stringify(e.graph),workflows:e.tests.map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,slug:t.slug,spec:JSON.stringify(t.spec)}))}}function el(e){return Hs.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Vy(e){let t=await V(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Zs(t.result);return b.info("Synced %d test(s) + graph to dev session",t.result.tests.length),tl({config:e.config,payload:n})}async function tl({config:e,payload:t}){let n=el(t),r=await F({config:e,document:By,variables:{graphSpec:t.graphSpec,projectId:e.projectId,workflows:[...t.workflows]}});if(r.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:r.syncDevSession.id,hash:n}}function nl(e){return!1}function rl(e){return!1}var $y,By,no=f(()=>{"use strict";Be();fe();me();$y=".ripplo",By=jy(`
174
174
  mutation SyncDevSession(
175
175
  $projectId: String!
176
176
  $graphSpec: String!
@@ -180,7 +180,7 @@ ${n}`].join(`
180
180
  id
181
181
  }
182
182
  }
183
- `)});import{useCallback as qy,useEffect as ln,useRef as Fy,useState as My}from"react";import{availableParallelism as rl}from"os";import{useSubscription as to}from"urql";import{graphql as dn}from"gql.tada";async function ol(){await(await cn).closeAll()}function al({config:e,cwd:t,devSessionId:n}){let[r,o]=My({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:rl()}),a=e,i=Fy(new Set);ln(()=>{cn.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=qy(s=>{il({activeRunIds:i.current,baseUrl:a.appUrl,config:a,setState:o,...s})},[a]);return ln(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),to({pause:n==null,query:zy},(s,c)=>{let p=c.runRequested;return p!=null&&l({agentProfileDescription:p.agentProfileDescription??void 0,agentProfileId:p.agentProfileId??void 0,cwd:t,runId:p.runId,workflowId:p.workflowId,workflowSlug:p.workflowSlug}),c}),to({pause:n==null,query:Xy,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&tl({cwd:t,slug:p}),c}),to({pause:n==null,query:Gy,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&nl({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),ln(()=>{if(n==null)return;let s=new AbortController;return Ky({activeConfig:a,activeRunIds:i.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[a,n]),ln(()=>()=>{cn.then(s=>s.closeAll())},[]),r}function il({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,setState:l,workflowId:s,workflowSlug:c}){if(e.has(i))return;e.add(i),l(u=>({...u,activeRunCount:e.size}));function p(){e.delete(i),l(u=>({...u,activeRunCount:e.size}))}Qy({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,workflowId:s,workflowSlug:c}).finally(p)}async function Ky({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(a=>{let i=setTimeout(a,Hy);o.addEventListener("abort",()=>{clearTimeout(i),a()},{once:!0})}),o.aborted)return;try{(await W({config:e,document:Jy,variables:{devSessionId:n}})).pendingDevRuns?.filter(i=>!t.has(i.id)).forEach(i=>{let l=i.workflow?.id;l!=null&&il({activeRunIds:t,agentProfileDescription:i.agentProfile?.description??void 0,agentProfileId:i.agentProfile?.id??void 0,baseUrl:e.appUrl,config:e,cwd:void 0,runId:i.id,setState:r,workflowId:l,workflowSlug:void 0})})}catch(a){b.error(a,"Runner error")}}}async function Qy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:a,workflowId:i,workflowSlug:l}){let s=await cn,c=await s.acquire();try{await ur({maxRuns:100});let p=o!=null&&l!=null?await Yy({cwd:o,workflowSlug:l}):void 0;await Xr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:c,config:r,headed:!1,preconditionNames:p,runId:a,webhookSecret:r.webhookSecret,workflowId:i})}catch(p){b.error(p,"Runner error")}finally{s.release(c)}}async function Yy({cwd:e,workflowSlug:t}){let n=await D(e);if(!n.ok)return;let r=n.result.graph.edges.find(a=>a.workflow===t);if(r==null)return;let o=n.result.graph.states[r.from];if(o!=null)return o.preconditions}var zy,Jy,Xy,Gy,cn,Hy,no=f(()=>{"use strict";ue();pe();eo();zy=dn(`
183
+ `)});import{useCallback as Wy,useEffect as cn,useRef as Fy,useState as qy}from"react";import{availableParallelism as ol}from"os";import{useSubscription as ro}from"urql";import{graphql as pn}from"gql.tada";async function al(){await(await dn).closeAll()}function il({config:e,cwd:t,devSessionId:n}){let[r,o]=qy({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:ol()}),a=e,i=Fy(new Set);cn(()=>{dn.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=Wy(s=>{sl({activeRunIds:i.current,baseUrl:a.appUrl,config:a,setState:o,...s})},[a]);return cn(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),ro({pause:n==null,query:My},(s,c)=>{let p=c.runRequested;return p!=null&&l({agentProfileDescription:p.agentProfileDescription??void 0,agentProfileId:p.agentProfileId??void 0,cwd:t,runId:p.runId,workflowId:p.workflowId,workflowSlug:p.workflowSlug}),c}),ro({pause:n==null,query:Jy,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&nl({cwd:t,slug:p}),c}),ro({pause:n==null,query:Xy,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&rl({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),cn(()=>{if(n==null)return;let s=new AbortController;return Hy({activeConfig:a,activeRunIds:i.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[a,n]),cn(()=>()=>{dn.then(s=>s.closeAll())},[]),r}function sl({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,setState:l,workflowId:s,workflowSlug:c}){if(e.has(i))return;e.add(i),l(u=>({...u,activeRunCount:e.size}));function p(){e.delete(i),l(u=>({...u,activeRunCount:e.size}))}Ky({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,workflowId:s,workflowSlug:c}).finally(p)}async function Hy({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(a=>{let i=setTimeout(a,Gy);o.addEventListener("abort",()=>{clearTimeout(i),a()},{once:!0})}),o.aborted)return;try{(await F({config:e,document:zy,variables:{devSessionId:n}})).pendingDevRuns?.filter(i=>!t.has(i.id)).forEach(i=>{let l=i.workflow?.id;l!=null&&sl({activeRunIds:t,agentProfileDescription:i.agentProfile?.description??void 0,agentProfileId:i.agentProfile?.id??void 0,baseUrl:e.appUrl,config:e,cwd:void 0,runId:i.id,setState:r,workflowId:l,workflowSlug:void 0})})}catch(a){b.error(a,"Runner error")}}}async function Ky({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:a,workflowId:i,workflowSlug:l}){let s=await dn,c=await s.acquire();try{await fr({maxRuns:100});let p=o!=null&&l!=null?await Yy({cwd:o,workflowSlug:l}):void 0;await Hr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:c,config:r,headed:!1,preconditionNames:p,runId:a,webhookSecret:r.webhookSecret,workflowId:i})}catch(p){b.error(p,"Runner error")}finally{s.release(c)}}async function Yy({cwd:e,workflowSlug:t}){let n=await V(e);if(!n.ok)return;let r=n.result.graph.edges.find(a=>a.workflow===t);if(r==null)return;let o=n.result.graph.states[r.from];if(o!=null)return o.preconditions}var My,zy,Jy,Xy,dn,Gy,oo=f(()=>{"use strict";fe();me();no();My=pn(`
184
184
  subscription RunRequestedDashboard {
185
185
  runRequested {
186
186
  agentProfileDescription
@@ -191,7 +191,7 @@ ${n}`].join(`
191
191
  workflowSlug
192
192
  }
193
193
  }
194
- `),Jy=dn(`
194
+ `),zy=pn(`
195
195
  query PendingDevRunsDashboard($devSessionId: String!) {
196
196
  pendingDevRuns(devSessionId: $devSessionId) {
197
197
  id
@@ -204,14 +204,14 @@ ${n}`].join(`
204
204
  }
205
205
  }
206
206
  }
207
- `),Xy=dn(`
207
+ `),Jy=pn(`
208
208
  subscription DevWorkflowDeleteDashboard($projectId: String!) {
209
209
  devWorkflowDeleteRequested(projectId: $projectId) {
210
210
  projectId
211
211
  slug
212
212
  }
213
213
  }
214
- `),Gy=dn(`
214
+ `),Xy=pn(`
215
215
  subscription DevWorkflowDuplicateDashboard($projectId: String!) {
216
216
  devWorkflowDuplicateRequested(projectId: $projectId) {
217
217
  projectId
@@ -219,7 +219,7 @@ ${n}`].join(`
219
219
  newSlug
220
220
  }
221
221
  }
222
- `),cn=pr({headed:!1,size:rl()});Hy=5e3});import{initGraphQLTada as Zy}from"gql.tada";import{readFragment as xR}from"gql.tada";var sl,ll=f(()=>{"use strict";sl=Zy()});var ro,oo=f(()=>{"use strict";ro={__schema:{queryType:{name:"Query",kind:"OBJECT"},mutationType:{name:"Mutation",kind:"OBJECT"},subscriptionType:{name:"Subscription",kind:"OBJECT"},types:[{kind:"OBJECT",name:"AgentProfile",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"icon",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"output",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"sourceTemplateSlug",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"AgentTemplate",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"icon",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"output",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BankPaymentMethod",fields:[{name:"bankName",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"last4",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BillingSubscription",fields:[{name:"billingInterval",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"cancelAtPeriodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"periodStart",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"plan",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"seats",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BranchSnapshot",fields:[{name:"commitMessage",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"commitSha",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graphFileHash",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowHashes",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"CardPaymentMethod",fields:[{name:"brand",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"last4",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"CliToken",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"lastUsedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"revokedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenPrefix",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSession",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"expiresAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionEvent",fields:[{name:"active",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionSyncedEvent",fields:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevWorkflowDeleteRequestedEvent",fields:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevWorkflowDuplicateRequestedEvent",fields:[{name:"newSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sourceSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Edge",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sourceState",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[]},{name:"targetState",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[]},{name:"workflowName",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"GitHubInstallation",fields:[{name:"accountLogin",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"accountType",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"installationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"GithubRepository",fields:[{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"fullName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"installationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"url",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Invoice",fields:[{name:"date",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"hostedInvoiceUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"totalCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"LinkPaymentMethod",fields:[{name:"email",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Mutation",fields:[{name:"cancelAllPendingRuns",type:{kind:"SCALAR",name:"Any"},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"cancelRun",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"cloneAgentTemplate",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"templateSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"completeRun",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"summary",type:{kind:"SCALAR",name:"Any"}},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"baseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"cloudBaseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"installationId",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"provider",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"repoUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createRun",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"}},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"executor",type:{kind:"SCALAR",name:"Any"}},{name:"isTest",type:{kind:"SCALAR",name:"Any"}},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteDevWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"duplicateDevWorkflow",type:{kind:"SCALAR",name:"Any"},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"endDevSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"removeGitHubInstallation",type:{kind:"OBJECT",name:"GitHubInstallation",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"revokeCurrentCliToken",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"rotateWebhookSecret",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runAllWorkflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"}},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"executor",type:{kind:"SCALAR",name:"Any"}},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowIds",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"saveGitHubInstallation",type:{kind:"OBJECT",name:"GitHubInstallation",ofType:null},args:[{name:"input",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"setOverageCap",type:{kind:"SCALAR",name:"Any"},args:[{name:"capCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"startRun",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"submitRunResults",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"steps",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"submitRunSteps",type:{kind:"SCALAR",name:"Any"},args:[{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"steps",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"syncBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"syncDevSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[{name:"graphSpec",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"trackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"untrackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"output",type:{kind:"SCALAR",name:"Any"}},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"cloudBaseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"preconditionApiPath",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateUsername",type:{kind:"OBJECT",name:"User",ofType:null},args:[{name:"username",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"baseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"}},{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"expectedOutcome",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"status",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"Organization",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationLimitStatus",fields:[{name:"agentCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"agentLimitPerProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateAgent",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canInviteMember",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"planName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimitReached",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetExceeded",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationUsage",fields:[{name:"overageCapCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"overageSpentCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodStart",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OtherPaymentMethod",fields:[{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"UNION",name:"PaymentMethod",possibleTypes:[{kind:"OBJECT",name:"BankPaymentMethod"},{kind:"OBJECT",name:"CardPaymentMethod"},{kind:"OBJECT",name:"LinkPaymentMethod"},{kind:"OBJECT",name:"OtherPaymentMethod"}]},{kind:"OBJECT",name:"Plan",fields:[{name:"annualPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limits",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"PlanLimits",ofType:null}},args:[]},{name:"monthlyPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"PlanLimits",fields:[{name:"historyDays",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxAgents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxProjects",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxUsers",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runOverageCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"scheduling",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Project",fields:[{name:"agentProfiles",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}},args:[]},{name:"baseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"cloudBaseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"defaultBranch",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[]},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"organization",type:{kind:"OBJECT",name:"Organization",ofType:null},args:[]},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditionApiPath",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"provider",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"repoUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"webhookSecret",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"ProjectRunStatusEvent",fields:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"hasFailed",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Query",fields:[{name:"activeSubscription",type:{kind:"OBJECT",name:"BillingSubscription",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentProfiles",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentTemplates",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentTemplate",ofType:null}}},args:[]},{name:"availablePlans",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Plan",ofType:null}}},args:[]},{name:"currentUser",type:{kind:"OBJECT",name:"User",ofType:null},args:[]},{name:"defaultPaymentMethod",type:{kind:"UNION",name:"PaymentMethod",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"gitHubAppInstallUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"gitHubInstallations",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"GitHubInstallation",ofType:null}}},args:[]},{name:"githubRepositories",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"GithubRepository",ofType:null}}},args:[]},{name:"healthcheck",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"invoices",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Invoice",ofType:null}}},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"me",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"organizationLimitStatus",type:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"organizationUsage",type:{kind:"OBJECT",name:"OrganizationUsage",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"pendingDevRuns",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"devSessionId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"projectRuns",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"cursor",type:{kind:"SCALAR",name:"Any"}},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"take",type:{kind:"SCALAR",name:"Any"}}]},{name:"projects",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Project",ofType:null}}},args:[]},{name:"run",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runResult",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runs",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"take",type:{kind:"SCALAR",name:"Any"}},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateNode",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateNodes",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"StateNode",ofType:null}}},args:[{name:"graphId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"trackedBranches",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TrackedBranch",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]}],interfaces:[]},{kind:"OBJECT",name:"Run",fields:[{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[]},{name:"completedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"executor",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"failureReason",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isTest",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"results",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunResult",ofType:null}}},args:[]},{name:"startedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"totalRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"userId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[]}],interfaces:[]},{kind:"UNION",name:"RunProgressEvent",possibleTypes:[{kind:"OBJECT",name:"RunResultUpdated"},{kind:"OBJECT",name:"RunStatusChanged"},{kind:"OBJECT",name:"RunTraceEntryAdded"}]},{kind:"OBJECT",name:"RunRequestedEvent",fields:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"executor",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunResult",fields:[{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"duration",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"perfP50",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfP90",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfP99",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfTotal",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sideEffects",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"SideEffect",ofType:null}}}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"summary",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"traceEntries",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceEntry",ofType:null}}}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunResultUpdated",fields:[{name:"runResult",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunResult",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunStatusChanged",fields:[{name:"run",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunTraceEntryAdded",fields:[{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"traceEntry",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceEntry",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"ScreenAnnotation",fields:[{name:"height",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"label",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"width",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"x",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"y",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"SideEffect",fields:[{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"StateGraph",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"edges",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"localOnlyWorkflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"states",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"StateNode",ofType:null}}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"StateNode",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"incoming",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"outgoing",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"routePattern",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stableId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Subscription",fields:[{name:"devSessionChanged",type:{kind:"OBJECT",name:"DevSessionEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devSessionSynced",type:{kind:"OBJECT",name:"DevSessionSyncedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devWorkflowDeleteRequested",type:{kind:"OBJECT",name:"DevWorkflowDeleteRequestedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devWorkflowDuplicateRequested",type:{kind:"OBJECT",name:"DevWorkflowDuplicateRequestedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"projectRunStatusChanged",type:{kind:"OBJECT",name:"ProjectRunStatusEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runProgress",type:{kind:"UNION",name:"RunProgressEvent",ofType:null},args:[{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runRequested",type:{kind:"OBJECT",name:"RunRequestedEvent",ofType:null},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TraceAssertion",fields:[{name:"description",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TraceEntry",fields:[{name:"annotations",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"ScreenAnnotation",ofType:null}}}},args:[]},{name:"assertions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceAssertion",ofType:null}}}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"nodeType",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"pageUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"screenshotUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"statusCode",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"stepIndex",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"timestamp",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"title",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportHeight",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportWidth",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TrackedBranch",fields:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"headCommit",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"snapshots",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"BranchSnapshot",ofType:null}}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"syncedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"User",fields:[{name:"email",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"image",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"username",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Workflow",fields:[{name:"additionalChecks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"agentProfiles",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}}},args:[]},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"description",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"expectedOutcome",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"latestRuns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"runs",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"source",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"spec",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"SCALAR",name:"Any"}],directives:[]}}});function I(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function oe(e,t,n){e.invalidate({__typename:t,id:n})}function ao({cache:e,childId:t,childTypeName:n,fieldName:r,parentId:o,parentTypeName:a}){let i=e.keyOfEntity({__typename:a,id:o});if(i==null)return!1;let l=e.keyOfEntity({__typename:n,id:t});if(l==null)return!1;let s=e.resolve(i,r);if(!Array.isArray(s))return!1;let c=s.map(p=>typeof p=="string"?p:null);return c.includes(l)||e.link(i,r,void 0,[...c,l]),!0}function tg(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;ao({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||oe(e,"RunResult",r)}function ng(e,t){t.runId!=null&&e.writeFragment(cl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function rg(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null,r=e.status==="completed"||e.status==="failed";ng(t,e),r&&e.runId!=null&&oe(t,"Run",e.runId),n&&(I(t,"run"),I(t,"projectRuns")),e.workflowId!=null&&e.runId!=null&&ao({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function og(){return{cancelAllPendingRuns(e,t,n){I(n,"workflows"),I(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&oe(n,"Run",r)},cloneAgentTemplate(e,t,n){I(n,"agentProfiles")},createAgentProfile(e,t,n){I(n,"agentProfiles")},createRun(e,t,n){I(n,"run"),I(n,"runs"),I(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(cl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),ao({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&oe(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&oe(n,"Workflow",r),I(n,"workflows"),I(n,"stateGraph")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&oe(n,"Project",r),I(n,"projects")},duplicateDevWorkflow(e,t,n){I(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&oe(n,"DevSession",r)},runAllWorkflows(e,t,n){I(n,"runs"),I(n,"projectRuns")},setOverageCap(e,t,n){I(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&oe(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&oe(n,"User",r),I(n,"currentUser")}}}function io(){return{keys:eg,schema:ro,updates:{Mutation:og(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&oe(n,"Project",r.projectId),r?.active===!1&&(I(n,"stateGraph"),I(n,"workflows"),I(n,"workflow"),I(n,"runs"),I(n,"run"),I(n,"projectRuns"))},devSessionSynced(e,t,n){I(n,"stateGraph"),I(n,"workflow"),I(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&rg(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&tg(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&oe(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&oe(n,"Run",r.run.id)}}}}}var eg,cl,dl=f(()=>{"use strict";ll();oo();eg={AgentProfile:e=>e.id??null,AgentTemplate:e=>e.id??null,BankPaymentMethod:()=>null,BillingSubscription:e=>e.id??null,BranchSnapshot:e=>e.id??null,CardPaymentMethod:()=>null,CliToken:e=>e.id??null,DevSession:e=>e.id??null,DevSessionEvent:()=>null,DevSessionSyncedEvent:()=>null,DevWorkflowDeleteRequestedEvent:()=>null,DevWorkflowDuplicateRequestedEvent:()=>null,Edge:e=>e.id??null,GitHubInstallation:e=>e.id??null,GithubRepository:()=>null,Invoice:e=>e.id??null,LinkPaymentMethod:()=>null,Organization:e=>e.id??null,OrganizationLimitStatus:()=>null,OrganizationUsage:()=>null,OtherPaymentMethod:()=>null,Plan:()=>null,PlanLimits:()=>null,Project:e=>e.id??null,ProjectRunStatusEvent:()=>null,Run:e=>e.id??null,RunRequestedEvent:()=>null,RunResult:e=>e.id??null,RunResultUpdated:()=>null,RunStatusChanged:()=>null,RunTraceEntryAdded:()=>null,ScreenAnnotation:e=>e.id??null,SideEffect:e=>e.id??null,StateGraph:e=>e.id??null,StateNode:e=>e.id??null,TraceAssertion:e=>e.id??null,TraceEntry:e=>e.id??null,TrackedBranch:e=>e.id??null,User:e=>e.id??null,Workflow:e=>e.id??null};cl=sl(`
222
+ `),dn=mr({headed:!1,size:ol()});Gy=5e3});import{initGraphQLTada as Qy}from"gql.tada";import{readFragment as jR}from"gql.tada";var ll,cl=f(()=>{"use strict";ll=Qy()});var ao,io=f(()=>{"use strict";ao={__schema:{queryType:{name:"Query",kind:"OBJECT"},mutationType:{name:"Mutation",kind:"OBJECT"},subscriptionType:{name:"Subscription",kind:"OBJECT"},types:[{kind:"OBJECT",name:"AgentProfile",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"icon",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"output",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"sourceTemplateSlug",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"AgentTemplate",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"icon",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"output",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BankPaymentMethod",fields:[{name:"bankName",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"last4",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BillingSubscription",fields:[{name:"billingInterval",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"cancelAtPeriodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"periodStart",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"plan",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"seats",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"BranchSnapshot",fields:[{name:"commitMessage",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"commitSha",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graphFileHash",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowHashes",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"CardPaymentMethod",fields:[{name:"brand",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"last4",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"CliToken",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"lastUsedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"revokedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenPrefix",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSession",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"expiresAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionEvent",fields:[{name:"active",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionSyncedEvent",fields:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevWorkflowDeleteRequestedEvent",fields:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevWorkflowDuplicateRequestedEvent",fields:[{name:"newSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sourceSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Edge",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sourceState",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[]},{name:"targetState",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[]},{name:"workflowName",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"GitHubInstallation",fields:[{name:"accountLogin",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"accountType",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"installationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"GithubRepository",fields:[{name:"description",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"fullName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"installationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"url",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Invoice",fields:[{name:"date",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"hostedInvoiceUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"totalCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"LinkPaymentMethod",fields:[{name:"email",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Mutation",fields:[{name:"cancelAllPendingRuns",type:{kind:"SCALAR",name:"Any"},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"cancelRun",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"cloneAgentTemplate",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"templateSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"completeRun",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"summary",type:{kind:"SCALAR",name:"Any"}},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"baseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"cloudBaseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"installationId",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"provider",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"repoUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"createRun",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"}},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"executor",type:{kind:"SCALAR",name:"Any"}},{name:"isTest",type:{kind:"SCALAR",name:"Any"}},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteDevWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"deleteProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"duplicateDevWorkflow",type:{kind:"SCALAR",name:"Any"},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"endDevSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"removeGitHubInstallation",type:{kind:"OBJECT",name:"GitHubInstallation",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"revokeCurrentCliToken",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"rotateWebhookSecret",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runAllWorkflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"}},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"executor",type:{kind:"SCALAR",name:"Any"}},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowIds",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"saveGitHubInstallation",type:{kind:"OBJECT",name:"GitHubInstallation",ofType:null},args:[{name:"input",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"setOverageCap",type:{kind:"SCALAR",name:"Any"},args:[{name:"capCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"startRun",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"submitRunResults",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"}},{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"steps",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"submitRunSteps",type:{kind:"SCALAR",name:"Any"},args:[{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"steps",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"syncBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"syncDevSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[{name:"graphSpec",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"trackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"untrackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"output",type:{kind:"SCALAR",name:"Any"}},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"cloudBaseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"preconditionApiPath",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateUsername",type:{kind:"OBJECT",name:"User",ofType:null},args:[{name:"username",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"baseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"}},{name:"expectedOutcome",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"status",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"Organization",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationLimitStatus",fields:[{name:"agentCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"agentLimitPerProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateAgent",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canInviteMember",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"planName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimitReached",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetExceeded",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationUsage",fields:[{name:"overageCapCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"overageSpentCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodStart",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OtherPaymentMethod",fields:[{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"UNION",name:"PaymentMethod",possibleTypes:[{kind:"OBJECT",name:"BankPaymentMethod"},{kind:"OBJECT",name:"CardPaymentMethod"},{kind:"OBJECT",name:"LinkPaymentMethod"},{kind:"OBJECT",name:"OtherPaymentMethod"}]},{kind:"OBJECT",name:"Plan",fields:[{name:"annualPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limits",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"PlanLimits",ofType:null}},args:[]},{name:"monthlyPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"PlanLimits",fields:[{name:"historyDays",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxAgents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxProjects",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxUsers",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runOverageCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"scheduling",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Project",fields:[{name:"agentProfiles",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}},args:[]},{name:"baseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"cloudBaseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"defaultBranch",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[]},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"organization",type:{kind:"OBJECT",name:"Organization",ofType:null},args:[]},{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditionApiPath",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"provider",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"repoUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"webhookSecret",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"ProjectRunStatusEvent",fields:[{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"hasFailed",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Query",fields:[{name:"activeSubscription",type:{kind:"OBJECT",name:"BillingSubscription",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentProfiles",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"agentTemplates",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentTemplate",ofType:null}}},args:[]},{name:"availablePlans",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Plan",ofType:null}}},args:[]},{name:"currentUser",type:{kind:"OBJECT",name:"User",ofType:null},args:[]},{name:"defaultPaymentMethod",type:{kind:"UNION",name:"PaymentMethod",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"gitHubAppInstallUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"gitHubInstallations",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"GitHubInstallation",ofType:null}}},args:[]},{name:"githubRepositories",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"GithubRepository",ofType:null}}},args:[]},{name:"healthcheck",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"invoices",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Invoice",ofType:null}}},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"me",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"organizationLimitStatus",type:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"organizationUsage",type:{kind:"OBJECT",name:"OrganizationUsage",ofType:null},args:[{name:"organizationId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"pendingDevRuns",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"devSessionId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"projectRuns",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"cursor",type:{kind:"SCALAR",name:"Any"}},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"take",type:{kind:"SCALAR",name:"Any"}}]},{name:"projects",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Project",ofType:null}}},args:[]},{name:"run",type:{kind:"OBJECT",name:"Run",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runResult",type:{kind:"OBJECT",name:"RunResult",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runs",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}},args:[{name:"take",type:{kind:"SCALAR",name:"Any"}},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateNode",type:{kind:"OBJECT",name:"StateNode",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"stateNodes",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"StateNode",ofType:null}}},args:[{name:"graphId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"trackedBranches",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TrackedBranch",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]}],interfaces:[]},{kind:"OBJECT",name:"Run",fields:[{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[]},{name:"completedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"concurrency",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"executor",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"failureReason",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isTest",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"platforms",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"results",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunResult",ofType:null}}},args:[]},{name:"startedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"totalRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"userId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[]}],interfaces:[]},{kind:"UNION",name:"RunProgressEvent",possibleTypes:[{kind:"OBJECT",name:"RunResultUpdated"},{kind:"OBJECT",name:"RunStatusChanged"},{kind:"OBJECT",name:"RunTraceEntryAdded"}]},{kind:"OBJECT",name:"RunRequestedEvent",fields:[{name:"agentProfileDescription",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"agentProfileId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"executor",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflowSlug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunResult",fields:[{name:"agentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"duration",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"failCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"passCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"perfP50",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfP90",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfP99",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"perfTotal",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"platform",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"sideEffects",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"SideEffect",ofType:null}}}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"summary",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"traceEntries",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceEntry",ofType:null}}}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"warnCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunResultUpdated",fields:[{name:"runResult",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunResult",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunStatusChanged",fields:[{name:"run",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunTraceEntryAdded",fields:[{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"traceEntry",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceEntry",ofType:null}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"ScreenAnnotation",fields:[{name:"height",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"label",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"width",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"x",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"y",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"SideEffect",fields:[{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"StateGraph",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"edges",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"localOnlyWorkflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"states",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"StateNode",ofType:null}}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"StateNode",fields:[{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"graph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"incoming",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"outgoing",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Edge",ofType:null}}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"routePattern",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"stableId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Subscription",fields:[{name:"devSessionChanged",type:{kind:"OBJECT",name:"DevSessionEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devSessionSynced",type:{kind:"OBJECT",name:"DevSessionSyncedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devWorkflowDeleteRequested",type:{kind:"OBJECT",name:"DevWorkflowDeleteRequestedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"devWorkflowDuplicateRequested",type:{kind:"OBJECT",name:"DevWorkflowDuplicateRequestedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"projectRunStatusChanged",type:{kind:"OBJECT",name:"ProjectRunStatusEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runProgress",type:{kind:"UNION",name:"RunProgressEvent",ofType:null},args:[{name:"runId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"runRequested",type:{kind:"OBJECT",name:"RunRequestedEvent",ofType:null},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TraceAssertion",fields:[{name:"description",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TraceEntry",fields:[{name:"annotations",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"ScreenAnnotation",ofType:null}}}},args:[]},{name:"assertions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"TraceAssertion",ofType:null}}}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"detail",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"duration",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"nodeType",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"pageUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"screenshotUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"statusCode",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"stepIndex",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"timestamp",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"title",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportHeight",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportWidth",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TrackedBranch",fields:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"headCommit",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"snapshots",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"BranchSnapshot",ofType:null}}},args:[]},{name:"stateGraph",type:{kind:"OBJECT",name:"StateGraph",ofType:null},args:[]},{name:"syncedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"User",fields:[{name:"email",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"image",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"username",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Workflow",fields:[{name:"additionalChecks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"agentProfiles",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}}},args:[]},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"expectedOutcome",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"latestRuns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"runs",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"source",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"spec",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"SCALAR",name:"Any"}],directives:[]}}});function j(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function ae(e,t,n){e.invalidate({__typename:t,id:n})}function so({cache:e,childId:t,childTypeName:n,fieldName:r,parentId:o,parentTypeName:a}){let i=e.keyOfEntity({__typename:a,id:o});if(i==null)return!1;let l=e.keyOfEntity({__typename:n,id:t});if(l==null)return!1;let s=e.resolve(i,r);if(!Array.isArray(s))return!1;let c=s.map(p=>typeof p=="string"?p:null);return c.includes(l)||e.link(i,r,void 0,[...c,l]),!0}function eg(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;so({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ae(e,"RunResult",r)}function tg(e,t){t.runId!=null&&e.writeFragment(dl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function ng(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null,r=e.status==="completed"||e.status==="failed";tg(t,e),r&&e.runId!=null&&ae(t,"Run",e.runId),n&&(j(t,"run"),j(t,"projectRuns")),e.workflowId!=null&&e.runId!=null&&so({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function rg(){return{cancelAllPendingRuns(e,t,n){j(n,"workflows"),j(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&ae(n,"Run",r)},cloneAgentTemplate(e,t,n){j(n,"agentProfiles")},createAgentProfile(e,t,n){j(n,"agentProfiles")},createRun(e,t,n){j(n,"run"),j(n,"runs"),j(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(dl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),so({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&ae(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&ae(n,"Workflow",r),j(n,"workflows"),j(n,"stateGraph")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ae(n,"Project",r),j(n,"projects")},duplicateDevWorkflow(e,t,n){j(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ae(n,"DevSession",r)},runAllWorkflows(e,t,n){j(n,"runs"),j(n,"projectRuns")},setOverageCap(e,t,n){j(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&ae(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ae(n,"User",r),j(n,"currentUser")}}}function lo(){return{keys:Zy,schema:ao,updates:{Mutation:rg(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ae(n,"Project",r.projectId),r?.active===!1&&(j(n,"stateGraph"),j(n,"workflows"),j(n,"workflow"),j(n,"runs"),j(n,"run"),j(n,"projectRuns"))},devSessionSynced(e,t,n){j(n,"stateGraph"),j(n,"workflow"),j(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&ng(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&eg(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&ae(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&ae(n,"Run",r.run.id)}}}}}var Zy,dl,pl=f(()=>{"use strict";cl();io();Zy={AgentProfile:e=>e.id??null,AgentTemplate:e=>e.id??null,BankPaymentMethod:()=>null,BillingSubscription:e=>e.id??null,BranchSnapshot:e=>e.id??null,CardPaymentMethod:()=>null,CliToken:e=>e.id??null,DevSession:e=>e.id??null,DevSessionEvent:()=>null,DevSessionSyncedEvent:()=>null,DevWorkflowDeleteRequestedEvent:()=>null,DevWorkflowDuplicateRequestedEvent:()=>null,Edge:e=>e.id??null,GitHubInstallation:e=>e.id??null,GithubRepository:()=>null,Invoice:e=>e.id??null,LinkPaymentMethod:()=>null,Organization:e=>e.id??null,OrganizationLimitStatus:()=>null,OrganizationUsage:()=>null,OtherPaymentMethod:()=>null,Plan:()=>null,PlanLimits:()=>null,Project:e=>e.id??null,ProjectRunStatusEvent:()=>null,Run:e=>e.id??null,RunRequestedEvent:()=>null,RunResult:e=>e.id??null,RunResultUpdated:()=>null,RunStatusChanged:()=>null,RunTraceEntryAdded:()=>null,ScreenAnnotation:e=>e.id??null,SideEffect:e=>e.id??null,StateGraph:e=>e.id??null,StateNode:e=>e.id??null,TraceAssertion:e=>e.id??null,TraceEntry:e=>e.id??null,TrackedBranch:e=>e.id??null,User:e=>e.id??null,Workflow:e=>e.id??null};dl=ll(`
223
223
  fragment RunCache on Run {
224
224
  id
225
225
  status
@@ -229,7 +229,7 @@ ${n}`].join(`
229
229
  id
230
230
  }
231
231
  }
232
- `)});var pl=f(()=>{"use strict";dl();oo()});import{Client as ag,fetchExchange as ig,subscriptionExchange as sg}from"urql";import{cacheExchange as lg}from"@urql/exchange-graphcache";import{createClient as cg}from"graphql-sse";function so({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=cg({headers:n,retryAttempts:1/0,url:t});return new ag({exchanges:[lg(io()),sg({forwardSubscription:o=>({subscribe:a=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},a)}})}),ig],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var ul=f(()=>{"use strict";pl()});import{Box as ml,Text as j,useInput as dg}from"ink";import{jsx as z,jsxs as me}from"react/jsx-runtime";function lo({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return dg((o,a)=>{a.return&&!n&&r()}),t!=null?me(ml,{flexDirection:"column",gap:1,children:[me(j,{children:[z(j,{color:"red",children:" \u2717 "}),z(j,{children:t})]}),me(j,{children:[z(j,{color:"cyan",children:" \u2192 "}),z(j,{children:"Press "}),z(j,{bold:!0,children:"Enter"}),z(j,{children:" to try again"})]})]}):e!=null?me(ml,{flexDirection:"column",gap:1,paddingLeft:2,children:[me(j,{children:[z(j,{color:"yellow",children:"* "}),z(j,{children:"Your code: "}),z(j,{bold:!0,color:"white",children:e.userCode})]}),me(j,{children:[z(j,{color:"yellow",children:"* "}),z(j,{children:"Waiting for browser authorization..."})]}),me(j,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?me(j,{children:[z(j,{color:"yellow",children:" * "}),z(j,{children:"Opening browser..."})]}):me(j,{children:[z(j,{color:"cyan",children:" \u2192 "}),z(j,{children:"Press "}),z(j,{bold:!0,children:"Enter"}),z(j,{children:" to open browser for authentication"})]})}var fl=f(()=>{"use strict"});import{useState as pg}from"react";import{Box as ug,Text as pn,useInput as mg}from"ink";import{jsx as un,jsxs as fg}from"react/jsx-runtime";function yl({items:e,onSelect:t}){let[n,r]=pg(0);return mg((o,a)=>{if(a.upArrow&&r(i=>Math.max(0,i-1)),a.downArrow&&r(i=>Math.min(e.length-1,i+1)),a.return){let i=e[n];i!=null&&t(i.value)}}),un(ug,{flexDirection:"column",children:e.map((o,a)=>fg(pn,{children:[a===n?un(pn,{color:"cyan",children:"> "}):un(pn,{children:" "}),un(pn,{bold:a===n,children:o.label})]},o.value))})}var gl=f(()=>{"use strict"});import{Box as yg,Text as Te,useInput as gg}from"ink";import{jsx as Xe,jsxs as co}from"react/jsx-runtime";function hl({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return gg((r,o)=>{o.return&&e()}),co(yg,{flexDirection:"column",children:[co(Te,{children:[Xe(Te,{color:"cyan",children:" \u2192 "}),Xe(Te,{children:"No projects found. Create one at: "}),Xe(Te,{bold:!0,color:"cyan",children:n})]}),co(Te,{children:[" ",Xe(Te,{dimColor:!0,children:"Press "}),Xe(Te,{bold:!0,children:"Enter"}),Xe(Te,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var Sl=f(()=>{"use strict"});import{useEffect as hg,useMemo as Sg,useRef as kg}from"react";import{Box as kl,Text as ve}from"ink";import{useQuery as Ag}from"urql";import{graphql as wg}from"gql.tada";import{jsx as xe,jsxs as mn}from"react/jsx-runtime";function Al({selectProject:e,serverUrl:t}){let[n,r]=Ag({query:bg}),o=kg(!1),a=Sg(()=>n.data?.projects??[],[n.data?.projects]);if(hg(()=>{let s=a[0];a.length===1&&s!=null&&(s.workflows?.length??0)===0&&!o.current&&(o.current=!0,e({id:s.id,name:s.name}))},[a,e]),n.fetching)return mn(ve,{children:[xe(ve,{color:"yellow",children:" * "}),xe(ve,{children:"Loading projects..."})]});if(n.error!=null)return mn(ve,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(a.length===0)return xe(hl,{reexecute:r,serverUrl:t});let i=a.map(s=>({label:s.name,value:s.id}));function l(s){let c=a.find(p=>p.id===s);c!=null&&e({id:c.id,name:c.name})}return mn(kl,{flexDirection:"column",children:[mn(ve,{children:[xe(ve,{color:"cyan",children:" \u2192 "}),xe(ve,{children:"Select a project:"})]}),xe(kl,{marginLeft:4,marginTop:1,children:xe(yl,{items:i,onSelect:l})})]})}var bg,wl=f(()=>{"use strict";gl();Sl();bg=wg(`
232
+ `)});var ul=f(()=>{"use strict";pl();io()});import{Client as og,fetchExchange as ag,subscriptionExchange as ig}from"urql";import{cacheExchange as sg}from"@urql/exchange-graphcache";import{createClient as lg}from"graphql-sse";function co({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=lg({headers:n,retryAttempts:1/0,url:t});return new og({exchanges:[sg(lo()),ig({forwardSubscription:o=>({subscribe:a=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},a)}})}),ag],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var ml=f(()=>{"use strict";ul()});import{Box as fl,Text as B,useInput as cg}from"ink";import{jsx as J,jsxs as ye}from"react/jsx-runtime";function po({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return cg((o,a)=>{a.return&&!n&&r()}),t!=null?ye(fl,{flexDirection:"column",gap:1,children:[ye(B,{children:[J(B,{color:"red",children:" \u2717 "}),J(B,{children:t})]}),ye(B,{children:[J(B,{color:"cyan",children:" \u2192 "}),J(B,{children:"Press "}),J(B,{bold:!0,children:"Enter"}),J(B,{children:" to try again"})]})]}):e!=null?ye(fl,{flexDirection:"column",gap:1,paddingLeft:2,children:[ye(B,{children:[J(B,{color:"yellow",children:"* "}),J(B,{children:"Your code: "}),J(B,{bold:!0,color:"white",children:e.userCode})]}),ye(B,{children:[J(B,{color:"yellow",children:"* "}),J(B,{children:"Waiting for browser authorization..."})]}),ye(B,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?ye(B,{children:[J(B,{color:"yellow",children:" * "}),J(B,{children:"Opening browser..."})]}):ye(B,{children:[J(B,{color:"cyan",children:" \u2192 "}),J(B,{children:"Press "}),J(B,{bold:!0,children:"Enter"}),J(B,{children:" to open browser for authentication"})]})}var yl=f(()=>{"use strict"});import{useState as dg}from"react";import{Box as pg,Text as un,useInput as ug}from"ink";import{jsx as mn,jsxs as mg}from"react/jsx-runtime";function gl({items:e,onSelect:t}){let[n,r]=dg(0);return ug((o,a)=>{if(a.upArrow&&r(i=>Math.max(0,i-1)),a.downArrow&&r(i=>Math.min(e.length-1,i+1)),a.return){let i=e[n];i!=null&&t(i.value)}}),mn(pg,{flexDirection:"column",children:e.map((o,a)=>mg(un,{children:[a===n?mn(un,{color:"cyan",children:"> "}):mn(un,{children:" "}),mn(un,{bold:a===n,children:o.label})]},o.value))})}var hl=f(()=>{"use strict"});import{Box as fg,Text as Re,useInput as yg}from"ink";import{jsx as He,jsxs as uo}from"react/jsx-runtime";function Sl({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return yg((r,o)=>{o.return&&e()}),uo(fg,{flexDirection:"column",children:[uo(Re,{children:[He(Re,{color:"cyan",children:" \u2192 "}),He(Re,{children:"No projects found. Create one at: "}),He(Re,{bold:!0,color:"cyan",children:n})]}),uo(Re,{children:[" ",He(Re,{dimColor:!0,children:"Press "}),He(Re,{bold:!0,children:"Enter"}),He(Re,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var kl=f(()=>{"use strict"});import{useEffect as gg,useMemo as hg,useRef as Sg}from"react";import{Box as Al,Text as Ee}from"ink";import{useQuery as kg}from"urql";import{graphql as Ag}from"gql.tada";import{jsx as Oe,jsxs as fn}from"react/jsx-runtime";function wl({selectProject:e,serverUrl:t}){let[n,r]=kg({query:wg}),o=Sg(!1),a=hg(()=>n.data?.projects??[],[n.data?.projects]);if(gg(()=>{let s=a[0];a.length===1&&s!=null&&(s.workflows?.length??0)===0&&!o.current&&(o.current=!0,e({id:s.id,name:s.name}))},[a,e]),n.fetching)return fn(Ee,{children:[Oe(Ee,{color:"yellow",children:" * "}),Oe(Ee,{children:"Loading projects..."})]});if(n.error!=null)return fn(Ee,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(a.length===0)return Oe(Sl,{reexecute:r,serverUrl:t});let i=a.map(s=>({label:s.name,value:s.id}));function l(s){let c=a.find(p=>p.id===s);c!=null&&e({id:c.id,name:c.name})}return fn(Al,{flexDirection:"column",children:[fn(Ee,{children:[Oe(Ee,{color:"cyan",children:" \u2192 "}),Oe(Ee,{children:"Select a project:"})]}),Oe(Al,{marginLeft:4,marginTop:1,children:Oe(gl,{items:i,onSelect:l})})]})}var wg,bl=f(()=>{"use strict";hl();kl();wg=Ag(`
233
233
  query SetupProjectSelect {
234
234
  projects {
235
235
  id
@@ -239,10 +239,11 @@ ${n}`].join(`
239
239
  }
240
240
  }
241
241
  }
242
- `)});import{Box as bl,Text as fe}from"ink";import Ng from"ink-spinner";import{jsx as Ge,jsxs as Pe}from"react/jsx-runtime";function po({config:e,error:t,scaffoldingStep:n,selectProject:r,stage:o}){return Pe(bl,{flexDirection:"column",padding:1,children:[Pe(fe,{bold:!0,children:[" ","ripplo setup"]}),Ge(fe,{children:""}),Pe(fe,{children:[Ge(fe,{color:"green",children:" \u2713 "}),Ge(fe,{children:"Authenticated"})]}),o==="scaffolding"?Pe(fe,{children:[Pe(fe,{color:"cyan",children:[" ",Ge(Ng,{type:"dots"})]}),Pe(fe,{children:[" ",n??"Setting up local environment..."]})]}):Ge(Al,{selectProject:r,serverUrl:e.ripploServerUrl}),t==null?null:Ge(bl,{marginTop:1,children:Pe(fe,{color:"red",children:[" ","Error: ",t]})})]})}var Nl=f(()=>{"use strict";wl()});import{useEffect as Tg,useState as Rg}from"react";function He(){let[e,t]=Rg(Tl);return Tg(()=>{function n(){t(Tl())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Tl(){return{height:process.stdout.rows,width:process.stdout.columns}}var fn=f(()=>{"use strict"});import{useEffect as Lg,useRef as Cg,useState as vg}from"react";function Rl({config:e,cwd:t}){let[n,r]=vg({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=Cg(void 0);return Lg(()=>{function a({devSessionId:l}){r(s=>({...s,devSessionId:l,syncError:void 0,syncing:!1}))}function i(l){r(s=>({...s,syncError:l,syncing:!1}))}return Ks({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=Zr({config:e,cwd:t,lastHash:s,onSyncError:i,onSyncSuccess:a})}).catch(l=>{let s=l instanceof Error?l.message:String(l);i(s),o.current=Zr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var Ll=f(()=>{"use strict";eo()});import kL from"chalk";import{z as Cl}from"zod";async function vl(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${xg}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return Pg.parse(r).version}catch{return}finally{clearTimeout(t)}}var uo,xg,Pg,xl=f(()=>{"use strict";ue();uo="0.1.8",xg="ripplo",Pg=Cl.object({version:Cl.string()})});import{useEffect as Eg,useState as Og}from"react";import{Text as Ee}from"ink";import{jsx as Ke,jsxs as jg}from"react/jsx-runtime";function Pl({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=Ig(),l=i!=null&&i!==uo,s=Ug({connected:n,syncError:o}),c=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${uo}`,d=l?` \u2192 v${i}`:"",m="q to quit",h=` ripplo ${u}${d} | ${r} ${s}${c}${p}`,k=Math.max(0,a-h.length-m.length-1);return jg(Ee,{inverse:!0,children:[Ke(Ee,{bold:!0,children:" ripplo "}),Ke(Ee,{dimColor:!0,children:u}),l?Ke(Ee,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,Ke(Ee,{color:_g({connected:n,syncError:o}),children:s}),t?null:Ke(Ee,{color:"yellow",children:c}),p," ".repeat(k),Ke(Ee,{dimColor:!0,children:m})," "]})}function Ug({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function _g({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function Ig(){let[e,t]=Og();return Eg(()=>{vl().then(n=>{n!=null&&t(n)})},[]),e}var El=f(()=>{"use strict";xl()});import{Box as yn,Text as At,useApp as $g,useInput as Bg}from"ink";import{jsx as Qe,jsxs as gn}from"react/jsx-runtime";function Ol({config:e,cwd:t}){let n=$g(),{height:r,width:o}=He(),{config:a,devSessionId:i,syncError:l}=Rl({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=al({config:a,cwd:t,devSessionId:i});Bg(d=>{d==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return gn(yn,{flexDirection:"column",height:r,width:o,children:[Qe(Pl,{activeRunCount:s,browsersReady:c,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),gn(yn,{flexDirection:"column",flexGrow:1,padding:1,children:[gn(yn,{children:[Qe(At,{children:"Developer dashboard: "}),Qe(At,{color:"cyan",children:u})]}),gn(yn,{marginTop:1,children:[Qe(At,{dimColor:!0,children:"Run "}),Qe(At,{color:"yellow",children:"ripplo doctor"}),Qe(At,{dimColor:!0,children:" for health checks"})]})]})]})}var Ul=f(()=>{"use strict";fn();Ll();no();El()});import{Text as _l}from"ink";import Dg from"ink-spinner";import{jsx as Il,jsxs as Wg}from"react/jsx-runtime";function jl({loading:e}){return e?Wg(_l,{color:Vg,children:[Il(Dg,{type:"dots"})," Starting..."]}):Il(_l,{children:""})}var Vg,$l=f(()=>{"use strict";Vg="#24CFFF"});import{useEffect as qg,useState as wt}from"react";import{Box as Oe,Text as mo,useInput as Fg}from"ink";import{jsx as Re,jsxs as fo}from"react/jsx-runtime";function Dl({onDismiss:e}){let{height:t,width:n}=He(),[r,o]=wt(0),[a,i]=wt(!1),[l,s]=wt(!1),[c,p]=wt(!1),[u,d]=wt(!1);Fg(()=>{u&&e()}),qg(()=>{let k=80+hn.length*70+80,S=[...hn.map((A,w)=>setTimeout(()=>{o(w+1)},80+w*70)),setTimeout(()=>{i(!0)},k),setTimeout(()=>{s(!0)},k+200),setTimeout(()=>{p(!0)},k+400),setTimeout(()=>{p(!1),d(!0)},k+2e3),setTimeout(()=>{e()},k+2800)];return()=>{S.forEach(A=>{clearTimeout(A)})}},[e]);let m=hn.length+5,h=Math.max(0,Math.floor((t-m)/2));return fo(Oe,{flexDirection:"column",height:t,width:n,children:[Re(Oe,{height:h}),fo(Oe,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Re(Oe,{flexDirection:"column",children:hn.map((k,S)=>Re(mo,{color:Bl,children:S<r?k:""},k))}),fo(Oe,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Re(mo,{bold:!0,color:Bl,children:a?Mg:""}),Re(Oe,{marginTop:1,children:Re(mo,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),Re(Oe,{marginTop:2,children:Re(jl,{loading:c})})]})]})]})}var hn,Bl,Mg,Vl=f(()=>{"use strict";fn();$l();hn=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],Bl="#24CFFF",Mg="ripplo"});import{createAuthClient as zg}from"better-auth/client";import{deviceAuthorizationClient as Jg}from"better-auth/client/plugins";function Sn({baseURL:e}){return zg({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Jg()]})}var yo=f(()=>{"use strict"});import{exec as Xg}from"child_process";async function ql({cwd:e,onDeviceCode:t,url:n}){let r=n??St().RIPPLO_SERVER_URL,o=Sn({baseURL:r}),a=await o.device.code({client_id:Wl});if(a.error!=null)throw new Error(`Failed to request device code: ${a.error.error_description}`);let{device_code:i,user_code:l,verification_uri_complete:s}=a.data;t({userCode:l,verificationUrl:s}),eh(s);let c=await Hg({authClient:o,deviceCode:i});return gr(e,c),c}async function Hg({authClient:e,deviceCode:t}){for(;;){await Yg(Gg);let n=await e.device.token({client_id:Wl,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return n.data.access_token;if(n.error==null)continue;if(!Qg(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function Qg(e){return Kg.has(e)}function Yg(e){return new Promise(t=>{setTimeout(t,e)})}function Zg(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function eh(e){let t=Zg();Xg(`${t} "${e}"`,()=>{})}var Gg,Wl,Kg,Fl=f(()=>{"use strict";ue();yo();on();Gg=5e3,Wl="ripplo-cli";Kg=new Set(["authorization_pending","slow_down"])});import{useCallback as go,useEffect as th,useState as Ue}from"react";import{exec as nh}from"child_process";import{promisify as rh}from"util";import Q from"fs";import ae from"path";function Jl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Ue(t==null?"login":"validating"),[a,i]=Ue(),[l,s]=Ue(),[c,p]=Ue(t),[u,d]=Ue(!1),[m,h]=Ue(),[k,S]=Ue();th(()=>{if(t==null)return;Sn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(T=>{if(T.data==null){o("login");return}return ho({cwd:e,serverUrl:n,token:t})}).then(T=>{if(T==null){o("select-project");return}i(T),o("complete")}).catch(T=>{s(T instanceof Error?T.message:String(T)),o("login")})},[e,t,n]);let A=go(()=>{u||(d(!0),s(void 0),ql({cwd:e,onDeviceCode:h,url:n}).then(R=>(p(R),ho({cwd:e,serverUrl:n,token:R}))).then(R=>{R==null?o("select-project"):(i(R),o("complete"))}).catch(R=>{d(!1),h(void 0),s(R instanceof Error?R.message:String(R))}))},[e,u,n]),w=go(R=>{let T=a?.token??c??t;if(T==null){s("No authentication token available");return}o("scaffolding"),s(void 0),ah({cwd:e,onStep:S,projectId:R.id}).then(()=>ho({cwd:e,serverUrl:n,token:T})).then(P=>{i(P??{appUrl:"",preconditionsUrl:"",projectId:R.id,ripploServerUrl:n,token:T,webhookSecret:""}),o("complete")}).catch(P=>{s(P instanceof Error?P.message:String(P)),o("select-project")})},[a,e,t,n,c]),x=go(()=>{i(void 0),o("login"),d(!1),h(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,error:l,loginStarted:u,resetToLogin:x,scaffoldingStep:k,selectProject:w,setStage:o,stage:r,startLogin:A,token:c}}async function ho({cwd:e,serverUrl:t,token:n}){let r=await D(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function ah({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),dh({cwd:e,projectId:n}),t("Updating .gitignore..."),gh(e),t("Marking ripplo.lock as generated..."),sh(e),t("Installing dependencies..."),await lh(e),t("Compiling initial lockfile..."),await ih(e),t("Setting up browser..."),await tr()}async function ih(e){let t=await D(e);if(!t.ok){b.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await he({cwd:e,result:t.result})}function sh(e){let t=ae.join(e,".gitattributes"),n=Q.existsSync(t)?Q.readFileSync(t,"utf8"):"";if(n.includes(zl))return;let r=n.length===0||n.endsWith(`
242
+ `)});import{Box as At,Text as ie,useInput as bg}from"ink";import Ng from"ink-spinner";import{jsx as ge,jsxs as de}from"react/jsx-runtime";function mo({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:a,stage:i}){return bg((l,s)=>{i==="scaffolding-warnings"&&s.return&&n()}),de(At,{flexDirection:"column",padding:1,children:[de(ie,{bold:!0,children:[" ","ripplo setup"]}),ge(ie,{children:""}),de(ie,{children:[ge(ie,{color:"green",children:" \u2713 "}),ge(ie,{children:"Authenticated"})]}),Tg({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:a,stage:i}),t==null?null:ge(At,{marginTop:1,children:de(ie,{color:"red",children:[" ","Error: ",t]})})]})}function Tg({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?de(ie,{children:[de(ie,{color:"cyan",children:[" ",ge(Ng,{type:"dots"})]}),de(ie,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?de(At,{flexDirection:"column",marginTop:1,children:[ge(ie,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((a,i)=>de(At,{flexDirection:"column",marginTop:1,children:[de(ie,{children:[" ",a.message]}),a.manualCommand==null?null:de(ie,{color:"cyan",children:[" $ ",a.manualCommand]})]},i)),ge(At,{marginTop:1,children:ge(ie,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):ge(wl,{selectProject:r,serverUrl:e.ripploServerUrl})}var Nl=f(()=>{"use strict";bl()});import{useEffect as Rg,useState as Lg}from"react";function Ke(){let[e,t]=Lg(Tl);return Rg(()=>{function n(){t(Tl())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Tl(){return{height:process.stdout.rows,width:process.stdout.columns}}var yn=f(()=>{"use strict"});import{useEffect as Cg,useRef as vg,useState as xg}from"react";function Rl({config:e,cwd:t}){let[n,r]=xg({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=vg(void 0);return Cg(()=>{function a({devSessionId:l}){r(s=>({...s,devSessionId:l,syncError:void 0,syncing:!1}))}function i(l){r(s=>({...s,syncError:l,syncing:!1}))}return Ys({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=to({config:e,cwd:t,lastHash:s,onSyncError:i,onSyncSuccess:a})}).catch(l=>{let s=l instanceof Error?l.message:String(l);i(s),o.current=to({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var Ll=f(()=>{"use strict";no()});import LL from"chalk";import{z as Cl}from"zod";async function vl(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${Pg}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return Eg.parse(r).version}catch{return}finally{clearTimeout(t)}}var fo,Pg,Eg,xl=f(()=>{"use strict";fe();fo="0.1.9",Pg="ripplo",Eg=Cl.object({version:Cl.string()})});import{useEffect as Og,useState as Ug}from"react";import{Text as Ue}from"ink";import{jsx as Ye,jsxs as $g}from"react/jsx-runtime";function Pl({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=jg(),l=i!=null&&i!==fo,s=_g({connected:n,syncError:o}),c=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${fo}`,d=l?` \u2192 v${i}`:"",m="q to quit",h=` ripplo ${u}${d} | ${r} ${s}${c}${p}`,k=Math.max(0,a-h.length-m.length-1);return $g(Ue,{inverse:!0,children:[Ye(Ue,{bold:!0,children:" ripplo "}),Ye(Ue,{dimColor:!0,children:u}),l?Ye(Ue,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,Ye(Ue,{color:Ig({connected:n,syncError:o}),children:s}),t?null:Ye(Ue,{color:"yellow",children:c}),p," ".repeat(k),Ye(Ue,{dimColor:!0,children:m})," "]})}function _g({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function Ig({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function jg(){let[e,t]=Ug();return Og(()=>{vl().then(n=>{n!=null&&t(n)})},[]),e}var El=f(()=>{"use strict";xl()});import{Box as gn,Text as wt,useApp as Bg,useInput as Dg}from"ink";import{jsx as Qe,jsxs as hn}from"react/jsx-runtime";function Ol({config:e,cwd:t}){let n=Bg(),{height:r,width:o}=Ke(),{config:a,devSessionId:i,syncError:l}=Rl({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=il({config:a,cwd:t,devSessionId:i});Dg(d=>{d==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return hn(gn,{flexDirection:"column",height:r,width:o,children:[Qe(Pl,{activeRunCount:s,browsersReady:c,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),hn(gn,{flexDirection:"column",flexGrow:1,padding:1,children:[hn(gn,{children:[Qe(wt,{children:"Developer dashboard: "}),Qe(wt,{color:"cyan",children:u})]}),hn(gn,{marginTop:1,children:[Qe(wt,{dimColor:!0,children:"Run "}),Qe(wt,{color:"yellow",children:"ripplo doctor"}),Qe(wt,{dimColor:!0,children:" for health checks"})]})]})]})}var Ul=f(()=>{"use strict";yn();Ll();oo();El()});import{Text as _l}from"ink";import Vg from"ink-spinner";import{jsx as Il,jsxs as Fg}from"react/jsx-runtime";function jl({loading:e}){return e?Fg(_l,{color:Wg,children:[Il(Vg,{type:"dots"})," Starting..."]}):Il(_l,{children:""})}var Wg,$l=f(()=>{"use strict";Wg="#24CFFF"});import{useEffect as qg,useState as bt}from"react";import{Box as _e,Text as yo,useInput as Mg}from"ink";import{jsx as Le,jsxs as go}from"react/jsx-runtime";function Dl({onDismiss:e}){let{height:t,width:n}=Ke(),[r,o]=bt(0),[a,i]=bt(!1),[l,s]=bt(!1),[c,p]=bt(!1),[u,d]=bt(!1);Mg(()=>{u&&e()}),qg(()=>{let k=80+Sn.length*70+80,S=[...Sn.map((A,w)=>setTimeout(()=>{o(w+1)},80+w*70)),setTimeout(()=>{i(!0)},k),setTimeout(()=>{s(!0)},k+200),setTimeout(()=>{p(!0)},k+400),setTimeout(()=>{p(!1),d(!0)},k+2e3),setTimeout(()=>{e()},k+2800)];return()=>{S.forEach(A=>{clearTimeout(A)})}},[e]);let m=Sn.length+5,h=Math.max(0,Math.floor((t-m)/2));return go(_e,{flexDirection:"column",height:t,width:n,children:[Le(_e,{height:h}),go(_e,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Le(_e,{flexDirection:"column",children:Sn.map((k,S)=>Le(yo,{color:Bl,children:S<r?k:""},k))}),go(_e,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Le(yo,{bold:!0,color:Bl,children:a?zg:""}),Le(_e,{marginTop:1,children:Le(yo,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),Le(_e,{marginTop:2,children:Le(jl,{loading:c})})]})]})]})}var Sn,Bl,zg,Vl=f(()=>{"use strict";yn();$l();Sn=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],Bl="#24CFFF",zg="ripplo"});import{createAuthClient as Jg}from"better-auth/client";import{deviceAuthorizationClient as Xg}from"better-auth/client/plugins";function kn({baseURL:e}){return Jg({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Xg()]})}var ho=f(()=>{"use strict"});import{exec as Gg}from"child_process";async function Fl({cwd:e,onDeviceCode:t,url:n}){let r=n??St().RIPPLO_SERVER_URL,o=kn({baseURL:r}),a=await o.device.code({client_id:Wl});if(a.error!=null)throw new Error(`Failed to request device code: ${a.error.error_description}`);let{device_code:i,user_code:l,verification_uri_complete:s}=a.data;t({userCode:l,verificationUrl:s}),th(s);let c=await Kg({authClient:o,deviceCode:i});return Sr(e,c),c}async function Kg({authClient:e,deviceCode:t}){for(;;){await Zg(Hg);let n=await e.device.token({client_id:Wl,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return n.data.access_token;if(n.error==null)continue;if(!Qg(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function Qg(e){return Yg.has(e)}function Zg(e){return new Promise(t=>{setTimeout(t,e)})}function eh(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function th(e){let t=eh();Gg(`${t} "${e}"`,()=>{})}var Hg,Wl,Yg,ql=f(()=>{"use strict";fe();ho();an();Hg=5e3,Wl="ripplo-cli";Yg=new Set(["authorization_pending","slow_down"])});import{useCallback as An,useEffect as nh,useState as Ce}from"react";import{exec as rh}from"child_process";import{promisify as oh}from"util";import z from"fs";import G from"path";function zl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Ce(t==null?"login":"validating"),[a,i]=Ce(),[l,s]=Ce(),[c,p]=Ce(t),[u,d]=Ce(!1),[m,h]=Ce(),[k,S]=Ce(),[A,w]=Ce([]);nh(()=>{if(t==null)return;kn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(L=>{if(L.data==null){o("login");return}return So({cwd:e,serverUrl:n,token:t})}).then(L=>{if(L==null){o("select-project");return}i(L),o("complete")}).catch(L=>{s(L instanceof Error?L.message:String(L)),o("login")})},[e,t,n]);let P=An(()=>{u||(d(!0),s(void 0),Fl({cwd:e,onDeviceCode:h,url:n}).then(x=>(p(x),So({cwd:e,serverUrl:n,token:x}))).then(x=>{x==null?o("select-project"):(i(x),o("complete"))}).catch(x=>{d(!1),h(void 0),s(x instanceof Error?x.message:String(x))}))},[e,u,n]),E=An(x=>{let L=a?.token??c??t;if(L==null){s("No authentication token available");return}o("scaffolding"),s(void 0),lh({cwd:e,onStep:S,projectId:x.id}).then(async $=>{w($);let ve=await So({cwd:e,serverUrl:n,token:L});i(ve??ah({projectId:x.id,serverUrl:n,token:L})),o($.length>0?"scaffolding-warnings":"complete")}).catch($=>{s($ instanceof Error?$.message:String($)),o("select-project")})},[a,e,t,n,c]),T=An(()=>{o("complete")},[]),I=An(()=>{i(void 0),o("login"),d(!1),h(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,dismissScaffoldWarnings:T,error:l,loginStarted:u,resetToLogin:I,scaffoldingStep:k,scaffoldWarnings:A,selectProject:E,setStage:o,stage:r,startLogin:P,token:c}}function ah({projectId:e,serverUrl:t,token:n}){return{appUrl:"",preconditionsUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function So({cwd:e,serverUrl:t,token:n}){let r=await V(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function lh({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),hh({cwd:e,projectId:n}),t("Updating .gitignore..."),Nh(e),t("Marking ripplo.lock as generated..."),uh(e),t("Installing dependencies...");let r=await ch(e),o=[];if(r.ok||o.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run this manually, then re-run \`npx ripplo\`.`}),r.ok){t("Compiling initial lockfile...");let a=await dh(e);a!=null&&o.push({manualCommand:void 0,message:a})}return t("Setting up browser..."),await rr(),o}async function ch(e){let t=mh({cwd:e,pm:gh(e)});b.info("Installing dependencies: %s",t);try{return await sh(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
243
+ `)[0]??n.message:String(n);return b.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function dh(e){try{await ph(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return b.warn("Initial lockfile compile failed: %s",n),`Couldn't compile initial lockfile: ${n}. You can run \`npx ripplo\` again after fixing the DSL.`}}async function ph(e){let t=await V(e);if(!t.ok){b.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await Se({cwd:e,result:t.result})}function uh(e){let t=G.join(e,".gitattributes"),n=z.existsSync(t)?z.readFileSync(t,"utf8"):"";if(n.includes(Ml))return;let r=n.length===0||n.endsWith(`
243
244
  `)?"":`
244
- `;Q.writeFileSync(t,`${n}${r}${zl}
245
- `)}async function lh(e){let t=ch(e),n=t==="yarn"?`yarn add -D ${Ml.join(" ")}`:`${t} add -D ${Ml.join(" ")}`;b.info("Installing dependencies: %s",n),await oh(n,{cwd:e})}function ch(e){return Q.existsSync(ae.join(e,"pnpm-lock.yaml"))?"pnpm":Q.existsSync(ae.join(e,"yarn.lock"))?"yarn":Q.existsSync(ae.join(e,"bun.lockb"))||Q.existsSync(ae.join(e,"bun.lock"))?"bun":"npm"}function dh({cwd:e,projectId:t}){let n=ae.join(e,".ripplo"),r=ae.join(n,"tests"),o=ae.join(n,"preconditions");Q.mkdirSync(r,{recursive:!0}),Q.mkdirSync(o,{recursive:!0}),kn(ae.join(n,"ripplo.ts"),ph(t)),kn(ae.join(n,"index.ts"),mh),kn(ae.join(n,".env"),uh()),kn(ae.join(n,"tsconfig.json"),fh)}function kn(e,t){Q.existsSync(e)||Q.writeFileSync(e,t)}function ph(e){return`import { config } from "dotenv";
245
+ `;z.writeFileSync(t,`${n}${r}${Ml}
246
+ `)}function mh({cwd:e,pm:t}){let n=ih.join(" ");return t==="pnpm"?fh(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?yh(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function fh(e){return z.existsSync(G.join(e,"pnpm-workspace.yaml"))||z.existsSync(G.join(e,"pnpm-workspace.yml"))}function yh(e){let t=G.join(e,"package.json");if(!z.existsSync(t))return!1;try{let n=JSON.parse(z.readFileSync(t,"utf8"));if(n==null||typeof n!="object"||!("workspaces"in n))return!1;let r=n.workspaces;return Array.isArray(r)||r!=null&&typeof r=="object"}catch{return!1}}function gh(e){return z.existsSync(G.join(e,"pnpm-lock.yaml"))?"pnpm":z.existsSync(G.join(e,"yarn.lock"))?"yarn":z.existsSync(G.join(e,"bun.lockb"))||z.existsSync(G.join(e,"bun.lock"))?"bun":"npm"}function hh({cwd:e,projectId:t}){let n=G.join(e,".ripplo"),r=G.join(n,"tests"),o=G.join(n,"preconditions");z.mkdirSync(r,{recursive:!0}),z.mkdirSync(o,{recursive:!0}),wn(G.join(n,"ripplo.ts"),Sh(t)),wn(G.join(n,"index.ts"),Ah),wn(G.join(n,".env"),kh()),wn(G.join(n,"tsconfig.json"),wh)}function wn(e,t){z.existsSync(e)||z.writeFileSync(e,t)}function Sh(e){return`import { config } from "dotenv";
246
247
  import { createRipplo } from "@ripplo/testing";
247
248
  import { z } from "zod";
248
249
 
@@ -262,18 +263,18 @@ const ripplo = createRipplo({
262
263
  });
263
264
 
264
265
  export default ripplo;
265
- `}function uh(){return`RIPPLO_WEBHOOK_SECRET="${jr()}"
266
- `}function gh(e){let t=ae.join(e,".gitignore");if(!Q.existsSync(t))return;let n=Q.readFileSync(t,"utf8"),r=yh.filter(a=>!n.includes(a));if(r.length===0)return;let o=n.endsWith(`
266
+ `}function kh(){return`RIPPLO_WEBHOOK_SECRET="${Br()}"
267
+ `}function Nh(e){let t=G.join(e,".gitignore");if(!z.existsSync(t))return;let n=z.readFileSync(t,"utf8"),r=bh.filter(a=>!n.includes(a));if(r.length===0)return;let o=n.endsWith(`
267
268
  `)?"":`
268
- `;Q.writeFileSync(t,n+o+r.join(`
269
+ `;z.writeFileSync(t,n+o+r.join(`
269
270
  `)+`
270
- `)}var Ml,oh,zl,mh,fh,yh,Xl=f(()=>{"use strict";ue();je();Fl();yo();pe();Ml=["@ripplo/testing","dotenv","zod"],oh=rh(nh);zl=".ripplo/ripplo.lock linguist-generated=true";mh=`// Register every precondition and test here. The CLI loads this one file \u2014
271
+ `)}var ih,sh,Ml,Ah,wh,bh,Jl=f(()=>{"use strict";fe();Be();ql();ho();me();ih=["@ripplo/testing","dotenv","zod"],sh=oh(rh);Ml=".ripplo/ripplo.lock linguist-generated=true";Ah=`// Register every precondition and test here. The CLI loads this one file \u2014
271
272
  // anything not imported from here is invisible to ripplo run / lint / status.
272
273
  // When you add a test under ./tests or a precondition under ./preconditions,
273
274
  // add a matching \`import "./..."\` line below.
274
275
 
275
276
  export { default } from "./ripplo.js";
276
- `,fh=`{
277
+ `,wh=`{
277
278
  "compilerOptions": {
278
279
  "strict": true,
279
280
  "noUncheckedIndexedAccess": true,
@@ -289,35 +290,35 @@ export { default } from "./ripplo.js";
289
290
  "include": ["*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
290
291
  "exclude": ["node_modules"]
291
292
  }
292
- `,yh=[".ripplo/debug/",".ripplo/.token",".ripplo/.env"]});import{useCallback as hh,useState as Sh}from"react";import{Box as So,Text as ko}from"ink";import{Provider as Ao}from"urql";import{jsx as Y,jsxs as kh}from"react/jsx-runtime";function Gl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Sh(!0),a=Jl({cwd:e,initialToken:t,serverUrl:n}),{height:i,width:l}=He(),s=hh(()=>{o(!1)},[]);if(r)return Y(Dl,{onDismiss:s});if(a.stage==="validating")return Y(So,{alignItems:"center",height:i,justifyContent:"center",width:l,children:kh(ko,{children:[Y(ko,{color:"yellow",children:"* "}),Y(ko,{children:"Validating session..."})]})});if(a.stage==="login")return Y(So,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Y(lo,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})});if(a.config!=null){let c=so({config:a.config});return wo({client:c,projectId:a.config.projectId}),a.stage==="complete"?Y(Ao,{value:c,children:Y(Ol,{config:a.config,cwd:e})}):Y(Ao,{value:c,children:Y(po,{config:a.config,error:a.error,scaffoldingStep:a.scaffoldingStep,selectProject:a.selectProject,stage:a.stage})})}if(a.token!=null){let c={appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:n,token:a.token,webhookSecret:""},p=so({config:c});return Y(Ao,{value:p,children:Y(po,{config:c,error:a.error,scaffoldingStep:a.scaffoldingStep,selectProject:a.selectProject,stage:a.stage})})}return Y(So,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Y(lo,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})})}var Hl=f(()=>{"use strict";bo();ul();fl();Nl();Ul();Vl();Xl();fn()});var Kl={};ac(Kl,{clearActiveSession:()=>Th,launchDashboard:()=>Lh,setActiveSession:()=>wo});import An from"fs";import No from"path";import Ah from"react";import{render as wh}from"ink";import{graphql as bh}from"gql.tada";function wo({client:e,projectId:t}){wn=e,bn=t}function Th(){wn=void 0,bn=void 0}function Rh(){if(wn==null||bn==null)return Promise.resolve();let e=wn.mutation(Nh,{projectId:bn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function Lh(){let e=process.cwd(),t=No.join(e,".ripplo","debug"),n=No.join(t,"last-crash.log");function r(i){An.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);An.writeFileSync(n,`${new Date().toISOString()}
293
+ `,bh=[".ripplo/debug/",".ripplo/.token",".ripplo/.env"]});import{useCallback as Th,useState as Rh}from"react";import{Box as ko,Text as Ao}from"ink";import{Provider as wo}from"urql";import{jsx as Z,jsxs as Lh}from"react/jsx-runtime";function Xl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Rh(!0),a=zl({cwd:e,initialToken:t,serverUrl:n}),{height:i,width:l}=Ke(),s=Th(()=>{o(!1)},[]);if(r)return Z(Dl,{onDismiss:s});if(a.stage==="validating")return Z(ko,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Lh(Ao,{children:[Z(Ao,{color:"yellow",children:"* "}),Z(Ao,{children:"Validating session..."})]})});if(a.stage==="login")return Z(ko,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Z(po,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})});if(a.config!=null){let c=co({config:a.config});return bo({client:c,projectId:a.config.projectId}),a.stage==="complete"?Z(wo,{value:c,children:Z(Ol,{config:a.config,cwd:e})}):Z(wo,{value:c,children:Z(mo,{config:a.config,error:a.error,scaffoldingStep:a.scaffoldingStep,scaffoldWarnings:a.scaffoldWarnings,selectProject:a.selectProject,stage:a.stage,onDismissWarnings:a.dismissScaffoldWarnings})})}if(a.token!=null){let c={appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:n,token:a.token,webhookSecret:""},p=co({config:c});return Z(wo,{value:p,children:Z(mo,{config:c,error:a.error,scaffoldingStep:a.scaffoldingStep,scaffoldWarnings:a.scaffoldWarnings,selectProject:a.selectProject,stage:a.stage,onDismissWarnings:a.dismissScaffoldWarnings})})}return Z(ko,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Z(po,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})})}var Gl=f(()=>{"use strict";No();ml();yl();Nl();Ul();Vl();Jl();yn()});var Hl={};oc(Hl,{clearActiveSession:()=>Eh,launchDashboard:()=>Uh,setActiveSession:()=>bo});import bn from"fs";import To from"path";import Ch from"react";import{render as vh}from"ink";import{graphql as xh}from"gql.tada";function bo({client:e,projectId:t}){Nn=e,Tn=t}function Eh(){Nn=void 0,Tn=void 0}function Oh(){if(Nn==null||Tn==null)return Promise.resolve();let e=Nn.mutation(Ph,{projectId:Tn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function Uh(){let e=process.cwd(),t=To.join(e,".ripplo","debug"),n=To.join(t,"last-crash.log");function r(i){bn.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);bn.writeFileSync(n,`${new Date().toISOString()}
293
294
  ${l}
294
- `),ol().finally(()=>{process.exit(1)})}let o;try{let i=ut(e),l=rn();Hn({filePath:No.join(t,"debug.log")}),o=wh(Ah.createElement(Gl,{cwd:e,initialToken:i??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>Rh()).then(()=>{process.exit(0)})}catch(i){r(i)}let a=!1;process.on("SIGINT",()=>{a||(a=!0,o?.unmount())}),process.on("SIGTERM",()=>{a||(a=!0,o?.unmount())}),process.on("uncaughtException",i=>{r(i)}),process.on("unhandledRejection",i=>{try{An.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);An.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
295
+ `),al().finally(()=>{process.exit(1)})}let o;try{let i=ut(e),l=on();Yn({filePath:To.join(t,"debug.log")}),o=vh(Ch.createElement(Xl,{cwd:e,initialToken:i??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>Oh()).then(()=>{process.exit(0)})}catch(i){r(i)}let a=!1;process.on("SIGINT",()=>{a||(a=!0,o?.unmount())}),process.on("SIGTERM",()=>{a||(a=!0,o?.unmount())}),process.on("uncaughtException",i=>{r(i)}),process.on("unhandledRejection",i=>{try{bn.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);bn.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
295
296
  ${l}
296
297
 
297
- `)}catch{}})}var Nh,wn,bn,bo=f(()=>{"use strict";no();ue();Hl();on();Nh=bh(`
298
+ `)}catch{}})}var Ph,Nn,Tn,No=f(()=>{"use strict";oo();fe();Gl();an();Ph=xh(`
298
299
  mutation EndDevSessionExit($projectId: String!) {
299
300
  endDevSession(projectId: $projectId) {
300
301
  id
301
302
  }
302
303
  }
303
- `)});import{config as Ql}from"dotenv";import Ch from"fs";import Ye from"path";import{fileURLToPath as vh}from"url";import xh from"yargs";import{hideBin as Ph}from"yargs/helpers";je();pe();async function Wo(e){let t=process.cwd(),n=await D(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
304
- `),process.exit(1)),e.check){let r=await Ct({cwd:t}),o=vt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${de} is up to date
305
- `);return}let a=o==="missing"?"missing":"out of date";process.stderr.write(`${de} is ${a} \u2014 run \`ripplo compile\` and commit the result
306
- `),process.exit(1)}await he({cwd:t,result:n.result}),process.stdout.write(`wrote ${de}
307
- `)}ue();je();import gt from"fs";import Ps from"path";import{chromium as bf}from"playwright";pe();import Af from"fs";import wf from"path";async function vs(e){let t=wf.join(e,".ripplo","index.ts");if(!Af.existsSync(t))return{appUrl:void 0,config:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],preconditionsUrl:void 0,valid:!1,warnings:[]};let n=await D(e);if(!n.ok)return{appUrl:void 0,config:void 0,errors:[{message:n.error,path:".ripplo/"}],preconditionsUrl:void 0,valid:!1,warnings:[]};let{config:r}=n.result;return{appUrl:r.appUrl,config:r,errors:[],preconditionsUrl:r.preconditionsUrl,valid:!0,warnings:[]}}async function Gr(e){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return}catch{return`appUrl (${e}) is not responding. Make sure your dev server is running on that port.`}}async function xs({appUrl:e,preconditionsUrl:t}){let n=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${n}/execute`,{body:JSON.stringify({precondition:"__ripplo_health_check"}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Precondition endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}pe();function Es(e){switch(e.type){case"settings":return!e.valid;case"token":return!e.exists;case"dev-server":return!e.reachable;case"preconditions":return e.count>0&&!e.configured;case"precondition-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"state-graph":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed}}async function Os(e){let t=await Rf(e),n=Lf(e),r=Cf(),o=await D(e),a=vf(o),i=xf(o),l=await Nf(e,o),s=Tf(e),c=await Pf(t,o);return[t,n,...c,a,i,l,s,r]}async function Nf(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await Ct({cwd:e});return{status:vt({compiled:t.result,existing:n}),type:"lockfile"}}function Tf(e){let t=Ps.join(e,".git","hooks","pre-commit");return gt.existsSync(t)?{installed:gt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Rf(e){let t=await vs(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(r=>r.path).filter(r=>r.length>0),type:"settings",valid:!1}}function Lf(e){let t=Ps.join(e,".ripplo",".token");return gt.existsSync(t)?{exists:gt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function Cf(){let e=bf.executablePath();return{installed:gt.existsSync(e),type:"browser"}}function vf(e){return e.ok?{errorCount:0,errors:[],found:!0,type:"state-graph",valid:!0}:{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"state-graph",valid:!1}}function xf(e){if(!e.ok)return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let t=e.result.tests.length;return{invalidNames:[],invalidWorkflows:[],total:t,type:"workflows",valid:t}}async function Pf(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await Gr(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let a=await Ef(n,t);return r.push(...a),r}async function Ef(e,t){let n=t.ok?Object.keys(t.result.graph.preconditions).length:0,r=e.preconditionsUrl.length>0,o={configured:r,count:n,endpointReachable:void 0,type:"preconditions"};if(n===0||!r)return[o];let a=_f(e.appUrl,e.preconditionsUrl);if(a==null)return[o];let i=await Gr(a)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:i,type:"preconditions"}),Us(e.preconditionsUrl)&&l.push({reachable:i,type:"precondition-endpoint",url:a}),!i)return l;let s=await xs({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await Of({preconditionUrl:a,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:a}),l}async function Of({preconditionUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let n=JSON.stringify({preconditions:[]});try{let r=await fetch(`${e}/execute-batch`,{body:n,headers:{"Content-Type":"application/json",...ze({body:n,secret:t})},method:"PUT",signal:AbortSignal.timeout(5e3)});return r.status===404?"disabled":r.status===401||r.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function Uf(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET on the dev server does not match the one in .ripplo/ripplo.ts.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: webhookSecret is empty in createRipplo() config. Set RIPPLO_WEBHOOK_SECRET in the env that .ripplo/ripplo.ts reads."}}function Us(e){return e.startsWith("http://")||e.startsWith("https://")}function _f(e,t){return Us(t)?t:`${e}${t}`}function _s(e){switch(e.type){case"settings":return $f(e);case"token":return Bf(e);case"dev-server":return Df(e);case"preconditions":return qf(e);case"webhook-verification":return Vf(e);case"state-graph":return Ff(e);case"workflows":return Mf(e);case"browser":return Wf(e);case"precondition-endpoint":return e.reachable?`\u2713 Precondition endpoint: ${e.url} is reachable`:`\u2717 Precondition endpoint: ${e.url} is not reachable`;case"adapter-enabled":return Uf(e);case"lockfile":return If(e);case"pre-commit-hook":return jf(e)}}function If(e){switch(e.status){case"match":return`\u2713 Lockfile: ${de} is up to date`;case"missing":return`\u2717 Lockfile: ${de} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${de} is out of date \u2014 run \`ripplo compile\` and commit it`}}function jf(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}function $f(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function Bf(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Df(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Make sure your dev server is running.`}function Vf(e){return e.rejectsUnsigned?"\u2713 Webhook verification: Unsigned requests are correctly rejected":"\u2717 Webhook verification: Endpoint accepted an unsigned request \u2014 webhook signature verification may be missing or misconfigured."}function Wf(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function qf(e){return e.count===0?"! Preconditions: None defined":e.configured?e.endpointReachable===void 0?`! Preconditions: ${String(e.count)} defined (could not verify endpoint)`:`\u2713 Preconditions: ${String(e.count)} defined, endpoint configured`:`\u2717 Preconditions: ${String(e.count)} defined but preconditionsUrl is not set in createRipplo() config`}function Ff(e){if(!e.found)return"\u2717 State graph: DSL compilation failed";if(e.valid)return"\u2713 State graph: Valid";let t=e.errors.map(n=>` - ${n.path===""?"":n.path+": "}${n.message}`);return`\u2717 State graph: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
304
+ `)});import{config as Kl}from"dotenv";import _h from"fs";import Ze from"path";import{fileURLToPath as Ih}from"url";import jh from"yargs";import{hideBin as $h}from"yargs/helpers";Be();me();async function Fo(e){let t=process.cwd(),n=await V(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
305
+ `),process.exit(1)),e.check){let r=await vt({cwd:t}),o=xt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${ue} is up to date
306
+ `);return}let a=o==="missing"?"missing":"out of date";process.stderr.write(`${ue} is ${a} \u2014 run \`ripplo compile\` and commit the result
307
+ `),process.exit(1)}await Se({cwd:t,result:n.result}),process.stdout.write(`wrote ${ue}
308
+ `)}fe();Be();import gt from"fs";import Es from"path";import{chromium as wf}from"playwright";me();import kf from"fs";import Af from"path";async function xs(e){let t=Af.join(e,".ripplo","index.ts");if(!kf.existsSync(t))return{appUrl:void 0,config:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],preconditionsUrl:void 0,valid:!1,warnings:[]};let n=await V(e);if(!n.ok)return{appUrl:void 0,config:void 0,errors:[{message:n.error,path:".ripplo/"}],preconditionsUrl:void 0,valid:!1,warnings:[]};let{config:r}=n.result;return{appUrl:r.appUrl,config:r,errors:[],preconditionsUrl:r.preconditionsUrl,valid:!0,warnings:[]}}async function Kr(e){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return}catch{return`appUrl (${e}) is not responding. Make sure your dev server is running on that port.`}}async function Ps({appUrl:e,preconditionsUrl:t}){let n=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${n}/execute`,{body:JSON.stringify({precondition:"__ripplo_health_check"}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Precondition endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}me();function Os(e){switch(e.type){case"settings":return!e.valid;case"token":return!e.exists;case"dev-server":return!e.reachable;case"preconditions":return e.count>0&&!e.configured;case"precondition-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"state-graph":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed}}async function Us(e){let t=await Tf(e),n=Rf(e),r=Lf(),o=await V(e),a=Cf(o),i=vf(o),l=await bf(e,o),s=Nf(e),c=await xf(t,o);return[t,n,...c,a,i,l,s,r]}async function bf(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await vt({cwd:e});return{status:xt({compiled:t.result,existing:n}),type:"lockfile"}}function Nf(e){let t=Es.join(e,".git","hooks","pre-commit");return gt.existsSync(t)?{installed:gt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Tf(e){let t=await xs(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(r=>r.path).filter(r=>r.length>0),type:"settings",valid:!1}}function Rf(e){let t=Es.join(e,".ripplo",".token");return gt.existsSync(t)?{exists:gt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function Lf(){let e=wf.executablePath();return{installed:gt.existsSync(e),type:"browser"}}function Cf(e){return e.ok?{errorCount:0,errors:[],found:!0,type:"state-graph",valid:!0}:{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"state-graph",valid:!1}}function vf(e){if(!e.ok)return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let t=e.result.tests.length;return{invalidNames:[],invalidWorkflows:[],total:t,type:"workflows",valid:t}}async function xf(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await Kr(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let a=await Pf(n,t);return r.push(...a),r}async function Pf(e,t){let n=t.ok?Object.keys(t.result.graph.preconditions).length:0,r=e.preconditionsUrl.length>0,o={configured:r,count:n,endpointReachable:void 0,type:"preconditions"};if(n===0||!r)return[o];let a=Uf(e.appUrl,e.preconditionsUrl);if(a==null)return[o];let i=await Kr(a)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:i,type:"preconditions"}),_s(e.preconditionsUrl)&&l.push({reachable:i,type:"precondition-endpoint",url:a}),!i)return l;let s=await Ps({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await Ef({preconditionUrl:a,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:a}),l}async function Ef({preconditionUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let n=JSON.stringify({preconditions:[]});try{let r=await fetch(`${e}/execute-batch`,{body:n,headers:{"Content-Type":"application/json",...Xe({body:n,secret:t})},method:"PUT",signal:AbortSignal.timeout(5e3)});return r.status===404?"disabled":r.status===401||r.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function Of(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET on the dev server does not match the one in .ripplo/ripplo.ts.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: webhookSecret is empty in createRipplo() config. Set RIPPLO_WEBHOOK_SECRET in the env that .ripplo/ripplo.ts reads."}}function _s(e){return e.startsWith("http://")||e.startsWith("https://")}function Uf(e,t){return _s(t)?t:`${e}${t}`}function Is(e){switch(e.type){case"settings":return jf(e);case"token":return $f(e);case"dev-server":return Bf(e);case"preconditions":return Wf(e);case"webhook-verification":return Df(e);case"state-graph":return Ff(e);case"workflows":return qf(e);case"browser":return Vf(e);case"precondition-endpoint":return e.reachable?`\u2713 Precondition endpoint: ${e.url} is reachable`:`\u2717 Precondition endpoint: ${e.url} is not reachable`;case"adapter-enabled":return Of(e);case"lockfile":return _f(e);case"pre-commit-hook":return If(e)}}function _f(e){switch(e.status){case"match":return`\u2713 Lockfile: ${ue} is up to date`;case"missing":return`\u2717 Lockfile: ${ue} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${ue} is out of date \u2014 run \`ripplo compile\` and commit it`}}function If(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}function jf(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function $f(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Bf(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Make sure your dev server is running.`}function Df(e){return e.rejectsUnsigned?"\u2713 Webhook verification: Unsigned requests are correctly rejected":"\u2717 Webhook verification: Endpoint accepted an unsigned request \u2014 webhook signature verification may be missing or misconfigured."}function Vf(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function Wf(e){return e.count===0?"! Preconditions: None defined":e.configured?e.endpointReachable===void 0?`! Preconditions: ${String(e.count)} defined (could not verify endpoint)`:`\u2713 Preconditions: ${String(e.count)} defined, endpoint configured`:`\u2717 Preconditions: ${String(e.count)} defined but preconditionsUrl is not set in createRipplo() config`}function Ff(e){if(!e.found)return"\u2717 State graph: DSL compilation failed";if(e.valid)return"\u2713 State graph: Valid";let t=e.errors.map(n=>` - ${n.path===""?"":n.path+": "}${n.message}`);return`\u2717 State graph: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
308
309
  ${t.join(`
309
- `)}`}function Mf(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let t=e.invalidWorkflows.map(n=>zf(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
310
+ `)}`}function qf(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let t=e.invalidWorkflows.map(n=>Mf(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
310
311
  ${t.join(`
311
- `)}`}function zf(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
312
+ `)}`}function Mf(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
312
313
  `+t.join(`
313
- `)}async function Is(){let e=process.cwd(),t=await Os(e),n=t.map(o=>_s(o));process.stdout.write(n.join(`
314
+ `)}async function js(){let e=process.cwd(),t=await Us(e),n=t.map(o=>Is(o));process.stdout.write(n.join(`
314
315
  `)+`
315
- `);let r=t.some(o=>Es(o));process.exit(r?1:0)}ue();import{graphql as tn,readFragment as Jf}from"gql.tada";import js from"figures";var ht={cross:js.cross,tick:js.tick};var Bs=tn(`
316
+ `);let r=t.some(o=>Os(o));process.exit(r?1:0)}fe();import{graphql as nn,readFragment as zf}from"gql.tada";import $s from"figures";var ht={cross:$s.cross,tick:$s.tick};var Ds=nn(`
316
317
  fragment WorkflowIdMCP on Workflow {
317
318
  id
318
319
  slug
319
320
  }
320
- `),Xf=tn(`
321
+ `),Jf=nn(`
321
322
  query ProjectWorkflowIdsMCP($projectId: String!) {
322
323
  project(id: $projectId) {
323
324
  id
@@ -329,14 +330,14 @@ ${t.join(`
329
330
  }
330
331
  }
331
332
  }
332
- `,[Bs]),Gf=tn(`
333
+ `,[Ds]),Xf=nn(`
333
334
  mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
334
335
  createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
335
336
  id
336
337
  status
337
338
  }
338
339
  }
339
- `),Hf=tn(`
340
+ `),Gf=nn(`
340
341
  query RunStatusMCP($id: String!) {
341
342
  run(id: $id) {
342
343
  id
@@ -363,7 +364,7 @@ ${t.join(`
363
364
  }
364
365
  }
365
366
  }
366
- `);async function nn({config:e,ids:t}){let n=await Kf({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:c})=>{let p=await Yf({config:e,workflowId:c});return{id:s,runId:p}})),o=[],a=[];r.forEach((s,c)=>{let p=n[c];if(p==null)return;if(s.status==="fulfilled"){o.push(s.value);return}let u=s.reason instanceof Error?s.reason.message:String(s.reason);a.push({id:p.id,runId:"",summary:`ERROR creating run: ${u}`})}),(await Promise.allSettled(o.map(async({id:s,runId:c})=>{let p=await ey({config:e,runId:c}),u=Qf({config:e,id:s,runId:c}),d=`.ripplo/debug/${c}/`;return{id:s,runId:c,summary:`View run: ${u}
367
+ `);async function rn({config:e,ids:t}){let n=await Hf({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:c})=>{let p=await Yf({config:e,workflowId:c});return{id:s,runId:p}})),o=[],a=[];r.forEach((s,c)=>{let p=n[c];if(p==null)return;if(s.status==="fulfilled"){o.push(s.value);return}let u=s.reason instanceof Error?s.reason.message:String(s.reason);a.push({id:p.id,runId:"",summary:`ERROR creating run: ${u}`})}),(await Promise.allSettled(o.map(async({id:s,runId:c})=>{let p=await Zf({config:e,runId:c}),u=Kf({config:e,id:s,runId:c}),d=`.ripplo/debug/${c}/`;return{id:s,runId:c,summary:`View run: ${u}
367
368
  Debug artifacts: ${d}
368
369
 
369
370
  ${p}`}}))).forEach((s,c)=>{let p=o[c];if(p==null)return;if(s.status==="fulfilled"){a.push(s.value);return}let u=s.reason instanceof Error?s.reason.message:String(s.reason);a.push({id:p.id,runId:p.runId,summary:`ERROR polling run ${p.runId}: ${u}`})});let l=a.map(s=>`**${s.id}:**
@@ -371,8 +372,8 @@ ${s.summary}`).join(`
371
372
 
372
373
  ---
373
374
 
374
- `);return{results:a,summary:l}}async function Kf({config:e,ids:t}){let n=await W({config:e,document:Xf,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");if(n.project.devSession==null)throw new Error("No active dev session. Start one by running `ripplo` (or `npx ripplo`) in your terminal, then try again.");let r=(n.project.workflows??[]).map(o=>Jf(Bs,o));return t.length===0?r.map(o=>({id:o.slug,workflowId:o.id})):t.map(o=>{let a=r.find(i=>i.slug===o);if(a==null)throw new Error(`Test "${o}" not found on server. Is the dev session running? (It watches .ripplo/ files and syncs them automatically.)`);return{id:o,workflowId:a.id}})}function Qf({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function Yf({config:e,workflowId:t}){let n=await W({config:e,document:Gf,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Zf=2e3,$s=150;async function ey({config:e,runId:t}){let n=0;for(;n<$s;){await ny(Zf),n+=1;let o=(await W({config:e,document:Hf,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return ty({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String($s)} times.`}function ty({results:e,runId:t,status:n}){let r=[`Run ${t}: ${n.toUpperCase()}`];return e.forEach(o=>{r.push(` ${o.status}: ${String(o.passCount)} passed, ${String(o.failCount)} failed (${String(o.duration??0)}ms)`),o.summary!=null&&r.push(` Summary: ${o.summary}`),o.traceEntries.forEach(a=>{let i=a.status==="passed"?ht.tick:ht.cross,l=a.detail==null?"":` \u2014 ${a.detail}`;r.push(` ${i} ${a.title} (${String(a.duration)}ms)${l}`),a.assertions.forEach(s=>{let c=s.status==="passed"?ht.tick:ht.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
375
- `)}function ny(e){return new Promise(t=>{setTimeout(t,e)})}ue();pe();on();import{graphql as ly}from"gql.tada";var cy=ly(`
375
+ `);return{results:a,summary:l}}async function Hf({config:e,ids:t}){let n=await F({config:e,document:Jf,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");if(n.project.devSession==null)throw new Error("No active dev session. Start one by running `ripplo` (or `npx ripplo`) in your terminal, then try again.");let r=(n.project.workflows??[]).map(o=>zf(Ds,o));return t.length===0?r.map(o=>({id:o.slug,workflowId:o.id})):t.map(o=>{let a=r.find(i=>i.slug===o);if(a==null)throw new Error(`Test "${o}" not found on server. Is the dev session running? (It watches .ripplo/ files and syncs them automatically.)`);return{id:o,workflowId:a.id}})}function Kf({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function Yf({config:e,workflowId:t}){let n=await F({config:e,document:Xf,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Qf=2e3,Bs=150;async function Zf({config:e,runId:t}){let n=0;for(;n<Bs;){await ty(Qf),n+=1;let o=(await F({config:e,document:Gf,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return ey({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(Bs)} times.`}function ey({results:e,runId:t,status:n}){let r=[`Run ${t}: ${n.toUpperCase()}`];return e.forEach(o=>{r.push(` ${o.status}: ${String(o.passCount)} passed, ${String(o.failCount)} failed (${String(o.duration??0)}ms)`),o.summary!=null&&r.push(` Summary: ${o.summary}`),o.traceEntries.forEach(a=>{let i=a.status==="passed"?ht.tick:ht.cross,l=a.detail==null?"":` \u2014 ${a.detail}`;r.push(` ${i} ${a.title} (${String(a.duration)}ms)${l}`),a.assertions.forEach(s=>{let c=s.status==="passed"?ht.tick:ht.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
376
+ `)}function ty(e){return new Promise(t=>{setTimeout(t,e)})}fe();me();an();import{graphql as sy}from"gql.tada";var ly=sy(`
376
377
  query DevSessionCheckPreflight($projectId: String!) {
377
378
  project(id: $projectId) {
378
379
  id
@@ -381,36 +382,36 @@ ${s.summary}`).join(`
381
382
  }
382
383
  }
383
384
  }
384
- `);async function an(){let e=process.cwd(),t=ut(e);t==null&&(process.stderr.write("Not authenticated. Run `ripplo` to set up your config first.\n"),process.exit(1));let n=await D(e);return n.ok||(process.stderr.write(`Failed to compile DSL config: ${n.error}
385
- `),process.exit(1)),{...n.result.config,ripploServerUrl:rn(),token:t}}async function sn(e){(await W({config:e,document:cy,variables:{projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start one by running `ripplo` (or `npx ripplo`) in a terminal first.\n"),process.exit(1))}async function Ws({id:e,runs:t}){let n=await an();await sn(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
386
- `);let r=await Promise.allSettled(Array.from({length:t},()=>nn({config:n,ids:[e]}))),o=0,a=0,i=new Map;r.forEach(s=>{if(s.status==="rejected"){a++;let p=s.reason instanceof Error?s.reason.message:"unknown error";i.set(p,(i.get(p)??0)+1);return}let c=s.value.results[0];if(c==null){a++;return}if(c.summary.includes("FAILED")||c.summary.includes("ERROR")){a++;let p=c.summary.split(`
385
+ `);async function sn(){let e=process.cwd(),t=ut(e);t==null&&(process.stderr.write("Not authenticated. Run `ripplo` to set up your config first.\n"),process.exit(1));let n=await V(e);return n.ok||(process.stderr.write(`Failed to compile DSL config: ${n.error}
386
+ `),process.exit(1)),{...n.result.config,ripploServerUrl:on(),token:t}}async function ln(e){(await F({config:e,document:ly,variables:{projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start one by running `ripplo` (or `npx ripplo`) in a terminal first.\n"),process.exit(1))}async function Fs({id:e,runs:t}){let n=await sn();await ln(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
387
+ `);let r=await Promise.allSettled(Array.from({length:t},()=>rn({config:n,ids:[e]}))),o=0,a=0,i=new Map;r.forEach(s=>{if(s.status==="rejected"){a++;let p=s.reason instanceof Error?s.reason.message:"unknown error";i.set(p,(i.get(p)??0)+1);return}let c=s.value.results[0];if(c==null){a++;return}if(c.summary.includes("FAILED")||c.summary.includes("ERROR")){a++;let p=c.summary.split(`
387
388
  `).find(u=>u.includes("FAILED")||u.includes("ERROR"))??"unknown failure";i.set(p,(i.get(p)??0)+1)}else o++});let l=t>0?a/t*100:0;process.stdout.write(`
388
389
  Results: ${String(o)} passed, ${String(a)} failed out of ${String(t)} runs
389
390
  `),process.stdout.write(`Flake rate: ${l.toFixed(1)}%
390
391
  `),i.size>0&&(process.stdout.write(`
391
392
  Failure patterns:
392
393
  `),i.forEach((s,c)=>{process.stdout.write(` ${String(s)}x: ${c}
393
- `)})),process.exit(a>0?1:0)}import Qr from"fs";import Ms from"path";xn();xt();var qs=To(Ir(),1);import{z as kt}from"zod";import{z as le}from"zod";var dy=kt.object({appUrl:kt.string(),preconditionsUrl:kt.string(),projectId:kt.string(),webhookSecret:kt.string()});var VT=le.object({preconditions:le.array(le.string().min(1))}),WT=le.object({data:le.record(le.string(),le.record(le.string(),le.string())),preconditions:le.array(le.string().min(1))});function Fs(e){let t=[];return e.tests.forEach(n=>{let r=py(n),o=a=>{t.push({...a,test:n.slug})};Ey.forEach(a=>{a(r,n,o)})}),{diagnostics:t}}function py(e){let t=[],n=e.spec.entryNode,r=new Set;for(;n!=null&&!r.has(n);){r.add(n);let o=e.spec.nodes[n];if(o==null)break;t.push(o),n=o.next}return t}function uy(e,t,n){e.forEach(r=>{r.type==="assertText"&&"operator"in r&&r.operator!=="equals"&&n({message:`${r.type} uses operator "${r.operator}" \u2014 only "equals" is allowed for determinism`,rule:"exact-text-match",step:r.label??r.id})})}function my(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Ay(o.value)){let a=o.value.value;!wy(a)&&by(a)&&n({message:`fill() uses hardcoded value "${a}" \u2014 consider using precondition data via {{namespace.key}}`,rule:"no-hardcoded-data",step:o.label??o.id})}})}function fy(e,t,n){if(Object.keys(t.spec.variables??{}).length===0)return;e.some(a=>JSON.stringify(a).includes("{{"))||n({message:"Test requires preconditions but steps() never references precondition data \u2014 destructure and use it",rule:"prefer-precondition-data",step:void 0})}function yy(e,t,n){e.forEach(r=>{(r.label==null||r.label.length===0)&&n({message:`Step "${r.id}" lacks .as("...") label \u2014 every step must be labeled`,rule:"missing-label",step:r.id})})}function gy(e,t,n){let r=new Map;e.forEach(o=>{if(o.label==null)return;let a=r.get(o.label);a==null?r.set(o.label,o.id):n({message:`Duplicate label "${o.label}" \u2014 also used by ${a}`,rule:"no-duplicate-labels",step:o.label})})}function hy(e,t,n){let r=0;e.forEach(o=>{Je(o)?r=0:(r++,r===3&&n({message:"3+ consecutive actions without an assertion \u2014 add verification between actions",rule:"assert-after-action",step:o.label??o.id}))})}function Sy(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!Je(r)&&n({message:"Last step is an action, not an assertion \u2014 expectedOutcome should be verified by assertions at the end",rule:"assert-matches-outcome",step:r.label??r.id})}function ky(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Ay(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function wy(e){return e.includes("{{")}function by(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function Je(e){return e.type.startsWith("assert")}var Ny=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function Ty(e){return Ny.has(e.type)}function Ry(e,t,n){!t.implemented||e.length===0||e.some(r=>Je(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Ly(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(a=>Je(a)).length;if(r===0)return;let o=r/e.length;if(o<.15){let a=Math.round(o*100);n({message:`Only ${String(r)}/${String(e.length)} steps are assertions (${String(a)}%) \u2014 add more verification between actions`,rule:"low-assertion-ratio",step:void 0})}}function Hr(e){if(!("locator"in e)||e.locator==null)return;let t=e.locator;return t.by==="role"?`role:${t.role}:${t.name??""}`:`testId:${t.value}`}function Cy(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let a=Hr(r);if(a==null)return;let i=e.slice(o+1,o+4);i.find(c=>c.type==="assertVisible"&&Hr(c)===a)==null||i.some(c=>Ty(c)||Je(c)&&Hr(c)!==a)||n({message:`click "${r.label??r.id}" is followed only by assert.visible on the same locator \u2014 verifies nothing about the click's effect`,rule:"tautological-post-click-assert",step:r.label??r.id})})}var vy=new Set(["the","is","a","an","and","or","of","to","in","on","at","for","that","this","with","be","are","was","were","it","its","as","by","from","after","before","should","will","can","still","but","not","no","so","if","then","than","user","users","page","view","shows","show","see","click","clicks","clicked","clickable","visible","appears","appear","displayed","stays","remains"]);function Kr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!vy.has(t))}function xy(e){let t=e.label==null?[]:Kr(e.label);if(!("locator"in e)||e.locator==null)return t;let n=e.locator,r=n.by==="role"?n.name??"":n.value;return[...t,...Kr(r)]}function Py(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(Kr(t.expectedOutcome));if(r.size===0)return;let o=e.filter(i=>Je(i));if(o.length===0)return;o.some(i=>xy(i).some(l=>r.has(l)))||n({message:`No assertion references any keyword from expectedOutcome (${[...r].join(", ")}) \u2014 the outcome may not actually be verified`,rule:"expected-outcome-keyword-coverage",step:void 0})}var Ey=[uy,my,fy,yy,gy,hy,Sy,ky,Ry,Ly,Cy,Py];je();pe();async function zs(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await D(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
394
- `),process.exit(1)),await he({cwd:r,result:o.result});let a=Fs(o.result),i=t.length===0?a.diagnostics:a.diagnostics.filter(d=>t.includes(d.test)),l=new Map;i.forEach(d=>{let m=l.get(d.test)??[];l.set(d.test,[...m,d])}),l.forEach((d,m)=>{process.stderr.write(`
394
+ `)})),process.exit(a>0?1:0)}import Zr from"fs";import zs from"path";En();Pt();var qs=Ro($r(),1);import{z as kt}from"zod";import{z as ce}from"zod";var cy=kt.object({appUrl:kt.string(),preconditionsUrl:kt.string(),projectId:kt.string(),webhookSecret:kt.string()});var XT=ce.object({preconditions:ce.array(ce.string().min(1))}),GT=ce.object({data:ce.record(ce.string(),ce.record(ce.string(),ce.string())),preconditions:ce.array(ce.string().min(1))});function Ms(e){let t=[];return e.tests.forEach(n=>{let r=dy(n),o=a=>{t.push({...a,test:n.slug})};Py.forEach(a=>{a(r,n,o)})}),{diagnostics:t}}function dy(e){let t=[],n=e.spec.entryNode,r=new Set;for(;n!=null&&!r.has(n);){r.add(n);let o=e.spec.nodes[n];if(o==null)break;t.push(o),n=o.next}return t}function py(e,t,n){e.forEach(r=>{r.type==="assertText"&&"operator"in r&&r.operator!=="equals"&&n({message:`${r.type} uses operator "${r.operator}" \u2014 only "equals" is allowed for determinism`,rule:"exact-text-match",step:r.label??r.id})})}function uy(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&ky(o.value)){let a=o.value.value;!Ay(a)&&wy(a)&&n({message:`fill() uses hardcoded value "${a}" \u2014 consider using precondition data via {{namespace.key}}`,rule:"no-hardcoded-data",step:o.label??o.id})}})}function my(e,t,n){if(Object.keys(t.spec.variables??{}).length===0)return;e.some(a=>JSON.stringify(a).includes("{{"))||n({message:"Test requires preconditions but steps() never references precondition data \u2014 destructure and use it",rule:"prefer-precondition-data",step:void 0})}function fy(e,t,n){e.forEach(r=>{(r.label==null||r.label.length===0)&&n({message:`Step "${r.id}" lacks .as("...") label \u2014 every step must be labeled`,rule:"missing-label",step:r.id})})}function yy(e,t,n){let r=new Map;e.forEach(o=>{if(o.label==null)return;let a=r.get(o.label);a==null?r.set(o.label,o.id):n({message:`Duplicate label "${o.label}" \u2014 also used by ${a}`,rule:"no-duplicate-labels",step:o.label})})}function gy(e,t,n){let r=0;e.forEach(o=>{Ge(o)?r=0:(r++,r===3&&n({message:"3+ consecutive actions without an assertion \u2014 add verification between actions",rule:"assert-after-action",step:o.label??o.id}))})}function hy(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!Ge(r)&&n({message:"Last step is an action, not an assertion \u2014 expectedOutcome should be verified by assertions at the end",rule:"assert-matches-outcome",step:r.label??r.id})}function Sy(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function ky(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Ay(e){return e.includes("{{")}function wy(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function Ge(e){return e.type.startsWith("assert")}var by=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function Ny(e){return by.has(e.type)}function Ty(e,t,n){!t.implemented||e.length===0||e.some(r=>Ge(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Ry(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(a=>Ge(a)).length;if(r===0)return;let o=r/e.length;if(o<.15){let a=Math.round(o*100);n({message:`Only ${String(r)}/${String(e.length)} steps are assertions (${String(a)}%) \u2014 add more verification between actions`,rule:"low-assertion-ratio",step:void 0})}}function Yr(e){if(!("locator"in e)||e.locator==null)return;let t=e.locator;return t.by==="role"?`role:${t.role}:${t.name??""}`:`testId:${t.value}`}function Ly(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let a=Yr(r);if(a==null)return;let i=e.slice(o+1,o+4);i.find(c=>c.type==="assertVisible"&&Yr(c)===a)==null||i.some(c=>Ny(c)||Ge(c)&&Yr(c)!==a)||n({message:`click "${r.label??r.id}" is followed only by assert.visible on the same locator \u2014 verifies nothing about the click's effect`,rule:"tautological-post-click-assert",step:r.label??r.id})})}var Cy=new Set(["the","is","a","an","and","or","of","to","in","on","at","for","that","this","with","be","are","was","were","it","its","as","by","from","after","before","should","will","can","still","but","not","no","so","if","then","than","user","users","page","view","shows","show","see","click","clicks","clicked","clickable","visible","appears","appear","displayed","stays","remains"]);function Qr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!Cy.has(t))}function vy(e){let t=e.label==null?[]:Qr(e.label);if(!("locator"in e)||e.locator==null)return t;let n=e.locator,r=n.by==="role"?n.name??"":n.value;return[...t,...Qr(r)]}function xy(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(Qr(t.expectedOutcome));if(r.size===0)return;let o=e.filter(i=>Ge(i));if(o.length===0)return;o.some(i=>vy(i).some(l=>r.has(l)))||n({message:`No assertion references any keyword from expectedOutcome (${[...r].join(", ")}) \u2014 the outcome may not actually be verified`,rule:"expected-outcome-keyword-coverage",step:void 0})}var Py=[py,uy,my,fy,yy,gy,hy,Sy,Ty,Ry,Ly,xy];Be();me();async function Js(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await V(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
395
+ `),process.exit(1)),await Se({cwd:r,result:o.result});let a=Ms(o.result),i=t.length===0?a.diagnostics:a.diagnostics.filter(d=>t.includes(d.test)),l=new Map;i.forEach(d=>{let m=l.get(d.test)??[];l.set(d.test,[...m,d])}),l.forEach((d,m)=>{process.stderr.write(`
395
396
  ${m}
396
397
  `),d.forEach(h=>{let k=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${k}
397
398
  `),process.stderr.write(` ${h.message}
398
399
  `)})});let s=new Set(o.builder.getUnimplemented().tests),c=n.filter(d=>s.has(d));c.length>0&&(process.stderr.write(`
399
400
  not-implemented
400
401
  `),c.forEach(d=>{process.stderr.write(` ${d} is still marked .notImplemented()
401
- `)}));let p=_y(r);p.length>0&&(process.stderr.write(`
402
+ `)}));let p=Uy(r);p.length>0&&(process.stderr.write(`
402
403
  preconditions
403
404
  `),p.forEach(d=>{process.stderr.write(` [hardcoded-identifier] ${d.file}
404
405
  `),process.stderr.write(` ${d.message}
405
406
  `)}));let u=i.length+c.length+p.length;u>0&&(process.stderr.write(`
406
407
  ${String(u)} error(s)
407
- `),process.exit(1))}var Oy=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Uy=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function _y(e){let t=Ms.join(e,".ripplo","preconditions");return Qr.existsSync(t)?Qr.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>Iy(Ms.join(t,r))):[]}function Iy(e){let t=Qr.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Oy.exec(t);o!=null&&!n&&r.push({file:e,message:`hardcoded email literal ${o[0]} \u2014 use ctx.uniqueEmail() so parallel runs don't collide`});let a=Uy.exec(t);return a!=null&&!n&&r.push({file:e,message:`hardcoded UUID-like literal ${a[0]} \u2014 use ctx.uniqueId() so parallel runs don't collide`}),r}async function Js(e){let t=await an();await sn(t);let{results:n,summary:r}=await nn({config:t,ids:e});process.stdout.write(`${r}
408
- `);let o=n.some(a=>a.summary.includes("FAILED")||a.summary.includes("ERROR"));process.exit(o?1:0)}pe();async function Xs(e){let t=process.cwd(),n=await D(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
408
+ `),process.exit(1))}var Ey=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Oy=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function Uy(e){let t=zs.join(e,".ripplo","preconditions");return Zr.existsSync(t)?Zr.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>_y(zs.join(t,r))):[]}function _y(e){let t=Zr.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Ey.exec(t);o!=null&&!n&&r.push({file:e,message:`hardcoded email literal ${o[0]} \u2014 use ctx.uniqueEmail() so parallel runs don't collide`});let a=Oy.exec(t);return a!=null&&!n&&r.push({file:e,message:`hardcoded UUID-like literal ${a[0]} \u2014 use ctx.uniqueId() so parallel runs don't collide`}),r}async function Xs(e){let t=await sn();await ln(t);let{results:n,summary:r}=await rn({config:t,ids:e});process.stdout.write(`${r}
409
+ `);let o=n.some(a=>a.summary.includes("FAILED")||a.summary.includes("ERROR"));process.exit(o?1:0)}me();async function Gs(e){let t=process.cwd(),n=await V(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
409
410
  `),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
410
411
  `);return}let o={tests:r.map(a=>({id:a,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
411
- `)}var Yl=Ye.resolve(Ye.dirname(vh(import.meta.url)),"..");Ql({path:Ye.join(Yl,".env.local"),quiet:!0});Ql({path:Ye.join(Yl,".env"),quiet:!0});Oh();async function Eh(){await xh(Ph(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},async()=>{let{launchDashboard:e}=await Promise.resolve().then(()=>(bo(),Kl));e()}).command("run [ids..]","Run tests in parallel",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run (all if omitted)",type:"string"})},e=>Js(e.ids)).command("lint [ids..]","Compile and lint tests (all or specific ids)",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to lint (all if omitted)",type:"string"}).option("require-implemented",{array:!0,default:t,describe:"Test ids that must not be .notImplemented() \u2014 fails if any still are",type:"string"})},e=>zs({ids:e.ids,requireImplemented:e["require-implemented"]})).command("flake-detect <id>","Run a test N times in parallel to detect flakiness",e=>e.positional("id",{demandOption:!0,describe:"Test id to run flake detection against",type:"string"}).option("runs",{default:10,describe:"Number of parallel runs",type:"number"}),e=>Ws({id:e.id,runs:e.runs})).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>Wo({check:e.check})).command("doctor","Check project health",()=>{},()=>Is()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Xs({format:e.format})).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}Eh().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
412
- `),process.exit(1)});function Oh(){let e=process.cwd(),t=Zl(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
413
- `))}function Zl(e){let t=Ye.dirname(e);return Ch.existsSync(Ye.join(e,".ripplo"))?e:t===e?null:Zl(t)}export{Eh as main};
412
+ `)}var Yl=Ze.resolve(Ze.dirname(Ih(import.meta.url)),"..");Kl({path:Ze.join(Yl,".env.local"),quiet:!0});Kl({path:Ze.join(Yl,".env"),quiet:!0});Dh();async function Bh(){await jh($h(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},async()=>{let{launchDashboard:e}=await Promise.resolve().then(()=>(No(),Hl));e()}).command("run [ids..]","Run tests in parallel",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run (all if omitted)",type:"string"})},e=>Xs(e.ids)).command("lint [ids..]","Compile and lint tests (all or specific ids)",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to lint (all if omitted)",type:"string"}).option("require-implemented",{array:!0,default:t,describe:"Test ids that must not be .notImplemented() \u2014 fails if any still are",type:"string"})},e=>Js({ids:e.ids,requireImplemented:e["require-implemented"]})).command("flake-detect <id>","Run a test N times in parallel to detect flakiness",e=>e.positional("id",{demandOption:!0,describe:"Test id to run flake detection against",type:"string"}).option("runs",{default:10,describe:"Number of parallel runs",type:"number"}),e=>Fs({id:e.id,runs:e.runs})).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>Fo({check:e.check})).command("doctor","Check project health",()=>{},()=>js()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Gs({format:e.format})).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}Bh().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
413
+ `),process.exit(1)});function Dh(){let e=process.cwd(),t=Ql(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
414
+ `))}function Ql(e){let t=Ze.dirname(e);return _h.existsSync(Ze.join(e,".ripplo"))?e:t===e?null:Ql(t)}export{Bh as main};
414
415
  /*! Bundled license information:
415
416
 
416
417
  mustache/mustache.mjs: