ripplo 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +326 -114
  2. package/package.json +6 -4
package/dist/index.js CHANGED
@@ -1,111 +1,112 @@
1
1
  #!/usr/bin/env node
2
- var Il=Object.create;var hn=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var $l=Object.getOwnPropertyNames;var Dl=Object.getPrototypeOf,Bl=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(e&&(t=e(e=0)),t);var St=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vl=(e,t)=>{for(var n in t)hn(e,n,{get:t[n],enumerable:!0})},Wl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $l(t))!Bl.call(e,o)&&o!==n&&hn(e,o,{get:()=>t[o],enumerable:!(r=jl(t,o))||r.enumerable});return e};var fo=(e,t,n)=>(n=e!=null?Il(Dl(e)):{},Wl(t||!e||!e.__esModule?hn(n,"default",{value:e,enumerable:!0}):n,e));import kn from"fs/promises";import Sn from"path";import{z as At}from"zod";import{z as yo}from"zod";import{z as Ie}from"zod";import{z as f}from"zod";import{z as Se}from"zod";import{z as Ao}from"zod";import{z as F}from"zod";import{z as ee}from"zod";import{z as te}from"zod";function bn(e){return ho({legacy:void 0,migrators:[],name:e,schemas:[]})}function zl(e,t){let n=JSON.parse(t);return e.decode(n)}function ho(e){return{initial:t=>An(t,{...e,schemas:[t]}),legacy:t=>ho({...e,legacy:t})}}function An(e,t){return{build:()=>Jl(e,t),legacy:n=>An(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return An(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function Jl(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Xl(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Xl(e,t,n){let{data:r,version:o}=Hl(t,n),a=ko(t,r,o);return e.parse(a)}function Hl(e,t){let n=ql.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Ml({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function ko(e,t,n){let r=e.schemas.length;if(n>r)throw new Fl({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return ko(e,i(a),n+1)}function Ro(e){return{preconditions:e.preconditions,tests:e.tests.filter(t=>t.implemented).map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,preconditions:[...t.preconditions],requiresKeys:{...t.requiresKeys},slug:t.slug,spec:t.spec}))}}function wn(e){let t=bo.encode(e);return`${JSON.stringify(t,Gc(t),2)}
3
- `}async function wt({cwd:e}){let t=Sn.join(e,me),n=await Xc(t);return n==null?null:zl(bo,n)}async function Ae({cwd:e,result:t}){let n=Ro(t),r=Sn.join(e,me);await kn.mkdir(Sn.dirname(r),{recursive:!0}),await kn.writeFile(r,wn(n),"utf8")}function bt({compiled:e,existing:t}){if(t==null)return"missing";let n=wn(Ro(e)),r=wn(t);return n===r?"match":"stale"}async function Xc(e){try{return await kn.readFile(e,"utf8")}catch(t){if(Hc(t)&&t.code==="ENOENT")return null;throw t}}function Hc(e){return e instanceof Error&&"code"in e}function Gc(e){return function(n,r){return r===e||!Kc(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[a])=>o.localeCompare(a)))}}function Kc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ql,Fl,Ml,So,Gl,Kl,_,Qe,Yl,Ql,Rn,Zl,ue,ec,tc,C,go,nc,rc,oc,ac,ic,sc,lc,cc,dc,pc,uc,mc,fc,yc,gc,hc,kc,Sc,Ac,wc,bc,Rc,Nc,Tc,Lc,Cc,vc,xc,Pc,Ec,Oc,Uc,_c,Ic,jc,$c,Dc,Bc,wo,Vc,Wc,qc,vh,xh,me,Fc,Mc,zc,Jc,bo,je=g(()=>{"use strict";ql=At.object({__codec:At.string().min(1),data:At.unknown(),version:At.number().int().positive()}),Fl=class extends Error{codec;currentVersion;gotVersion;constructor(e){super(`Unsupported ${e.codec} version ${String(e.gotVersion)} (current ${String(e.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=e.codec,this.currentVersion=e.currentVersion,this.gotVersion=e.gotVersion}},Ml=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};So=Ie.object({depends:Ie.array(Ie.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Ie.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Ie.array(Ie.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name."),Gl=Se.object({by:Se.literal("testId"),value:Se.string().min(1)}),Kl=Se.object({by:Se.literal("role"),name:Se.string().optional(),role:Se.string().min(1)}),_=Se.discriminatedUnion("by",[Gl,Kl]),Qe=Ao.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Yl=Ao.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Ql=F.object({type:F.literal("static"),value:F.union([F.string(),F.number(),F.boolean()])}),Rn=F.object({name:F.string().min(1),type:F.literal("variable")}),Zl=F.discriminatedUnion("type",[Ql,Rn]),ue=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.string()}),Rn]),ec=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.number().int().nonnegative()}),Rn]),tc=ee.discriminatedUnion("type",[ee.object({default:ee.string().optional(),type:ee.literal("string")}),ee.object({default:ee.number().optional(),type:ee.literal("number")}),ee.object({default:ee.boolean().optional(),type:ee.literal("boolean")}),ee.object({key:ee.string().min(1),type:ee.literal("env")})]),C={comment:f.string().max(2e3).optional(),id:f.string().min(1).max(200),label:f.string().max(500).optional(),next:f.string().max(200).optional(),timeout:f.number().int().positive().optional()},go=500,nc=f.object({...C,type:f.literal("goto"),url:ue}),rc=f.object({...C,locator:_,type:f.literal("click")}),oc=f.object({...C,locator:_,type:f.literal("fill"),value:ue}),ac=f.object({...C,locator:_,type:f.literal("select"),value:ue}),ic=f.object({...C,locator:_,type:f.literal("hover")}),sc=f.object({...C,key:f.string().min(1),locator:_.optional(),type:f.literal("press")}),lc=f.object({...C,locator:_,type:f.literal("check")}),cc=f.object({...C,locator:_,type:f.literal("uncheck")}),dc=f.object({...C,height:f.number().int().positive(),type:f.literal("setViewport"),width:f.number().int().positive()}),pc=f.object({...C,message:f.string().min(1),type:f.literal("fail")}),uc=f.object({...C,type:f.literal("setVariable"),value:Zl,variable:f.string().min(1)}),mc=f.object({...C,locator:_,type:f.literal("extractText"),variable:f.string().min(1)}),fc=f.object({...C,files:f.array(f.string()).min(1),locator:_,type:f.literal("upload")}),yc=f.object({...C,locator:_,type:f.literal("dblclick")}),gc=f.object({...C,source:_,target:_,type:f.literal("drag")}),hc=f.object({...C,locator:_,type:f.literal("scrollIntoView")}),kc=f.object({...C,locator:_,type:f.literal("type"),value:ue}),Sc=f.object({...C,locator:_,type:f.literal("focus")}),Ac=f.object({...C,locator:_,type:f.literal("clear")}),wc=f.object({...C,locator:_,type:f.literal("rightClick")}),bc=f.object({...C,action:f.enum(["accept","dismiss"]),promptText:f.string().optional(),type:f.literal("handleDialog")}),Rc=f.object({...C,action:f.enum(["read","write"]),type:f.literal("clipboard"),value:ue.optional(),variable:f.string().min(1).optional()}),Nc=f.object({...C,permission:f.string().min(1),state:f.enum(["granted","prompt"]),type:f.literal("setPermission")}),Tc=f.object({...C,locator:_,type:f.literal("assertVisible")}),Lc=f.object({...C,locator:_,type:f.literal("assertNotVisible")}),Cc=f.object({...C,expected:ue,locator:_,operator:Qe,type:f.literal("assertText")}),vc=f.object({...C,expected:ue,operator:Qe,type:f.literal("assertUrl")}),xc=f.object({...C,expected:ec,locator:_,operator:Yl,type:f.literal("assertCount")}),Pc=f.object({...C,expected:ue,locator:_,operator:Qe,type:f.literal("assertValue")}),Ec=f.object({...C,attribute:f.string().min(1),expected:ue,locator:_,operator:Qe,type:f.literal("assertAttribute")}),Oc=f.object({...C,locator:_,type:f.literal("assertEnabled")}),Uc=f.object({...C,locator:_,type:f.literal("assertDisabled")}),_c=f.object({...C,expected:ue,operator:Qe,type:f.literal("assertTitle")}),Ic=f.object({...C,locator:_,type:f.literal("assertChecked")}),jc=f.object({...C,locator:_,type:f.literal("assertNotChecked")}),$c=f.object({...C,locator:_,type:f.literal("assertFocused")}),Dc=f.object({...C,locator:_,type:f.literal("assertNotFocused")}),Bc=f.discriminatedUnion("type",[nc,rc,oc,ac,ic,sc,lc,cc,Tc,Lc,Cc,vc,xc,Pc,Ec,Oc,Uc,dc,pc,uc,mc,fc,yc,gc,hc,kc,Sc,Ac,wc,bc,Rc,Nc,_c,Ic,jc,$c,Dc]),wo=f.object({entryNode:f.string().min(1).max(200),nodes:f.record(f.string().max(200),Bc).refine(e=>Object.keys(e).length<=go,`Workflow has more than ${String(go)} nodes`),variableNamespaces:f.record(f.string().max(200),f.string().max(500)).optional(),variables:f.record(f.string().max(200),tc).optional()}),Vc=yo.record(yo.string().max(200),So),Wc={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},qc={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},vh=bn("workflow-spec").legacy(Wc).initial(wo).build(),xh=bn("precondition-map").legacy(qc).initial(Vc).build(),me=".ripplo/ripplo.lock",Fc=5e3,Mc=te.record(te.string().max(200),te.string().max(200)),zc=te.object({expectedOutcome:te.string().max(2e3),name:te.string().max(200),preconditions:te.array(te.string().max(200)).max(1e3),requiresKeys:Mc,slug:te.string().max(200),spec:wo}),Jc=te.object({preconditions:te.record(te.string().max(200),So),tests:te.array(zc).max(Fc)}),bo=bn("ripplo-lockfile").initial(Jc).build()});function No(e){return e.data}function To(e){return{as(t){return{data:{label:t,node:e}}}}}var Rt=g(()=>{"use strict"});function Nt(e){let t=e.getPreconditions(),n=e.getTests();Yc(n);let r={};t.forEach(a=>{r[a.name]={depends:[...a.dependsOn],description:a.description,returns:[...a.returns]}});let o=n.map(a=>Qc(a,t));return{config:e.getConfig(),preconditions:r,tests:o}}function Yc(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 Qc(e,t){let n=e.id,{accessedKeys:r,vars:o}=ed(e.requiresKeys),a=e.startsAtFn==null?void 0:e.startsAtFn(o),i=e.stepsFn==null?[]:e.stepsFn(o),l=a==null?i:[Zc(a),...i],s=td(l,r,e.requiresKeys),c=[];Object.keys(e.requiresKeys).length>0&&r.size===0&&e.implemented&&c.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()");let u=rd(e.requires,t);return{additionalChecks:[],description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,preconditions:u,requiresKeys:{...e.requiresKeys},slug:n,spec:s,warnings:c}}function Zc(e){return To({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function ed(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 td(e,t,n){let r={};e.forEach((i,l)=>{let s=`step-${String(l)}`,c=l<e.length-1?`step-${String(l+1)}`:void 0;r[s]=nd(i,s,c)});let o={};t.forEach(i=>{o[i]={default:`test-${i}`,type:"string"}});let a={...n};return{entryNode:"step-0",nodes:r,variableNamespaces:a,variables:o}}function nd(e,t,n){let{label:r,node:o}=No(e);return{...o,id:t,label:r,next:n}}function rd(e,t){let n=new Map(t.map(i=>[i.name,i])),r=[],o=new Set;function a(i){o.has(i)||(o.add(i),n.get(i)?.dependsOn.forEach(l=>{a(l)}),r.push(i))}return e.forEach(i=>{a(i)}),r}var Nn=g(()=>{"use strict";Rt()});var Lo=g(()=>{"use strict";Nn();Rt()});import od from"path";import{createJiti as ad}from"jiti";async function V(e){let t=od.join(e,".ripplo","index.ts");try{let r=await ad(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 fe=g(()=>{"use strict";Lo()});function Ln(e){return typeof e=="function"}function sd(e){return De(e)?"array":typeof e}function Tn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function vo(e,t){return e!=null&&typeof e=="object"&&t in e}function ld(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function dd(e,t){return cd.call(e,t)}function ud(e){return!dd(pd,e)}function fd(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return md[n]})}function Sd(e,t){if(!e)return[];var n=!1,r=[],o=[],a=[],i=!1,l=!1,s="",c=0;function p(){if(i&&!l)for(;a.length;)delete o[a.pop()];else a=[];i=!1,l=!1}var u,d,m;function h(L){if(typeof L=="string"&&(L=L.split(gd,2)),!De(L)||L.length!==2)throw new Error("Invalid tags: "+L);u=new RegExp(Tn(L[0])+"\\s*"),d=new RegExp("\\s*"+Tn(L[1])),m=new RegExp("\\s*"+Tn("}"+L[1]))}h(t||le.tags);for(var S=new et(e),k,A,w,P,E,N;!S.eos();){if(k=S.pos,w=S.scanUntil(u),w)for(var I=0,x=w.length;I<x;++I)P=w.charAt(I),ud(P)?(a.push(o.length),s+=P):(l=!0,n=!0,s+=" "),o.push(["text",P,k,k+1]),k+=1,P===`
4
- `&&(p(),s="",c=0,n=!1);if(!S.scan(u))break;if(i=!0,A=S.scan(kd)||"name",S.scan(yd),A==="="?(w=S.scanUntil(xo),S.scan(xo),S.scanUntil(d)):A==="{"?(w=S.scanUntil(m),S.scan(hd),S.scanUntil(d),A="&"):w=S.scanUntil(d),!S.scan(d))throw new Error("Unclosed tag at "+S.pos);if(A==">"?E=[A,w,k,S.pos,s,c,n]:E=[A,w,k,S.pos],c++,o.push(E),A==="#"||A==="^")r.push(E);else if(A==="/"){if(N=r.pop(),!N)throw new Error('Unopened section "'+w+'" at '+k);if(N[1]!==w)throw new Error('Unclosed section "'+N[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&h(w)}if(p(),N=r.pop(),N)throw new Error('Unclosed section "'+N[1]+'" at '+S.pos);return wd(Ad(o))}function Ad(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 wd(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 et(e){this.string=e,this.tail=e,this.pos=0}function $e(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function G(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var id,De,cd,pd,md,yd,gd,xo,hd,kd,le,Ze,Po,Eo=g(()=>{"use strict";id=Object.prototype.toString,De=Array.isArray||function(t){return id.call(t)==="[object Array]"};cd=RegExp.prototype.test;pd=/\S/;md={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};yd=/\s*/,gd=/\s+/,xo=/\s*=/,hd=/\s*\}/,kd=/#|\^|\/|>|\{|&|=|!/;et.prototype.eos=function(){return this.tail===""};et.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};et.prototype.scanUntil=function(t){var n=this.tail.search(t),r;switch(n){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=r.length,r};$e.prototype.push=function(t){return new $e(t,this)};$e.prototype.lookup=function(t){var n=this.cache,r;if(n.hasOwnProperty(t))r=n[t];else{for(var o=this,a,i,l,s=!1;o;){if(t.indexOf(".")>0)for(a=o.view,i=t.split("."),l=0;a!=null&&l<i.length;)l===i.length-1&&(s=vo(a,i[l])||ld(a,i[l])),a=a[i[l++]];else a=o.view[t],s=vo(o.view,t);if(s){r=a;break}o=o.parent}n[t]=r}return Ln(r)&&(r=r.call(this.view)),r};G.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};G.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||le.tags).join(":"),a=typeof r<"u",i=a?r.get(o):void 0;return i==null&&(i=Sd(t,n),a&&r.set(o,i)),i};G.prototype.render=function(t,n,r,o){var a=this.getConfigTags(o),i=this.parse(t,a),l=n instanceof $e?n:new $e(n,void 0);return this.renderTokens(i,l,r,t,o)};G.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};G.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(Ln(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}};G.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)};G.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),a=t.split(`
5
- `),i=0;i<a.length;i++)a[i].length&&(i>0||!r)&&(a[i]=o+a[i]);return a.join(`
6
- `)};G.prototype.renderPartial=function(t,n,r,o){if(r){var a=this.getConfigTags(o),i=Ln(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)}}};G.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};G.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||le.escape,a=n.lookup(t[1]);if(a!=null)return typeof a=="number"&&o===le.escape?String(a):o(a)};G.prototype.rawValue=function(t){return t[1]};G.prototype.getConfigTags=function(t){return De(t)?t:t&&typeof t=="object"?t.tags:void 0};G.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!De(t))return t.escape};le={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){Ze.templateCache=e},get templateCache(){return Ze.templateCache}},Ze=new G;le.clearCache=function(){return Ze.clearCache()};le.parse=function(t,n){return Ze.parse(t,n)};le.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+sd(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Ze.render(t,n,r,o)};le.escape=fd;le.Scanner=et;le.Context=$e;le.Writer=G;Po=le});function tt({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Rd({def:n,name:t})]))}function Rd({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??bd[e.type]??""}function nt({ref:e,variables:t}){if(e.type==="static")return e.value;let n=t[e.name];if(n==null||typeof n=="object")throw new Error(`Variable "${e.name}" is not defined`);return n}function Y({ref:e,variables:t}){let n=String(nt({ref:e,variables:t}));return Cn({raw:n,variables:t})}function Cn({raw:e,variables:t}){return Po.render(e,t,{},{escape:n=>n})}function vn({ref:e,variables:t}){let n=nt({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 bd,we=g(()=>{"use strict";Eo();bd={boolean:!1,number:0,string:""}});function B({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Oo(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Oo(e.name,n)})}}function Oo(e,t){return t==null?e:Cn({raw:e,variables:t})}var Ve=g(()=>{"use strict";we()});async function Uo({node:e,page:t,timeout:n}){await B({locator:e.source,page:t,variables:void 0}).dragTo(B({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function _o({node:e,page:t,timeout:n}){await B({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Io({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 jo({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=Y({ref:e.value,variables:n}),a=JSON.stringify(o);return await t.evaluate(`navigator.clipboard.writeText(${a})`),{variables:n}}if(e.variable==null)throw new Error("clipboard read requires a variable name to store the result");let r=String(await t.evaluate("navigator.clipboard.readText()"));return{variables:Be({name:e.variable,store:n,value:r})}}async function $o({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Do=g(()=>{"use strict";Ve();we()});async function xn({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 Td({node:e,page:t,timeout:n,variables:r});case"rightClick":return await _o({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=Y({ref:e.url,variables:r});return await t.goto(o,{timeout:n,waitUntil:"domcontentloaded"}),await t.waitForLoadState("load",{timeout:n}),await t.waitForFunction("document.body != null && document.body.childElementCount > 0 && (document.body.textContent?.trim().length ?? 0) > 0",void 0,{timeout:n}),await t.evaluate("new Promise((resolve) => { requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined))); })"),{variables:r}}case"fill":return Cd({node:e,page:t,timeout:n,variables:r});case"select":return vd({node:e,page:t,timeout:n,variables:r});case"type":return xd({node:e,page:t,timeout:n,variables:r});case"press":return await Ld({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Uo({node:e,page:t,timeout:n}),{variables:r};case"upload":return Pd({node:e,page:t,timeout:n,variables:r});case"extractText":return Ed({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=nt({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 Io({node:e,page:t,variables:r});case"clipboard":return jo({node:e,page:t,variables:r});case"setPermission":return await $o({node:e,page:t}),{variables:r}}}async function Td({node:e,page:t,timeout:n,variables:r}){return await B({locator:e.locator,page:t,variables:r})[Nd[e.type]]({timeout:n}),{variables:r}}async function Ld({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await B({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Cd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function vd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function xd({node:e,page:t,timeout:n,variables:r}){let o=Y({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Pd({node:e,page:t,timeout:n,variables:r}){return await B({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function Ed({node:e,page:t,timeout:n,variables:r}){let o=await B({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 Nd,Pn=g(()=>{"use strict";Do();Ve();we();Nd={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function be({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"}),Ud(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 Od(e){return"locator"in e}async function Ud(e){return(await Promise.all(e.map(n=>_d(n)))).filter(n=>n!=null)}async function _d(e){if(!Od(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 Tt({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=B({locator:e.source,page:t,variables:void 0}),a=B({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:a,type:"action"}]}if(!Id(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=B({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function Id(e){return"locator"in e&&e.locator!=null}var rt=g(()=>{"use strict";Ve()});import{z as jd}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=jd.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 T(e){let t=e.specNode==null?[]:Tt({node:e.specNode,page:e.page}),n=await be({page:e.page,runStartTime:e.runStartTime,targets:t}),r=[...e.assertions],o={annotations:n.annotations,assertions:r,detail:e.detail,duration:Math.round(e.duration),nodeId:`agent-step-${String(e.stepIndex)}`,nodeType:e.nodeType,screenshotBase64:n.screenshotBase64,snapshotTimestamp:n.snapshotTimestamp,status:e.status,stepIndex:e.stepIndex,title:e.title,url:n.url,viewportHeight:n.viewportHeight,viewportWidth:n.viewportWidth},a=r.length>0?r.map(i=>`${i.status}: ${i.description} \u2014 ${i.detail??""}`).join(`
7
- `):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:a}}var U=g(()=>{"use strict";rt()});import{z as Bo}from"zod";var $d,Vo,Wo=g(()=>{"use strict";U();$d=Bo.object({selector:Bo.string().describe("CSS selector for the checkbox or radio button")}),Vo=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:$d,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 T({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 qo}from"zod";var Dd,Fo,Mo=g(()=>{"use strict";U();Dd=qo.object({selector:qo.string().describe("CSS selector for the element to check focus on")}),Fo=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:Dd,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 T({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 En}from"zod";var Bd,zo,Jo=g(()=>{"use strict";U();Bd=En.object({expected:En.string().describe("The expected text content"),selector:En.string().describe("CSS selector for the element to check")}),zo=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Bd,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 T({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 On}from"zod";function Wd({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 Vd,Xo,Ho=g(()=>{"use strict";U();Vd=On.object({expected:On.string().describe("Expected page title or substring"),operator:On.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),Xo=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:Vd,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=Wd({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 T({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 Go}from"zod";var qd,Ko,Yo=g(()=>{"use strict";U();qd=Go.object({selector:Go.string().describe("CSS selector for the element to check")}),Ko=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:qd,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 T({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 Qo}from"zod";var Fd,Zo,ea=g(()=>{"use strict";U();Fd=Qo.object({selector:Qo.string().describe("CSS selector for the checkbox to check")}),Zo=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:Fd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),T({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 ta}from"zod";var Md,na,ra=g(()=>{"use strict";U();Md=ta.object({selector:ta.string().describe("CSS selector for the input to clear")}),na=R({description:"Clear the contents of an input field",name:"clear",schema:Md,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),T({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 oa}from"zod";var zd,aa,ia=g(()=>{"use strict";U();zd=oa.object({selector:oa.string().describe("CSS selector for the element to click")}),aa=R({description:"Click an element matching the CSS selector",name:"click",schema:zd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),T({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 Un}from"zod";var Jd,sa,la=g(()=>{"use strict";U();Jd=Un.object({action:Un.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Un.string().optional().describe("Text to write (required for write action)")}),sa=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:Jd,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 T({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 T({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 Lt}from"zod";var ca,da,pa=g(()=>{"use strict";ca=Lt.object({summary:Lt.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:Lt.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.")}),da={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:{...Lt.toJSONSchema(ca,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=ca.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 ua}from"zod";var Xd,ma,fa=g(()=>{"use strict";U();Xd=ua.object({selector:ua.string().describe("CSS selector for the element to extract text from")}),ma=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:Xd,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return T({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 _n}from"zod";var Hd,ya,ga=g(()=>{"use strict";U();Hd=_n.object({selector:_n.string().describe("CSS selector for the input element"),value:_n.string().describe("The text to type into the element")}),ya=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Hd,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),T({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 ha}from"zod";function Kd(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Gd,ka,Sa=g(()=>{"use strict";U();Gd=ha.object({level:ha.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),ka=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:Gd,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=>Kd(o)).join(`
2
+ var Nd=Object.create;var Bn=Object.defineProperty;var Cd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var vd=Object.getPrototypeOf,Pd=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>(e&&(t=e(e=0)),t);var $t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Go=(e,t)=>{for(var n in t)Bn(e,n,{get:t[n],enumerable:!0})},xd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ld(t))!Pd.call(e,o)&&o!==n&&Bn(e,o,{get:()=>t[o],enumerable:!(r=Cd(t,o))||r.enumerable});return e};var Ko=(e,t,n)=>(n=e!=null?Nd(vd(e)):{},xd(t||!e||!e.__esModule?Bn(n,"default",{value:e,enumerable:!0}):n,e));import Vn from"fs/promises";import Wn from"path";import{z as Dt}from"zod";import{z as Qo}from"zod";import{z as Ye}from"zod";import{z as y}from"zod";import{z as Pe}from"zod";import{z as ni}from"zod";import{z as F}from"zod";import{z as re}from"zod";import{z as oe}from"zod";function Hn(e){return Zo({legacy:void 0,migrators:[],name:e,schemas:[]})}function _d(e,t){let n=JSON.parse(t);return e.decode(n)}function Zo(e){return{initial:t=>qn(t,{...e,schemas:[t]}),legacy:t=>Zo({...e,legacy:t})}}function qn(e,t){return{build:()=>Ud(e,t),legacy:n=>qn(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return qn(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function Ud(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>jd(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function jd(e,t,n){let{data:r,version:o}=$d(t,n),i=ei(t,r,o);return e.parse(i)}function $d(e,t){let n=Ed.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Id({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function ei(e,t,n){let r=e.schemas.length;if(n>r)throw new Od({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let i=o.parse(t),a=e.migrators[n-1];if(a==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return ei(e,a(i),n+1)}function ii(e){return{preconditions:e.preconditions,tests:e.tests.filter(t=>t.implemented).map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,preconditions:[...t.preconditions],requiresKeys:{...t.requiresKeys},slug:t.slug,spec:t.spec}))}}function Fn(e){let t=oi.encode(e);return`${JSON.stringify(t,Dp(t),2)}
3
+ `}async function Bt({cwd:e}){let t=Wn.join(e,ke),n=await jp(t);return n==null?null:_d(oi,n)}async function pe({cwd:e,result:t}){let n=ii(t),r=Wn.join(e,ke);await Vn.mkdir(Wn.dirname(r),{recursive:!0}),await Vn.writeFile(r,Fn(n),"utf8")}function Vt({compiled:e,existing:t}){if(t==null)return"missing";let n=Fn(ii(e)),r=Fn(t);return n===r?"match":"stale"}async function jp(e){try{return await Vn.readFile(e,"utf8")}catch(t){if($p(t)&&t.code==="ENOENT")return null;throw t}}function $p(e){return e instanceof Error&&"code"in e}function Dp(e){return function(n,r){return r===e||!Bp(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function Bp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ed,Od,Id,ti,Dd,Bd,j,gt,Vd,Wd,Mn,qd,he,Fd,Hd,v,Yo,Md,Jd,zd,Xd,Gd,Kd,Qd,Yd,Zd,ep,tp,np,rp,op,ip,ap,sp,lp,cp,dp,pp,up,mp,fp,yp,gp,hp,kp,Sp,Ap,wp,bp,Rp,Tp,Np,Cp,Lp,vp,ri,Pp,xp,Ep,pw,uw,ke,Op,Ip,_p,Up,oi,xe=m(()=>{"use strict";Ed=Dt.object({__codec:Dt.string().min(1),data:Dt.unknown(),version:Dt.number().int().positive()}),Od=class extends Error{codec;currentVersion;gotVersion;constructor(e){super(`Unsupported ${e.codec} version ${String(e.gotVersion)} (current ${String(e.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=e.codec,this.currentVersion=e.currentVersion,this.gotVersion=e.gotVersion}},Id=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};ti=Ye.object({depends:Ye.array(Ye.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:Ye.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Ye.array(Ye.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."),Dd=Pe.object({by:Pe.literal("testId"),value:Pe.string().min(1)}),Bd=Pe.object({by:Pe.literal("role"),name:Pe.string().optional(),role:Pe.string().min(1)}),j=Pe.discriminatedUnion("by",[Dd,Bd]),gt=ni.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Vd=ni.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Wd=F.object({type:F.literal("static"),value:F.union([F.string(),F.number(),F.boolean()])}),Mn=F.object({name:F.string().min(1),type:F.literal("variable")}),qd=F.discriminatedUnion("type",[Wd,Mn]),he=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.string()}),Mn]),Fd=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.number().int().nonnegative()}),Mn]),Hd=re.discriminatedUnion("type",[re.object({default:re.string().optional(),type:re.literal("string")}),re.object({default:re.number().optional(),type:re.literal("number")}),re.object({default:re.boolean().optional(),type:re.literal("boolean")}),re.object({key:re.string().min(1),type:re.literal("env")})]),v={comment:y.string().max(2e3).optional(),id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),timeout:y.number().int().positive().optional()},Yo=500,Md=y.object({...v,type:y.literal("goto"),url:he}),Jd=y.object({...v,locator:j,type:y.literal("click")}),zd=y.object({...v,locator:j,type:y.literal("fill"),value:he}),Xd=y.object({...v,locator:j,type:y.literal("select"),value:he}),Gd=y.object({...v,locator:j,type:y.literal("hover")}),Kd=y.object({...v,key:y.string().min(1),locator:j.optional(),type:y.literal("press")}),Qd=y.object({...v,locator:j,type:y.literal("check")}),Yd=y.object({...v,locator:j,type:y.literal("uncheck")}),Zd=y.object({...v,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),ep=y.object({...v,message:y.string().min(1),type:y.literal("fail")}),tp=y.object({...v,type:y.literal("setVariable"),value:qd,variable:y.string().min(1)}),np=y.object({...v,locator:j,type:y.literal("extractText"),variable:y.string().min(1)}),rp=y.object({...v,files:y.array(y.string()).min(1),locator:j,type:y.literal("upload")}),op=y.object({...v,locator:j,type:y.literal("dblclick")}),ip=y.object({...v,source:j,target:j,type:y.literal("drag")}),ap=y.object({...v,locator:j,type:y.literal("scrollIntoView")}),sp=y.object({...v,locator:j,type:y.literal("type"),value:he}),lp=y.object({...v,locator:j,type:y.literal("focus")}),cp=y.object({...v,locator:j,type:y.literal("clear")}),dp=y.object({...v,locator:j,type:y.literal("rightClick")}),pp=y.object({...v,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),up=y.object({...v,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:he.optional(),variable:y.string().min(1).optional()}),mp=y.object({...v,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),fp=y.object({...v,locator:j,type:y.literal("assertVisible")}),yp=y.object({...v,locator:j,type:y.literal("assertNotVisible")}),gp=y.object({...v,expected:he,locator:j,operator:gt,type:y.literal("assertText")}),hp=y.object({...v,expected:he,operator:gt,type:y.literal("assertUrl")}),kp=y.object({...v,expected:Fd,locator:j,operator:Vd,type:y.literal("assertCount")}),Sp=y.object({...v,expected:he,locator:j,operator:gt,type:y.literal("assertValue")}),Ap=y.object({...v,attribute:y.string().min(1),expected:he,locator:j,operator:gt,type:y.literal("assertAttribute")}),wp=y.object({...v,locator:j,type:y.literal("assertEnabled")}),bp=y.object({...v,locator:j,type:y.literal("assertDisabled")}),Rp=y.object({...v,expected:he,operator:gt,type:y.literal("assertTitle")}),Tp=y.object({...v,locator:j,type:y.literal("assertChecked")}),Np=y.object({...v,locator:j,type:y.literal("assertNotChecked")}),Cp=y.object({...v,locator:j,type:y.literal("assertFocused")}),Lp=y.object({...v,locator:j,type:y.literal("assertNotFocused")}),vp=y.discriminatedUnion("type",[Md,Jd,zd,Xd,Gd,Kd,Qd,Yd,fp,yp,gp,hp,kp,Sp,Ap,wp,bp,Zd,ep,tp,np,rp,op,ip,ap,sp,lp,cp,dp,pp,up,mp,Rp,Tp,Np,Cp,Lp]),ri=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),vp).refine(e=>Object.keys(e).length<=Yo,`Workflow has more than ${String(Yo)} nodes`),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),Hd).optional()}),Pp=Qo.record(Qo.string().max(200),ti),xp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Ep={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},pw=Hn("workflow-spec").legacy(xp).initial(ri).build(),uw=Hn("precondition-map").legacy(Ep).initial(Pp).build(),ke=".ripplo/ripplo.lock",Op=5e3,Ip=oe.record(oe.string().max(200),oe.string().max(200)),_p=oe.object({expectedOutcome:oe.string().max(2e3),name:oe.string().max(200),preconditions:oe.array(oe.string().max(200)).max(1e3),requiresKeys:Ip,slug:oe.string().max(200),spec:ri}),Up=oe.object({preconditions:oe.record(oe.string().max(200),ti),tests:oe.array(_p).max(Op)}),oi=Hn("ripplo-lockfile").initial(Up).build()});function ai(e){return e.data}function si(e){return{as(t){return{data:{label:t,node:e}}}}}var Wt=m(()=>{"use strict"});function qt(e){let t=e.getPreconditions(),n=e.getTests();Vp(n);let r={};t.forEach(i=>{r[i.name]={depends:[...i.dependsOn],description:i.description,returns:[...i.returns]}});let o=n.map(i=>Wp(i,t));return{config:e.getConfig(),preconditions:r,tests:o}}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,t){let n=e.id,{accessedKeys:r,vars:o}=Fp(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),l=i==null?a:[qp(i),...a],s=Hp(l,r,e.requiresKeys),c=[];Object.keys(e.requiresKeys).length>0&&r.size===0&&e.implemented&&c.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()");let u=Jp(e.requires,t);return{additionalChecks:[],description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,preconditions:u,requiresKeys:{...e.requiresKeys},slug:n,spec:s,warnings:c}}function qp(e){return si({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function Fp(e){let t=new Set,n={};return Object.keys(e).forEach(r=>{n[r]=new Proxy({},{get(o,i){if(typeof i=="string"){let a=`${r}.${i}`;return t.add(a),`{{${a}}}`}}})}),{accessedKeys:t,vars:n}}function Hp(e,t,n){let r={};e.forEach((a,l)=>{let s=`step-${String(l)}`,c=l<e.length-1?`step-${String(l+1)}`:void 0;r[s]=Mp(a,s,c)});let o={};t.forEach(a=>{o[a]={default:`test-${a}`,type:"string"}});let i={...n};return{entryNode:"step-0",nodes:r,variableNamespaces:i,variables:o}}function Mp(e,t,n){let{label:r,node:o}=ai(e);return{...o,id:t,label:r,next:n}}function Jp(e,t){let n=new Map(t.map(a=>[a.name,a])),r=[],o=new Set;function i(a){o.has(a)||(o.add(a),n.get(a)?.dependsOn.forEach(l=>{i(l)}),r.push(a))}return e.forEach(a=>{i(a)}),r}var Jn=m(()=>{"use strict";Wt()});var li=m(()=>{"use strict";Jn();Wt()});import zp from"path";import{createJiti as Xp}from"jiti";function Kp(e){return e==null||typeof e!="object"?!1:Gp.every(t=>typeof Reflect.get(e,t)=="function")}function Qp(e){return e===null?"null":Array.isArray(e)?"array":typeof e}async function O(e){let t=zp.join(e,".ripplo","index.ts");try{let r=await Xp(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!Kp(o))return{error:`${t} must default-export a RipploBuilder (got ${Qp(o)})`,ok:!1};let i=qt(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var Gp,X=m(()=>{"use strict";li();Gp=["getConfig","getPreconditions","getTests","getUnimplemented","implement","precondition","test"]});function Xn(e){return typeof e=="function"}function Zp(e){return et(e)?"array":typeof e}function zn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function di(e,t){return e!=null&&typeof e=="object"&&t in e}function eu(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function nu(e,t){return tu.call(e,t)}function ou(e){return!nu(ru,e)}function au(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return iu[n]})}function pu(e,t){if(!e)return[];var n=!1,r=[],o=[],i=[],a=!1,l=!1,s="",c=0;function p(){if(a&&!l)for(;i.length;)delete o[i.pop()];else i=[];a=!1,l=!1}var u,d,f;function h(C){if(typeof C=="string"&&(C=C.split(lu,2)),!et(C)||C.length!==2)throw new Error("Invalid tags: "+C);u=new RegExp(zn(C[0])+"\\s*"),d=new RegExp("\\s*"+zn(C[1])),f=new RegExp("\\s*"+zn("}"+C[1]))}h(t||ue.tags);for(var S=new kt(e),k,A,w,L,E,T;!S.eos();){if(k=S.pos,w=S.scanUntil(u),w)for(var $=0,x=w.length;$<x;++$)L=w.charAt($),ou(L)?(i.push(o.length),s+=L):(l=!0,n=!0,s+=" "),o.push(["text",L,k,k+1]),k+=1,L===`
4
+ `&&(p(),s="",c=0,n=!1);if(!S.scan(u))break;if(a=!0,A=S.scan(du)||"name",S.scan(su),A==="="?(w=S.scanUntil(pi),S.scan(pi),S.scanUntil(d)):A==="{"?(w=S.scanUntil(f),S.scan(cu),S.scanUntil(d),A="&"):w=S.scanUntil(d),!S.scan(d))throw new Error("Unclosed tag at "+S.pos);if(A==">"?E=[A,w,k,S.pos,s,c,n]:E=[A,w,k,S.pos],c++,o.push(E),A==="#"||A==="^")r.push(E);else if(A==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+w+'" at '+k);if(T[1]!==w)throw new Error('Unclosed section "'+T[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?l=!0:A==="="&&h(w)}if(p(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+S.pos);return mu(uu(o))}function uu(e){for(var t=[],n,r,o=0,i=e.length;o<i;++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 mu(e){for(var t=[],n=t,r=[],o,i,a=0,l=e.length;a<l;++a)switch(o=e[a],o[0]){case"#":case"^":n.push(o),r.push(o),n=o[4]=[];break;case"/":i=r.pop(),i[5]=o[2],n=r.length>0?r[r.length-1][4]:t;break;default:n.push(o)}return t}function kt(e){this.string=e,this.tail=e,this.pos=0}function Ze(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function Q(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var Yp,et,tu,ru,iu,su,lu,pi,cu,du,ue,ht,ui,mi=m(()=>{"use strict";Yp=Object.prototype.toString,et=Array.isArray||function(t){return Yp.call(t)==="[object Array]"};tu=RegExp.prototype.test;ru=/\S/;iu={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};su=/\s*/,lu=/\s+/,pi=/\s*=/,cu=/\s*\}/,du=/#|\^|\/|>|\{|&|=|!/;kt.prototype.eos=function(){return this.tail===""};kt.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};kt.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};Ze.prototype.push=function(t){return new Ze(t,this)};Ze.prototype.lookup=function(t){var n=this.cache,r;if(n.hasOwnProperty(t))r=n[t];else{for(var o=this,i,a,l,s=!1;o;){if(t.indexOf(".")>0)for(i=o.view,a=t.split("."),l=0;i!=null&&l<a.length;)l===a.length-1&&(s=di(i,a[l])||eu(i,a[l])),i=i[a[l++]];else i=o.view[t],s=di(o.view,t);if(s){r=i;break}o=o.parent}n[t]=r}return Xn(r)&&(r=r.call(this.view)),r};Q.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Q.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||ue.tags).join(":"),i=typeof r<"u",a=i?r.get(o):void 0;return a==null&&(a=pu(t,n),i&&r.set(o,a)),a};Q.prototype.render=function(t,n,r,o){var i=this.getConfigTags(o),a=this.parse(t,i),l=n instanceof Ze?n:new Ze(n,void 0);return this.renderTokens(a,l,r,t,o)};Q.prototype.renderTokens=function(t,n,r,o,i){for(var a="",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,i):s==="^"?c=this.renderInverted(l,n,r,o,i):s===">"?c=this.renderPartial(l,n,r,i):s==="&"?c=this.unescapedValue(l,n):s==="name"?c=this.escapedValue(l,n,i):s==="text"&&(c=this.rawValue(l)),c!==void 0&&(a+=c);return a};Q.prototype.renderSection=function(t,n,r,o,i){var a=this,l="",s=n.lookup(t[1]);function c(d){return a.render(d,n,r,i)}if(s){if(et(s))for(var p=0,u=s.length;p<u;++p)l+=this.renderTokens(t[4],n.push(s[p]),r,o,i);else if(typeof s=="object"||typeof s=="string"||typeof s=="number")l+=this.renderTokens(t[4],n.push(s),r,o,i);else if(Xn(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,i);return l}};Q.prototype.renderInverted=function(t,n,r,o,i){var a=n.lookup(t[1]);if(!a||et(a)&&a.length===0)return this.renderTokens(t[4],n,r,o,i)};Q.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),i=t.split(`
5
+ `),a=0;a<i.length;a++)i[a].length&&(a>0||!r)&&(i[a]=o+i[a]);return i.join(`
6
+ `)};Q.prototype.renderPartial=function(t,n,r,o){if(r){var i=this.getConfigTags(o),a=Xn(r)?r(t[1]):r[t[1]];if(a!=null){var l=t[6],s=t[5],c=t[4],p=a;s==0&&c&&(p=this.indentPartial(a,c,l));var u=this.parse(p,i);return this.renderTokens(u,n,r,p,o)}}};Q.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};Q.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||ue.escape,i=n.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===ue.escape?String(i):o(i)};Q.prototype.rawValue=function(t){return t[1]};Q.prototype.getConfigTags=function(t){return et(t)?t:t&&typeof t=="object"?t.tags:void 0};Q.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!et(t))return t.escape};ue={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){ht.templateCache=e},get templateCache(){return ht.templateCache}},ht=new Q;ue.clearCache=function(){return ht.clearCache()};ue.parse=function(t,n){return ht.parse(t,n)};ue.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Zp(t)+'" was given as the first argument for mustache#render(template, view, partials)');return ht.render(t,n,r,o)};ue.escape=au;ue.Scanner=kt;ue.Context=Ze;ue.Writer=Q;ui=ue});function St({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,yu({def:n,name:t})]))}function yu({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??fu[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 Z({ref:e,variables:t}){let n=String(At({ref:e,variables:t}));return Gn({raw:n,variables:t})}function Gn({raw:e,variables:t}){return ui.render(e,t,{},{escape:n=>n})}function Kn({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 tt({name:e,store:t,value:n}){return{...t,[e]:n}}var fu,Ee=m(()=>{"use strict";mi();fu={boolean:!1,number:0,string:""}});function W({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(fi(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:fi(e.name,n)})}}function fi(e,t){return t==null?e:Gn({raw:e,variables:t})}var nt=m(()=>{"use strict";Ee()});async function yi({node:e,page:t,timeout:n}){await W({locator:e.source,page:t,variables:void 0}).dragTo(W({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function gi({node:e,page:t,timeout:n}){await W({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function hi({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 ki({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=Z({ref:e.value,variables:n}),i=JSON.stringify(o);return await t.evaluate(`navigator.clipboard.writeText(${i})`),{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:tt({name:e.variable,store:n,value:r})}}async function Si({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Ai=m(()=>{"use strict";nt();Ee()});async function Qn({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 hu({node:e,page:t,timeout:n,variables:r});case"rightClick":return await gi({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=Z({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 Su({node:e,page:t,timeout:n,variables:r});case"select":return Au({node:e,page:t,timeout:n,variables:r});case"type":return wu({node:e,page:t,timeout:n,variables:r});case"press":return await ku({node:e,page:t,timeout:n}),{variables:r};case"drag":return await yi({node:e,page:t,timeout:n}),{variables:r};case"upload":return bu({node:e,page:t,timeout:n,variables:r});case"extractText":return Ru({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=At({ref:e.value,variables:r});return{variables:tt({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 hi({node:e,page:t,variables:r});case"clipboard":return ki({node:e,page:t,variables:r});case"setPermission":return await Si({node:e,page:t}),{variables:r}}}async function hu({node:e,page:t,timeout:n,variables:r}){return await W({locator:e.locator,page:t,variables:r})[gu[e.type]]({timeout:n}),{variables:r}}async function ku({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await W({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Su({node:e,page:t,timeout:n,variables:r}){let o=Z({ref:e.value,variables:r});return await W({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Au({node:e,page:t,timeout:n,variables:r}){let o=Z({ref:e.value,variables:r});return await W({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function wu({node:e,page:t,timeout:n,variables:r}){let o=Z({ref:e.value,variables:r});return await W({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function bu({node:e,page:t,timeout:n,variables:r}){return await W({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function Ru({node:e,page:t,timeout:n,variables:r}){let o=await W({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:tt({name:e.variable,store:r,value:o})}}var gu,Yn=m(()=>{"use strict";Ai();nt();Ee();gu={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function Oe({page:e,runStartTime:t,targets:n}){let r=e.viewportSize();if(r==null)throw new Error("Page has no viewport set");let[o,i]=await Promise.all([e.screenshot({type:"png"}),Nu(n)]),a=o.toString("base64");return{annotations:i,screenshotBase64:a,snapshotTimestamp:Math.round(performance.now()-t),url:e.url(),viewportHeight:r.height,viewportWidth:r.width}}function Tu(e){return"locator"in e}async function Nu(e){return(await Promise.all(e.map(n=>Cu(n)))).filter(n=>n!=null)}async function Cu(e){if(!Tu(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 Ft({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=W({locator:e.source,page:t,variables:void 0}),i=W({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:i,type:"action"}]}if(!Lu(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=W({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function Lu(e){return"locator"in e&&e.locator!=null}var wt=m(()=>{"use strict";nt()});import{z as vu}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=vu.toJSONSchema(r,{target:"draft-2020-12"});return{anthropicTool:{description:e,input_schema:{...o,type:"object"},name:n},name:n,async execute(i,a){let l=r.parse(a);return{...await Promise.resolve(t(i,l)),kind:"action"}}}}async function N(e){let t=e.specNode==null?[]:Ft({node:e.specNode,page:e.page}),n=await Oe({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},i=r.length>0?r.map(a=>`${a.status}: ${a.description} \u2014 ${a.detail??""}`).join(`
7
+ `):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:i}}var _=m(()=>{"use strict";wt()});import{z as wi}from"zod";var Pu,bi,Ri=m(()=>{"use strict";_();Pu=wi.object({selector:wi.string().describe("CSS selector for the checkbox or radio button")}),bi=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:Pu,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isChecked().catch(()=>!1),o=r?"passed":"failed",i=[{description:`Element ${t.selector} is checked`,detail:r?void 0:"Element is not checked",status:o}];return N({assertions:i,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 Ti}from"zod";var xu,Ni,Ci=m(()=>{"use strict";_();xu=Ti.object({selector:Ti.string().describe("CSS selector for the element to check focus on")}),Ni=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:xu,execute:async(e,t)=>{let n=performance.now(),o=!!await e.page.locator(t.selector).evaluate("(el) => document.activeElement === el").catch(()=>!1),i=o?"passed":"failed",a=[{description:`Element ${t.selector} is focused`,detail:o?void 0:"Element does not have focus",status:i}];return N({assertions:a,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:i,stepIndex:e.stepIndex,title:`Assert focused: ${t.selector}`})}})});import{z as Zn}from"zod";var Eu,Li,vi=m(()=>{"use strict";_();Eu=Zn.object({expected:Zn.string().describe("The expected text content"),selector:Zn.string().describe("CSS selector for the element to check")}),Li=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Eu,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),i=o?"passed":"failed",a=[{description:`Text contains "${t.expected}"`,detail:`Actual: "${r??"(not found)"}"`,status:i}];return N({assertions:a,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:i,stepIndex:e.stepIndex,title:`Assert text: ${t.selector}`})}})});import{z as er}from"zod";function Iu({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 Ou,Pi,xi=m(()=>{"use strict";_();Ou=er.object({expected:er.string().describe("Expected page title or substring"),operator:er.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),Pi=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:Ou,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=Iu({actual:r,expected:t.expected,operator:t.operator}),i=o?"passed":"failed",a=[{description:`Title ${t.operator} "${t.expected}"`,detail:o?void 0:`Got: "${r}"`,status:i}],l=`agent-step-${String(e.stepIndex)}`,s={expected:{type:"static",value:t.expected},id:l,operator:t.operator,type:"assertTitle"};return N({assertions:a,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:i,stepIndex:e.stepIndex,title:`Assert title ${t.operator} "${t.expected}"`})}})});import{z as Ei}from"zod";var _u,Oi,Ii=m(()=>{"use strict";_();_u=Ei.object({selector:Ei.string().describe("CSS selector for the element to check")}),Oi=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:_u,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isVisible().catch(()=>!1),o=r?"passed":"failed",i=[{description:`Element ${t.selector} is visible`,detail:r?"Element is visible":"Element is not visible",status:o}];return N({assertions:i,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 _i}from"zod";var Uu,Ui,ji=m(()=>{"use strict";_();Uu=_i.object({selector:_i.string().describe("CSS selector for the checkbox to check")}),Ui=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:Uu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),N({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 $i}from"zod";var ju,Di,Bi=m(()=>{"use strict";_();ju=$i.object({selector:$i.string().describe("CSS selector for the input to clear")}),Di=R({description:"Clear the contents of an input field",name:"clear",schema:ju,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),N({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 Vi}from"zod";var $u,Wi,qi=m(()=>{"use strict";_();$u=Vi.object({selector:Vi.string().describe("CSS selector for the element to click")}),Wi=R({description:"Click an element matching the CSS selector",name:"click",schema:$u,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),N({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 tr}from"zod";var Du,Fi,Hi=m(()=>{"use strict";_();Du=tr.object({action:tr.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:tr.string().optional().describe("Text to write (required for write action)")}),Fi=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:Du,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 a=JSON.stringify(t.value);await e.page.evaluate(`navigator.clipboard.writeText(${a})`);let l={action:"write",id:r,type:"clipboard",value:{type:"static",value:t.value}};return N({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()")),i={action:"read",id:r,type:"clipboard"};return N({assertions:[],detail:`Clipboard contents: "${o}"`,duration:performance.now()-n,nodeType:"clipboard",page:e.page,runStartTime:e.runStartTime,specNode:i,status:"passed",stepIndex:e.stepIndex,title:"Clipboard read"})}})});import{z as Ht}from"zod";var Mi,Ji,zi=m(()=>{"use strict";Mi=Ht.object({summary:Ht.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:Ht.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.")}),Ji={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:{...Ht.toJSONSchema(Mi,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Mi.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 Xi}from"zod";var Bu,Gi,Ki=m(()=>{"use strict";_();Bu=Xi.object({selector:Xi.string().describe("CSS selector for the element to extract text from")}),Gi=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:Bu,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return N({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 nr}from"zod";var Vu,Qi,Yi=m(()=>{"use strict";_();Vu=nr.object({selector:nr.string().describe("CSS selector for the input element"),value:nr.string().describe("The text to type into the element")}),Qi=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Vu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),N({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 Zi}from"zod";function qu(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Wu,ea,ta=m(()=>{"use strict";_();Wu=Zi.object({level:Zi.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),ea=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:Wu,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=>qu(o)).join(`
9
9
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
10
- ${r}`}}})});import{z as Aa}from"zod";var In,Yd,wa,ba=g(()=>{"use strict";U();In=50,Yd=Aa.object({urlFilter:Aa.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),wa=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:Yd,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(-In),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>In?`
12
- (showing last ${String(In)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${i}
13
- ${a}`}}})});import{z as Ra}from"zod";var Qd,Na,Ta=g(()=>{"use strict";U();Qd=Ra.object({urlPattern:Ra.string().describe("Regex pattern to match the request URL")}),Na=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:Qd,execute:(e,t)=>{let n=new RegExp(t.urlPattern,"i"),r=e.monitor.networkEntries.filter(s=>n.test(s.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let o=r.at(-1);if(o==null)return{specNode:void 0,stepResult:void 0,toolOutput:`No network requests matching: ${t.urlPattern}`};let a=o.statusCode==null?"pending":String(o.statusCode),i=Object.entries(o.responseHeaders).map(([s,c])=>` ${s}: ${c}`).join(`
14
- `),l=o.responseBody??"(no body captured)";return{specNode:void 0,stepResult:void 0,toolOutput:`${o.method} ${a} ${o.url}
10
+ ${r}`}}})});import{z as na}from"zod";var rr,Fu,ra,oa=m(()=>{"use strict";_();rr=50,Fu=na.object({urlFilter:na.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),ra=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:Fu,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(-rr),i=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
+ `),a=r.length>rr?`
12
+ (showing last ${String(rr)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${a}
13
+ ${i}`}}})});import{z as ia}from"zod";var Hu,aa,sa=m(()=>{"use strict";_();Hu=ia.object({urlPattern:ia.string().describe("Regex pattern to match the request URL")}),aa=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:Hu,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 i=o.statusCode==null?"pending":String(o.statusCode),a=Object.entries(o.responseHeaders).map(([s,c])=>` ${s}: ${c}`).join(`
14
+ `),l=o.responseBody??"(no body captured)";return{specNode:void 0,stepResult:void 0,toolOutput:`${o.method} ${i} ${o.url}
15
15
 
16
16
  Response Headers:
17
- ${i}
17
+ ${a}
18
18
 
19
19
  Body:
20
- ${l}`}}})});import{z as La}from"zod";var Zd,Ca,va=g(()=>{"use strict";U();Zd=La.object({selector:La.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),Ca=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:Zd,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 ep}from"zod";var tp,xa,Pa=g(()=>{"use strict";U();tp=ep.object({}),xa=R({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:tp,execute:async(e,t)=>{let n=await e.page.locator("body").textContent({timeout:5e3}),r=e.page.url(),o=await e.page.title();return{specNode:void 0,stepResult:void 0,toolOutput:`URL: ${r}
20
+ ${l}`}}})});import{z as la}from"zod";var Mu,ca,da=m(()=>{"use strict";_();Mu=la.object({selector:la.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),ca=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:Mu,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 Ju}from"zod";var zu,pa,ua=m(()=>{"use strict";_();zu=Ju.object({}),pa=R({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:zu,execute:async(e,t)=>{let n=await e.page.locator("body").textContent({timeout:5e3}),r=e.page.url(),o=await e.page.title();return{specNode:void 0,stepResult:void 0,toolOutput:`URL: ${r}
21
21
  Title: ${o}
22
22
 
23
- ${n??""}`}}})});import{z as np}from"zod";var rp,Ea,Oa=g(()=>{"use strict";U();rp=np.object({}),Ea=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:rp,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 Xu}from"zod";var Gu,ma,fa=m(()=>{"use strict";_();Gu=Xu.object({}),ma=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:Gu,execute:(e,t)=>{if(e.monitor.pageErrors.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No page errors recorded."};let n=e.monitor.pageErrors.map((r,o)=>`--- Error ${String(o+1)} ---
24
24
  ${r}`).join(`
25
25
 
26
26
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(e.monitor.pageErrors.length)} page errors:
27
27
 
28
- ${n}`}}})});import{z as Ua}from"zod";async function ap(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
28
+ ${n}`}}})});import{z as ya}from"zod";async function Qu(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
29
29
  (none)`;let n=t.map(r=>` ${r.name}=${r.value} (domain=${r.domain}, httpOnly=${String(r.httpOnly)}, secure=${String(r.secure)}, sameSite=${r.sameSite})`);return`## Cookies (${String(t.length)})
30
30
  ${n.join(`
31
- `)}`}async function _a(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
- ${String(n)}`}var op,Ia,ja=g(()=>{"use strict";U();op=Ua.object({type:Ua.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),Ia=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:op,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await ap(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await _a(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await _a(e.page,"sessionStorage")]:[]].join(`
31
+ `)}`}async function ga(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
+ ${String(n)}`}var Ku,ha,ka=m(()=>{"use strict";_();Ku=ya.object({type:ya.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),ha=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:Ku,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await Qu(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await ga(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await ga(e.page,"sessionStorage")]:[]].join(`
33
33
 
34
- `)})})});import{z as jn}from"zod";var ip,$a,Da=g(()=>{"use strict";U();ip=jn.object({action:jn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:jn.string().optional().describe("Text to enter for prompt dialogs")}),$a=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:ip,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 T({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 Ba}from"zod";var sp,Va,Wa=g(()=>{"use strict";U();sp=Ba.object({selector:Ba.string().describe("CSS selector for the element to hover over")}),Va=R({description:"Hover over an element matching the CSS selector",name:"hover",schema:sp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),T({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 $n}from"zod";var lp,qa,Fa=g(()=>{"use strict";U();lp=$n.object({permission:$n.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:$n.enum(["granted","prompt"]).describe("Permission state to set")}),qa=R({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:lp,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 T({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 Ma}from"zod";var cp,za,Ja=g(()=>{"use strict";U();cp=Ma.object({url:Ma.string().describe("The URL to navigate to")}),za=R({description:"Navigate the browser to a URL",name:"navigate",schema:cp,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 T({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 Xa}from"zod";var dp,Ha,Ga=g(()=>{"use strict";U();dp=Xa.object({key:Xa.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),Ha=R({description:"Press a keyboard key",name:"press",schema:dp,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 T({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 Dn}from"zod";var pp,Ka,Ya=g(()=>{"use strict";U();pp=Dn.object({height:Dn.number().int().positive().describe("Viewport height in pixels"),width:Dn.number().int().positive().describe("Viewport width in pixels")}),Ka=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:pp,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 T({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 Qa}from"zod";var up,Za,ei=g(()=>{"use strict";U();up=Qa.object({selector:Qa.string().describe("CSS selector for the element to right-click")}),Za=R({description:"Right-click an element to open the context menu",name:"right_click",schema:up,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),T({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 ti}from"zod";function fp(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var mp,ni,ri=g(()=>{"use strict";U();mp=ti.object({pattern:ti.string().describe("Regex pattern to search console log messages")}),ni=R({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:mp,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=>fp(a)).join(`
34
+ `)})})});import{z as or}from"zod";var Yu,Sa,Aa=m(()=>{"use strict";_();Yu=or.object({action:or.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:or.string().optional().describe("Text to enter for prompt dialogs")}),Sa=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:Yu,execute:(e,t)=>{let n=performance.now();e.page.once("dialog",async i=>{t.action==="accept"?await i.accept(t.promptText??void 0):await i.dismiss()});let r=`agent-step-${String(e.stepIndex)}`,o={action:t.action,id:r,type:"handleDialog"};return N({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 wa}from"zod";var Zu,ba,Ra=m(()=>{"use strict";_();Zu=wa.object({selector:wa.string().describe("CSS selector for the element to hover over")}),ba=R({description:"Hover over an element matching the CSS selector",name:"hover",schema:Zu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),N({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 ir}from"zod";var em,Ta,Na=m(()=>{"use strict";_();em=ir.object({permission:ir.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:ir.enum(["granted","prompt"]).describe("Permission state to set")}),Ta=R({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:em,execute:async(e,t)=>{let n=performance.now(),r=e.page.context();t.state==="granted"?await r.grantPermissions([t.permission]):await r.clearPermissions();let i={id:`agent-step-${String(e.stepIndex)}`,permission:t.permission,state:t.state,type:"setPermission"};return N({assertions:[],detail:`Set ${t.permission} to ${t.state}`,duration:performance.now()-n,nodeType:"setPermission",page:e.page,runStartTime:e.runStartTime,specNode:i,status:"passed",stepIndex:e.stepIndex,title:`Set permission: ${t.permission} \u2192 ${t.state}`})}})});import{z as Ca}from"zod";var tm,La,va=m(()=>{"use strict";_();tm=Ca.object({url:Ca.string().describe("The URL to navigate to")}),La=R({description:"Navigate the browser to a URL",name:"navigate",schema:tm,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 N({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 Pa}from"zod";var nm,xa,Ea=m(()=>{"use strict";_();nm=Pa.object({key:Pa.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),xa=R({description:"Press a keyboard key",name:"press",schema:nm,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 N({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 ar}from"zod";var rm,Oa,Ia=m(()=>{"use strict";_();rm=ar.object({height:ar.number().int().positive().describe("Viewport height in pixels"),width:ar.number().int().positive().describe("Viewport width in pixels")}),Oa=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:rm,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 N({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 _a}from"zod";var om,Ua,ja=m(()=>{"use strict";_();om=_a.object({selector:_a.string().describe("CSS selector for the element to right-click")}),Ua=R({description:"Right-click an element to open the context menu",name:"right_click",schema:om,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),N({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 $a}from"zod";function am(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var im,Da,Ba=m(()=>{"use strict";_();im=$a.object({pattern:$a.string().describe("Regex pattern to search console log messages")}),Da=R({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:im,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.consoleEntries.filter(i=>n.test(i.text));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No console messages matching: ${t.pattern}`};let o=r.map(i=>am(i)).join(`
35
35
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
36
- ${o}`}}})});import{z as oi}from"zod";var yp,ai,ii=g(()=>{"use strict";U();yp=oi.object({pattern:oi.string().describe("Regex pattern to search across network request URLs and response bodies")}),ai=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:yp,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 Va}from"zod";var sm,Wa,qa=m(()=>{"use strict";_();sm=Va.object({pattern:Va.string().describe("Regex pattern to search across network request URLs and response bodies")}),Wa=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:sm,execute:(e,t)=>{let n=new RegExp(t.pattern,"i"),r=e.monitor.networkEntries.filter(i=>n.test(i.url)||i.responseBody!=null&&n.test(i.responseBody));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:`No network entries matching: ${t.pattern}`};let o=r.map(i=>{let a=i.statusCode==null?"pending":String(i.statusCode),l=n.test(i.url)?" [URL match]":"",s=i.responseBody!=null&&n.test(i.responseBody)?" [body match]":"";return`${i.method} ${a} ${i.url}${l}${s}`}).join(`
37
37
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching network entries:
38
- ${o}`}}})});import{z as si}from"zod";function Sp({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 gp,hp,kp,li,ci=g(()=>{"use strict";U();gp=20,hp=2,kp=si.object({pattern:si.string().describe("Regex pattern to search for in the page HTML")}),li=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:kp,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
- `),o=Sp({contextLines:hp,lines:r,maxResults:gp,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 Fa}from"zod";function pm({contextLines:e,lines:t,maxResults:n,pattern:r}){let o=new RegExp(r,"i"),i=[];return t.forEach((a,l)=>{if(i.length>=n||!o.test(a))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 f=s+d+1;return`${s+d===l?">":" "} ${String(f)}: ${u}`}).join(`
39
+ `);i.push(p)}),i}var lm,cm,dm,Ha,Ma=m(()=>{"use strict";_();lm=20,cm=2,dm=Fa.object({pattern:Fa.string().describe("Regex pattern to search for in the page HTML")}),Ha=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:dm,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
+ `),o=pm({contextLines:cm,lines:r,maxResults:lm,pattern:t.pattern});return o.length===0?{specNode:void 0,stepResult:void 0,toolOutput:`No matches found for pattern: ${t.pattern}`}:{specNode:void 0,stepResult:void 0,toolOutput:o.join(`
41
41
  ---
42
- `)}}})});import{z as Bn}from"zod";var Ap,di,pi=g(()=>{"use strict";U();Ap=Bn.object({selector:Bn.string().describe("CSS selector for the select element"),value:Bn.string().describe("The option value to select")}),di=R({description:"Select an option from a dropdown/select element",name:"select",schema:Ap,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),T({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 ui}from"zod";var wp,mi,fi=g(()=>{"use strict";U();wp=ui.object({selector:ui.string().describe("CSS selector for the checkbox to uncheck")}),mi=R({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:wp,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),T({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 ot(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 Ct(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 Ct(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 Ct,Vn=g(()=>{"use strict";Ct=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 gi({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:a}){let i=bp.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 Wn,bp,qn,yi,hi=g(()=>{"use strict";Wo();Mo();Jo();Ho();Yo();ea();ra();ia();la();pa();fa();ga();Sa();ba();Ta();va();Pa();Oa();ja();Da();Wa();Fa();Ja();Ga();Ya();ei();ri();ii();ci();pi();fi();Vn();Wn=[za,aa,ya,Ha,Zo,mi,di,Va,xa,li,na,Za,$a,sa,qa,Ko,zo,Xo,Vo,Fo,ka,wa,Na,Ea,Ca,Ia,ni,ai,Ka,ma,da],bp=new Map(Wn.map(e=>[e.name,e])),qn=Wn.map(e=>e.anthropicTool),yi=Wn.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
- `)});import ki from"fs";import Rp from"path";import Fn from"pino";function Mn({filePath:e}){let t=Rp.dirname(e);ki.mkdirSync(t,{recursive:!0}),ki.writeFileSync(e,"");let n=Fn.destination({dest:e,sync:!0}),r=Fn({level:"info"},n);b.info=r.info.bind(r),b.warn=r.warn.bind(r),b.error=r.error.bind(r),b.debug=r.debug.bind(r),b.fatal=r.fatal.bind(r),b.trace=r.trace.bind(r)}var b,K=g(()=>{"use strict";b=Fn({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Np from"@anthropic-ai/sdk";async function zn({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 Np({apiKey:"ripplo",baseURL:`${i}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":a}}),d=performance.now(),m=ot(o);await Up({baseUrl:e,page:o});let h=vp({extraVariables:n,spec:l}),S=Pp({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),k=Ep({baseUrl:e,spec:l,variables:h}),w=[{content:Op({page:o,startUrl:k}),role:"user"}],P=[],E=[],N={findings:"",stepIndex:0,verdict:void 0};N=await Lp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:E,state:N,steps:P,system:S}),N.verdict==null&&(N=await Cp({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:E,state:N,steps:P,system:S}));let I=Ip(E);return{findings:N.findings,generatedSpec:I,monitor:m,steps:P,verdict:N.verdict??"fail"}}function Ai({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Lp({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<Tp;u++){b.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:Si,messages:t,model:"server-controlled",system:c,tools:qn}),m=await wi({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:a,specNodes:i,stepIndex:p.stepIndex,steps:s});if(p=Ai({result:m,state:p}),!m.continueLoop)break}return p}async function Cp({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:Si,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:qn}),u=await wi({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:a,specNodes:i,stepIndex:l.stepIndex,steps:s});return Ai({result:u,state:l})}function vp({extraVariables:e,spec:t}){let n=xp(e,t?.variableNamespaces);return{...tt({defs:t?.variables}),...n}}function xp(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 Pp({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:a}){let i=a==null?"":[`
42
+ `)}}})});import{z as sr}from"zod";var um,Ja,za=m(()=>{"use strict";_();um=sr.object({selector:sr.string().describe("CSS selector for the select element"),value:sr.string().describe("The option value to select")}),Ja=R({description:"Select an option from a dropdown/select element",name:"select",schema:um,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),N({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 Xa}from"zod";var mm,Ga,Ka=m(()=>{"use strict";_();mm=Xa.object({selector:Xa.string().describe("CSS selector for the checkbox to uncheck")}),Ga=R({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:mm,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),N({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 bt(e){let t=[],n=[],r=[],o=new Map;function i(u){t.push({level:u.type(),text:u.text(),timestamp:Date.now(),url:u.location().url})}function a(u){let d=new Mt(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(),f=new Mt(u);f.responseBody=`(request failed: ${d?.errorText??"unknown"})`,n.push(f)}e.on("console",i),e.on("request",a),e.on("response",l),e.on("pageerror",s),e.on("requestfailed",c);function p(){e.off("console",i),e.off("request",a),e.off("response",l),e.off("pageerror",s),e.off("requestfailed",c)}return{consoleEntries:t,detach:p,networkEntries:n,pageErrors:r}}var Mt,lr=m(()=>{"use strict";Mt=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 Ya({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:i}){let a=fm.get(n);if(a==null)throw new Error(`Unknown agent tool: ${n}`);return a.execute({monitor:t,page:r,runStartTime:o,stepIndex:i},e)}var cr,fm,dr,Qa,Za=m(()=>{"use strict";Ri();Ci();vi();xi();Ii();ji();Bi();qi();Hi();zi();Ki();Yi();ta();oa();sa();da();ua();fa();ka();Aa();Ra();Na();va();Ea();Ia();ja();Ba();qa();Ma();za();Ka();lr();cr=[La,Wi,Qi,xa,Ui,Ga,Ja,ba,pa,Ha,Di,Ua,Sa,Fi,Ta,Oi,Li,Pi,bi,Ni,ea,ra,aa,ma,ca,ha,Da,Wa,Oa,Gi,Ji],fm=new Map(cr.map(e=>[e.name,e])),dr=cr.map(e=>e.anthropicTool),Qa=cr.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
+ `)});import es from"fs";import ym from"path";import pr from"pino";function ur({filePath:e}){let t=ym.dirname(e);es.mkdirSync(t,{recursive:!0}),es.writeFileSync(e,"");let n=pr.destination({dest:e,sync:!0}),r=pr({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,Y=m(()=>{"use strict";b=pr({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import gm from"@anthropic-ai/sdk";async function mr({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:i,serverUrl:a,spec:l,systemPrompt:s,token:c,workflowContext:p}){let u=new gm({apiKey:"ripplo",baseURL:`${a}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":i}}),d=performance.now(),f=bt(o);await Nm({baseUrl:e,page:o});let h=Am({extraVariables:n,spec:l}),S=bm({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),k=Rm({baseUrl:e,spec:l,variables:h}),w=[{content:Tm({page:o,startUrl:k}),role:"user"}],L=[],E=[],T={findings:"",stepIndex:0,verdict:void 0};T=await km({client:u,messages:w,monitor:f,onStep:r,page:o,runStartTime:d,specNodes:E,state:T,steps:L,system:S}),T.verdict==null&&(T=await Sm({client:u,messages:w,monitor:f,onStep:r,page:o,runStartTime:d,specNodes:E,state:T,steps:L,system:S}));let $=Lm(E);return{findings:T.findings,generatedSpec:$,monitor:f,steps:L,verdict:T.verdict??"fail"}}function ns({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function km({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:l,steps:s,system:c}){let p=l;for(let u=0;u<hm;u++){b.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:ts,messages:t,model:"server-controlled",system:c,tools:dr}),f=await rs({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:i,specNodes:a,stepIndex:p.stepIndex,steps:s});if(p=ns({result:f,state:p}),!f.continueLoop)break}return p}async function Sm({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,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:ts,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:dr}),u=await rs({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:i,specNodes:a,stepIndex:l.stepIndex,steps:s});return ns({result:u,state:l})}function Am({extraVariables:e,spec:t}){let n=wm(e,t?.variableNamespaces);return{...St({defs:t?.variables}),...n}}function wm(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,i])=>{n.set(i,o)});let r={};return Object.entries(e).forEach(([o,i])=>{let a=n.get(o);Object.entries(i).forEach(([l,s])=>{r[a==null?l:`${a}.${l}`]=s})}),r}function bm({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:i}){let a=i==null?"":[`
45
45
 
46
- ## Workflow Under Test`,`**Name:** ${a.name}`,`**Description:** ${a.description}`,`**Expected Outcome:** ${a.expectedOutcome}`,`
46
+ ## Workflow Under Test`,`**Name:** ${i.name}`,`**Description:** ${i.description}`,`**Expected Outcome:** ${i.expectedOutcome}`,`
47
47
  Focus your testing ONLY on this specific workflow. Do not test unrelated parts of the application.`].join(`
48
48
  `),l=n==null?"":`
49
49
 
50
50
  Reference workflow spec (the steps a user would follow):
51
51
  \`\`\`json
52
52
  ${JSON.stringify(n,null,2)}
53
- \`\`\``,s=t.map(m=>`- ${m}`).join(`
53
+ \`\`\``,s=t.map(f=>`- ${f}`).join(`
54
54
  `),c=t.length===0?"":`
55
55
 
56
56
  ## Setup Already Completed
57
57
  The following setup steps have already been run before your session started:
58
58
  ${s}
59
59
 
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(`
60
+ Do not repeat any of these steps.`,p=Object.entries(o),u=p.map(([f,h])=>`- **${f}:** ${typeof h=="object"?JSON.stringify(h):String(h)}`).join(`
61
61
  `),d=p.length===0?"":`
62
62
 
63
63
  ## Resolved Variables
64
64
  ${u}`;return[`You are testing the application at: ${e}`,"Use the provided tools to navigate, interact with, and assert things about the page.","Use get_page_content to inspect the page when you need to understand what's on screen.","Follow the workflow steps to complete the task.",`
65
- ## Available Tools`,yi,i,c,l,d,`
65
+ ## Available Tools`,Qa,a,c,l,d,`
66
66
  ## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
67
- `)}function Ep({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 Op({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 Up({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 wi({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:a,specNodes:i,stepIndex:l,steps:s}){let c=o.content.filter(k=>k.type==="text").map(k=>k.text),p=o.content.filter(k=>k.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 k of p){let A=await _p({block:k,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 S=h??c.join(`
69
- `);return{continueLoop:m==null&&o.stop_reason==="tool_use",newFindings:S,nextStepIndex:d,verdict:m}}async function _p({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:a,stepIndex:i,steps:l}){try{let s=await gi({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 be({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 Ip(e){if(e.length===0)return{entryNode:"",nodes:{}};let t={};e.forEach((r,o)=>{let a=e[o+1],i=a==null?r:{...r,next:a.id};t[r.id]=i});let n=e[0];if(n==null)throw new Error("Expected at least one spec node after length check");return{entryNode:n.id,nodes:t}}var Tp,Si,Jn=g(()=>{"use strict";hi();K();rt();we();Tp=50,Si=16384});function Xn({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
67
+ `)}function Rm({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 i=r.url.value.replaceAll(/\{\{(\w+)\}\}/g,(a,l)=>{let s=n[l];return s==null?`{{${l}}}`:typeof s=="object"?JSON.stringify(s):String(s)});return i.startsWith("http")?i:`${e}${i.startsWith("/")?"":"/"}${i}`}function Tm({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 Nm({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 rs({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:i,specNodes:a,stepIndex:l,steps:s}){let c=o.content.filter(k=>k.type==="text").map(k=>k.text),p=o.content.filter(k=>k.type==="tool_use");if(p.length===0)return{continueLoop:!1,newFindings:c.join(`
68
+ `),nextStepIndex:l,verdict:void 0};let u=[],d=l,f,h;for(let k of p){let A=await Cm({block:k,monitor:t,onStep:n,page:r,runStartTime:i,specNodes:a,stepIndex:d,steps:s});u.push(A.toolResult),d=A.nextStepIndex,A.verdict!=null&&(f=A.verdict,h=A.summary)}e.push({content:o.content,role:"assistant"},{content:u,role:"user"});let S=h??c.join(`
69
+ `);return{continueLoop:f==null&&o.stop_reason==="tool_use",newFindings:S,nextStepIndex:d,verdict:f}}async function Cm({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:i,stepIndex:a,steps:l}){try{let s=await Ya({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:a}),c={content:s.toolOutput,tool_use_id:e.id,type:"tool_result"};return s.kind==="verdict"?(b.info(" [%d] %s \u2014 verdict: %s",a,e.name,s.verdict),{nextStepIndex:a,summary:s.summary,toolResult:c,verdict:s.verdict}):(s.specNode!=null&&i.push(s.specNode),s.stepResult!=null?(l.push(s.stepResult),n?.(s.stepResult),b.info(" [%d] %s \u2014 %s",a,e.name,s.stepResult.status),{nextStepIndex:a+1,summary:void 0,toolResult:c,verdict:void 0}):(b.info(" [%d] %s \u2014 info",a,e.name),{nextStepIndex:a,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",a,e.name,c);let p=await Oe({page:r,runStartTime:o,targets:[]}),u={annotations:p.annotations,assertions:[],detail:`Error: ${c}`,duration:0,nodeId:`agent-step-${String(a)}`,nodeType:"click",screenshotBase64:p.screenshotBase64,snapshotTimestamp:p.snapshotTimestamp,status:"failed",stepIndex:a,title:`${e.name} (error)`,url:p.url,viewportHeight:p.viewportHeight,viewportWidth:p.viewportWidth};return l.push(u),n?.(u),{nextStepIndex:a+1,summary:void 0,toolResult:{content:`Error: ${c}`,is_error:!0,tool_use_id:e.id,type:"tool_result"},verdict:void 0}}}function Lm(e){if(e.length===0)return{entryNode:"",nodes:{}};let t={};e.forEach((r,o)=>{let i=e[o+1],a=i==null?r:{...r,next:i.id};t[r.id]=a});let n=e[0];if(n==null)throw new Error("Expected at least one spec node after length check");return{entryNode:n.id,nodes:t}}var hm,ts,fr=m(()=>{"use strict";Za();Y();wt();Ee();hm=50,ts=16384});function yr({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
70
70
  ${e}`];t!=null&&t.length>0&&r.push(`## Output
71
71
  ${t}`),n!=null&&n.length>0&&r.push(`## Success Criteria
72
- ${n}`);let o=["## Completing Your Evaluation",'When you finish your evaluation, you MUST call the `complete_test` tool with your verdict ("pass" or "fail") and a `summary` string.',jp({hasSuccessCriteria:n!=null&&n.length>0}),$p({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.',vm({hasSuccessCriteria:n!=null&&n.length>0}),Pm({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
73
73
  `)),r.join(`
74
74
 
75
- `)}function jp({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 $p({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 Hn=g(()=>{"use strict"});import{execFile as Dp}from"child_process";import{createRequire as Bp}from"module";import bi from"fs";import Ri from"path";import{chromium as Gn}from"playwright";async function Re({headed:e}){b.info("Browser executable: %s",Gn.executablePath());try{return await Gn.launch({headless:!e})}catch(t){throw Vp(t)?new Error(`Playwright browsers are not installed. Run:
75
+ `)}function vm({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 Pm({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 gr=m(()=>{"use strict"});import{execFile as xm}from"child_process";import{createRequire as Em}from"module";import os from"fs";import is from"path";import{chromium as as}from"playwright";async function Ie({headed:e}){try{return await as.launch({headless:!e})}catch(t){throw Om(t)?new Error(`Playwright browsers are not installed. Run:
76
76
 
77
77
  npx playwright install chromium
78
- `):t}}async function Kn(){let e=Gn.executablePath();if(bi.existsSync(e))return;b.info("Chromium not found. Installing via Playwright...");let t=Bp(import.meta.url),n=Ri.dirname(t.resolve("playwright/package.json")),r=Ri.join(n,"cli.js");if(await new Promise((o,a)=>{Dp(process.execPath,[r,"install","chromium"],i=>{if(i!=null){a(new Error(`Playwright install failed: ${i.message}`));return}o()})}),!bi.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
78
+ `):t}}async function hr(){let e=as.executablePath();if(os.existsSync(e))return;b.info("Chromium not found. Installing via Playwright...");let t=Em(import.meta.url),n=is.dirname(t.resolve("playwright/package.json")),r=is.join(n,"cli.js");if(await new Promise((o,i)=>{xm(process.execPath,[r,"install","chromium"],a=>{if(a!=null){i(new Error(`Playwright install failed: ${a.message}`));return}o()})}),!os.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
79
79
 
80
80
  npx playwright install chromium
81
- `);b.info("\u2713 Chromium installed")}function Vp(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var at=g(()=>{"use strict";K()});import{mkdir as Yn,writeFile as ce}from"fs/promises";import Q from"path";async function vt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let a=Q.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await Yn(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([ce(Q.join(a,"info.json"),JSON.stringify(i,null,2)),ce(Q.join(a,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),Wp({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 Wp({context:e,page:t,stepDir:n}){let[r,o,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),qp(t),Fp({context:e,page:t})]);await Promise.all([ce(Q.join(n,"dom.html"),r),ce(Q.join(n,"accessibility-tree.txt"),o),ce(Q.join(n,"storage.json"),JSON.stringify(a,null,2))])}async function qp(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Fp({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 xt({monitor:e,runId:t,steps:n,summary:r}){try{let o=Q.join(process.cwd(),".ripplo","debug",t);await Yn(o,{recursive:!0}),await Promise.all([ce(Q.join(o,"summary.txt"),Mp({steps:n,summary:r})),ce(Q.join(o,"console.log"),zp(e.consoleEntries)),ce(Q.join(o,"network.jsonl"),Jp(e.networkEntries)),ce(Q.join(o,"page-errors.log"),e.pageErrors.join(`
81
+ `);b.info("\u2713 Chromium installed")}function Om(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var Rt=m(()=>{"use strict";Y()});import{mkdir as kr,writeFile as fe}from"fs/promises";import ee from"path";async function Jt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let i=ee.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await kr(i,{recursive:!0});let a={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([fe(ee.join(i,"info.json"),JSON.stringify(a,null,2)),fe(ee.join(i,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),Im({context:e,page:t,stepDir:i})])}catch(i){let a=i instanceof Error?i.message:String(i);b.warn("Failed to write step debug data for step %d: %s",r,a)}}async function Im({context:e,page:t,stepDir:n}){let[r,o,i]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),_m(t),Um({context:e,page:t})]);await Promise.all([fe(ee.join(n,"dom.html"),r),fe(ee.join(n,"accessibility-tree.txt"),o),fe(ee.join(n,"storage.json"),JSON.stringify(i,null,2))])}async function _m(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Um({context:e,page:t}){let[n,r]=await Promise.all([t.evaluate(()=>({localStorage:Object.fromEntries(Array.from({length:localStorage.length},(o,i)=>{let a=localStorage.key(i);return a==null?void 0:[a,localStorage.getItem(a)??""]}).filter(o=>o!=null)),sessionStorage:Object.fromEntries(Array.from({length:sessionStorage.length},(o,i)=>{let a=sessionStorage.key(i);return a==null?void 0:[a,sessionStorage.getItem(a)??""]}).filter(o=>o!=null))})).catch(()=>({localStorage:{},sessionStorage:{}})),e.cookies().catch(()=>[])]);return{cookies:r,localStorage:n.localStorage,sessionStorage:n.sessionStorage}}async function zt({monitor:e,runId:t,steps:n,summary:r}){try{let o=ee.join(process.cwd(),".ripplo","debug",t);await kr(o,{recursive:!0}),await Promise.all([fe(ee.join(o,"summary.txt"),jm({steps:n,summary:r})),fe(ee.join(o,"console.log"),$m(e.consoleEntries)),fe(ee.join(o,"network.jsonl"),Dm(e.networkEntries)),fe(ee.join(o,"page-errors.log"),e.pageErrors.join(`
82
82
  ---
83
- `))]),b.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write run debug summary: %s",a)}}function Mp({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 zp(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
- `)}function Jp(e){return e.map(t=>JSON.stringify(t)).join(`
86
- `)}async function Ni({error:e,runId:t,stack:n,workflowName:r}){try{let o=Q.join(process.cwd(),".ripplo","debug",t);await Yn(o,{recursive:!0});let a=n==null?e:`${e}
83
+ `))]),b.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);b.warn("Failed to write run debug summary: %s",i)}}function jm({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 $m(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
+ `)}function Dm(e){return e.map(t=>JSON.stringify(t)).join(`
86
+ `)}async function ss({error:e,runId:t,stack:n,workflowName:r}){try{let o=ee.join(process.cwd(),".ripplo","debug",t);await kr(o,{recursive:!0});let i=n==null?e:`${e}
87
87
 
88
- ${n}`,i=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
88
+ ${n}`,a=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
89
89
  ${n}`].join(`
90
- `);await Promise.all([ce(Q.join(o,"error.txt"),a),ce(Q.join(o,"summary.txt"),i)]),b.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let a=o instanceof Error?o.message:String(o);b.warn("Failed to write error debug artifacts: %s",a)}}var Pt=g(()=>{"use strict";K()});async function Qn({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 Re({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 k=function(I){s.enqueueStep(I),s.flushSteps(),vt({context:m,page:h,runId:a,stepIndex:I.stepIndex,stepResult:I})};var S=k;let A=await zn({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:k,page:h,runId:a,serverUrl:i,spec:l,systemPrompt:c,token:p,workflowContext:u}),w=A.verdict==="pass"?"passed":"failed";await s.complete({statusOverride:w,steps:A.steps,summary:A.findings});let P=A.steps.filter(I=>I.status==="passed").length,E=A.steps.filter(I=>I.status==="failed").length,N={duration:A.steps.reduce((I,x)=>I+x.duration,0),failCount:E,passCount:P,runId:a,status:w,workflowName:u.name};await xt({monitor:A.monitor,runId:a,steps:A.steps,summary:N}),b.info("Agent test complete: %d passed, %d failed",P,E),b.info(`
90
+ `);await Promise.all([fe(ee.join(o,"error.txt"),i),fe(ee.join(o,"summary.txt"),a)]),b.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);b.warn("Failed to write error debug artifacts: %s",i)}}var Xt=m(()=>{"use strict";Y()});async function Sr({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:i,serverUrl:a,spec:l,streaming:s,systemPrompt:c,token:p,workflowContext:u}){let d=await Ie({headed:o}),f=await d.newContext({baseURL:e});t.length>0&&(await f.addCookies([...t]),b.info("Injected %d cookies from preconditions",t.length));let h=await f.newPage();try{let k=function($){s.enqueueStep($),s.flushSteps(),Jt({context:f,page:h,runId:i,stepIndex:$.stepIndex,stepResult:$})};var S=k;let A=await mr({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:k,page:h,runId:i,serverUrl:a,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 L=A.steps.filter($=>$.status==="passed").length,E=A.steps.filter($=>$.status==="failed").length,T={duration:A.steps.reduce(($,x)=>$+x.duration,0),failCount:E,passCount:L,runId:i,status:w,workflowName:u.name};await zt({monitor:A.monitor,runId:i,steps:A.steps,summary:T}),b.info("Agent test complete: %d passed, %d failed",L,E),b.info(`
91
91
  === Agent Summary ===
92
- %s`,A.findings)}finally{await d.close()}}var Zn=g(()=>{"use strict";at();Jn();Pt();K()});async function er({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return it({actual:o??"",expected:e,label:"Text",operator:n})}function Et({expected:e,operator:t,url:n}){return it({actual:n,expected:e,label:"URL",operator:t})}async function tr({expected:e,locator:t,operator:n}){let r=await t.count();return Oi({actual:r,expected:e,label:"Count",operator:n})}async function nr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return it({actual:o,expected:e,label:"Value",operator:n})}async function rr({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 or({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 Ti({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let a=await n.getAttribute(e,{timeout:o});return it({actual:a??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Li({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 Ci({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 vi({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 xi({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 Pi({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 Ei({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 it(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Xp(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Xp({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 Oi(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Hp(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Hp({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 ar=g(()=>{"use strict"});async function X({fn:e,label:t}){let n=performance.now(),r=await e();return b.info("%s: %dms",t,Math.round(performance.now()-n)),r}var We=g(()=>{"use strict";K()});async function ir({headed:e,size:t}){let n=await X({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>Re({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"),Re({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 Ui=g(()=>{"use strict";at();K();We()});import{print as Gp}from"graphql";async function q(e){let t=Gp(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(Kp)})}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(!Yp(a))throw new Error("Invalid GraphQL response");if(Qp(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 Yp(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function Qp(e){return Array.isArray(e.errors)&&e.errors.length>0}var Kp,st=g(()=>{"use strict";Kp=15e3});import{readdir as Zp,rm as eu,stat as tu}from"fs/promises";import uw from"os";import ji from"path";import{graphql as nu}from"gql.tada";async function sr({maxRuns:e}){try{let n=(await Zp(_i,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=ji.join(_i,c.name),u=await tu(p);return{dirPath:p,mtime:u.mtimeMs}})),a=o.filter(c=>r-c.mtime>Ii),l=o.filter(c=>r-c.mtime<=Ii).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...a,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>eu(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 _i,Ii,hw,$i=g(()=>{"use strict";st();K();_i=ji.join(process.cwd(),".ripplo","debug"),Ii=360*60*1e3,hw=nu(`
92
+ %s`,A.findings)}finally{await d.close()}}var Ar=m(()=>{"use strict";Rt();fr();Xt();Y()});async function wr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return Tt({actual:o??"",expected:e,label:"Text",operator:n})}function Gt({expected:e,operator:t,url:n}){return Tt({actual:n,expected:e,label:"URL",operator:t})}async function br({expected:e,locator:t,operator:n}){let r=await t.count();return ys({actual:r,expected:e,label:"Count",operator:n})}async function Rr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return Tt({actual:o,expected:e,label:"Value",operator:n})}async function Tr({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 Nr({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 ls({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let i=await n.getAttribute(e,{timeout:o});return Tt({actual:i??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function cs({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 ds({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 ps({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 us({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 ms({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 fs({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 Tt(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Bm(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Bm({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 ys(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Vm(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Vm({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 Cr=m(()=>{"use strict"});async function G({fn:e,label:t}){let n=performance.now(),r=await e();return b.info("%s: %dms",t,Math.round(performance.now()-n)),r}var rt=m(()=>{"use strict";Y()});async function Lr({headed:e,size:t}){let n=await G({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>Ie({headed:e})))}),r=new Set,o=[];function i(){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 a(s){if(r.delete(s),!s.isConnected()){b.warn("Released browser is disconnected, launching replacement"),Ie({headed:e}).then(p=>{a(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:i,closeAll:l,release:a}}var gs=m(()=>{"use strict";Rt();Y();rt()});import{print as Wm}from"graphql";async function U(e){let t=Wm(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(qm)})}catch(a){let l=a instanceof Error?a.message:String(a);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 i=await o.json();if(!Fm(i))throw new Error("Invalid GraphQL response");if(Hm(i))throw new Error(i.errors.map(a=>a.message).join(", "));if(i.data==null)throw new Error("No data returned from server");return i.data}function Fm(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function Hm(e){return Array.isArray(e.errors)&&e.errors.length>0}var qm,Nt=m(()=>{"use strict";qm=15e3});import{readdir as Mm,rm as Jm,stat as zm}from"fs/promises";import GT from"os";import Ss from"path";import{graphql as Xm}from"gql.tada";async function vr({maxRuns:e}){try{let n=(await Mm(hs,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=Ss.join(hs,c.name),u=await zm(p);return{dirPath:p,mtime:u.mtimeMs}})),i=o.filter(c=>r-c.mtime>ks),l=o.filter(c=>r-c.mtime<=ks).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...i,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>Jm(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 hs,ks,eN,As=m(()=>{"use strict";Nt();Y();hs=Ss.join(process.cwd(),".ripplo","debug"),ks=360*60*1e3,eN=Xm(`
93
93
  mutation RevokeCurrentCliToken {
94
94
  revokeCurrentCliToken
95
95
  }
96
- `)});async function lr({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(ru)})}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 ru,cr=g(()=>{"use strict";K();ru=5e3});import lt from"fs";import dr from"path";function ct(e){let t=dr.join(e,".ripplo",".token");if(!lt.existsSync(t))return null;let n=lt.readFileSync(t,"utf8").trim();return n.length===0?null:n}function pr(e,t){let n=dr.join(e,".ripplo");lt.existsSync(n)||lt.mkdirSync(n,{recursive:!0}),lt.writeFileSync(dr.join(n,".token"),t+`
98
- `)}var Di=g(()=>{"use strict"});import{z as Ot}from"zod";function It(e){return Bi({legacy:void 0,migrators:[],name:e,schemas:[]})}function Bi(e){return{initial:t=>ur(t,{...e,schemas:[t]}),legacy:t=>Bi({...e,legacy:t})}}function ur(e,t){return{build:()=>au(e,t),legacy:n=>ur(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return ur(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function au(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>iu(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function iu(e,t,n){let{data:r,version:o}=su(t,n),a=Vi(t,r,o);return e.parse(a)}function su(e,t){let n=ou.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new _t({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function Vi(e,t,n){let r=e.schemas.length;if(n>r)throw new Ut({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let a=o.parse(t),i=e.migrators[n-1];if(i==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return Vi(e,i(a),n+1)}var ou,Ut,_t,mr=g(()=>{"use strict";ou=Ot.object({__codec:Ot.string().min(1),data:Ot.unknown(),version:Ot.number().int().positive()}),Ut=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},_t=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as qe}from"zod";var fr,yr=g(()=>{"use strict";fr=qe.object({depends:qe.array(qe.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:qe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:qe.array(qe.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name.")});import{z as Ne}from"zod";var lu,cu,O,gr=g(()=>{"use strict";lu=Ne.object({by:Ne.literal("testId"),value:Ne.string().min(1)}),cu=Ne.object({by:Ne.literal("role"),name:Ne.string().optional(),role:Ne.string().min(1)}),O=Ne.discriminatedUnion("by",[lu,cu])});import{z as Wi}from"zod";var Te,jt,hr=g(()=>{"use strict";Te=Wi.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),jt=Wi.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as M}from"zod";var du,kr,$t,ne,Dt,Sr=g(()=>{"use strict";du=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),kr=M.object({name:M.string().min(1),type:M.literal("variable")}),$t=M.discriminatedUnion("type",[du,kr]),ne=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),kr]),Dt=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),kr])});import{z as re}from"zod";var Bt,Ar=g(()=>{"use strict";Bt=re.discriminatedUnion("type",[re.object({default:re.string().optional(),type:re.literal("string")}),re.object({default:re.number().optional(),type:re.literal("number")}),re.object({default:re.boolean().optional(),type:re.literal("boolean")}),re.object({key:re.string().min(1),type:re.literal("env")})])});import{z as y}from"zod";var v,qi,pu,uu,mu,fu,yu,gu,hu,ku,Su,Au,wu,bu,Ru,Nu,Tu,Lu,Cu,vu,xu,Pu,Eu,Ou,Uu,_u,Iu,ju,$u,Du,Bu,Vu,Wu,qu,Fu,Mu,zu,Ju,Xu,Fi,Vt,Wt=g(()=>{"use strict";gr();hr();Sr();Ar();gr();hr();Sr();Ar();v={comment:y.string().max(2e3).optional(),id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),timeout:y.number().int().positive().optional()},qi=500,pu=y.object({...v,type:y.literal("goto"),url:ne}),uu=y.object({...v,locator:O,type:y.literal("click")}),mu=y.object({...v,locator:O,type:y.literal("fill"),value:ne}),fu=y.object({...v,locator:O,type:y.literal("select"),value:ne}),yu=y.object({...v,locator:O,type:y.literal("hover")}),gu=y.object({...v,key:y.string().min(1),locator:O.optional(),type:y.literal("press")}),hu=y.object({...v,locator:O,type:y.literal("check")}),ku=y.object({...v,locator:O,type:y.literal("uncheck")}),Su=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")}),wu=y.object({...v,type:y.literal("setVariable"),value:$t,variable:y.string().min(1)}),bu=y.object({...v,locator:O,type:y.literal("extractText"),variable:y.string().min(1)}),Ru=y.object({...v,files:y.array(y.string()).min(1),locator:O,type:y.literal("upload")}),Nu=y.object({...v,locator:O,type:y.literal("dblclick")}),Tu=y.object({...v,source:O,target:O,type:y.literal("drag")}),Lu=y.object({...v,locator:O,type:y.literal("scrollIntoView")}),Cu=y.object({...v,locator:O,type:y.literal("type"),value:ne}),vu=y.object({...v,locator:O,type:y.literal("focus")}),xu=y.object({...v,locator:O,type:y.literal("clear")}),Pu=y.object({...v,locator:O,type:y.literal("rightClick")}),Eu=y.object({...v,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),Ou=y.object({...v,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:ne.optional(),variable:y.string().min(1).optional()}),Uu=y.object({...v,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),_u=y.object({...v,locator:O,type:y.literal("assertVisible")}),Iu=y.object({...v,locator:O,type:y.literal("assertNotVisible")}),ju=y.object({...v,expected:ne,locator:O,operator:Te,type:y.literal("assertText")}),$u=y.object({...v,expected:ne,operator:Te,type:y.literal("assertUrl")}),Du=y.object({...v,expected:Dt,locator:O,operator:jt,type:y.literal("assertCount")}),Bu=y.object({...v,expected:ne,locator:O,operator:Te,type:y.literal("assertValue")}),Vu=y.object({...v,attribute:y.string().min(1),expected:ne,locator:O,operator:Te,type:y.literal("assertAttribute")}),Wu=y.object({...v,locator:O,type:y.literal("assertEnabled")}),qu=y.object({...v,locator:O,type:y.literal("assertDisabled")}),Fu=y.object({...v,expected:ne,operator:Te,type:y.literal("assertTitle")}),Mu=y.object({...v,locator:O,type:y.literal("assertChecked")}),zu=y.object({...v,locator:O,type:y.literal("assertNotChecked")}),Ju=y.object({...v,locator:O,type:y.literal("assertFocused")}),Xu=y.object({...v,locator:O,type:y.literal("assertNotFocused")}),Fi=y.discriminatedUnion("type",[pu,uu,mu,fu,yu,gu,hu,ku,_u,Iu,ju,$u,Du,Bu,Vu,Wu,qu,Su,Au,wu,bu,Ru,Nu,Tu,Lu,Cu,vu,xu,Pu,Eu,Ou,Uu,Fu,Mu,zu,Ju,Xu]),Vt=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),Fi).refine(e=>Object.keys(e).length<=qi,`Workflow has more than ${String(qi)} nodes`),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),Bt).optional()})});import{z as Mi}from"zod";var Hu,Gu,Ku,wr,Yu,zi=g(()=>{"use strict";mr();yr();Wt();Hu=Mi.record(Mi.string().max(200),fr),Gu={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Ku={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},wr=It("workflow-spec").legacy(Gu).initial(Vt).build(),Yu=It("precondition-map").legacy(Ku).initial(Hu).build()});var Ji=g(()=>{"use strict";Wt()});var Xi=g(()=>{"use strict";mr();zi();yr();Wt();Ji()});async function br({failFast:e,onStep:t,page:n,spec:r,variables:o}){let a=performance.now();return em({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:a,spec:r,variables:o})}function Zu({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function em({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 tm({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(Zu({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function tm({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let a=performance.now(),i=e.label??`${e.type} (${e.id})`,l=e.timeout??Qu,s=Tt({node:e,page:n});try{let c=await nm({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-a),u=c.assertions.some(m=>m.status==="failed"),d=await X({label:`Snapshot [${i}]`,fn:()=>be({page:n,runStartTime:r,targets:s})});return{annotations:d.annotations,assertions:c.assertions,detail:void 0,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:u?"failed":"passed",stepIndex:0,title:i,url:d.url,variables:c.variables,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}catch(c){let p=Math.round(performance.now()-a),u=c instanceof Error?c.message:String(c),d=await X({label:`Snapshot [${i}] (error)`,fn:()=>be({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 nm({node:e,page:t,timeout:n,variables:r}){if(rm(e)){let a=await xn({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:a.variables}}return{assertions:await am({node:e,page:t,timeout:n,variables:r}),variables:r}}function rm(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 om(e){return e.type.startsWith("assert")}async function am({node:e,page:t,timeout:n,variables:r}){if(!om(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 sm({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let a=Y({ref:o.expected,variables:r});return[await er({expected:a,locator:B({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertUrl":{let a=Y({ref:o.expected,variables:r});return[Et({expected:a,operator:o.operator,url:t.url()})]}case"assertTitle":{let a=Y({ref:o.expected,variables:r});return[Et({expected:a,operator:o.operator,url:await t.title()})]}case"assertCount":{let a=vn({ref:o.expected,variables:r});return[await tr({expected:a,locator:B({locator:o.locator,page:t,variables:r}),operator:o.operator})]}case"assertValue":{let a=Y({ref:o.expected,variables:r});return[await nr({expected:a,locator:B({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertAttribute":{let a=Y({ref:o.expected,variables:r});return[await Ti({attribute:o.attribute,expected:a,locator:B({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function sm({assertNode:e,page:t,timeout:n,variables:r}){let o=im[e.type];return[await o({locator:B({locator:e.locator,page:t,variables:r}),timeout:n})]}var Qu,im,Rr=g(()=>{"use strict";Pn();ar();Ve();K();We();rt();we();Qu=1e4;im={assertChecked:vi,assertDisabled:Ci,assertEnabled:Li,assertFocused:Pi,assertNotChecked:xi,assertNotFocused:Ei,assertNotVisible:or,assertVisible:rr}});async function Nr({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=ot(s),p=[];function u(w){o?.(w),p.push(vt({context:l,page:s,runId:a,stepIndex:w.stepIndex,stepResult:w}))}let d=lm(r,i.variableNamespaces),m={...tt({defs:i.variables}),...d};b.info("Starting graph execution (entry: %s)",i.entryNode);let h=await br({failFast:!0,onStep:u,page:s,spec:i,variables:m});await Promise.allSettled(p);let S=h.steps.filter(w=>w.status==="passed").length,k=h.steps.filter(w=>w.status==="failed").length,A={duration:h.steps.reduce((w,P)=>w+P.duration,0),failCount:k,passCount:S,runId:a,status:k>0?"failed":"passed",workflowName:""};return await xt({monitor:c,runId:a,steps:h.steps,summary:A}),await l.close(),h.steps}function lm(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 Tr=g(()=>{"use strict";Vn();Pt();Rr();K();we()});var Gi=St(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.timingSafeEqual=void 0;function Hi(e,t=""){if(!e)throw new Error(t)}function cm(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)),Hi(e instanceof DataView),Hi(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}qt.timingSafeEqual=cm});var Qi=St(oe=>{"use strict";var dm=oe&&oe.__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(oe,"__esModule",{value:!0});var W=256,Lr=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var n="",r=0;r<t.length-2;r+=3){var o=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),n+=this._encodeByte(o>>>6&63),n+=this._encodeByte(o>>>0&63)}var a=t.length-r;if(a>0){var o=t[r]<<16|(a===2?t[r+1]<<8:0);n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),a===2?n+=this._encodeByte(o>>>6&63):n+=this._paddingCharacter||"",n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var n=this._getPaddingLength(t),r=t.length-n,o=new Uint8Array(this.maxDecodedLength(r)),a=0,i=0,l=0,s=0,c=0,p=0,u=0;i<r-4;i+=4)s=this._decodeChar(t.charCodeAt(i+0)),c=this._decodeChar(t.charCodeAt(i+1)),p=this._decodeChar(t.charCodeAt(i+2)),u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=s<<2|c>>>4,o[a++]=c<<4|p>>>2,o[a++]=p<<6|u,l|=s&W,l|=c&W,l|=p&W,l|=u&W;if(i<r-1&&(s=this._decodeChar(t.charCodeAt(i)),c=this._decodeChar(t.charCodeAt(i+1)),o[a++]=s<<2|c>>>4,l|=s&W,l|=c&W),i<r-2&&(p=this._decodeChar(t.charCodeAt(i+2)),o[a++]=c<<4|p>>>2,l|=p&W),i<r-3&&(u=this._decodeChar(t.charCodeAt(i+3)),o[a++]=p<<6|u,l|=u&W),l!==0)throw new Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=W;return n+=(42-t&t-44)>>>8&-W+t-43+62,n+=(46-t&t-48)>>>8&-W+t-47+63,n+=(47-t&t-58)>>>8&-W+t-48+52,n+=(64-t&t-91)>>>8&-W+t-65+0,n+=(96-t&t-123)>>>8&-W+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0&&t[r]===this._paddingCharacter;r--)n++;if(t.length<4||n>2)throw new Error("Base64Coder: incorrect padding")}return n},e})();oe.Coder=Lr;var dt=new Lr;function pm(e){return dt.encode(e)}oe.encode=pm;function um(e){return dt.decode(e)}oe.decode=um;var Ki=(function(e){dm(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=W;return r+=(44-n&n-46)>>>8&-W+n-45+62,r+=(94-n&n-96)>>>8&-W+n-95+63,r+=(47-n&n-58)>>>8&-W+n-48+52,r+=(64-n&n-91)>>>8&-W+n-65+0,r+=(96-n&n-123)>>>8&-W+n-97+26,r},t})(Lr);oe.URLSafeCoder=Ki;var Yi=new Ki;function mm(e){return Yi.encode(e)}oe.encodeURLSafe=mm;function fm(e){return Yi.decode(e)}oe.decodeURLSafe=fm;oe.encodedLength=function(e){return dt.encodedLength(e)};oe.maxDecodedLength=function(e){return dt.maxDecodedLength(e)};oe.decodedLength=function(e){return dt.decodedLength(e)}});var es=St((Zi,Ft)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof Ft=="object"&&typeof Ft.exports=="object"?Ft.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Zi,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,S){for(var k,A,w,P,E,N,I,x,L,j,Pe,Ye,kt;S>=64;){for(k=d[0],A=d[1],w=d[2],P=d[3],E=d[4],N=d[5],I=d[6],x=d[7],j=0;j<16;j++)Pe=h+j*4,u[j]=(m[Pe]&255)<<24|(m[Pe+1]&255)<<16|(m[Pe+2]&255)<<8|m[Pe+3]&255;for(j=16;j<64;j++)L=u[j-2],Ye=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,L=u[j-15],kt=(L>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,u[j]=(Ye+u[j-7]|0)+(kt+u[j-16]|0);for(j=0;j<64;j++)Ye=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&N^~E&I)|0)+(x+(t[j]+u[j]|0)|0)|0,kt=((k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10))+(k&A^k&w^A&w)|0,x=I,I=N,N=E,E=P+Ye|0,P=w,w=A,A=k,k=Ye+kt|0;d[0]+=k,d[1]+=A,d[2]+=w,d[3]+=P,d[4]+=E,d[5]+=N,d[6]+=I,d[7]+=x,h+=64,S-=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,S=m/536870912|0,k=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]=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]=k>>>24&255,this.buffer[A-3]=k>>>16&255,this.buffer[A-2]=k>>>8&255,this.buffer[A-1]=k>>>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 S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");d.reset(),S>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 S=new Uint8Array([1]),k=i(d,u),A=new o(k),w=new Uint8Array(A.digestLength),P=w.length,E=new Uint8Array(h),N=0;N<h;N++)P===w.length&&(l(w,A,m,S),P=0),E[N]=w[P++];return A.clean(),w.fill(0),S.fill(0),E}e.hkdf=c;function p(u,d,m,h){for(var S=new o(u),k=S.digestLength,A=new Uint8Array(4),w=new Uint8Array(k),P=new Uint8Array(k),E=new Uint8Array(h),N=0;N*k<h;N++){var I=N+1;A[0]=I>>>24&255,A[1]=I>>>16&255,A[2]=I>>>8&255,A[3]=I>>>0&255,S.reset(),S.update(d),S.update(A),S.finish(P);for(var x=0;x<k;x++)w[x]=P[x];for(var x=2;x<=m;x++){S.reset(),S.update(P).finish(P);for(var L=0;L<k;L++)w[L]^=P[L]}for(var x=0;x<k&&N*k+x<h;x++)E[N*k+x]=w[x]}for(var N=0;N<k;N++)w[N]=P[N]=0;for(var N=0;N<4;N++)A[N]=0;return S.clean(),E}e.pbkdf2=p})});var vr=St(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.Webhook=Fe.WebhookVerificationError=void 0;var ym=Gi(),ts=Qi(),gm=es(),ns=300,Cr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},Le=class e extends Cr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Fe.WebhookVerificationError=Le;var Mt=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=ts.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 Le("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,ym.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new Le("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,${ts.encode(gm.hmac(this.key,i))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new Le("Invalid Signature Headers");if(n-r>ns)throw new Le("Message timestamp too old");if(r>n+ns)throw new Le("Message timestamp too new");return new Date(r*1e3)}};Fe.Webhook=Mt;Mt.prefix="whsec_"});import rs from"crypto";function Me({body:e,secret:t}){let n=new os.Webhook(t),r=`msg_${rs.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 xr(){return`whsec_${rs.randomBytes(24).toString("base64")}`}var os,Pr=g(()=>{"use strict";os=fo(vr(),1)});import{parseSetCookie as hm}from"set-cookie-parser";import{z as ae}from"zod";async function Er({baseUrl:e,project:t,webhookSecret:n,workflowSlug:r}){let o={apiUrl:void 0,cookies:[],data:{},executed:[]},a=t.workflows.find(s=>s.slug===r);if(a==null)return o;let i=ss({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),l=a.preconditions;return l.length===0?{...o,apiUrl:i}:i==null?o:is({apiUrl:i,preconditionNames:l,webhookSecret:n})}async function Or({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",...bm({cookies:t}),...Me({body:a,secret:o})},method:"PUT",signal:AbortSignal.timeout(as)});i.ok||b.error("Teardown returned %s",String(i.status))}catch{b.error("Teardown request failed")}}async function is({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",...Me({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(as)});if(!a.ok){let c=await Am(a);throw new Error(`execute-batch returned ${String(a.status)}: ${c}`)}let i=await a.json(),l=km.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=Rm({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 Am(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=wm(t),r=n==null?null:Sm.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function wm(e){try{return JSON.parse(e)}catch{return null}}function bm({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Rm({domain:e,res:t}){let n=t.headers.getSetCookie();return hm(n,{decodeValues:!1}).map(o=>Nm({cookie:o,domain:e}))}function Nm({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=Lm({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 Lm({raw:e}){return Tm[e.toLowerCase()]??"Lax"}async function Ur({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=ss({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:is({apiUrl:o,preconditionNames:n,webhookSecret:r})}function ss({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var as,km,Sm,Tm,_r=g(()=>{"use strict";K();Pr();as=3e4,km=ae.object({data:ae.record(ae.string(),ae.record(ae.string(),ae.string())),error:ae.string().optional(),executed:ae.array(ae.string()),runId:ae.string(),success:ae.boolean()});Sm=ae.object({error:ae.string()});Tm={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as Ir}from"gql.tada";async function jr({agentProfileId:e,config:t,runId:n}){let r=await q({config:t,document:vm,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=Cm({config:t,runResultId:o,steps:[c]}).catch(u=>{b.error(u,"Failed to submit step %d",c.stepIndex)});a.push(p)}async function l(){await Promise.all(a)}async function s({statusOverride:c,steps:p,summary:u}){await X({label:`flushSteps (${String(a.length)} steps)`,fn:()=>Promise.all(a)});let d=p.filter(k=>k.status==="passed").length,m=p.filter(k=>k.status==="failed").length,h=p.reduce((k,A)=>k+A.duration,0),S=c??(m>0?"failed":"passed");await X({label:"completeRun",fn:()=>q({config:t,document:Pm,variables:{duration:h,failCount:m,passCount:d,runResultId:o,status:S,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:i,flushSteps:l,runResultId:o}}async function Cm({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 q({config:e,document:xm,variables:{runResultId:t,steps:r}})}var vm,xm,Pm,$r=g(()=>{"use strict";st();K();We();vm=Ir(`
96
+ `)});async function Pr({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Gm)})}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 Gm,xr=m(()=>{"use strict";Y();Gm=5e3});import Kt from"fs";import Er from"path";function Or(e){return Er.join(e,".ripplo",Km)}function Me(e){let t=Or(e);Kt.existsSync(t)||Kt.mkdirSync(t,{recursive:!0});let n=Er.join(t,".gitignore");return Kt.existsSync(n)||Kt.writeFileSync(n,`*
98
+ `),t}function Se(e,t){return Er.join(Or(e),t)}var Km,Ir=m(()=>{"use strict";Km=".local"});import _r from"fs";function Ae(e){let t=Se(e,"token");if(!_r.existsSync(t))return null;let n=_r.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Ur(e,t){Me(e),_r.writeFileSync(Se(e,"token"),t+`
99
+ `)}var ws=m(()=>{"use strict";Ir()});import{z as Qt}from"zod";function en(e){return bs({legacy:void 0,migrators:[],name:e,schemas:[]})}function bs(e){return{initial:t=>jr(t,{...e,schemas:[t]}),legacy:t=>bs({...e,legacy:t})}}function jr(e,t){return{build:()=>Ym(e,t),legacy:n=>jr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return jr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function Ym(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Zm(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Zm(e,t,n){let{data:r,version:o}=ef(t,n),i=Rs(t,r,o);return e.parse(i)}function ef(e,t){let n=Qm.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Zt({expected:e.name,got:n.data.__codec});return{data:n.data.data,version:n.data.version}}if(e.legacy!=null&&e.legacy.detect(t))return{data:t,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function Rs(e,t,n){let r=e.schemas.length;if(n>r)throw new Yt({codec:e.name,currentVersion:r,gotVersion:n});if(n===r)return t;let o=e.schemas[n-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(n)}; cannot migrate.`);let i=o.parse(t),a=e.migrators[n-1];if(a==null)throw new Error(`Codec "${e.name}" missing migrator v${String(n)} \u2192 v${String(n+1)}.`);return Rs(e,a(i),n+1)}var Qm,Yt,Zt,$r=m(()=>{"use strict";Qm=Qt.object({__codec:Qt.string().min(1),data:Qt.unknown(),version:Qt.number().int().positive()}),Yt=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Zt=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as ot}from"zod";var Dr,Br=m(()=>{"use strict";Dr=ot.object({depends:ot.array(ot.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:ot.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:ot.array(ot.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 _e}from"zod";var tf,nf,I,Vr=m(()=>{"use strict";tf=_e.object({by:_e.literal("testId"),value:_e.string().min(1)}),nf=_e.object({by:_e.literal("role"),name:_e.string().optional(),role:_e.string().min(1)}),I=_e.discriminatedUnion("by",[tf,nf])});import{z as Ts}from"zod";var Ue,tn,Wr=m(()=>{"use strict";Ue=Ts.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),tn=Ts.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as H}from"zod";var rf,qr,nn,ie,rn,Fr=m(()=>{"use strict";rf=H.object({type:H.literal("static"),value:H.union([H.string(),H.number(),H.boolean()])}),qr=H.object({name:H.string().min(1),type:H.literal("variable")}),nn=H.discriminatedUnion("type",[rf,qr]),ie=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.string()}),qr]),rn=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.number().int().nonnegative()}),qr])});import{z as ae}from"zod";var on,Hr=m(()=>{"use strict";on=ae.discriminatedUnion("type",[ae.object({default:ae.string().optional(),type:ae.literal("string")}),ae.object({default:ae.number().optional(),type:ae.literal("number")}),ae.object({default:ae.boolean().optional(),type:ae.literal("boolean")}),ae.object({key:ae.string().min(1),type:ae.literal("env")})])});import{z as g}from"zod";var P,Ns,of,af,sf,lf,cf,df,pf,uf,mf,ff,yf,gf,hf,kf,Sf,Af,wf,bf,Rf,Tf,Nf,Cf,Lf,vf,Pf,xf,Ef,Of,If,_f,Uf,jf,$f,Df,Bf,Vf,Wf,Cs,an,sn=m(()=>{"use strict";Vr();Wr();Fr();Hr();Vr();Wr();Fr();Hr();P={comment:g.string().max(2e3).optional(),id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),timeout:g.number().int().positive().optional()},Ns=500,of=g.object({...P,type:g.literal("goto"),url:ie}),af=g.object({...P,locator:I,type:g.literal("click")}),sf=g.object({...P,locator:I,type:g.literal("fill"),value:ie}),lf=g.object({...P,locator:I,type:g.literal("select"),value:ie}),cf=g.object({...P,locator:I,type:g.literal("hover")}),df=g.object({...P,key:g.string().min(1),locator:I.optional(),type:g.literal("press")}),pf=g.object({...P,locator:I,type:g.literal("check")}),uf=g.object({...P,locator:I,type:g.literal("uncheck")}),mf=g.object({...P,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),ff=g.object({...P,message:g.string().min(1),type:g.literal("fail")}),yf=g.object({...P,type:g.literal("setVariable"),value:nn,variable:g.string().min(1)}),gf=g.object({...P,locator:I,type:g.literal("extractText"),variable:g.string().min(1)}),hf=g.object({...P,files:g.array(g.string()).min(1),locator:I,type:g.literal("upload")}),kf=g.object({...P,locator:I,type:g.literal("dblclick")}),Sf=g.object({...P,source:I,target:I,type:g.literal("drag")}),Af=g.object({...P,locator:I,type:g.literal("scrollIntoView")}),wf=g.object({...P,locator:I,type:g.literal("type"),value:ie}),bf=g.object({...P,locator:I,type:g.literal("focus")}),Rf=g.object({...P,locator:I,type:g.literal("clear")}),Tf=g.object({...P,locator:I,type:g.literal("rightClick")}),Nf=g.object({...P,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),Cf=g.object({...P,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:ie.optional(),variable:g.string().min(1).optional()}),Lf=g.object({...P,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),vf=g.object({...P,locator:I,type:g.literal("assertVisible")}),Pf=g.object({...P,locator:I,type:g.literal("assertNotVisible")}),xf=g.object({...P,expected:ie,locator:I,operator:Ue,type:g.literal("assertText")}),Ef=g.object({...P,expected:ie,operator:Ue,type:g.literal("assertUrl")}),Of=g.object({...P,expected:rn,locator:I,operator:tn,type:g.literal("assertCount")}),If=g.object({...P,expected:ie,locator:I,operator:Ue,type:g.literal("assertValue")}),_f=g.object({...P,attribute:g.string().min(1),expected:ie,locator:I,operator:Ue,type:g.literal("assertAttribute")}),Uf=g.object({...P,locator:I,type:g.literal("assertEnabled")}),jf=g.object({...P,locator:I,type:g.literal("assertDisabled")}),$f=g.object({...P,expected:ie,operator:Ue,type:g.literal("assertTitle")}),Df=g.object({...P,locator:I,type:g.literal("assertChecked")}),Bf=g.object({...P,locator:I,type:g.literal("assertNotChecked")}),Vf=g.object({...P,locator:I,type:g.literal("assertFocused")}),Wf=g.object({...P,locator:I,type:g.literal("assertNotFocused")}),Cs=g.discriminatedUnion("type",[of,af,sf,lf,cf,df,pf,uf,vf,Pf,xf,Ef,Of,If,_f,Uf,jf,mf,ff,yf,gf,hf,kf,Sf,Af,wf,bf,Rf,Tf,Nf,Cf,Lf,$f,Df,Bf,Vf,Wf]),an=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),Cs).refine(e=>Object.keys(e).length<=Ns,`Workflow has more than ${String(Ns)} nodes`),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),on).optional()})});import{z as Ls}from"zod";var qf,Ff,Hf,Mr,Mf,vs=m(()=>{"use strict";$r();Br();sn();qf=Ls.record(Ls.string().max(200),Dr),Ff={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Hf={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Mr=en("workflow-spec").legacy(Ff).initial(an).build(),Mf=en("precondition-map").legacy(Hf).initial(qf).build()});var Ps=m(()=>{"use strict";sn()});var xs=m(()=>{"use strict";$r();vs();Br();sn();Ps()});async function Jr({failFast:e,onStep:t,page:n,spec:r,variables:o}){let i=performance.now();return Xf({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:i,spec:r,variables:o})}function zf({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Xf({currentId:e,failFast:t,onStep:n,page:r,runStartTime:o,spec:i,variables:a}){let l=[],s=a,c=e;for(;c!=null;){let p=i.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 f=await Gf({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(zf({onStep:n,steps:[f],target:l}),s=f.variables,t&&f.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function Gf({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let i=performance.now(),a=e.label??`${e.type} (${e.id})`,l=e.timeout??Jf,s=Ft({node:e,page:n});try{let c=await Kf({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-i),u=c.assertions.some(f=>f.status==="failed"),d=await G({label:`Snapshot [${a}]`,fn:()=>Oe({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:a,url:d.url,variables:c.variables,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}catch(c){let p=Math.round(performance.now()-i),u=c instanceof Error?c.message:String(c),d=await G({label:`Snapshot [${a}] (error)`,fn:()=>Oe({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:a,url:d.url,variables:o,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth}}}async function Kf({node:e,page:t,timeout:n,variables:r}){if(Qf(e)){let i=await Qn({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:i.variables}}return{assertions:await Zf({node:e,page:t,timeout:n,variables:r}),variables:r}}function Qf(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 Yf(e){return e.type.startsWith("assert")}async function Zf({node:e,page:t,timeout:n,variables:r}){if(!Yf(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 ty({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let i=Z({ref:o.expected,variables:r});return[await wr({expected:i,locator:W({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertUrl":{let i=Z({ref:o.expected,variables:r});return[Gt({expected:i,operator:o.operator,url:t.url()})]}case"assertTitle":{let i=Z({ref:o.expected,variables:r});return[Gt({expected:i,operator:o.operator,url:await t.title()})]}case"assertCount":{let i=Kn({ref:o.expected,variables:r});return[await br({expected:i,locator:W({locator:o.locator,page:t,variables:r}),operator:o.operator})]}case"assertValue":{let i=Z({ref:o.expected,variables:r});return[await Rr({expected:i,locator:W({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}case"assertAttribute":{let i=Z({ref:o.expected,variables:r});return[await ls({attribute:o.attribute,expected:i,locator:W({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function ty({assertNode:e,page:t,timeout:n,variables:r}){let o=ey[e.type];return[await o({locator:W({locator:e.locator,page:t,variables:r}),timeout:n})]}var Jf,ey,zr=m(()=>{"use strict";Yn();Cr();nt();Y();rt();wt();Ee();Jf=1e4;ey={assertChecked:ps,assertDisabled:ds,assertEnabled:cs,assertFocused:ms,assertNotChecked:us,assertNotFocused:fs,assertNotVisible:Nr,assertVisible:Tr}});async function Xr({baseUrl:e,browser:t,cookies:n,extraVariables:r,onStep:o,runId:i,spec:a}){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=bt(s),p=[];function u(w){o?.(w),p.push(Jt({context:l,page:s,runId:i,stepIndex:w.stepIndex,stepResult:w}))}let d=ny(r,a.variableNamespaces),f={...St({defs:a.variables}),...d};b.info("Starting graph execution (entry: %s)",a.entryNode);let h=await Jr({failFast:!0,onStep:u,page:s,spec:a,variables:f});await Promise.allSettled(p);let S=h.steps.filter(w=>w.status==="passed").length,k=h.steps.filter(w=>w.status==="failed").length,A={duration:h.steps.reduce((w,L)=>w+L.duration,0),failCount:k,passCount:S,runId:i,status:k>0?"failed":"passed",workflowName:""};return await zt({monitor:c,runId:i,steps:h.steps,summary:A}),await l.close(),h.steps}function ny(e,t){if(e==null||t==null)return{};let n=new Map;Object.entries(t).forEach(([o,i])=>{n.set(i,o)});let r={};return Object.entries(e).forEach(([o,i])=>{let a=n.get(o);a!=null&&(r[a]={...r[a],...i})}),r}var Gr=m(()=>{"use strict";lr();Xt();zr();Y();Ee()});var Os=$t(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.timingSafeEqual=void 0;function Es(e,t=""){if(!e)throw new Error(t)}function ry(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)),Es(e instanceof DataView),Es(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}ln.timingSafeEqual=ry});var Us=$t(se=>{"use strict";var oy=se&&se.__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 i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},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(se,"__esModule",{value:!0});var q=256,Kr=(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 i=t.length-r;if(i>0){var o=t[r]<<16|(i===2?t[r+1]<<8:0);n+=this._encodeByte(o>>>18&63),n+=this._encodeByte(o>>>12&63),i===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)),i=0,a=0,l=0,s=0,c=0,p=0,u=0;a<r-4;a+=4)s=this._decodeChar(t.charCodeAt(a+0)),c=this._decodeChar(t.charCodeAt(a+1)),p=this._decodeChar(t.charCodeAt(a+2)),u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=s<<2|c>>>4,o[i++]=c<<4|p>>>2,o[i++]=p<<6|u,l|=s&q,l|=c&q,l|=p&q,l|=u&q;if(a<r-1&&(s=this._decodeChar(t.charCodeAt(a)),c=this._decodeChar(t.charCodeAt(a+1)),o[i++]=s<<2|c>>>4,l|=s&q,l|=c&q),a<r-2&&(p=this._decodeChar(t.charCodeAt(a+2)),o[i++]=c<<4|p>>>2,l|=p&q),a<r-3&&(u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=p<<6|u,l|=u&q),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=q;return n+=(42-t&t-44)>>>8&-q+t-43+62,n+=(46-t&t-48)>>>8&-q+t-47+63,n+=(47-t&t-58)>>>8&-q+t-48+52,n+=(64-t&t-91)>>>8&-q+t-65+0,n+=(96-t&t-123)>>>8&-q+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})();se.Coder=Kr;var Ct=new Kr;function iy(e){return Ct.encode(e)}se.encode=iy;function ay(e){return Ct.decode(e)}se.decode=ay;var Is=(function(e){oy(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=q;return r+=(44-n&n-46)>>>8&-q+n-45+62,r+=(94-n&n-96)>>>8&-q+n-95+63,r+=(47-n&n-58)>>>8&-q+n-48+52,r+=(64-n&n-91)>>>8&-q+n-65+0,r+=(96-n&n-123)>>>8&-q+n-97+26,r},t})(Kr);se.URLSafeCoder=Is;var _s=new Is;function sy(e){return _s.encode(e)}se.encodeURLSafe=sy;function ly(e){return _s.decode(e)}se.decodeURLSafe=ly;se.encodedLength=function(e){return Ct.encodedLength(e)};se.maxDecodedLength=function(e){return Ct.maxDecodedLength(e)};se.decodedLength=function(e){return Ct.decodedLength(e)}});var $s=$t((js,cn)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof cn=="object"&&typeof cn.exports=="object"?cn.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(js,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,f,h,S){for(var k,A,w,L,E,T,$,x,C,D,He,yt,jt;S>=64;){for(k=d[0],A=d[1],w=d[2],L=d[3],E=d[4],T=d[5],$=d[6],x=d[7],D=0;D<16;D++)He=h+D*4,u[D]=(f[He]&255)<<24|(f[He+1]&255)<<16|(f[He+2]&255)<<8|f[He+3]&255;for(D=16;D<64;D++)C=u[D-2],yt=(C>>>17|C<<15)^(C>>>19|C<<13)^C>>>10,C=u[D-15],jt=(C>>>7|C<<25)^(C>>>18|C<<14)^C>>>3,u[D]=(yt+u[D-7]|0)+(jt+u[D-16]|0);for(D=0;D<64;D++)yt=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&T^~E&$)|0)+(x+(t[D]+u[D]|0)|0)|0,jt=((k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10))+(k&A^k&w^A&w)|0,x=$,$=T,T=E,E=L+yt|0,L=w,w=A,A=k,k=yt+jt|0;d[0]+=k,d[1]+=A,d[2]+=w,d[3]+=L,d[4]+=E,d[5]+=T,d[6]+=$,d[7]+=x,h+=64,S-=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,f){if(f===void 0&&(f=d.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=f,this.bufferLength>0){for(;this.bufferLength<64&&f>0;)this.buffer[this.bufferLength++]=d[h++],f--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(f>=64&&(h=n(this.temp,this.state,d,h,f),f%=64);f>0;)this.buffer[this.bufferLength++]=d[h++],f--;return this},u.prototype.finish=function(d){if(!this.finished){var f=this.bytesHashed,h=this.bufferLength,S=f/536870912|0,k=f<<3,A=f%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]=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]=k>>>24&255,this.buffer[A-3]=k>>>16&255,this.buffer[A-2]=k>>>8&255,this.buffer[A-1]=k>>>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 f=0;f<this.state.length;f++)d[f]=this.state[f]},u.prototype._restoreState=function(d,f){for(var h=0;h<this.state.length;h++)this.state[h]=d[h];this.bytesHashed=f,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 f=new Uint8Array(this.blockSize);if(d.length>this.blockSize)new r().update(d).finish(f).clean();else for(var h=0;h<d.length;h++)f[h]=d[h];for(var h=0;h<f.length;h++)f[h]^=54;this.inner.update(f);for(var h=0;h<f.length;h++)f[h]^=106;this.outer.update(f),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<f.length;h++)f[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 i(u){var d=new r().update(u),f=d.digest();return d.clean(),f}e.hash=i,e.default=i;function a(u,d){var f=new o(u).update(d),h=f.digest();return f.clean(),h}e.hmac=a;function l(u,d,f,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");d.reset(),S>1&&d.update(u),f&&d.update(f),d.update(h),d.finish(u),h[0]++}var s=new Uint8Array(e.digestLength);function c(u,d,f,h){d===void 0&&(d=s),h===void 0&&(h=32);for(var S=new Uint8Array([1]),k=a(d,u),A=new o(k),w=new Uint8Array(A.digestLength),L=w.length,E=new Uint8Array(h),T=0;T<h;T++)L===w.length&&(l(w,A,f,S),L=0),E[T]=w[L++];return A.clean(),w.fill(0),S.fill(0),E}e.hkdf=c;function p(u,d,f,h){for(var S=new o(u),k=S.digestLength,A=new Uint8Array(4),w=new Uint8Array(k),L=new Uint8Array(k),E=new Uint8Array(h),T=0;T*k<h;T++){var $=T+1;A[0]=$>>>24&255,A[1]=$>>>16&255,A[2]=$>>>8&255,A[3]=$>>>0&255,S.reset(),S.update(d),S.update(A),S.finish(L);for(var x=0;x<k;x++)w[x]=L[x];for(var x=2;x<=f;x++){S.reset(),S.update(L).finish(L);for(var C=0;C<k;C++)w[C]^=L[C]}for(var x=0;x<k&&T*k+x<h;x++)E[T*k+x]=w[x]}for(var T=0;T<k;T++)w[T]=L[T]=0;for(var T=0;T<4;T++)A[T]=0;return S.clean(),E}e.pbkdf2=p})});var Yr=$t(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.Webhook=it.WebhookVerificationError=void 0;var cy=Os(),Ds=Us(),dy=$s(),Bs=300,Qr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},je=class e extends Qr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};it.WebhookVerificationError=je;var dn=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=Ds.decode(t)}}verify(t,n){let r={};for(let d of Object.keys(n))r[d.toLowerCase()]=n[d];let o=r["webhook-id"],i=r["webhook-signature"],a=r["webhook-timestamp"];if(!i||!o||!a)throw new je("Missing required headers");let l=this.verifyTimestamp(a),c=this.sign(o,l,t).split(",")[1],p=i.split(" "),u=new globalThis.TextEncoder;for(let d of p){let[f,h]=d.split(",");if(f==="v1"&&(0,cy.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new je("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,i=Math.floor(n.getTime()/1e3),a=o.encode(`${t}.${i}.${r}`);return`v1,${Ds.encode(dy.hmac(this.key,a))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new je("Invalid Signature Headers");if(n-r>Bs)throw new je("Message timestamp too old");if(r>n+Bs)throw new je("Message timestamp too new");return new Date(r*1e3)}};it.Webhook=dn;dn.prefix="whsec_"});import Vs from"crypto";function at({body:e,secret:t}){let n=new Ws.Webhook(t),r=`msg_${Vs.randomUUID()}`,o=new Date,i=n.sign(r,o,e),a=Math.floor(o.getTime()/1e3);return{"webhook-id":r,"webhook-signature":i,"webhook-timestamp":String(a)}}function Zr(){return`whsec_${Vs.randomBytes(24).toString("base64")}`}var Ws,eo=m(()=>{"use strict";Ws=Ko(Yr(),1)});import{parseSetCookie as py}from"set-cookie-parser";import{z as le}from"zod";async function to({baseUrl:e,project:t,webhookSecret:n,workflowSlug:r}){let o={apiUrl:void 0,cookies:[],data:{},executed:[]},i=t.workflows.find(s=>s.slug===r);if(i==null)return o;let a=Hs({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),l=i.preconditions;return l.length===0?{...o,apiUrl:a}:a==null?o:Fs({apiUrl:a,preconditionNames:l,webhookSecret:n})}async function no({apiUrl:e,cookies:t,data:n,executed:r,webhookSecret:o}){if(r.length!==0)try{let i=JSON.stringify({data:n,preconditions:r}),a=await fetch(`${e}/teardown`,{body:i,headers:{"Content-Type":"application/json",...gy({cookies:t}),...at({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(qs)});a.ok||b.error("Teardown returned %s",String(a.status))}catch{b.error("Teardown request failed")}}async function Fs({apiUrl:e,preconditionNames:t,webhookSecret:n}){let r=performance.now(),o=JSON.stringify({preconditions:t}),i=await fetch(`${e}/execute-batch`,{body:o,headers:{"Content-Type":"application/json",...at({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(qs)});if(!i.ok){let c=await fy(i);throw new Error(`execute-batch returned ${String(i.status)}: ${c}`)}let a=await i.json(),l=uy.safeParse(a);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=hy({domain:new URL(e).hostname,res:i});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 fy(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=yy(t),r=n==null?null:my.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function yy(e){try{return JSON.parse(e)}catch{return null}}function gy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function hy({domain:e,res:t}){let n=t.headers.getSetCookie();return py(n,{decodeValues:!1}).map(o=>ky({cookie:o,domain:e}))}function ky({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=Ay({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 Ay({raw:e}){return Sy[e.toLowerCase()]??"Lax"}async function ro({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Hs({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Fs({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Hs({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var qs,uy,my,Sy,oo=m(()=>{"use strict";Y();eo();qs=3e4,uy=le.object({data:le.record(le.string(),le.record(le.string(),le.string())),error:le.string().optional(),executed:le.array(le.string()),runId:le.string(),success:le.boolean()});my=le.object({error:le.string()});Sy={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as io}from"gql.tada";async function ao({agentProfileId:e,config:t,runId:n}){let r=await U({config:t,document:by,variables:{agentProfileId:e??null,platform:"chromium",runId:n}});if(r.startRun==null)throw new Error("Failed to start run");let o=r.startRun.id,i=[];function a(c){let p=wy({config:t,runResultId:o,steps:[c]}).catch(u=>{b.error(u,"Failed to submit step %d",c.stepIndex)});i.push(p)}async function l(){await Promise.all(i)}async function s({statusOverride:c,steps:p,summary:u}){await G({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let d=p.filter(k=>k.status==="passed").length,f=p.filter(k=>k.status==="failed").length,h=p.reduce((k,A)=>k+A.duration,0),S=c??(f>0?"failed":"passed");await G({label:"completeRun",fn:()=>U({config:t,document:Ty,variables:{duration:h,failCount:f,passCount:d,runResultId:o,status:S,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:a,flushSteps:l,runResultId:o}}async function wy({config:e,runResultId:t,steps:n}){let r=n.map(o=>({annotations:o.annotations.map(i=>({height:i.height,label:i.label,type:i.type,width:i.width,x:i.x,y:i.y})),assertions:o.assertions.map(i=>({description:i.description,detail:i.detail,status:i.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 U({config:e,document:Ry,variables:{runResultId:t,steps:r}})}var by,Ry,Ty,so=m(()=>{"use strict";Nt();Y();rt();by=io(`
99
100
  mutation StartRunCLI($runId: String!, $platform: String!, $agentProfileId: String) {
100
101
  startRun(runId: $runId, platform: $platform, agentProfileId: $agentProfileId) {
101
102
  id
102
103
  }
103
104
  }
104
- `),xm=Ir(`
105
+ `),Ry=io(`
105
106
  mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
106
107
  submitRunSteps(runResultId: $runResultId, steps: $steps)
107
108
  }
108
- `),Pm=Ir(`
109
+ `),Ty=io(`
109
110
  mutation CompleteRunCLI(
110
111
  $runResultId: String!
111
112
  $status: String!
@@ -128,7 +129,7 @@ ${n}`].join(`
128
129
  status
129
130
  }
130
131
  }
131
- `)});import{z as ge}from"zod";import{graphql as Xt,readFragment as zt}from"gql.tada";async function Dr({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=_m({externalBrowser:r,headed:a});let h=i==null?void 0:X({label:"Preconditions resolved",fn:()=>Ur({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:i,webhookSecret:s})}),[{project:S,workflow:k},A]=await Promise.all([X({label:"Run context resolved",fn:()=>Wm({config:o,workflowId:c})}),X({label:"Streaming run started",fn:()=>jr({agentProfileId:t,config:o,runId:l})}),lr({appUrl:n})]);p=k.name,u=A;let w=Fm(k.spec);b.info("Executing workflow: %s",k.name),await Jm(jm({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:d,config:o,headed:a,ownsBrowser:m,preconditionPromise:h,project:S,runId:l,specData:w,streaming:u,webhookSecret:s,workflow:k}),zm())}catch(h){throw await Im({browserPromise:d,error:h,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),h}}function _m({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):X({label:"Browser launched",fn:()=>Re({headed:t})})}async function Im({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 Ni({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 jm({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:a,ownsBrowser:i,preconditionPromise:l,project:s,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m}){let h=l??X({label:"Preconditions resolved",fn:()=>Er({baseUrl:n,project:Bm(s),webhookSecret:d,workflowSlug:m.slug})}),[S,k]=await Promise.all([h,r]);if(t!=null){i&&await k.close(),await $m({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:a,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m});return}await Vm({baseUrl:n,browser:k,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d})}async function $m({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 qm({config:r,profileId:t});await Qn({baseUrl:n,cookies:a.cookies,executedPreconditions:a.executed,extraVariables:a.data,headed:o,runId:i,serverUrl:r.ripploServerUrl,spec:l,streaming:s,systemPrompt:u,token:r.token,workflowContext:{description:p.name,expectedOutcome:p.name,name:p.name}}),await cs({preconditionResult:a,webhookSecret:c})}function Bm(e){let t=(e.workflows??[]).map(n=>{let r=zt(Jt,n);return Dm.parse(r)});return{preconditionApiPath:e.preconditionApiPath,workflows:t}}async function Vm({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:a,webhookSecret:i}){let l=await X({label:"Spec executed",fn:()=>Nr({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:a.enqueueStep,runId:r,spec:o})});await cs({preconditionResult:n,webhookSecret:i}),await a.complete({statusOverride:void 0,steps:l,summary:void 0});let s=l.filter(p=>p.status==="passed").length,c=l.filter(p=>p.status==="failed").length;b.info("Run complete: %d passed, %d failed",s,c)}async function cs({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await Or({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function Wm({config:e,workflowId:t}){let n=await q({config:e,document:Om,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...zt(ls,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},i=(o.workflows??[]).find(s=>zt(Jt,s).id===t);if(i==null)throw new Error(`Workflow ${t} not found`);let l=zt(Jt,i);return{project:o,workflow:l}}async function qm({config:e,profileId:t}){let n=await q({config:e,document:Um,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),Xn({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function Fm(e){if(e==null)throw new Error("Workflow has no spec");return wr.decode(e)}function zm(){return Mm.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Jm(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 Em,Jt,ls,Om,Um,Dm,Mm,ds=g(()=>{"use strict";Xi();Hn();Zn();at();cr();st();Pt();Tr();K();We();_r();$r();Em=12e4,Jt=Xt(`
132
+ `)});import{z as we}from"zod";import{graphql as mn,readFragment as pn}from"gql.tada";async function lo({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:i,preconditionNames:a,runId:l,webhookSecret:s,workflowId:c}){let p="unknown",u,d,f=!1;try{f=r==null,d=vy({externalBrowser:r,headed:i});let h=a==null?void 0:G({label:"Preconditions resolved",fn:()=>ro({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:a,webhookSecret:s})}),[{project:S,workflow:k},A]=await Promise.all([G({label:"Run context resolved",fn:()=>Uy({config:o,workflowId:c})}),G({label:"Streaming run started",fn:()=>ao({agentProfileId:t,config:o,runId:l})}),Pr({appUrl:n})]);p=k.name,u=A;let w=$y(k.spec);b.info("Executing workflow: %s",k.name),await Vy(xy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:d,config:o,headed:i,ownsBrowser:f,preconditionPromise:h,project:S,runId:l,specData:w,streaming:u,webhookSecret:s,workflow:k}),By())}catch(h){throw await Py({browserPromise:d,error:h,ownsBrowser:f,runId:l,streaming:u,workflowName:p}),h}}function vy({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):G({label:"Browser launched",fn:()=>Ie({headed:t})})}async function Py({browserPromise:e,error:t,ownsBrowser:n,runId:r,streaming:o,workflowName:i}){let a=t instanceof Error?t.message:String(t),l=t instanceof Error?t.stack:void 0;await ss({error:a,runId:r,stack:l,workflowName:i}),o!=null&&await o.complete({statusOverride:"failed",steps:[],summary:a}).catch(()=>{}),n&&e!=null&&await(await e.catch(()=>{}))?.close()}async function xy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:i,ownsBrowser:a,preconditionPromise:l,project:s,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:f}){let h=l??G({label:"Preconditions resolved",fn:()=>to({baseUrl:n,project:Iy(s),webhookSecret:d,workflowSlug:f.slug})}),[S,k]=await Promise.all([h,r]);if(t!=null){a&&await k.close(),await Ey({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:i,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:f});return}await _y({baseUrl:n,browser:k,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d})}async function Ey({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:i,runId:a,specData:l,streaming:s,webhookSecret:c,workflow:p}){let u=e!=null&&e.length>0?e:await jy({config:r,profileId:t});await Sr({baseUrl:n,cookies:i.cookies,executedPreconditions:i.executed,extraVariables:i.data,headed:o,runId:a,serverUrl:r.ripploServerUrl,spec:l,streaming:s,systemPrompt:u,token:r.token,workflowContext:{description:p.name,expectedOutcome:p.name,name:p.name}}),await Js({preconditionResult:i,webhookSecret:c})}function Iy(e){let t=(e.workflows??[]).map(n=>{let r=pn(un,n);return Oy.parse(r)});return{preconditionApiPath:e.preconditionApiPath,workflows:t}}async function _y({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:i,webhookSecret:a}){let l=await G({label:"Spec executed",fn:()=>Xr({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:i.enqueueStep,runId:r,spec:o})});await Js({preconditionResult:n,webhookSecret:a}),await i.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 Js({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await no({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function Uy({config:e,workflowId:t}){let n=await U({config:e,document:Cy,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...pn(Ms,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},a=(o.workflows??[]).find(s=>pn(un,s).id===t);if(a==null)throw new Error(`Workflow ${t} not found`);let l=pn(un,a);return{project:o,workflow:l}}async function jy({config:e,profileId:t}){let n=await U({config:e,document:Ly,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),yr({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function $y(e){if(e==null)throw new Error("Workflow has no spec");return Mr.decode(e)}function By(){return Dy.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Vy(e,t){let n,r=new Promise((o,i)=>{n=setTimeout(()=>{i(new Error(`Run timed out after ${String(t)}ms`))},t)});try{await Promise.race([e,r])}finally{n!=null&&clearTimeout(n)}}var Ny,un,Ms,Cy,Ly,Oy,Dy,zs=m(()=>{"use strict";xs();gr();Ar();Rt();xr();Nt();Xt();Gr();Y();rt();oo();so();Ny=12e4,un=mn(`
132
133
  fragment WorkflowRun on Workflow {
133
134
  id
134
135
  slug
@@ -140,7 +141,7 @@ ${n}`].join(`
140
141
  preconditionName
141
142
  }
142
143
  }
143
- `),ls=Xt(`
144
+ `),Ms=mn(`
144
145
  fragment ProjectRun on Project {
145
146
  id
146
147
  baseUrl
@@ -149,13 +150,13 @@ ${n}`].join(`
149
150
  ...WorkflowRun
150
151
  }
151
152
  }
152
- `,[Jt]),Om=Xt(`
153
+ `,[un]),Cy=mn(`
153
154
  query ProjectRun($projectId: String!) {
154
155
  project(id: $projectId) {
155
156
  ...ProjectRun
156
157
  }
157
158
  }
158
- `,[ls]),Um=Xt(`
159
+ `,[Ms]),Ly=mn(`
159
160
  query AgentProfileRun($id: String!) {
160
161
  agentProfile(id: $id) {
161
162
  id
@@ -165,7 +166,13 @@ ${n}`].join(`
165
166
  successCriteria
166
167
  }
167
168
  }
168
- `);Dm=ge.object({preconditions:ge.array(ge.string()),requiresKeys:ge.array(ge.object({namespace:ge.string(),preconditionName:ge.string()})),slug:ge.string()});Mm=ge.coerce.number().int().positive().catch(Em)});var ye=g(()=>{"use strict";Pn();Jn();Hn();Zn();ar();at();Ui();$i();cr();st();Di();ds();Tr();Rr();Ve();K();We();_r();Pr();rt();$r();we()});import{z as bs}from"zod";function Kt(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return mt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return mt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return mt().RIPPLO_SERVER_URL;let r=jf[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function mt(){return Rs??=$f.parse(process.env),Rs}var Uf,_f,If,jf,$f,Rs,Yt=g(()=>{"use strict";Uf="https://ripplo.ai",_f="https://ripplo-dev.up.railway.app",If="https://localhost:3001",jf={dev:_f,local:If};$f=bs.object({RIPPLO_SERVER_URL:bs.string().min(1).default(Uf)})});import Es from"crypto";import Fr from"fs";import Os from"path";import{watch as uy}from"chokidar";import{graphql as my}from"gql.tada";async function Us(e){return hy(e)}function Mr({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let a=Os.join(t,fy),i=n,l="",s,c=!1,p=!1,u=uy(a,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(S,k)=>{if(k.endsWith(".ts")){if(c){p=!0;return}s!=null&&clearTimeout(s),s=setTimeout(()=>{m()},200)}}),u.on("error",S=>{let k=S instanceof Error?S.message:String(S);b.error("File watcher error: %s",k)});function d(){p=!1,s=setTimeout(()=>{m()},200)}async function m(){c=!0,p=!1;try{await h()}catch(S){let k=S instanceof Error?S.message:"Unknown error";b.error("Sync failed: %s",k),r(k)}finally{c=!1,p&&d()}}async function h(){let S=gy(a);if(S===l)return;l=S;let k=await V(t);if(!k.ok){r(k.error);return}await Ae({cwd:t,result:k.result});let A=Is(k.result),w=js(A);if(w===i)return;i=w;let P=await $s({config:e,payload:A});b.info("Dev session synced (%d test(s))",k.result.tests.length),o({devSessionId:P.devSessionId,hash:P.hash})}return function(){s!=null&&clearTimeout(s),u.close()}}function gy(e){let t=Es.createHash("sha256");return _s(t,e),t.digest("hex")}function _s(e,t){if(!Fr.existsSync(t))return;Fr.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Os.join(t,r.name);r.isDirectory()?_s(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(Fr.readFileSync(o)))})}function Is(e){return{preconditions:Object.entries(e.preconditions).map(([t,n])=>({depends:[...n.depends??[]],description:n.description,name:t,returns:[...n.returns??[]]})),workflows:e.tests.filter(t=>t.implemented).map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,preconditions:[...t.preconditions],requiresKeys:Object.entries(t.requiresKeys).map(([n,r])=>({namespace:n,preconditionName:r})),slug:t.slug,spec:JSON.stringify(t.spec)}))}}function js(e){return Es.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function hy(e){let t=await V(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Is(t.result);return b.info("Synced %d test(s) + graph to dev session",t.result.tests.length),$s({config:e.config,payload:n})}async function $s({config:e,payload:t}){let n=js(t),r=await q({config:e,document:yy,variables:{preconditions:t.preconditions.map(o=>({depends:[...o.depends],description:o.description,name:o.name,returns:[...o.returns]})),projectId:e.projectId,workflows:t.workflows.map(o=>({expectedOutcome:o.expectedOutcome,name:o.name,preconditions:[...o.preconditions],requiresKeys:o.requiresKeys.map(a=>({namespace:a.namespace,preconditionName:a.preconditionName})),slug:o.slug,spec:o.spec}))}});if(r.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:r.syncDevSession.id,hash:n}}function Ds(e){return!1}function Bs(e){return!1}var fy,yy,zr=g(()=>{"use strict";je();ye();fe();fy=".ripplo",yy=my(`
169
+ `);Oy=we.object({preconditions:we.array(we.string()),requiresKeys:we.array(we.object({namespace:we.string(),preconditionName:we.string()})),slug:we.string()});Dy=we.coerce.number().int().positive().catch(Ny)});var J=m(()=>{"use strict";Yn();fr();gr();Ar();Cr();Rt();gs();As();xr();Nt();ws();Ir();zs();Gr();zr();nt();Y();rt();oo();eo();wt();so();Ee()});import Wy from"fs";import qy from"path";async function Xs(e){let t=qy.join(e,".ripplo","index.ts");if(!Wy.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 O(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 co(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 Gs({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}}var Ks=m(()=>{"use strict";X()});import Lt from"fs";import Qs from"path";import{chromium as Fy}from"playwright";function Ys(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"preconditions-validation":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 fn(e){let t=await Jy(e),n=zy(e),r=Xy(),o=await O(e),i=Gy(o),a=Yy(o),l=await Hy(e,o),s=My(e),c=await Zy(t,o);return[t,n,...c,i,a,l,s,r]}async function Hy(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await Bt({cwd:e});return{status:Vt({compiled:t.result,existing:n}),type:"lockfile"}}function My(e){let t=Qs.join(e,".git","hooks","pre-commit");return Lt.existsSync(t)?{installed:Lt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Jy(e){let t=await Xs(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(r=>r.path).filter(r=>r.length>0),type:"settings",valid:!1}}function zy(e){let t=Qs.join(e,".ripplo",".local","token");return Lt.existsSync(t)?{exists:Lt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function Xy(){let e=Fy.executablePath();return{installed:Lt.existsSync(e),type:"browser"}}function Gy(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=Ky(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function Ky(e,t){let n=[],r=new Set(Object.keys(e));return Object.entries(e).forEach(([o,i])=>{(i.depends??[]).forEach(a=>{r.has(a)||n.push({message:`Depends on non-existent precondition "${a}"`,path:`preconditions.${o}.depends`})})}),t.forEach(o=>{Object.entries(o.requiresKeys).forEach(([i,a])=>{r.has(a)||n.push({message:`Test "${o.slug}" requires non-existent precondition "${a}" (as ${i})`,path:`tests.${o.slug}.requiresKeys.${i}`})})}),Qy(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function Qy(e){let t=new Set,n=new Set,r=[];function o(i){if(n.has(i)){r.push(`Precondition "${i}" has a circular dependency`);return}t.has(i)||(t.add(i),n.add(i),(e[i]?.depends??[]).forEach(a=>{o(a)}),n.delete(i))}return Object.keys(e).forEach(i=>{o(i)}),r}function Yy(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 Zy(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await co(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await eg(n,t);return r.push(...i),r}async function eg(e,t){let n=t.ok?Object.keys(t.result.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 i=rg(e.appUrl,e.preconditionsUrl);if(i==null)return[o];let a=await co(i)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:a,type:"preconditions"}),Zs(e.preconditionsUrl)&&l.push({reachable:a,type:"precondition-endpoint",url:i}),!a)return l;let s=await Gs({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await tg({preconditionUrl:i,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:i}),l}async function tg({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",...at({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 ng(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 Zs(e){return e.startsWith("http://")||e.startsWith("https://")}function rg(e,t){return Zs(t)?t:`${e}${t}`}function el(e){switch(e.type){case"settings":return ag(e);case"token":return sg(e);case"dev-server":return lg(e);case"preconditions":return pg(e);case"webhook-verification":return cg(e);case"preconditions-validation":return ug(e);case"workflows":return mg(e);case"browser":return dg(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 ng(e);case"lockfile":return og(e);case"pre-commit-hook":return ig(e)}}function og(e){switch(e.status){case"match":return`\u2713 Lockfile: ${ke} is up to date`;case"missing":return`\u2717 Lockfile: ${ke} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${ke} is out of date \u2014 run \`ripplo compile\` and commit it`}}function ig(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 ag(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function sg(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function lg(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 cg(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 dg(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function pg(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 ug(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"}
170
+ ${t.join(`
171
+ `)}`}function mg(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=>fg(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
172
+ ${t.join(`
173
+ `)}`}function fg(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
174
+ `+t.join(`
175
+ `)}var po=m(()=>{"use strict";J();xe();Ks();X()});import{z as il}from"zod";function $e(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return Pt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return Pt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return Pt().RIPPLO_SERVER_URL;let r=Pg[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function Pt(){return al??=xg.parse(process.env),al}var Cg,Lg,vg,Pg,xg,al,st=m(()=>{"use strict";Cg="https://ripplo.ai",Lg="https://ripplo-dev.up.railway.app",vg="https://localhost:3001",Pg={dev:Lg,local:vg};xg=il.object({RIPPLO_SERVER_URL:il.string().min(1).default(Cg)})});import Et from"fs";function Al(e){return Se(e,uh)}function wl(e){let t=Al(e);if(!Et.existsSync(t))return!1;let n=Et.statSync(t);return Date.now()-n.mtimeMs<=fh}function Sl(e){Me(e);let t=Al(e),n=new Date;Et.existsSync(t)?Et.utimesSync(t,n,n):Et.writeFileSync(t,"")}function bl(e){Sl(e);let t=setInterval(()=>{Sl(e)},mh);return()=>{clearInterval(t)}}var uh,mh,fh,ho=m(()=>{"use strict";J();uh="cli-heartbeat",mh=2e3,fh=1e4});var jl={};Go(jl,{redirectStdioToFile:()=>qh});import An from"fs";import Wh from"path";function qh(e){An.mkdirSync(Wh.dirname(e),{recursive:!0});let t=An.openSync(e,"a"),n=process.stdout.write.bind(process.stdout),r=process.stderr.write.bind(process.stderr);function o(l,s,c){let p=typeof s=="string"?s:void 0,u=typeof l=="string"?Buffer.from(l,p??"utf8"):Buffer.from(l);An.writeSync(t,u);let d=typeof s=="function"?s:c;return d?.(),!0}let i=o;process.stdout.write=i,process.stderr.write=i;let a=!1;return function(){a||(a=!0,process.stdout.write=n,process.stderr.write=r,An.closeSync(t))}}var $l=m(()=>{"use strict"});import Dl from"crypto";import Ao from"fs";import Bl from"path";import{watch as Fh}from"chokidar";import{graphql as Hh}from"gql.tada";async function Vl(e){return Xh(e)}function wo({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let i=Bl.join(t,Mh),a=n,l="",s,c=!1,p=!1,u=Fh(i,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(S,k)=>{if(k.endsWith(".ts")){if(c){p=!0;return}s!=null&&clearTimeout(s),s=setTimeout(()=>{f()},200)}}),u.on("error",S=>{let k=S instanceof Error?S.message:String(S);b.error("File watcher error: %s",k)});function d(){p=!1,s=setTimeout(()=>{f()},200)}async function f(){c=!0,p=!1;try{await h()}catch(S){let k=S instanceof Error?S.message:"Unknown error";b.error("Sync failed: %s",k),r(k)}finally{c=!1,p&&d()}}async function h(){let S=zh(i);if(S===l)return;l=S;let k=await O(t);if(!k.ok){r(k.error);return}await pe({cwd:t,result:k.result});let A=ql(k.result),w=Fl(A);if(w===a)return;a=w;let L=await Hl({config:e,payload:A});b.info("Dev session synced (%d test(s))",k.result.tests.length),o({devSessionId:L.devSessionId,hash:L.hash})}return function(){s!=null&&clearTimeout(s),u.close()}}function zh(e){let t=Dl.createHash("sha256");return Wl(t,e),t.digest("hex")}function Wl(e,t){if(!Ao.existsSync(t))return;Ao.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Bl.join(t,r.name);r.isDirectory()?Wl(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(Ao.readFileSync(o)))})}function ql(e){return{preconditions:Object.entries(e.preconditions).map(([t,n])=>({depends:[...n.depends??[]],description:n.description,name:t,returns:[...n.returns??[]]})),workflows:e.tests.map(t=>({expectedOutcome:t.expectedOutcome,name:t.name,preconditions:[...t.preconditions],requiresKeys:Object.entries(t.requiresKeys).map(([n,r])=>({namespace:n,preconditionName:r})),slug:t.slug,spec:t.implemented?JSON.stringify(t.spec):null}))}}function Fl(e){return Dl.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Xh(e){let t=await O(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=ql(t.result);return b.info("Synced %d test(s) + graph to dev session",t.result.tests.length),Hl({config:e.config,payload:n})}async function Hl({config:e,payload:t}){let n=Fl(t),r=await U({config:e,document:Jh,variables:{preconditions:t.preconditions.map(o=>({depends:[...o.depends],description:o.description,name:o.name,returns:[...o.returns]})),projectId:e.projectId,workflows:t.workflows.map(o=>({expectedOutcome:o.expectedOutcome,name:o.name,preconditions:[...o.preconditions],requiresKeys:o.requiresKeys.map(i=>({namespace:i.namespace,preconditionName:i.preconditionName})),slug:o.slug,spec:o.spec??null}))}});if(r.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:r.syncDevSession.id,hash:n}}function Ml(e){return!1}function Jl(e){return!1}var Mh,Jh,bo=m(()=>{"use strict";xe();J();X();Mh=".ripplo",Jh=Hh(`
169
176
  mutation SyncDevSession(
170
177
  $projectId: String!
171
178
  $preconditions: [SyncDevPreconditionInput!]!
@@ -175,7 +182,7 @@ ${n}`].join(`
175
182
  id
176
183
  }
177
184
  }
178
- `)});import{useCallback as ky,useEffect as en,useRef as Sy,useState as Ay}from"react";import{availableParallelism as Vs}from"os";import{useSubscription as Jr}from"urql";import{graphql as nn}from"gql.tada";async function Ws(){await(await tn).closeAll()}function qs({config:e,cwd:t,devSessionId:n}){let[r,o]=Ay({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:Vs()}),a=e,i=Sy(new Set);en(()=>{tn.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=ky(s=>{Fs({activeRunIds:i.current,baseUrl:a.appUrl,config:a,setState:o,...s})},[a]);return en(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),Jr({pause:n==null,query:wy},(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}),Jr({pause:n==null,query:Ry,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&Ds({cwd:t,slug:p}),c}),Jr({pause:n==null,query:Ny,variables:{projectId:a.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&Bs({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),en(()=>{if(n==null)return;let s=new AbortController;return Ly({activeConfig:a,activeRunIds:i.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[a,n]),en(()=>()=>{tn.then(s=>s.closeAll())},[]),r}function Fs({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}))}Cy({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:a,runId:i,workflowId:s,workflowSlug:c}).finally(p)}async function Ly({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(a=>{let i=setTimeout(a,Ty);o.addEventListener("abort",()=>{clearTimeout(i),a()},{once:!0})}),o.aborted)return;try{(await q({config:e,document:by,variables:{devSessionId:n}})).pendingDevRuns?.filter(i=>!t.has(i.id)).forEach(i=>{let l=i.workflow?.id;l!=null&&Fs({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 Cy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:a,workflowId:i,workflowSlug:l}){let s=await tn,c=await s.acquire();try{await sr({maxRuns:100});let p=o!=null&&l!=null?await vy({cwd:o,workflowSlug:l}):void 0;await Dr({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 vy({cwd:e,workflowSlug:t}){let n=await V(e);if(!n.ok)return;let r=n.result.tests.find(o=>o.slug===t);if(r!=null)return r.preconditions}var wy,by,Ry,Ny,tn,Ty,Xr=g(()=>{"use strict";ye();fe();zr();wy=nn(`
185
+ `)});import{useCallback as Gh,useEffect as wn,useRef as Kh,useState as Qh}from"react";import{availableParallelism as zl}from"os";import{useSubscription as Ro}from"urql";import{graphql as Rn}from"gql.tada";async function Xl(){await(await bn).closeAll()}function Gl({config:e,cwd:t,devSessionId:n}){let[r,o]=Qh({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:zl()}),i=e,a=Kh(new Set);wn(()=>{bn.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=Gh(s=>{Kl({activeRunIds:a.current,baseUrl:i.appUrl,config:i,setState:o,...s})},[i]);return wn(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),Ro({pause:n==null,query:Yh},(s,c)=>{let p=c.runRequested;return p!=null&&l({agentProfileDescription:p.agentProfileDescription??void 0,agentProfileId:p.agentProfileId??void 0,cwd:t,runId:p.runId,workflowId:p.workflowId,workflowSlug:p.workflowSlug}),c}),Ro({pause:n==null,query:ek,variables:{projectId:i.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&Ml({cwd:t,slug:p}),c}),Ro({pause:n==null,query:tk,variables:{projectId:i.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&Jl({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),wn(()=>{if(n==null)return;let s=new AbortController;return rk({activeConfig:i,activeRunIds:a.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[i,n]),wn(()=>()=>{bn.then(s=>s.closeAll())},[]),r}function Kl({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,setState:l,workflowId:s,workflowSlug:c}){if(e.has(a))return;e.add(a),l(u=>({...u,activeRunCount:e.size}));function p(){e.delete(a),l(u=>({...u,activeRunCount:e.size}))}ok({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,workflowId:s,workflowSlug:c}).finally(p)}async function rk({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(i=>{let a=setTimeout(i,nk);o.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})}),o.aborted)return;try{(await U({config:e,document:Zh,variables:{devSessionId:n}})).pendingDevRuns?.filter(a=>!t.has(a.id)).forEach(a=>{let l=a.workflow?.id;l!=null&&Kl({activeRunIds:t,agentProfileDescription:a.agentProfile?.description??void 0,agentProfileId:a.agentProfile?.id??void 0,baseUrl:e.appUrl,config:e,cwd:void 0,runId:a.id,setState:r,workflowId:l,workflowSlug:void 0})})}catch(i){b.error(i,"Runner error")}}}async function ok({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:i,workflowId:a,workflowSlug:l}){let s=await bn,c=await s.acquire();try{await vr({maxRuns:100});let p=o!=null&&l!=null?await ik({cwd:o,workflowSlug:l}):void 0;await lo({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:c,config:r,headed:!1,preconditionNames:p,runId:i,webhookSecret:r.webhookSecret,workflowId:a})}catch(p){b.error(p,"Runner error")}finally{s.release(c)}}async function ik({cwd:e,workflowSlug:t}){let n=await O(e);if(!n.ok)return;let r=n.result.tests.find(o=>o.slug===t);if(r!=null)return r.preconditions}var Yh,Zh,ek,tk,bn,nk,To=m(()=>{"use strict";J();X();bo();Yh=Rn(`
179
186
  subscription RunRequestedDashboard {
180
187
  runRequested {
181
188
  agentProfileDescription
@@ -186,7 +193,7 @@ ${n}`].join(`
186
193
  workflowSlug
187
194
  }
188
195
  }
189
- `),by=nn(`
196
+ `),Zh=Rn(`
190
197
  query PendingDevRunsDashboard($devSessionId: String!) {
191
198
  pendingDevRuns(devSessionId: $devSessionId) {
192
199
  id
@@ -199,14 +206,14 @@ ${n}`].join(`
199
206
  }
200
207
  }
201
208
  }
202
- `),Ry=nn(`
209
+ `),ek=Rn(`
203
210
  subscription DevWorkflowDeleteDashboard($projectId: String!) {
204
211
  devWorkflowDeleteRequested(projectId: $projectId) {
205
212
  projectId
206
213
  slug
207
214
  }
208
215
  }
209
- `),Ny=nn(`
216
+ `),tk=Rn(`
210
217
  subscription DevWorkflowDuplicateDashboard($projectId: String!) {
211
218
  devWorkflowDuplicateRequested(projectId: $projectId) {
212
219
  projectId
@@ -214,7 +221,7 @@ ${n}`].join(`
214
221
  newSlug
215
222
  }
216
223
  }
217
- `),tn=ir({headed:!1,size:Vs()});Ty=5e3});import{initGraphQLTada as xy}from"gql.tada";import{readFragment as zN}from"gql.tada";var Ms,zs=g(()=>{"use strict";Ms=xy()});var Hr,Gr=g(()=>{"use strict";Hr={__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:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",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:"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:"preconditions",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:"workflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"trackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"untrackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"output",type:{kind:"SCALAR",name:"Any"}},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"cloudBaseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"preconditionApiPath",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateUsername",type:{kind:"OBJECT",name:"User",ofType:null},args:[{name:"username",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"baseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"}},{name:"expectedOutcome",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"status",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"Organization",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationLimitStatus",fields:[{name:"agentCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"agentLimitPerProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateAgent",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canInviteMember",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"planName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimitReached",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetExceeded",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationUsage",fields:[{name:"overageCapCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"overageSpentCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodStart",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OtherPaymentMethod",fields:[{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"UNION",name:"PaymentMethod",possibleTypes:[{kind:"OBJECT",name:"BankPaymentMethod"},{kind:"OBJECT",name:"CardPaymentMethod"},{kind:"OBJECT",name:"LinkPaymentMethod"},{kind:"OBJECT",name:"OtherPaymentMethod"}]},{kind:"OBJECT",name:"Plan",fields:[{name:"annualPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limits",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"PlanLimits",ofType:null}},args:[]},{name:"monthlyPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"PlanLimits",fields:[{name:"historyDays",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxAgents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxProjects",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxUsers",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runOverageCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"scheduling",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Precondition",fields:[{name:"depends",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"description",type:{kind:"NON_NULL",ofType:{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:"returns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{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:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]},{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:"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:"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:"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:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[]},{name:"snapshots",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"BranchSnapshot",ofType:null}}},args:[]},{name:"syncedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"User",fields:[{name:"email",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"image",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"username",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Workflow",fields:[{name:"additionalChecks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"agentProfiles",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}}},args:[]},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"expectedOutcome",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"latestRuns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"requiresKeys",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"WorkflowRequiresKey",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:"OBJECT",name:"WorkflowRequiresKey",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"namespace",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditionName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"SCALAR",name:"Any"}],directives:[]}}});function $(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function ie(e,t,n){e.invalidate({__typename:t,id:n})}function Kr({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 Ey(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Kr({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ie(e,"RunResult",r)}function Oy(e,t){t.runId!=null&&e.writeFragment(Js,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function Uy(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null,r=e.status==="completed"||e.status==="failed";Oy(t,e),r&&e.runId!=null&&ie(t,"Run",e.runId),n&&($(t,"run"),$(t,"projectRuns")),e.workflowId!=null&&e.runId!=null&&Kr({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function _y(){return{cancelAllPendingRuns(e,t,n){$(n,"workflows"),$(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&ie(n,"Run",r)},cloneAgentTemplate(e,t,n){$(n,"agentProfiles")},createAgentProfile(e,t,n){$(n,"agentProfiles")},createRun(e,t,n){$(n,"run"),$(n,"runs"),$(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(Js,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Kr({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&ie(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&ie(n,"Workflow",r),$(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ie(n,"Project",r),$(n,"projects")},duplicateDevWorkflow(e,t,n){$(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ie(n,"DevSession",r)},runAllWorkflows(e,t,n){$(n,"runs"),$(n,"projectRuns")},setOverageCap(e,t,n){$(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&ie(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ie(n,"User",r),$(n,"currentUser")}}}function Yr(){return{keys:Py,schema:Hr,updates:{Mutation:_y(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ie(n,"Project",r.projectId),r?.active===!1&&($(n,"workflows"),$(n,"workflow"),$(n,"runs"),$(n,"run"),$(n,"projectRuns"))},devSessionSynced(e,t,n){$(n,"workflow"),$(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&Uy(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&Ey(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&ie(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&ie(n,"Run",r.run.id)}}}}}var Py,Js,Xs=g(()=>{"use strict";zs();Gr();Py={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,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,Precondition:e=>e.id??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,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,WorkflowRequiresKey:e=>e.id??null};Js=Ms(`
224
+ `),bn=Lr({headed:!1,size:zl()});nk=5e3});import{initGraphQLTada as ak}from"gql.tada";import{readFragment as dx}from"gql.tada";var No,Ql=m(()=>{"use strict";No=ak()});var Co,Lo=m(()=>{"use strict";Co={__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:"healthChecks",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"HealthCheck",ofType:null}}},args:[]},{name:"hooksPaused",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[]},{name:"scopeItems",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"ScopeItem",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:[{name:"where",type:{kind:"SCALAR",name:"Any"}}]}],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:"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:"HealthCheck",fields:[{name:"detail",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tone",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"type",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:"HealthChecksChangedEvent",fields:[{name:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"userId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"HooksPausedRequestedEvent",fields:[{name:"paused",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:"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:"addScopeItem",type:{kind:"OBJECT",name:"ScopeItem",ofType:null},args:[{name:"label",type:{kind:"SCALAR",name:"Any"}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"source",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowId",type:{kind:"SCALAR",name:"Any"}}]},{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:"linkScopeItem",type:{kind:"OBJECT",name:"ScopeItem",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"pushHealthChecks",type:{kind:"SCALAR",name:"Any"},args:[{name:"checks",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:"removeGitHubInstallation",type:{kind:"OBJECT",name:"GitHubInstallation",ofType:null},args:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"removeScopeItem",type:{kind:"SCALAR",name:"Any"},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:"setHooksPaused",type:{kind:"SCALAR",name:"Any"},args:[{name:"paused",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",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:"preconditions",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:"workflows",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{name:"trackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"untrackBranch",type:{kind:"OBJECT",name:"TrackedBranch",ofType:null},args:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateAgentProfile",type:{kind:"OBJECT",name:"AgentProfile",ofType:null},args:[{name:"description",type:{kind:"SCALAR",name:"Any"}},{name:"icon",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"output",type:{kind:"SCALAR",name:"Any"}},{name:"successCriteria",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateProject",type:{kind:"OBJECT",name:"Project",ofType:null},args:[{name:"cloudBaseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"logoUrl",type:{kind:"SCALAR",name:"Any"}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"preconditionApiPath",type:{kind:"SCALAR",name:"Any"}}]},{name:"updateUsername",type:{kind:"OBJECT",name:"User",ofType:null},args:[{name:"username",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"updateWorkflow",type:{kind:"OBJECT",name:"Workflow",ofType:null},args:[{name:"baseUrl",type:{kind:"SCALAR",name:"Any"}},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"}},{name:"expectedOutcome",type:{kind:"SCALAR",name:"Any"}},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"name",type:{kind:"SCALAR",name:"Any"}},{name:"status",type:{kind:"SCALAR",name:"Any"}}]}],interfaces:[]},{kind:"OBJECT",name:"Organization",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limitStatus",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"OrganizationLimitStatus",ofType:null}},args:[{name:"projectId",type:{kind:"SCALAR",name:"Any"}}]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationLimitStatus",fields:[{name:"agentCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"agentLimitPerProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateAgent",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canCreateProject",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"canInviteMember",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"memberLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"planName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"projectLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimitReached",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetExceeded",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OrganizationUsage",fields:[{name:"overageCapCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"overageSpentCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodEnd",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"periodStart",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runLimit",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"tokenUsagePercent",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"OtherPaymentMethod",fields:[{name:"type",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"UNION",name:"PaymentMethod",possibleTypes:[{kind:"OBJECT",name:"BankPaymentMethod"},{kind:"OBJECT",name:"CardPaymentMethod"},{kind:"OBJECT",name:"LinkPaymentMethod"},{kind:"OBJECT",name:"OtherPaymentMethod"}]},{kind:"OBJECT",name:"Plan",fields:[{name:"annualPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"limits",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"PlanLimits",ofType:null}},args:[]},{name:"monthlyPrice",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"PlanLimits",fields:[{name:"historyDays",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxAgents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxProjects",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxRuns",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"maxUsers",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"runOverageCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"scheduling",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"tokenBudgetCents",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Precondition",fields:[{name:"depends",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"description",type:{kind:"NON_NULL",ofType:{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:"returns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{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:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[{name:"branch",type:{kind:"SCALAR",name:"Any"}}]},{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:"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:"completedAt",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:"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:"ScopeChangedEvent",fields:[{name:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"userId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"ScopeItem",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:"label",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"source",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflow",type:{kind:"OBJECT",name:"Workflow",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:"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:"healthChecksChanged",type:{kind:"OBJECT",name:"HealthChecksChangedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]},{name:"hooksPausedRequested",type:{kind:"OBJECT",name:"HooksPausedRequestedEvent",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:[]},{name:"scopeChanged",type:{kind:"OBJECT",name:"ScopeChangedEvent",ofType:null},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}]}],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:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[]},{name:"snapshots",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"BranchSnapshot",ofType:null}}},args:[]},{name:"syncedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"User",fields:[{name:"email",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"image",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"username",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Workflow",fields:[{name:"additionalChecks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"agentProfiles",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}}},args:[]},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"expectedOutcome",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"latestRuns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"requiresKeys",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"WorkflowRequiresKey",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:"OBJECT",name:"WorkflowRequiresKey",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"namespace",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditionName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"SCALAR",name:"Any"}],directives:[]}}});function B(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function ce(e,t,n){e.invalidate({__typename:t,id:n})}function lk({argMatches:e,cache:t,childKey:n,fieldName:r}){t.inspectFields("Query").filter(o=>o.fieldName===r&&e(o.arguments??null)).forEach(o=>{let i=t.resolve("Query",o.fieldName,o.arguments);if(!Array.isArray(i))return;let a=i.map(l=>typeof l=="string"?l:null);a.includes(n)||t.link("Query",o.fieldName,o.arguments,[n,...a])})}function vo({cache:e,childId:t,childTypeName:n,fieldName:r,parentId:o,parentTypeName:i}){let a=e.keyOfEntity({__typename:i,id:o});if(a==null)return!1;let l=e.keyOfEntity({__typename:n,id:t});if(l==null)return!1;let s=e.resolve(a,r);if(!Array.isArray(s))return!1;let c=s.map(p=>typeof p=="string"?p:null);return c.includes(l)||e.link(a,r,void 0,[...c,l]),!0}function ck(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;vo({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ce(e,"RunResult",r)}function Po(e){return e==="completed"||e==="failed"}function dk(e,t){if(t.runId==null)return;let n=Po(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(Yl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function Zl(e,t){e.invalidate({__typename:"Run",id:t},"results")}function pk(e,t){e.workflowId==null||e.runId==null||vo({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function uk(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;dk(t,e),Po(e.status)&&e.runId!=null&&Zl(t,e.runId),n&&(B(t,"run"),mk(t,e)),pk(e,t)}function mk(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){B(e,"projectRuns");return}lk({cache:e,childKey:n,fieldName:"projectRuns",argMatches:r=>{if(r?.cursor!=null)return!1;let i=r?.projectId;return!(typeof i=="string"&&i!==t.workflowId)}}),B(e,"projectRuns")}function fk(e,t,n){let r=e.keyOfEntity({__typename:"Project",id:t});if(r==null)return;let o=e.resolve(r,"devSession");if(typeof o!="string")return;let i=e.resolve(o,"scopeItems");if(!Array.isArray(i))return;let a=i.flatMap(s=>typeof s=="string"?[s]:[]),l=e.keyOfEntity({__typename:"ScopeItem",id:n});l==null||a.includes(l)||e.link(o,"scopeItems",void 0,[...a,{__typename:"ScopeItem",id:n}])}function gk(e,t){e.inspectFields("Query").filter(n=>n.fieldName==="project").forEach(n=>{let r=e.resolve("Query",n.fieldName,n.arguments);if(typeof r!="string")return;let o=e.resolve(r,"devSession");typeof o=="string"&&e.writeFragment(yk,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function hk(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&fk(n,t.projectId,r)},cancelAllPendingRuns(e,t,n){B(n,"workflows"),B(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&ce(n,"Run",r)},cloneAgentTemplate(e,t,n){B(n,"agentProfiles")},createAgentProfile(e,t,n){B(n,"agentProfiles")},createRun(e,t,n){B(n,"run"),B(n,"runs"),B(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(Yl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),vo({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&ce(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&ce(n,"Workflow",r),B(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ce(n,"Project",r),B(n,"projects")},duplicateDevWorkflow(e,t,n){B(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ce(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&ce(n,"ScopeItem",r)},removeScopeItem(e,t,n){ce(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){B(n,"runs"),B(n,"projectRuns")},setHooksPaused(e,t,n){gk(n,t.paused)},setOverageCap(e,t,n){B(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&ce(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ce(n,"User",r),B(n,"currentUser")}}}function xo(){return{keys:sk,optimistic:{addScopeItem:e=>({__typename:"ScopeItem",createdAt:new Date().toISOString(),id:`optimistic_${String(Date.now())}`,label:e.label??null,source:e.source,workflow:null}),removeScopeItem:()=>!0},schema:Co,updates:{Mutation:hk(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ce(n,"Project",r.projectId),r?.active===!1&&(B(n,"workflows"),B(n,"workflow"),B(n,"runs"),B(n,"run"),B(n,"projectRuns"))},devSessionSynced(e,t,n){B(n,"workflow"),B(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&uk(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&ck(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&ce(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&Po(r.run.status)&&Zl(n,r.run.id)}}}}}var sk,Yl,yk,ec=m(()=>{"use strict";Ql();Lo();sk={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,GitHubInstallation:e=>e.id??null,GithubRepository:()=>null,HealthCheck:e=>e.id??null,HealthChecksChangedEvent:()=>null,HooksPausedRequestedEvent:()=>null,Invoice:e=>e.id??null,LinkPaymentMethod:()=>null,Organization:e=>e.id??null,OrganizationLimitStatus:()=>null,OrganizationUsage:()=>null,OtherPaymentMethod:()=>null,Plan:()=>null,PlanLimits:()=>null,Precondition:e=>e.id??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,ScopeChangedEvent:()=>null,ScopeItem:e=>e.id??null,ScreenAnnotation:e=>e.id??null,SideEffect: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,WorkflowRequiresKey:e=>e.id??null};Yl=No(`
218
225
  fragment RunCache on Run {
219
226
  id
220
227
  status
@@ -224,7 +231,12 @@ ${n}`].join(`
224
231
  id
225
232
  }
226
233
  }
227
- `)});var Hs=g(()=>{"use strict";Xs();Gr()});import{Client as Iy,fetchExchange as jy,subscriptionExchange as $y}from"urql";import{cacheExchange as Dy}from"@urql/exchange-graphcache";import{createClient as By}from"graphql-sse";function Qr({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=By({headers:n,retryAttempts:1/0,url:t});return new Iy({exchanges:[Dy(Yr()),$y({forwardSubscription:o=>({subscribe:a=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},a)}})}),jy],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var Gs=g(()=>{"use strict";Hs()});import{Box as Ks,Text as D,useInput as Vy}from"ink";import{jsx as J,jsxs as he}from"react/jsx-runtime";function Zr({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Vy((o,a)=>{a.return&&!n&&r()}),t!=null?he(Ks,{flexDirection:"column",gap:1,children:[he(D,{children:[J(D,{color:"red",children:" \u2717 "}),J(D,{children:t})]}),he(D,{children:[J(D,{color:"cyan",children:" \u2192 "}),J(D,{children:"Press "}),J(D,{bold:!0,children:"Enter"}),J(D,{children:" to try again"})]})]}):e!=null?he(Ks,{flexDirection:"column",gap:1,paddingLeft:2,children:[he(D,{children:[J(D,{color:"yellow",children:"* "}),J(D,{children:"Your code: "}),J(D,{bold:!0,color:"white",children:e.userCode})]}),he(D,{children:[J(D,{color:"yellow",children:"* "}),J(D,{children:"Waiting for browser authorization..."})]}),he(D,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?he(D,{children:[J(D,{color:"yellow",children:" * "}),J(D,{children:"Opening browser..."})]}):he(D,{children:[J(D,{color:"cyan",children:" \u2192 "}),J(D,{children:"Press "}),J(D,{bold:!0,children:"Enter"}),J(D,{children:" to open browser for authentication"})]})}var Ys=g(()=>{"use strict"});import{useState as Wy}from"react";import{Box as qy,Text as rn,useInput as Fy}from"ink";import{jsx as on,jsxs as My}from"react/jsx-runtime";function Qs({items:e,onSelect:t}){let[n,r]=Wy(0);return Fy((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)}}),on(qy,{flexDirection:"column",children:e.map((o,a)=>My(rn,{children:[a===n?on(rn,{color:"cyan",children:"> "}):on(rn,{children:" "}),on(rn,{bold:a===n,children:o.label})]},o.value))})}var Zs=g(()=>{"use strict"});import{Box as zy,Text as Ce,useInput as Jy}from"ink";import{jsx as Je,jsxs as eo}from"react/jsx-runtime";function el({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Jy((r,o)=>{o.return&&e()}),eo(zy,{flexDirection:"column",children:[eo(Ce,{children:[Je(Ce,{color:"cyan",children:" \u2192 "}),Je(Ce,{children:"No projects found. Create one at: "}),Je(Ce,{bold:!0,color:"cyan",children:n})]}),eo(Ce,{children:[" ",Je(Ce,{dimColor:!0,children:"Press "}),Je(Ce,{bold:!0,children:"Enter"}),Je(Ce,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var tl=g(()=>{"use strict"});import{useEffect as Xy,useMemo as Hy,useRef as Gy}from"react";import{Box as nl,Text as Ee}from"ink";import{useQuery as Ky}from"urql";import{graphql as Yy}from"gql.tada";import{jsx as Oe,jsxs as an}from"react/jsx-runtime";function rl({selectProject:e,serverUrl:t}){let[n,r]=Ky({query:Qy}),o=Gy(!1),a=Hy(()=>n.data?.projects??[],[n.data?.projects]);if(Xy(()=>{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 an(Ee,{children:[Oe(Ee,{color:"yellow",children:" * "}),Oe(Ee,{children:"Loading projects..."})]});if(n.error!=null)return an(Ee,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(a.length===0)return Oe(el,{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 an(nl,{flexDirection:"column",children:[an(Ee,{children:[Oe(Ee,{color:"cyan",children:" \u2192 "}),Oe(Ee,{children:"Select a project:"})]}),Oe(nl,{marginLeft:4,marginTop:1,children:Oe(Qs,{items:i,onSelect:l})})]})}var Qy,ol=g(()=>{"use strict";Zs();tl();Qy=Yy(`
234
+ `);yk=No(`
235
+ fragment HooksPausedPatch on DevSession {
236
+ id
237
+ hooksPaused
238
+ }
239
+ `)});var tc=m(()=>{"use strict";ec();Lo()});import{Client as kk,fetchExchange as Sk,subscriptionExchange as Ak}from"urql";import{cacheExchange as wk}from"@urql/exchange-graphcache";import{createClient as bk}from"graphql-sse";function nc({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=bk({headers:n,retryAttempts:1/0,url:t});return new kk({exchanges:[wk(xo()),Ak({forwardSubscription:o=>({subscribe:i=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},i)}})}),Sk],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var rc=m(()=>{"use strict";tc()});import{Box as oc,Text as V,useInput as Rk}from"ink";import{jsx as z,jsxs as Ce}from"react/jsx-runtime";function ic({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Rk((o,i)=>{i.return&&!n&&r()}),t!=null?Ce(oc,{flexDirection:"column",gap:1,children:[Ce(V,{children:[z(V,{color:"red",children:" \u2717 "}),z(V,{children:t})]}),Ce(V,{children:[z(V,{color:"cyan",children:" \u2192 "}),z(V,{children:"Press "}),z(V,{bold:!0,children:"Enter"}),z(V,{children:" to try again"})]})]}):e!=null?Ce(oc,{flexDirection:"column",gap:1,paddingLeft:2,children:[Ce(V,{children:[z(V,{color:"yellow",children:"* "}),z(V,{children:"Your code: "}),z(V,{bold:!0,color:"white",children:e.userCode})]}),Ce(V,{children:[z(V,{color:"yellow",children:"* "}),z(V,{children:"Waiting for browser authorization..."})]}),Ce(V,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?Ce(V,{children:[z(V,{color:"yellow",children:" * "}),z(V,{children:"Opening browser..."})]}):Ce(V,{children:[z(V,{color:"cyan",children:" \u2192 "}),z(V,{children:"Press "}),z(V,{bold:!0,children:"Enter"}),z(V,{children:" to open browser for authentication"})]})}var ac=m(()=>{"use strict"});import{useState as Tk}from"react";import{Box as Nk,Text as Tn,useInput as Ck}from"ink";import{jsx as Nn,jsxs as Lk}from"react/jsx-runtime";function sc({items:e,onSelect:t}){let[n,r]=Tk(0);return Ck((o,i)=>{if(i.upArrow&&r(a=>Math.max(0,a-1)),i.downArrow&&r(a=>Math.min(e.length-1,a+1)),i.return){let a=e[n];a!=null&&t(a.value)}}),Nn(Nk,{flexDirection:"column",children:e.map((o,i)=>Lk(Tn,{children:[i===n?Nn(Tn,{color:"cyan",children:"> "}):Nn(Tn,{children:" "}),Nn(Tn,{bold:i===n,children:o.label})]},o.value))})}var lc=m(()=>{"use strict"});import{Box as vk,Text as De,useInput as Pk}from"ink";import{jsx as dt,jsxs as Eo}from"react/jsx-runtime";function cc({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Pk((r,o)=>{o.return&&e()}),Eo(vk,{flexDirection:"column",children:[Eo(De,{children:[dt(De,{color:"cyan",children:" \u2192 "}),dt(De,{children:"No projects found. Create one at: "}),dt(De,{bold:!0,color:"cyan",children:n})]}),Eo(De,{children:[" ",dt(De,{dimColor:!0,children:"Press "}),dt(De,{bold:!0,children:"Enter"}),dt(De,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var dc=m(()=>{"use strict"});import{useEffect as xk,useMemo as Ek,useRef as Ok}from"react";import{Box as pc,Text as ze}from"ink";import{useQuery as Ik}from"urql";import{graphql as _k}from"gql.tada";import{jsx as Xe,jsxs as Cn}from"react/jsx-runtime";function uc({selectProject:e,serverUrl:t}){let[n,r]=Ik({query:Uk}),o=Ok(!1),i=Ek(()=>n.data?.projects??[],[n.data?.projects]);if(xk(()=>{let s=i[0];i.length===1&&s!=null&&(s.workflows?.length??0)===0&&!o.current&&(o.current=!0,e({id:s.id,name:s.name}))},[i,e]),n.fetching)return Cn(ze,{children:[Xe(ze,{color:"yellow",children:" * "}),Xe(ze,{children:"Loading projects..."})]});if(n.error!=null)return Cn(ze,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(i.length===0)return Xe(cc,{reexecute:r,serverUrl:t});let a=i.map(s=>({label:s.name,value:s.id}));function l(s){let c=i.find(p=>p.id===s);c!=null&&e({id:c.id,name:c.name})}return Cn(pc,{flexDirection:"column",children:[Cn(ze,{children:[Xe(ze,{color:"cyan",children:" \u2192 "}),Xe(ze,{children:"Select a project:"})]}),Xe(pc,{marginLeft:4,marginTop:1,children:Xe(sc,{items:a,onSelect:l})})]})}var Uk,mc=m(()=>{"use strict";lc();dc();Uk=_k(`
228
240
  query SetupProjectSelect {
229
241
  projects {
230
242
  id
@@ -234,11 +246,77 @@ ${n}`].join(`
234
246
  }
235
247
  }
236
248
  }
237
- `)});import{Box as yt,Text as se,useInput as Zy}from"ink";import eg from"ink-spinner";import{jsx as ke,jsxs as pe}from"react/jsx-runtime";function to({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:a,stage:i}){return Zy((l,s)=>{i==="scaffolding-warnings"&&s.return&&n()}),pe(yt,{flexDirection:"column",padding:1,children:[pe(se,{bold:!0,children:[" ","ripplo setup"]}),ke(se,{children:""}),pe(se,{children:[ke(se,{color:"green",children:" \u2713 "}),ke(se,{children:"Authenticated"})]}),tg({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:a,stage:i}),t==null?null:ke(yt,{marginTop:1,children:pe(se,{color:"red",children:[" ","Error: ",t]})})]})}function tg({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?pe(se,{children:[pe(se,{color:"cyan",children:[" ",ke(eg,{type:"dots"})]}),pe(se,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?pe(yt,{flexDirection:"column",marginTop:1,children:[ke(se,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((a,i)=>pe(yt,{flexDirection:"column",marginTop:1,children:[pe(se,{children:[" ",a.message]}),a.manualCommand==null?null:pe(se,{color:"cyan",children:[" $ ",a.manualCommand]})]},i)),ke(yt,{marginTop:1,children:ke(se,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):ke(rl,{selectProject:r,serverUrl:e.ripploServerUrl})}var al=g(()=>{"use strict";ol()});import{useEffect as ng,useState as rg}from"react";function Xe(){let[e,t]=rg(il);return ng(()=>{function n(){t(il())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function il(){return{height:process.stdout.rows,width:process.stdout.columns}}var sn=g(()=>{"use strict"});import{useEffect as og,useRef as ag,useState as ig}from"react";function sl({config:e,cwd:t}){let[n,r]=ig({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=ag(void 0);return og(()=>{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 Us({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=Mr({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=Mr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var ll=g(()=>{"use strict";zr()});import IT from"chalk";import{z as cl}from"zod";async function dl(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${sg}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return lg.parse(r).version}catch{return}finally{clearTimeout(t)}}var no,sg,lg,pl=g(()=>{"use strict";ye();no="0.1.10",sg="ripplo",lg=cl.object({version:cl.string()})});import{useEffect as cg,useState as dg}from"react";import{Text as Ue}from"ink";import{jsx as He,jsxs as fg}from"react/jsx-runtime";function ul({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=mg(),l=i!=null&&i!==no,s=pg({connected:n,syncError:o}),c=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${no}`,d=l?` \u2192 v${i}`:"",m="q to quit",h=` ripplo ${u}${d} | ${r} ${s}${c}${p}`,S=Math.max(0,a-h.length-m.length-1);return fg(Ue,{inverse:!0,children:[He(Ue,{bold:!0,children:" ripplo "}),He(Ue,{dimColor:!0,children:u}),l?He(Ue,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,He(Ue,{color:ug({connected:n,syncError:o}),children:s}),t?null:He(Ue,{color:"yellow",children:c}),p," ".repeat(S),He(Ue,{dimColor:!0,children:m})," "]})}function pg({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function ug({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function mg(){let[e,t]=dg();return cg(()=>{dl().then(n=>{n!=null&&t(n)})},[]),e}var ml=g(()=>{"use strict";pl()});import{Box as ln,Text as gt,useApp as yg,useInput as gg}from"ink";import{jsx as Ge,jsxs as cn}from"react/jsx-runtime";function fl({config:e,cwd:t}){let n=yg(),{height:r,width:o}=Xe(),{config:a,devSessionId:i,syncError:l}=sl({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=qs({config:a,cwd:t,devSessionId:i});gg(d=>{d==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return cn(ln,{flexDirection:"column",height:r,width:o,children:[Ge(ul,{activeRunCount:s,browsersReady:c,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),cn(ln,{flexDirection:"column",flexGrow:1,padding:1,children:[cn(ln,{children:[Ge(gt,{children:"Developer dashboard: "}),Ge(gt,{color:"cyan",children:u})]}),cn(ln,{marginTop:1,children:[Ge(gt,{dimColor:!0,children:"Run "}),Ge(gt,{color:"yellow",children:"ripplo doctor"}),Ge(gt,{dimColor:!0,children:" for health checks"})]})]})]})}var yl=g(()=>{"use strict";sn();ll();Xr();ml()});import{Text as gl}from"ink";import hg from"ink-spinner";import{jsx as hl,jsxs as Sg}from"react/jsx-runtime";function kl({loading:e}){return e?Sg(gl,{color:kg,children:[hl(hg,{type:"dots"})," Starting..."]}):hl(gl,{children:""})}var kg,Sl=g(()=>{"use strict";kg="#24CFFF"});import{useEffect as Ag,useState as ht}from"react";import{Box as _e,Text as ro,useInput as wg}from"ink";import{jsx as ve,jsxs as oo}from"react/jsx-runtime";function wl({onDismiss:e}){let{height:t,width:n}=Xe(),[r,o]=ht(0),[a,i]=ht(!1),[l,s]=ht(!1),[c,p]=ht(!1),[u,d]=ht(!1);wg(()=>{u&&e()}),Ag(()=>{let S=80+dn.length*70+80,k=[...dn.map((A,w)=>setTimeout(()=>{o(w+1)},80+w*70)),setTimeout(()=>{i(!0)},S),setTimeout(()=>{s(!0)},S+200),setTimeout(()=>{p(!0)},S+400),setTimeout(()=>{p(!1),d(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{k.forEach(A=>{clearTimeout(A)})}},[e]);let m=dn.length+5,h=Math.max(0,Math.floor((t-m)/2));return oo(_e,{flexDirection:"column",height:t,width:n,children:[ve(_e,{height:h}),oo(_e,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[ve(_e,{flexDirection:"column",children:dn.map((S,k)=>ve(ro,{color:Al,children:k<r?S:""},S))}),oo(_e,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[ve(ro,{bold:!0,color:Al,children:a?bg:""}),ve(_e,{marginTop:1,children:ve(ro,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),ve(_e,{marginTop:2,children:ve(kl,{loading:c})})]})]})]})}var dn,Al,bg,bl=g(()=>{"use strict";sn();Sl();dn=[" 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 "],Al="#24CFFF",bg="ripplo"});import{createAuthClient as Rg}from"better-auth/client";import{deviceAuthorizationClient as Ng}from"better-auth/client/plugins";function pn({baseURL:e}){return Rg({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Ng()]})}var ao=g(()=>{"use strict"});import{exec as Tg}from"child_process";async function Nl({cwd:e,onDeviceCode:t,url:n}){let r=n??mt().RIPPLO_SERVER_URL,o=pn({baseURL:r}),a=await o.device.code({client_id:Rl});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}),Og(s);let c=await Cg({authClient:o,deviceCode:i});return pr(e,c),c}async function Cg({authClient:e,deviceCode:t}){for(;;){await Pg(Lg);let n=await e.device.token({client_id:Rl,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(!xg(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function xg(e){return vg.has(e)}function Pg(e){return new Promise(t=>{setTimeout(t,e)})}function Eg(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function Og(e){let t=Eg();Tg(`${t} "${e}"`,()=>{})}var Lg,Rl,vg,Tl=g(()=>{"use strict";ye();ao();Yt();Lg=5e3,Rl="ripplo-cli";vg=new Set(["authorization_pending","slow_down"])});import{useCallback as un,useEffect as Ug,useState as xe}from"react";import{exec as _g}from"child_process";import{promisify as Ig}from"util";import z from"fs";import H from"path";function Cl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=xe(t==null?"login":"validating"),[a,i]=xe(),[l,s]=xe(),[c,p]=xe(t),[u,d]=xe(!1),[m,h]=xe(),[S,k]=xe(),[A,w]=xe([]);Ug(()=>{if(t==null)return;pn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(L=>{if(L.data==null){o("login");return}return io({cwd:e,serverUrl:n,token:t})}).then(L=>{if(L==null){o("select-project");return}i(L),o("complete")}).catch(L=>{s(L instanceof Error?L.message:String(L)),o("login")})},[e,t,n]);let P=un(()=>{u||(d(!0),s(void 0),Nl({cwd:e,onDeviceCode:h,url:n}).then(x=>(p(x),io({cwd:e,serverUrl:n,token:x}))).then(x=>{x==null?o("select-project"):(i(x),o("complete"))}).catch(x=>{d(!1),h(void 0),s(x instanceof Error?x.message:String(x))}))},[e,u,n]),E=un(x=>{let L=a?.token??c??t;if(L==null){s("No authentication token available");return}o("scaffolding"),s(void 0),Bg({cwd:e,onStep:k,projectId:x.id}).then(async j=>{w(j);let Pe=await io({cwd:e,serverUrl:n,token:L});i(Pe??jg({projectId:x.id,serverUrl:n,token:L})),o(j.length>0?"scaffolding-warnings":"complete")}).catch(j=>{s(j instanceof Error?j.message:String(j)),o("select-project")})},[a,e,t,n,c]),N=un(()=>{o("complete")},[]),I=un(()=>{i(void 0),o("login"),d(!1),h(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,dismissScaffoldWarnings:N,error:l,loginStarted:u,resetToLogin:I,scaffoldingStep:S,scaffoldWarnings:A,selectProject:E,setStage:o,stage:r,startLogin:P,token:c}}function jg({projectId:e,serverUrl:t,token:n}){return{appUrl:"",preconditionsUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function io({cwd:e,serverUrl:t,token:n}){let r=await V(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Bg({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Hg({cwd:e,projectId:n}),t("Updating .gitignore..."),eh(e),t("Marking ripplo.lock as generated..."),Fg(e),t("Installing dependencies...");let r=await Vg(e),o=[];if(r.ok||o.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run this manually, then re-run \`npx ripplo\`.`}),r.ok){t("Compiling initial lockfile...");let a=await Wg(e);a!=null&&o.push({manualCommand:void 0,message:a})}return t("Setting up browser..."),await Kn(),o}async function Vg(e){let t=Mg({cwd:e,pm:Xg(e)});b.info("Installing dependencies: %s",t);try{return await Dg(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
238
- `)[0]??n.message:String(n);return b.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function Wg(e){try{await qg(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return b.warn("Initial lockfile compile failed: %s",n),`Couldn't compile initial lockfile: ${n}. You can run \`npx ripplo\` again after fixing the DSL.`}}async function qg(e){let t=await V(e);if(!t.ok){b.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await Ae({cwd:e,result:t.result})}function Fg(e){let t=H.join(e,".gitattributes"),n=z.existsSync(t)?z.readFileSync(t,"utf8"):"";if(n.includes(Ll))return;let r=n.length===0||n.endsWith(`
249
+ `)});import{Box as It,Text as de,useInput as jk}from"ink";import $k from"ink-spinner";import{jsx as Le,jsxs as ge}from"react/jsx-runtime";function fc({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}){return jk((l,s)=>{a==="scaffolding-warnings"&&s.return&&n()}),ge(It,{flexDirection:"column",padding:1,children:[ge(de,{bold:!0,children:[" ","ripplo setup"]}),Le(de,{children:""}),ge(de,{children:[Le(de,{color:"green",children:" \u2713 "}),Le(de,{children:"Authenticated"})]}),Dk({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}),t==null?null:Le(It,{marginTop:1,children:ge(de,{color:"red",children:[" ","Error: ",t]})})]})}function Dk({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?ge(de,{children:[ge(de,{color:"cyan",children:[" ",Le($k,{type:"dots"})]}),ge(de,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?ge(It,{flexDirection:"column",marginTop:1,children:[Le(de,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((i,a)=>ge(It,{flexDirection:"column",marginTop:1,children:[ge(de,{children:[" ",i.message]}),i.manualCommand==null?null:ge(de,{color:"cyan",children:[" $ ",i.manualCommand]})]},a)),Le(It,{marginTop:1,children:Le(de,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):Le(uc,{selectProject:r,serverUrl:e.ripploServerUrl})}var yc=m(()=>{"use strict";mc()});import{useEffect as Bk,useState as Vk}from"react";function pt(){let[e,t]=Vk(gc);return Bk(()=>{function n(){t(gc())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function gc(){return{height:process.stdout.rows,width:process.stdout.columns}}var Ln=m(()=>{"use strict"});import{useEffect as Wk,useRef as qk,useState as Fk}from"react";function hc({config:e,cwd:t}){let[n,r]=Fk({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=qk(void 0);return Wk(()=>{function i({devSessionId:l}){r(s=>({...s,devSessionId:l,syncError:void 0,syncing:!1}))}function a(l){r(s=>({...s,syncError:l,syncing:!1}))}return Vl({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{i({devSessionId:l}),o.current=wo({config:e,cwd:t,lastHash:s,onSyncError:a,onSyncSuccess:i})}).catch(l=>{let s=l instanceof Error?l.message:String(l);a(s),o.current=wo({config:e,cwd:t,lastHash:"",onSyncError:a,onSyncSuccess:i})}),()=>{o.current?.()}},[e,t]),n}var kc=m(()=>{"use strict";bo()});function vn(e){return{...Hk(e),type:e.type}}function Hk(e){switch(e.type){case"settings":return Mk(e);case"token":return Jk(e.exists);case"dev-server":return zk(e);case"preconditions":return Zk(e);case"precondition-endpoint":return Xk(e);case"adapter-enabled":return tS(e.status);case"webhook-verification":return Gk(e.rejectsUnsigned);case"preconditions-validation":return Kk(e);case"workflows":return nS(e);case"browser":return Qk(e.installed);case"lockfile":return oS(e.status);case"pre-commit-hook":return Yk(e.installed)}}function Mk(e){return e.valid?{detail:"configured",label:"Settings",tone:"ok"}:{detail:`missing ${e.missingFields.join(", ")}`,label:"Settings",tone:"error"}}function Jk(e){return e?{detail:"signed in",label:"Auth",tone:"ok"}:{detail:"not signed in",label:"Auth",tone:"error"}}function zk(e){return e.reachable?{detail:e.appUrl,label:"Dev server",tone:"ok"}:{detail:`${e.appUrl} unreachable`,label:"Dev server",tone:"error"}}function Xk(e){return e.reachable?{detail:e.url,label:"Endpoint",tone:"ok"}:{detail:`${e.url} unreachable`,label:"Endpoint",tone:"error"}}function Gk(e){return e?{detail:"rejects unsigned",label:"Webhook auth",tone:"ok"}:{detail:"accepts unsigned!",label:"Webhook auth",tone:"error"}}function Kk(e){if(e.valid)return{detail:"valid",label:"State graph",tone:"ok"};let t=e.errorCount===1?"":"s";return{detail:`${String(e.errorCount)} error${t}`,label:"State graph",tone:"error"}}function Qk(e){return e?{detail:"chromium installed",label:"Browser",tone:"ok"}:{detail:"chromium missing",label:"Browser",tone:"error"}}function Yk(e){return e?{detail:"installed",label:"Pre-commit",tone:"ok"}:{detail:"not installed",label:"Pre-commit",tone:"warn"}}function Zk(e){return e.count===0?{detail:"none defined",label:"Preconditions",tone:"info"}:e.configured?e.endpointReachable===!1?{detail:`${String(e.count)} defined, endpoint unreachable`,label:"Preconditions",tone:"error"}:{detail:`${String(e.count)} defined`,label:"Preconditions",tone:"ok"}:{detail:`${String(e.count)} defined, url unset`,label:"Preconditions",tone:"error"}}function tS(e){let t=eS[e];return t??{detail:"unreachable",label:"Adapter",tone:"error"}}function nS(e){return e.total===0?{detail:"none defined",label:"Tests",tone:"info"}:e.invalidNames.length>0?{detail:`${String(e.invalidNames.length)} invalid of ${String(e.total)}`,label:"Tests",tone:"error"}:{detail:`${String(e.total)} valid`,label:"Tests",tone:"ok"}}function oS(e){let t=rS[e];return t??{detail:"stale (run ripplo compile)",label:"Lockfile",tone:"warn"}}var eS,rS,Sc,Ac,Oo=m(()=>{"use strict";eS={"bad-secret":{detail:"webhook secret mismatch",label:"Adapter",tone:"error"},disabled:{detail:"disabled (set ENABLE_RIPPLO_TESTING)",label:"Adapter",tone:"error"},enabled:{detail:"enabled",label:"Adapter",tone:"ok"},"no-secret":{detail:"no webhook secret",label:"Adapter",tone:"error"},unreachable:{detail:"unreachable",label:"Adapter",tone:"error"}};rS={match:{detail:"up to date",label:"Lockfile",tone:"ok"},missing:{detail:"missing (run ripplo compile)",label:"Lockfile",tone:"error"},stale:{detail:"stale (run ripplo compile)",label:"Lockfile",tone:"warn"}};Sc={"adapter-enabled":"ADAPTER_ENABLED",browser:"BROWSER","dev-server":"DEV_SERVER",lockfile:"LOCKFILE","pre-commit-hook":"PRE_COMMIT_HOOK","precondition-endpoint":"PRECONDITION_ENDPOINT",preconditions:"PRECONDITIONS","preconditions-validation":"PRECONDITIONS_VALIDATION",settings:"SETTINGS",token:"TOKEN","webhook-verification":"WEBHOOK_VERIFICATION",workflows:"WORKFLOWS"},Ac={error:"ERROR",info:"INFO",ok:"OK",warn:"WARN"}});import{useEffect as iS,useState as aS}from"react";import sS from"path";import{watch as lS}from"chokidar";import{graphql as cS}from"gql.tada";function wc({config:e,cwd:t}){let[n,r]=aS({checks:[],lastRunAt:void 0,running:!1});return iS(()=>{let o={cancelled:!1,inFlight:!1,lastPushedKey:void 0},i;async function a(){if(!(o.cancelled||o.inFlight)){o.inFlight=!0;try{let c=await fn(t);r({checks:c,lastRunAt:Date.now(),running:!1}),o.lastPushedKey=await uS({checks:c,config:e,lastPushedKey:o.lastPushedKey})}catch(c){b.error(c,"health check tick failed")}finally{o.inFlight=!1}}}function l(){o.cancelled||(i=setTimeout(()=>{a().finally(l)},dS))}a().finally(l);let s=lS(sS.join(t,".ripplo","ripplo.lock"),{ignoreInitial:!0,persistent:!0});return s.on("all",()=>{a()}),()=>{o.cancelled=!0,i!=null&&clearTimeout(i),s.close()}},[e,t]),n}async function uS({checks:e,config:t,lastPushedKey:n}){if(t.projectId.length===0)return n;let r=e.map(i=>{let a=vn(i);return{detail:a.detail,tone:Ac[a.tone],type:Sc[a.type]}}),o=JSON.stringify(r);if(o===n)return n;try{return await U({config:t,document:pS,variables:{checks:r,projectId:t.projectId}}),o}catch(i){return b.error(i,"Failed to push health checks"),n}}var dS,pS,bc=m(()=>{"use strict";J();po();Oo();dS=5e3,pS=cS(`
250
+ mutation PushHealthChecks($projectId: String!, $checks: [HealthCheckInput!]!) {
251
+ pushHealthChecks(projectId: $projectId, checks: $checks)
252
+ }
253
+ `)});import Io from"fs";import{useEffect as mS}from"react";import{useQuery as fS,useSubscription as yS}from"urql";import{graphql as Tc}from"gql.tada";function Nc({cwd:e,projectId:t}){let[{data:n}]=fS({query:gS,variables:{projectId:t}});mS(()=>{let r=n?.project?.devSession?.hooksPaused;r!=null&&Rc({cwd:e,paused:r})},[e,n]),yS({query:hS,variables:{projectId:t}},(r,o)=>{let i=o.hooksPausedRequested;return i!=null&&Rc({cwd:e,paused:i.paused}),o})}function Rc({cwd:e,paused:t}){let n=Se(e,"hooks-paused");if(t){Me(e),Io.writeFileSync(n,"");return}Io.existsSync(n)&&Io.unlinkSync(n)}var gS,hS,Cc=m(()=>{"use strict";J();gS=Tc(`
254
+ query HooksPausedState($projectId: String!) {
255
+ project(id: $projectId) {
256
+ id
257
+ devSession {
258
+ id
259
+ hooksPaused
260
+ }
261
+ }
262
+ }
263
+ `),hS=Tc(`
264
+ subscription HooksPausedRequested($projectId: String!) {
265
+ hooksPausedRequested(projectId: $projectId) {
266
+ paused
267
+ projectId
268
+ }
269
+ }
270
+ `)});import{useEffect as kS,useState as Lc}from"react";import{useQuery as SS,useSubscription as vc}from"urql";import{graphql as _o}from"gql.tada";function xc({projectId:e}){let[{data:t}]=SS({query:AS,variables:{projectId:e}}),[n,r]=Lc(),[o,i]=Lc();return kS(()=>{let a=t?.project?.devSession?.hooksPaused;a!=null&&r(a);let l=t?.project?.devSession?.scopeItems;l!=null&&i(l.map(s=>Pc(s)))},[t]),vc({query:wS,variables:{projectId:e}},(a,l)=>{let s=l.hooksPausedRequested;return s!=null&&r(s.paused),l}),vc({query:bS,variables:{projectId:e}},(a,l)=>{let s=l.scopeChanged?.devSession?.scopeItems;return s!=null&&i(s.map(c=>Pc(c))),l}),{paused:n??!1,projectName:t?.project?.name,scope:o??[]}}function Pc(e){let t=e.workflow;return t!=null?{id:e.id,label:t.name}:{id:e.id,label:e.label??"(intent)"}}var AS,wS,bS,Ec=m(()=>{"use strict";AS=_o(`
271
+ query ProjectStateDashboard($projectId: String!) {
272
+ project(id: $projectId) {
273
+ id
274
+ name
275
+ devSession {
276
+ id
277
+ hooksPaused
278
+ scopeItems {
279
+ id
280
+ label
281
+ workflow {
282
+ id
283
+ slug
284
+ name
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+ `),wS=_o(`
291
+ subscription HooksPausedDashboard($projectId: String!) {
292
+ hooksPausedRequested(projectId: $projectId) {
293
+ paused
294
+ projectId
295
+ }
296
+ }
297
+ `),bS=_o(`
298
+ subscription ScopeChangedDashboard($projectId: String!) {
299
+ scopeChanged(projectId: $projectId) {
300
+ projectId
301
+ devSession {
302
+ id
303
+ scopeItems {
304
+ id
305
+ label
306
+ workflow {
307
+ id
308
+ slug
309
+ name
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ `)});import{Box as RS,Text as Uo}from"ink";import{jsx as Oc,jsxs as Ic}from"react/jsx-runtime";function _c({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return Ic(RS,{paddingX:1,children:[Oc(Uo,{dimColor:!0,children:"Activity "}),Ic(Uo,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),Oc(Uo,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var Uc=m(()=>{"use strict"});import{Box as TS,Text as Pn}from"ink";import{jsx as xn,jsxs as CS}from"react/jsx-runtime";function jc({check:e}){let{detail:t,label:n,tone:r}=vn(e),o=NS[r];return CS(TS,{children:[xn(Pn,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),xn(Pn,{children:" "}),xn(Pn,{children:n.padEnd(18," ")}),xn(Pn,{color:o,children:t})]})}var NS,$c=m(()=>{"use strict";Oo();NS={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as LS,Text as Dc}from"ink";import{jsx as jo,jsxs as vS}from"react/jsx-runtime";function Bc({checks:e}){return vS(LS,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[jo(Dc,{bold:!0,children:"Health"}),e.length===0?jo(Dc,{dimColor:!0,children:"Running first pass..."}):e.map(t=>jo(jc,{check:t},t.type))]})}var Vc=m(()=>{"use strict";$c()});import{Box as En,Text as ut}from"ink";import{jsx as mt,jsxs as On}from"react/jsx-runtime";function Wc({appUrl:e,developerUrl:t,projectName:n}){return On(En,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[On(En,{children:[mt(ut,{dimColor:!0,children:"Project "}),mt(ut,{bold:!0,children:n})]}),On(En,{children:[mt(ut,{dimColor:!0,children:"App "}),mt(ut,{color:"cyan",children:e})]}),On(En,{children:[mt(ut,{dimColor:!0,children:"Dashboard "}),mt(ut,{color:"cyan",children:t})]})]})}var qc=m(()=>{"use strict"});import{Box as $o,Text as Be}from"ink";import{jsx as Ve,jsxs as Do}from"react/jsx-runtime";function Fc({paused:e,scope:t}){return Do($o,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Do($o,{children:[Ve(Be,{bold:!0,children:"Scope"}),Ve(Be,{dimColor:!0,children:` (${String(t.length)})`}),Ve(Be,{children:" "}),Ve(Be,{dimColor:!0,children:"Hooks "}),Ve(Be,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?Ve(Be,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>Do($o,{children:[Ve(Be,{color:"cyan",children:"\u2022 "}),Ve(Be,{children:n.label})]},n.id))]})}var Hc=m(()=>{"use strict"});import{Box as PS,Text as Mc}from"ink";import{jsx as xS,jsxs as Jc}from"react/jsx-runtime";function zc({preconditions:e,workflows:t}){let n=t?.type==="workflows"?t.total:0,r=t?.type==="workflows"?t.invalidNames.length:0,o=e?.type==="preconditions"?e.count:0;return Jc(PS,{marginTop:1,paddingX:1,children:[xS(Mc,{dimColor:!0,children:"Workflows "}),Jc(Mc,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var Xc=m(()=>{"use strict"});import BE from"chalk";import{z as Gc}from"zod";async function Kc(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${ES}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return OS.parse(r).version}catch{return}finally{clearTimeout(t)}}var Bo,ES,OS,Qc=m(()=>{"use strict";J();Bo="0.1.12",ES="ripplo",OS=Gc.object({version:Gc.string()})});import{useEffect as IS,useState as _S}from"react";import{Text as Ge}from"ink";import{jsx as ft,jsxs as DS}from"react/jsx-runtime";function Yc({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let l=$S(),s=l!=null&&l!==Bo,c=US({connected:n,syncError:i}),p=t?"":" warming up browsers...",u=e>0?` ${String(e)} running`:"",d=`v${Bo}`,f=s?` \u2192 v${l}`:"",h=`project ${r} \xB7 q to quit`,S=` ripplo ${d}${f} | ${o} ${c}${p}${u}`,k=Math.max(0,a-S.length-h.length-1);return DS(Ge,{inverse:!0,children:[ft(Ge,{bold:!0,children:" ripplo "}),ft(Ge,{dimColor:!0,children:d}),s?ft(Ge,{color:"yellow",children:` \u2192 v${l}`}):null,` | ${o} `,ft(Ge,{color:jS({connected:n,syncError:i}),children:c}),t?null:ft(Ge,{color:"yellow",children:p}),u," ".repeat(k),ft(Ge,{dimColor:!0,children:h})," "]})}function US({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function jS({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function $S(){let[e,t]=_S();return IS(()=>{Kc().then(n=>{n!=null&&t(n)})},[]),e}var Zc=m(()=>{"use strict";Qc()});import{useEffect as BS}from"react";import{availableParallelism as VS}from"os";import{Box as Vo,Text as WS,useApp as qS,useInput as FS}from"ink";import{jsx as We,jsxs as ed}from"react/jsx-runtime";function td({config:e,cwd:t}){let n=qS(),{height:r,width:o}=pt(),{config:i,devSessionId:a,syncError:l}=hc({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=Gl({config:i,cwd:t,devSessionId:a}),{checks:u}=wc({config:i,cwd:t}),{paused:d,projectName:f,scope:h}=xc({projectId:e.projectId});Nc({cwd:t,projectId:e.projectId}),BS(()=>bl(t),[t]),FS(T=>{T==="q"&&n.exit()});let S=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,k=u.filter(T=>HS.has(T.type)),A=u.find(T=>T.type==="workflows"),w=u.find(T=>T.type==="preconditions"),L=VS(),E=f??"\u2026";return ed(Vo,{flexDirection:"column",height:r,width:o,children:[We(Yc,{activeRunCount:s,browsersReady:c,connected:p,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:l,width:o}),ed(Vo,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[We(Wc,{appUrl:i.appUrl,developerUrl:S,projectName:E}),We(Fc,{paused:d,scope:h}),We(Bc,{checks:k}),We(zc,{preconditions:w,workflows:A}),We(_c,{activeRunCount:s,browsersReady:c,maxConcurrency:L}),We(Vo,{marginTop:1,paddingX:1,children:We(WS,{dimColor:!0,children:"q quit"})})]})]})}var HS,nd=m(()=>{"use strict";ho();Ln();kc();bc();Cc();Ec();To();Uc();Vc();qc();Hc();Xc();Zc();HS=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as rd}from"ink";import MS from"ink-spinner";import{jsx as od,jsxs as zS}from"react/jsx-runtime";function id({loading:e}){return e?zS(rd,{color:JS,children:[od(MS,{type:"dots"})," Starting..."]}):od(rd,{children:""})}var JS,ad=m(()=>{"use strict";JS="#24CFFF"});import{useEffect as XS,useState as _t}from"react";import{Box as Ke,Text as Wo,useInput as GS}from"ink";import{jsx as qe,jsxs as qo}from"react/jsx-runtime";function ld({onDismiss:e}){let{height:t,width:n}=pt(),[r,o]=_t(0),[i,a]=_t(!1),[l,s]=_t(!1),[c,p]=_t(!1),[u,d]=_t(!1);GS(()=>{u&&e()}),XS(()=>{let S=80+In.length*70+80,k=[...In.map((A,w)=>setTimeout(()=>{o(w+1)},80+w*70)),setTimeout(()=>{a(!0)},S),setTimeout(()=>{s(!0)},S+200),setTimeout(()=>{p(!0)},S+400),setTimeout(()=>{p(!1),d(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{k.forEach(A=>{clearTimeout(A)})}},[e]);let f=In.length+5,h=Math.max(0,Math.floor((t-f)/2));return qo(Ke,{flexDirection:"column",height:t,width:n,children:[qe(Ke,{height:h}),qo(Ke,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[qe(Ke,{flexDirection:"column",children:In.map((S,k)=>qe(Wo,{color:sd,children:k<r?S:""},S))}),qo(Ke,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[qe(Wo,{bold:!0,color:sd,children:i?KS:""}),qe(Ke,{marginTop:1,children:qe(Wo,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),qe(Ke,{marginTop:2,children:qe(id,{loading:c})})]})]})]})}var In,sd,KS,cd=m(()=>{"use strict";Ln();ad();In=[" 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 "],sd="#24CFFF",KS="ripplo"});import{createAuthClient as QS}from"better-auth/client";import{deviceAuthorizationClient as YS}from"better-auth/client/plugins";function _n({baseURL:e}){return QS({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[YS()]})}var Fo=m(()=>{"use strict"});import{exec as ZS}from"child_process";async function pd({cwd:e,onDeviceCode:t,url:n}){let r=n??Pt().RIPPLO_SERVER_URL,o=_n({baseURL:r}),i=await o.device.code({client_id:dd});if(i.error!=null)throw new Error(`Failed to request device code: ${i.error.error_description}`);let{device_code:a,user_code:l,verification_uri_complete:s}=i.data;t({userCode:l,verificationUrl:s}),aA(s);let c=await tA({authClient:o,deviceCode:a});return Ur(e,c),c}async function tA({authClient:e,deviceCode:t}){for(;;){await oA(eA);let n=await e.device.token({client_id:dd,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(!rA(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function rA(e){return nA.has(e)}function oA(e){return new Promise(t=>{setTimeout(t,e)})}function iA(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function aA(e){let t=iA();ZS(`${t} "${e}"`,()=>{})}var eA,dd,nA,ud=m(()=>{"use strict";J();Fo();st();eA=5e3,dd="ripplo-cli";nA=new Set(["authorization_pending","slow_down"])});import{useCallback as Un,useEffect as sA,useState as Fe}from"react";import{exec as lA}from"child_process";import{promisify as cA}from"util";import M from"fs";import K from"path";function fd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Fe(t==null?"login":"validating"),[i,a]=Fe(),[l,s]=Fe(),[c,p]=Fe(t),[u,d]=Fe(!1),[f,h]=Fe(),[S,k]=Fe(),[A,w]=Fe([]);sA(()=>{if(t==null)return;_n({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(C=>{if(C.data==null){o("login");return}return Ho({cwd:e,serverUrl:n,token:t})}).then(C=>{if(C==null){o("select-project");return}a(C),o("complete")}).catch(C=>{s(C instanceof Error?C.message:String(C)),o("login")})},[e,t,n]);let L=Un(()=>{u||(d(!0),s(void 0),pd({cwd:e,onDeviceCode:h,url:n}).then(x=>(p(x),Ho({cwd:e,serverUrl:n,token:x}))).then(x=>{x==null?o("select-project"):(a(x),o("complete"))}).catch(x=>{d(!1),h(void 0),s(x instanceof Error?x.message:String(x))}))},[e,u,n]),E=Un(x=>{let C=i?.token??c??t;if(C==null){s("No authentication token available");return}o("scaffolding"),s(void 0),mA({cwd:e,onStep:k,projectId:x.id}).then(async D=>{w(D);let He=await Ho({cwd:e,serverUrl:n,token:C});a(He??dA({projectId:x.id,serverUrl:n,token:C})),o(D.length>0?"scaffolding-warnings":"complete")}).catch(D=>{s(D instanceof Error?D.message:String(D)),o("select-project")})},[i,e,t,n,c]),T=Un(()=>{o("complete")},[]),$=Un(()=>{a(void 0),o("login"),d(!1),h(void 0),s(void 0)},[]);return{config:i,deviceCodeInfo:f,dismissScaffoldWarnings:T,error:l,loginStarted:u,resetToLogin:$,scaffoldingStep:S,scaffoldWarnings:A,selectProject:E,setStage:o,stage:r,startLogin:L,token:c}}function dA({projectId:e,serverUrl:t,token:n}){return{appUrl:"",preconditionsUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Ho({cwd:e,serverUrl:t,token:n}){let r=await O(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function mA({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),bA({cwd:e,projectId:n}),t("Updating .gitignore..."),vA(e),t("Marking ripplo.lock as generated..."),hA(e),t("Installing dependencies...");let r=await fA(e),o=[];if(r.ok||o.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run this manually, then re-run \`npx ripplo\`.`}),r.ok){t("Compiling initial lockfile...");let i=await yA(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await hr(),o}async function fA(e){let t=kA({cwd:e,pm:wA(e)});b.info("Installing dependencies: %s",t);try{return await uA(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
316
+ `)[0]??n.message:String(n);return b.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function yA(e){try{await gA(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return b.warn("Initial lockfile compile failed: %s",n),`Couldn't compile initial lockfile: ${n}. You can run \`npx ripplo\` again after fixing the DSL.`}}async function gA(e){let t=await O(e);if(!t.ok){b.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await pe({cwd:e,result:t.result})}function hA(e){let t=K.join(e,".gitattributes"),n=M.existsSync(t)?M.readFileSync(t,"utf8"):"";if(n.includes(md))return;let r=n.length===0||n.endsWith(`
239
317
  `)?"":`
240
- `;z.writeFileSync(t,`${n}${r}${Ll}
241
- `)}function Mg({cwd:e,pm:t}){let n=$g.join(" ");return t==="pnpm"?zg(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?Jg(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function zg(e){return z.existsSync(H.join(e,"pnpm-workspace.yaml"))||z.existsSync(H.join(e,"pnpm-workspace.yml"))}function Jg(e){let t=H.join(e,"package.json");if(!z.existsSync(t))return!1;try{let n=JSON.parse(z.readFileSync(t,"utf8"));if(n==null||typeof n!="object"||!("workspaces"in n))return!1;let r=n.workspaces;return Array.isArray(r)||r!=null&&typeof r=="object"}catch{return!1}}function Xg(e){return z.existsSync(H.join(e,"pnpm-lock.yaml"))?"pnpm":z.existsSync(H.join(e,"yarn.lock"))?"yarn":z.existsSync(H.join(e,"bun.lockb"))||z.existsSync(H.join(e,"bun.lock"))?"bun":"npm"}function Hg({cwd:e,projectId:t}){let n=H.join(e,".ripplo"),r=H.join(n,"tests"),o=H.join(n,"preconditions");z.mkdirSync(r,{recursive:!0}),z.mkdirSync(o,{recursive:!0}),mn(H.join(n,"ripplo.ts"),Gg(t)),mn(H.join(n,"index.ts"),Yg),mn(H.join(n,".env"),Kg()),mn(H.join(n,"tsconfig.json"),Qg)}function mn(e,t){z.existsSync(e)||z.writeFileSync(e,t)}function Gg(e){return`import { config } from "dotenv";
318
+ `;M.writeFileSync(t,`${n}${r}${md}
319
+ `)}function kA({cwd:e,pm:t}){let n=pA.join(" ");return t==="pnpm"?SA(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?AA(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function SA(e){return M.existsSync(K.join(e,"pnpm-workspace.yaml"))||M.existsSync(K.join(e,"pnpm-workspace.yml"))}function AA(e){let t=K.join(e,"package.json");if(!M.existsSync(t))return!1;try{let n=JSON.parse(M.readFileSync(t,"utf8"));if(n==null||typeof n!="object"||!("workspaces"in n))return!1;let r=n.workspaces;return Array.isArray(r)||r!=null&&typeof r=="object"}catch{return!1}}function wA(e){return M.existsSync(K.join(e,"pnpm-lock.yaml"))?"pnpm":M.existsSync(K.join(e,"yarn.lock"))?"yarn":M.existsSync(K.join(e,"bun.lockb"))||M.existsSync(K.join(e,"bun.lock"))?"bun":"npm"}function bA({cwd:e,projectId:t}){let n=K.join(e,".ripplo"),r=K.join(n,"tests"),o=K.join(n,"preconditions");M.mkdirSync(r,{recursive:!0}),M.mkdirSync(o,{recursive:!0}),jn(K.join(n,"ripplo.ts"),RA(t)),jn(K.join(n,"index.ts"),NA),jn(K.join(n,".env"),TA()),jn(K.join(n,"tsconfig.json"),CA)}function jn(e,t){M.existsSync(e)||M.writeFileSync(e,t)}function RA(e){return`import { config } from "dotenv";
242
320
  import { createRipplo } from "@ripplo/testing";
243
321
  import { z } from "zod";
244
322
 
@@ -258,18 +336,18 @@ const ripplo = createRipplo({
258
336
  });
259
337
 
260
338
  export default ripplo;
261
- `}function Kg(){return`RIPPLO_WEBHOOK_SECRET="${xr()}"
262
- `}function eh(e){let t=H.join(e,".gitignore");if(!z.existsSync(t))return;let n=z.readFileSync(t,"utf8"),r=Zg.filter(a=>!n.includes(a));if(r.length===0)return;let o=n.endsWith(`
339
+ `}function TA(){return`RIPPLO_WEBHOOK_SECRET="${Zr()}"
340
+ `}function vA(e){let t=K.join(e,".gitignore");if(!M.existsSync(t))return;let n=M.readFileSync(t,"utf8"),r=LA.filter(i=>!n.includes(i));if(r.length===0)return;let o=n.endsWith(`
263
341
  `)?"":`
264
- `;z.writeFileSync(t,n+o+r.join(`
342
+ `;M.writeFileSync(t,n+o+r.join(`
265
343
  `)+`
266
- `)}var $g,Dg,Ll,Yg,Qg,Zg,vl=g(()=>{"use strict";ye();je();Tl();ao();fe();$g=["@ripplo/testing","dotenv","zod"],Dg=Ig(_g);Ll=".ripplo/ripplo.lock linguist-generated=true";Yg=`// Register every precondition and test here. The CLI loads this one file \u2014
344
+ `)}var pA,uA,md,NA,CA,LA,yd=m(()=>{"use strict";J();xe();ud();Fo();X();pA=["@ripplo/testing","dotenv","zod"],uA=cA(lA);md=".ripplo/ripplo.lock linguist-generated=true";NA=`// Register every precondition and test here. The CLI loads this one file \u2014
267
345
  // anything not imported from here is invisible to ripplo run / lint / status.
268
346
  // When you add a test under ./tests or a precondition under ./preconditions,
269
347
  // add a matching \`import "./..."\` line below.
270
348
 
271
349
  export { default } from "./ripplo.js";
272
- `,Qg=`{
350
+ `,CA=`{
273
351
  "compilerOptions": {
274
352
  "strict": true,
275
353
  "noUncheckedIndexedAccess": true,
@@ -285,35 +363,49 @@ export { default } from "./ripplo.js";
285
363
  "include": ["*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
286
364
  "exclude": ["node_modules"]
287
365
  }
288
- `,Zg=[".ripplo/debug/",".ripplo/.token",".ripplo/.env"]});import{useCallback as th,useState as nh}from"react";import{Box as so,Text as lo}from"ink";import{Provider as co}from"urql";import{jsx as Z,jsxs as rh}from"react/jsx-runtime";function xl({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=nh(!0),a=Cl({cwd:e,initialToken:t,serverUrl:n}),{height:i,width:l}=Xe(),s=th(()=>{o(!1)},[]);if(r)return Z(wl,{onDismiss:s});if(a.stage==="validating")return Z(so,{alignItems:"center",height:i,justifyContent:"center",width:l,children:rh(lo,{children:[Z(lo,{color:"yellow",children:"* "}),Z(lo,{children:"Validating session..."})]})});if(a.stage==="login")return Z(so,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Z(Zr,{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"?Z(co,{value:c,children:Z(fl,{config:a.config,cwd:e})}):Z(co,{value:c,children:Z(to,{config:a.config,error:a.error,scaffoldingStep:a.scaffoldingStep,scaffoldWarnings:a.scaffoldWarnings,selectProject:a.selectProject,stage:a.stage,onDismissWarnings:a.dismissScaffoldWarnings})})}if(a.token!=null){let c={appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:n,token:a.token,webhookSecret:""},p=Qr({config:c});return Z(co,{value:p,children:Z(to,{config:c,error:a.error,scaffoldingStep:a.scaffoldingStep,scaffoldWarnings:a.scaffoldWarnings,selectProject:a.selectProject,stage:a.stage,onDismissWarnings:a.dismissScaffoldWarnings})})}return Z(so,{alignItems:"center",height:i,justifyContent:"center",width:l,children:Z(Zr,{deviceCodeInfo:a.deviceCodeInfo,error:a.error,loginStarted:a.loginStarted,startLogin:a.startLogin})})}var Pl=g(()=>{"use strict";uo();Gs();Ys();al();yl();bl();vl();sn()});var El={};Vl(El,{clearActiveSession:()=>lh,launchDashboard:()=>dh,setActiveSession:()=>po});import fn from"fs";import mo from"path";import oh from"react";import{render as ah}from"ink";import{graphql as ih}from"gql.tada";function po({client:e,projectId:t}){yn=e,gn=t}function lh(){yn=void 0,gn=void 0}function ch(){if(yn==null||gn==null)return Promise.resolve();let e=yn.mutation(sh,{projectId:gn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function dh(){let e=process.cwd(),t=mo.join(e,".ripplo","debug"),n=mo.join(t,"last-crash.log");function r(i){fn.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);fn.writeFileSync(n,`${new Date().toISOString()}
289
- ${l}
290
- `),Ws().finally(()=>{process.exit(1)})}let o;try{let i=ct(e),l=Kt();Mn({filePath:mo.join(t,"debug.log")}),o=ah(oh.createElement(xl,{cwd:e,initialToken:i??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>ch()).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{fn.mkdirSync(t,{recursive:!0});let l=i instanceof Error?i.stack??i.message:String(i);fn.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
291
- ${l}
366
+ `,LA=[".ripplo/debug/",".ripplo/.local/",".ripplo/.env"]});import{useCallback as PA,useEffect as xA,useMemo as gd,useState as EA}from"react";import{Box as hd,Text as Mo}from"ink";import{Provider as OA}from"urql";import{graphql as IA}from"gql.tada";import{jsx as ve,jsxs as $A}from"react/jsx-runtime";function kd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=EA(!0),i=fd({cwd:e,initialToken:t,serverUrl:n}),{height:a,width:l}=pt(),s=gd(()=>UA({serverUrl:n,setup:i}),[i,n]),c=gd(()=>nc({config:s}),[s]);xA(()=>{i.config!=null&&(Jo({client:c,projectId:i.config.projectId}),c.query(_A,{projectId:i.config.projectId}).toPromise())},[c,i.config]);let p=PA(()=>{o(!1)},[]);return ve(OA,{value:c,children:jA({cwd:e,dismissSplash:p,effectiveConfig:s,height:a,setup:i,showSplash:r,width:l})})}function UA({serverUrl:e,setup:t}){return t.config!=null?t.config:{appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:e,token:t.token??"",webhookSecret:""}}function jA({cwd:e,dismissSplash:t,effectiveConfig:n,height:r,setup:o,showSplash:i,width:a}){return i?ve(ld,{onDismiss:t}):o.stage==="validating"?ve(hd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:$A(Mo,{children:[ve(Mo,{color:"yellow",children:"* "}),ve(Mo,{children:"Validating session..."})]})}):o.stage==="complete"&&o.config!=null?ve(td,{config:o.config,cwd:e}):o.stage==="login"||o.token==null?ve(hd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:ve(ic,{deviceCodeInfo:o.deviceCodeInfo,error:o.error,loginStarted:o.loginStarted,startLogin:o.startLogin})}):ve(fc,{config:o.config??n,error:o.error,scaffoldingStep:o.scaffoldingStep,scaffoldWarnings:o.scaffoldWarnings,selectProject:o.selectProject,stage:o.stage,onDismissWarnings:o.dismissScaffoldWarnings})}var _A,Sd=m(()=>{"use strict";zo();rc();ac();yc();nd();cd();yd();Ln();_A=IA(`
367
+ query PrefetchProjectState($projectId: String!) {
368
+ project(id: $projectId) {
369
+ id
370
+ name
371
+ devSession {
372
+ id
373
+ hooksPaused
374
+ scopeItems {
375
+ id
376
+ label
377
+ workflow {
378
+ id
379
+ slug
380
+ name
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+ `)});var Ad={};Go(Ad,{clearActiveSession:()=>qA,launchDashboard:()=>HA,setActiveSession:()=>Jo});import Ut from"fs";import Xo from"path";import DA from"react";import{render as BA}from"ink";import{graphql as VA}from"gql.tada";function Jo({client:e,projectId:t}){$n=e,Dn=t}function qA(){$n=void 0,Dn=void 0}function FA(){if($n==null||Dn==null)return Promise.resolve();let e=$n.mutation(WA,{projectId:Dn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function HA({restoreStdio:e}){let t=process.cwd(),n=Xo.join(t,".ripplo","debug"),r=Xo.join(n,"debug.log"),o=Xo.join(n,"last-crash.log");Ut.mkdirSync(n,{recursive:!0}),ur({filePath:r});function i(s){e(),Ut.mkdirSync(n,{recursive:!0});let c=s instanceof Error?s.stack??s.message:String(s);Ut.writeFileSync(o,`${new Date().toISOString()}
387
+ ${c}
388
+ `),Xl().finally(()=>{process.exit(1)})}let a;try{let s=Ae(t),c=$e();e(),a=BA(DA.createElement(kd,{cwd:t,initialToken:s??void 0,serverUrl:c}),{alternateScreen:!0}),a.waitUntilExit().then(()=>FA()).then(()=>{process.exit(0)})}catch(s){i(s)}let l=!1;process.on("SIGINT",()=>{l||(l=!0,a?.unmount())}),process.on("SIGTERM",()=>{l||(l=!0,a?.unmount())}),process.on("uncaughtException",s=>{i(s)}),process.on("unhandledRejection",s=>{try{Ut.mkdirSync(n,{recursive:!0});let c=s instanceof Error?s.stack??s.message:String(s);Ut.appendFileSync(o,`${new Date().toISOString()} [unhandledRejection]
389
+ ${c}
292
390
 
293
- `)}catch{}})}var sh,yn,gn,uo=g(()=>{"use strict";Xr();ye();Pl();Yt();sh=ih(`
391
+ `)}catch{}})}var WA,$n,Dn,zo=m(()=>{"use strict";To();J();Sd();st();WA=VA(`
294
392
  mutation EndDevSessionExit($projectId: String!) {
295
393
  endDevSession(projectId: $projectId) {
296
394
  id
297
395
  }
298
396
  }
299
- `)});import{config as Ol}from"dotenv";import ph from"fs";import Ke from"path";import{fileURLToPath as uh}from"url";import mh from"yargs";import{hideBin as fh}from"yargs/helpers";je();fe();async function Co(e){let t=process.cwd(),n=await V(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
300
- `),process.exit(1)),e.check){let r=await wt({cwd:t}),o=bt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${me} is up to date
301
- `);return}let a=o==="missing"?"missing":"out of date";process.stderr.write(`${me} is ${a} \u2014 run \`ripplo compile\` and commit the result
302
- `),process.exit(1)}await Ae({cwd:t,result:n.result}),process.stdout.write(`wrote ${me}
303
- `)}ye();je();import pt from"fs";import ms from"path";import{chromium as Gm}from"playwright";fe();import Xm from"fs";import Hm from"path";async function ps(e){let t=Hm.join(e,".ripplo","index.ts");if(!Xm.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 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 us({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}}fe();function fs(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"preconditions-validation":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 ys(e){let t=await Qm(e),n=Zm(e),r=ef(),o=await V(e),a=tf(o),i=of(o),l=await Km(e,o),s=Ym(e),c=await af(t,o);return[t,n,...c,a,i,l,s,r]}async function Km(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await wt({cwd:e});return{status:bt({compiled:t.result,existing:n}),type:"lockfile"}}function Ym(e){let t=ms.join(e,".git","hooks","pre-commit");return pt.existsSync(t)?{installed:pt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Qm(e){let t=await ps(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 Zm(e){let t=ms.join(e,".ripplo",".token");return pt.existsSync(t)?{exists:pt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function ef(){let e=Gm.executablePath();return{installed:pt.existsSync(e),type:"browser"}}function tf(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=nf(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function nf(e,t){let n=[],r=new Set(Object.keys(e));return Object.entries(e).forEach(([o,a])=>{(a.depends??[]).forEach(i=>{r.has(i)||n.push({message:`Depends on non-existent precondition "${i}"`,path:`preconditions.${o}.depends`})})}),t.forEach(o=>{Object.entries(o.requiresKeys).forEach(([a,i])=>{r.has(i)||n.push({message:`Test "${o.slug}" requires non-existent precondition "${i}" (as ${a})`,path:`tests.${o.slug}.requiresKeys.${a}`})})}),rf(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function rf(e){let t=new Set,n=new Set,r=[];function o(a){if(n.has(a)){r.push(`Precondition "${a}" has a circular dependency`);return}t.has(a)||(t.add(a),n.add(a),(e[a]?.depends??[]).forEach(i=>{o(i)}),n.delete(a))}return Object.keys(e).forEach(a=>{o(a)}),r}function of(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 af(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 sf(n,t);return r.push(...a),r}async function sf(e,t){let n=t.ok?Object.keys(t.result.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=df(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"}),gs(e.preconditionsUrl)&&l.push({reachable:i,type:"precondition-endpoint",url:a}),!i)return l;let s=await us({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await lf({preconditionUrl:a,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:a}),l}async function lf({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",...Me({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 cf(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 gs(e){return e.startsWith("http://")||e.startsWith("https://")}function df(e,t){return gs(t)?t:`${e}${t}`}function hs(e){switch(e.type){case"settings":return mf(e);case"token":return ff(e);case"dev-server":return yf(e);case"preconditions":return kf(e);case"webhook-verification":return gf(e);case"preconditions-validation":return Sf(e);case"workflows":return Af(e);case"browser":return hf(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 cf(e);case"lockfile":return pf(e);case"pre-commit-hook":return uf(e)}}function pf(e){switch(e.status){case"match":return`\u2713 Lockfile: ${me} is up to date`;case"missing":return`\u2717 Lockfile: ${me} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${me} is out of date \u2014 run \`ripplo compile\` and commit it`}}function uf(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 mf(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function ff(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function yf(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 gf(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 hf(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function kf(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 Sf(e){if(!e.found)return"\u2717 State graph: DSL compilation failed";if(e.valid)return"\u2713 State graph: Valid";let t=e.errors.map(n=>` - ${n.path===""?"":n.path+": "}${n.message}`);return`\u2717 State graph: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
304
- ${t.join(`
305
- `)}`}function Af(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=>wf(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
306
- ${t.join(`
307
- `)}`}function wf(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
308
- `+t.join(`
309
- `)}async function ks(){let e=process.cwd(),t=await ys(e),n=t.map(o=>hs(o));process.stdout.write(n.join(`
397
+ `)});import{config as wd}from"dotenv";import MA from"fs";import Qe from"path";import{fileURLToPath as JA}from"url";import zA from"yargs";import{hideBin as XA}from"yargs/helpers";xe();X();async function ci(e){let t=process.cwd(),n=await O(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
398
+ `),process.exit(1)),e.check){let r=await Bt({cwd:t}),o=Vt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${ke} is up to date
399
+ `);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${ke} is ${i} \u2014 run \`ripplo compile\` and commit the result
400
+ `),process.exit(1)}await pe({cwd:t,result:n.result}),process.stdout.write(`wrote ${ke}
401
+ `)}po();async function tl(){let e=process.cwd(),t=await fn(e),n=t.map(o=>el(o));process.stdout.write(n.join(`
310
402
  `)+`
311
- `);let r=t.some(o=>fs(o));process.exit(r?1:0)}ye();import{graphql as Ht,readFragment as bf}from"gql.tada";import Ss from"figures";var ut={cross:Ss.cross,tick:Ss.tick};var ws=Ht(`
403
+ `);let r=t.some(o=>Ys(o));process.exit(r?1:0)}J();import{graphql as yn,readFragment as yg}from"gql.tada";import nl from"figures";var vt={cross:nl.cross,tick:nl.tick};var ol=yn(`
312
404
  fragment WorkflowIdMCP on Workflow {
313
405
  id
314
406
  slug
315
407
  }
316
- `),Rf=Ht(`
408
+ `),gg=yn(`
317
409
  query ProjectWorkflowIdsMCP($projectId: String!) {
318
410
  project(id: $projectId) {
319
411
  id
@@ -325,14 +417,14 @@ ${t.join(`
325
417
  }
326
418
  }
327
419
  }
328
- `,[ws]),Nf=Ht(`
420
+ `,[ol]),hg=yn(`
329
421
  mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
330
422
  createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
331
423
  id
332
424
  status
333
425
  }
334
426
  }
335
- `),Tf=Ht(`
427
+ `),kg=yn(`
336
428
  query RunStatusMCP($id: String!) {
337
429
  run(id: $id) {
338
430
  id
@@ -359,16 +451,16 @@ ${t.join(`
359
451
  }
360
452
  }
361
453
  }
362
- `);async function Gt({config:e,ids:t}){let n=await Lf({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:c})=>{let p=await vf({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 Pf({config:e,runId:c}),u=Cf({config:e,id:s,runId:c}),d=`.ripplo/debug/${c}/`;return{id:s,runId:c,summary:`View run: ${u}
363
- Debug artifacts: ${d}
454
+ `);async function gn({config:e,ids:t}){let n=await Sg({config:e,ids:t}),r=await Promise.all(n.map(async a=>{try{let l=await wg({config:e,workflowId:a.workflowId});return{entry:a,ok:!0,runId:l}}catch(l){let s=l instanceof Error?l.message:String(l);return{entry:a,message:s,ok:!1}}})),o=await Promise.all(r.map(async a=>{if(!a.ok)return{id:a.entry.id,runId:"",summary:`ERROR creating run: ${a.message}`};let{entry:l,runId:s}=a;try{let c=await Rg({config:e,runId:s}),p=Ag({config:e,id:l.id,runId:s}),u=`.ripplo/debug/${s}/`;return{id:l.id,runId:s,summary:`View run: ${p}
455
+ Debug artifacts: ${u}
364
456
 
365
- ${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}:**
366
- ${s.summary}`).join(`
457
+ ${c}`}}catch(c){let p=c instanceof Error?c.message:String(c);return{id:l.id,runId:s,summary:`ERROR polling run ${s}: ${p}`}}})),i=o.map(a=>`**${a.id}:**
458
+ ${a.summary}`).join(`
367
459
 
368
460
  ---
369
461
 
370
- `);return{results:a,summary:l}}async function Lf({config:e,ids:t}){let n=await q({config:e,document:Rf,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=>bf(ws,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 Cf({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function vf({config:e,workflowId:t}){let n=await q({config:e,document:Nf,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var xf=2e3,As=150;async function Pf({config:e,runId:t}){let n=0;for(;n<As;){await Of(xf),n+=1;let o=(await q({config:e,document:Tf,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return Ef({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(As)} times.`}function Ef({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"?ut.tick:ut.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"?ut.tick:ut.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
371
- `)}function Of(e){return new Promise(t=>{setTimeout(t,e)})}ye();fe();Yt();import{graphql as Df}from"gql.tada";var Bf=Df(`
462
+ `);return{results:o,summary:i}}async function Sg({config:e,ids:t}){let n=await U({config:e,document:gg,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=>yg(ol,o));return t.length===0?r.map(o=>({id:o.slug,workflowId:o.id})):t.map(o=>{let i=r.find(a=>a.slug===o);if(i==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:i.id}})}function Ag({config:e,id:t,runId:n}){let r=e.ripploServerUrl.replace(/:3000\b/,":3001"),o=new URL(r.endsWith("/")?r:`${r}/`);return new URL(`projects/${e.projectId}/workflows/${t}/runs/${n}`,o).toString()}async function wg({config:e,workflowId:t}){let n=await U({config:e,document:hg,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var bg=2e3,rl=150;async function Rg({config:e,runId:t}){let n=0;for(;n<rl;){await Ng(bg),n+=1;let o=(await U({config:e,document:kg,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return Tg({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(rl)} times.`}function Tg({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(i=>{let a=i.status==="passed"?vt.tick:vt.cross,l=i.detail==null?"":` \u2014 ${i.detail}`;r.push(` ${a} ${i.title} (${String(i.duration)}ms)${l}`),i.assertions.forEach(s=>{let c=s.status==="passed"?vt.tick:vt.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
463
+ `)}function Ng(e){return new Promise(t=>{setTimeout(t,e)})}J();X();st();import{graphql as Eg}from"gql.tada";var Og=Eg(`
372
464
  query DevSessionCheckPreflight($projectId: String!) {
373
465
  project(id: $projectId) {
374
466
  id
@@ -377,36 +469,156 @@ ${s.summary}`).join(`
377
469
  }
378
470
  }
379
471
  }
380
- `);async function Qt(){let e=process.cwd(),t=ct(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}
381
- `),process.exit(1)),{...n.result.config,ripploServerUrl:Kt(),token:t}}async function Zt(e){(await q({config:e,document:Bf,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 Ns({id:e,runs:t}){let n=await Qt();await Zt(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
382
- `);let r=await Promise.allSettled(Array.from({length:t},()=>Gt({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(`
383
- `).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(`
384
- Results: ${String(o)} passed, ${String(a)} failed out of ${String(t)} runs
472
+ `);async function be(){let e=process.cwd(),t=Ae(e);t==null&&(process.stderr.write("Not authenticated. Run `ripplo` to set up your config first.\n"),process.exit(1));let n=await O(e);return n.ok||(process.stderr.write(`Failed to compile DSL config: ${n.error}
473
+ `),process.exit(1)),{...n.result.config,ripploServerUrl:$e(),token:t}}async function Re(e){(await U({config:e,document:Og,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 sl({id:e,runs:t}){let n=await be();await Re(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
474
+ `);let r=await Promise.allSettled(Array.from({length:t},()=>gn({config:n,ids:[e]}))),o=0,i=0,a=new Map;r.forEach(s=>{if(s.status==="rejected"){i++;let p=s.reason instanceof Error?s.reason.message:"unknown error";a.set(p,(a.get(p)??0)+1);return}let c=s.value.results[0];if(c==null){i++;return}if(c.summary.includes("FAILED")||c.summary.includes("ERROR")){i++;let p=c.summary.split(`
475
+ `).find(u=>u.includes("FAILED")||u.includes("ERROR"))??"unknown failure";a.set(p,(a.get(p)??0)+1)}else o++});let l=t>0?i/t*100:0;process.stdout.write(`
476
+ Results: ${String(o)} passed, ${String(i)} failed out of ${String(t)} runs
385
477
  `),process.stdout.write(`Flake rate: ${l.toFixed(1)}%
386
- `),i.size>0&&(process.stdout.write(`
478
+ `),a.size>0&&(process.stdout.write(`
387
479
  Failure patterns:
388
- `),i.forEach((s,c)=>{process.stdout.write(` ${String(s)}x: ${c}
389
- `)})),process.exit(a>0?1:0)}import qr from"fs";import Cs from"path";Nn();Rt();var Ts=fo(vr(),1);import{z as ft}from"zod";import{z as de}from"zod";var Vf=ft.object({appUrl:ft.string(),preconditionsUrl:ft.string(),projectId:ft.string(),webhookSecret:ft.string()});var nN=de.object({preconditions:de.array(de.string().min(1))}),rN=de.object({data:de.record(de.string(),de.record(de.string(),de.string())),preconditions:de.array(de.string().min(1))});function Ls(e){let t=[];return e.tests.forEach(n=>{let r=Wf(n),o=a=>{t.push({...a,test:n.slug})};sy.forEach(a=>{a(r,n,o)})}),{diagnostics:t}}function Wf(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 qf(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 Ff(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Kf(o.value)){let a=o.value.value;!Yf(a)&&Qf(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 Mf(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 zf(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 Jf(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 Xf(e,t,n){let r=0;e.forEach(o=>{ze(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 Hf(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!ze(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 Gf(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Kf(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Yf(e){return e.includes("{{")}function Qf(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function ze(e){return e.type.startsWith("assert")}var Zf=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function ey(e){return Zf.has(e.type)}function ty(e,t,n){!t.implemented||e.length===0||e.some(r=>ze(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function ny(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(a=>ze(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 Vr(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 ry(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let a=Vr(r);if(a==null)return;let i=e.slice(o+1,o+4);i.find(c=>c.type==="assertVisible"&&Vr(c)===a)==null||i.some(c=>ey(c)||ze(c)&&Vr(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 oy=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 Wr(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!oy.has(t))}function ay(e){let t=e.label==null?[]:Wr(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,...Wr(r)]}function iy(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(Wr(t.expectedOutcome));if(r.size===0)return;let o=e.filter(i=>ze(i));if(o.length===0)return;o.some(i=>ay(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 sy=[qf,Ff,Mf,zf,Jf,Xf,Hf,Gf,ty,ny,ry,iy];je();fe();async function vs(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await V(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
390
- `),process.exit(1)),await Ae({cwd:r,result:o.result});let a=Ls(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(`
391
- ${m}
392
- `),d.forEach(h=>{let S=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${S}
480
+ `),a.forEach((s,c)=>{process.stdout.write(` ${String(s)}x: ${c}
481
+ `)})),process.exit(i>0?1:0)}import go from"fs";import cl from"path";import*as dl from"remeda";Jn();Wt();var ll=Ko(Yr(),1);import{z as Te}from"zod";import{z as ye}from"zod";var uo=["src/**","app/**","apps/**","pages/**","routes/**","components/**"],mo=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md"],Ig=Te.object({appUrl:Te.string(),ignorePaths:Te.array(Te.string()).optional(),preconditionsUrl:Te.string(),projectId:Te.string(),watchPaths:Te.array(Te.string()).optional(),webhookSecret:Te.string()});var FL=ye.object({preconditions:ye.array(ye.string().min(1))}),HL=ye.object({data:ye.record(ye.string(),ye.record(ye.string(),ye.string())),preconditions:ye.array(ye.string().min(1))});function lt(e){let t=[];return e.tests.forEach(n=>{let r=_g(n),o=i=>{t.push({...i,test:n.slug})};eh.forEach(i=>{i(r,n,o)})}),{diagnostics:t}}function _g(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 Ug(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 jg(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Fg(o.value)){let i=o.value.value;!Hg(i)&&Mg(i)&&n({message:`fill() uses hardcoded value "${i}" \u2014 consider using precondition data via {{namespace.key}}`,rule:"no-hardcoded-data",step:o.label??o.id})}})}function $g(e,t,n){if(Object.keys(t.spec.variables??{}).length===0)return;e.some(i=>JSON.stringify(i).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 Dg(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 Bg(e,t,n){let r=new Map;e.forEach(o=>{if(o.label==null)return;let i=r.get(o.label);i==null?r.set(o.label,o.id):n({message:`Duplicate label "${o.label}" \u2014 also used by ${i}`,rule:"no-duplicate-labels",step:o.label})})}function Vg(e,t,n){let r=0;e.forEach(o=>{ct(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 Wg(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!ct(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 qg(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Fg(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Hg(e){return e.includes("{{")}function Mg(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function ct(e){return e.type.startsWith("assert")}var Jg=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function zg(e){return Jg.has(e.type)}function Xg(e,t,n){!t.implemented||e.length===0||e.some(r=>ct(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Gg(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(i=>ct(i)).length;if(r===0)return;let o=r/e.length;if(o<.15){let i=Math.round(o*100);n({message:`Only ${String(r)}/${String(e.length)} steps are assertions (${String(i)}%) \u2014 add more verification between actions`,rule:"low-assertion-ratio",step:void 0})}}function fo(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 Kg(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let i=fo(r);if(i==null)return;let a=e.slice(o+1,o+4);a.find(c=>c.type==="assertVisible"&&fo(c)===i)==null||a.some(c=>zg(c)||ct(c)&&fo(c)!==i)||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 Qg=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 yo(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!Qg.has(t))}function Yg(e){let t=e.label==null?[]:yo(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,...yo(r)]}function Zg(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(yo(t.expectedOutcome));if(r.size===0)return;let o=e.filter(a=>ct(a));if(o.length===0)return;o.some(a=>Yg(a).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 eh=[Ug,jg,$g,Dg,Bg,Vg,Wg,qg,Xg,Gg,Kg,Zg];xe();X();async function pl(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await O(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
482
+ `),process.exit(1)),await pe({cwd:r,result:o.result});let i=lt(o.result),a=t.length===0?i.diagnostics:i.diagnostics.filter(d=>t.includes(d.test)),l=dl.groupBy(a,d=>d.test);Object.entries(l).forEach(([d,f])=>{process.stderr.write(`
483
+ ${d}
484
+ `),f.forEach(h=>{let S=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${S}
393
485
  `),process.stderr.write(` ${h.message}
394
486
  `)})});let s=new Set(o.builder.getUnimplemented().tests),c=n.filter(d=>s.has(d));c.length>0&&(process.stderr.write(`
395
487
  not-implemented
396
488
  `),c.forEach(d=>{process.stderr.write(` ${d} is still marked .notImplemented()
397
- `)}));let p=dy(r);p.length>0&&(process.stderr.write(`
489
+ `)}));let p=rh(r);p.length>0&&(process.stderr.write(`
398
490
  preconditions
399
491
  `),p.forEach(d=>{process.stderr.write(` [hardcoded-identifier] ${d.file}
400
492
  `),process.stderr.write(` ${d.message}
401
- `)}));let u=i.length+c.length+p.length;u>0&&(process.stderr.write(`
493
+ `)}));let u=a.length+c.length+p.length;u>0&&(process.stderr.write(`
402
494
  ${String(u)} error(s)
403
- `),process.exit(1))}var ly=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,cy=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function dy(e){let t=Cs.join(e,".ripplo","preconditions");return qr.existsSync(t)?qr.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>py(Cs.join(t,r))):[]}function py(e){let t=qr.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=ly.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=cy.exec(t);return a!=null&&!n&&r.push({file:e,message:`hardcoded UUID-like literal ${a[0]} \u2014 use ctx.uniqueId() so parallel runs don't collide`}),r}async function xs(e){let t=await Qt();await Zt(t);let{results:n,summary:r}=await Gt({config:t,ids:e});process.stdout.write(`${r}
404
- `);let o=n.some(a=>a.summary.includes("FAILED")||a.summary.includes("ERROR"));process.exit(o?1:0)}fe();async function Ps(e){let t=process.cwd(),n=await V(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
495
+ `),process.exit(1))}var th=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,nh=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function rh(e){let t=cl.join(e,".ripplo","preconditions");return go.existsSync(t)?go.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>oh(cl.join(t,r))):[]}function oh(e){let t=go.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=th.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 i=nh.exec(t);return i!=null&&!n&&r.push({file:e,message:`hardcoded UUID-like literal ${i[0]} \u2014 use ctx.uniqueId() so parallel runs don't collide`}),r}async function ul(e){let t=await be();await Re(t);let{results:n,summary:r}=await gn({config:t,ids:e});process.stdout.write(`${r}
496
+ `);let o=n.some(i=>i.summary.includes("FAILED")||i.summary.includes("ERROR"));process.exit(o?1:0)}J();import{graphql as xt}from"gql.tada";var ih=xt(`
497
+ query ScopeStatus($projectId: String!) {
498
+ project(id: $projectId) {
499
+ id
500
+ devSession {
501
+ id
502
+ scopeItems {
503
+ id
504
+ label
505
+ source
506
+ workflow {
507
+ id
508
+ slug
509
+ name
510
+ spec
511
+ }
512
+ }
513
+ }
514
+ }
515
+ }
516
+ `),ah=xt(`
517
+ query ScopeWorkflowBySlug($projectId: String!, $slug: String!) {
518
+ project(id: $projectId) {
519
+ id
520
+ devSession {
521
+ id
522
+ workflows(where: { slug: $slug }) {
523
+ id
524
+ slug
525
+ }
526
+ }
527
+ }
528
+ }
529
+ `),sh=xt(`
530
+ mutation ScopeAdd($projectId: String!, $workflowId: String!) {
531
+ addScopeItem(projectId: $projectId, source: AGENT, workflowId: $workflowId) {
532
+ id
533
+ }
534
+ }
535
+ `),lh=xt(`
536
+ mutation ScopeLink($id: ID!, $workflowId: String!) {
537
+ linkScopeItem(id: $id, workflowId: $workflowId) {
538
+ id
539
+ }
540
+ }
541
+ `),ch=xt(`
542
+ mutation ScopeRemove($id: ID!) {
543
+ removeScopeItem(id: $id)
544
+ }
545
+ `);async function ml(e){let t=await be();await Re(t);let r=(await U({config:t,document:ih,variables:{projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(r,null,2)}
546
+ `);return}if(r.length===0){process.stdout.write("No scope items. Add via `ripplo scope add <test-id>` or from the dashboard.\n");return}r.forEach(o=>{let i=o.workflow;if(i==null){process.stdout.write(` [intent] (${o.id}) ${o.label??""}
547
+ `);return}let a=i.spec==null?"stub":"implemented";process.stdout.write(` [${a}] (${o.id}) ${i.slug} \u2014 ${i.name}
548
+ `)})}async function fl({testId:e}){let t=await be();await Re(t);let n=await hl({cfg:t,slug:e}),r=await U({config:t,document:sh,variables:{projectId:t.projectId,workflowId:n}});process.stdout.write(`Added scope item ${r.addScopeItem?.id??"?"}
549
+ `)}async function yl({id:e,testId:t}){let n=await be();await Re(n);let r=await hl({cfg:n,slug:t});await U({config:n,document:lh,variables:{id:e,workflowId:r}}),process.stdout.write(`Linked scope item ${e} to ${t}
550
+ `)}async function gl({id:e}){let t=await be();await Re(t),await U({config:t,document:ch,variables:{id:e}}),process.stdout.write(`Removed scope item ${e}
551
+ `)}async function hl({cfg:e,slug:t}){let r=(await U({config:e,document:ah,variables:{projectId:e.projectId,slug:t}})).project?.devSession?.workflows?.[0];return r==null&&(process.stderr.write(`No workflow found with id "${t}". Create a stub first via the testing DSL.
552
+ `),process.exit(1)),r.id}X();async function kl(e){let t=process.cwd(),n=await O(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
405
553
  `),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
406
- `);return}let o={tests:r.map(a=>({id:a,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
407
- `)}var Ul=Ke.resolve(Ke.dirname(uh(import.meta.url)),"..");Ol({path:Ke.join(Ul,".env.local"),quiet:!0});Ol({path:Ke.join(Ul,".env"),quiet:!0});gh();async function yh(){await mh(fh(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},async()=>{let{launchDashboard:e}=await Promise.resolve().then(()=>(uo(),El));e()}).command("run [ids..]","Run tests in parallel",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run (all if omitted)",type:"string"})},e=>xs(e.ids)).command("lint [ids..]","Compile and lint tests (all or specific ids)",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to lint (all if omitted)",type:"string"}).option("require-implemented",{array:!0,default:t,describe:"Test ids that must not be .notImplemented() \u2014 fails if any still are",type:"string"})},e=>vs({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=>Ns({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=>Co({check:e.check})).command("doctor","Check project health",()=>{},()=>ks()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Ps({format:e.format})).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}yh().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
408
- `),process.exit(1)});function gh(){let e=process.cwd(),t=_l(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
409
- `))}function _l(e){let t=Ke.dirname(e);return ph.existsSync(Ke.join(e,".ripplo"))?e:t===e?null:_l(t)}export{yh as main};
554
+ `);return}let o={tests:r.map(i=>({id:i,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
555
+ `)}import{z as Ne}from"zod";var dh=Ne.object({agent_id:Ne.string().optional(),cwd:Ne.string().optional(),hook_event_name:Ne.string().optional(),mode:Ne.string().optional(),session_id:Ne.string().optional(),tool_input:Ne.looseObject({file_path:Ne.string().optional()}).optional(),tool_name:Ne.string().optional()});async function te(){let e=await ph();if(e.trim()==="")return{};let t=JSON.parse(e);return dh.parse(t)}function ph(){return new Promise((e,t)=>{if(process.stdin.isTTY){e("");return}let n=[];process.stdin.on("data",r=>n.push(r)),process.stdin.on("end",()=>{e(Buffer.concat(n).toString("utf8"))}),process.stdin.on("error",t)})}ho();J();import yh from"fs";function gh(e){return Se(e,"hooks-paused")}function ne(e){return yh.existsSync(gh(e))?!1:wl(e)}import{execFileSync as hh}from"child_process";import{createHash as Lv}from"crypto";import ko from"process";import Rl from"picomatch";function kh(e){return Nl(["diff","--name-only","HEAD"],e).split(`
556
+ `).filter(n=>n.length>0)}function Tl({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=Rl([...n]),o=Rl([...t]);return kh(e).filter(i=>r(i)&&!o(i))}function hn(e,...t){return Nl(["diff","--name-only","HEAD","--",...t],e).split(`
557
+ `).filter(r=>r.length>0)}var Sh=ko.env.GIT_BIN!=null&&ko.env.GIT_BIN.length>0?ko.env.GIT_BIN:"git";function Ah(e){if(!(e instanceof Error)||!("status"in e))return null;let t=Reflect.get(e,"status");return typeof t=="number"?t:null}function wh(e){if(!(e instanceof Error)||!("stderr"in e))return"";let t=Reflect.get(e,"stderr");return typeof t=="string"?t:Buffer.isBuffer(t)?t.toString("utf8"):""}function Nl(e,t){try{return hh(Sh,[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch(n){let r=Ah(n);if(r==null||r===0)return"";let o=wh(n).trim();throw new Error(`git ${e.join(" ")} failed (exit ${String(r)}): ${o}`)}}X();async function kn(e){let t=await O(e);if(!t.ok)throw new Error(`resolvePaths: DSL compile failed \u2014 ${t.error}`);let n=t.builder.getConfig();return{ignorePaths:n.ignorePaths??mo,watchPaths:n.watchPaths??uo}}import bh from"fs";import Rh from"path";function me(e){return bh.existsSync(Rh.join(e,".ripplo"))}async function Cl(){await te();let e=process.cwd();if(!me(e)||!ne(e))return;let{ignorePaths:t,watchPaths:n}=await kn(e),r=Tl({cwd:e,ignoreGlobs:t,watchGlobs:n});r.length===0||hn(e,".ripplo/tests",".ripplo/preconditions").length>0||process.stderr.write(`Scope drift: ${String(r.length)} app file(s) changed with no .ripplo/tests updates. Any e2e flow these changes could affect should be in scope \u2014 \`npx ripplo scope add <test-id>\` an existing test, or stub a new one via /ripplo:create.
558
+ `)}import Ot from"fs";import Th from"os";import Ll from"path";function Je(e){process.stderr.write(`${e}
559
+ `),process.exit(2)}async function vl(){if((await te()).tool_name!=="ExitPlanMode"||!ne(process.cwd()))return;let t=Nh();if(t==null)return;let n=128*1024;if(Ot.statSync(t).size>n)return;let o=Ot.readFileSync(t,"utf8");/apps\/web|apps\/server|route|component|user flow/i.test(o)&&(/\.ripplo\/tests|Tests to implement/.test(o)||Je(`Plan touches user-facing code but cites no .ripplo/tests stubs.
560
+ Add a 'Tests to implement' section listing .notImplemented() test ids, or reference existing .ripplo/tests files.`))}function Nh(){let e=Ll.join(Th.homedir(),".claude","plans");return Ot.existsSync(e)?Ot.readdirSync(e).filter(n=>n.endsWith(".md")).map(n=>Ll.join(e,n)).map(n=>({full:n,mtime:Ot.statSync(n).mtimeMs})).sort((n,r)=>r.mtime-n.mtime)[0]?.full??null:null}X();async function Pl(){if((await te()).mode!=="plan")return;let t=process.cwd();if(!me(t)||!ne(t))return;let n=await O(t);if(!n.ok)return;let{tests:r}=n.builder.getUnimplemented();process.stderr.write('Scope this plan: identify which user flows it touches, then for each one either\n \u2022 add an existing test from .ripplo/tests/ to scope (`npx ripplo scope add <test-id>`) so Stop validates it still passes, or\n \u2022 stub a new `.notImplemented()` test under .ripplo/tests/ and scope add it.\nList the test ids under a "Tests to implement" section in your plan \u2014 ExitPlanMode blocks otherwise.\n'),r.length>0&&(process.stderr.write(`Existing stubs (already .notImplemented()):
561
+ `),r.forEach(o=>process.stderr.write(` ${o}
562
+ `)))}import Ch from"path";import xl from"picomatch";X();async function El(){let t=(await te()).tool_input?.file_path;if(t==null)return;let n=process.cwd();if(!me(n)||!ne(n))return;let r=Ch.relative(n,t);if(r.startsWith(".."))return;let{ignorePaths:o,watchPaths:i}=await kn(n),a=xl([...i]),l=xl([...o]);if(!a(r)||l(r))return;let s=await O(n);if(!s.ok)return;let{tests:c}=s.builder.getUnimplemented();c.length!==0&&process.stderr.write(`Reminder: .notImplemented() stubs still present \u2014 tests: ${c.join(", ")}
563
+ `)}xe();X();async function Ol(){let t=(await te()).tool_input?.file_path;if(t==null||!/\/\.ripplo\/.*\.ts$/.test(t))return;let n=process.cwd();if(!me(n)||!ne(n))return;let r=await O(n);r.ok||Je(`Compilation failed: ${r.error}`),await pe({cwd:n,result:r.result});let{diagnostics:o}=lt(r.result);if(o.length===0)return;let i=o.map(a=>{let l=a.step==null?"":` at "${a.step}"`;return` [${a.rule}]${l} ${a.test}: ${a.message}`});Je(i.join(`
564
+ `))}J();X();st();import{graphql as Lh}from"gql.tada";var vh=Lh(`
565
+ query ScopeReminder($projectId: String!) {
566
+ project(id: $projectId) {
567
+ id
568
+ devSession {
569
+ id
570
+ scopeItems {
571
+ id
572
+ label
573
+ workflow {
574
+ slug
575
+ spec
576
+ }
577
+ }
578
+ }
579
+ }
580
+ }
581
+ `);async function Il(){await te();let e=process.cwd();if(!me(e)||!ne(e))return;let t=Ae(e);if(t==null)return;let n=await O(e);if(!n.ok)return;let r={...n.result.config,ripploServerUrl:$e(),token:t},o=await U({config:r,document:vh,variables:{projectId:r.projectId}}).catch(l=>{let s=l instanceof Error?l.message:String(l);return process.stderr.write(`Scope reminder unavailable: ${s}
582
+ `),null});if(o==null)return;let i=o.project?.devSession?.scopeItems??[];if(i.length===0){process.stderr.write("Testing Scope is empty. Stub a test for any user flow you take on, then `npx ripplo scope add <test-id>`.\n");return}let a=i.map(l=>{let s=l.workflow;return s==null?` [intent] (${l.id}) ${l.label??""}`:` [${s.spec==null?"stub":"implemented"}] (${l.id}) ${s.slug}`});process.stderr.write(`Testing Scope (${String(i.length)}):
583
+ ${a.join(`
584
+ `)}
585
+ If your next change touches an existing test's user flow, \`npx ripplo scope add <test-id>\` to mark it for Stop validation. If it introduces a new flow, stub a \`.notImplemented()\` test and scope add that. Remove items the user retires.
586
+ `)}import{execFileSync as Ph}from"child_process";import xh from"path";import So from"process";xe();J();import{graphql as Eh}from"gql.tada";import{z as Sn}from"zod";X();st();var Oh=Eh(`
587
+ query ScopeEnforce($projectId: String!) {
588
+ project(id: $projectId) {
589
+ id
590
+ devSession {
591
+ id
592
+ scopeItems {
593
+ id
594
+ label
595
+ workflow {
596
+ id
597
+ slug
598
+ name
599
+ spec
600
+ }
601
+ }
602
+ }
603
+ }
604
+ }
605
+ `);async function Ul(){let e=await te();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=So.cwd();if(!me(t)||!ne(t))return;let n=Ih(t),r=await _h(t,n);r.length>0&&Je(r.join(`
606
+
607
+ `))}function Ih(e){return hn(e,".ripplo/tests").filter(t=>t.endsWith(".ts")).map(t=>xh.basename(t,".ts"))}async function _h(e,t){let n=await O(e);if(!n.ok)return[`--- Compilation failed ---
608
+ ${n.error}`];await pe({cwd:e,result:n.result});let r=await Uh(e,n),o=[...new Set([...t,...r.scopedSlugsToRun])],i=jh(n,t),a=$h(n),l=Dh(e,o);return[i,a,l,r.error].filter(s=>s!=null)}async function Uh(e,t){let n=Ae(e);if(n==null)return{error:null,scopedSlugsToRun:[]};let r={...t.result.config,ripploServerUrl:$e(),token:n},i=(await U({config:r,document:Oh,variables:{projectId:r.projectId}}).catch(()=>null))?.project?.devSession?.scopeItems??[],a=i.flatMap(c=>{let p=c.workflow;return p==null?[` [intent] ${c.label??"(no label)"} \u2014 stub a test for this flow`]:p.spec==null?[` [stub] ${p.slug} \u2014 implement \`${p.name}\``]:[]}),l=i.flatMap(c=>c.workflow?.spec==null?[]:[c.workflow.slug]);return{error:a.length===0?null:`--- Testing Scope ---
609
+ ${a.join(`
610
+ `)}
611
+
612
+ Each scope item must reach an implemented workflow, or remove it via \`npx ripplo scope remove <id>\`.`,scopedSlugsToRun:l}}function jh(e,t){let{diagnostics:n}=lt(e.result),r=new Set(e.builder.getUnimplemented().tests),o=t.filter(l=>r.has(l));if(n.length===0&&o.length===0)return null;let i=n.map(l=>{let s=l.step==null?"":` at "${l.step}"`;return` [${l.rule}]${s} ${l.test}: ${l.message}`}),a=o.map(l=>` [not-implemented] ${l} is still marked .notImplemented()`);return`--- Ripplo Lint ---
613
+ ${[...i,...a].join(`
614
+ `)}`}function $h(e){let{tests:t}=e.builder.getUnimplemented();return t.length===0?null:`--- Unimplemented stubs remain ---
615
+ tests: ${t.join(", ")}`}function Dh(e,t){if(t.length===0)return null;let n=Vh(["run",...t],e);if(n.code===0)return null;let r=n.output.split(`
616
+ `).filter(o=>/FAILED/.test(o)).join(`
617
+ `);return r.length===0?null:`--- Ripplo Run Failures (${t.join(" ")}) ---
618
+ ${r}`}var Bh=Sn.object({status:Sn.number().nullish(),stderr:Sn.unknown().optional(),stdout:Sn.unknown().optional()});function _l(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function Vh(e,t){let n=So.argv[1];if(n==null)return{code:1,output:""};try{return{code:0,output:Ph(So.execPath,[n,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(r){let o=Bh.safeParse(r);if(!o.success)return{code:1,output:""};let i=`${_l(o.data.stdout)}${_l(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}var bd=Qe.resolve(Qe.dirname(JA(import.meta.url)),"..");wd({path:Qe.join(bd,".env.local"),quiet:!0});wd({path:Qe.join(bd,".env"),quiet:!0});ZA();var Rd={"coverage-nudge":Cl,"exit-plan-gate":vl,"plan-reminder":Pl,"post-edit-flag-stubs":El,"post-edit-lint":Ol,"scope-reminder":Il,"stop-enforce":Ul};async function GA(){await zA(XA(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},KA).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=>ul(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=>pl({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=>sl({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=>ci({check:e.check})).command("doctor","Check project health",()=>{},()=>tl()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>kl({format:e.format})).command("scope <subcommand>","Manage testing scope",YA).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(Rd),demandOption:!0,type:"string"}),e=>QA(e.name)).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}async function KA(){let{redirectStdioToFile:e}=await Promise.resolve().then(()=>($l(),jl)),t=e(Qe.join(process.cwd(),".ripplo","debug","debug.log")),{launchDashboard:n}=await Promise.resolve().then(()=>(zo(),Ad));n({restoreStdio:t})}async function QA(e){let t=Rd[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
619
+ `),process.exit(1)),await t()}GA().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
620
+ `),process.exit(1)});function YA(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>ml({format:t.format})).command("add <test-id>","Bind an existing test (stub or implemented) to scope as agent intent",t=>t.positional("test-id",{demandOption:!0,describe:"Slug of an existing workflow",type:"string"}),t=>fl({testId:t["test-id"]})).command("link <id> <test-id>","Link an existing scope item to a test",t=>t.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),t=>yl({id:t.id,testId:t["test-id"]})).command("remove <id>","Remove a scope item by id",t=>t.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}),t=>gl({id:t.id})).demandCommand(1)}function ZA(){let e=process.cwd(),t=Td(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
621
+ `))}function Td(e){let t=Qe.dirname(e);return MA.existsSync(Qe.join(e,".ripplo"))?e:t===e?null:Td(t)}export{GA as main};
410
622
  /*! Bundled license information:
411
623
 
412
624
  mustache/mustache.mjs: