ripplo 0.1.5 → 0.1.7

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 (3) hide show
  1. package/README.md +9 -7
  2. package/dist/index.js +104 -96
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,46 +1,47 @@
1
1
  #!/usr/bin/env node
2
- var tl=Object.create;var Jt=Object.defineProperty;var nl=Object.getOwnPropertyDescriptor;var rl=Object.getOwnPropertyNames;var ol=Object.getPrototypeOf,al=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(e&&(t=e(e=0)),t);var at=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),il=(e,t)=>{for(var n in t)Jt(e,n,{get:t[n],enumerable:!0})},sl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rl(t))!al.call(e,o)&&o!==n&&Jt(e,o,{get:()=>t[o],enumerable:!(r=nl(t,o))||r.enumerable});return e};var Jr=(e,t,n)=>(n=e!=null?tl(ol(e)):{},sl(t||!e||!e.__esModule?Jt(n,"default",{value:e,enumerable:!0}):n,e));function Xt(e){return typeof e=="function"}function dl(e){return Te(e)?"array":typeof e}function zt(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zr(e,t){return e!=null&&typeof e=="object"&&t in e}function cl(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function ul(e,t){return pl.call(e,t)}function fl(e){return!ul(ml,e)}function gl(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return yl[n]})}function wl(e,t){if(!e)return[];var n=!1,r=[],o=[],a=[],i=!1,l=!1,s="",d=0;function p(){if(i&&!l)for(;a.length;)delete o[a.pop()];else a=[];i=!1,l=!1}var u,c,m;function g(P){if(typeof P=="string"&&(P=P.split(Sl,2)),!Te(P)||P.length!==2)throw new Error("Invalid tags: "+P);u=new RegExp(zt(P[0])+"\\s*"),c=new RegExp("\\s*"+zt(P[1])),m=new RegExp("\\s*"+zt("}"+P[1]))}g(t||Z.tags);for(var S=new We(e),h,A,k,N,C,T;!S.eos();){if(h=S.pos,k=S.scanUntil(u),k)for(var O=0,I=k.length;O<I;++O)N=k.charAt(O),fl(N)?(a.push(o.length),s+=N):(l=!0,n=!0,s+=" "),o.push(["text",N,h,h+1]),h+=1,N===`
3
- `&&(p(),s="",d=0,n=!1);if(!S.scan(u))break;if(i=!0,A=S.scan(Al)||"name",S.scan(hl),A==="="?(k=S.scanUntil(Xr),S.scan(Xr),S.scanUntil(c)):A==="{"?(k=S.scanUntil(m),S.scan(kl),S.scanUntil(c),A="&"):k=S.scanUntil(c),!S.scan(c))throw new Error("Unclosed tag at "+S.pos);if(A==">"?C=[A,k,h,S.pos,s,d,n]:C=[A,k,h,S.pos],d++,o.push(C),A==="#"||A==="^")r.push(C);else if(A==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+k+'" at '+h);if(T[1]!==k)throw new Error('Unclosed section "'+T[1]+'" at '+h)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&g(k)}if(p(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+S.pos);return Nl(Rl(o))}function Rl(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 Nl(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 We(e){this.string=e,this.tail=e,this.pos=0}function Ne(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function F(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var ll,Te,pl,ml,yl,hl,Sl,Xr,kl,Al,Z,Ve,Gr,Hr=y(()=>{"use strict";ll=Object.prototype.toString,Te=Array.isArray||function(t){return ll.call(t)==="[object Array]"};pl=RegExp.prototype.test;ml=/\S/;yl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};hl=/\s*/,Sl=/\s+/,Xr=/\s*=/,kl=/\s*\}/,Al=/#|\^|\/|>|\{|&|=|!/;We.prototype.eos=function(){return this.tail===""};We.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};We.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};Ne.prototype.push=function(t){return new Ne(t,this)};Ne.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=zr(a,i[l])||cl(a,i[l])),a=a[i[l++]];else a=o.view[t],s=zr(o.view,t);if(s){r=a;break}o=o.parent}n[t]=r}return Xt(r)&&(r=r.call(this.view)),r};F.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};F.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||Z.tags).join(":"),a=typeof r<"u",i=a?r.get(o):void 0;return i==null&&(i=wl(t,n),a&&r.set(o,i)),i};F.prototype.render=function(t,n,r,o){var a=this.getConfigTags(o),i=this.parse(t,a),l=n instanceof Ne?n:new Ne(n,void 0);return this.renderTokens(i,l,r,t,o)};F.prototype.renderTokens=function(t,n,r,o,a){for(var i="",l,s,d,p=0,u=t.length;p<u;++p)d=void 0,l=t[p],s=l[0],s==="#"?d=this.renderSection(l,n,r,o,a):s==="^"?d=this.renderInverted(l,n,r,o,a):s===">"?d=this.renderPartial(l,n,r,a):s==="&"?d=this.unescapedValue(l,n):s==="name"?d=this.escapedValue(l,n,a):s==="text"&&(d=this.rawValue(l)),d!==void 0&&(i+=d);return i};F.prototype.renderSection=function(t,n,r,o,a){var i=this,l="",s=n.lookup(t[1]);function d(c){return i.render(c,n,r,a)}if(s){if(Te(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(Xt(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]),d),s!=null&&(l+=s)}else l+=this.renderTokens(t[4],n,r,o,a);return l}};F.prototype.renderInverted=function(t,n,r,o,a){var i=n.lookup(t[1]);if(!i||Te(i)&&i.length===0)return this.renderTokens(t[4],n,r,o,a)};F.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),a=t.split(`
2
+ var vl=Object.create;var pn=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var Pl=Object.getOwnPropertyNames;var El=Object.getPrototypeOf,Ol=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(e&&(t=e(e=0)),t);var wt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ul=(e,t)=>{for(var n in t)pn(e,n,{get:t[n],enumerable:!0})},_l=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pl(t))!Ol.call(e,o)&&o!==n&&pn(e,o,{get:()=>t[o],enumerable:!(r=xl(t,o))||r.enumerable});return e};var fo=(e,t,n)=>(n=e!=null?vl(El(e)):{},_l(t||!e||!e.__esModule?pn(n,"default",{value:e,enumerable:!0}):n,e));import un from"fs/promises";import mn from"path";import{z as Le}from"zod";import{z as Ce}from"zod";import{z as je}from"zod";import{z as bt}from"zod";import{z as f}from"zod";import{z as ge}from"zod";import{z as yo}from"zod";import{z as F}from"zod";import{z as Z}from"zod";import{z as ee}from"zod";function go(e){return{graph:e.graph,lockfileVersion:Ec,tests:e.tests.map(t=>({additionalChecks:[...t.additionalChecks],description:t.description,expectedOutcome:t.expectedOutcome,implemented:t.implemented,name:t.name,slug:t.slug,spec:t.spec,warnings:[...t.warnings]}))}}function fn(e){return`${JSON.stringify(e,jc(e),2)}
3
+ `}async function Nt({cwd:e}){let t=mn.join(e,pe),n=await _c(t);if(n==null)return null;let r=JSON.parse(n);return Uc.parse(r)}async function he({cwd:e,result:t}){let n=go(t),r=mn.join(e,pe);await un.mkdir(mn.dirname(r),{recursive:!0}),await un.writeFile(r,fn(n),"utf8")}function Rt({compiled:e,existing:t}){if(t==null)return"missing";let n=fn(go(e)),r=fn(t);return n===r?"match":"stale"}async function _c(e){try{return await un.readFile(e,"utf8")}catch(t){if(Ic(t)&&t.code==="ENOENT")return null;throw t}}function Ic(e){return e instanceof Error&&"code"in e}function jc(e){return function(n,r){return r===e||!$c(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[a])=>o.localeCompare(a)))}}function $c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Il,jl,$l,Bl,Dl,Vl,U,tt,Wl,ql,yn,Fl,de,Ml,zl,C,Jl,Xl,Gl,Hl,Kl,Ql,Yl,Zl,ec,tc,nc,rc,oc,ac,ic,sc,lc,cc,dc,pc,uc,mc,fc,yc,gc,hc,Sc,kc,Ac,wc,bc,Nc,Rc,Tc,Lc,Cc,vc,xc,Pc,Ec,pe,Oc,Uc,$e=g(()=>{"use strict";Il=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"),jl=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."),$l=bt.object({preconditions:bt.array(bt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:bt.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"),Bl=Ce.object({edges:Ce.array(Il).describe("Directed edges between states, each executed by a workflow"),preconditions:Ce.record(Ce.string(),jl).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:Ce.record(Ce.string(),$l).describe("States keyed by stable ID (kebab-case)"),version:Ce.literal(3).describe("Schema version, always 3")}).describe("Ripplo State Graph v3 \u2014 models application states, edges, and executable preconditions"),Dl=ge.object({by:ge.literal("testId"),value:ge.string().min(1)}),Vl=ge.object({by:ge.literal("role"),name:ge.string().optional(),role:ge.string().min(1)}),U=ge.discriminatedUnion("by",[Dl,Vl]),tt=yo.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Wl=yo.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),ql=F.object({type:F.literal("static"),value:F.union([F.string(),F.number(),F.boolean()])}),yn=F.object({name:F.string().min(1),type:F.literal("variable")}),Fl=F.discriminatedUnion("type",[ql,yn]),de=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.string()}),yn]),Ml=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.number().int().nonnegative()}),yn]),zl=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:f.string().optional(),id:f.string().min(1),label:f.string().optional(),next:f.string().optional(),timeout:f.number().int().positive().optional()},Jl=f.object({...C,type:f.literal("goto"),url:de}),Xl=f.object({...C,locator:U,type:f.literal("click")}),Gl=f.object({...C,locator:U,type:f.literal("fill"),value:de}),Hl=f.object({...C,locator:U,type:f.literal("select"),value:de}),Kl=f.object({...C,locator:U,type:f.literal("hover")}),Ql=f.object({...C,key:f.string().min(1),locator:U.optional(),type:f.literal("press")}),Yl=f.object({...C,locator:U,type:f.literal("check")}),Zl=f.object({...C,locator:U,type:f.literal("uncheck")}),ec=f.object({...C,height:f.number().int().positive(),type:f.literal("setViewport"),width:f.number().int().positive()}),tc=f.object({...C,message:f.string().min(1),type:f.literal("fail")}),nc=f.object({...C,type:f.literal("setVariable"),value:Fl,variable:f.string().min(1)}),rc=f.object({...C,locator:U,type:f.literal("extractText"),variable:f.string().min(1)}),oc=f.object({...C,files:f.array(f.string()).min(1),locator:U,type:f.literal("upload")}),ac=f.object({...C,locator:U,type:f.literal("dblclick")}),ic=f.object({...C,source:U,target:U,type:f.literal("drag")}),sc=f.object({...C,locator:U,type:f.literal("scrollIntoView")}),lc=f.object({...C,locator:U,type:f.literal("type"),value:de}),cc=f.object({...C,locator:U,type:f.literal("focus")}),dc=f.object({...C,locator:U,type:f.literal("clear")}),pc=f.object({...C,locator:U,type:f.literal("rightClick")}),uc=f.object({...C,action:f.enum(["accept","dismiss"]),promptText:f.string().optional(),type:f.literal("handleDialog")}),mc=f.object({...C,action:f.enum(["read","write"]),type:f.literal("clipboard"),value:de.optional(),variable:f.string().min(1).optional()}),fc=f.object({...C,permission:f.string().min(1),state:f.enum(["granted","prompt"]),type:f.literal("setPermission")}),yc=f.object({...C,locator:U,type:f.literal("assertVisible")}),gc=f.object({...C,locator:U,type:f.literal("assertNotVisible")}),hc=f.object({...C,expected:de,locator:U,operator:tt,type:f.literal("assertText")}),Sc=f.object({...C,expected:de,operator:tt,type:f.literal("assertUrl")}),kc=f.object({...C,expected:Ml,locator:U,operator:Wl,type:f.literal("assertCount")}),Ac=f.object({...C,expected:de,locator:U,operator:tt,type:f.literal("assertValue")}),wc=f.object({...C,attribute:f.string().min(1),expected:de,locator:U,operator:tt,type:f.literal("assertAttribute")}),bc=f.object({...C,locator:U,type:f.literal("assertEnabled")}),Nc=f.object({...C,locator:U,type:f.literal("assertDisabled")}),Rc=f.object({...C,expected:de,operator:tt,type:f.literal("assertTitle")}),Tc=f.object({...C,locator:U,type:f.literal("assertChecked")}),Lc=f.object({...C,locator:U,type:f.literal("assertNotChecked")}),Cc=f.object({...C,locator:U,type:f.literal("assertFocused")}),vc=f.object({...C,locator:U,type:f.literal("assertNotFocused")}),xc=f.discriminatedUnion("type",[Jl,Xl,Gl,Hl,Kl,Ql,Yl,Zl,yc,gc,hc,Sc,kc,Ac,wc,bc,Nc,ec,tc,nc,rc,oc,ac,ic,sc,lc,cc,dc,pc,uc,mc,fc,Rc,Tc,Lc,Cc,vc]),Pc=f.object({entryNode:f.string().min(1),nodes:f.record(f.string(),xc),variableNamespaces:f.record(f.string(),f.string()).optional(),variables:f.record(f.string(),zl).optional(),version:f.literal(2)}),Ec=1,pe=".ripplo/ripplo.lock",Oc=ee.object({additionalChecks:ee.array(ee.string()),description:ee.string(),expectedOutcome:ee.string(),implemented:ee.boolean(),name:ee.string(),slug:ee.string(),spec:Pc,warnings:ee.array(ee.string())}),Uc=ee.object({graph:Bl,lockfileVersion:ee.number().int().positive(),tests:ee.array(Oc)})});function ho(e){return e.data}function So(e){return{as(t){return{data:{label:t,node:e}}}}}var Tt=g(()=>{"use strict"});function Lt(e){let t=e.getPreconditions(),n=e.getTests();Bc(n);let r=n.map(a=>Dc(a)),o=Fc(t,n);return{config:e.getConfig(),graph:o,tests:r}}function Bc(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 Dc(e){let t=e.id,{accessedKeys:n,vars:r}=ko(e.requiresKeys),o=e.startsAtFn==null?void 0:e.startsAtFn(r),a=e.stepsFn==null?[]:e.stepsFn(r),i=o==null?a:[Vc(o),...a],l=Wc(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 Vc(e){return So({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function ko(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 Wc(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]=qc(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,version:2}}function qc(e,t,n){let{label:r,node:o}=ho(e);return{...o,id:t,label:r,next:n}}function Fc(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=Mc(a.requires,e),{vars:l}=ko(a.requiresKeys),s=a.startsAtFn(l),c=zc(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,version:3}}function Mc(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 zc(e,t){let n=e.toSorted((r,o)=>r.localeCompare(o));return Jc(`${n.join("-")}-${t}`)}function Jc(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}var gn=g(()=>{"use strict";Tt()});var Ao=g(()=>{"use strict";gn();Tt()});import Xc from"path";import{createJiti as Gc}from"jiti";async function D(e){let t=Xc.join(e,".ripplo","index.ts");try{let r=await Gc(import.meta.url,{moduleCache:!1}).import(t),a=r!=null&&typeof r=="object"&&"default"in r?r.default:r,i=Lt(a);return{builder:a,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var ue=g(()=>{"use strict";Ao()});function Sn(e){return typeof e=="function"}function Kc(e){return De(e)?"array":typeof e}function hn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function bo(e,t){return e!=null&&typeof e=="object"&&t in e}function Qc(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function Zc(e,t){return Yc.call(e,t)}function td(e){return!Zc(ed,e)}function rd(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return nd[n]})}function ld(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(ad,2)),!De(_)||_.length!==2)throw new Error("Invalid tags: "+_);u=new RegExp(hn(_[0])+"\\s*"),d=new RegExp("\\s*"+hn(_[1])),m=new RegExp("\\s*"+hn("}"+_[1]))}h(t||se.tags);for(var k=new rt(e),S,A,w,x,T,R;!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),td(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(sd)||"name",k.scan(od),A==="="?(w=k.scanUntil(No),k.scan(No),k.scanUntil(d)):A==="{"?(w=k.scanUntil(m),k.scan(id),k.scanUntil(d),A="&"):w=k.scanUntil(d),!k.scan(d))throw new Error("Unclosed tag at "+k.pos);if(A==">"?T=[A,w,S,k.pos,s,c,n]:T=[A,w,S,k.pos],c++,o.push(T),A==="#"||A==="^")r.push(T);else if(A==="/"){if(R=r.pop(),!R)throw new Error('Unopened section "'+w+'" at '+S);if(R[1]!==w)throw new Error('Unclosed section "'+R[1]+'" at '+S)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&h(w)}if(p(),R=r.pop(),R)throw new Error('Unclosed section "'+R[1]+'" at '+k.pos);return dd(cd(o))}function cd(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 dd(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 Be(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 Hc,De,Yc,ed,nd,od,ad,No,id,sd,se,nt,Ro,To=g(()=>{"use strict";Hc=Object.prototype.toString,De=Array.isArray||function(t){return Hc.call(t)==="[object Array]"};Yc=RegExp.prototype.test;ed=/\S/;nd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};od=/\s*/,ad=/\s+/,No=/\s*=/,id=/\s*\}/,sd=/#|\^|\/|>|\{|&|=|!/;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};Be.prototype.push=function(t){return new Be(t,this)};Be.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=bo(a,i[l])||Qc(a,i[l])),a=a[i[l++]];else a=o.view[t],s=bo(o.view,t);if(s){r=a;break}o=o.parent}n[t]=r}return Sn(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||se.tags).join(":"),a=typeof r<"u",i=a?r.get(o):void 0;return i==null&&(i=ld(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 Be?n:new Be(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(De(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(Sn(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||De(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(`
4
5
  `),i=0;i<a.length;i++)a[i].length&&(i>0||!r)&&(a[i]=o+a[i]);return a.join(`
5
- `)};F.prototype.renderPartial=function(t,n,r,o){if(r){var a=this.getConfigTags(o),i=Xt(r)?r(t[1]):r[t[1]];if(i!=null){var l=t[6],s=t[5],d=t[4],p=i;s==0&&d&&(p=this.indentPartial(i,d,l));var u=this.parse(p,a);return this.renderTokens(u,n,r,p,o)}}};F.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};F.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||Z.escape,a=n.lookup(t[1]);if(a!=null)return typeof a=="number"&&o===Z.escape?String(a):o(a)};F.prototype.rawValue=function(t){return t[1]};F.prototype.getConfigTags=function(t){return Te(t)?t:t&&typeof t=="object"?t.tags:void 0};F.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Te(t))return t.escape};Z={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){Ve.templateCache=e},get templateCache(){return Ve.templateCache}},Ve=new F;Z.clearCache=function(){return Ve.clearCache()};Z.parse=function(t,n){return Ve.parse(t,n)};Z.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+dl(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Ve.render(t,n,r,o)};Z.escape=gl;Z.Scanner=We;Z.Context=Ne;Z.Writer=F;Gr=Z});function qe({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,bl({def:n,name:t})]))}function bl({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??Tl[e.type]??""}function Fe({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 J({ref:e,variables:t}){let n=String(Fe({ref:e,variables:t}));return Gt({raw:n,variables:t})}function Gt({raw:e,variables:t}){return Gr.render(e,t,{},{escape:n=>n})}function Ht({ref:e,variables:t}){let n=Fe({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 be({name:e,store:t,value:n}){return{...t,[e]:n}}var Tl,le=y(()=>{"use strict";Hr();Tl={boolean:!1,number:0,string:""}});function _({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Kr(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Kr(e.name,n)})}}function Kr(e,t){return t==null?e:Gt({raw:e,variables:t})}var Le=y(()=>{"use strict";le()});async function Qr({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 Yr({node:e,page:t,timeout:n}){await _({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Zr({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 eo({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=J({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:be({name:e.variable,store:n,value:r})}}async function to({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var no=y(()=>{"use strict";Le();le()});async function Kt({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 Cl({node:e,page:t,timeout:n,variables:r});case"rightClick":return await Yr({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=J({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 xl({node:e,page:t,timeout:n,variables:r});case"select":return Pl({node:e,page:t,timeout:n,variables:r});case"type":return El({node:e,page:t,timeout:n,variables:r});case"press":return await vl({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Qr({node:e,page:t,timeout:n}),{variables:r};case"upload":return Ol({node:e,page:t,timeout:n,variables:r});case"extractText":return Ul({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=Fe({ref:e.value,variables:r});return{variables:be({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 Zr({node:e,page:t,variables:r});case"clipboard":return eo({node:e,page:t,variables:r});case"setPermission":return await to({node:e,page:t}),{variables:r}}}async function Cl({node:e,page:t,timeout:n,variables:r}){return await _({locator:e.locator,page:t,variables:r})[Ll[e.type]]({timeout:n}),{variables:r}}async function vl({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 xl({node:e,page:t,timeout:n,variables:r}){let o=J({ref:e.value,variables:r});return await _({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Pl({node:e,page:t,timeout:n,variables:r}){let o=J({ref:e.value,variables:r});return await _({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function El({node:e,page:t,timeout:n,variables:r}){let o=J({ref:e.value,variables:r});return await _({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Ol({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 Ul({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:be({name:e.variable,store:r,value:o})}}var Ll,Qt=y(()=>{"use strict";no();Le();le();Ll={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function de({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"}),Il(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 _l(e){return"locator"in e}async function Il(e){return(await Promise.all(e.map(n=>jl(n)))).filter(n=>n!=null)}async function jl(e){if(!_l(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 it({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(!$l(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 $l(e){return"locator"in e&&e.locator!=null}var Me=y(()=>{"use strict";Le()});import{z as Bl}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=Bl.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 b(e){let t=e.specNode==null?[]:it({node:e.specNode,page:e.page}),n=await de({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(`
6
- `):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:a}}var x=y(()=>{"use strict";Me()});import{z as ro}from"zod";var Dl,oo,ao=y(()=>{"use strict";x();Dl=ro.object({selector:ro.string().describe("CSS selector for the checkbox or radio button")}),oo=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:Dl,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 b({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 io}from"zod";var Vl,so,lo=y(()=>{"use strict";x();Vl=io.object({selector:io.string().describe("CSS selector for the element to check focus on")}),so=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:Vl,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 b({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 Yt}from"zod";var Wl,co,po=y(()=>{"use strict";x();Wl=Yt.object({expected:Yt.string().describe("The expected text content"),selector:Yt.string().describe("CSS selector for the element to check")}),co=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Wl,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 b({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 Zt}from"zod";function Fl({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 ql,uo,mo=y(()=>{"use strict";x();ql=Zt.object({expected:Zt.string().describe("Expected page title or substring"),operator:Zt.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),uo=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:ql,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=Fl({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 b({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 fo}from"zod";var Ml,yo,go=y(()=>{"use strict";x();Ml=fo.object({selector:fo.string().describe("CSS selector for the element to check")}),yo=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:Ml,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 b({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 ho}from"zod";var Jl,So,ko=y(()=>{"use strict";x();Jl=ho.object({selector:ho.string().describe("CSS selector for the checkbox to check")}),So=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:Jl,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),b({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 Ao}from"zod";var zl,wo,Ro=y(()=>{"use strict";x();zl=Ao.object({selector:Ao.string().describe("CSS selector for the input to clear")}),wo=R({description:"Clear the contents of an input field",name:"clear",schema:zl,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),b({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 No}from"zod";var Xl,To,bo=y(()=>{"use strict";x();Xl=No.object({selector:No.string().describe("CSS selector for the element to click")}),To=R({description:"Click an element matching the CSS selector",name:"click",schema:Xl,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),b({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 en}from"zod";var Gl,Lo,Co=y(()=>{"use strict";x();Gl=en.object({action:en.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:en.string().optional().describe("Text to write (required for write action)")}),Lo=R({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:Gl,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 b({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 b({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 st}from"zod";var vo,xo,Po=y(()=>{"use strict";vo=st.object({summary:st.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:st.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.")}),xo={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:{...st.toJSONSchema(vo,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=vo.parse(t),r={kind:"verdict",summary:n.summary,toolOutput:`Verdict: ${n.verdict}
7
- ${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as Eo}from"zod";var Hl,Oo,Uo=y(()=>{"use strict";x();Hl=Eo.object({selector:Eo.string().describe("CSS selector for the element to extract text from")}),Oo=R({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:Hl,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return b({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 tn}from"zod";var Kl,_o,Io=y(()=>{"use strict";x();Kl=tn.object({selector:tn.string().describe("CSS selector for the input element"),value:tn.string().describe("The text to type into the element")}),_o=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Kl,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),b({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 jo}from"zod";function Yl(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Ql,$o,Bo=y(()=>{"use strict";x();Ql=jo.object({level:jo.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),$o=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:Ql,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=>Yl(o)).join(`
6
+ `)};X.prototype.renderPartial=function(t,n,r,o){if(r){var a=this.getConfigTags(o),i=Sn(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)||se.escape,a=n.lookup(t[1]);if(a!=null)return typeof a=="number"&&o===se.escape?String(a):o(a)};X.prototype.rawValue=function(t){return t[1]};X.prototype.getConfigTags=function(t){return De(t)?t:t&&typeof t=="object"?t.tags:void 0};X.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!De(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 X;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 "'+Kc(t)+'" was given as the first argument for mustache#render(template, view, partials)');return nt.render(t,n,r,o)};se.escape=rd;se.Scanner=rt;se.Context=Be;se.Writer=X;Ro=se});function ot({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,ud({def:n,name:t})]))}function ud({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??pd[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 kn({raw:n,variables:t})}function kn({raw:e,variables:t}){return Ro.render(e,t,{},{escape:n=>n})}function An({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 Ve({name:e,store:t,value:n}){return{...t,[e]:n}}var pd,Se=g(()=>{"use strict";To();pd={boolean:!1,number:0,string:""}});function $({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Lo(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Lo(e.name,n)})}}function Lo(e,t){return t==null?e:kn({raw:e,variables:t})}var We=g(()=>{"use strict";Se()});async function Co({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 vo({node:e,page:t,timeout:n}){await $({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function xo({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 Po({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:Ve({name:e.variable,store:n,value:r})}}async function Eo({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Oo=g(()=>{"use strict";We();Se()});async function wn({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 fd({node:e,page:t,timeout:n,variables:r});case"rightClick":return await vo({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 gd({node:e,page:t,timeout:n,variables:r});case"select":return hd({node:e,page:t,timeout:n,variables:r});case"type":return Sd({node:e,page:t,timeout:n,variables:r});case"press":return await yd({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Co({node:e,page:t,timeout:n}),{variables:r};case"upload":return kd({node:e,page:t,timeout:n,variables:r});case"extractText":return Ad({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=at({ref:e.value,variables:r});return{variables:Ve({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 xo({node:e,page:t,variables:r});case"clipboard":return Po({node:e,page:t,variables:r});case"setPermission":return await Eo({node:e,page:t}),{variables:r}}}async function fd({node:e,page:t,timeout:n,variables:r}){return await $({locator:e.locator,page:t,variables:r})[md[e.type]]({timeout:n}),{variables:r}}async function yd({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 gd({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 hd({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 Sd({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 kd({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 Ad({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:Ve({name:e.variable,store:r,value:o})}}var md,bn=g(()=>{"use strict";Oo();We();Se();md={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"}),bd(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 wd(e){return"locator"in e}async function bd(e){return(await Promise.all(e.map(n=>Nd(n)))).filter(n=>n!=null)}async function Nd(e){if(!wd(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 Ct({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(!Rd(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 Rd(e){return"locator"in e&&e.locator!=null}var it=g(()=>{"use strict";We()});import{z as Td}from"zod";function N({description:e,execute:t,name:n,schema:r}){let o=Td.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?[]:Ct({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=g(()=>{"use strict";it()});import{z as Uo}from"zod";var Ld,_o,Io=g(()=>{"use strict";O();Ld=Uo.object({selector:Uo.string().describe("CSS selector for the checkbox or radio button")}),_o=N({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:Ld,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 jo}from"zod";var Cd,$o,Bo=g(()=>{"use strict";O();Cd=jo.object({selector:jo.string().describe("CSS selector for the element to check focus on")}),$o=N({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:Cd,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 Nn}from"zod";var vd,Do,Vo=g(()=>{"use strict";O();vd=Nn.object({expected:Nn.string().describe("The expected text content"),selector:Nn.string().describe("CSS selector for the element to check")}),Do=N({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:vd,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 Rn}from"zod";function Pd({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 xd,Wo,qo=g(()=>{"use strict";O();xd=Rn.object({expected:Rn.string().describe("Expected page title or substring"),operator:Rn.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),Wo=N({description:"Assert that the page title matches an expected value",name:"assert_title",schema:xd,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=Pd({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 Fo}from"zod";var Ed,Mo,zo=g(()=>{"use strict";O();Ed=Fo.object({selector:Fo.string().describe("CSS selector for the element to check")}),Mo=N({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:Ed,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 Jo}from"zod";var Od,Xo,Go=g(()=>{"use strict";O();Od=Jo.object({selector:Jo.string().describe("CSS selector for the checkbox to check")}),Xo=N({description:"Check a checkbox matching the CSS selector",name:"check",schema:Od,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 Ho}from"zod";var Ud,Ko,Qo=g(()=>{"use strict";O();Ud=Ho.object({selector:Ho.string().describe("CSS selector for the input to clear")}),Ko=N({description:"Clear the contents of an input field",name:"clear",schema:Ud,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 Yo}from"zod";var _d,Zo,ea=g(()=>{"use strict";O();_d=Yo.object({selector:Yo.string().describe("CSS selector for the element to click")}),Zo=N({description:"Click an element matching the CSS selector",name:"click",schema:_d,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 Tn}from"zod";var Id,ta,na=g(()=>{"use strict";O();Id=Tn.object({action:Tn.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Tn.string().optional().describe("Text to write (required for write action)")}),ta=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:Id,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 vt}from"zod";var ra,oa,aa=g(()=>{"use strict";ra=vt.object({summary:vt.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:vt.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.")}),oa={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:{...vt.toJSONSchema(ra,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=ra.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 ia}from"zod";var jd,sa,la=g(()=>{"use strict";O();jd=ia.object({selector:ia.string().describe("CSS selector for the element to extract text from")}),sa=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:jd,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 Ln}from"zod";var $d,ca,da=g(()=>{"use strict";O();$d=Ln.object({selector:Ln.string().describe("CSS selector for the input element"),value:Ln.string().describe("The text to type into the element")}),ca=N({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:$d,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 pa}from"zod";function Dd(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Bd,ua,ma=g(()=>{"use strict";O();Bd=pa.object({level:pa.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:Bd,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=>Dd(o)).join(`
8
9
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
9
- ${r}`}}})});import{z as Do}from"zod";var nn,Zl,Vo,Wo=y(()=>{"use strict";x();nn=50,Zl=Do.object({urlFilter:Do.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),Vo=R({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:Zl,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(-nn),a=o.map(l=>{let s=l.statusCode==null?"pending":String(l.statusCode),d=l.responseHeaders["content-type"]??"";return`${l.method} ${s} ${l.url} [${d}]`}).join(`
10
- `),i=r.length>nn?`
11
- (showing last ${String(nn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${i}
12
- ${a}`}}})});import{z as qo}from"zod";var ed,Fo,Mo=y(()=>{"use strict";x();ed=qo.object({urlPattern:qo.string().describe("Regex pattern to match the request URL")}),Fo=R({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:ed,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,d])=>` ${s}: ${d}`).join(`
10
+ ${r}`}}})});import{z as fa}from"zod";var Cn,Vd,ya,ga=g(()=>{"use strict";O();Cn=50,Vd=fa.object({urlFilter:fa.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),ya=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:Vd,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(-Cn),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>Cn?`
12
+ (showing last ${String(Cn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${i}
13
+ ${a}`}}})});import{z as ha}from"zod";var Wd,Sa,ka=g(()=>{"use strict";O();Wd=ha.object({urlPattern:ha.string().describe("Regex pattern to match the request URL")}),Sa=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:Wd,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(`
13
14
  `),l=o.responseBody??"(no body captured)";return{specNode:void 0,stepResult:void 0,toolOutput:`${o.method} ${a} ${o.url}
14
15
 
15
16
  Response Headers:
16
17
  ${i}
17
18
 
18
19
  Body:
19
- ${l}`}}})});import{z as Jo}from"zod";var td,zo,Xo=y(()=>{"use strict";x();td=Jo.object({selector:Jo.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),zo=R({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:td,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 nd}from"zod";var rd,Go,Ho=y(()=>{"use strict";x();rd=nd.object({}),Go=R({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:rd,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 Aa}from"zod";var qd,wa,ba=g(()=>{"use strict";O();qd=Aa.object({selector:Aa.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:qd,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 Fd}from"zod";var Md,Na,Ra=g(()=>{"use strict";O();Md=Fd.object({}),Na=N({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:Md,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
21
  Title: ${o}
21
22
 
22
- ${n??""}`}}})});import{z as od}from"zod";var ad,Ko,Qo=y(()=>{"use strict";x();ad=od.object({}),Ko=R({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:ad,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 zd}from"zod";var Jd,Ta,La=g(()=>{"use strict";O();Jd=zd.object({}),Ta=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:Jd,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
24
  ${r}`).join(`
24
25
 
25
26
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(e.monitor.pageErrors.length)} page errors:
26
27
 
27
- ${n}`}}})});import{z as Yo}from"zod";async function sd(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
28
+ ${n}`}}})});import{z as Ca}from"zod";async function Gd(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
28
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)})
29
30
  ${n.join(`
30
- `)}`}async function Zo(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
31
- ${String(n)}`}var id,ea,ta=y(()=>{"use strict";x();id=Yo.object({type:Yo.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),ea=R({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:id,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await sd(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await Zo(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await Zo(e.page,"sessionStorage")]:[]].join(`
31
+ `)}`}async function va(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
+ ${String(n)}`}var Xd,xa,Pa=g(()=>{"use strict";O();Xd=Ca.object({type:Ca.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),xa=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:Xd,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await Gd(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await va(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await va(e.page,"sessionStorage")]:[]].join(`
32
33
 
33
- `)})})});import{z as rn}from"zod";var ld,na,ra=y(()=>{"use strict";x();ld=rn.object({action:rn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:rn.string().optional().describe("Text to enter for prompt dialogs")}),na=R({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:ld,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 b({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 oa}from"zod";var dd,aa,ia=y(()=>{"use strict";x();dd=oa.object({selector:oa.string().describe("CSS selector for the element to hover over")}),aa=R({description:"Hover over an element matching the CSS selector",name:"hover",schema:dd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),b({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 on}from"zod";var cd,sa,la=y(()=>{"use strict";x();cd=on.object({permission:on.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:on.enum(["granted","prompt"]).describe("Permission state to set")}),sa=R({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:cd,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 b({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 da}from"zod";var pd,ca,pa=y(()=>{"use strict";x();pd=da.object({url:da.string().describe("The URL to navigate to")}),ca=R({description:"Navigate the browser to a URL",name:"navigate",schema:pd,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 b({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 ua}from"zod";var ud,ma,fa=y(()=>{"use strict";x();ud=ua.object({key:ua.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),ma=R({description:"Press a keyboard key",name:"press",schema:ud,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 b({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 an}from"zod";var md,ya,ga=y(()=>{"use strict";x();md=an.object({height:an.number().int().positive().describe("Viewport height in pixels"),width:an.number().int().positive().describe("Viewport width in pixels")}),ya=R({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:md,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 b({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 ha}from"zod";var fd,Sa,ka=y(()=>{"use strict";x();fd=ha.object({selector:ha.string().describe("CSS selector for the element to right-click")}),Sa=R({description:"Right-click an element to open the context menu",name:"right_click",schema:fd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),b({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 Aa}from"zod";function gd(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var yd,wa,Ra=y(()=>{"use strict";x();yd=Aa.object({pattern:Aa.string().describe("Regex pattern to search console log messages")}),wa=R({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:yd,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=>gd(a)).join(`
34
+ `)})})});import{z as vn}from"zod";var Hd,Ea,Oa=g(()=>{"use strict";O();Hd=vn.object({action:vn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:vn.string().optional().describe("Text to enter for prompt dialogs")}),Ea=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:Hd,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 Ua}from"zod";var Kd,_a,Ia=g(()=>{"use strict";O();Kd=Ua.object({selector:Ua.string().describe("CSS selector for the element to hover over")}),_a=N({description:"Hover over an element matching the CSS selector",name:"hover",schema:Kd,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 xn}from"zod";var Qd,ja,$a=g(()=>{"use strict";O();Qd=xn.object({permission:xn.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:xn.enum(["granted","prompt"]).describe("Permission state to set")}),ja=N({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:Qd,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 Ba}from"zod";var Yd,Da,Va=g(()=>{"use strict";O();Yd=Ba.object({url:Ba.string().describe("The URL to navigate to")}),Da=N({description:"Navigate the browser to a URL",name:"navigate",schema:Yd,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 Wa}from"zod";var Zd,qa,Fa=g(()=>{"use strict";O();Zd=Wa.object({key:Wa.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),qa=N({description:"Press a keyboard key",name:"press",schema:Zd,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 Pn}from"zod";var ep,Ma,za=g(()=>{"use strict";O();ep=Pn.object({height:Pn.number().int().positive().describe("Viewport height in pixels"),width:Pn.number().int().positive().describe("Viewport width in pixels")}),Ma=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:ep,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 Ja}from"zod";var tp,Xa,Ga=g(()=>{"use strict";O();tp=Ja.object({selector:Ja.string().describe("CSS selector for the element to right-click")}),Xa=N({description:"Right-click an element to open the context menu",name:"right_click",schema:tp,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 Ha}from"zod";function rp(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var np,Ka,Qa=g(()=>{"use strict";O();np=Ha.object({pattern:Ha.string().describe("Regex pattern to search console log messages")}),Ka=N({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:np,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=>rp(a)).join(`
34
35
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
35
- ${o}`}}})});import{z as Na}from"zod";var hd,Ta,ba=y(()=>{"use strict";x();hd=Na.object({pattern:Na.string().describe("Regex pattern to search across network request URLs and response bodies")}),Ta=R({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:hd,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 Ya}from"zod";var op,Za,ei=g(()=>{"use strict";O();op=Ya.object({pattern:Ya.string().describe("Regex pattern to search across network request URLs and response bodies")}),Za=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:op,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
37
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching network entries:
37
- ${o}`}}})});import{z as La}from"zod";function wd({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),d=Math.min(t.length-1,l+e),p=t.slice(s,d+1).map((u,c)=>{let m=s+c+1;return`${s+c===l?">":" "} ${String(m)}: ${u}`}).join(`
38
- `);a.push(p)}),a}var Sd,kd,Ad,Ca,va=y(()=>{"use strict";x();Sd=20,kd=2,Ad=La.object({pattern:La.string().describe("Regex pattern to search for in the page HTML")}),Ca=R({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:Ad,execute:async(e,t)=>{let r=(await e.page.content()).split(`
39
- `),o=wd({contextLines:kd,lines:r,maxResults:Sd,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 ti}from"zod";function lp({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 ap,ip,sp,ni,ri=g(()=>{"use strict";O();ap=20,ip=2,sp=ti.object({pattern:ti.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:sp,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
+ `),o=lp({contextLines:ip,lines:r,maxResults:ap,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(`
40
41
  ---
41
- `)}}})});import{z as sn}from"zod";var Rd,xa,Pa=y(()=>{"use strict";x();Rd=sn.object({selector:sn.string().describe("CSS selector for the select element"),value:sn.string().describe("The option value to select")}),xa=R({description:"Select an option from a dropdown/select element",name:"select",schema:Rd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),b({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 Ea}from"zod";var Nd,Oa,Ua=y(()=>{"use strict";x();Nd=Ea.object({selector:Ea.string().describe("CSS selector for the checkbox to uncheck")}),Oa=R({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:Nd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),b({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 Je(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 c=new lt(u);o.set(u,c),n.push(c)}function l(u){let c=o.get(u.request());c!=null&&(o.delete(u.request()),c.applyResponse(u))}function s(u){r.push(`${u.message}
42
- ${u.stack??""}`)}function d(u){let c=u.failure(),m=new lt(u);m.responseBody=`(request failed: ${c?.errorText??"unknown"})`,n.push(m)}e.on("console",a),e.on("request",i),e.on("response",l),e.on("pageerror",s),e.on("requestfailed",d);function p(){e.off("console",a),e.off("request",i),e.off("response",l),e.off("pageerror",s),e.off("requestfailed",d)}return{consoleEntries:t,detach:p,networkEntries:n,pageErrors:r}}var lt,ln=y(()=>{"use strict";lt=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 Ia({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:a}){let i=Td.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 dn,Td,cn,_a,ja=y(()=>{"use strict";ao();lo();po();mo();go();ko();Ro();bo();Co();Po();Uo();Io();Bo();Wo();Mo();Xo();Ho();Qo();ta();ra();ia();la();pa();fa();ga();ka();Ra();ba();va();Pa();Ua();ln();dn=[ca,To,_o,ma,So,Oa,xa,aa,Go,Ca,wo,Sa,na,Lo,sa,yo,co,uo,oo,so,$o,Vo,Fo,Ko,zo,ea,wa,Ta,ya,Oo,xo],Td=new Map(dn.map(e=>[e.name,e])),cn=dn.map(e=>e.anthropicTool),_a=dn.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
43
- `)});import $a from"fs";import bd from"path";import pn from"pino";function un({filePath:e}){let t=bd.dirname(e);$a.mkdirSync(t,{recursive:!0}),$a.writeFileSync(e,"");let n=pn.destination({dest:e,sync:!0}),r=pn({level:"info"},n);w.info=r.info.bind(r),w.warn=r.warn.bind(r),w.error=r.error.bind(r),w.debug=r.debug.bind(r),w.fatal=r.fatal.bind(r),w.trace=r.trace.bind(r)}var w,M=y(()=>{"use strict";w=pn({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Ld from"@anthropic-ai/sdk";async function mn({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:a,serverUrl:i,spec:l,systemPrompt:s,token:d,workflowContext:p}){let u=new Ld({apiKey:"ripplo",baseURL:`${i}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${d}`,"x-run-id":a}}),c=performance.now(),m=Je(o);await Id({baseUrl:e,page:o});let g=Pd({extraVariables:n,spec:l}),S=Od({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:g,workflowContext:p}),h=Ud({baseUrl:e,spec:l,variables:g}),k=[{content:_d({page:o,startUrl:h}),role:"user"}],N=[],C=[],T={findings:"",stepIndex:0,verdict:void 0};T=await vd({client:u,messages:k,monitor:m,onStep:r,page:o,runStartTime:c,specNodes:C,state:T,steps:N,system:S}),T.verdict==null&&(T=await xd({client:u,messages:k,monitor:m,onStep:r,page:o,runStartTime:c,specNodes:C,state:T,steps:N,system:S}));let O=$d(C);return{findings:T.findings,generatedSpec:O,monitor:m,steps:N,verdict:T.verdict??"fail"}}function Da({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function vd({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:d}){let p=l;for(let u=0;u<Cd;u++){w.info("Agent iteration %d",u+1);let c=await e.messages.create({max_tokens:Ba,messages:t,model:"server-controlled",system:d,tools:cn}),m=await Va({messages:t,monitor:n,onStep:r,page:o,response:c,runStartTime:a,specNodes:i,stepIndex:p.stepIndex,steps:s});if(p=Da({result:m,state:p}),!m.continueLoop)break}return p}async function xd({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:a,specNodes:i,state:l,steps:s,system:d}){w.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:Ba,messages:t,model:"server-controlled",system:d,tool_choice:{name:"complete_test",type:"tool"},tools:cn}),u=await Va({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:a,specNodes:i,stepIndex:l.stepIndex,steps:s});return Da({result:u,state:l})}function Pd({extraVariables:e,spec:t}){let n=Ed(e,t?.variableNamespaces);return{...qe({defs:t?.variables}),...n}}function Ed(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 Od({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:a}){let i=a==null?"":[`
42
+ `)}}})});import{z as En}from"zod";var cp,oi,ai=g(()=>{"use strict";O();cp=En.object({selector:En.string().describe("CSS selector for the select element"),value:En.string().describe("The option value to select")}),oi=N({description:"Select an option from a dropdown/select element",name:"select",schema:cp,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 ii}from"zod";var dp,si,li=g(()=>{"use strict";O();dp=ii.object({selector:ii.string().describe("CSS selector for the checkbox to uncheck")}),si=N({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:dp,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 xt(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 xt(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 xt,On=g(()=>{"use strict";xt=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 di({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:a}){let i=pp.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 Un,pp,_n,ci,pi=g(()=>{"use strict";Io();Bo();Vo();qo();zo();Go();Qo();ea();na();aa();la();da();ma();ga();ka();ba();Ra();La();Pa();Oa();Ia();$a();Va();Fa();za();Ga();Qa();ei();ri();ai();li();On();Un=[Da,Zo,ca,qa,Xo,si,oi,_a,Na,ni,Ko,Xa,Ea,ta,ja,Mo,Do,Wo,_o,$o,ua,ya,Sa,Ta,wa,xa,Ka,Za,Ma,sa,oa],pp=new Map(Un.map(e=>[e.name,e])),_n=Un.map(e=>e.anthropicTool),ci=Un.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
+ `)});import ui from"fs";import up from"path";import In from"pino";function jn({filePath:e}){let t=up.dirname(e);ui.mkdirSync(t,{recursive:!0}),ui.writeFileSync(e,"");let n=In.destination({dest:e,sync:!0}),r=In({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=g(()=>{"use strict";b=In({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import mp from"@anthropic-ai/sdk";async function $n({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 mp({apiKey:"ripplo",baseURL:`${i}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":a}}),d=performance.now(),m=st(o);await bp({baseUrl:e,page:o});let h=hp({extraVariables:n,spec:l}),k=kp({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),S=Ap({baseUrl:e,spec:l,variables:h}),w=[{content:wp({page:o,startUrl:S}),role:"user"}],x=[],T=[],R={findings:"",stepIndex:0,verdict:void 0};R=await yp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:T,state:R,steps:x,system:k}),R.verdict==null&&(R=await gp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:T,state:R,steps:x,system:k}));let P=Rp(T);return{findings:R.findings,generatedSpec:P,monitor:m,steps:x,verdict:R.verdict??"fail"}}function fi({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function yp({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<fp;u++){b.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:mi,messages:t,model:"server-controlled",system:c,tools:_n}),m=await yi({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:a,specNodes:i,stepIndex:p.stepIndex,steps:s});if(p=fi({result:m,state:p}),!m.continueLoop)break}return p}async function gp({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:mi,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:_n}),u=await yi({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:a,specNodes:i,stepIndex:l.stepIndex,steps:s});return fi({result:u,state:l})}function hp({extraVariables:e,spec:t}){let n=Sp(e,t?.variableNamespaces);return{...ot({defs:t?.variables}),...n}}function Sp(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 kp({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:a}){let i=a==null?"":[`
44
45
 
45
46
  ## Workflow Under Test`,`**Name:** ${a.name}`,`**Description:** ${a.description}`,`**Expected Outcome:** ${a.expectedOutcome}`,`
46
47
  Focus your testing ONLY on this specific workflow. Do not test unrelated parts of the application.`].join(`
@@ -50,61 +51,61 @@ Reference workflow spec (the steps a user would follow):
50
51
  \`\`\`json
51
52
  ${JSON.stringify(n,null,2)}
52
53
  \`\`\``,s=t.map(m=>`- ${m}`).join(`
53
- `),d=t.length===0?"":`
54
+ `),c=t.length===0?"":`
54
55
 
55
56
  ## Setup Already Completed
56
57
  The following setup steps have already been run before your session started:
57
58
  ${s}
58
59
 
59
- Do not repeat any of these steps.`,p=Object.entries(o),u=p.map(([m,g])=>`- **${m}:** ${typeof g=="object"?JSON.stringify(g):String(g)}`).join(`
60
- `),c=p.length===0?"":`
60
+ Do not repeat any of these steps.`,p=Object.entries(o),u=p.map(([m,h])=>`- **${m}:** ${typeof h=="object"?JSON.stringify(h):String(h)}`).join(`
61
+ `),d=p.length===0?"":`
61
62
 
62
63
  ## Resolved Variables
63
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.",`
64
- ## Available Tools`,_a,i,d,l,c,`
65
+ ## Available Tools`,ci,i,c,l,d,`
65
66
  ## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
66
- `)}function Ud({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 _d({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 Id({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?(w.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function Va({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:a,specNodes:i,stepIndex:l,steps:s}){let d=o.content.filter(h=>h.type==="text").map(h=>h.text),p=o.content.filter(h=>h.type==="tool_use");if(p.length===0)return{continueLoop:!1,newFindings:d.join(`
67
- `),nextStepIndex:l,verdict:void 0};let u=[],c=l,m,g;for(let h of p){let A=await jd({block:h,monitor:t,onStep:n,page:r,runStartTime:a,specNodes:i,stepIndex:c,steps:s});u.push(A.toolResult),c=A.nextStepIndex,A.verdict!=null&&(m=A.verdict,g=A.summary)}e.push({content:o.content,role:"assistant"},{content:u,role:"user"});let S=g??d.join(`
68
- `);return{continueLoop:m==null&&o.stop_reason==="tool_use",newFindings:S,nextStepIndex:c,verdict:m}}async function jd({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:a,stepIndex:i,steps:l}){try{let s=await Ia({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:i}),d={content:s.toolOutput,tool_use_id:e.id,type:"tool_result"};return s.kind==="verdict"?(w.info(" [%d] %s \u2014 verdict: %s",i,e.name,s.verdict),{nextStepIndex:i,summary:s.summary,toolResult:d,verdict:s.verdict}):(s.specNode!=null&&a.push(s.specNode),s.stepResult!=null?(l.push(s.stepResult),n?.(s.stepResult),w.info(" [%d] %s \u2014 %s",i,e.name,s.stepResult.status),{nextStepIndex:i+1,summary:void 0,toolResult:d,verdict:void 0}):(w.info(" [%d] %s \u2014 info",i,e.name),{nextStepIndex:i,summary:void 0,toolResult:d,verdict:void 0}))}catch(s){let d=s instanceof Error?s.message:"Unknown error";w.error(" [%d] %s \u2014 error: %s",i,e.name,d);let p=await de({page:r,runStartTime:o,targets:[]}),u={annotations:p.annotations,assertions:[],detail:`Error: ${d}`,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: ${d}`,is_error:!0,tool_use_id:e.id,type:"tool_result"},verdict:void 0}}}function $d(e){if(e.length===0)return{entryNode:"",nodes:{},version:2};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,version:2}}var Cd,Ba,fn=y(()=>{"use strict";ja();M();Me();le();Cd=50,Ba=16384});function yn({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
67
+ `)}function Ap({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 wp({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 bp({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 yi({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 Np({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 Np({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:a,stepIndex:i,steps:l}){try{let s=await di({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 Rp(e){if(e.length===0)return{entryNode:"",nodes:{},version:2};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,version:2}}var fp,mi,Bn=g(()=>{"use strict";pi();G();it();Se();fp=50,mi=16384});function Dn({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
69
70
  ${e}`];t!=null&&t.length>0&&r.push(`## Output
70
71
  ${t}`),n!=null&&n.length>0&&r.push(`## Success Criteria
71
- ${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.',Bd({hasSuccessCriteria:n!=null&&n.length>0}),Dd({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.',Tp({hasSuccessCriteria:n!=null&&n.length>0}),Lp({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
72
73
  `)),r.join(`
73
74
 
74
- `)}function Bd({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 Dd({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 gn=y(()=>{"use strict"});import{execFile as Vd}from"child_process";import{createRequire as Wd}from"module";import Wa from"fs";import qa from"path";import{chromium as hn}from"playwright";async function ce({headed:e}){w.info("Browser executable: %s",hn.executablePath());try{return await hn.launch({headless:!e})}catch(t){throw qd(t)?new Error(`Playwright browsers are not installed. Run:
75
+ `)}function Tp({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 Lp({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 Vn=g(()=>{"use strict"});import{execFile as Cp}from"child_process";import{createRequire as vp}from"module";import gi from"fs";import hi from"path";import{chromium as Wn}from"playwright";async function Ae({headed:e}){b.info("Browser executable: %s",Wn.executablePath());try{return await Wn.launch({headless:!e})}catch(t){throw xp(t)?new Error(`Playwright browsers are not installed. Run:
75
76
 
76
77
  npx playwright install chromium
77
- `):t}}async function Sn(){let e=hn.executablePath();if(Wa.existsSync(e))return;w.info("Chromium not found. Installing via Playwright...");let t=Wd(import.meta.url),n=qa.dirname(t.resolve("playwright/package.json")),r=qa.join(n,"cli.js");if(await new Promise((o,a)=>{Vd(process.execPath,[r,"install","chromium"],i=>{if(i!=null){a(new Error(`Playwright install failed: ${i.message}`));return}o()})}),!Wa.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
78
+ `):t}}async function qn(){let e=Wn.executablePath();if(gi.existsSync(e))return;b.info("Chromium not found. Installing via Playwright...");let t=vp(import.meta.url),n=hi.dirname(t.resolve("playwright/package.json")),r=hi.join(n,"cli.js");if(await new Promise((o,a)=>{Cp(process.execPath,[r,"install","chromium"],i=>{if(i!=null){a(new Error(`Playwright install failed: ${i.message}`));return}o()})}),!gi.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
78
79
 
79
80
  npx playwright install chromium
80
- `);w.info("\u2713 Chromium installed")}function qd(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var ze=y(()=>{"use strict";M()});import{mkdir as kn,writeFile as te}from"fs/promises";import z from"path";async function dt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let a=z.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await kn(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([te(z.join(a,"info.json"),JSON.stringify(i,null,2)),te(z.join(a,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),Fd({context:e,page:t,stepDir:a})])}catch(a){let i=a instanceof Error?a.message:String(a);w.warn("Failed to write step debug data for step %d: %s",r,i)}}async function Fd({context:e,page:t,stepDir:n}){let[r,o,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),Md(t),Jd({context:e,page:t})]);await Promise.all([te(z.join(n,"dom.html"),r),te(z.join(n,"accessibility-tree.txt"),o),te(z.join(n,"storage.json"),JSON.stringify(a,null,2))])}async function Md(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Jd({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 ct({monitor:e,runId:t,steps:n,summary:r}){try{let o=z.join(process.cwd(),".ripplo","debug",t);await kn(o,{recursive:!0}),await Promise.all([te(z.join(o,"summary.txt"),zd({steps:n,summary:r})),te(z.join(o,"console.log"),Xd(e.consoleEntries)),te(z.join(o,"network.jsonl"),Gd(e.networkEntries)),te(z.join(o,"page-errors.log"),e.pageErrors.join(`
81
+ `);b.info("\u2713 Chromium installed")}function xp(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var lt=g(()=>{"use strict";G()});import{mkdir as Fn,writeFile as le}from"fs/promises";import K from"path";async function Pt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let a=K.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await Fn(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(K.join(a,"info.json"),JSON.stringify(i,null,2)),le(K.join(a,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),Pp({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 Pp({context:e,page:t,stepDir:n}){let[r,o,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),Ep(t),Op({context:e,page:t})]);await Promise.all([le(K.join(n,"dom.html"),r),le(K.join(n,"accessibility-tree.txt"),o),le(K.join(n,"storage.json"),JSON.stringify(a,null,2))])}async function Ep(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Op({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 Et({monitor:e,runId:t,steps:n,summary:r}){try{let o=K.join(process.cwd(),".ripplo","debug",t);await Fn(o,{recursive:!0}),await Promise.all([le(K.join(o,"summary.txt"),Up({steps:n,summary:r})),le(K.join(o,"console.log"),_p(e.consoleEntries)),le(K.join(o,"network.jsonl"),Ip(e.networkEntries)),le(K.join(o,"page-errors.log"),e.pageErrors.join(`
81
82
  ---
82
- `))]),w.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);w.warn("Failed to write run debug summary: %s",a)}}function zd({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(`
83
- `)}function Xd(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
84
- `)}function Gd(e){return e.map(t=>JSON.stringify(t)).join(`
85
- `)}async function Fa({error:e,runId:t,stack:n,workflowName:r}){try{let o=z.join(process.cwd(),".ripplo","debug",t);await kn(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 Up({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 _p(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
+ `)}function Ip(e){return e.map(t=>JSON.stringify(t)).join(`
86
+ `)}async function Si({error:e,runId:t,stack:n,workflowName:r}){try{let o=K.join(process.cwd(),".ripplo","debug",t);await Fn(o,{recursive:!0});let a=n==null?e:`${e}
86
87
 
87
88
  ${n}`,i=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
88
89
  ${n}`].join(`
89
- `);await Promise.all([te(z.join(o,"error.txt"),a),te(z.join(o,"summary.txt"),i)]),w.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);w.warn("Failed to write error debug artifacts: %s",a)}}var pt=y(()=>{"use strict";M()});async function An({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:a,serverUrl:i,spec:l,streaming:s,systemPrompt:d,token:p,workflowContext:u}){let c=await ce({headed:o}),m=await c.newContext({baseURL:e});t.length>0&&(await m.addCookies([...t]),w.info("Injected %d cookies from preconditions",t.length));let g=await m.newPage();try{let h=function(O){s.enqueueStep(O),s.flushSteps(),dt({context:m,page:g,runId:a,stepIndex:O.stepIndex,stepResult:O})};var S=h;let A=await mn({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:h,page:g,runId:a,serverUrl:i,spec:l,systemPrompt:d,token:p,workflowContext:u}),k=A.verdict==="pass"?"passed":"failed";await s.complete({statusOverride:k,steps:A.steps,summary:A.findings});let N=A.steps.filter(O=>O.status==="passed").length,C=A.steps.filter(O=>O.status==="failed").length,T={duration:A.steps.reduce((O,I)=>O+I.duration,0),failCount:C,passCount:N,runId:a,status:k,workflowName:u.name};await ct({monitor:A.monitor,runId:a,steps:A.steps,summary:T}),w.info("Agent test complete: %d passed, %d failed",N,C),w.info(`
90
+ `);await Promise.all([le(K.join(o,"error.txt"),a),le(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 Ot=g(()=>{"use strict";G()});async function Mn({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(),Pt({context:m,page:h,runId:a,stepIndex:P.stepIndex,stepResult:P})};var k=S;let A=await $n({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,T=A.steps.filter(P=>P.status==="failed").length,R={duration:A.steps.reduce((P,B)=>P+B.duration,0),failCount:T,passCount:x,runId:a,status:w,workflowName:u.name};await Et({monitor:A.monitor,runId:a,steps:A.steps,summary:R}),b.info("Agent test complete: %d passed, %d failed",x,T),b.info(`
90
91
  === Agent Summary ===
91
- %s`,A.findings)}finally{await c.close()}}var wn=y(()=>{"use strict";ze();fn();pt();M()});async function Rn({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return Xe({actual:o??"",expected:e,label:"Text",operator:n})}function ut({expected:e,operator:t,url:n}){return Xe({actual:n,expected:e,label:"URL",operator:t})}async function Nn({expected:e,locator:t,operator:n}){let r=await t.count();return Qa({actual:r,expected:e,label:"Count",operator:n})}async function Tn({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return Xe({actual:o,expected:e,label:"Value",operator:n})}async function bn({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 Ln({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 Ma({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let a=await n.getAttribute(e,{timeout:o});return Xe({actual:a??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Ja({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 za({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 Xa({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 Ga({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 Ha({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 Ka({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 Xe(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Hd(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Hd({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 Qa(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Kd(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Kd({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 Cn=y(()=>{"use strict"});async function q({fn:e,label:t}){let n=performance.now(),r=await e();return w.info("%s: %dms",t,Math.round(performance.now()-n)),r}var Ce=y(()=>{"use strict";M()});async function vn({headed:e,size:t}){let n=await q({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>ce({headed:e})))}),r=new Set,o=[];function a(){let s=n.pop();return s!=null?(r.add(s),Promise.resolve(s)):new Promise(d=>{o.push(p=>{r.add(p),d(p)})})}function i(s){if(r.delete(s),!s.isConnected()){w.warn("Released browser is disconnected, launching replacement"),ce({headed:e}).then(p=>{i(p)});return}let d=o.shift();if(d!=null){d(s);return}n.push(s)}async function l(){let s=[...n,...r];n.length=0,r.clear(),await Promise.allSettled(s.map(d=>d.close()))}return{acquire:a,closeAll:l,release:i}}var Ya=y(()=>{"use strict";ze();M();Ce()});import{print as Qd}from"graphql";async function $(e){let t=Qd(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(Yd)})}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(!Zd(a))throw new Error("Invalid GraphQL response");if(ec(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 Zd(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function ec(e){return Array.isArray(e.errors)&&e.errors.length>0}var Yd,Ge=y(()=>{"use strict";Yd=15e3});import{readdir as tc,rm as nc,stat as rc}from"fs/promises";import NS from"os";import ti from"path";import{graphql as oc}from"gql.tada";async function xn({maxRuns:e}){try{let n=(await tc(Za,{withFileTypes:!0})).filter(d=>d.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async d=>{let p=ti.join(Za,d.name),u=await rc(p);return{dirPath:p,mtime:u.mtimeMs}})),a=o.filter(d=>r-d.mtime>ei),l=o.filter(d=>r-d.mtime<=ei).toSorted((d,p)=>p.mtime-d.mtime).slice(e),s=[...a,...l];if(s.length===0)return;await Promise.allSettled(s.map(d=>nc(d.dirPath,{force:!0,recursive:!0}))),w.info("Pruned %d old debug run(s)",s.length)}catch{w.warn("Debug run pruning failed, ignoring")}}var Za,ei,vS,ni=y(()=>{"use strict";Ge();M();Za=ti.join(process.cwd(),".ripplo","debug"),ei=360*60*1e3,vS=oc(`
92
+ %s`,A.findings)}finally{await d.close()}}var zn=g(()=>{"use strict";lt();Bn();Ot();G()});async function Jn({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 Ut({expected:e,operator:t,url:n}){return ct({actual:n,expected:e,label:"URL",operator:t})}async function Xn({expected:e,locator:t,operator:n}){let r=await t.count();return Li({actual:r,expected:e,label:"Count",operator:n})}async function Gn({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 Hn({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 Kn({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 ki({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 Ai({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 bi({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 Ni({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 Ri({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 Ti({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=jp(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function jp({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 Li(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=$p(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function $p({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 Qn=g(()=>{"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 qe=g(()=>{"use strict";G()});async function Yn({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 Ci=g(()=>{"use strict";lt();G();qe()});import{print as Bp}from"graphql";async function W(e){let t=Bp(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(Dp)})}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(!Vp(a))throw new Error("Invalid GraphQL response");if(Wp(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 Vp(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function Wp(e){return Array.isArray(e.errors)&&e.errors.length>0}var Dp,dt=g(()=>{"use strict";Dp=15e3});import{readdir as qp,rm as Fp,stat as Mp}from"fs/promises";import UA from"os";import Pi from"path";import{graphql as zp}from"gql.tada";async function Zn({maxRuns:e}){try{let n=(await qp(vi,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=Pi.join(vi,c.name),u=await Mp(p);return{dirPath:p,mtime:u.mtimeMs}})),a=o.filter(c=>r-c.mtime>xi),l=o.filter(c=>r-c.mtime<=xi).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...a,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>Fp(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 vi,xi,BA,Ei=g(()=>{"use strict";dt();G();vi=Pi.join(process.cwd(),".ripplo","debug"),xi=360*60*1e3,BA=zp(`
92
93
  mutation RevokeCurrentCliToken {
93
94
  revokeCurrentCliToken
94
95
  }
95
- `)});async function Pn({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(ac)})}catch(t){let n=t instanceof Error?t.message:String(t);throw w.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(`
96
- `))}}var ac,En=y(()=>{"use strict";M();ac=5e3});import He from"fs";import On from"path";function Ke(e){let t=On.join(e,".ripplo",".token");if(!He.existsSync(t))return null;let n=He.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Un(e,t){let n=On.join(e,".ripplo");He.existsSync(n)||He.mkdirSync(n,{recursive:!0}),He.writeFileSync(On.join(n,".token"),t+`
97
- `)}var ri=y(()=>{"use strict"});import{z as ge}from"zod";var _n,In=y(()=>{"use strict";_n=ge.object({from:ge.string().min(1).describe("Key of the source state in the states record"),requiresKeys:ge.record(ge.string(),ge.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:ge.string().min(1).describe("Key of the target state in the states record"),workflow:ge.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 ve}from"zod";var jn,$n=y(()=>{"use strict";jn=ve.object({depends:ve.array(ve.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:ve.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:ve.array(ve.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 mt}from"zod";var Bn,Dn=y(()=>{"use strict";Bn=mt.object({preconditions:mt.array(mt.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:mt.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 he}from"zod";var oi,Vn=y(()=>{"use strict";In();$n();Dn();oi=he.object({edges:he.array(_n).describe("Directed edges between states, each executed by a workflow"),preconditions:he.record(he.string(),jn).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:he.record(he.string(),Bn).describe("States keyed by stable ID (kebab-case)"),version:he.literal(3).describe("Schema version, always 3")}).describe("Ripplo State Graph v3 \u2014 models application states, edges, and executable preconditions")});var ai=y(()=>{"use strict";Vn()});import{z as pe}from"zod";var ic,sc,v,Wn=y(()=>{"use strict";ic=pe.object({by:pe.literal("testId"),value:pe.string().min(1)}),sc=pe.object({by:pe.literal("role"),name:pe.string().optional(),role:pe.string().min(1)}),v=pe.discriminatedUnion("by",[ic,sc])});import{z as ii}from"zod";var ue,ft,qn=y(()=>{"use strict";ue=ii.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),ft=ii.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as D}from"zod";var lc,Fn,yt,G,gt,Mn=y(()=>{"use strict";lc=D.object({type:D.literal("static"),value:D.union([D.string(),D.number(),D.boolean()])}),Fn=D.object({name:D.string().min(1),type:D.literal("variable")}),yt=D.discriminatedUnion("type",[lc,Fn]),G=D.discriminatedUnion("type",[D.object({type:D.literal("static"),value:D.string()}),Fn]),gt=D.discriminatedUnion("type",[D.object({type:D.literal("static"),value:D.number().int().nonnegative()}),Fn])});import{z as H}from"zod";var ht,Jn=y(()=>{"use strict";ht=H.discriminatedUnion("type",[H.object({default:H.string().optional(),type:H.literal("string")}),H.object({default:H.number().optional(),type:H.literal("number")}),H.object({default:H.boolean().optional(),type:H.literal("boolean")}),H.object({key:H.string().min(1),type:H.literal("env")})])});import{z as f}from"zod";var L,dc,cc,pc,uc,mc,fc,yc,gc,hc,Sc,kc,Ac,wc,Rc,Nc,Tc,bc,Lc,Cc,vc,xc,Pc,Ec,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,Wc,qc,Fc,Mc,Jc,si,zn,Xn=y(()=>{"use strict";Wn();qn();Mn();Jn();Wn();qn();Mn();Jn();L={comment:f.string().optional(),id:f.string().min(1),label:f.string().optional(),next:f.string().optional(),timeout:f.number().int().positive().optional()},dc=f.object({...L,type:f.literal("goto"),url:G}),cc=f.object({...L,locator:v,type:f.literal("click")}),pc=f.object({...L,locator:v,type:f.literal("fill"),value:G}),uc=f.object({...L,locator:v,type:f.literal("select"),value:G}),mc=f.object({...L,locator:v,type:f.literal("hover")}),fc=f.object({...L,key:f.string().min(1),locator:v.optional(),type:f.literal("press")}),yc=f.object({...L,locator:v,type:f.literal("check")}),gc=f.object({...L,locator:v,type:f.literal("uncheck")}),hc=f.object({...L,height:f.number().int().positive(),type:f.literal("setViewport"),width:f.number().int().positive()}),Sc=f.object({...L,message:f.string().min(1),type:f.literal("fail")}),kc=f.object({...L,type:f.literal("setVariable"),value:yt,variable:f.string().min(1)}),Ac=f.object({...L,locator:v,type:f.literal("extractText"),variable:f.string().min(1)}),wc=f.object({...L,files:f.array(f.string()).min(1),locator:v,type:f.literal("upload")}),Rc=f.object({...L,locator:v,type:f.literal("dblclick")}),Nc=f.object({...L,source:v,target:v,type:f.literal("drag")}),Tc=f.object({...L,locator:v,type:f.literal("scrollIntoView")}),bc=f.object({...L,locator:v,type:f.literal("type"),value:G}),Lc=f.object({...L,locator:v,type:f.literal("focus")}),Cc=f.object({...L,locator:v,type:f.literal("clear")}),vc=f.object({...L,locator:v,type:f.literal("rightClick")}),xc=f.object({...L,action:f.enum(["accept","dismiss"]),promptText:f.string().optional(),type:f.literal("handleDialog")}),Pc=f.object({...L,action:f.enum(["read","write"]),type:f.literal("clipboard"),value:G.optional(),variable:f.string().min(1).optional()}),Ec=f.object({...L,permission:f.string().min(1),state:f.enum(["granted","prompt"]),type:f.literal("setPermission")}),Oc=f.object({...L,locator:v,type:f.literal("assertVisible")}),Uc=f.object({...L,locator:v,type:f.literal("assertNotVisible")}),_c=f.object({...L,expected:G,locator:v,operator:ue,type:f.literal("assertText")}),Ic=f.object({...L,expected:G,operator:ue,type:f.literal("assertUrl")}),jc=f.object({...L,expected:gt,locator:v,operator:ft,type:f.literal("assertCount")}),$c=f.object({...L,expected:G,locator:v,operator:ue,type:f.literal("assertValue")}),Bc=f.object({...L,attribute:f.string().min(1),expected:G,locator:v,operator:ue,type:f.literal("assertAttribute")}),Dc=f.object({...L,locator:v,type:f.literal("assertEnabled")}),Vc=f.object({...L,locator:v,type:f.literal("assertDisabled")}),Wc=f.object({...L,expected:G,operator:ue,type:f.literal("assertTitle")}),qc=f.object({...L,locator:v,type:f.literal("assertChecked")}),Fc=f.object({...L,locator:v,type:f.literal("assertNotChecked")}),Mc=f.object({...L,locator:v,type:f.literal("assertFocused")}),Jc=f.object({...L,locator:v,type:f.literal("assertNotFocused")}),si=f.discriminatedUnion("type",[dc,cc,pc,uc,mc,fc,yc,gc,Oc,Uc,_c,Ic,jc,$c,Bc,Dc,Vc,hc,Sc,kc,Ac,wc,Rc,Nc,Tc,bc,Lc,Cc,vc,xc,Pc,Ec,Wc,qc,Fc,Mc,Jc]),zn=f.object({entryNode:f.string().min(1),nodes:f.record(f.string(),si),variableNamespaces:f.record(f.string(),f.string()).optional(),variables:f.record(f.string(),ht).optional(),version:f.literal(2)})});function Gn(e){let t=zn.safeParse(e);return t.success?{data:t.data,success:!0}:{errors:t.error.issues.map(n=>({message:n.message,path:n.path.join(".")})),success:!1}}var li=y(()=>{"use strict";Xn()});var di=y(()=>{"use strict";In();Vn();ai();$n();Xn();Dn();li()});async function Hn({failFast:e,onStep:t,page:n,spec:r,variables:o}){let a=performance.now();return Gc({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:a,spec:r,variables:o})}function Xc({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Gc({currentId:e,failFast:t,onStep:n,page:r,runStartTime:o,spec:a,variables:i}){let l=[],s=i,d=e;for(;d!=null;){let p=a.nodes[d];if(p==null)throw new Error(`Node "${d}" not found in spec`);let u=d,c=p.label??`${p.type} (${d})`;w.info("Executing node: %s [%s]",c,p.type);let m=await Hc({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(Xc({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;d=p.next}return{steps:l,variables:s}}async function Hc({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let a=performance.now(),i=e.label??`${e.type} (${e.id})`,l=e.timeout??zc,s=it({node:e,page:n});try{let d=await Kc({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-a),u=d.assertions.some(m=>m.status==="failed"),c=await q({label:`Snapshot [${i}]`,fn:()=>de({page:n,runStartTime:r,targets:s})});return{annotations:c.annotations,assertions:d.assertions,detail:void 0,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:c.screenshotBase64,snapshotTimestamp:c.snapshotTimestamp,status:u?"failed":"passed",stepIndex:0,title:i,url:c.url,variables:d.variables,viewportHeight:c.viewportHeight,viewportWidth:c.viewportWidth}}catch(d){let p=Math.round(performance.now()-a),u=d instanceof Error?d.message:String(d),c=await q({label:`Snapshot [${i}] (error)`,fn:()=>de({page:n,runStartTime:r,targets:s})});return{annotations:c.annotations,assertions:[],detail:u,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:c.screenshotBase64,snapshotTimestamp:c.snapshotTimestamp,status:"failed",stepIndex:0,title:i,url:c.url,variables:o,viewportHeight:c.viewportHeight,viewportWidth:c.viewportWidth}}}async function Kc({node:e,page:t,timeout:n,variables:r}){if(Qc(e)){let a=await Kt({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:a.variables}}return{assertions:await Zc({node:e,page:t,timeout:n,variables:r}),variables:r}}function Qc(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 Yc(e){return e.type.startsWith("assert")}async function Zc({node:e,page:t,timeout:n,variables:r}){if(!Yc(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 tp({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let a=J({ref:o.expected,variables:r});return[await Rn({expected:a,locator:_({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertUrl":{let a=J({ref:o.expected,variables:r});return[ut({expected:a,operator:o.operator,url:t.url()})]}case"assertTitle":{let a=J({ref:o.expected,variables:r});return[ut({expected:a,operator:o.operator,url:await t.title()})]}case"assertCount":{let a=Ht({ref:o.expected,variables:r});return[await Nn({expected:a,locator:_({locator:o.locator,page:t,variables:r}),operator:o.operator})]}case"assertValue":{let a=J({ref:o.expected,variables:r});return[await Tn({expected:a,locator:_({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertAttribute":{let a=J({ref:o.expected,variables:r});return[await Ma({attribute:o.attribute,expected:a,locator:_({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function tp({assertNode:e,page:t,timeout:n,variables:r}){let o=ep[e.type];return[await o({locator:_({locator:e.locator,page:t,variables:r}),timeout:n})]}var zc,ep,Kn=y(()=>{"use strict";Qt();Cn();Le();M();Ce();Me();le();zc=1e4;ep={assertChecked:Xa,assertDisabled:za,assertEnabled:Ja,assertFocused:Ha,assertNotChecked:Ga,assertNotFocused:Ka,assertNotVisible:Ln,assertVisible:bn}});async function Qn({baseUrl:e,browser:t,cookies:n,extraVariables:r,onStep:o,runId:a,spec:i}){let l=await t.newContext({baseURL:e});w.info("Browser context created"),n.length>0&&await l.addCookies(n);let s=await l.newPage();w.info("Page created");let d=Je(s),p=[];function u(k){o?.(k),p.push(dt({context:l,page:s,runId:a,stepIndex:k.stepIndex,stepResult:k}))}let c=np(r,i.variableNamespaces),m={...qe({defs:i.variables}),...c};w.info("Starting graph execution (entry: %s)",i.entryNode);let g=await Hn({failFast:!0,onStep:u,page:s,spec:i,variables:m});await Promise.allSettled(p);let S=g.steps.filter(k=>k.status==="passed").length,h=g.steps.filter(k=>k.status==="failed").length,A={duration:g.steps.reduce((k,N)=>k+N.duration,0),failCount:h,passCount:S,runId:a,status:h>0?"failed":"passed",workflowName:""};return await ct({monitor:d,runId:a,steps:g.steps,summary:A}),await l.close(),g.steps}function np(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 Yn=y(()=>{"use strict";ln();pt();Kn();M();le()});var pi=at(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.timingSafeEqual=void 0;function ci(e,t=""){if(!e)throw new Error(t)}function rp(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)),ci(e instanceof DataView),ci(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}St.timingSafeEqual=rp});var fi=at(K=>{"use strict";var op=K&&K.__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(K,"__esModule",{value:!0});var j=256,Zn=(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,d=0,p=0,u=0;i<r-4;i+=4)s=this._decodeChar(t.charCodeAt(i+0)),d=this._decodeChar(t.charCodeAt(i+1)),p=this._decodeChar(t.charCodeAt(i+2)),u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=s<<2|d>>>4,o[a++]=d<<4|p>>>2,o[a++]=p<<6|u,l|=s&j,l|=d&j,l|=p&j,l|=u&j;if(i<r-1&&(s=this._decodeChar(t.charCodeAt(i)),d=this._decodeChar(t.charCodeAt(i+1)),o[a++]=s<<2|d>>>4,l|=s&j,l|=d&j),i<r-2&&(p=this._decodeChar(t.charCodeAt(i+2)),o[a++]=d<<4|p>>>2,l|=p&j),i<r-3&&(u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=p<<6|u,l|=u&j),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=j;return n+=(42-t&t-44)>>>8&-j+t-43+62,n+=(46-t&t-48)>>>8&-j+t-47+63,n+=(47-t&t-58)>>>8&-j+t-48+52,n+=(64-t&t-91)>>>8&-j+t-65+0,n+=(96-t&t-123)>>>8&-j+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})();K.Coder=Zn;var Qe=new Zn;function ap(e){return Qe.encode(e)}K.encode=ap;function ip(e){return Qe.decode(e)}K.decode=ip;var ui=(function(e){op(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=j;return r+=(44-n&n-46)>>>8&-j+n-45+62,r+=(94-n&n-96)>>>8&-j+n-95+63,r+=(47-n&n-58)>>>8&-j+n-48+52,r+=(64-n&n-91)>>>8&-j+n-65+0,r+=(96-n&n-123)>>>8&-j+n-97+26,r},t})(Zn);K.URLSafeCoder=ui;var mi=new ui;function sp(e){return mi.encode(e)}K.encodeURLSafe=sp;function lp(e){return mi.decode(e)}K.decodeURLSafe=lp;K.encodedLength=function(e){return Qe.encodedLength(e)};K.maxDecodedLength=function(e){return Qe.maxDecodedLength(e)};K.decodedLength=function(e){return Qe.decodedLength(e)}});var gi=at((yi,kt)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof kt=="object"&&typeof kt.exports=="object"?kt.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(yi,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,c,m,g,S){for(var h,A,k,N,C,T,O,I,P,B,Be,De,ot;S>=64;){for(h=c[0],A=c[1],k=c[2],N=c[3],C=c[4],T=c[5],O=c[6],I=c[7],B=0;B<16;B++)Be=g+B*4,u[B]=(m[Be]&255)<<24|(m[Be+1]&255)<<16|(m[Be+2]&255)<<8|m[Be+3]&255;for(B=16;B<64;B++)P=u[B-2],De=(P>>>17|P<<15)^(P>>>19|P<<13)^P>>>10,P=u[B-15],ot=(P>>>7|P<<25)^(P>>>18|P<<14)^P>>>3,u[B]=(De+u[B-7]|0)+(ot+u[B-16]|0);for(B=0;B<64;B++)De=(((C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7))+(C&T^~C&O)|0)+(I+(t[B]+u[B]|0)|0)|0,ot=((h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10))+(h&A^h&k^A&k)|0,I=O,O=T,T=C,C=N+De|0,N=k,k=A,A=h,h=De+ot|0;c[0]+=h,c[1]+=A,c[2]+=k,c[3]+=N,c[4]+=C,c[5]+=T,c[6]+=O,c[7]+=I,g+=64,S-=64}return g}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 c=0;c<this.buffer.length;c++)this.buffer[c]=0;for(var c=0;c<this.temp.length;c++)this.temp[c]=0;this.reset()},u.prototype.update=function(c,m){if(m===void 0&&(m=c.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this.bytesHashed+=m,this.bufferLength>0){for(;this.bufferLength<64&&m>0;)this.buffer[this.bufferLength++]=c[g++],m--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(m>=64&&(g=n(this.temp,this.state,c,g,m),m%=64);m>0;)this.buffer[this.bufferLength++]=c[g++],m--;return this},u.prototype.finish=function(c){if(!this.finished){var m=this.bytesHashed,g=this.bufferLength,S=m/536870912|0,h=m<<3,A=m%64<56?64:128;this.buffer[g]=128;for(var k=g+1;k<A-8;k++)this.buffer[k]=0;this.buffer[A-8]=S>>>24&255,this.buffer[A-7]=S>>>16&255,this.buffer[A-6]=S>>>8&255,this.buffer[A-5]=S>>>0&255,this.buffer[A-4]=h>>>24&255,this.buffer[A-3]=h>>>16&255,this.buffer[A-2]=h>>>8&255,this.buffer[A-1]=h>>>0&255,n(this.temp,this.state,this.buffer,0,A),this.finished=!0}for(var k=0;k<8;k++)c[k*4+0]=this.state[k]>>>24&255,c[k*4+1]=this.state[k]>>>16&255,c[k*4+2]=this.state[k]>>>8&255,c[k*4+3]=this.state[k]>>>0&255;return this},u.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},u.prototype._saveState=function(c){for(var m=0;m<this.state.length;m++)c[m]=this.state[m]},u.prototype._restoreState=function(c,m){for(var g=0;g<this.state.length;g++)this.state[g]=c[g];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},u})();e.Hash=r;var o=(function(){function u(c){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(c.length>this.blockSize)new r().update(c).finish(m).clean();else for(var g=0;g<c.length;g++)m[g]=c[g];for(var g=0;g<m.length;g++)m[g]^=54;this.inner.update(m);for(var g=0;g<m.length;g++)m[g]^=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 g=0;g<m.length;g++)m[g]=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 c=0;c<this.istate.length;c++)this.ostate[c]=this.istate[c]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(c){return this.inner.update(c),this},u.prototype.finish=function(c){return this.outer.finished?this.outer.finish(c):(this.inner.finish(c),this.outer.update(c,this.digestLength).finish(c)),this},u.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},u})();e.HMAC=o;function a(u){var c=new r().update(u),m=c.digest();return c.clean(),m}e.hash=a,e.default=a;function i(u,c){var m=new o(u).update(c),g=m.digest();return m.clean(),g}e.hmac=i;function l(u,c,m,g){var S=g[0];if(S===0)throw new Error("hkdf: cannot expand more");c.reset(),S>1&&c.update(u),m&&c.update(m),c.update(g),c.finish(u),g[0]++}var s=new Uint8Array(e.digestLength);function d(u,c,m,g){c===void 0&&(c=s),g===void 0&&(g=32);for(var S=new Uint8Array([1]),h=i(c,u),A=new o(h),k=new Uint8Array(A.digestLength),N=k.length,C=new Uint8Array(g),T=0;T<g;T++)N===k.length&&(l(k,A,m,S),N=0),C[T]=k[N++];return A.clean(),k.fill(0),S.fill(0),C}e.hkdf=d;function p(u,c,m,g){for(var S=new o(u),h=S.digestLength,A=new Uint8Array(4),k=new Uint8Array(h),N=new Uint8Array(h),C=new Uint8Array(g),T=0;T*h<g;T++){var O=T+1;A[0]=O>>>24&255,A[1]=O>>>16&255,A[2]=O>>>8&255,A[3]=O>>>0&255,S.reset(),S.update(c),S.update(A),S.finish(N);for(var I=0;I<h;I++)k[I]=N[I];for(var I=2;I<=m;I++){S.reset(),S.update(N).finish(N);for(var P=0;P<h;P++)k[P]^=N[P]}for(var I=0;I<h&&T*h+I<g;I++)C[T*h+I]=k[I]}for(var T=0;T<h;T++)k[T]=N[T]=0;for(var T=0;T<4;T++)A[T]=0;return S.clean(),C}e.pbkdf2=p})});var tr=at(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.Webhook=xe.WebhookVerificationError=void 0;var dp=pi(),hi=fi(),cp=gi(),Si=300,er=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},me=class e extends er{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};xe.WebhookVerificationError=me;var At=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=hi.decode(t)}}verify(t,n){let r={};for(let c of Object.keys(n))r[c.toLowerCase()]=n[c];let o=r["webhook-id"],a=r["webhook-signature"],i=r["webhook-timestamp"];if(!a||!o||!i)throw new me("Missing required headers");let l=this.verifyTimestamp(i),d=this.sign(o,l,t).split(",")[1],p=a.split(" "),u=new globalThis.TextEncoder;for(let c of p){let[m,g]=c.split(",");if(m==="v1"&&(0,dp.timingSafeEqual)(u.encode(g),u.encode(d)))return JSON.parse(t.toString())}throw new me("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,${hi.encode(cp.hmac(this.key,i))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new me("Invalid Signature Headers");if(n-r>Si)throw new me("Message timestamp too old");if(r>n+Si)throw new me("Message timestamp too new");return new Date(r*1e3)}};xe.Webhook=At;At.prefix="whsec_"});import ki from"crypto";function Pe({body:e,secret:t}){let n=new Ai.Webhook(t),r=`msg_${ki.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 nr(){return`whsec_${ki.randomBytes(24).toString("base64")}`}var Ai,rr=y(()=>{"use strict";Ai=Jr(tr(),1)});import{parseSetCookie as pp}from"set-cookie-parser";import{z as Q}from"zod";async function or({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(d=>d.workflowSlug===r);if(i?.sourceState==null)return o;let l=Ni({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),s=i.sourceState.preconditions;return s.length===0?{...o,apiUrl:l}:l==null?o:Ri({apiUrl:l,preconditionNames:s,webhookSecret:n})}async function ar({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",...gp({cookies:t}),...Pe({body:a,secret:o})},method:"PUT",signal:AbortSignal.timeout(wi)});i.ok||w.error("Teardown returned %s",String(i.status))}catch{w.error("Teardown request failed")}}async function Ri({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",...Pe({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(wi)});if(!a.ok){let d=await fp(a);throw new Error(`execute-batch returned ${String(a.status)}: ${d}`)}let i=await a.json(),l=up.safeParse(i);if(!l.success)throw new Error(`execute-batch response has invalid shape: ${l.error.message}`);if(!l.data.success){let d=l.data.error??"no error detail";throw new Error(`Precondition batch failed: ${d}`)}let s=hp({domain:new URL(e).hostname,res:a});return w.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 fp(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=yp(t),r=n==null?null:mp.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function yp(e){try{return JSON.parse(e)}catch{return null}}function gp({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function hp({domain:e,res:t}){let n=t.headers.getSetCookie();return pp(n,{decodeValues:!1}).map(o=>Sp({cookie:o,domain:e}))}function Sp({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=Ap({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 Ap({raw:e}){return kp[e.toLowerCase()]??"Lax"}async function ir({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Ni({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Ri({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Ni({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var wi,up,mp,kp,sr=y(()=>{"use strict";M();rr();wi=3e4,up=Q.object({data:Q.record(Q.string(),Q.record(Q.string(),Q.string())),error:Q.string().optional(),executed:Q.array(Q.string()),runId:Q.string(),success:Q.boolean()});mp=Q.object({error:Q.string()});kp={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as lr}from"gql.tada";async function dr({agentProfileId:e,config:t,runId:n}){let r=await $({config:t,document:Rp,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(d){let p=wp({config:t,runResultId:o,steps:[d]}).catch(u=>{w.error(u,"Failed to submit step %d",d.stepIndex)});a.push(p)}async function l(){await Promise.all(a)}async function s({statusOverride:d,steps:p,summary:u}){await q({label:`flushSteps (${String(a.length)} steps)`,fn:()=>Promise.all(a)});let c=p.filter(h=>h.status==="passed").length,m=p.filter(h=>h.status==="failed").length,g=p.reduce((h,A)=>h+A.duration,0),S=d??(m>0?"failed":"passed");await q({label:"completeRun",fn:()=>$({config:t,document:Tp,variables:{duration:g,failCount:m,passCount:c,runResultId:o,status:S,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:i,flushSteps:l,runResultId:o}}async function wp({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 $({config:e,document:Np,variables:{runResultId:t,steps:r}})}var Rp,Np,Tp,cr=y(()=>{"use strict";Ge();M();Ce();Rp=lr(`
96
+ `)});async function er({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Jp)})}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 Jp,tr=g(()=>{"use strict";G();Jp=5e3});import pt from"fs";import nr from"path";function ut(e){let t=nr.join(e,".ripplo",".token");if(!pt.existsSync(t))return null;let n=pt.readFileSync(t,"utf8").trim();return n.length===0?null:n}function rr(e,t){let n=nr.join(e,".ripplo");pt.existsSync(n)||pt.mkdirSync(n,{recursive:!0}),pt.writeFileSync(nr.join(n,".token"),t+`
98
+ `)}var Oi=g(()=>{"use strict"});import{z as ve}from"zod";var or,ar=g(()=>{"use strict";or=ve.object({from:ve.string().min(1).describe("Key of the source state in the states record"),requiresKeys:ve.record(ve.string(),ve.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:ve.string().min(1).describe("Key of the target state in the states record"),workflow:ve.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 Fe}from"zod";var ir,sr=g(()=>{"use strict";ir=Fe.object({depends:Fe.array(Fe.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:Fe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Fe.array(Fe.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 _t}from"zod";var lr,cr=g(()=>{"use strict";lr=_t.object({preconditions:_t.array(_t.string().min(1)).describe("Ordered list of precondition names to satisfy before entering this state"),route:_t.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 xe}from"zod";var Ui,dr=g(()=>{"use strict";ar();sr();cr();Ui=xe.object({edges:xe.array(or).describe("Directed edges between states, each executed by a workflow"),preconditions:xe.record(xe.string(),ir).describe("Named preconditions keyed by name (e.g. 'auth:admin', 'data:three-projects'). States reference these by name."),states:xe.record(xe.string(),lr).describe("States keyed by stable ID (kebab-case)"),version:xe.literal(3).describe("Schema version, always 3")}).describe("Ripplo State Graph v3 \u2014 models application states, edges, and executable preconditions")});var _i=g(()=>{"use strict";dr()});import{z as we}from"zod";var Xp,Gp,E,pr=g(()=>{"use strict";Xp=we.object({by:we.literal("testId"),value:we.string().min(1)}),Gp=we.object({by:we.literal("role"),name:we.string().optional(),role:we.string().min(1)}),E=we.discriminatedUnion("by",[Xp,Gp])});import{z as Ii}from"zod";var be,It,ur=g(()=>{"use strict";be=Ii.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),It=Ii.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as M}from"zod";var Hp,mr,jt,te,$t,fr=g(()=>{"use strict";Hp=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),mr=M.object({name:M.string().min(1),type:M.literal("variable")}),jt=M.discriminatedUnion("type",[Hp,mr]),te=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),mr]),$t=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),mr])});import{z as ne}from"zod";var Bt,yr=g(()=>{"use strict";Bt=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 y}from"zod";var v,Kp,Qp,Yp,Zp,eu,tu,nu,ru,ou,au,iu,su,lu,cu,du,pu,uu,mu,fu,yu,gu,hu,Su,ku,Au,wu,bu,Nu,Ru,Tu,Lu,Cu,vu,xu,Pu,Eu,Ou,ji,gr,hr=g(()=>{"use strict";pr();ur();fr();yr();pr();ur();fr();yr();v={comment:y.string().optional(),id:y.string().min(1),label:y.string().optional(),next:y.string().optional(),timeout:y.number().int().positive().optional()},Kp=y.object({...v,type:y.literal("goto"),url:te}),Qp=y.object({...v,locator:E,type:y.literal("click")}),Yp=y.object({...v,locator:E,type:y.literal("fill"),value:te}),Zp=y.object({...v,locator:E,type:y.literal("select"),value:te}),eu=y.object({...v,locator:E,type:y.literal("hover")}),tu=y.object({...v,key:y.string().min(1),locator:E.optional(),type:y.literal("press")}),nu=y.object({...v,locator:E,type:y.literal("check")}),ru=y.object({...v,locator:E,type:y.literal("uncheck")}),ou=y.object({...v,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),au=y.object({...v,message:y.string().min(1),type:y.literal("fail")}),iu=y.object({...v,type:y.literal("setVariable"),value:jt,variable:y.string().min(1)}),su=y.object({...v,locator:E,type:y.literal("extractText"),variable:y.string().min(1)}),lu=y.object({...v,files:y.array(y.string()).min(1),locator:E,type:y.literal("upload")}),cu=y.object({...v,locator:E,type:y.literal("dblclick")}),du=y.object({...v,source:E,target:E,type:y.literal("drag")}),pu=y.object({...v,locator:E,type:y.literal("scrollIntoView")}),uu=y.object({...v,locator:E,type:y.literal("type"),value:te}),mu=y.object({...v,locator:E,type:y.literal("focus")}),fu=y.object({...v,locator:E,type:y.literal("clear")}),yu=y.object({...v,locator:E,type:y.literal("rightClick")}),gu=y.object({...v,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),hu=y.object({...v,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:te.optional(),variable:y.string().min(1).optional()}),Su=y.object({...v,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),ku=y.object({...v,locator:E,type:y.literal("assertVisible")}),Au=y.object({...v,locator:E,type:y.literal("assertNotVisible")}),wu=y.object({...v,expected:te,locator:E,operator:be,type:y.literal("assertText")}),bu=y.object({...v,expected:te,operator:be,type:y.literal("assertUrl")}),Nu=y.object({...v,expected:$t,locator:E,operator:It,type:y.literal("assertCount")}),Ru=y.object({...v,expected:te,locator:E,operator:be,type:y.literal("assertValue")}),Tu=y.object({...v,attribute:y.string().min(1),expected:te,locator:E,operator:be,type:y.literal("assertAttribute")}),Lu=y.object({...v,locator:E,type:y.literal("assertEnabled")}),Cu=y.object({...v,locator:E,type:y.literal("assertDisabled")}),vu=y.object({...v,expected:te,operator:be,type:y.literal("assertTitle")}),xu=y.object({...v,locator:E,type:y.literal("assertChecked")}),Pu=y.object({...v,locator:E,type:y.literal("assertNotChecked")}),Eu=y.object({...v,locator:E,type:y.literal("assertFocused")}),Ou=y.object({...v,locator:E,type:y.literal("assertNotFocused")}),ji=y.discriminatedUnion("type",[Kp,Qp,Yp,Zp,eu,tu,nu,ru,ku,Au,wu,bu,Nu,Ru,Tu,Lu,Cu,ou,au,iu,su,lu,cu,du,pu,uu,mu,fu,yu,gu,hu,Su,vu,xu,Pu,Eu,Ou]),gr=y.object({entryNode:y.string().min(1),nodes:y.record(y.string(),ji),variableNamespaces:y.record(y.string(),y.string()).optional(),variables:y.record(y.string(),Bt).optional(),version:y.literal(2)})});function Sr(e){let t=gr.safeParse(e);return t.success?{data:t.data,success:!0}:{errors:t.error.issues.map(n=>({message:n.message,path:n.path.join(".")})),success:!1}}var $i=g(()=>{"use strict";hr()});var Bi=g(()=>{"use strict";ar();dr();_i();sr();hr();cr();$i()});async function kr({failFast:e,onStep:t,page:n,spec:r,variables:o}){let a=performance.now();return Iu({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:a,spec:r,variables:o})}function _u({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Iu({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 ju({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(_u({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function ju({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let a=performance.now(),i=e.label??`${e.type} (${e.id})`,l=e.timeout??Uu,s=Ct({node:e,page:n});try{let c=await $u({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 $u({node:e,page:t,timeout:n,variables:r}){if(Bu(e)){let a=await wn({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:a.variables}}return{assertions:await Vu({node:e,page:t,timeout:n,variables:r}),variables:r}}function Bu(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 Du(e){return e.type.startsWith("assert")}async function Vu({node:e,page:t,timeout:n,variables:r}){if(!Du(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 qu({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let a=H({ref:o.expected,variables:r});return[await Jn({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[Ut({expected:a,operator:o.operator,url:t.url()})]}case"assertTitle":{let a=H({ref:o.expected,variables:r});return[Ut({expected:a,operator:o.operator,url:await t.title()})]}case"assertCount":{let a=An({ref:o.expected,variables:r});return[await Xn({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 Gn({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 ki({attribute:o.attribute,expected:a,locator:$({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function qu({assertNode:e,page:t,timeout:n,variables:r}){let o=Wu[e.type];return[await o({locator:$({locator:e.locator,page:t,variables:r}),timeout:n})]}var Uu,Wu,Ar=g(()=>{"use strict";bn();Qn();We();G();qe();it();Se();Uu=1e4;Wu={assertChecked:bi,assertDisabled:wi,assertEnabled:Ai,assertFocused:Ri,assertNotChecked:Ni,assertNotFocused:Ti,assertNotVisible:Kn,assertVisible:Hn}});async function wr({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(Pt({context:l,page:s,runId:a,stepIndex:w.stepIndex,stepResult:w}))}let d=Fu(r,i.variableNamespaces),m={...ot({defs:i.variables}),...d};b.info("Starting graph execution (entry: %s)",i.entryNode);let h=await kr({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 Et({monitor:c,runId:a,steps:h.steps,summary:A}),await l.close(),h.steps}function Fu(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 br=g(()=>{"use strict";On();Ot();Ar();G();Se()});var Vi=wt(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.timingSafeEqual=void 0;function Di(e,t=""){if(!e)throw new Error(t)}function Mu(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)),Di(e instanceof DataView),Di(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}Dt.timingSafeEqual=Mu});var Fi=wt(re=>{"use strict";var zu=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 V=256,Nr=(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})();re.Coder=Nr;var mt=new Nr;function Ju(e){return mt.encode(e)}re.encode=Ju;function Xu(e){return mt.decode(e)}re.decode=Xu;var Wi=(function(e){zu(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})(Nr);re.URLSafeCoder=Wi;var qi=new Wi;function Gu(e){return qi.encode(e)}re.encodeURLSafe=Gu;function Hu(e){return qi.decode(e)}re.decodeURLSafe=Hu;re.encodedLength=function(e){return mt.encodedLength(e)};re.maxDecodedLength=function(e){return mt.maxDecodedLength(e)};re.decodedLength=function(e){return mt.decodedLength(e)}});var zi=wt((Mi,Vt)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof Vt=="object"&&typeof Vt.exports=="object"?Vt.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Mi,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,T,R,P,B,_,q,Ze,et,At;k>=64;){for(S=d[0],A=d[1],w=d[2],x=d[3],T=d[4],R=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],At=(_>>>7|_<<25)^(_>>>18|_<<14)^_>>>3,u[q]=(et+u[q-7]|0)+(At+u[q-16]|0);for(q=0;q<64;q++)et=(((T>>>6|T<<26)^(T>>>11|T<<21)^(T>>>25|T<<7))+(T&R^~T&P)|0)+(B+(t[q]+u[q]|0)|0)|0,At=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&A^S&w^A&w)|0,B=P,P=R,R=T,T=x+et|0,x=w,w=A,A=S,S=et+At|0;d[0]+=S,d[1]+=A,d[2]+=w,d[3]+=x,d[4]+=T,d[5]+=R,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,T=new Uint8Array(h),R=0;R<h;R++)x===w.length&&(l(w,A,m,k),x=0),T[R]=w[x++];return A.clean(),w.fill(0),k.fill(0),T}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),T=new Uint8Array(h),R=0;R*S<h;R++){var P=R+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&&R*S+B<h;B++)T[R*S+B]=w[B]}for(var R=0;R<S;R++)w[R]=x[R]=0;for(var R=0;R<4;R++)A[R]=0;return k.clean(),T}e.pbkdf2=p})});var Tr=wt(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.Webhook=Me.WebhookVerificationError=void 0;var Ku=Vi(),Ji=Fi(),Qu=zi(),Xi=300,Rr=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 Rr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Me.WebhookVerificationError=Ne;var Wt=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=Ji.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,Ku.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,${Ji.encode(Qu.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>Xi)throw new Ne("Message timestamp too old");if(r>n+Xi)throw new Ne("Message timestamp too new");return new Date(r*1e3)}};Me.Webhook=Wt;Wt.prefix="whsec_"});import Gi from"crypto";function ze({body:e,secret:t}){let n=new Hi.Webhook(t),r=`msg_${Gi.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 Lr(){return`whsec_${Gi.randomBytes(24).toString("base64")}`}var Hi,Cr=g(()=>{"use strict";Hi=fo(Tr(),1)});import{parseSetCookie as Yu}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=Yi({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),s=i.sourceState.preconditions;return s.length===0?{...o,apiUrl:l}:l==null?o:Qi({apiUrl:l,preconditionNames:s,webhookSecret:n})}async function xr({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",...rm({cookies:t}),...ze({body:a,secret:o})},method:"PUT",signal:AbortSignal.timeout(Ki)});i.ok||b.error("Teardown returned %s",String(i.status))}catch{b.error("Teardown request failed")}}async function Qi({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(Ki)});if(!a.ok){let c=await tm(a);throw new Error(`execute-batch returned ${String(a.status)}: ${c}`)}let i=await a.json(),l=Zu.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=om({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 tm(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=nm(t),r=n==null?null:em.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function nm(e){try{return JSON.parse(e)}catch{return null}}function rm({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function om({domain:e,res:t}){let n=t.headers.getSetCookie();return Yu(n,{decodeValues:!1}).map(o=>am({cookie:o,domain:e}))}function am({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=sm({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 sm({raw:e}){return im[e.toLowerCase()]??"Lax"}async function Pr({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Yi({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Qi({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Yi({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var Ki,Zu,em,im,Er=g(()=>{"use strict";G();Cr();Ki=3e4,Zu=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()});em=oe.object({error:oe.string()});im={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as Or}from"gql.tada";async function Ur({agentProfileId:e,config:t,runId:n}){let r=await W({config:t,document:cm,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=lm({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:pm,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 lm({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:dm,variables:{runResultId:t,steps:r}})}var cm,dm,pm,_r=g(()=>{"use strict";dt();G();qe();cm=Or(`
98
99
  mutation StartRunCLI($runId: String!, $platform: String!, $agentProfileId: String) {
99
100
  startRun(runId: $runId, platform: $platform, agentProfileId: $agentProfileId) {
100
101
  id
101
102
  }
102
103
  }
103
- `),Np=lr(`
104
+ `),dm=Or(`
104
105
  mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
105
106
  submitRunSteps(runResultId: $runResultId, steps: $steps)
106
107
  }
107
- `),Tp=lr(`
108
+ `),pm=Or(`
108
109
  mutation CompleteRunCLI(
109
110
  $runResultId: String!
110
111
  $status: String!
@@ -127,14 +128,14 @@ ${n}`].join(`
127
128
  status
128
129
  }
129
130
  }
130
- `)});import{z as bp}from"zod";import{graphql as wt,readFragment as pr}from"gql.tada";async function mr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:a,preconditionNames:i,runId:l,webhookSecret:s,workflowId:d}){let p="unknown",u,c,m=!1;try{m=r==null,c=xp({externalBrowser:r,headed:a});let g=i==null?void 0:q({label:"Preconditions resolved",fn:()=>ir({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:i,webhookSecret:s})}),[{project:S,workflow:h},A]=await Promise.all([q({label:"Run context resolved",fn:()=>_p({config:o,workflowId:d})}),q({label:"Streaming run started",fn:()=>dr({agentProfileId:t,config:o,runId:l})}),Pn({appUrl:n})]);p=h.name,u=A;let k=jp(h.spec);w.info("Executing workflow: %s",h.name),await Dp(Ep({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:c,config:o,headed:a,ownsBrowser:m,preconditionPromise:g,project:S,runId:l,specData:k,streaming:u,webhookSecret:s,workflow:h}),Bp())}catch(g){throw await Pp({browserPromise:c,error:g,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),g}}function xp({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):q({label:"Browser launched",fn:()=>ce({headed:t})})}async function Pp({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 Fa({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 Ep({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:a,ownsBrowser:i,preconditionPromise:l,project:s,runId:d,specData:p,streaming:u,webhookSecret:c,workflow:m}){let g=l??q({label:"Preconditions resolved",fn:()=>or({baseUrl:n,project:s,webhookSecret:c,workflowSlug:m.slug})}),[S,h]=await Promise.all([g,r]);if(t!=null){i&&await h.close(),await Op({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:a,preconditionResult:S,runId:d,specData:p,streaming:u,webhookSecret:c,workflow:m});return}await Up({baseUrl:n,browser:h,preconditionResult:S,runId:d,specData:p,streaming:u,webhookSecret:c})}async function Op({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:a,runId:i,specData:l,streaming:s,webhookSecret:d,workflow:p}){let u=e!=null&&e.length>0?e:await Ip({config:r,profileId:t});await An({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 bi({preconditionResult:a,webhookSecret:d})}async function Up({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:a,webhookSecret:i}){let l=await q({label:"Spec executed",fn:()=>Qn({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:a.enqueueStep,runId:r,spec:o})});await bi({preconditionResult:n,webhookSecret:i}),await a.complete({statusOverride:void 0,steps:l,summary:void 0});let s=l.filter(p=>p.status==="passed").length,d=l.filter(p=>p.status==="failed").length;w.info("Run complete: %d passed, %d failed",s,d)}async function bi({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await ar({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function _p({config:e,workflowId:t}){let n=await $({config:e,document:Cp,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...pr(Ti,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},i=(o.workflows??[]).find(s=>pr(ur,s).id===t);if(i==null)throw new Error(`Workflow ${t} not found`);let l=pr(ur,i);return{project:o,workflow:l}}async function Ip({config:e,profileId:t}){let n=await $({config:e,document:vp,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 w.info("Using agent profile: %s",r.name),yn({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function jp(e){if(e==null)throw new Error("Workflow has no spec");let t=Gn(e);if(!t.success){let n=t.errors.map(r=>`${r.path}: ${r.message}`).join("; ");throw new Error(`Invalid spec: ${n}`)}return t.data}function Bp(){return $p.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Dp(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 Lp,ur,Ti,Cp,vp,$p,Li=y(()=>{"use strict";di();gn();wn();ze();En();Ge();pt();Yn();M();Ce();sr();cr();Lp=12e4,ur=wt(`
131
+ `)});import{z as um}from"zod";import{graphql as qt,readFragment as Ir}from"gql.tada";async function $r({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=gm({externalBrowser:r,headed:a});let h=i==null?void 0:J({label:"Preconditions resolved",fn:()=>Pr({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:i,webhookSecret:s})}),[{project:k,workflow:S},A]=await Promise.all([J({label:"Run context resolved",fn:()=>wm({config:o,workflowId:c})}),J({label:"Streaming run started",fn:()=>Ur({agentProfileId:t,config:o,runId:l})}),er({appUrl:n})]);p=S.name,u=A;let w=Nm(S.spec);b.info("Executing workflow: %s",S.name),await Lm(Sm({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}),Tm())}catch(h){throw await hm({browserPromise:d,error:h,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),h}}function gm({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):J({label:"Browser launched",fn:()=>Ae({headed:t})})}async function hm({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 Si({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 Sm({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:()=>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 km({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:a,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m});return}await Am({baseUrl:n,browser:S,preconditionResult:k,runId:c,specData:p,streaming:u,webhookSecret:d})}async function km({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 bm({config:r,profileId:t});await Mn({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 es({preconditionResult:a,webhookSecret:c})}async function Am({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:a,webhookSecret:i}){let l=await J({label:"Spec executed",fn:()=>wr({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:a.enqueueStep,runId:r,spec:o})});await es({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 es({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await xr({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function wm({config:e,workflowId:t}){let n=await W({config:e,document:fm,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...Ir(Zi,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},i=(o.workflows??[]).find(s=>Ir(jr,s).id===t);if(i==null)throw new Error(`Workflow ${t} not found`);let l=Ir(jr,i);return{project:o,workflow:l}}async function bm({config:e,profileId:t}){let n=await W({config:e,document:ym,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),Dn({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function Nm(e){if(e==null)throw new Error("Workflow has no spec");let t=Sr(e);if(!t.success){let n=t.errors.map(r=>`${r.path}: ${r.message}`).join("; ");throw new Error(`Invalid spec: ${n}`)}return t.data}function Tm(){return Rm.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Lm(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 mm,jr,Zi,fm,ym,Rm,ts=g(()=>{"use strict";Bi();Vn();zn();lt();tr();dt();Ot();br();G();qe();Er();_r();mm=12e4,jr=qt(`
131
132
  fragment WorkflowRun on Workflow {
132
133
  id
133
134
  slug
134
135
  name
135
136
  spec
136
137
  }
137
- `),Ti=wt(`
138
+ `),Zi=qt(`
138
139
  fragment ProjectRun on Project {
139
140
  id
140
141
  baseUrl
@@ -153,13 +154,13 @@ ${n}`].join(`
153
154
  ...WorkflowRun
154
155
  }
155
156
  }
156
- `,[ur]),Cp=wt(`
157
+ `,[jr]),fm=qt(`
157
158
  query ProjectRun($projectId: String!) {
158
159
  project(id: $projectId) {
159
160
  ...ProjectRun
160
161
  }
161
162
  }
162
- `,[Ti]),vp=wt(`
163
+ `,[Zi]),ym=qt(`
163
164
  query AgentProfileRun($id: String!) {
164
165
  agentProfile(id: $id) {
165
166
  id
@@ -169,7 +170,7 @@ ${n}`].join(`
169
170
  successCriteria
170
171
  }
171
172
  }
172
- `);$p=bp.coerce.number().int().positive().catch(Lp)});var oe=y(()=>{"use strict";Qt();fn();gn();wn();Cn();ze();Ya();ni();En();Ge();ri();Li();Yn();Kn();Le();M();Ce();sr();rr();Me();cr();le()});function Ci(e){return e.data}function vi(e){return{as(t){return{data:{label:t,node:e}}}}}var Rt=y(()=>{"use strict"});function Nt(e){let t=e.getPreconditions(),n=e.getTests();Vp(n);let r=n.map(a=>Wp(a)),o=Jp(t,n);return{config:e.getConfig(),graph:o,tests:r}}function Vp(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 Wp(e){let t=e.id,{accessedKeys:n,vars:r}=xi(e.requiresKeys),o=e.startsAtFn==null?void 0:e.startsAtFn(r),a=e.stepsFn==null?[]:e.stepsFn(r),i=o==null?a:[qp(o),...a],l=Fp(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 qp(e){return vi({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function xi(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 Fp(e,t,n){let r={};e.forEach((i,l)=>{let s=`step-${String(l)}`,d=l<e.length-1?`step-${String(l+1)}`:void 0;r[s]=Mp(i,s,d)});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,version:2}}function Mp(e,t,n){let{label:r,node:o}=Ci(e);return{...o,id:t,label:r,next:n}}function Jp(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=zp(a.requires,e),{vars:l}=xi(a.requiresKeys),s=a.startsAtFn(l),d=Xp(i,s);r[d]={preconditions:[...i],route:s},o.push({from:d,requiresKeys:a.requiresKeys,to:d,workflow:a.id})}),{edges:o,preconditions:n,states:r,version:3}}function zp(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 Xp(e,t){let n=e.toSorted((r,o)=>r.localeCompare(o));return Gp(`${n.join("-")}-${t}`)}function Gp(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")}var fr=y(()=>{"use strict";Rt()});var Pi=y(()=>{"use strict";fr();Rt()});import Hp from"path";import{createJiti as Kp}from"jiti";async function V(e){let t=Hp.join(e,".ripplo","index.ts");try{let r=await Kp(import.meta.url,{moduleCache:!1}).import(t),a=r!=null&&typeof r=="object"&&"default"in r?r.default:r,i=Nt(a);return{builder:a,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var ae=y(()=>{"use strict";Pi()});import{z as Wi}from"zod";function Lt(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return Ze().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return Ze().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return Ze().RIPPLO_SERVER_URL;let r=_u[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function Ze(){return qi??=Iu.parse(process.env),qi}var Eu,Ou,Uu,_u,Iu,qi,Ct=y(()=>{"use strict";Eu="https://ripplo.ai",Ou="https://ripplo-dev.up.railway.app",Uu="https://localhost:3001",_u={dev:Ou,local:Uu};Iu=Wi.object({RIPPLO_SERVER_URL:Wi.string().min(1).default(Eu)})});import Ki from"crypto";import Ar from"fs";import Qi from"path";import{watch as cm}from"chokidar";import{graphql as pm}from"gql.tada";async function Yi(e){return ym(e)}function wr({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let a=Qi.join(t,um),i=n,l="",s,d=!1,p=!1,u=cm(a,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(S,h)=>{if(h.endsWith(".ts")){if(d){p=!0;return}s!=null&&clearTimeout(s),s=setTimeout(()=>{m()},200)}}),u.on("error",S=>{let h=S instanceof Error?S.message:String(S);w.error("File watcher error: %s",h)});function c(){p=!1,s=setTimeout(()=>{m()},200)}async function m(){d=!0,p=!1;try{await g()}catch(S){let h=S instanceof Error?S.message:"Unknown error";w.error("Sync failed: %s",h),r(h)}finally{d=!1,p&&c()}}async function g(){let S=fm(a);if(S===l)return;l=S;let h=await V(t);if(!h.ok){r(h.error);return}let A=es(h.result),k=ts(A);if(k===i)return;i=k;let N=await ns({config:e,payload:A});w.info("Dev session synced (%d test(s))",h.result.tests.length),o({devSessionId:N.devSessionId,hash:N.hash})}return function(){s!=null&&clearTimeout(s),u.close()}}function fm(e){let t=Ki.createHash("sha256");return Zi(t,e),t.digest("hex")}function Zi(e,t){if(!Ar.existsSync(t))return;Ar.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Qi.join(t,r.name);r.isDirectory()?Zi(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(Ar.readFileSync(o)))})}function es(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 ts(e){return Ki.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function ym(e){let t=await V(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=es(t.result);return w.info("Synced %d test(s) + graph to dev session",t.result.tests.length),ns({config:e.config,payload:n})}async function ns({config:e,payload:t}){let n=ts(t),r=await $({config:e,document:mm,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 rs(e){return!1}function os(e){return!1}var um,mm,Rr=y(()=>{"use strict";oe();ae();um=".ripplo",mm=pm(`
173
+ `);Rm=um.coerce.number().int().positive().catch(mm)});var me=g(()=>{"use strict";bn();Bn();Vn();zn();Qn();lt();Ci();Ei();tr();dt();Oi();ts();br();Ar();We();G();qe();Er();Cr();it();_r();Se()});import{z as ms}from"zod";function zt(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return gt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return gt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return gt().RIPPLO_SERVER_URL;let r=ff[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function gt(){return fs??=yf.parse(process.env),fs}var pf,uf,mf,ff,yf,fs,Jt=g(()=>{"use strict";pf="https://ripplo.ai",uf="https://ripplo-dev.up.railway.app",mf="https://localhost:3001",ff={dev:uf,local:mf};yf=ms.object({RIPPLO_SERVER_URL:ms.string().min(1).default(pf)})});import bs from"crypto";import qr from"fs";import Ns from"path";import{watch as Mf}from"chokidar";import{graphql as zf}from"gql.tada";async function Rs(e){return Hf(e)}function Fr({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let a=Ns.join(t,Jf),i=n,l="",s,c=!1,p=!1,u=Mf(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=Gf(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=Ls(S.result),w=Cs(A);if(w===i)return;i=w;let x=await vs({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 Gf(e){let t=bs.createHash("sha256");return Ts(t,e),t.digest("hex")}function Ts(e,t){if(!qr.existsSync(t))return;qr.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Ns.join(t,r.name);r.isDirectory()?Ts(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(qr.readFileSync(o)))})}function Ls(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 Cs(e){return bs.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Hf(e){let t=await D(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Ls(t.result);return b.info("Synced %d test(s) + graph to dev session",t.result.tests.length),vs({config:e.config,payload:n})}async function vs({config:e,payload:t}){let n=Cs(t),r=await W({config:e,document:Xf,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 xs(e){return!1}function Ps(e){return!1}var Jf,Xf,Mr=g(()=>{"use strict";$e();me();ue();Jf=".ripplo",Xf=zf(`
173
174
  mutation SyncDevSession(
174
175
  $projectId: String!
175
176
  $graphSpec: String!
@@ -179,7 +180,7 @@ ${n}`].join(`
179
180
  id
180
181
  }
181
182
  }
182
- `)});import{useCallback as gm,useEffect as Pt,useRef as hm,useState as Sm}from"react";import{availableParallelism as as}from"os";import{useSubscription as Nr}from"urql";import{graphql as Ot}from"gql.tada";async function is(){await(await Et).closeAll()}function ss({config:e,cwd:t,devSessionId:n}){let[r,o]=Sm({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:as()}),a=e,i=hm(new Set);Pt(()=>{Et.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=gm(s=>{ls({activeRunIds:i.current,baseUrl:a.appUrl,config:a,setState:o,...s})},[a]);return Pt(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),Nr({pause:n==null,query:km},(s,d)=>{let p=d.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}),d}),Nr({pause:n==null,query:wm,variables:{projectId:a.projectId}},(s,d)=>{let p=d.devWorkflowDeleteRequested?.slug;return p!=null&&rs({cwd:t,slug:p}),d}),Nr({pause:n==null,query:Rm,variables:{projectId:a.projectId}},(s,d)=>{let p=d.devWorkflowDuplicateRequested;return p!=null&&os({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),d}),Pt(()=>{if(n==null)return;let s=new AbortController;return Tm({activeConfig:a,activeRunIds:i.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[a,n]),Pt(()=>()=>{Et.then(s=>s.closeAll())},[]),r}function ls({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,setState:l,workflowId:s,workflowSlug:d}){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}))}bm({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,workflowId:s,workflowSlug:d}).finally(p)}async function Tm({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(a=>{let i=setTimeout(a,Nm);o.addEventListener("abort",()=>{clearTimeout(i),a()},{once:!0})}),o.aborted)return;try{(await $({config:e,document:Am,variables:{devSessionId:n}})).pendingDevRuns?.filter(i=>!t.has(i.id)).forEach(i=>{let l=i.workflow?.id;l!=null&&ls({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){w.error(a,"Runner error")}}}async function bm({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:a,workflowId:i,workflowSlug:l}){let s=await Et,d=await s.acquire();try{await xn({maxRuns:100});let p=o!=null&&l!=null?await Lm({cwd:o,workflowSlug:l}):void 0;await mr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:d,config:r,headed:!1,preconditionNames:p,runId:a,webhookSecret:r.webhookSecret,workflowId:i})}catch(p){w.error(p,"Runner error")}finally{s.release(d)}}async function Lm({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 km,Am,wm,Rm,Et,Nm,Tr=y(()=>{"use strict";oe();ae();Rr();km=Ot(`
183
+ `)});import{useCallback as Kf,useEffect as Ht,useRef as Qf,useState as Yf}from"react";import{availableParallelism as Es}from"os";import{useSubscription as zr}from"urql";import{graphql as Qt}from"gql.tada";async function Os(){await(await Kt).closeAll()}function Us({config:e,cwd:t,devSessionId:n}){let[r,o]=Yf({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:Es()}),a=e,i=Qf(new Set);Ht(()=>{Kt.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=Kf(s=>{_s({activeRunIds:i.current,baseUrl:a.appUrl,config:a,setState:o,...s})},[a]);return Ht(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),zr({pause:n==null,query:Zf},(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}),zr({pause:n==null,query:ty,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&xs({cwd:t,slug:p}),c}),zr({pause:n==null,query:ny,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&Ps({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),Ht(()=>{if(n==null)return;let s=new AbortController;return oy({activeConfig:a,activeRunIds:i.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[a,n]),Ht(()=>()=>{Kt.then(s=>s.closeAll())},[]),r}function _s({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}))}ay({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,workflowId:s,workflowSlug:c}).finally(p)}async function oy({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(a=>{let i=setTimeout(a,ry);o.addEventListener("abort",()=>{clearTimeout(i),a()},{once:!0})}),o.aborted)return;try{(await W({config:e,document:ey,variables:{devSessionId:n}})).pendingDevRuns?.filter(i=>!t.has(i.id)).forEach(i=>{let l=i.workflow?.id;l!=null&&_s({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 ay({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:a,workflowId:i,workflowSlug:l}){let s=await Kt,c=await s.acquire();try{await Zn({maxRuns:100});let p=o!=null&&l!=null?await iy({cwd:o,workflowSlug:l}):void 0;await $r({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 iy({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 Zf,ey,ty,ny,Kt,ry,Jr=g(()=>{"use strict";me();ue();Mr();Zf=Qt(`
183
184
  subscription RunRequestedDashboard {
184
185
  runRequested {
185
186
  agentProfileDescription
@@ -190,7 +191,7 @@ ${n}`].join(`
190
191
  workflowSlug
191
192
  }
192
193
  }
193
- `),Am=Ot(`
194
+ `),ey=Qt(`
194
195
  query PendingDevRunsDashboard($devSessionId: String!) {
195
196
  pendingDevRuns(devSessionId: $devSessionId) {
196
197
  id
@@ -203,14 +204,14 @@ ${n}`].join(`
203
204
  }
204
205
  }
205
206
  }
206
- `),wm=Ot(`
207
+ `),ty=Qt(`
207
208
  subscription DevWorkflowDeleteDashboard($projectId: String!) {
208
209
  devWorkflowDeleteRequested(projectId: $projectId) {
209
210
  projectId
210
211
  slug
211
212
  }
212
213
  }
213
- `),Rm=Ot(`
214
+ `),ny=Qt(`
214
215
  subscription DevWorkflowDuplicateDashboard($projectId: String!) {
215
216
  devWorkflowDuplicateRequested(projectId: $projectId) {
216
217
  projectId
@@ -218,7 +219,7 @@ ${n}`].join(`
218
219
  newSlug
219
220
  }
220
221
  }
221
- `),Et=vn({headed:!1,size:as()});Nm=5e3});import{initGraphQLTada as Cm}from"gql.tada";import{readFragment as fR}from"gql.tada";var ds,cs=y(()=>{"use strict";ds=Cm()});var br,Lr=y(()=>{"use strict";br={__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:[]},{name:"version",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 E(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function Y(e,t,n){e.invalidate({__typename:t,id:n})}function Cr({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 d=s.map(p=>typeof p=="string"?p:null);return d.includes(l)||e.link(i,r,void 0,[...d,l]),!0}function xm(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Cr({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||Y(e,"RunResult",r)}function Pm(e,t){t.runId!=null&&e.writeFragment(ps,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function Em(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null,r=e.status==="completed"||e.status==="failed";Pm(t,e),r&&e.runId!=null&&Y(t,"Run",e.runId),n&&(E(t,"run"),E(t,"projectRuns")),e.workflowId!=null&&e.runId!=null&&Cr({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function Om(){return{cancelAllPendingRuns(e,t,n){E(n,"workflows"),E(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&Y(n,"Run",r)},cloneAgentTemplate(e,t,n){E(n,"agentProfiles")},createAgentProfile(e,t,n){E(n,"agentProfiles")},createRun(e,t,n){E(n,"run"),E(n,"runs"),E(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(ps,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Cr({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&Y(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&Y(n,"Workflow",r),E(n,"workflows"),E(n,"stateGraph")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&Y(n,"Project",r),E(n,"projects")},duplicateDevWorkflow(e,t,n){E(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&Y(n,"DevSession",r)},runAllWorkflows(e,t,n){E(n,"runs"),E(n,"projectRuns")},setOverageCap(e,t,n){E(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&Y(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&Y(n,"User",r),E(n,"currentUser")}}}function vr(){return{keys:vm,schema:br,updates:{Mutation:Om(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&Y(n,"Project",r.projectId),r?.active===!1&&(E(n,"stateGraph"),E(n,"workflows"),E(n,"workflow"),E(n,"runs"),E(n,"run"),E(n,"projectRuns"))},devSessionSynced(e,t,n){E(n,"stateGraph"),E(n,"workflow"),E(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&Em(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&xm(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&Y(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&Y(n,"Run",r.run.id)}}}}}var vm,ps,us=y(()=>{"use strict";cs();Lr();vm={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};ps=ds(`
222
+ `),Kt=Yn({headed:!1,size:Es()});ry=5e3});import{initGraphQLTada as sy}from"gql.tada";import{readFragment as hR}from"gql.tada";var Is,js=g(()=>{"use strict";Is=sy()});var Xr,Gr=g(()=>{"use strict";Xr={__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:[]},{name:"version",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 ae(e,t,n){e.invalidate({__typename:t,id:n})}function Hr({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 cy(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Hr({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ae(e,"RunResult",r)}function dy(e,t){t.runId!=null&&e.writeFragment($s,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function py(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null,r=e.status==="completed"||e.status==="failed";dy(t,e),r&&e.runId!=null&&ae(t,"Run",e.runId),n&&(I(t,"run"),I(t,"projectRuns")),e.workflowId!=null&&e.runId!=null&&Hr({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function uy(){return{cancelAllPendingRuns(e,t,n){I(n,"workflows"),I(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&ae(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($s,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Hr({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),I(n,"workflows"),I(n,"stateGraph")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ae(n,"Project",r),I(n,"projects")},duplicateDevWorkflow(e,t,n){I(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ae(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&&ae(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ae(n,"User",r),I(n,"currentUser")}}}function Kr(){return{keys:ly,schema:Xr,updates:{Mutation:uy(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ae(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&&py(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&cy(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 ly,$s,Bs=g(()=>{"use strict";js();Gr();ly={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};$s=Is(`
222
223
  fragment RunCache on Run {
223
224
  id
224
225
  status
@@ -228,7 +229,7 @@ ${n}`].join(`
228
229
  id
229
230
  }
230
231
  }
231
- `)});var ms=y(()=>{"use strict";us();Lr()});import{Client as Um,fetchExchange as _m,subscriptionExchange as Im}from"urql";import{cacheExchange as jm}from"@urql/exchange-graphcache";import{createClient as $m}from"graphql-sse";function xr({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=$m({headers:n,retryAttempts:1/0,url:t});return new Um({exchanges:[jm(vr()),Im({forwardSubscription:o=>({subscribe:a=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},a)}})}),_m],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var fs=y(()=>{"use strict";ms()});import{Box as ys,Text as U,useInput as Bm}from"ink";import{jsx as W,jsxs as ie}from"react/jsx-runtime";function Pr({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Bm((o,a)=>{a.return&&!n&&r()}),t!=null?ie(ys,{flexDirection:"column",gap:1,children:[ie(U,{children:[W(U,{color:"red",children:" \u2717 "}),W(U,{children:t})]}),ie(U,{children:[W(U,{color:"cyan",children:" \u2192 "}),W(U,{children:"Press "}),W(U,{bold:!0,children:"Enter"}),W(U,{children:" to try again"})]})]}):e!=null?ie(ys,{flexDirection:"column",gap:1,paddingLeft:2,children:[ie(U,{children:[W(U,{color:"yellow",children:"* "}),W(U,{children:"Your code: "}),W(U,{bold:!0,color:"white",children:e.userCode})]}),ie(U,{children:[W(U,{color:"yellow",children:"* "}),W(U,{children:"Waiting for browser authorization..."})]}),ie(U,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?ie(U,{children:[W(U,{color:"yellow",children:" * "}),W(U,{children:"Opening browser..."})]}):ie(U,{children:[W(U,{color:"cyan",children:" \u2192 "}),W(U,{children:"Press "}),W(U,{bold:!0,children:"Enter"}),W(U,{children:" to open browser for authentication"})]})}var gs=y(()=>{"use strict"});import{useState as Dm}from"react";import{Box as Vm,Text as Ut,useInput as Wm}from"ink";import{jsx as _t,jsxs as qm}from"react/jsx-runtime";function hs({items:e,onSelect:t}){let[n,r]=Dm(0);return Wm((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)}}),_t(Vm,{flexDirection:"column",children:e.map((o,a)=>qm(Ut,{children:[a===n?_t(Ut,{color:"cyan",children:"> "}):_t(Ut,{children:" "}),_t(Ut,{bold:a===n,children:o.label})]},o.value))})}var Ss=y(()=>{"use strict"});import{Box as Fm,Text as fe,useInput as Mm}from"ink";import{jsx as Oe,jsxs as Er}from"react/jsx-runtime";function ks({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Mm((r,o)=>{o.return&&e()}),Er(Fm,{flexDirection:"column",children:[Er(fe,{children:[Oe(fe,{color:"cyan",children:" \u2192 "}),Oe(fe,{children:"No projects found. Create one at: "}),Oe(fe,{bold:!0,color:"cyan",children:n})]}),Er(fe,{children:[" ",Oe(fe,{dimColor:!0,children:"Press "}),Oe(fe,{bold:!0,children:"Enter"}),Oe(fe,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var As=y(()=>{"use strict"});import{useEffect as Jm,useMemo as zm,useRef as Xm}from"react";import{Box as ws,Text as Se}from"ink";import{useQuery as Gm}from"urql";import{graphql as Hm}from"gql.tada";import{jsx as ke,jsxs as It}from"react/jsx-runtime";function Rs({selectProject:e,serverUrl:t}){let[n,r]=Gm({query:Km}),o=Xm(!1),a=zm(()=>n.data?.projects??[],[n.data?.projects]);if(Jm(()=>{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 It(Se,{children:[ke(Se,{color:"yellow",children:" * "}),ke(Se,{children:"Loading projects..."})]});if(n.error!=null)return It(Se,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(a.length===0)return ke(ks,{reexecute:r,serverUrl:t});let i=a.map(s=>({label:s.name,value:s.id}));function l(s){let d=a.find(p=>p.id===s);d!=null&&e({id:d.id,name:d.name})}return It(ws,{flexDirection:"column",children:[It(Se,{children:[ke(Se,{color:"cyan",children:" \u2192 "}),ke(Se,{children:"Select a project:"})]}),ke(ws,{marginLeft:4,marginTop:1,children:ke(hs,{items:i,onSelect:l})})]})}var Km,Ns=y(()=>{"use strict";Ss();As();Km=Hm(`
232
+ `)});var Ds=g(()=>{"use strict";Bs();Gr()});import{Client as my,fetchExchange as fy,subscriptionExchange as yy}from"urql";import{cacheExchange as gy}from"@urql/exchange-graphcache";import{createClient as hy}from"graphql-sse";function Qr({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=hy({headers:n,retryAttempts:1/0,url:t});return new my({exchanges:[gy(Kr()),yy({forwardSubscription:o=>({subscribe:a=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},a)}})}),fy],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var Vs=g(()=>{"use strict";Ds()});import{Box as Ws,Text as j,useInput as Sy}from"ink";import{jsx as z,jsxs as fe}from"react/jsx-runtime";function Yr({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Sy((o,a)=>{a.return&&!n&&r()}),t!=null?fe(Ws,{flexDirection:"column",gap:1,children:[fe(j,{children:[z(j,{color:"red",children:" \u2717 "}),z(j,{children:t})]}),fe(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?fe(Ws,{flexDirection:"column",gap:1,paddingLeft:2,children:[fe(j,{children:[z(j,{color:"yellow",children:"* "}),z(j,{children:"Your code: "}),z(j,{bold:!0,color:"white",children:e.userCode})]}),fe(j,{children:[z(j,{color:"yellow",children:"* "}),z(j,{children:"Waiting for browser authorization..."})]}),fe(j,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?fe(j,{children:[z(j,{color:"yellow",children:" * "}),z(j,{children:"Opening browser..."})]}):fe(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 qs=g(()=>{"use strict"});import{useState as ky}from"react";import{Box as Ay,Text as Yt,useInput as wy}from"ink";import{jsx as Zt,jsxs as by}from"react/jsx-runtime";function Fs({items:e,onSelect:t}){let[n,r]=ky(0);return wy((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)}}),Zt(Ay,{flexDirection:"column",children:e.map((o,a)=>by(Yt,{children:[a===n?Zt(Yt,{color:"cyan",children:"> "}):Zt(Yt,{children:" "}),Zt(Yt,{bold:a===n,children:o.label})]},o.value))})}var Ms=g(()=>{"use strict"});import{Box as Ny,Text as Re,useInput as Ry}from"ink";import{jsx as Xe,jsxs as Zr}from"react/jsx-runtime";function zs({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Ry((r,o)=>{o.return&&e()}),Zr(Ny,{flexDirection:"column",children:[Zr(Re,{children:[Xe(Re,{color:"cyan",children:" \u2192 "}),Xe(Re,{children:"No projects found. Create one at: "}),Xe(Re,{bold:!0,color:"cyan",children:n})]}),Zr(Re,{children:[" ",Xe(Re,{dimColor:!0,children:"Press "}),Xe(Re,{bold:!0,children:"Enter"}),Xe(Re,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var Js=g(()=>{"use strict"});import{useEffect as Ty,useMemo as Ly,useRef as Cy}from"react";import{Box as Xs,Text as Pe}from"ink";import{useQuery as vy}from"urql";import{graphql as xy}from"gql.tada";import{jsx as Ee,jsxs as en}from"react/jsx-runtime";function Gs({selectProject:e,serverUrl:t}){let[n,r]=vy({query:Py}),o=Cy(!1),a=Ly(()=>n.data?.projects??[],[n.data?.projects]);if(Ty(()=>{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 en(Pe,{children:[Ee(Pe,{color:"yellow",children:" * "}),Ee(Pe,{children:"Loading projects..."})]});if(n.error!=null)return en(Pe,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(a.length===0)return Ee(zs,{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 en(Xs,{flexDirection:"column",children:[en(Pe,{children:[Ee(Pe,{color:"cyan",children:" \u2192 "}),Ee(Pe,{children:"Select a project:"})]}),Ee(Xs,{marginLeft:4,marginTop:1,children:Ee(Fs,{items:i,onSelect:l})})]})}var Py,Hs=g(()=>{"use strict";Ms();Js();Py=xy(`
232
233
  query SetupProjectSelect {
233
234
  projects {
234
235
  id
@@ -238,7 +239,10 @@ ${n}`].join(`
238
239
  }
239
240
  }
240
241
  }
241
- `)});import{Box as Ts,Text as se}from"ink";import{jsx as Ae,jsxs as tt}from"react/jsx-runtime";function Or({config:e,error:t,selectProject:n,stage:r}){return tt(Ts,{flexDirection:"column",padding:1,children:[tt(se,{bold:!0,children:[" ","ripplo setup"]}),Ae(se,{children:""}),tt(se,{children:[Ae(se,{color:"green",children:" \u2713 "}),Ae(se,{children:"Authenticated"})]}),r==="scaffolding"?tt(se,{children:[Ae(se,{color:"yellow",children:" * "}),Ae(se,{children:"Setting up local environment..."})]}):Ae(Rs,{selectProject:n,serverUrl:e.ripploServerUrl}),t==null?null:Ae(Ts,{marginTop:1,children:tt(se,{color:"red",children:[" ","Error: ",t]})})]})}var bs=y(()=>{"use strict";Ns()});import{useEffect as Qm,useState as Ym}from"react";function Ue(){let[e,t]=Ym(Ls);return Qm(()=>{function n(){t(Ls())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Ls(){return{height:process.stdout.rows,width:process.stdout.columns}}var jt=y(()=>{"use strict"});import{useEffect as Zm,useRef as ef,useState as tf}from"react";function Cs({config:e,cwd:t}){let[n,r]=tf({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=ef(void 0);return Zm(()=>{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 Yi({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=wr({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=wr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var vs=y(()=>{"use strict";Rr()});import rN from"chalk";import{z as xs}from"zod";async function Ps(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${nf}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return rf.parse(r).version}catch{return}finally{clearTimeout(t)}}var Ur,nf,rf,Es=y(()=>{"use strict";oe();Ur="0.1.5",nf="ripplo",rf=xs.object({version:xs.string()})});import{useEffect as of,useState as af}from"react";import{Text as we}from"ink";import{jsx as _e,jsxs as cf}from"react/jsx-runtime";function Os({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=df(),l=i!=null&&i!==Ur,s=sf({connected:n,syncError:o}),d=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${Ur}`,c=l?` \u2192 v${i}`:"",m="q to quit",g=` ripplo ${u}${c} | ${r} ${s}${d}${p}`,S=Math.max(0,a-g.length-m.length-1);return cf(we,{inverse:!0,children:[_e(we,{bold:!0,children:" ripplo "}),_e(we,{dimColor:!0,children:u}),l?_e(we,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,_e(we,{color:lf({connected:n,syncError:o}),children:s}),t?null:_e(we,{color:"yellow",children:d}),p," ".repeat(S),_e(we,{dimColor:!0,children:m})," "]})}function sf({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function lf({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function df(){let[e,t]=af();return of(()=>{Ps().then(n=>{n!=null&&t(n)})},[]),e}var Us=y(()=>{"use strict";Es()});import{Box as $t,Text as nt,useApp as pf,useInput as uf}from"ink";import{jsx as Ie,jsxs as Bt}from"react/jsx-runtime";function _s({config:e,cwd:t}){let n=pf(),{height:r,width:o}=Ue(),{config:a,devSessionId:i,syncError:l}=Cs({config:e,cwd:t}),{activeRunCount:s,browsersReady:d,connected:p}=ss({config:a,cwd:t,devSessionId:i});uf(c=>{c==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return Bt($t,{flexDirection:"column",height:r,width:o,children:[Ie(Os,{activeRunCount:s,browsersReady:d,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),Bt($t,{flexDirection:"column",flexGrow:1,padding:1,children:[Bt($t,{children:[Ie(nt,{children:"Developer dashboard: "}),Ie(nt,{color:"cyan",children:u})]}),Bt($t,{marginTop:1,children:[Ie(nt,{dimColor:!0,children:"Run "}),Ie(nt,{color:"yellow",children:"ripplo doctor"}),Ie(nt,{dimColor:!0,children:" for health checks"})]})]})]})}var Is=y(()=>{"use strict";jt();vs();Tr();Us()});import{Text as js}from"ink";import mf from"ink-spinner";import{jsx as $s,jsxs as yf}from"react/jsx-runtime";function Bs({loading:e}){return e?yf(js,{color:ff,children:[$s(mf,{type:"dots"})," Starting..."]}):$s(js,{children:""})}var ff,Ds=y(()=>{"use strict";ff="#24CFFF"});import{useEffect as gf,useState as rt}from"react";import{Box as Re,Text as _r,useInput as hf}from"ink";import{jsx as ye,jsxs as Ir}from"react/jsx-runtime";function Ws({onDismiss:e}){let{height:t,width:n}=Ue(),[r,o]=rt(0),[a,i]=rt(!1),[l,s]=rt(!1),[d,p]=rt(!1),[u,c]=rt(!1);hf(()=>{u&&e()}),gf(()=>{let S=80+Dt.length*70+80,h=[...Dt.map((A,k)=>setTimeout(()=>{o(k+1)},80+k*70)),setTimeout(()=>{i(!0)},S),setTimeout(()=>{s(!0)},S+200),setTimeout(()=>{p(!0)},S+400),setTimeout(()=>{p(!1),c(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{h.forEach(A=>{clearTimeout(A)})}},[e]);let m=Dt.length+5,g=Math.max(0,Math.floor((t-m)/2));return Ir(Re,{flexDirection:"column",height:t,width:n,children:[ye(Re,{height:g}),Ir(Re,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[ye(Re,{flexDirection:"column",children:Dt.map((S,h)=>ye(_r,{color:Vs,children:h<r?S:""},S))}),Ir(Re,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[ye(_r,{bold:!0,color:Vs,children:a?Sf:""}),ye(Re,{marginTop:1,children:ye(_r,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),ye(Re,{marginTop:2,children:ye(Bs,{loading:d})})]})]})]})}var Dt,Vs,Sf,qs=y(()=>{"use strict";jt();Ds();Dt=[" 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 "],Vs="#24CFFF",Sf="ripplo"});import{createAuthClient as kf}from"better-auth/client";import{deviceAuthorizationClient as Af}from"better-auth/client/plugins";function Vt({baseURL:e}){return kf({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Af()]})}var jr=y(()=>{"use strict"});import{exec as wf}from"child_process";async function Ms({cwd:e,onDeviceCode:t,url:n}){let r=n??Ze().RIPPLO_SERVER_URL,o=Vt({baseURL:r}),a=await o.device.code({client_id:Fs});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}),vf(s);let d=await Nf({authClient:o,deviceCode:i});return Un(e,d),d}async function Nf({authClient:e,deviceCode:t}){for(;;){await Lf(Rf);let n=await e.device.token({client_id:Fs,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(!bf(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function bf(e){return Tf.has(e)}function Lf(e){return new Promise(t=>{setTimeout(t,e)})}function Cf(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function vf(e){let t=Cf();wf(`${t} "${e}"`,()=>{})}var Rf,Fs,Tf,Js=y(()=>{"use strict";oe();jr();Ct();Rf=5e3,Fs="ripplo-cli";Tf=new Set(["authorization_pending","slow_down"])});import{useCallback as $r,useEffect as xf,useState as je}from"react";import{execSync as Pf}from"child_process";import re from"fs";import ee from"path";function Xs({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=je(t==null?"login":"validating"),[a,i]=je(),[l,s]=je(),[d,p]=je(t),[u,c]=je(!1),[m,g]=je();xf(()=>{if(t==null)return;Vt({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(N=>{if(N.data==null){o("login");return}return Br({cwd:e,serverUrl:n,token:t})}).then(N=>{if(N==null){o("select-project");return}i(N),o("complete")}).catch(N=>{s(N instanceof Error?N.message:String(N)),o("login")})},[e,t,n]);let S=$r(()=>{u||(c(!0),s(void 0),Ms({cwd:e,onDeviceCode:g,url:n}).then(k=>(p(k),Br({cwd:e,serverUrl:n,token:k}))).then(k=>{k==null?o("select-project"):(i(k),o("complete"))}).catch(k=>{c(!1),g(void 0),s(k instanceof Error?k.message:String(k))}))},[e,u,n]),h=$r(k=>{let N=a?.token??d??t;if(N==null){s("No authentication token available");return}o("scaffolding"),s(void 0),Ef({cwd:e,projectId:k.id}).then(()=>Br({cwd:e,serverUrl:n,token:N})).then(C=>{i(C??{appUrl:"",preconditionsUrl:"",projectId:k.id,ripploServerUrl:n,token:N,webhookSecret:""}),o("complete")}).catch(C=>{s(C instanceof Error?C.message:String(C)),o("select-project")})},[a,e,t,n,d]),A=$r(()=>{i(void 0),o("login"),c(!1),g(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,error:l,loginStarted:u,resetToLogin:A,selectProject:h,setStage:o,stage:r,startLogin:S,token:d}}async function Br({cwd:e,serverUrl:t,token:n}){let r=await V(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Ef({cwd:e,projectId:t}){_f({cwd:e,projectId:t}),Vf(e),Of(e),await Sn()}function Of(e){let t=Uf(e),n=t==="yarn"?`yarn add -D ${zs.join(" ")}`:`${t} add -D ${zs.join(" ")}`;w.info("Installing dependencies: %s",n),Pf(n,{cwd:e,stdio:"pipe"})}function Uf(e){return re.existsSync(ee.join(e,"pnpm-lock.yaml"))?"pnpm":re.existsSync(ee.join(e,"yarn.lock"))?"yarn":re.existsSync(ee.join(e,"bun.lockb"))||re.existsSync(ee.join(e,"bun.lock"))?"bun":"npm"}function _f({cwd:e,projectId:t}){let n=ee.join(e,".ripplo"),r=ee.join(n,"tests"),o=ee.join(n,"preconditions");re.mkdirSync(r,{recursive:!0}),re.mkdirSync(o,{recursive:!0}),Wt(ee.join(n,"ripplo.ts"),If(t)),Wt(ee.join(n,"index.ts"),$f),Wt(ee.join(n,".env"),jf()),Wt(ee.join(n,"tsconfig.json"),Bf)}function Wt(e,t){re.existsSync(e)||re.writeFileSync(e,t)}function If(e){return`import { config } from "dotenv";
242
+ `)});import{Box as Ks,Text as ye}from"ink";import Ey from"ink-spinner";import{jsx as Ge,jsxs as Oe}from"react/jsx-runtime";function eo({config:e,error:t,scaffoldingStep:n,selectProject:r,stage:o}){return Oe(Ks,{flexDirection:"column",padding:1,children:[Oe(ye,{bold:!0,children:[" ","ripplo setup"]}),Ge(ye,{children:""}),Oe(ye,{children:[Ge(ye,{color:"green",children:" \u2713 "}),Ge(ye,{children:"Authenticated"})]}),o==="scaffolding"?Oe(ye,{children:[Oe(ye,{color:"cyan",children:[" ",Ge(Ey,{type:"dots"})]}),Oe(ye,{children:[" ",n??"Setting up local environment..."]})]}):Ge(Gs,{selectProject:r,serverUrl:e.ripploServerUrl}),t==null?null:Ge(Ks,{marginTop:1,children:Oe(ye,{color:"red",children:[" ","Error: ",t]})})]})}var Qs=g(()=>{"use strict";Hs()});import{useEffect as Oy,useState as Uy}from"react";function He(){let[e,t]=Uy(Ys);return Oy(()=>{function n(){t(Ys())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Ys(){return{height:process.stdout.rows,width:process.stdout.columns}}var tn=g(()=>{"use strict"});import{useEffect as _y,useRef as Iy,useState as jy}from"react";function Zs({config:e,cwd:t}){let[n,r]=jy({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=Iy(void 0);return _y(()=>{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 Rs({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=Fr({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=Fr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var el=g(()=>{"use strict";Mr()});import sT from"chalk";import{z as tl}from"zod";async function nl(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${$y}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return By.parse(r).version}catch{return}finally{clearTimeout(t)}}var to,$y,By,rl=g(()=>{"use strict";me();to="0.1.7",$y="ripplo",By=tl.object({version:tl.string()})});import{useEffect as Dy,useState as Vy}from"react";import{Text as Ue}from"ink";import{jsx as Ke,jsxs as My}from"react/jsx-runtime";function ol({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=Fy(),l=i!=null&&i!==to,s=Wy({connected:n,syncError:o}),c=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${to}`,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 My(Ue,{inverse:!0,children:[Ke(Ue,{bold:!0,children:" ripplo "}),Ke(Ue,{dimColor:!0,children:u}),l?Ke(Ue,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,Ke(Ue,{color:qy({connected:n,syncError:o}),children:s}),t?null:Ke(Ue,{color:"yellow",children:c}),p," ".repeat(k),Ke(Ue,{dimColor:!0,children:m})," "]})}function Wy({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function qy({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function Fy(){let[e,t]=Vy();return Dy(()=>{nl().then(n=>{n!=null&&t(n)})},[]),e}var al=g(()=>{"use strict";rl()});import{Box as nn,Text as St,useApp as zy,useInput as Jy}from"ink";import{jsx as Qe,jsxs as rn}from"react/jsx-runtime";function il({config:e,cwd:t}){let n=zy(),{height:r,width:o}=He(),{config:a,devSessionId:i,syncError:l}=Zs({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=Us({config:a,cwd:t,devSessionId:i});Jy(d=>{d==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return rn(nn,{flexDirection:"column",height:r,width:o,children:[Qe(ol,{activeRunCount:s,browsersReady:c,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),rn(nn,{flexDirection:"column",flexGrow:1,padding:1,children:[rn(nn,{children:[Qe(St,{children:"Developer dashboard: "}),Qe(St,{color:"cyan",children:u})]}),rn(nn,{marginTop:1,children:[Qe(St,{dimColor:!0,children:"Run "}),Qe(St,{color:"yellow",children:"ripplo doctor"}),Qe(St,{dimColor:!0,children:" for health checks"})]})]})]})}var sl=g(()=>{"use strict";tn();el();Jr();al()});import{Text as ll}from"ink";import Xy from"ink-spinner";import{jsx as cl,jsxs as Hy}from"react/jsx-runtime";function dl({loading:e}){return e?Hy(ll,{color:Gy,children:[cl(Xy,{type:"dots"})," Starting..."]}):cl(ll,{children:""})}var Gy,pl=g(()=>{"use strict";Gy="#24CFFF"});import{useEffect as Ky,useState as kt}from"react";import{Box as _e,Text as no,useInput as Qy}from"ink";import{jsx as Te,jsxs as ro}from"react/jsx-runtime";function ml({onDismiss:e}){let{height:t,width:n}=He(),[r,o]=kt(0),[a,i]=kt(!1),[l,s]=kt(!1),[c,p]=kt(!1),[u,d]=kt(!1);Qy(()=>{u&&e()}),Ky(()=>{let k=80+on.length*70+80,S=[...on.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=on.length+5,h=Math.max(0,Math.floor((t-m)/2));return ro(_e,{flexDirection:"column",height:t,width:n,children:[Te(_e,{height:h}),ro(_e,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Te(_e,{flexDirection:"column",children:on.map((k,S)=>Te(no,{color:ul,children:S<r?k:""},k))}),ro(_e,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Te(no,{bold:!0,color:ul,children:a?Yy:""}),Te(_e,{marginTop:1,children:Te(no,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),Te(_e,{marginTop:2,children:Te(dl,{loading:c})})]})]})]})}var on,ul,Yy,fl=g(()=>{"use strict";tn();pl();on=[" 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 "],ul="#24CFFF",Yy="ripplo"});import{createAuthClient as Zy}from"better-auth/client";import{deviceAuthorizationClient as eg}from"better-auth/client/plugins";function an({baseURL:e}){return Zy({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[eg()]})}var oo=g(()=>{"use strict"});import{exec as tg}from"child_process";async function gl({cwd:e,onDeviceCode:t,url:n}){let r=n??gt().RIPPLO_SERVER_URL,o=an({baseURL:r}),a=await o.device.code({client_id:yl});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}),lg(s);let c=await rg({authClient:o,deviceCode:i});return rr(e,c),c}async function rg({authClient:e,deviceCode:t}){for(;;){await ig(ng);let n=await e.device.token({client_id:yl,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(!ag(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function ag(e){return og.has(e)}function ig(e){return new Promise(t=>{setTimeout(t,e)})}function sg(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function lg(e){let t=sg();tg(`${t} "${e}"`,()=>{})}var ng,yl,og,hl=g(()=>{"use strict";me();oo();Jt();ng=5e3,yl="ripplo-cli";og=new Set(["authorization_pending","slow_down"])});import{useCallback as ao,useEffect as cg,useState as Ie}from"react";import{exec as dg}from"child_process";import{promisify as pg}from"util";import Q from"fs";import ie from"path";function Al({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Ie(t==null?"login":"validating"),[a,i]=Ie(),[l,s]=Ie(),[c,p]=Ie(t),[u,d]=Ie(!1),[m,h]=Ie(),[k,S]=Ie();cg(()=>{if(t==null)return;an({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(R=>{if(R.data==null){o("login");return}return io({cwd:e,serverUrl:n,token:t})}).then(R=>{if(R==null){o("select-project");return}i(R),o("complete")}).catch(R=>{s(R instanceof Error?R.message:String(R)),o("login")})},[e,t,n]);let A=ao(()=>{u||(d(!0),s(void 0),gl({cwd:e,onDeviceCode:h,url:n}).then(T=>(p(T),io({cwd:e,serverUrl:n,token:T}))).then(T=>{T==null?o("select-project"):(i(T),o("complete"))}).catch(T=>{d(!1),h(void 0),s(T instanceof Error?T.message:String(T))}))},[e,u,n]),w=ao(T=>{let R=a?.token??c??t;if(R==null){s("No authentication token available");return}o("scaffolding"),s(void 0),mg({cwd:e,onStep:S,projectId:T.id}).then(()=>io({cwd:e,serverUrl:n,token:R})).then(P=>{i(P??{appUrl:"",preconditionsUrl:"",projectId:T.id,ripploServerUrl:n,token:R,webhookSecret:""}),o("complete")}).catch(P=>{s(P instanceof Error?P.message:String(P)),o("select-project")})},[a,e,t,n,c]),x=ao(()=>{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 io({cwd:e,serverUrl:t,token:n}){let r=await D(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function mg({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Sg({cwd:e,projectId:n}),t("Updating .gitignore..."),Rg(e),t("Marking ripplo.lock as generated..."),yg(e),t("Installing dependencies..."),await gg(e),t("Compiling initial lockfile..."),await fg(e),t("Setting up browser..."),await qn()}async function fg(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 yg(e){let t=ie.join(e,".gitattributes"),n=Q.existsSync(t)?Q.readFileSync(t,"utf8"):"";if(n.includes(kl))return;let r=n.length===0||n.endsWith(`
243
+ `)?"":`
244
+ `;Q.writeFileSync(t,`${n}${r}${kl}
245
+ `)}async function gg(e){let t=hg(e),n=t==="yarn"?`yarn add -D ${Sl.join(" ")}`:`${t} add -D ${Sl.join(" ")}`;b.info("Installing dependencies: %s",n),await ug(n,{cwd:e})}function hg(e){return Q.existsSync(ie.join(e,"pnpm-lock.yaml"))?"pnpm":Q.existsSync(ie.join(e,"yarn.lock"))?"yarn":Q.existsSync(ie.join(e,"bun.lockb"))||Q.existsSync(ie.join(e,"bun.lock"))?"bun":"npm"}function Sg({cwd:e,projectId:t}){let n=ie.join(e,".ripplo"),r=ie.join(n,"tests"),o=ie.join(n,"preconditions");Q.mkdirSync(r,{recursive:!0}),Q.mkdirSync(o,{recursive:!0}),sn(ie.join(n,"ripplo.ts"),kg(t)),sn(ie.join(n,"index.ts"),wg),sn(ie.join(n,".env"),Ag()),sn(ie.join(n,"tsconfig.json"),bg)}function sn(e,t){Q.existsSync(e)||Q.writeFileSync(e,t)}function kg(e){return`import { config } from "dotenv";
242
246
  import { createRipplo } from "@ripplo/testing";
243
247
  import { z } from "zod";
244
248
 
@@ -258,18 +262,18 @@ const ripplo = createRipplo({
258
262
  });
259
263
 
260
264
  export default ripplo;
261
- `}function jf(){return`RIPPLO_WEBHOOK_SECRET="${nr()}"
262
- `}function Vf(e){let t=ee.join(e,".gitignore");if(!re.existsSync(t))return;let n=re.readFileSync(t,"utf8"),r=Df.filter(a=>!n.includes(a));if(r.length===0)return;let o=n.endsWith(`
265
+ `}function Ag(){return`RIPPLO_WEBHOOK_SECRET="${Lr()}"
266
+ `}function Rg(e){let t=ie.join(e,".gitignore");if(!Q.existsSync(t))return;let n=Q.readFileSync(t,"utf8"),r=Ng.filter(a=>!n.includes(a));if(r.length===0)return;let o=n.endsWith(`
263
267
  `)?"":`
264
- `;re.writeFileSync(t,n+o+r.join(`
268
+ `;Q.writeFileSync(t,n+o+r.join(`
265
269
  `)+`
266
- `)}var zs,$f,Bf,Df,Gs=y(()=>{"use strict";oe();Js();jr();ae();zs=["@ripplo/testing","dotenv","zod"];$f=`// Register every precondition and test here. The CLI loads this one file \u2014
270
+ `)}var Sl,ug,kl,wg,bg,Ng,wl=g(()=>{"use strict";me();$e();hl();oo();ue();Sl=["@ripplo/testing","dotenv","zod"],ug=pg(dg);kl=".ripplo/ripplo.lock linguist-generated=true";wg=`// Register every precondition and test here. The CLI loads this one file \u2014
267
271
  // anything not imported from here is invisible to ripplo run / lint / status.
268
272
  // When you add a test under ./tests or a precondition under ./preconditions,
269
273
  // add a matching \`import "./..."\` line below.
270
274
 
271
275
  export { default } from "./ripplo.js";
272
- `,Bf=`{
276
+ `,bg=`{
273
277
  "compilerOptions": {
274
278
  "strict": true,
275
279
  "noUncheckedIndexedAccess": true,
@@ -285,31 +289,35 @@ export { default } from "./ripplo.js";
285
289
  "include": ["*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
286
290
  "exclude": ["node_modules"]
287
291
  }
288
- `,Df=[".ripplo/debug/",".ripplo/.token",".ripplo/.env"]});import{useCallback as Wf,useState as qf}from"react";import{Box as Dr,Text as Vr}from"ink";import{Provider as Wr}from"urql";import{jsx as X,jsxs as Ff}from"react/jsx-runtime";function Hs({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=qf(!0),a=Xs({cwd:e,initialToken:t,serverUrl:n}),{height:i,width:l}=Ue(),s=Wf(()=>{o(!1)},[]);if(r)return X(Ws,{onDismiss:s});if(a.stage==="validating")return X(Dr,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Ff(Vr,{children:[X(Vr,{color:"yellow",children:"* "}),X(Vr,{children:"Validating session..."})]})});if(a.stage==="login")return X(Dr,{alignItems:"center",height:i,justifyContent:"center",width:l,children:X(Pr,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})});if(a.config!=null){let d=xr({config:a.config});return qr({client:d,projectId:a.config.projectId}),a.stage==="complete"?X(Wr,{value:d,children:X(_s,{config:a.config,cwd:e})}):X(Wr,{value:d,children:X(Or,{config:a.config,error:a.error,selectProject:a.selectProject,stage:a.stage})})}if(a.token!=null){let d={appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:n,token:a.token,webhookSecret:""},p=xr({config:d});return X(Wr,{value:p,children:X(Or,{config:d,error:a.error,selectProject:a.selectProject,stage:a.stage})})}return X(Dr,{alignItems:"center",height:i,justifyContent:"center",width:l,children:X(Pr,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})})}var Ks=y(()=>{"use strict";Fr();fs();gs();bs();Is();qs();Gs();jt()});var Qs={};il(Qs,{clearActiveSession:()=>Gf,launchDashboard:()=>Kf,setActiveSession:()=>qr});import qt from"fs";import Mr from"path";import Mf from"react";import{render as Jf}from"ink";import{graphql as zf}from"gql.tada";function qr({client:e,projectId:t}){Ft=e,Mt=t}function Gf(){Ft=void 0,Mt=void 0}function Hf(){if(Ft==null||Mt==null)return Promise.resolve();let e=Ft.mutation(Xf,{projectId:Mt}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function Kf(){let e=process.cwd(),t=Mr.join(e,".ripplo","debug"),n=Mr.join(t,"last-crash.log");function r(i){qt.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);qt.writeFileSync(n,`${new Date().toISOString()}
292
+ `,Ng=[".ripplo/debug/",".ripplo/.token",".ripplo/.env"]});import{useCallback as Tg,useState as Lg}from"react";import{Box as so,Text as lo}from"ink";import{Provider as co}from"urql";import{jsx as Y,jsxs as Cg}from"react/jsx-runtime";function bl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Lg(!0),a=Al({cwd:e,initialToken:t,serverUrl:n}),{height:i,width:l}=He(),s=Tg(()=>{o(!1)},[]);if(r)return Y(ml,{onDismiss:s});if(a.stage==="validating")return Y(so,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Cg(lo,{children:[Y(lo,{color:"yellow",children:"* "}),Y(lo,{children:"Validating session..."})]})});if(a.stage==="login")return Y(so,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Y(Yr,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})});if(a.config!=null){let c=Qr({config:a.config});return po({client:c,projectId:a.config.projectId}),a.stage==="complete"?Y(co,{value:c,children:Y(il,{config:a.config,cwd:e})}):Y(co,{value:c,children:Y(eo,{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=Qr({config:c});return Y(co,{value:p,children:Y(eo,{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(Yr,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})})}var Nl=g(()=>{"use strict";uo();Vs();qs();Qs();sl();fl();wl();tn()});var Rl={};Ul(Rl,{clearActiveSession:()=>Og,launchDashboard:()=>_g,setActiveSession:()=>po});import ln from"fs";import mo from"path";import vg from"react";import{render as xg}from"ink";import{graphql as Pg}from"gql.tada";function po({client:e,projectId:t}){cn=e,dn=t}function Og(){cn=void 0,dn=void 0}function Ug(){if(cn==null||dn==null)return Promise.resolve();let e=cn.mutation(Eg,{projectId:dn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function _g(){let e=process.cwd(),t=mo.join(e,".ripplo","debug"),n=mo.join(t,"last-crash.log");function r(i){ln.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);ln.writeFileSync(n,`${new Date().toISOString()}
289
293
  ${l}
290
- `),is().finally(()=>{process.exit(1)})}let o;try{let i=Ke(e),l=Lt();un({filePath:Mr.join(t,"debug.log")}),o=Jf(Mf.createElement(Hs,{cwd:e,initialToken:i??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>Hf()).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{qt.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);qt.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
294
+ `),Os().finally(()=>{process.exit(1)})}let o;try{let i=ut(e),l=zt();jn({filePath:mo.join(t,"debug.log")}),o=xg(vg.createElement(bl,{cwd:e,initialToken:i??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>Ug()).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{ln.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);ln.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
291
295
  ${l}
292
296
 
293
- `)}catch{}})}var Xf,Ft,Mt,Fr=y(()=>{"use strict";Tr();oe();Ks();Ct();Xf=zf(`
297
+ `)}catch{}})}var Eg,cn,dn,uo=g(()=>{"use strict";Jr();me();Nl();Jt();Eg=Pg(`
294
298
  mutation EndDevSessionExit($projectId: String!) {
295
299
  endDevSession(projectId: $projectId) {
296
300
  id
297
301
  }
298
302
  }
299
- `)});import{config as Ys}from"dotenv";import Qf from"fs";import $e from"path";import{fileURLToPath as Yf}from"url";import Zf from"yargs";import{hideBin as ey}from"yargs/helpers";oe();import gr from"fs";import Zp from"path";import{chromium as eu}from"playwright";ae();import Qp from"fs";import Yp from"path";async function Ei(e){let t=Yp.join(e,".ripplo","index.ts");if(!Qp.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 yr(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 Oi({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}}ae();function Ui(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}}async function _i(e){let t=await tu(e),n=nu(e),r=ru(),o=await V(e),a=ou(o),i=au(o),l=await iu(t,o);return[t,n,...l,a,i,r]}async function tu(e){let t=await Ei(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 nu(e){let t=Zp.join(e,".ripplo",".token");return gr.existsSync(t)?{exists:gr.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function ru(){let e=eu.executablePath();return{installed:gr.existsSync(e),type:"browser"}}function ou(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 au(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 iu(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await yr(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let a=await su(n,t);return r.push(...a),r}async function su(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=cu(e.appUrl,e.preconditionsUrl);if(a==null)return[o];let i=await yr(a)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:i,type:"preconditions"}),Ii(e.preconditionsUrl)&&l.push({reachable:i,type:"precondition-endpoint",url:a}),!i)return l;let s=await Oi({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let d=await lu({preconditionUrl:a,webhookSecret:e.webhookSecret});return l.push({status:d,type:"adapter-enabled",url:a}),l}async function lu({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",...Pe({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 du(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 Ii(e){return e.startsWith("http://")||e.startsWith("https://")}function cu(e,t){return Ii(t)?t:`${e}${t}`}function ji(e){switch(e.type){case"settings":return pu(e);case"token":return uu(e);case"dev-server":return mu(e);case"preconditions":return gu(e);case"webhook-verification":return fu(e);case"state-graph":return hu(e);case"workflows":return Su(e);case"browser":return yu(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 du(e)}}function pu(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function uu(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function mu(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 fu(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 yu(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function gu(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 hu(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"}
303
+ `)});import{config as Tl}from"dotenv";import Ig from"fs";import Ye from"path";import{fileURLToPath as jg}from"url";import $g from"yargs";import{hideBin as Bg}from"yargs/helpers";$e();ue();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 Nt({cwd:t}),o=Rt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${pe} is up to date
305
+ `);return}let a=o==="missing"?"missing":"out of date";process.stderr.write(`${pe} 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 ${pe}
307
+ `)}me();$e();import ft from"fs";import os from"path";import{chromium as xm}from"playwright";ue();import Cm from"fs";import vm from"path";async function ns(e){let t=vm.join(e,".ripplo","index.ts");if(!Cm.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 Br(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 rs({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}}ue();function as(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 is(e){let t=await Om(e),n=Um(e),r=_m(),o=await D(e),a=Im(o),i=jm(o),l=await Pm(e,o),s=Em(e),c=await $m(t,o);return[t,n,...c,a,i,l,s,r]}async function Pm(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await Nt({cwd:e});return{status:Rt({compiled:t.result,existing:n}),type:"lockfile"}}function Em(e){let t=os.join(e,".git","hooks","pre-commit");return ft.existsSync(t)?{installed:ft.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Om(e){let t=await ns(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 Um(e){let t=os.join(e,".ripplo",".token");return ft.existsSync(t)?{exists:ft.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function _m(){let e=xm.executablePath();return{installed:ft.existsSync(e),type:"browser"}}function Im(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 jm(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 $m(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await Br(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let a=await Bm(n,t);return r.push(...a),r}async function Bm(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=Wm(e.appUrl,e.preconditionsUrl);if(a==null)return[o];let i=await Br(a)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:i,type:"preconditions"}),ss(e.preconditionsUrl)&&l.push({reachable:i,type:"precondition-endpoint",url:a}),!i)return l;let s=await rs({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await Dm({preconditionUrl:a,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:a}),l}async function Dm({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 Vm(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 ss(e){return e.startsWith("http://")||e.startsWith("https://")}function Wm(e,t){return ss(t)?t:`${e}${t}`}function ls(e){switch(e.type){case"settings":return Mm(e);case"token":return zm(e);case"dev-server":return Jm(e);case"preconditions":return Hm(e);case"webhook-verification":return Xm(e);case"state-graph":return Km(e);case"workflows":return Qm(e);case"browser":return Gm(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 Vm(e);case"lockfile":return qm(e);case"pre-commit-hook":return Fm(e)}}function qm(e){switch(e.status){case"match":return`\u2713 Lockfile: ${pe} is up to date`;case"missing":return`\u2717 Lockfile: ${pe} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${pe} is out of date \u2014 run \`ripplo compile\` and commit it`}}function Fm(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 Mm(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function zm(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Jm(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 Xm(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 Gm(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function Hm(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 Km(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"}
300
308
  ${t.join(`
301
- `)}`}function Su(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=>ku(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
309
+ `)}`}function Qm(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=>Ym(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
302
310
  ${t.join(`
303
- `)}`}function ku(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
311
+ `)}`}function Ym(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
304
312
  `+t.join(`
305
- `)}async function $i(){let e=process.cwd(),t=await _i(e),n=t.map(o=>ji(o));process.stdout.write(n.join(`
313
+ `)}async function cs(){let e=process.cwd(),t=await is(e),n=t.map(o=>ls(o));process.stdout.write(n.join(`
306
314
  `)+`
307
- `);let r=t.some(o=>Ui(o));process.exit(r?1:0)}oe();import{graphql as Tt,readFragment as Au}from"gql.tada";import Bi from"figures";var Ye={cross:Bi.cross,tick:Bi.tick};var Vi=Tt(`
315
+ `);let r=t.some(o=>as(o));process.exit(r?1:0)}me();import{graphql as Ft,readFragment as Zm}from"gql.tada";import ds from"figures";var yt={cross:ds.cross,tick:ds.tick};var us=Ft(`
308
316
  fragment WorkflowIdMCP on Workflow {
309
317
  id
310
318
  slug
311
319
  }
312
- `),wu=Tt(`
320
+ `),ef=Ft(`
313
321
  query ProjectWorkflowIdsMCP($projectId: String!) {
314
322
  project(id: $projectId) {
315
323
  id
@@ -321,14 +329,14 @@ ${t.join(`
321
329
  }
322
330
  }
323
331
  }
324
- `,[Vi]),Ru=Tt(`
332
+ `,[us]),tf=Ft(`
325
333
  mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
326
334
  createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
327
335
  id
328
336
  status
329
337
  }
330
338
  }
331
- `),Nu=Tt(`
339
+ `),nf=Ft(`
332
340
  query RunStatusMCP($id: String!) {
333
341
  run(id: $id) {
334
342
  id
@@ -355,16 +363,16 @@ ${t.join(`
355
363
  }
356
364
  }
357
365
  }
358
- `);async function bt({config:e,ids:t}){let n=await Tu({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:d})=>{let p=await Lu({config:e,workflowId:d});return{id:s,runId:p}})),o=[],a=[];r.forEach((s,d)=>{let p=n[d];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:d})=>{let p=await vu({config:e,runId:d}),u=bu({config:e,id:s,runId:d}),c=`.ripplo/debug/${d}/`;return{id:s,runId:d,summary:`View run: ${u}
359
- Debug artifacts: ${c}
366
+ `);async function Mt({config:e,ids:t}){let n=await rf({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:c})=>{let p=await af({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 lf({config:e,runId:c}),u=of({config:e,id:s,runId:c}),d=`.ripplo/debug/${c}/`;return{id:s,runId:c,summary:`View run: ${u}
367
+ Debug artifacts: ${d}
360
368
 
361
- ${p}`}}))).forEach((s,d)=>{let p=o[d];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}:**
369
+ ${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}:**
362
370
  ${s.summary}`).join(`
363
371
 
364
372
  ---
365
373
 
366
- `);return{results:a,summary:l}}async function Tu({config:e,ids:t}){let n=await $({config:e,document:wu,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=>Au(Vi,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 bu({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function Lu({config:e,workflowId:t}){let n=await $({config:e,document:Ru,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Cu=2e3,Di=150;async function vu({config:e,runId:t}){let n=0;for(;n<Di;){await Pu(Cu),n+=1;let o=(await $({config:e,document:Nu,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return xu({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(Di)} times.`}function xu({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"?Ye.tick:Ye.cross,l=a.detail==null?"":` \u2014 ${a.detail}`;r.push(` ${i} ${a.title} (${String(a.duration)}ms)${l}`),a.assertions.forEach(s=>{let d=s.status==="passed"?Ye.tick:Ye.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${d} ${s.description}${p}`)})})}),r.join(`
367
- `)}function Pu(e){return new Promise(t=>{setTimeout(t,e)})}oe();ae();Ct();import{graphql as ju}from"gql.tada";var $u=ju(`
374
+ `);return{results:a,summary:l}}async function rf({config:e,ids:t}){let n=await W({config:e,document:ef,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=>Zm(us,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 of({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function af({config:e,workflowId:t}){let n=await W({config:e,document:tf,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var sf=2e3,ps=150;async function lf({config:e,runId:t}){let n=0;for(;n<ps;){await df(sf),n+=1;let o=(await W({config:e,document:nf,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return cf({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(ps)} times.`}function cf({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"?yt.tick:yt.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"?yt.tick:yt.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
375
+ `)}function df(e){return new Promise(t=>{setTimeout(t,e)})}me();ue();Jt();import{graphql as gf}from"gql.tada";var hf=gf(`
368
376
  query DevSessionCheckPreflight($projectId: String!) {
369
377
  project(id: $projectId) {
370
378
  id
@@ -373,36 +381,36 @@ ${s.summary}`).join(`
373
381
  }
374
382
  }
375
383
  }
376
- `);async function vt(){let e=process.cwd(),t=Ke(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}
377
- `),process.exit(1)),{...n.result.config,ripploServerUrl:Lt(),token:t}}async function xt(e){(await $({config:e,document:$u,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 Fi({id:e,runs:t}){let n=await vt();await xt(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
378
- `);let r=await Promise.allSettled(Array.from({length:t},()=>bt({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 d=s.value.results[0];if(d==null){a++;return}if(d.summary.includes("FAILED")||d.summary.includes("ERROR")){a++;let p=d.summary.split(`
384
+ `);async function Xt(){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:zt(),token:t}}async function Gt(e){(await W({config:e,document:hf,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 ys({id:e,runs:t}){let n=await Xt();await Gt(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
386
+ `);let r=await Promise.allSettled(Array.from({length:t},()=>Mt({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(`
379
387
  `).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(`
380
388
  Results: ${String(o)} passed, ${String(a)} failed out of ${String(t)} runs
381
389
  `),process.stdout.write(`Flake rate: ${l.toFixed(1)}%
382
390
  `),i.size>0&&(process.stdout.write(`
383
391
  Failure patterns:
384
- `),i.forEach((s,d)=>{process.stdout.write(` ${String(s)}x: ${d}
385
- `)})),process.exit(a>0?1:0)}import kr from"fs";import zi from"path";fr();Rt();var Mi=Jr(tr(),1);import{z as et}from"zod";import{z as ne}from"zod";var Bu=et.object({appUrl:et.string(),preconditionsUrl:et.string(),projectId:et.string(),webhookSecret:et.string()});var Cw=ne.object({preconditions:ne.array(ne.string().min(1))}),vw=ne.object({data:ne.record(ne.string(),ne.record(ne.string(),ne.string())),preconditions:ne.array(ne.string().min(1))});function Ji(e){let t=[];return e.tests.forEach(n=>{let r=Du(n),o=a=>{t.push({...a,test:n.slug})};am.forEach(a=>{a(r,n,o)})}),{diagnostics:t}}function Du(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 Vu(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 Wu(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Gu(o.value)){let a=o.value.value;!Hu(a)&&Ku(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 qu(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 Fu(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 Mu(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 Ju(e,t,n){let r=0;e.forEach(o=>{Ee(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 zu(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!Ee(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 Xu(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Gu(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Hu(e){return e.includes("{{")}function Ku(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function Ee(e){return e.type.startsWith("assert")}var Qu=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function Yu(e){return Qu.has(e.type)}function Zu(e,t,n){!t.implemented||e.length===0||e.some(r=>Ee(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function em(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(a=>Ee(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 tm(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(d=>d.type==="assertVisible"&&hr(d)===a)==null||i.some(d=>Yu(d)||Ee(d)&&hr(d)!==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 nm=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 Sr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!nm.has(t))}function rm(e){let t=e.label==null?[]:Sr(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,...Sr(r)]}function om(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(Sr(t.expectedOutcome));if(r.size===0)return;let o=e.filter(i=>Ee(i));if(o.length===0)return;o.some(i=>rm(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 am=[Vu,Wu,qu,Fu,Mu,Ju,zu,Xu,Zu,em,tm,om];ae();async function Xi(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await V(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
386
- `),process.exit(1));let a=Ji(o.result),i=t.length===0?a.diagnostics:a.diagnostics.filter(c=>t.includes(c.test)),l=new Map;i.forEach(c=>{let m=l.get(c.test)??[];l.set(c.test,[...m,c])}),l.forEach((c,m)=>{process.stderr.write(`
392
+ `),i.forEach((s,c)=>{process.stdout.write(` ${String(s)}x: ${c}
393
+ `)})),process.exit(a>0?1:0)}import Wr from"fs";import Ss from"path";gn();Tt();var gs=fo(Tr(),1);import{z as ht}from"zod";import{z as ce}from"zod";var Sf=ht.object({appUrl:ht.string(),preconditionsUrl:ht.string(),projectId:ht.string(),webhookSecret:ht.string()});var vN=ce.object({preconditions:ce.array(ce.string().min(1))}),xN=ce.object({data:ce.record(ce.string(),ce.record(ce.string(),ce.string())),preconditions:ce.array(ce.string().min(1))});function hs(e){let t=[];return e.tests.forEach(n=>{let r=kf(n),o=a=>{t.push({...a,test:n.slug})};Df.forEach(a=>{a(r,n,o)})}),{diagnostics:t}}function kf(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 Af(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 wf(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&vf(o.value)){let a=o.value.value;!xf(a)&&Pf(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 bf(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 Nf(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 Rf(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 Tf(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 Lf(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 Cf(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function vf(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function xf(e){return e.includes("{{")}function Pf(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 Ef=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function Of(e){return Ef.has(e.type)}function Uf(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 _f(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 Dr(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 If(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let a=Dr(r);if(a==null)return;let i=e.slice(o+1,o+4);i.find(c=>c.type==="assertVisible"&&Dr(c)===a)==null||i.some(c=>Of(c)||Je(c)&&Dr(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 jf=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 Vr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!jf.has(t))}function $f(e){let t=e.label==null?[]:Vr(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,...Vr(r)]}function Bf(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(Vr(t.expectedOutcome));if(r.size===0)return;let o=e.filter(i=>Je(i));if(o.length===0)return;o.some(i=>$f(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 Df=[Af,wf,bf,Nf,Rf,Tf,Lf,Cf,Uf,_f,If,Bf];$e();ue();async function ks(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=hs(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(`
387
395
  ${m}
388
- `),c.forEach(g=>{let S=g.step==null?"":` at "${g.step}"`;process.stderr.write(` [${g.rule}]${S}
389
- `),process.stderr.write(` ${g.message}
390
- `)})});let s=new Set(o.builder.getUnimplemented().tests),d=n.filter(c=>s.has(c));d.length>0&&(process.stderr.write(`
396
+ `),d.forEach(h=>{let k=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${k}
397
+ `),process.stderr.write(` ${h.message}
398
+ `)})});let s=new Set(o.builder.getUnimplemented().tests),c=n.filter(d=>s.has(d));c.length>0&&(process.stderr.write(`
391
399
  not-implemented
392
- `),d.forEach(c=>{process.stderr.write(` ${c} is still marked .notImplemented()
393
- `)}));let p=lm(r);p.length>0&&(process.stderr.write(`
400
+ `),c.forEach(d=>{process.stderr.write(` ${d} is still marked .notImplemented()
401
+ `)}));let p=qf(r);p.length>0&&(process.stderr.write(`
394
402
  preconditions
395
- `),p.forEach(c=>{process.stderr.write(` [hardcoded-identifier] ${c.file}
396
- `),process.stderr.write(` ${c.message}
397
- `)}));let u=i.length+d.length+p.length;u>0&&(process.stderr.write(`
403
+ `),p.forEach(d=>{process.stderr.write(` [hardcoded-identifier] ${d.file}
404
+ `),process.stderr.write(` ${d.message}
405
+ `)}));let u=i.length+c.length+p.length;u>0&&(process.stderr.write(`
398
406
  ${String(u)} error(s)
399
- `),process.exit(1))}var im=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,sm=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function lm(e){let t=zi.join(e,".ripplo","preconditions");return kr.existsSync(t)?kr.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>dm(zi.join(t,r))):[]}function dm(e){let t=kr.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=im.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=sm.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 Gi(e){let t=await vt();await xt(t);let{results:n,summary:r}=await bt({config:t,ids:e});process.stdout.write(`${r}
400
- `);let o=n.some(a=>a.summary.includes("FAILED")||a.summary.includes("ERROR"));process.exit(o?1:0)}ae();async function Hi(e){let t=process.cwd(),n=await V(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
407
+ `),process.exit(1))}var Vf=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Wf=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function qf(e){let t=Ss.join(e,".ripplo","preconditions");return Wr.existsSync(t)?Wr.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>Ff(Ss.join(t,r))):[]}function Ff(e){let t=Wr.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Vf.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=Wf.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 As(e){let t=await Xt();await Gt(t);let{results:n,summary:r}=await Mt({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)}ue();async function ws(e){let t=process.cwd(),n=await D(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
401
409
  `),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
402
410
  `);return}let o={tests:r.map(a=>({id:a,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
403
- `)}var Zs=$e.resolve($e.dirname(Yf(import.meta.url)),"..");Ys({path:$e.join(Zs,".env.local"),quiet:!0});Ys({path:$e.join(Zs,".env"),quiet:!0});ny();async function ty(){await Zf(ey(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},async()=>{let{launchDashboard:e}=await Promise.resolve().then(()=>(Fr(),Qs));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=>Gi(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=>Xi({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=>Fi({id:e.id,runs:e.runs})).command("doctor","Check project health",()=>{},()=>$i()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Hi({format:e.format})).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}ty().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
404
- `),process.exit(1)});function ny(){let e=process.cwd(),t=el(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
405
- `))}function el(e){let t=$e.dirname(e);return Qf.existsSync($e.join(e,".ripplo"))?e:t===e?null:el(t)}export{ty as main};
411
+ `)}var Ll=Ye.resolve(Ye.dirname(jg(import.meta.url)),"..");Tl({path:Ye.join(Ll,".env.local"),quiet:!0});Tl({path:Ye.join(Ll,".env"),quiet:!0});Vg();async function Dg(){await $g(Bg(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},async()=>{let{launchDashboard:e}=await Promise.resolve().then(()=>(uo(),Rl));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=>As(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=>ks({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=>ys({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",()=>{},()=>cs()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>ws({format:e.format})).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}Dg().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
412
+ `),process.exit(1)});function Vg(){let e=process.cwd(),t=Cl(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
413
+ `))}function Cl(e){let t=Ye.dirname(e);return Ig.existsSync(Ye.join(e,".ripplo"))?e:t===e?null:Cl(t)}export{Dg as main};
406
414
  /*! Bundled license information:
407
415
 
408
416
  mustache/mustache.mjs: