ripplo 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -7
  2. package/dist/index.js +221 -151
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,112 +1,112 @@
1
1
  #!/usr/bin/env node
2
- var Ec=Object.create;var In=Object.defineProperty;var Oc=Object.getOwnPropertyDescriptor;var Ic=Object.getOwnPropertyNames;var _c=Object.getPrototypeOf,Uc=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ot=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jc=(e,t)=>{for(var n in t)In(e,n,{get:t[n],enumerable:!0})},$c=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ic(t))!Uc.call(e,o)&&o!==n&&In(e,o,{get:()=>t[o],enumerable:!(r=Oc(t,o))||r.enumerable});return e};var Do=(e,t,n)=>(n=e!=null?Ec(_c(e)):{},$c(t||!e||!e.__esModule?In(n,"default",{value:e,enumerable:!0}):n,e));import _n from"fs/promises";import Un from"path";import{z as It}from"zod";import{z as Bo}from"zod";import{z as Xe}from"zod";import{z as f}from"zod";import{z as xe}from"zod";import{z as Mo}from"zod";import{z as F}from"zod";import{z as oe}from"zod";import{z as ie}from"zod";function Dn(e){return Wo({legacy:void 0,migrators:[],name:e,schemas:[]})}function Wc(e,t){let n=JSON.parse(t);return e.decode(n)}function Wo(e){return{initial:t=>jn(t,{...e,schemas:[t]}),legacy:t=>Wo({...e,legacy:t})}}function jn(e,t){return{build:()=>qc(e,t),legacy:n=>jn(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return jn(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function qc(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Fc(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Fc(e,t,n){let{data:r,version:o}=Mc(t,n),i=qo(t,r,o);return e.parse(i)}function Mc(e,t){let n=Dc.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Vc({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 qo(e,t,n){let r=e.schemas.length;if(n>r)throw new Bc({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 qo(e,a(i),n+1)}function Jo(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 $n(e){let t=Ho.encode(e);return`${JSON.stringify(t,zd(t),2)}
3
- `}async function _t({cwd:e}){let t=Un.join(e,Se),n=await Fd(t);return n==null?null:Wc(Ho,n)}async function ue({cwd:e,result:t}){let n=Jo(t),r=Un.join(e,Se);await _n.mkdir(Un.dirname(r),{recursive:!0}),await _n.writeFile(r,$n(n),"utf8")}function Ut({compiled:e,existing:t}){if(t==null)return"missing";let n=$n(Jo(e)),r=$n(t);return n===r?"match":"stale"}async function Fd(e){try{return await _n.readFile(e,"utf8")}catch(t){if(Md(t)&&t.code==="ENOENT")return null;throw t}}function Md(e){return e instanceof Error&&"code"in e}function zd(e){return function(n,r){return r===e||!Hd(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function Hd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Dc,Bc,Vc,Fo,zc,Hc,U,ut,Jc,Xc,Bn,Gc,ke,Kc,Qc,C,Vo,Yc,Zc,ed,td,nd,rd,od,id,ad,sd,ld,cd,dd,pd,ud,md,fd,yd,gd,hd,kd,Sd,Ad,wd,Rd,bd,Nd,Td,Ld,Cd,vd,xd,Pd,Ed,Od,Id,_d,Ud,zo,jd,$d,Dd,RS,bS,Se,Bd,Vd,Wd,qd,Ho,Pe=g(()=>{"use strict";Dc=It.object({__codec:It.string().min(1),data:It.unknown(),version:It.number().int().positive()}),Bc=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}},Vc=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};Fo=Xe.object({depends:Xe.array(Xe.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:Xe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Xe.array(Xe.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."),zc=xe.object({by:xe.literal("testId"),value:xe.string().min(1)}),Hc=xe.object({by:xe.literal("role"),name:xe.string().optional(),role:xe.string().min(1)}),U=xe.discriminatedUnion("by",[zc,Hc]),ut=Mo.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Jc=Mo.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Xc=F.object({type:F.literal("static"),value:F.union([F.string(),F.number(),F.boolean()])}),Bn=F.object({name:F.string().min(1),type:F.literal("variable")}),Gc=F.discriminatedUnion("type",[Xc,Bn]),ke=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.string()}),Bn]),Kc=F.discriminatedUnion("type",[F.object({type:F.literal("static"),value:F.number().int().nonnegative()}),Bn]),Qc=oe.discriminatedUnion("type",[oe.object({default:oe.string().optional(),type:oe.literal("string")}),oe.object({default:oe.number().optional(),type:oe.literal("number")}),oe.object({default:oe.boolean().optional(),type:oe.literal("boolean")}),oe.object({key:oe.string().min(1),type:oe.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()},Vo=500,Yc=f.object({...C,type:f.literal("goto"),url:ke}),Zc=f.object({...C,locator:U,type:f.literal("click")}),ed=f.object({...C,locator:U,type:f.literal("fill"),value:ke}),td=f.object({...C,locator:U,type:f.literal("select"),value:ke}),nd=f.object({...C,locator:U,type:f.literal("hover")}),rd=f.object({...C,key:f.string().min(1),locator:U.optional(),type:f.literal("press")}),od=f.object({...C,locator:U,type:f.literal("check")}),id=f.object({...C,locator:U,type:f.literal("uncheck")}),ad=f.object({...C,height:f.number().int().positive(),type:f.literal("setViewport"),width:f.number().int().positive()}),sd=f.object({...C,message:f.string().min(1),type:f.literal("fail")}),ld=f.object({...C,type:f.literal("setVariable"),value:Gc,variable:f.string().min(1)}),cd=f.object({...C,locator:U,type:f.literal("extractText"),variable:f.string().min(1)}),dd=f.object({...C,files:f.array(f.string()).min(1),locator:U,type:f.literal("upload")}),pd=f.object({...C,locator:U,type:f.literal("dblclick")}),ud=f.object({...C,source:U,target:U,type:f.literal("drag")}),md=f.object({...C,locator:U,type:f.literal("scrollIntoView")}),fd=f.object({...C,locator:U,type:f.literal("type"),value:ke}),yd=f.object({...C,locator:U,type:f.literal("focus")}),gd=f.object({...C,locator:U,type:f.literal("clear")}),hd=f.object({...C,locator:U,type:f.literal("rightClick")}),kd=f.object({...C,action:f.enum(["accept","dismiss"]),promptText:f.string().optional(),type:f.literal("handleDialog")}),Sd=f.object({...C,action:f.enum(["read","write"]),type:f.literal("clipboard"),value:ke.optional(),variable:f.string().min(1).optional()}),Ad=f.object({...C,permission:f.string().min(1),state:f.enum(["granted","prompt"]),type:f.literal("setPermission")}),wd=f.object({...C,locator:U,type:f.literal("assertVisible")}),Rd=f.object({...C,locator:U,type:f.literal("assertNotVisible")}),bd=f.object({...C,expected:ke,locator:U,operator:ut,type:f.literal("assertText")}),Nd=f.object({...C,expected:ke,operator:ut,type:f.literal("assertUrl")}),Td=f.object({...C,expected:Kc,locator:U,operator:Jc,type:f.literal("assertCount")}),Ld=f.object({...C,expected:ke,locator:U,operator:ut,type:f.literal("assertValue")}),Cd=f.object({...C,attribute:f.string().min(1),expected:ke,locator:U,operator:ut,type:f.literal("assertAttribute")}),vd=f.object({...C,locator:U,type:f.literal("assertEnabled")}),xd=f.object({...C,locator:U,type:f.literal("assertDisabled")}),Pd=f.object({...C,expected:ke,operator:ut,type:f.literal("assertTitle")}),Ed=f.object({...C,locator:U,type:f.literal("assertChecked")}),Od=f.object({...C,locator:U,type:f.literal("assertNotChecked")}),Id=f.object({...C,locator:U,type:f.literal("assertFocused")}),_d=f.object({...C,locator:U,type:f.literal("assertNotFocused")}),Ud=f.discriminatedUnion("type",[Yc,Zc,ed,td,nd,rd,od,id,wd,Rd,bd,Nd,Td,Ld,Cd,vd,xd,ad,sd,ld,cd,dd,pd,ud,md,fd,yd,gd,hd,kd,Sd,Ad,Pd,Ed,Od,Id,_d]),zo=f.object({entryNode:f.string().min(1).max(200),nodes:f.record(f.string().max(200),Ud).refine(e=>Object.keys(e).length<=Vo,`Workflow has more than ${String(Vo)} nodes`),variableNamespaces:f.record(f.string().max(200),f.string().max(500)).optional(),variables:f.record(f.string().max(200),Qc).optional()}),jd=Bo.record(Bo.string().max(200),Fo),$d={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Dd={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},RS=Dn("workflow-spec").legacy($d).initial(zo).build(),bS=Dn("precondition-map").legacy(Dd).initial(jd).build(),Se=".ripplo/ripplo.lock",Bd=5e3,Vd=ie.record(ie.string().max(200),ie.string().max(200)),Wd=ie.object({expectedOutcome:ie.string().max(2e3),name:ie.string().max(200),preconditions:ie.array(ie.string().max(200)).max(1e3),requiresKeys:Vd,slug:ie.string().max(200),spec:zo}),qd=ie.object({preconditions:ie.record(ie.string().max(200),Fo),tests:ie.array(Wd).max(Bd)}),Ho=Dn("ripplo-lockfile").initial(qd).build()});function Xo(e){return e.data}function Go(e){return{as(t){return{data:{label:t,node:e}}}}}var jt=g(()=>{"use strict"});function $t(e){let t=e.getPreconditions(),n=e.getTests();Jd(n);let r={};t.forEach(i=>{r[i.name]={depends:[...i.dependsOn],description:i.description,returns:[...i.returns]}});let o=n.map(i=>Xd(i,t));return{config:e.getConfig(),preconditions:r,tests:o}}function Jd(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 Xd(e,t){let n=e.id,{accessedKeys:r,vars:o}=Kd(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),l=i==null?a:[Gd(i),...a],s=Qd(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=Zd(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 Gd(e){return Go({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function Kd(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 Qd(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]=Yd(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 Yd(e,t,n){let{label:r,node:o}=Xo(e);return{...o,id:t,label:r,next:n}}function Zd(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 Vn=g(()=>{"use strict";jt()});var Ko=g(()=>{"use strict";Vn();jt()});import ep from"path";import{createJiti as tp}from"jiti";async function O(e){let t=ep.join(e,".ripplo","index.ts");try{let r=await tp(import.meta.url,{moduleCache:!1}).import(t),i=r!=null&&typeof r=="object"&&"default"in r?r.default:r,a=$t(i);return{builder:i,ok:!0,result:a}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var J=g(()=>{"use strict";Ko()});function qn(e){return typeof e=="function"}function rp(e){return Ke(e)?"array":typeof e}function Wn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Yo(e,t){return e!=null&&typeof e=="object"&&t in e}function op(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function ap(e,t){return ip.call(e,t)}function lp(e){return!ap(sp,e)}function dp(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return cp[n]})}function yp(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,m;function h(L){if(typeof L=="string"&&(L=L.split(up,2)),!Ke(L)||L.length!==2)throw new Error("Invalid tags: "+L);u=new RegExp(Wn(L[0])+"\\s*"),d=new RegExp("\\s*"+Wn(L[1])),m=new RegExp("\\s*"+Wn("}"+L[1]))}h(t||me.tags);for(var S=new ft(e),k,A,w,P,E,N;!S.eos();){if(k=S.pos,w=S.scanUntil(u),w)for(var $=0,x=w.length;$<x;++$)P=w.charAt($),lp(P)?(i.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(a=!0,A=S.scan(fp)||"name",S.scan(pp),A==="="?(w=S.scanUntil(Zo),S.scan(Zo),S.scanUntil(d)):A==="{"?(w=S.scanUntil(m),S.scan(mp),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 hp(gp(o))}function gp(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 hp(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 ft(e){this.string=e,this.tail=e,this.pos=0}function Ge(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 np,Ke,ip,sp,cp,pp,up,Zo,mp,fp,me,mt,ei,ti=g(()=>{"use strict";np=Object.prototype.toString,Ke=Array.isArray||function(t){return np.call(t)==="[object Array]"};ip=RegExp.prototype.test;sp=/\S/;cp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};pp=/\s*/,up=/\s+/,Zo=/\s*=/,mp=/\s*\}/,fp=/#|\^|\/|>|\{|&|=|!/;ft.prototype.eos=function(){return this.tail===""};ft.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};ft.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};Ge.prototype.push=function(t){return new Ge(t,this)};Ge.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=Yo(i,a[l])||op(i,a[l])),i=i[a[l++]];else i=o.view[t],s=Yo(o.view,t);if(s){r=i;break}o=o.parent}n[t]=r}return qn(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||me.tags).join(":"),i=typeof r<"u",a=i?r.get(o):void 0;return a==null&&(a=yp(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 Ge?n:new Ge(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(Ke(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(qn(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||Ke(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(`
2
+ var Ud=Object.create;var Wn=Object.defineProperty;var jd=Object.getOwnPropertyDescriptor;var $d=Object.getOwnPropertyNames;var Bd=Object.getPrototypeOf,Dd=Object.prototype.hasOwnProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yo=(e,t)=>{for(var n in t)Wn(e,n,{get:t[n],enumerable:!0})},Vd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $d(t))!Dd.call(e,o)&&o!==n&&Wn(e,o,{get:()=>t[o],enumerable:!(r=jd(t,o))||r.enumerable});return e};var Zo=(e,t,n)=>(n=e!=null?Ud(Bd(e)):{},Vd(t||!e||!e.__esModule?Wn(n,"default",{value:e,enumerable:!0}):n,e));import Fn from"fs/promises";import Mn from"path";import{z as Dt}from"zod";import{z as ei}from"zod";import{z as et}from"zod";import{z as y}from"zod";import{z as xe}from"zod";import{z as ii}from"zod";import{z as H}from"zod";import{z as ae}from"zod";import{z as qn}from"zod";import{z as Z}from"zod";function Jn(e){return ni({legacy:void 0,migrators:[],name:e,schemas:[]})}function Md(e,t){let n=JSON.parse(t);return e.decode(n)}function ni(e){return{initial:t=>Hn(t,{...e,schemas:[t]}),legacy:t=>ni({...e,legacy:t})}}function Hn(e,t){return{build:()=>Hd(e,t),legacy:n=>Hn(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Hn(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function Hd(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>zd(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function zd(e,t,n){let{data:r,version:o}=Jd(t,n),i=ri(t,r,o);return e.parse(i)}function Jd(e,t){let n=Wd.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Fd({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 ri(e,t,n){let r=e.schemas.length;if(n>r)throw new qd({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 ri(e,a(i),n+1)}function li(e){return{observers:e.observers,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 zn(e){let t=si.encode(e);return`${JSON.stringify(t,Qp(t),2)}
3
+ `}async function Vt({cwd:e}){let t=Mn.join(e,Se),n=await Gp(t);return n==null?null:Md(si,n)}async function ue({cwd:e,result:t}){let n=li(t),r=Mn.join(e,Se);await Fn.mkdir(Mn.dirname(r),{recursive:!0}),await Fn.writeFile(r,zn(n),"utf8")}function Wt({compiled:e,existing:t}){if(t==null)return"missing";let n=zn(li(e)),r=zn(t);return n===r?"match":"stale"}async function Gp(e){try{return await Fn.readFile(e,"utf8")}catch(t){if(Kp(t)&&t.code==="ENOENT")return null;throw t}}function Kp(e){return e instanceof Error&&"code"in e}function Qp(e){return function(n,r){return r===e||!Yp(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function Yp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Wd,qd,Fd,oi,Xd,Gd,j,ht,Kd,Qd,Xn,Yd,ge,Zd,ep,L,ti,tp,np,rp,op,ip,ap,sp,lp,cp,dp,pp,up,mp,fp,yp,gp,hp,kp,Sp,wp,Ap,bp,Rp,Tp,vp,Np,Cp,Lp,Pp,xp,Ep,Op,Ip,_p,Up,jp,$p,Bp,Dp,ai,Vp,Wp,qp,jA,$A,Fp,Mp,Se,Hp,zp,Jp,Xp,si,Ee=f(()=>{"use strict";Wd=Dt.object({__codec:Dt.string().min(1),data:Dt.unknown(),version:Dt.number().int().positive()}),qd=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}},Fd=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};oi=et.object({depends:et.array(et.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:et.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:et.array(et.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."),Xd=xe.object({by:xe.literal("testId"),value:xe.string().min(1)}),Gd=xe.object({by:xe.literal("role"),name:xe.string().optional(),role:xe.string().min(1)}),j=xe.discriminatedUnion("by",[Xd,Gd]),ht=ii.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Kd=ii.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Qd=H.object({type:H.literal("static"),value:H.union([H.string(),H.number(),H.boolean()])}),Xn=H.object({name:H.string().min(1),type:H.literal("variable")}),Yd=H.discriminatedUnion("type",[Qd,Xn]),ge=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.string()}),Xn]),Zd=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.number().int().nonnegative()}),Xn]),ep=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")})]),L={id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),uiOnly:y.boolean().optional()},ti=500,tp=y.object({...L,type:y.literal("goto"),url:ge}),np=y.object({...L,locator:j,type:y.literal("click")}),rp=y.object({...L,locator:j,type:y.literal("fill"),value:ge}),op=y.object({...L,locator:j,type:y.literal("select"),value:ge}),ip=y.object({...L,locator:j,type:y.literal("hover")}),ap=y.object({...L,key:y.string().min(1),locator:j.optional(),type:y.literal("press")}),sp=y.object({...L,locator:j,type:y.literal("check")}),lp=y.object({...L,locator:j,type:y.literal("uncheck")}),cp=y.object({...L,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),dp=y.object({...L,message:y.string().min(1),type:y.literal("fail")}),pp=y.object({...L,type:y.literal("setVariable"),value:Yd,variable:y.string().min(1)}),up=y.object({...L,locator:j,type:y.literal("extractText"),variable:y.string().min(1)}),mp=y.object({...L,files:y.array(y.string()).min(1),locator:j,type:y.literal("upload")}),fp=y.object({...L,locator:j,type:y.literal("dblclick")}),yp=y.object({...L,source:j,target:j,type:y.literal("drag")}),gp=y.object({...L,locator:j,type:y.literal("scrollIntoView")}),hp=y.object({...L,locator:j,type:y.literal("type"),value:ge}),kp=y.object({...L,locator:j,type:y.literal("focus")}),Sp=y.object({...L,locator:j,type:y.literal("clear")}),wp=y.object({...L,locator:j,type:y.literal("rightClick")}),Ap=y.object({...L,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),bp=y.object({...L,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:ge.optional(),variable:y.string().min(1).optional()}),Rp=y.object({...L,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Tp=y.object({...L,locator:j,type:y.literal("assertVisible")}),vp=y.object({...L,locator:j,type:y.literal("assertNotVisible")}),Np=y.object({...L,expected:ge,locator:j,operator:ht,type:y.literal("assertText")}),Cp=y.object({...L,expected:ge,operator:ht,type:y.literal("assertUrl")}),Lp=y.object({...L,expected:Zd,locator:j,operator:Kd,type:y.literal("assertCount")}),Pp=y.object({...L,expected:ge,locator:j,operator:ht,type:y.literal("assertValue")}),xp=y.object({...L,attribute:y.string().min(1),expected:ge,locator:j,operator:ht,type:y.literal("assertAttribute")}),Ep=y.object({...L,locator:j,type:y.literal("assertEnabled")}),Op=y.object({...L,locator:j,type:y.literal("assertDisabled")}),Ip=y.object({...L,expected:ge,operator:ht,type:y.literal("assertTitle")}),_p=y.object({...L,locator:j,type:y.literal("assertChecked")}),Up=y.object({...L,locator:j,type:y.literal("assertNotChecked")}),jp=y.object({...L,locator:j,type:y.literal("assertFocused")}),$p=y.object({...L,locator:j,type:y.literal("assertNotFocused")}),Bp=y.object({...L,budget:y.enum(["fast","slow","async"]),observer:y.string().min(1).max(200),params:y.record(y.string().max(200),ge),type:y.literal("assertObserver")}),Dp=y.discriminatedUnion("type",[tp,np,rp,op,ip,ap,sp,lp,Tp,vp,Np,Cp,Lp,Pp,xp,Ep,Op,cp,dp,pp,up,mp,fp,yp,gp,hp,kp,Sp,wp,Ap,bp,Rp,Ip,_p,Up,jp,$p,Bp]),ai=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),Dp).refine(e=>Object.keys(e).length<=ti,`Workflow has more than ${String(ti)} nodes`),uiOnly:y.boolean().optional(),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),ep).optional()}),Vp=ei.record(ei.string().max(200),oi),Wp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},qp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},jA=Jn("workflow-spec").legacy(Wp).initial(ai).build(),$A=Jn("precondition-map").legacy(qp).initial(Vp).build(),Fp=["fast","slow","async"],Mp=qn.object({budget:qn.enum(Fp).describe("Polling budget tier: fast | slow | async"),description:qn.string().min(1).describe("Human-readable description of what this observer checks")}).describe("A named backend state observer. Tests assert against it with assert.backend(observer, params). Implementation lives on the user's server."),Se=".ripplo/ripplo.lock",Hp=5e3,zp=Z.record(Z.string().max(200),Z.string().max(200)),Jp=Z.object({expectedOutcome:Z.string().max(2e3),name:Z.string().max(200),preconditions:Z.array(Z.string().max(200)).max(1e3),requiresKeys:zp,slug:Z.string().max(200),spec:ai}),Xp=Z.object({observers:Z.record(Z.string().max(200),Mp),preconditions:Z.record(Z.string().max(200),oi),tests:Z.array(Jp).max(Hp)}),si=Jn("ripplo-lockfile").initial(Xp).build()});function ci(e){return e.data}function di(e){return{as(t){return{data:{label:t,node:e}}}}}var qt=f(()=>{"use strict"});function Ft(e){let t=e.getPreconditions(),n=e.getObservers(),r=e.getTests();Zp(r);let o={};t.forEach(s=>{o[s.name]={depends:[...s.dependsOn],description:s.description,returns:[...s.returns]}});let i={};n.forEach(s=>{i[s.name]={budget:s.budget,description:s.description}});let a=r.map(s=>eu(s,t));return{config:e.getConfig(),observers:i,preconditions:o,tests:a}}function Zp(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 eu(e,t){let n=e.id,{accessedKeys:r,vars:o}=nu(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),s=i==null?a:[tu(i),...a],l=ru(s,r,e.requiresKeys,e.uiOnly),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=iu(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:l,warnings:c}}function tu(e){return di({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function nu(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 ru(e,t,n,r){let o={};e.forEach((s,l)=>{let c=`step-${String(l)}`,d=l<e.length-1?`step-${String(l+1)}`:void 0;o[c]=ou(s,c,d)});let i={};t.forEach(s=>{i[s]={default:`test-${s}`,type:"string"}});let a={...n};return{entryNode:"step-0",nodes:o,uiOnly:r,variableNamespaces:a,variables:i}}function ou(e,t,n){let{label:r,node:o}=ci(e);return{...o,id:t,label:r,next:n}}function iu(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(s=>{i(s)}),r.push(a))}return e.forEach(a=>{i(a)}),r}var Gn=f(()=>{"use strict";qt()});var pi=f(()=>{"use strict";Gn();qt()});import au from"path";import{createJiti as su}from"jiti";function cu(e){return e==null||typeof e!="object"?!1:lu.every(t=>typeof Reflect.get(e,t)=="function")}function du(e){return e===null?"null":Array.isArray(e)?"array":typeof e}async function O(e){let t=au.join(e,".ripplo","index.ts");try{let r=await su(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!cu(o))return{error:`${t} must default-export a RipploBuilder (got ${du(o)})`,ok:!1};let i=Ft(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var lu,K=f(()=>{"use strict";pi();lu=["getConfig","getObservers","getPreconditions","getTests","getUnimplemented","implementObserver","implementPrecondition","observer","precondition","test"]});function Qn(e){return typeof e=="function"}function uu(e){return nt(e)?"array":typeof e}function Kn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function mi(e,t){return e!=null&&typeof e=="object"&&t in e}function mu(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function yu(e,t){return fu.call(e,t)}function hu(e){return!yu(gu,e)}function Su(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return ku[n]})}function Tu(e,t){if(!e)return[];var n=!1,r=[],o=[],i=[],a=!1,s=!1,l="",c=0;function d(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var u,p,m;function h(C){if(typeof C=="string"&&(C=C.split(Au,2)),!nt(C)||C.length!==2)throw new Error("Invalid tags: "+C);u=new RegExp(Kn(C[0])+"\\s*"),p=new RegExp("\\s*"+Kn(C[1])),m=new RegExp("\\s*"+Kn("}"+C[1]))}h(t||me.tags);for(var S=new St(e),k,w,b,v,x,T;!S.eos();){if(k=S.pos,b=S.scanUntil(u),b)for(var $=0,E=b.length;$<E;++$)v=b.charAt($),hu(v)?(i.push(o.length),l+=v):(s=!0,n=!0,l+=" "),o.push(["text",v,k,k+1]),k+=1,v===`
4
+ `&&(d(),l="",c=0,n=!1);if(!S.scan(u))break;if(a=!0,w=S.scan(Ru)||"name",S.scan(wu),w==="="?(b=S.scanUntil(fi),S.scan(fi),S.scanUntil(p)):w==="{"?(b=S.scanUntil(m),S.scan(bu),S.scanUntil(p),w="&"):b=S.scanUntil(p),!S.scan(p))throw new Error("Unclosed tag at "+S.pos);if(w==">"?x=[w,b,k,S.pos,l,c,n]:x=[w,b,k,S.pos],c++,o.push(x),w==="#"||w==="^")r.push(x);else if(w==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+b+'" at '+k);if(T[1]!==b)throw new Error('Unclosed section "'+T[1]+'" at '+k)}else w==="name"||w==="{"||w==="&"?s=!0:w==="="&&h(b)}if(d(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+S.pos);return Nu(vu(o))}function vu(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 Nu(e){for(var t=[],n=t,r=[],o,i,a=0,s=e.length;a<s;++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 St(e){this.string=e,this.tail=e,this.pos=0}function tt(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function ee(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var pu,nt,fu,gu,ku,wu,Au,fi,bu,Ru,me,kt,yi,gi=f(()=>{"use strict";pu=Object.prototype.toString,nt=Array.isArray||function(t){return pu.call(t)==="[object Array]"};fu=RegExp.prototype.test;gu=/\S/;ku={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};wu=/\s*/,Au=/\s+/,fi=/\s*=/,bu=/\s*\}/,Ru=/#|\^|\/|>|\{|&|=|!/;St.prototype.eos=function(){return this.tail===""};St.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};St.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};tt.prototype.push=function(t){return new tt(t,this)};tt.prototype.lookup=function(t){var n=this.cache,r;if(n.hasOwnProperty(t))r=n[t];else{for(var o=this,i,a,s,l=!1;o;){if(t.indexOf(".")>0)for(i=o.view,a=t.split("."),s=0;i!=null&&s<a.length;)s===a.length-1&&(l=mi(i,a[s])||mu(i,a[s])),i=i[a[s++]];else i=o.view[t],l=mi(o.view,t);if(l){r=i;break}o=o.parent}n[t]=r}return Qn(r)&&(r=r.call(this.view)),r};ee.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};ee.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||me.tags).join(":"),i=typeof r<"u",a=i?r.get(o):void 0;return a==null&&(a=Tu(t,n),i&&r.set(o,a)),a};ee.prototype.render=function(t,n,r,o){var i=this.getConfigTags(o),a=this.parse(t,i),s=n instanceof tt?n:new tt(n,void 0);return this.renderTokens(a,s,r,t,o)};ee.prototype.renderTokens=function(t,n,r,o,i){for(var a="",s,l,c,d=0,u=t.length;d<u;++d)c=void 0,s=t[d],l=s[0],l==="#"?c=this.renderSection(s,n,r,o,i):l==="^"?c=this.renderInverted(s,n,r,o,i):l===">"?c=this.renderPartial(s,n,r,i):l==="&"?c=this.unescapedValue(s,n):l==="name"?c=this.escapedValue(s,n,i):l==="text"&&(c=this.rawValue(s)),c!==void 0&&(a+=c);return a};ee.prototype.renderSection=function(t,n,r,o,i){var a=this,s="",l=n.lookup(t[1]);function c(p){return a.render(p,n,r,i)}if(l){if(nt(l))for(var d=0,u=l.length;d<u;++d)s+=this.renderTokens(t[4],n.push(l[d]),r,o,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")s+=this.renderTokens(t[4],n.push(l),r,o,i);else if(Qn(l)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(n.view,o.slice(t[3],t[5]),c),l!=null&&(s+=l)}else s+=this.renderTokens(t[4],n,r,o,i);return s}};ee.prototype.renderInverted=function(t,n,r,o,i){var a=n.lookup(t[1]);if(!a||nt(a)&&a.length===0)return this.renderTokens(t[4],n,r,o,i)};ee.prototype.indentPartial=function(t,n,r){for(var o=n.replace(/[^ \t]/g,""),i=t.split(`
5
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=qn(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)||me.escape,i=n.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===me.escape?String(i):o(i)};Q.prototype.rawValue=function(t){return t[1]};Q.prototype.getConfigTags=function(t){return Ke(t)?t:t&&typeof t=="object"?t.tags:void 0};Q.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Ke(t))return t.escape};me={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){mt.templateCache=e},get templateCache(){return mt.templateCache}},mt=new Q;me.clearCache=function(){return mt.clearCache()};me.parse=function(t,n){return mt.parse(t,n)};me.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+rp(t)+'" was given as the first argument for mustache#render(template, view, partials)');return mt.render(t,n,r,o)};me.escape=dp;me.Scanner=ft;me.Context=Ge;me.Writer=Q;ei=me});function yt({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Sp({def:n,name:t})]))}function Sp({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??kp[e.type]??""}function gt({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(gt({ref:e,variables:t}));return Fn({raw:n,variables:t})}function Fn({raw:e,variables:t}){return ei.render(e,t,{},{escape:n=>n})}function Mn({ref:e,variables:t}){let n=gt({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 Qe({name:e,store:t,value:n}){return{...t,[e]:n}}var kp,Ee=g(()=>{"use strict";ti();kp={boolean:!1,number:0,string:""}});function W({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(ni(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:ni(e.name,n)})}}function ni(e,t){return t==null?e:Fn({raw:e,variables:t})}var Ye=g(()=>{"use strict";Ee()});async function ri({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 oi({node:e,page:t,timeout:n}){await W({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function ii({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 ai({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:Qe({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 li=g(()=>{"use strict";Ye();Ee()});async function zn({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 wp({node:e,page:t,timeout:n,variables:r});case"rightClick":return await oi({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 bp({node:e,page:t,timeout:n,variables:r});case"select":return Np({node:e,page:t,timeout:n,variables:r});case"type":return Tp({node:e,page:t,timeout:n,variables:r});case"press":return await Rp({node:e,page:t,timeout:n}),{variables:r};case"drag":return await ri({node:e,page:t,timeout:n}),{variables:r};case"upload":return Lp({node:e,page:t,timeout:n,variables:r});case"extractText":return Cp({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=gt({ref:e.value,variables:r});return{variables:Qe({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 ii({node:e,page:t,variables:r});case"clipboard":return ai({node:e,page:t,variables:r});case"setPermission":return await si({node:e,page:t}),{variables:r}}}async function wp({node:e,page:t,timeout:n,variables:r}){return await W({locator:e.locator,page:t,variables:r})[Ap[e.type]]({timeout:n}),{variables:r}}async function Rp({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 bp({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 Np({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 Tp({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 Lp({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 Cp({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:Qe({name:e.variable,store:r,value:o})}}var Ap,Hn=g(()=>{"use strict";li();Ye();Ee();Ap={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"}),xp(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 vp(e){return"locator"in e}async function xp(e){return(await Promise.all(e.map(n=>Pp(n)))).filter(n=>n!=null)}async function Pp(e){if(!vp(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 Dt({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(!Ep(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 Ep(e){return"locator"in e&&e.locator!=null}var ht=g(()=>{"use strict";Ye()});import{z as Op}from"zod";function b({description:e,execute:t,name:n,schema:r}){let o=Op.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 T(e){let t=e.specNode==null?[]:Dt({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 _=g(()=>{"use strict";ht()});import{z as ci}from"zod";var Ip,di,pi=g(()=>{"use strict";_();Ip=ci.object({selector:ci.string().describe("CSS selector for the checkbox or radio button")}),di=b({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:Ip,execute:async(e,t)=>{let n=performance.now(),r=await e.page.locator(t.selector).isChecked().catch(()=>!1),o=r?"passed":"failed",i=[{description:`Element ${t.selector} is checked`,detail:r?void 0:"Element is not checked",status:o}];return T({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 ui}from"zod";var _p,mi,fi=g(()=>{"use strict";_();_p=ui.object({selector:ui.string().describe("CSS selector for the element to check focus on")}),mi=b({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:_p,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 T({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 Jn}from"zod";var Up,yi,gi=g(()=>{"use strict";_();Up=Jn.object({expected:Jn.string().describe("The expected text content"),selector:Jn.string().describe("CSS selector for the element to check")}),yi=b({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Up,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 T({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 Xn}from"zod";function $p({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 jp,hi,ki=g(()=>{"use strict";_();jp=Xn.object({expected:Xn.string().describe("Expected page title or substring"),operator:Xn.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),hi=b({description:"Assert that the page title matches an expected value",name:"assert_title",schema:jp,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=$p({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 T({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 Si}from"zod";var Dp,Ai,wi=g(()=>{"use strict";_();Dp=Si.object({selector:Si.string().describe("CSS selector for the element to check")}),Ai=b({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:Dp,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 T({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 Ri}from"zod";var Bp,bi,Ni=g(()=>{"use strict";_();Bp=Ri.object({selector:Ri.string().describe("CSS selector for the checkbox to check")}),bi=b({description:"Check a checkbox matching the CSS selector",name:"check",schema:Bp,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 Ti}from"zod";var Vp,Li,Ci=g(()=>{"use strict";_();Vp=Ti.object({selector:Ti.string().describe("CSS selector for the input to clear")}),Li=b({description:"Clear the contents of an input field",name:"clear",schema:Vp,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 vi}from"zod";var Wp,xi,Pi=g(()=>{"use strict";_();Wp=vi.object({selector:vi.string().describe("CSS selector for the element to click")}),xi=b({description:"Click an element matching the CSS selector",name:"click",schema:Wp,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 Gn}from"zod";var qp,Ei,Oi=g(()=>{"use strict";_();qp=Gn.object({action:Gn.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Gn.string().optional().describe("Text to write (required for write action)")}),Ei=b({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:qp,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 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()")),i={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:i,status:"passed",stepIndex:e.stepIndex,title:"Clipboard read"})}})});import{z as Bt}from"zod";var Ii,_i,Ui=g(()=>{"use strict";Ii=Bt.object({summary:Bt.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:Bt.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.")}),_i={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:{...Bt.toJSONSchema(Ii,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Ii.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 ji}from"zod";var Fp,$i,Di=g(()=>{"use strict";_();Fp=ji.object({selector:ji.string().describe("CSS selector for the element to extract text from")}),$i=b({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:Fp,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 Kn}from"zod";var Mp,Bi,Vi=g(()=>{"use strict";_();Mp=Kn.object({selector:Kn.string().describe("CSS selector for the input element"),value:Kn.string().describe("The text to type into the element")}),Bi=b({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Mp,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 Wi}from"zod";function Hp(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var zp,qi,Fi=g(()=>{"use strict";_();zp=Wi.object({level:Wi.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),qi=b({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:zp,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=>Hp(o)).join(`
6
+ `)};ee.prototype.renderPartial=function(t,n,r,o){if(r){var i=this.getConfigTags(o),a=Qn(r)?r(t[1]):r[t[1]];if(a!=null){var s=t[6],l=t[5],c=t[4],d=a;l==0&&c&&(d=this.indentPartial(a,c,s));var u=this.parse(d,i);return this.renderTokens(u,n,r,d,o)}}};ee.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};ee.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||me.escape,i=n.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===me.escape?String(i):o(i)};ee.prototype.rawValue=function(t){return t[1]};ee.prototype.getConfigTags=function(t){return nt(t)?t:t&&typeof t=="object"?t.tags:void 0};ee.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!nt(t))return t.escape};me={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){kt.templateCache=e},get templateCache(){return kt.templateCache}},kt=new ee;me.clearCache=function(){return kt.clearCache()};me.parse=function(t,n){return kt.parse(t,n)};me.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+uu(t)+'" was given as the first argument for mustache#render(template, view, partials)');return kt.render(t,n,r,o)};me.escape=Su;me.Scanner=St;me.Context=tt;me.Writer=ee;yi=me});function wt({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Lu({def:n,name:t})]))}function Lu({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??Cu[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 te({ref:e,variables:t}){let n=String(At({ref:e,variables:t}));return Yn({raw:n,variables:t})}function Yn({raw:e,variables:t}){return yi.render(e,t,{},{escape:n=>n})}function Zn({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 rt({name:e,store:t,value:n}){return{...t,[e]:n}}var Cu,Oe=f(()=>{"use strict";gi();Cu={boolean:!1,number:0,string:""}});function q({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(hi(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:hi(e.name,n)})}}function hi(e,t){return t==null?e:Yn({raw:e,variables:t})}var ot=f(()=>{"use strict";Oe()});async function ki({node:e,page:t,timeout:n}){await q({locator:e.source,page:t,variables:void 0}).dragTo(q({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function Si({node:e,page:t,timeout:n}){await q({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function wi({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 Ai({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=te({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:rt({name:e.variable,store:n,value:r})}}async function bi({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Ri=f(()=>{"use strict";ot();Oe()});async function er({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 xu({node:e,page:t,timeout:n,variables:r});case"rightClick":return await Si({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=te({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 Ou({node:e,page:t,timeout:n,variables:r});case"select":return Iu({node:e,page:t,timeout:n,variables:r});case"type":return _u({node:e,page:t,timeout:n,variables:r});case"press":return await Eu({node:e,page:t,timeout:n}),{variables:r};case"drag":return await ki({node:e,page:t,timeout:n}),{variables:r};case"upload":return Uu({node:e,page:t,timeout:n,variables:r});case"extractText":return ju({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=At({ref:e.value,variables:r});return{variables:rt({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 wi({node:e,page:t,variables:r});case"clipboard":return Ai({node:e,page:t,variables:r});case"setPermission":return await bi({node:e,page:t}),{variables:r}}}async function xu({node:e,page:t,timeout:n,variables:r}){return await q({locator:e.locator,page:t,variables:r})[Pu[e.type]]({timeout:n}),{variables:r}}async function Eu({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await q({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Ou({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await q({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Iu({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await q({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function _u({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await q({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Uu({node:e,page:t,timeout:n,variables:r}){return await q({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function ju({node:e,page:t,timeout:n,variables:r}){let o=await q({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:rt({name:e.variable,store:r,value:o})}}var Pu,tr=f(()=>{"use strict";Ri();ot();Oe();Pu={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function Ie({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"}),Bu(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 $u(e){return"locator"in e}async function Bu(e){return(await Promise.all(e.map(n=>Du(n)))).filter(n=>n!=null)}async function Du(e){if(!$u(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 Mt({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=q({locator:e.source,page:t,variables:void 0}),i=q({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:i,type:"action"}]}if(!Vu(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=q({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function Vu(e){return"locator"in e&&e.locator!=null}var bt=f(()=>{"use strict";ot()});import{z as Wu}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=Wu.toJSONSchema(r,{target:"draft-2020-12"});return{anthropicTool:{description:e,input_schema:{...o,type:"object"},name:n},name:n,async execute(i,a){let s=r.parse(a);return{...await Promise.resolve(t(i,s)),kind:"action"}}}}async function N(e){let t=e.specNode==null?[]:Mt({node:e.specNode,page:e.page}),n=await Ie({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 _=f(()=>{"use strict";bt()});import{z as Ti}from"zod";var qu,vi,Ni=f(()=>{"use strict";_();qu=Ti.object({selector:Ti.string().describe("CSS selector for the checkbox or radio button")}),vi=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:qu,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 Ci}from"zod";var Fu,Li,Pi=f(()=>{"use strict";_();Fu=Ci.object({selector:Ci.string().describe("CSS selector for the element to check focus on")}),Li=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:Fu,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 nr}from"zod";var Mu,xi,Ei=f(()=>{"use strict";_();Mu=nr.object({expected:nr.string().describe("The expected text content"),selector:nr.string().describe("CSS selector for the element to check")}),xi=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Mu,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 rr}from"zod";function zu({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 Hu,Oi,Ii=f(()=>{"use strict";_();Hu=rr.object({expected:rr.string().describe("Expected page title or substring"),operator:rr.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),Oi=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:Hu,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=zu({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}],s=`agent-step-${String(e.stepIndex)}`,l={expected:{type:"static",value:t.expected},id:s,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:l,status:i,stepIndex:e.stepIndex,title:`Assert title ${t.operator} "${t.expected}"`})}})});import{z as _i}from"zod";var Ju,Ui,ji=f(()=>{"use strict";_();Ju=_i.object({selector:_i.string().describe("CSS selector for the element to check")}),Ui=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:Ju,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 Xu,Bi,Di=f(()=>{"use strict";_();Xu=$i.object({selector:$i.string().describe("CSS selector for the checkbox to check")}),Bi=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:Xu,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 Vi}from"zod";var Gu,Wi,qi=f(()=>{"use strict";_();Gu=Vi.object({selector:Vi.string().describe("CSS selector for the input to clear")}),Wi=R({description:"Clear the contents of an input field",name:"clear",schema:Gu,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 Fi}from"zod";var Ku,Mi,Hi=f(()=>{"use strict";_();Ku=Fi.object({selector:Fi.string().describe("CSS selector for the element to click")}),Mi=R({description:"Click an element matching the CSS selector",name:"click",schema:Ku,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 or}from"zod";var Qu,zi,Ji=f(()=>{"use strict";_();Qu=or.object({action:or.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:or.string().optional().describe("Text to write (required for write action)")}),zi=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:Qu,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 s={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:s,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 Xi,Gi,Ki=f(()=>{"use strict";Xi=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.")}),Gi={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(Xi,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Xi.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 Qi}from"zod";var Yu,Yi,Zi=f(()=>{"use strict";_();Yu=Qi.object({selector:Qi.string().describe("CSS selector for the element to extract text from")}),Yi=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:Yu,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 ir}from"zod";var Zu,ea,ta=f(()=>{"use strict";_();Zu=ir.object({selector:ir.string().describe("CSS selector for the input element"),value:ir.string().describe("The text to type into the element")}),ea=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:Zu,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 na}from"zod";function tm(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var em,ra,oa=f(()=>{"use strict";_();em=na.object({level:na.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),ra=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:em,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=>tm(o)).join(`
9
9
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
10
- ${r}`}}})});import{z as Mi}from"zod";var Qn,Jp,zi,Hi=g(()=>{"use strict";_();Qn=50,Jp=Mi.object({urlFilter:Mi.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),zi=b({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:Jp,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(-Qn),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>Qn?`
12
- (showing last ${String(Qn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${a}
13
- ${i}`}}})});import{z as Ji}from"zod";var Xp,Xi,Gi=g(()=>{"use strict";_();Xp=Ji.object({urlPattern:Ji.string().describe("Regex pattern to match the request URL")}),Xi=b({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:Xp,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}
10
+ ${r}`}}})});import{z as ia}from"zod";var ar,nm,aa,sa=f(()=>{"use strict";_();ar=50,nm=ia.object({urlFilter:ia.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),aa=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:nm,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(s=>n.test(s.url));if(r.length===0)return{specNode:void 0,stepResult:void 0,toolOutput:"No network requests recorded."};let o=r.slice(-ar),i=o.map(s=>{let l=s.statusCode==null?"pending":String(s.statusCode),c=s.responseHeaders["content-type"]??"";return`${s.method} ${l} ${s.url} [${c}]`}).join(`
11
+ `),a=r.length>ar?`
12
+ (showing last ${String(ar)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${a}
13
+ ${i}`}}})});import{z as la}from"zod";var rm,ca,da=f(()=>{"use strict";_();rm=la.object({urlPattern:la.string().describe("Regex pattern to match the request URL")}),ca=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:rm,execute:(e,t)=>{let n=new RegExp(t.urlPattern,"i"),r=e.monitor.networkEntries.filter(l=>n.test(l.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(([l,c])=>` ${l}: ${c}`).join(`
14
+ `),s=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
17
  ${a}
18
18
 
19
19
  Body:
20
- ${l}`}}})});import{z as Ki}from"zod";var Gp,Qi,Yi=g(()=>{"use strict";_();Gp=Ki.object({selector:Ki.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),Qi=b({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:Gp,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 Kp}from"zod";var Qp,Zi,ea=g(()=>{"use strict";_();Qp=Kp.object({}),Zi=b({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:Qp,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
+ ${s}`}}})});import{z as pa}from"zod";var om,ua,ma=f(()=>{"use strict";_();om=pa.object({selector:pa.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),ua=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:om,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 im}from"zod";var am,fa,ya=f(()=>{"use strict";_();am=im.object({}),fa=R({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:am,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 Yp}from"zod";var Zp,ta,na=g(()=>{"use strict";_();Zp=Yp.object({}),ta=b({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:Zp,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 sm}from"zod";var lm,ga,ha=f(()=>{"use strict";_();lm=sm.object({}),ga=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:lm,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 ra}from"zod";async function tu(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
28
+ ${n}`}}})});import{z as ka}from"zod";async function dm(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 oa(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
- ${String(n)}`}var eu,ia,aa=g(()=>{"use strict";_();eu=ra.object({type:ra.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),ia=b({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:eu,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await tu(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await oa(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await oa(e.page,"sessionStorage")]:[]].join(`
31
+ `)}`}async function Sa(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
32
+ ${String(n)}`}var cm,wa,Aa=f(()=>{"use strict";_();cm=ka.object({type:ka.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),wa=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:cm,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await dm(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await Sa(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await Sa(e.page,"sessionStorage")]:[]].join(`
33
33
 
34
- `)})})});import{z as Yn}from"zod";var nu,sa,la=g(()=>{"use strict";_();nu=Yn.object({action:Yn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:Yn.string().optional().describe("Text to enter for prompt dialogs")}),sa=b({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:nu,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 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 ca}from"zod";var ru,da,pa=g(()=>{"use strict";_();ru=ca.object({selector:ca.string().describe("CSS selector for the element to hover over")}),da=b({description:"Hover over an element matching the CSS selector",name:"hover",schema:ru,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 Zn}from"zod";var ou,ua,ma=g(()=>{"use strict";_();ou=Zn.object({permission:Zn.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:Zn.enum(["granted","prompt"]).describe("Permission state to set")}),ua=b({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:ou,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 T({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 fa}from"zod";var iu,ya,ga=g(()=>{"use strict";_();iu=fa.object({url:fa.string().describe("The URL to navigate to")}),ya=b({description:"Navigate the browser to a URL",name:"navigate",schema:iu,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 ha}from"zod";var au,ka,Sa=g(()=>{"use strict";_();au=ha.object({key:ha.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),ka=b({description:"Press a keyboard key",name:"press",schema:au,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 er}from"zod";var su,Aa,wa=g(()=>{"use strict";_();su=er.object({height:er.number().int().positive().describe("Viewport height in pixels"),width:er.number().int().positive().describe("Viewport width in pixels")}),Aa=b({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:su,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 Ra}from"zod";var lu,ba,Na=g(()=>{"use strict";_();lu=Ra.object({selector:Ra.string().describe("CSS selector for the element to right-click")}),ba=b({description:"Right-click an element to open the context menu",name:"right_click",schema:lu,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 Ta}from"zod";function du(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var cu,La,Ca=g(()=>{"use strict";_();cu=Ta.object({pattern:Ta.string().describe("Regex pattern to search console log messages")}),La=b({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:cu,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=>du(i)).join(`
34
+ `)})})});import{z as sr}from"zod";var pm,ba,Ra=f(()=>{"use strict";_();pm=sr.object({action:sr.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:sr.string().optional().describe("Text to enter for prompt dialogs")}),ba=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:pm,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 Ta}from"zod";var um,va,Na=f(()=>{"use strict";_();um=Ta.object({selector:Ta.string().describe("CSS selector for the element to hover over")}),va=R({description:"Hover over an element matching the CSS selector",name:"hover",schema:um,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 lr}from"zod";var mm,Ca,La=f(()=>{"use strict";_();mm=lr.object({permission:lr.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:lr.enum(["granted","prompt"]).describe("Permission state to set")}),Ca=R({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:mm,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 Pa}from"zod";var fm,xa,Ea=f(()=>{"use strict";_();fm=Pa.object({url:Pa.string().describe("The URL to navigate to")}),xa=R({description:"Navigate the browser to a URL",name:"navigate",schema:fm,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 Oa}from"zod";var ym,Ia,_a=f(()=>{"use strict";_();ym=Oa.object({key:Oa.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),Ia=R({description:"Press a keyboard key",name:"press",schema:ym,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 cr}from"zod";var gm,Ua,ja=f(()=>{"use strict";_();gm=cr.object({height:cr.number().int().positive().describe("Viewport height in pixels"),width:cr.number().int().positive().describe("Viewport width in pixels")}),Ua=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:gm,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 hm,Ba,Da=f(()=>{"use strict";_();hm=$a.object({selector:$a.string().describe("CSS selector for the element to right-click")}),Ba=R({description:"Right-click an element to open the context menu",name:"right_click",schema:hm,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 Va}from"zod";function Sm(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var km,Wa,qa=f(()=>{"use strict";_();km=Va.object({pattern:Va.string().describe("Regex pattern to search console log messages")}),Wa=R({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:km,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=>Sm(i)).join(`
35
35
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
36
- ${o}`}}})});import{z as va}from"zod";var pu,xa,Pa=g(()=>{"use strict";_();pu=va.object({pattern:va.string().describe("Regex pattern to search across network request URLs and response bodies")}),xa=b({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:pu,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(`
36
+ ${o}`}}})});import{z as Fa}from"zod";var wm,Ma,Ha=f(()=>{"use strict";_();wm=Fa.object({pattern:Fa.string().describe("Regex pattern to search across network request URLs and response bodies")}),Ma=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:wm,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),s=n.test(i.url)?" [URL match]":"",l=i.responseBody!=null&&n.test(i.responseBody)?" [body match]":"";return`${i.method} ${a} ${i.url}${s}${l}`}).join(`
37
37
  `);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching network entries:
38
- ${o}`}}})});import{z as Ea}from"zod";function yu({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 m=s+d+1;return`${s+d===l?">":" "} ${String(m)}: ${u}`}).join(`
39
- `);i.push(p)}),i}var uu,mu,fu,Oa,Ia=g(()=>{"use strict";_();uu=20,mu=2,fu=Ea.object({pattern:Ea.string().describe("Regex pattern to search for in the page HTML")}),Oa=b({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:fu,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
- `),o=yu({contextLines:mu,lines:r,maxResults:uu,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 za}from"zod";function Tm({contextLines:e,lines:t,maxResults:n,pattern:r}){let o=new RegExp(r,"i"),i=[];return t.forEach((a,s)=>{if(i.length>=n||!o.test(a))return;let l=Math.max(0,s-e),c=Math.min(t.length-1,s+e),d=t.slice(l,c+1).map((u,p)=>{let m=l+p+1;return`${l+p===s?">":" "} ${String(m)}: ${u}`}).join(`
39
+ `);i.push(d)}),i}var Am,bm,Rm,Ja,Xa=f(()=>{"use strict";_();Am=20,bm=2,Rm=za.object({pattern:za.string().describe("Regex pattern to search for in the page HTML")}),Ja=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:Rm,execute:async(e,t)=>{let r=(await e.page.content()).split(`
40
+ `),o=Tm({contextLines:bm,lines:r,maxResults:Am,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 tr}from"zod";var gu,_a,Ua=g(()=>{"use strict";_();gu=tr.object({selector:tr.string().describe("CSS selector for the select element"),value:tr.string().describe("The option value to select")}),_a=b({description:"Select an option from a dropdown/select element",name:"select",schema:gu,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 ja}from"zod";var hu,$a,Da=g(()=>{"use strict";_();hu=ja.object({selector:ja.string().describe("CSS selector for the checkbox to uncheck")}),$a=b({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:hu,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 kt(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 Vt(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 Vt(u);m.responseBody=`(request failed: ${d?.errorText??"unknown"})`,n.push(m)}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 Vt,nr=g(()=>{"use strict";Vt=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 Va({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:i}){let a=ku.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 rr,ku,or,Ba,Wa=g(()=>{"use strict";pi();fi();gi();ki();wi();Ni();Ci();Pi();Oi();Ui();Di();Vi();Fi();Hi();Gi();Yi();ea();na();aa();la();pa();ma();ga();Sa();wa();Na();Ca();Pa();Ia();Ua();Da();nr();rr=[ya,xi,Bi,ka,bi,$a,_a,da,Zi,Oa,Li,ba,sa,Ei,ua,Ai,yi,hi,di,mi,qi,zi,Xi,ta,Qi,ia,La,xa,Aa,$i,_i],ku=new Map(rr.map(e=>[e.name,e])),or=rr.map(e=>e.anthropicTool),Ba=rr.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
- `)});import qa from"fs";import Su from"path";import ir from"pino";function ar({filePath:e}){let t=Su.dirname(e);qa.mkdirSync(t,{recursive:!0}),qa.writeFileSync(e,"");let n=ir.destination({dest:e,sync:!0}),r=ir({level:"info"},n);R.info=r.info.bind(r),R.warn=r.warn.bind(r),R.error=r.error.bind(r),R.debug=r.debug.bind(r),R.fatal=r.fatal.bind(r),R.trace=r.trace.bind(r)}var R,Y=g(()=>{"use strict";R=ir({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Au from"@anthropic-ai/sdk";async function sr({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 Au({apiKey:"ripplo",baseURL:`${a}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":i}}),d=performance.now(),m=kt(o);await xu({baseUrl:e,page:o});let h=Nu({extraVariables:n,spec:l}),S=Lu({baseUrl:e,executedPreconditions:t,spec:l,systemPrompt:s,variables:h,workflowContext:p}),k=Cu({baseUrl:e,spec:l,variables:h}),w=[{content:vu({page:o,startUrl:k}),role:"user"}],P=[],E=[],N={findings:"",stepIndex:0,verdict:void 0};N=await Ru({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 bu({client:u,messages:w,monitor:m,onStep:r,page:o,runStartTime:d,specNodes:E,state:N,steps:P,system:S}));let $=Eu(E);return{findings:N.findings,generatedSpec:$,monitor:m,steps:P,verdict:N.verdict??"fail"}}function Ma({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Ru({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<wu;u++){R.info("Agent iteration %d",u+1);let d=await e.messages.create({max_tokens:Fa,messages:t,model:"server-controlled",system:c,tools:or}),m=await za({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:i,specNodes:a,stepIndex:p.stepIndex,steps:s});if(p=Ma({result:m,state:p}),!m.continueLoop)break}return p}async function bu({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:l,steps:s,system:c}){R.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:Fa,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:or}),u=await za({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:i,specNodes:a,stepIndex:l.stepIndex,steps:s});return Ma({result:u,state:l})}function Nu({extraVariables:e,spec:t}){let n=Tu(e,t?.variableNamespaces);return{...yt({defs:t?.variables}),...n}}function Tu(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 Lu({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:i}){let a=i==null?"":[`
42
+ `)}}})});import{z as dr}from"zod";var vm,Ga,Ka=f(()=>{"use strict";_();vm=dr.object({selector:dr.string().describe("CSS selector for the select element"),value:dr.string().describe("The option value to select")}),Ga=R({description:"Select an option from a dropdown/select element",name:"select",schema:vm,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 Qa}from"zod";var Nm,Ya,Za=f(()=>{"use strict";_();Nm=Qa.object({selector:Qa.string().describe("CSS selector for the checkbox to uncheck")}),Ya=R({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:Nm,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 Rt(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 p=new zt(u);o.set(u,p),n.push(p)}function s(u){let p=o.get(u.request());p!=null&&(o.delete(u.request()),p.applyResponse(u))}function l(u){r.push(`${u.message}
43
+ ${u.stack??""}`)}function c(u){let p=u.failure(),m=new zt(u);m.responseBody=`(request failed: ${p?.errorText??"unknown"})`,n.push(m)}e.on("console",i),e.on("request",a),e.on("response",s),e.on("pageerror",l),e.on("requestfailed",c);function d(){e.off("console",i),e.off("request",a),e.off("response",s),e.off("pageerror",l),e.off("requestfailed",c)}return{consoleEntries:t,detach:d,networkEntries:n,pageErrors:r}}var zt,pr=f(()=>{"use strict";zt=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 ts({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:i}){let a=Cm.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 ur,Cm,mr,es,ns=f(()=>{"use strict";Ni();Pi();Ei();Ii();ji();Di();qi();Hi();Ji();Ki();Zi();ta();oa();sa();da();ma();ya();ha();Aa();Ra();Na();La();Ea();_a();ja();Da();qa();Ha();Xa();Ka();Za();pr();ur=[xa,Mi,ea,Ia,Bi,Ya,Ga,va,fa,Ja,Wi,Ba,ba,zi,Ca,Ui,xi,Oi,vi,Li,ra,aa,ca,ga,ua,wa,Wa,Ma,Ua,Yi,Gi],Cm=new Map(ur.map(e=>[e.name,e])),mr=ur.map(e=>e.anthropicTool),es=ur.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
44
+ `)});import rs from"fs";import Lm from"path";import fr from"pino";function yr({filePath:e}){let t=Lm.dirname(e);rs.mkdirSync(t,{recursive:!0}),rs.writeFileSync(e,"");let n=fr.destination({dest:e,sync:!0}),r=fr({level:"info"},n);A.info=r.info.bind(r),A.warn=r.warn.bind(r),A.error=r.error.bind(r),A.debug=r.debug.bind(r),A.fatal=r.fatal.bind(r),A.trace=r.trace.bind(r)}var A,Q=f(()=>{"use strict";A=fr({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Pm from"@anthropic-ai/sdk";async function gr({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:i,serverUrl:a,spec:s,systemPrompt:l,token:c,workflowContext:d}){let u=new Pm({apiKey:"ripplo",baseURL:`${a}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":i}}),p=performance.now(),m=Rt(o);await Bm({baseUrl:e,page:o});let h=Im({extraVariables:n,spec:s}),S=Um({baseUrl:e,executedPreconditions:t,spec:s,systemPrompt:l,variables:h,workflowContext:d}),k=jm({baseUrl:e,spec:s,variables:h}),b=[{content:$m({page:o,startUrl:k}),role:"user"}],v=[],x=[],T={findings:"",stepIndex:0,verdict:void 0};T=await Em({client:u,messages:b,monitor:m,onStep:r,page:o,runStartTime:p,specNodes:x,state:T,steps:v,system:S}),T.verdict==null&&(T=await Om({client:u,messages:b,monitor:m,onStep:r,page:o,runStartTime:p,specNodes:x,state:T,steps:v,system:S}));let $=Vm(x);return{findings:T.findings,generatedSpec:$,monitor:m,steps:v,verdict:T.verdict??"fail"}}function is({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Em({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:s,steps:l,system:c}){let d=s;for(let u=0;u<xm;u++){A.info("Agent iteration %d",u+1);let p=await e.messages.create({max_tokens:os,messages:t,model:"server-controlled",system:c,tools:mr}),m=await as({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:i,specNodes:a,stepIndex:d.stepIndex,steps:l});if(d=is({result:m,state:d}),!m.continueLoop)break}return d}async function Om({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:s,steps:l,system:c}){A.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 d=await e.messages.create({max_tokens:os,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:mr}),u=await as({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:i,specNodes:a,stepIndex:s.stepIndex,steps:l});return is({result:u,state:s})}function Im({extraVariables:e,spec:t}){let n=_m(e,t?.variableNamespaces);return{...wt({defs:t?.variables}),...n}}function _m(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(([s,l])=>{r[a==null?s:`${a}.${s}`]=l})}),r}function Um({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:i}){let a=i==null?"":[`
45
45
 
46
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
- `),l=n==null?"":`
48
+ `),s=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
+ \`\`\``,l=t.map(m=>`- ${m}`).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
- ${s}
58
+ ${l}
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(`
61
- `),d=p.length===0?"":`
60
+ Do not repeat any of these steps.`,d=Object.entries(o),u=d.map(([m,h])=>`- **${m}:** ${typeof h=="object"?JSON.stringify(h):String(h)}`).join(`
61
+ `),p=d.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`,Ba,a,c,l,d,`
65
+ ## Available Tools`,es,a,c,s,p,`
66
66
  ## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
67
- `)}function Cu({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 vu({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 xu({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?(R.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function za({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,m,h;for(let k of p){let A=await Pu({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&&(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 Pu({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:i,stepIndex:a,steps:l}){try{let s=await Va({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"?(R.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),R.info(" [%d] %s \u2014 %s",a,e.name,s.stepResult.status),{nextStepIndex:a+1,summary:void 0,toolResult:c,verdict:void 0}):(R.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";R.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 Eu(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 wu,Fa,lr=g(()=>{"use strict";Wa();Y();ht();Ee();wu=50,Fa=16384});function cr({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
67
+ `)}function jm({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,s)=>{let l=n[s];return l==null?`{{${s}}}`:typeof l=="object"?JSON.stringify(l):String(l)});return i.startsWith("http")?i:`${e}${i.startsWith("/")?"":"/"}${i}`}function $m({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 Bm({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?(A.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function as({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:i,specNodes:a,stepIndex:s,steps:l}){let c=o.content.filter(k=>k.type==="text").map(k=>k.text),d=o.content.filter(k=>k.type==="tool_use");if(d.length===0)return{continueLoop:!1,newFindings:c.join(`
68
+ `),nextStepIndex:s,verdict:void 0};let u=[],p=s,m,h;for(let k of d){let w=await Dm({block:k,monitor:t,onStep:n,page:r,runStartTime:i,specNodes:a,stepIndex:p,steps:l});u.push(w.toolResult),p=w.nextStepIndex,w.verdict!=null&&(m=w.verdict,h=w.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:p,verdict:m}}async function Dm({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:i,stepIndex:a,steps:s}){try{let l=await ts({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:a}),c={content:l.toolOutput,tool_use_id:e.id,type:"tool_result"};return l.kind==="verdict"?(A.info(" [%d] %s \u2014 verdict: %s",a,e.name,l.verdict),{nextStepIndex:a,summary:l.summary,toolResult:c,verdict:l.verdict}):(l.specNode!=null&&i.push(l.specNode),l.stepResult!=null?(s.push(l.stepResult),n?.(l.stepResult),A.info(" [%d] %s \u2014 %s",a,e.name,l.stepResult.status),{nextStepIndex:a+1,summary:void 0,toolResult:c,verdict:void 0}):(A.info(" [%d] %s \u2014 info",a,e.name),{nextStepIndex:a,summary:void 0,toolResult:c,verdict:void 0}))}catch(l){let c=l instanceof Error?l.message:"Unknown error";A.error(" [%d] %s \u2014 error: %s",a,e.name,c);let d=await Ie({page:r,runStartTime:o,targets:[]}),u={annotations:d.annotations,assertions:[],detail:`Error: ${c}`,duration:0,nodeId:`agent-step-${String(a)}`,nodeType:"click",screenshotBase64:d.screenshotBase64,snapshotTimestamp:d.snapshotTimestamp,status:"failed",stepIndex:a,title:`${e.name} (error)`,url:d.url,viewportHeight:d.viewportHeight,viewportWidth:d.viewportWidth};return s.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 Vm(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 xm,os,hr=f(()=>{"use strict";ns();Q();bt();Oe();xm=50,os=16384});function kr({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.',Ou({hasSuccessCriteria:n!=null&&n.length>0}),Iu({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.',Wm({hasSuccessCriteria:n!=null&&n.length>0}),qm({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
73
73
  `)),r.join(`
74
74
 
75
- `)}function Ou({hasSuccessCriteria:e}){return e?"Base your verdict strictly on the Success Criteria defined above. A test passes ONLY if all success criteria are met, and fails if any criterion is not met. Individual step failures during exploration do not necessarily mean the test failed, but the success criteria are the ultimate authority for your verdict.":"Base your verdict on whether the workflow worked correctly. Individual step failures during exploration do not necessarily mean the test failed."}function Iu({hasOutput:e}){return e?'The `summary` parameter is the ONLY output the user will see. You MUST use the `summary` field for EXACTLY the output described in the "Output" section above \u2014 nothing else. Do not describe what you did, do not list steps, do not add a test summary. The `summary` must contain ONLY what the Output section asks for, word for word if it specifies exact text.':"Include a brief summary of what you found in the `summary` parameter."}var dr=g(()=>{"use strict"});import{execFile as _u}from"child_process";import{createRequire as Uu}from"module";import Ha from"fs";import Ja from"path";import{chromium as pr}from"playwright";async function Ie({headed:e}){R.info("Browser executable: %s",pr.executablePath());try{return await pr.launch({headless:!e})}catch(t){throw ju(t)?new Error(`Playwright browsers are not installed. Run:
75
+ `)}function Wm({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 qm({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 Sr=f(()=>{"use strict"});import{execFile as Fm}from"child_process";import{createRequire as Mm}from"module";import ss from"fs";import ls from"path";import{chromium as cs}from"playwright";async function _e({headed:e}){try{return await cs.launch({headless:!e})}catch(t){throw Hm(t)?new Error(`Playwright browsers are not installed. Run:
76
76
 
77
77
  npx playwright install chromium
78
- `):t}}async function ur(){let e=pr.executablePath();if(Ha.existsSync(e))return;R.info("Chromium not found. Installing via Playwright...");let t=Uu(import.meta.url),n=Ja.dirname(t.resolve("playwright/package.json")),r=Ja.join(n,"cli.js");if(await new Promise((o,i)=>{_u(process.execPath,[r,"install","chromium"],a=>{if(a!=null){i(new Error(`Playwright install failed: ${a.message}`));return}o()})}),!Ha.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
78
+ `):t}}async function wr(){let e=cs.executablePath();if(ss.existsSync(e))return;A.info("Chromium not found. Installing via Playwright...");let t=Mm(import.meta.url),n=ls.dirname(t.resolve("playwright/package.json")),r=ls.join(n,"cli.js");if(await new Promise((o,i)=>{Fm(process.execPath,[r,"install","chromium"],a=>{if(a!=null){i(new Error(`Playwright install failed: ${a.message}`));return}o()})}),!ss.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
79
79
 
80
80
  npx playwright install chromium
81
- `);R.info("\u2713 Chromium installed")}function ju(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var St=g(()=>{"use strict";Y()});import{mkdir as mr,writeFile as ye}from"fs/promises";import ee from"path";async function Wt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let i=ee.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await mr(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([ye(ee.join(i,"info.json"),JSON.stringify(a,null,2)),ye(ee.join(i,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),$u({context:e,page:t,stepDir:i})])}catch(i){let a=i instanceof Error?i.message:String(i);R.warn("Failed to write step debug data for step %d: %s",r,a)}}async function $u({context:e,page:t,stepDir:n}){let[r,o,i]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),Du(t),Bu({context:e,page:t})]);await Promise.all([ye(ee.join(n,"dom.html"),r),ye(ee.join(n,"accessibility-tree.txt"),o),ye(ee.join(n,"storage.json"),JSON.stringify(i,null,2))])}async function Du(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Bu({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 qt({monitor:e,runId:t,steps:n,summary:r}){try{let o=ee.join(process.cwd(),".ripplo","debug",t);await mr(o,{recursive:!0}),await Promise.all([ye(ee.join(o,"summary.txt"),Vu({steps:n,summary:r})),ye(ee.join(o,"console.log"),Wu(e.consoleEntries)),ye(ee.join(o,"network.jsonl"),qu(e.networkEntries)),ye(ee.join(o,"page-errors.log"),e.pageErrors.join(`
81
+ `);A.info("\u2713 Chromium installed")}function Hm(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var Tt=f(()=>{"use strict";Q()});import{mkdir as Ar,writeFile as he}from"fs/promises";import ne from"path";async function Jt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let i=ne.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await Ar(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([he(ne.join(i,"info.json"),JSON.stringify(a,null,2)),he(ne.join(i,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),zm({context:e,page:t,stepDir:i})])}catch(i){let a=i instanceof Error?i.message:String(i);A.warn("Failed to write step debug data for step %d: %s",r,a)}}async function zm({context:e,page:t,stepDir:n}){let[r,o,i]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),Jm(t),Xm({context:e,page:t})]);await Promise.all([he(ne.join(n,"dom.html"),r),he(ne.join(n,"accessibility-tree.txt"),o),he(ne.join(n,"storage.json"),JSON.stringify(i,null,2))])}async function Jm(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Xm({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 Xt({monitor:e,runId:t,steps:n,summary:r}){try{let o=ne.join(process.cwd(),".ripplo","debug",t);await Ar(o,{recursive:!0}),await Promise.all([he(ne.join(o,"summary.txt"),Gm({steps:n,summary:r})),he(ne.join(o,"console.log"),Km(e.consoleEntries)),he(ne.join(o,"network.jsonl"),Qm(e.networkEntries)),he(ne.join(o,"page-errors.log"),e.pageErrors.join(`
82
82
  ---
83
- `))]),R.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);R.warn("Failed to write run debug summary: %s",i)}}function Vu({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 Wu(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
- `)}function qu(e){return e.map(t=>JSON.stringify(t)).join(`
86
- `)}async function Xa({error:e,runId:t,stack:n,workflowName:r}){try{let o=ee.join(process.cwd(),".ripplo","debug",t);await mr(o,{recursive:!0});let i=n==null?e:`${e}
83
+ `))]),A.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);A.warn("Failed to write run debug summary: %s",i)}}function Gm({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 Km(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
85
+ `)}function Qm(e){return e.map(t=>JSON.stringify(t)).join(`
86
+ `)}async function ds({error:e,runId:t,stack:n,workflowName:r}){try{let o=ne.join(process.cwd(),".ripplo","debug",t);await Ar(o,{recursive:!0});let i=n==null?e:`${e}
87
87
 
88
88
  ${n}`,a=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
89
89
  ${n}`].join(`
90
- `);await Promise.all([ye(ee.join(o,"error.txt"),i),ye(ee.join(o,"summary.txt"),a)]),R.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);R.warn("Failed to write error debug artifacts: %s",i)}}var Ft=g(()=>{"use strict";Y()});async function fr({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}),m=await d.newContext({baseURL:e});t.length>0&&(await m.addCookies([...t]),R.info("Injected %d cookies from preconditions",t.length));let h=await m.newPage();try{let k=function($){s.enqueueStep($),s.flushSteps(),Wt({context:m,page:h,runId:i,stepIndex:$.stepIndex,stepResult:$})};var S=k;let A=await sr({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 P=A.steps.filter($=>$.status==="passed").length,E=A.steps.filter($=>$.status==="failed").length,N={duration:A.steps.reduce(($,x)=>$+x.duration,0),failCount:E,passCount:P,runId:i,status:w,workflowName:u.name};await qt({monitor:A.monitor,runId:i,steps:A.steps,summary:N}),R.info("Agent test complete: %d passed, %d failed",P,E),R.info(`
90
+ `);await Promise.all([he(ne.join(o,"error.txt"),i),he(ne.join(o,"summary.txt"),a)]),A.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);A.warn("Failed to write error debug artifacts: %s",i)}}var Gt=f(()=>{"use strict";Q()});async function br({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:i,serverUrl:a,spec:s,streaming:l,systemPrompt:c,token:d,workflowContext:u}){let p=await _e({headed:o}),m=await p.newContext({baseURL:e});t.length>0&&(await m.addCookies([...t]),A.info("Injected %d cookies from preconditions",t.length));let h=await m.newPage();try{let k=function($){l.enqueueStep($),l.flushSteps(),Jt({context:m,page:h,runId:i,stepIndex:$.stepIndex,stepResult:$})};var S=k;let w=await gr({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:k,page:h,runId:i,serverUrl:a,spec:s,systemPrompt:c,token:d,workflowContext:u}),b=w.verdict==="pass"?"passed":"failed";await l.complete({statusOverride:b,steps:w.steps,summary:w.findings});let v=w.steps.filter($=>$.status==="passed").length,x=w.steps.filter($=>$.status==="failed").length,T={duration:w.steps.reduce(($,E)=>$+E.duration,0),failCount:x,passCount:v,runId:i,status:b,workflowName:u.name};await Xt({monitor:w.monitor,runId:i,steps:w.steps,summary:T}),A.info("Agent test complete: %d passed, %d failed",v,x),A.info(`
91
91
  === Agent Summary ===
92
- %s`,A.findings)}finally{await d.close()}}var yr=g(()=>{"use strict";St();lr();Ft();Y()});async function gr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return At({actual:o??"",expected:e,label:"Text",operator:n})}function Mt({expected:e,operator:t,url:n}){return At({actual:n,expected:e,label:"URL",operator:t})}async function hr({expected:e,locator:t,operator:n}){let r=await t.count();return ns({actual:r,expected:e,label:"Count",operator:n})}async function kr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return At({actual:o,expected:e,label:"Value",operator:n})}async function Sr({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 Ar({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 Ga({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let i=await n.getAttribute(e,{timeout:o});return At({actual:i??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Ka({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 Qa({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 Ya({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 Za({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 es({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 ts({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 At(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Fu(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Fu({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 ns(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Mu(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Mu({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 wr=g(()=>{"use strict"});async function X({fn:e,label:t}){let n=performance.now(),r=await e();return R.info("%s: %dms",t,Math.round(performance.now()-n)),r}var Ze=g(()=>{"use strict";Y()});async function Rr({headed:e,size:t}){let n=await X({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()){R.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 rs=g(()=>{"use strict";St();Y();Ze()});import{print as zu}from"graphql";async function j(e){let t=zu(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(Hu)})}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(!Ju(i))throw new Error("Invalid GraphQL response");if(Xu(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 Ju(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function Xu(e){return Array.isArray(e.errors)&&e.errors.length>0}var Hu,wt=g(()=>{"use strict";Hu=15e3});import{readdir as Gu,rm as Ku,stat as Qu}from"fs/promises";import ab from"os";import as from"path";import{graphql as Yu}from"gql.tada";async function br({maxRuns:e}){try{let n=(await Gu(os,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let p=as.join(os,c.name),u=await Qu(p);return{dirPath:p,mtime:u.mtimeMs}})),i=o.filter(c=>r-c.mtime>is),l=o.filter(c=>r-c.mtime<=is).toSorted((c,p)=>p.mtime-c.mtime).slice(e),s=[...i,...l];if(s.length===0)return;await Promise.allSettled(s.map(c=>Ku(c.dirPath,{force:!0,recursive:!0}))),R.info("Pruned %d old debug run(s)",s.length)}catch{R.warn("Debug run pruning failed, ignoring")}}var os,is,pb,ss=g(()=>{"use strict";wt();Y();os=as.join(process.cwd(),".ripplo","debug"),is=360*60*1e3,pb=Yu(`
92
+ %s`,w.findings)}finally{await p.close()}}var Rr=f(()=>{"use strict";Tt();hr();Gt();Q()});async function Tr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return vt({actual:o??"",expected:e,label:"Text",operator:n})}function Kt({expected:e,operator:t,url:n}){return vt({actual:n,expected:e,label:"URL",operator:t})}async function vr({expected:e,locator:t,operator:n}){let r=await t.count();return ks({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 vt({actual:o,expected:e,label:"Value",operator:n})}async function Cr({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 Lr({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 ps({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let i=await n.getAttribute(e,{timeout:o});return vt({actual:i??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function us({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 ms({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 fs({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 ys({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 gs({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 hs({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 vt(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Ym(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Ym({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 ks(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Zm(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Zm({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 Pr=f(()=>{"use strict"});async function Y({fn:e,label:t}){let n=performance.now(),r=await e();return A.info("%s: %dms",t,Math.round(performance.now()-n)),r}var it=f(()=>{"use strict";Q()});async function xr({headed:e,size:t}){let n=await Y({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>_e({headed:e})))}),r=new Set,o=[];function i(){let l=n.pop();return l!=null?(r.add(l),Promise.resolve(l)):new Promise(c=>{o.push(d=>{r.add(d),c(d)})})}function a(l){if(r.delete(l),!l.isConnected()){A.warn("Released browser is disconnected, launching replacement"),_e({headed:e}).then(d=>{a(d)});return}let c=o.shift();if(c!=null){c(l);return}n.push(l)}async function s(){let l=[...n,...r];n.length=0,r.clear(),await Promise.allSettled(l.map(c=>c.close()))}return{acquire:i,closeAll:s,release:a}}var Ss=f(()=>{"use strict";Tt();Q();it()});import{print as ef}from"graphql";async function U(e){let t=ef(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(tf)})}catch(a){let s=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: ${s}`)}let i=await o.json();if(!nf(i))throw new Error("Invalid GraphQL response");if(rf(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 nf(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function rf(e){return Array.isArray(e.errors)&&e.errors.length>0}var tf,Nt=f(()=>{"use strict";tf=15e3});import{readdir as of,rm as af,stat as sf}from"fs/promises";import Av from"os";import bs from"path";import{graphql as lf}from"gql.tada";async function Er({maxRuns:e}){try{let n=(await of(ws,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let d=bs.join(ws,c.name),u=await sf(d);return{dirPath:d,mtime:u.mtimeMs}})),i=o.filter(c=>r-c.mtime>As),s=o.filter(c=>r-c.mtime<=As).toSorted((c,d)=>d.mtime-c.mtime).slice(e),l=[...i,...s];if(l.length===0)return;await Promise.allSettled(l.map(c=>af(c.dirPath,{force:!0,recursive:!0}))),A.info("Pruned %d old debug run(s)",l.length)}catch{A.warn("Debug run pruning failed, ignoring")}}var ws,As,Nv,Rs=f(()=>{"use strict";Nt();Q();ws=bs.join(process.cwd(),".ripplo","debug"),As=360*60*1e3,Nv=lf(`
93
93
  mutation RevokeCurrentCliToken {
94
94
  revokeCurrentCliToken
95
95
  }
96
- `)});async function Nr({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Zu)})}catch(t){let n=t instanceof Error?t.message:String(t);throw R.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 Zu,Tr=g(()=>{"use strict";Y();Zu=5e3});import zt from"fs";import Lr from"path";function Cr(e){return Lr.join(e,".ripplo",em)}function qe(e){let t=Cr(e);zt.existsSync(t)||zt.mkdirSync(t,{recursive:!0});let n=Lr.join(t,".gitignore");return zt.existsSync(n)||zt.writeFileSync(n,`*
98
- `),t}function Ae(e,t){return Lr.join(Cr(e),t)}var em,vr=g(()=>{"use strict";em=".local"});import xr from"fs";function we(e){let t=Ae(e,"token");if(!xr.existsSync(t))return null;let n=xr.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Pr(e,t){qe(e),xr.writeFileSync(Ae(e,"token"),t+`
99
- `)}var ls=g(()=>{"use strict";vr()});import{z as Ht}from"zod";function Gt(e){return cs({legacy:void 0,migrators:[],name:e,schemas:[]})}function cs(e){return{initial:t=>Er(t,{...e,schemas:[t]}),legacy:t=>cs({...e,legacy:t})}}function Er(e,t){return{build:()=>nm(e,t),legacy:n=>Er(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Er(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function nm(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>rm(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function rm(e,t,n){let{data:r,version:o}=om(t,n),i=ds(t,r,o);return e.parse(i)}function om(e,t){let n=tm.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Xt({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 ds(e,t,n){let r=e.schemas.length;if(n>r)throw new Jt({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 ds(e,a(i),n+1)}var tm,Jt,Xt,Or=g(()=>{"use strict";tm=Ht.object({__codec:Ht.string().min(1),data:Ht.unknown(),version:Ht.number().int().positive()}),Jt=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}},Xt=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as et}from"zod";var Ir,_r=g(()=>{"use strict";Ir=et.object({depends:et.array(et.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:et.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:et.array(et.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 im,am,I,Ur=g(()=>{"use strict";im=_e.object({by:_e.literal("testId"),value:_e.string().min(1)}),am=_e.object({by:_e.literal("role"),name:_e.string().optional(),role:_e.string().min(1)}),I=_e.discriminatedUnion("by",[im,am])});import{z as ps}from"zod";var Ue,Kt,jr=g(()=>{"use strict";Ue=ps.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Kt=ps.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as M}from"zod";var sm,$r,Qt,ae,Yt,Dr=g(()=>{"use strict";sm=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),$r=M.object({name:M.string().min(1),type:M.literal("variable")}),Qt=M.discriminatedUnion("type",[sm,$r]),ae=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),$r]),Yt=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),$r])});import{z as se}from"zod";var Zt,Br=g(()=>{"use strict";Zt=se.discriminatedUnion("type",[se.object({default:se.string().optional(),type:se.literal("string")}),se.object({default:se.number().optional(),type:se.literal("number")}),se.object({default:se.boolean().optional(),type:se.literal("boolean")}),se.object({key:se.string().min(1),type:se.literal("env")})])});import{z as y}from"zod";var v,us,lm,cm,dm,pm,um,mm,fm,ym,gm,hm,km,Sm,Am,wm,Rm,bm,Nm,Tm,Lm,Cm,vm,xm,Pm,Em,Om,Im,_m,Um,jm,$m,Dm,Bm,Vm,Wm,qm,Fm,Mm,ms,en,tn=g(()=>{"use strict";Ur();jr();Dr();Br();Ur();jr();Dr();Br();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()},us=500,lm=y.object({...v,type:y.literal("goto"),url:ae}),cm=y.object({...v,locator:I,type:y.literal("click")}),dm=y.object({...v,locator:I,type:y.literal("fill"),value:ae}),pm=y.object({...v,locator:I,type:y.literal("select"),value:ae}),um=y.object({...v,locator:I,type:y.literal("hover")}),mm=y.object({...v,key:y.string().min(1),locator:I.optional(),type:y.literal("press")}),fm=y.object({...v,locator:I,type:y.literal("check")}),ym=y.object({...v,locator:I,type:y.literal("uncheck")}),gm=y.object({...v,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),hm=y.object({...v,message:y.string().min(1),type:y.literal("fail")}),km=y.object({...v,type:y.literal("setVariable"),value:Qt,variable:y.string().min(1)}),Sm=y.object({...v,locator:I,type:y.literal("extractText"),variable:y.string().min(1)}),Am=y.object({...v,files:y.array(y.string()).min(1),locator:I,type:y.literal("upload")}),wm=y.object({...v,locator:I,type:y.literal("dblclick")}),Rm=y.object({...v,source:I,target:I,type:y.literal("drag")}),bm=y.object({...v,locator:I,type:y.literal("scrollIntoView")}),Nm=y.object({...v,locator:I,type:y.literal("type"),value:ae}),Tm=y.object({...v,locator:I,type:y.literal("focus")}),Lm=y.object({...v,locator:I,type:y.literal("clear")}),Cm=y.object({...v,locator:I,type:y.literal("rightClick")}),vm=y.object({...v,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),xm=y.object({...v,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:ae.optional(),variable:y.string().min(1).optional()}),Pm=y.object({...v,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Em=y.object({...v,locator:I,type:y.literal("assertVisible")}),Om=y.object({...v,locator:I,type:y.literal("assertNotVisible")}),Im=y.object({...v,expected:ae,locator:I,operator:Ue,type:y.literal("assertText")}),_m=y.object({...v,expected:ae,operator:Ue,type:y.literal("assertUrl")}),Um=y.object({...v,expected:Yt,locator:I,operator:Kt,type:y.literal("assertCount")}),jm=y.object({...v,expected:ae,locator:I,operator:Ue,type:y.literal("assertValue")}),$m=y.object({...v,attribute:y.string().min(1),expected:ae,locator:I,operator:Ue,type:y.literal("assertAttribute")}),Dm=y.object({...v,locator:I,type:y.literal("assertEnabled")}),Bm=y.object({...v,locator:I,type:y.literal("assertDisabled")}),Vm=y.object({...v,expected:ae,operator:Ue,type:y.literal("assertTitle")}),Wm=y.object({...v,locator:I,type:y.literal("assertChecked")}),qm=y.object({...v,locator:I,type:y.literal("assertNotChecked")}),Fm=y.object({...v,locator:I,type:y.literal("assertFocused")}),Mm=y.object({...v,locator:I,type:y.literal("assertNotFocused")}),ms=y.discriminatedUnion("type",[lm,cm,dm,pm,um,mm,fm,ym,Em,Om,Im,_m,Um,jm,$m,Dm,Bm,gm,hm,km,Sm,Am,wm,Rm,bm,Nm,Tm,Lm,Cm,vm,xm,Pm,Vm,Wm,qm,Fm,Mm]),en=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),ms).refine(e=>Object.keys(e).length<=us,`Workflow has more than ${String(us)} nodes`),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),Zt).optional()})});import{z as fs}from"zod";var zm,Hm,Jm,Vr,Xm,ys=g(()=>{"use strict";Or();_r();tn();zm=fs.record(fs.string().max(200),Ir),Hm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Jm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Vr=Gt("workflow-spec").legacy(Hm).initial(en).build(),Xm=Gt("precondition-map").legacy(Jm).initial(zm).build()});var gs=g(()=>{"use strict";tn()});var hs=g(()=>{"use strict";Or();ys();_r();tn();gs()});async function Wr({failFast:e,onStep:t,page:n,spec:r,variables:o}){let i=performance.now();return Qm({currentId:r.entryNode,failFast:e,onStep:t,page:n,runStartTime:i,spec:r,variables:o})}function Km({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Qm({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})`;R.info("Executing node: %s [%s]",d,p.type);let m=await Ym({node:p,nodeId:u,page:r,runStartTime:o,variables:s});if(Km({onStep:n,steps:[m],target:l}),s=m.variables,t&&m.status==="failed")break;c=p.next}return{steps:l,variables:s}}async function Ym({node:e,nodeId:t,page:n,runStartTime:r,variables:o}){let i=performance.now(),a=e.label??`${e.type} (${e.id})`,l=e.timeout??Gm,s=Dt({node:e,page:n});try{let c=await Zm({node:e,page:n,timeout:l,variables:o}),p=Math.round(performance.now()-i),u=c.assertions.some(m=>m.status==="failed"),d=await X({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 X({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 Zm({node:e,page:t,timeout:n,variables:r}){if(ef(e)){let i=await zn({node:e,page:t,timeout:n,variables:r});return{assertions:[],variables:i.variables}}return{assertions:await nf({node:e,page:t,timeout:n,variables:r}),variables:r}}function ef(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 tf(e){return e.type.startsWith("assert")}async function nf({node:e,page:t,timeout:n,variables:r}){if(!tf(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 of({assertNode:o,page:t,timeout:n,variables:r});case"assertText":{let i=Z({ref:o.expected,variables:r});return[await gr({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[Mt({expected:i,operator:o.operator,url:t.url()})]}case"assertTitle":{let i=Z({ref:o.expected,variables:r});return[Mt({expected:i,operator:o.operator,url:await t.title()})]}case"assertCount":{let i=Mn({ref:o.expected,variables:r});return[await hr({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 kr({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 Ga({attribute:o.attribute,expected:i,locator:W({locator:o.locator,page:t,variables:r}),operator:o.operator,timeout:n})]}}}async function of({assertNode:e,page:t,timeout:n,variables:r}){let o=rf[e.type];return[await o({locator:W({locator:e.locator,page:t,variables:r}),timeout:n})]}var Gm,rf,qr=g(()=>{"use strict";Hn();wr();Ye();Y();Ze();ht();Ee();Gm=1e4;rf={assertChecked:Ya,assertDisabled:Qa,assertEnabled:Ka,assertFocused:es,assertNotChecked:Za,assertNotFocused:ts,assertNotVisible:Ar,assertVisible:Sr}});async function Fr({baseUrl:e,browser:t,cookies:n,extraVariables:r,onStep:o,runId:i,spec:a}){let l=await t.newContext({baseURL:e});R.info("Browser context created"),n.length>0&&await l.addCookies(n);let s=await l.newPage();R.info("Page created");let c=kt(s),p=[];function u(w){o?.(w),p.push(Wt({context:l,page:s,runId:i,stepIndex:w.stepIndex,stepResult:w}))}let d=af(r,a.variableNamespaces),m={...yt({defs:a.variables}),...d};R.info("Starting graph execution (entry: %s)",a.entryNode);let h=await Wr({failFast:!0,onStep:u,page:s,spec:a,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:i,status:k>0?"failed":"passed",workflowName:""};return await qt({monitor:c,runId:i,steps:h.steps,summary:A}),await l.close(),h.steps}function af(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 Mr=g(()=>{"use strict";nr();Ft();qr();Y();Ee()});var Ss=Ot(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.timingSafeEqual=void 0;function ks(e,t=""){if(!e)throw new Error(t)}function sf(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)),ks(e instanceof DataView),ks(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}nn.timingSafeEqual=sf});var Rs=Ot(le=>{"use strict";var lf=le&&le.__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(le,"__esModule",{value:!0});var q=256,zr=(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})();le.Coder=zr;var Rt=new zr;function cf(e){return Rt.encode(e)}le.encode=cf;function df(e){return Rt.decode(e)}le.decode=df;var As=(function(e){lf(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})(zr);le.URLSafeCoder=As;var ws=new As;function pf(e){return ws.encode(e)}le.encodeURLSafe=pf;function uf(e){return ws.decode(e)}le.decodeURLSafe=uf;le.encodedLength=function(e){return Rt.encodedLength(e)};le.maxDecodedLength=function(e){return Rt.maxDecodedLength(e)};le.decodedLength=function(e){return Rt.decodedLength(e)}});var Ns=Ot((bs,rn)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof rn=="object"&&typeof rn.exports=="object"?rn.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(bs,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,$,x,L,D,We,pt,Et;S>=64;){for(k=d[0],A=d[1],w=d[2],P=d[3],E=d[4],N=d[5],$=d[6],x=d[7],D=0;D<16;D++)We=h+D*4,u[D]=(m[We]&255)<<24|(m[We+1]&255)<<16|(m[We+2]&255)<<8|m[We+3]&255;for(D=16;D<64;D++)L=u[D-2],pt=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,L=u[D-15],Et=(L>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,u[D]=(pt+u[D-7]|0)+(Et+u[D-16]|0);for(D=0;D<64;D++)pt=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&N^~E&$)|0)+(x+(t[D]+u[D]|0)|0)|0,Et=((k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10))+(k&A^k&w^A&w)|0,x=$,$=N,N=E,E=P+pt|0,P=w,w=A,A=k,k=pt+Et|0;d[0]+=k,d[1]+=A,d[2]+=w,d[3]+=P,d[4]+=E,d[5]+=N,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,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 i(u){var d=new r().update(u),m=d.digest();return d.clean(),m}e.hash=i,e.default=i;function a(u,d){var m=new o(u).update(d),h=m.digest();return m.clean(),h}e.hmac=a;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=a(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 $=N+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(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 Jr=Ot(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.Webhook=tt.WebhookVerificationError=void 0;var mf=Ss(),Ts=Rs(),ff=Ns(),Ls=300,Hr=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 Hr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};tt.WebhookVerificationError=je;var on=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"],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[m,h]=d.split(",");if(m==="v1"&&(0,mf.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,${Ts.encode(ff.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>Ls)throw new je("Message timestamp too old");if(r>n+Ls)throw new je("Message timestamp too new");return new Date(r*1e3)}};tt.Webhook=on;on.prefix="whsec_"});import Cs from"crypto";function nt({body:e,secret:t}){let n=new vs.Webhook(t),r=`msg_${Cs.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 Xr(){return`whsec_${Cs.randomBytes(24).toString("base64")}`}var vs,Gr=g(()=>{"use strict";vs=Do(Jr(),1)});import{parseSetCookie as yf}from"set-cookie-parser";import{z as ce}from"zod";async function Kr({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=Es({baseUrl:e,preconditionApiPath:t.preconditionApiPath}),l=i.preconditions;return l.length===0?{...o,apiUrl:a}:a==null?o:Ps({apiUrl:a,preconditionNames:l,webhookSecret:n})}async function Qr({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",...Af({cookies:t}),...nt({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(xs)});a.ok||R.error("Teardown returned %s",String(a.status))}catch{R.error("Teardown request failed")}}async function Ps({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",...nt({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(xs)});if(!i.ok){let c=await kf(i);throw new Error(`execute-batch returned ${String(i.status)}: ${c}`)}let a=await i.json(),l=gf.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=wf({domain:new URL(e).hostname,res:i});return R.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 kf(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=Sf(t),r=n==null?null:hf.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function Sf(e){try{return JSON.parse(e)}catch{return null}}function Af({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function wf({domain:e,res:t}){let n=t.headers.getSetCookie();return yf(n,{decodeValues:!1}).map(o=>Rf({cookie:o,domain:e}))}function Rf({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=Nf({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 Nf({raw:e}){return bf[e.toLowerCase()]??"Lax"}async function Yr({baseUrl:e,preconditionApiPath:t,preconditionNames:n,webhookSecret:r}){let o=Es({baseUrl:e,preconditionApiPath:t});return o==null||n.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:Ps({apiUrl:o,preconditionNames:n,webhookSecret:r})}function Es({baseUrl:e,preconditionApiPath:t}){if(t.length!==0)return t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`}var xs,gf,hf,bf,Zr=g(()=>{"use strict";Y();Gr();xs=3e4,gf=ce.object({data:ce.record(ce.string(),ce.record(ce.string(),ce.string())),error:ce.string().optional(),executed:ce.array(ce.string()),runId:ce.string(),success:ce.boolean()});hf=ce.object({error:ce.string()});bf={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as eo}from"gql.tada";async function to({agentProfileId:e,config:t,runId:n}){let r=await j({config:t,document:Lf,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=Tf({config:t,runResultId:o,steps:[c]}).catch(u=>{R.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 X({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});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:()=>j({config:t,document:vf,variables:{duration:h,failCount:m,passCount:d,runResultId:o,status:S,summary:u??null,warnCount:0}})})}return{complete:s,enqueueStep:a,flushSteps:l,runResultId:o}}async function Tf({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 j({config:e,document:Cf,variables:{runResultId:t,steps:r}})}var Lf,Cf,vf,no=g(()=>{"use strict";wt();Y();Ze();Lf=eo(`
96
+ `)});async function Or({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(cf)})}catch(t){let n=t instanceof Error?t.message:String(t);throw A.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 cf,Ir=f(()=>{"use strict";Q();cf=5e3});import Qt from"fs";import _r from"path";function Ur(e){return _r.join(e,".ripplo",df)}function Je(e){let t=Ur(e);Qt.existsSync(t)||Qt.mkdirSync(t,{recursive:!0});let n=_r.join(t,".gitignore");return Qt.existsSync(n)||Qt.writeFileSync(n,`*
98
+ `),t}function we(e,t){return _r.join(Ur(e),t)}var df,jr=f(()=>{"use strict";df=".local"});import $r from"fs";function Ae(e){let t=we(e,"token");if(!$r.existsSync(t))return null;let n=$r.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Br(e,t){Je(e),$r.writeFileSync(we(e,"token"),t+`
99
+ `)}var Ts=f(()=>{"use strict";jr()});import{z as Yt}from"zod";function tn(e){return vs({legacy:void 0,migrators:[],name:e,schemas:[]})}function vs(e){return{initial:t=>Dr(t,{...e,schemas:[t]}),legacy:t=>vs({...e,legacy:t})}}function Dr(e,t){return{build:()=>uf(e,t),legacy:n=>Dr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Dr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function uf(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>mf(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function mf(e,t,n){let{data:r,version:o}=ff(t,n),i=Ns(t,r,o);return e.parse(i)}function ff(e,t){let n=pf.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new en({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 Ns(e,t,n){let r=e.schemas.length;if(n>r)throw new Zt({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 Ns(e,a(i),n+1)}var pf,Zt,en,Vr=f(()=>{"use strict";pf=Yt.object({__codec:Yt.string().min(1),data:Yt.unknown(),version:Yt.number().int().positive()}),Zt=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}},en=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as at}from"zod";var Wr,qr=f(()=>{"use strict";Wr=at.object({depends:at.array(at.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:at.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:at.array(at.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 Ue}from"zod";var yf,gf,I,Fr=f(()=>{"use strict";yf=Ue.object({by:Ue.literal("testId"),value:Ue.string().min(1)}),gf=Ue.object({by:Ue.literal("role"),name:Ue.string().optional(),role:Ue.string().min(1)}),I=Ue.discriminatedUnion("by",[yf,gf])});import{z as Cs}from"zod";var je,nn,Mr=f(()=>{"use strict";je=Cs.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),nn=Cs.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z}from"zod";var hf,Hr,rn,re,on,zr=f(()=>{"use strict";hf=z.object({type:z.literal("static"),value:z.union([z.string(),z.number(),z.boolean()])}),Hr=z.object({name:z.string().min(1),type:z.literal("variable")}),rn=z.discriminatedUnion("type",[hf,Hr]),re=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.string()}),Hr]),on=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.number().int().nonnegative()}),Hr])});import{z as se}from"zod";var an,Jr=f(()=>{"use strict";an=se.discriminatedUnion("type",[se.object({default:se.string().optional(),type:se.literal("string")}),se.object({default:se.number().optional(),type:se.literal("number")}),se.object({default:se.boolean().optional(),type:se.literal("boolean")}),se.object({key:se.string().min(1),type:se.literal("env")})])});import{z as g}from"zod";var P,Ls,kf,Sf,wf,Af,bf,Rf,Tf,vf,Nf,Cf,Lf,Pf,xf,Ef,Of,If,_f,Uf,jf,$f,Bf,Df,Vf,Wf,qf,Ff,Mf,Hf,zf,Jf,Xf,Gf,Kf,Qf,Yf,Zf,ey,ty,Ps,sn,ln=f(()=>{"use strict";Fr();Mr();zr();Jr();Fr();Mr();zr();Jr();P={id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),uiOnly:g.boolean().optional()},Ls=500,kf=g.object({...P,type:g.literal("goto"),url:re}),Sf=g.object({...P,locator:I,type:g.literal("click")}),wf=g.object({...P,locator:I,type:g.literal("fill"),value:re}),Af=g.object({...P,locator:I,type:g.literal("select"),value:re}),bf=g.object({...P,locator:I,type:g.literal("hover")}),Rf=g.object({...P,key:g.string().min(1),locator:I.optional(),type:g.literal("press")}),Tf=g.object({...P,locator:I,type:g.literal("check")}),vf=g.object({...P,locator:I,type:g.literal("uncheck")}),Nf=g.object({...P,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),Cf=g.object({...P,message:g.string().min(1),type:g.literal("fail")}),Lf=g.object({...P,type:g.literal("setVariable"),value:rn,variable:g.string().min(1)}),Pf=g.object({...P,locator:I,type:g.literal("extractText"),variable:g.string().min(1)}),xf=g.object({...P,files:g.array(g.string()).min(1),locator:I,type:g.literal("upload")}),Ef=g.object({...P,locator:I,type:g.literal("dblclick")}),Of=g.object({...P,source:I,target:I,type:g.literal("drag")}),If=g.object({...P,locator:I,type:g.literal("scrollIntoView")}),_f=g.object({...P,locator:I,type:g.literal("type"),value:re}),Uf=g.object({...P,locator:I,type:g.literal("focus")}),jf=g.object({...P,locator:I,type:g.literal("clear")}),$f=g.object({...P,locator:I,type:g.literal("rightClick")}),Bf=g.object({...P,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),Df=g.object({...P,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:re.optional(),variable:g.string().min(1).optional()}),Vf=g.object({...P,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),Wf=g.object({...P,locator:I,type:g.literal("assertVisible")}),qf=g.object({...P,locator:I,type:g.literal("assertNotVisible")}),Ff=g.object({...P,expected:re,locator:I,operator:je,type:g.literal("assertText")}),Mf=g.object({...P,expected:re,operator:je,type:g.literal("assertUrl")}),Hf=g.object({...P,expected:on,locator:I,operator:nn,type:g.literal("assertCount")}),zf=g.object({...P,expected:re,locator:I,operator:je,type:g.literal("assertValue")}),Jf=g.object({...P,attribute:g.string().min(1),expected:re,locator:I,operator:je,type:g.literal("assertAttribute")}),Xf=g.object({...P,locator:I,type:g.literal("assertEnabled")}),Gf=g.object({...P,locator:I,type:g.literal("assertDisabled")}),Kf=g.object({...P,expected:re,operator:je,type:g.literal("assertTitle")}),Qf=g.object({...P,locator:I,type:g.literal("assertChecked")}),Yf=g.object({...P,locator:I,type:g.literal("assertNotChecked")}),Zf=g.object({...P,locator:I,type:g.literal("assertFocused")}),ey=g.object({...P,locator:I,type:g.literal("assertNotFocused")}),ty=g.object({...P,budget:g.enum(["fast","slow","async"]),observer:g.string().min(1).max(200),params:g.record(g.string().max(200),re),type:g.literal("assertObserver")}),Ps=g.discriminatedUnion("type",[kf,Sf,wf,Af,bf,Rf,Tf,vf,Wf,qf,Ff,Mf,Hf,zf,Jf,Xf,Gf,Nf,Cf,Lf,Pf,xf,Ef,Of,If,_f,Uf,jf,$f,Bf,Df,Vf,Kf,Qf,Yf,Zf,ey,ty]),sn=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),Ps).refine(e=>Object.keys(e).length<=Ls,`Workflow has more than ${String(Ls)} nodes`),uiOnly:g.boolean().optional(),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),an).optional()})});import{z as xs}from"zod";var ny,ry,oy,Xr,iy,Es=f(()=>{"use strict";Vr();qr();ln();ny=xs.record(xs.string().max(200),Wr),ry={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},oy={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Xr=tn("workflow-spec").legacy(ry).initial(sn).build(),iy=tn("precondition-map").legacy(oy).initial(ny).build()});import{z as Gr}from"zod";var Os,ay,Is=f(()=>{"use strict";Os=["fast","slow","async"],ay=Gr.object({budget:Gr.enum(Os).describe("Polling budget tier: fast | slow | async"),description:Gr.string().min(1).describe("Human-readable description of what this observer checks")}).describe("A named backend state observer. Tests assert against it with assert.backend(observer, params). Implementation lives on the user's server.")});var _s=f(()=>{"use strict";ln()});var Us=f(()=>{"use strict";Vr();Es();qr();Is();ln();_s()});var $s=Bt(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.timingSafeEqual=void 0;function js(e,t=""){if(!e)throw new Error(t)}function sy(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)),js(e instanceof DataView),js(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}cn.timingSafeEqual=sy});var Vs=Bt(le=>{"use strict";var ly=le&&le.__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(le,"__esModule",{value:!0});var F=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,s=0,l=0,c=0,d=0,u=0;a<r-4;a+=4)l=this._decodeChar(t.charCodeAt(a+0)),c=this._decodeChar(t.charCodeAt(a+1)),d=this._decodeChar(t.charCodeAt(a+2)),u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=l<<2|c>>>4,o[i++]=c<<4|d>>>2,o[i++]=d<<6|u,s|=l&F,s|=c&F,s|=d&F,s|=u&F;if(a<r-1&&(l=this._decodeChar(t.charCodeAt(a)),c=this._decodeChar(t.charCodeAt(a+1)),o[i++]=l<<2|c>>>4,s|=l&F,s|=c&F),a<r-2&&(d=this._decodeChar(t.charCodeAt(a+2)),o[i++]=c<<4|d>>>2,s|=d&F),a<r-3&&(u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=d<<6|u,s|=u&F),s!==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=F;return n+=(42-t&t-44)>>>8&-F+t-43+62,n+=(46-t&t-48)>>>8&-F+t-47+63,n+=(47-t&t-58)>>>8&-F+t-48+52,n+=(64-t&t-91)>>>8&-F+t-65+0,n+=(96-t&t-123)>>>8&-F+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})();le.Coder=Kr;var Ct=new Kr;function cy(e){return Ct.encode(e)}le.encode=cy;function dy(e){return Ct.decode(e)}le.decode=dy;var Bs=(function(e){ly(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=F;return r+=(44-n&n-46)>>>8&-F+n-45+62,r+=(94-n&n-96)>>>8&-F+n-95+63,r+=(47-n&n-58)>>>8&-F+n-48+52,r+=(64-n&n-91)>>>8&-F+n-65+0,r+=(96-n&n-123)>>>8&-F+n-97+26,r},t})(Kr);le.URLSafeCoder=Bs;var Ds=new Bs;function py(e){return Ds.encode(e)}le.encodeURLSafe=py;function uy(e){return Ds.decode(e)}le.decodeURLSafe=uy;le.encodedLength=function(e){return Ct.encodedLength(e)};le.maxDecodedLength=function(e){return Ct.maxDecodedLength(e)};le.decodedLength=function(e){return Ct.decodedLength(e)}});var qs=Bt((Ws,dn)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof dn=="object"&&typeof dn.exports=="object"?dn.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Ws,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,p,m,h,S){for(var k,w,b,v,x,T,$,E,C,D,ze,gt,$t;S>=64;){for(k=p[0],w=p[1],b=p[2],v=p[3],x=p[4],T=p[5],$=p[6],E=p[7],D=0;D<16;D++)ze=h+D*4,u[D]=(m[ze]&255)<<24|(m[ze+1]&255)<<16|(m[ze+2]&255)<<8|m[ze+3]&255;for(D=16;D<64;D++)C=u[D-2],gt=(C>>>17|C<<15)^(C>>>19|C<<13)^C>>>10,C=u[D-15],$t=(C>>>7|C<<25)^(C>>>18|C<<14)^C>>>3,u[D]=(gt+u[D-7]|0)+($t+u[D-16]|0);for(D=0;D<64;D++)gt=(((x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7))+(x&T^~x&$)|0)+(E+(t[D]+u[D]|0)|0)|0,$t=((k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10))+(k&w^k&b^w&b)|0,E=$,$=T,T=x,x=v+gt|0,v=b,b=w,w=k,k=gt+$t|0;p[0]+=k,p[1]+=w,p[2]+=b,p[3]+=v,p[4]+=x,p[5]+=T,p[6]+=$,p[7]+=E,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 p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},u.prototype.update=function(p,m){if(m===void 0&&(m=p.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++]=p[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,p,h,m),m%=64);m>0;)this.buffer[this.bufferLength++]=p[h++],m--;return this},u.prototype.finish=function(p){if(!this.finished){var m=this.bytesHashed,h=this.bufferLength,S=m/536870912|0,k=m<<3,w=m%64<56?64:128;this.buffer[h]=128;for(var b=h+1;b<w-8;b++)this.buffer[b]=0;this.buffer[w-8]=S>>>24&255,this.buffer[w-7]=S>>>16&255,this.buffer[w-6]=S>>>8&255,this.buffer[w-5]=S>>>0&255,this.buffer[w-4]=k>>>24&255,this.buffer[w-3]=k>>>16&255,this.buffer[w-2]=k>>>8&255,this.buffer[w-1]=k>>>0&255,n(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var b=0;b<8;b++)p[b*4+0]=this.state[b]>>>24&255,p[b*4+1]=this.state[b]>>>16&255,p[b*4+2]=this.state[b]>>>8&255,p[b*4+3]=this.state[b]>>>0&255;return this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u.prototype._saveState=function(p){for(var m=0;m<this.state.length;m++)p[m]=this.state[m]},u.prototype._restoreState=function(p,m){for(var h=0;h<this.state.length;h++)this.state[h]=p[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},u})();e.Hash=r;var o=(function(){function u(p){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(p.length>this.blockSize)new r().update(p).finish(m).clean();else for(var h=0;h<p.length;h++)m[h]=p[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 p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},u.prototype.update=function(p){return this.inner.update(p),this},u.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},u.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},u})();e.HMAC=o;function i(u){var p=new r().update(u),m=p.digest();return p.clean(),m}e.hash=i,e.default=i;function a(u,p){var m=new o(u).update(p),h=m.digest();return m.clean(),h}e.hmac=a;function s(u,p,m,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");p.reset(),S>1&&p.update(u),m&&p.update(m),p.update(h),p.finish(u),h[0]++}var l=new Uint8Array(e.digestLength);function c(u,p,m,h){p===void 0&&(p=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),k=a(p,u),w=new o(k),b=new Uint8Array(w.digestLength),v=b.length,x=new Uint8Array(h),T=0;T<h;T++)v===b.length&&(s(b,w,m,S),v=0),x[T]=b[v++];return w.clean(),b.fill(0),S.fill(0),x}e.hkdf=c;function d(u,p,m,h){for(var S=new o(u),k=S.digestLength,w=new Uint8Array(4),b=new Uint8Array(k),v=new Uint8Array(k),x=new Uint8Array(h),T=0;T*k<h;T++){var $=T+1;w[0]=$>>>24&255,w[1]=$>>>16&255,w[2]=$>>>8&255,w[3]=$>>>0&255,S.reset(),S.update(p),S.update(w),S.finish(v);for(var E=0;E<k;E++)b[E]=v[E];for(var E=2;E<=m;E++){S.reset(),S.update(v).finish(v);for(var C=0;C<k;C++)b[C]^=v[C]}for(var E=0;E<k&&T*k+E<h;E++)x[T*k+E]=b[E]}for(var T=0;T<k;T++)b[T]=v[T]=0;for(var T=0;T<4;T++)w[T]=0;return S.clean(),x}e.pbkdf2=d})});var Yr=Bt(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.Webhook=st.WebhookVerificationError=void 0;var my=$s(),Fs=Vs(),fy=qs(),Ms=300,Qr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},$e=class e extends Qr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};st.WebhookVerificationError=$e;var pn=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=Fs.decode(t)}}verify(t,n){let r={};for(let p of Object.keys(n))r[p.toLowerCase()]=n[p];let o=r["webhook-id"],i=r["webhook-signature"],a=r["webhook-timestamp"];if(!i||!o||!a)throw new $e("Missing required headers");let s=this.verifyTimestamp(a),c=this.sign(o,s,t).split(",")[1],d=i.split(" "),u=new globalThis.TextEncoder;for(let p of d){let[m,h]=p.split(",");if(m==="v1"&&(0,my.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new $e("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,${Fs.encode(fy.hmac(this.key,a))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new $e("Invalid Signature Headers");if(n-r>Ms)throw new $e("Message timestamp too old");if(r>n+Ms)throw new $e("Message timestamp too new");return new Date(r*1e3)}};st.Webhook=pn;pn.prefix="whsec_"});import Hs from"crypto";function Be({body:e,secret:t}){let n=new zs.Webhook(t),r=`msg_${Hs.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_${Hs.randomBytes(24).toString("base64")}`}var zs,un=f(()=>{"use strict";zs=Zo(Yr(),1)});import{z as fe}from"zod";async function Js({apiUrl:e,budget:t,observer:n,params:r,webhookSecret:o}){let i=gy[t],a=performance.now(),s={lastReason:void 0,pollCount:0};for(;performance.now()-a<i.timeoutMs;){s.pollCount+=1;let l=await wy({apiUrl:e,observer:n,params:r,webhookSecret:o}),c=Sy({observer:n,outcome:l,start:a,state:s});if(c!=null)return c;let d=i.timeoutMs-(performance.now()-a);if(d<=0)break;let u=Math.min(Ay({backoff:i.backoffMs,pollCount:s.pollCount}),d);await by(u)}return{description:`observer "${n}"`,detail:`budget "${t}" exhausted after ${String(s.pollCount)} poll(s) (${Xs(a)}); last: ${s.lastReason??"no retry reason"}`,status:"failed"}}function Sy({observer:e,outcome:t,start:n,state:r}){return t.kind==="transport-error"?{description:`observer "${e}"`,detail:`transport error after ${String(r.pollCount)} poll(s): ${t.reason}`,status:"failed"}:t.kind==="pass"?{description:`observer "${e}"`,detail:r.pollCount>1?`passed after ${String(r.pollCount)} polls (${Xs(n)})`:void 0,status:"passed"}:t.kind==="fail"?{description:`observer "${e}"`,detail:`failed: ${t.reason} (after ${String(r.pollCount)} poll(s))`,status:"failed"}:(r.lastReason=t.reason,null)}async function wy({apiUrl:e,observer:t,params:n,webhookSecret:r}){let o=JSON.stringify({observer:t,params:n});try{let i=await fetch(`${e}/execute-observer`,{body:o,headers:{"Content-Type":"application/json",...Be({body:o,secret:r})},method:"PUT",signal:AbortSignal.timeout(yy)});if(!i.ok){let l=await i.text().catch(()=>"");return{kind:"transport-error",reason:`status ${String(i.status)}: ${l.slice(0,200)}`}}let a=await i.json(),s=ky.safeParse(a);return s.success?!s.data.success||s.data.outcome==null?{kind:"transport-error",reason:s.data.error??"engine reported failure without outcome"}:s.data.outcome:{kind:"transport-error",reason:`invalid response shape: ${s.error.message}`}}catch(i){let a=i instanceof Error?i.message:String(i);return A.error("observer request failed: %s",a),{kind:"transport-error",reason:a}}}function Ay({backoff:e,pollCount:t}){let n=Math.min(t-1,e.length-1);return e[n]??1e3}function Xs(e){return`${String(Math.round(performance.now()-e))}ms`}async function by(e){return new Promise(t=>setTimeout(t,e))}var yy,gy,hy,ky,Gs=f(()=>{"use strict";Q();un();yy=15e4,gy={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:3e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},hy=fe.discriminatedUnion("kind",[fe.object({kind:fe.literal("pass")}),fe.object({kind:fe.literal("retry"),reason:fe.string()}),fe.object({kind:fe.literal("fail"),reason:fe.string()})]),ky=fe.object({error:fe.string().optional(),outcome:hy.optional(),success:fe.boolean()})});async function eo({failFast:e,observerTransport:t,onStep:n,page:r,spec:o,variables:i}){let a=performance.now();return vy({currentId:o.entryNode,failFast:e,observerTransport:t,onStep:n,page:r,runStartTime:a,spec:o,variables:i})}function Ty({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function vy({currentId:e,failFast:t,observerTransport:n,onStep:r,page:o,runStartTime:i,spec:a,variables:s}){let l=[],c=s,d=e;for(;d!=null;){let u=a.nodes[d];if(u==null)throw new Error(`Node "${d}" not found in spec`);let p=d,m=u.label??`${u.type} (${d})`;A.info("Executing node: %s [%s]",m,u.type);let h=await Ny({node:u,nodeId:p,observerTransport:n,page:o,runStartTime:i,variables:c});if(Ty({onStep:r,steps:[h],target:l}),c=h.variables,t&&h.status==="failed")break;d=u.next}return{steps:l,variables:c}}async function Ny({node:e,nodeId:t,observerTransport:n,page:r,runStartTime:o,variables:i}){let a=performance.now(),s=e.label??`${e.type} (${e.id})`,l=Ry,c=Mt({node:e,page:r});try{let d=await Cy({node:e,observerTransport:n,page:r,timeout:l,variables:i}),u=Math.round(performance.now()-a),p=d.assertions.some(h=>h.status==="failed"),m=await Y({label:`Snapshot [${s}]`,fn:()=>Ie({page:r,runStartTime:o,targets:c})});return{annotations:m.annotations,assertions:d.assertions,detail:void 0,duration:u,nodeId:t,nodeType:e.type,screenshotBase64:m.screenshotBase64,snapshotTimestamp:m.snapshotTimestamp,status:p?"failed":"passed",stepIndex:0,title:s,url:m.url,variables:d.variables,viewportHeight:m.viewportHeight,viewportWidth:m.viewportWidth}}catch(d){let u=Math.round(performance.now()-a),p=d instanceof Error?d.message:String(d),m=await Y({label:`Snapshot [${s}] (error)`,fn:()=>Ie({page:r,runStartTime:o,targets:c})});return{annotations:m.annotations,assertions:[],detail:p,duration:u,nodeId:t,nodeType:e.type,screenshotBase64:m.screenshotBase64,snapshotTimestamp:m.snapshotTimestamp,status:"failed",stepIndex:0,title:s,url:m.url,variables:i,viewportHeight:m.viewportHeight,viewportWidth:m.viewportWidth}}}async function Cy({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(Ly(e)){let a=await er({node:e,page:n,timeout:r,variables:o});return{assertions:[],variables:a.variables}}return{assertions:await xy({node:e,observerTransport:t,page:n,timeout:r,variables:o}),variables:o}}function Ly(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 Py(e){return e.type.startsWith("assert")}async function xy({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(!Py(e))throw new Error(`Unknown node type: ${e.type}`);let i=e;switch(i.type){case"assertVisible":case"assertNotVisible":case"assertEnabled":case"assertDisabled":case"assertChecked":case"assertNotChecked":case"assertFocused":case"assertNotFocused":return Oy({assertNode:i,page:n,timeout:r,variables:o});case"assertText":{let a=te({ref:i.expected,variables:o});return[await Tr({expected:a,locator:q({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertUrl":{let a=te({ref:i.expected,variables:o});return[Kt({expected:a,operator:i.operator,url:n.url()})]}case"assertTitle":{let a=te({ref:i.expected,variables:o});return[Kt({expected:a,operator:i.operator,url:await n.title()})]}case"assertCount":{let a=Zn({ref:i.expected,variables:o});return[await vr({expected:a,locator:q({locator:i.locator,page:n,variables:o}),operator:i.operator})]}case"assertValue":{let a=te({ref:i.expected,variables:o});return[await Nr({expected:a,locator:q({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertAttribute":{let a=te({ref:i.expected,variables:o});return[await ps({attribute:i.attribute,expected:a,locator:q({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertObserver":{if(t==null)return[{description:`observer "${i.observer}"`,detail:"observer transport not configured \u2014 set engineUrl + webhookSecret in ripplo.config",status:"failed"}];let a={};return Object.entries(i.params).forEach(([s,l])=>{a[s]=te({ref:l,variables:o})}),[await Js({apiUrl:t.apiUrl,budget:i.budget,observer:i.observer,params:a,webhookSecret:t.webhookSecret})]}}}async function Oy({assertNode:e,page:t,timeout:n,variables:r}){let o=Ey[e.type];return[await o({locator:q({locator:e.locator,page:t,variables:r}),timeout:n})]}var Ry,Ey,to=f(()=>{"use strict";tr();Gs();Pr();ot();Q();it();bt();Oe();Ry=1e4;Ey={assertChecked:fs,assertDisabled:ms,assertEnabled:us,assertFocused:gs,assertNotChecked:ys,assertNotFocused:hs,assertNotVisible:Lr,assertVisible:Cr}});async function no({baseUrl:e,browser:t,cookies:n,extraVariables:r,observerTransport:o,onStep:i,runId:a,spec:s}){let l=await t.newContext({baseURL:e});A.info("Browser context created"),n.length>0&&await l.addCookies(n);let c=await l.newPage();A.info("Page created");let d=Rt(c),u=[];function p(v){i?.(v),u.push(Jt({context:l,page:c,runId:a,stepIndex:v.stepIndex,stepResult:v}))}let m=Iy(r,s.variableNamespaces),h={...wt({defs:s.variables}),...m};A.info("Starting graph execution (entry: %s)",s.entryNode);let S=await eo({failFast:!0,observerTransport:o,onStep:p,page:c,spec:s,variables:h});await Promise.allSettled(u);let k=S.steps.filter(v=>v.status==="passed").length,w=S.steps.filter(v=>v.status==="failed").length,b={duration:S.steps.reduce((v,x)=>v+x.duration,0),failCount:w,passCount:k,runId:a,status:w>0?"failed":"passed",workflowName:""};return await Xt({monitor:d,runId:a,steps:S.steps,summary:b}),await l.close(),S.steps}function Iy(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 ro=f(()=>{"use strict";pr();Gt();to();Q();Oe()});import{parseSetCookie as _y}from"set-cookie-parser";import{z as ce}from"zod";async function oo({project:e,webhookSecret:t,workflowSlug:n}){let r={apiUrl:void 0,cookies:[],data:{},executed:[]},o=e.workflows.find(s=>s.slug===n);if(o==null)return r;let i=e.engineBaseUrl.length===0?void 0:e.engineBaseUrl,a=o.preconditions;return a.length===0?{...r,apiUrl:i}:i==null?r:Qs({apiUrl:i,preconditionNames:a,webhookSecret:t})}async function io({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-preconditions`,{body:i,headers:{"Content-Type":"application/json",...Dy({cookies:t}),...Be({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(Ks)});a.ok||A.error("Teardown returned %s",String(a.status))}catch{A.error("Teardown request failed")}}async function Qs({apiUrl:e,preconditionNames:t,webhookSecret:n}){let r=performance.now(),o=JSON.stringify({preconditions:t}),i=await fetch(`${e}/execute-preconditions`,{body:o,headers:{"Content-Type":"application/json",...Be({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(Ks)});if(!i.ok){let c=await $y(i);throw new Error(`execute-preconditions returned ${String(i.status)}: ${c}`)}let a=await i.json(),s=Uy.safeParse(a);if(!s.success)throw new Error(`execute-preconditions response has invalid shape: ${s.error.message}`);if(!s.data.success){let c=s.data.error??"no error detail";throw new Error(`Precondition batch failed: ${c}`)}let l=Vy({domain:new URL(e).hostname,res:i});return A.info("Preconditions resolved: %s (%dms)",s.data.executed.join(", "),Math.round(performance.now()-r)),{apiUrl:e,cookies:l,data:s.data.data,executed:s.data.executed}}async function $y(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=By(t),r=n==null?null:jy.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function By(e){try{return JSON.parse(e)}catch{return null}}function Dy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Vy({domain:e,res:t}){let n=t.headers.getSetCookie();return _y(n,{decodeValues:!1}).map(o=>Wy({cookie:o,domain:e}))}function Wy({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=Fy({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 Fy({raw:e}){return qy[e.toLowerCase()]??"Lax"}async function ao({engineBaseUrl:e,preconditionNames:t,webhookSecret:n}){let r=e.length===0?void 0:e;return r==null||t.length===0?{apiUrl:r,cookies:[],data:{},executed:[]}:Qs({apiUrl:r,preconditionNames:t,webhookSecret:n})}var Ks,Uy,jy,qy,so=f(()=>{"use strict";Q();un();Ks=3e4,Uy=ce.object({data:ce.record(ce.string(),ce.record(ce.string(),ce.string())),error:ce.string().optional(),executed:ce.array(ce.string()),runId:ce.string(),success:ce.boolean()});jy=ce.object({error:ce.string()});qy={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as lo}from"gql.tada";async function co({agentProfileId:e,config:t,runId:n}){let r=await U({config:t,document:Hy,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 d=My({config:t,runResultId:o,steps:[c]}).catch(u=>{A.error(u,"Failed to submit step %d",c.stepIndex)});i.push(d)}async function s(){await Promise.all(i)}async function l({statusOverride:c,steps:d,summary:u}){await Y({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let p=d.filter(k=>k.status==="passed").length,m=d.filter(k=>k.status==="failed").length,h=d.reduce((k,w)=>k+w.duration,0),S=c??(m>0?"failed":"passed");await Y({label:"completeRun",fn:()=>U({config:t,document:Jy,variables:{duration:h,failCount:m,passCount:p,runResultId:o,status:S,summary:u??null,warnCount:0}})})}return{complete:l,enqueueStep:a,flushSteps:s,runResultId:o}}async function My({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:zy,variables:{runResultId:t,steps:r}})}var Hy,zy,Jy,po=f(()=>{"use strict";Nt();Q();it();Hy=lo(`
100
100
  mutation StartRunCLI($runId: String!, $platform: String!, $agentProfileId: String) {
101
101
  startRun(runId: $runId, platform: $platform, agentProfileId: $agentProfileId) {
102
102
  id
103
103
  }
104
104
  }
105
- `),Cf=eo(`
105
+ `),zy=lo(`
106
106
  mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
107
107
  submitRunSteps(runResultId: $runResultId, steps: $steps)
108
108
  }
109
- `),vf=eo(`
109
+ `),Jy=lo(`
110
110
  mutation CompleteRunCLI(
111
111
  $runResultId: String!
112
112
  $status: String!
@@ -129,7 +129,7 @@ ${n}`].join(`
129
129
  status
130
130
  }
131
131
  }
132
- `)});import{z as Re}from"zod";import{graphql as ln,readFragment as an}from"gql.tada";async function ro({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,m=!1;try{m=r==null,d=Of({externalBrowser:r,headed:i});let h=a==null?void 0:X({label:"Preconditions resolved",fn:()=>Yr({baseUrl:n,preconditionApiPath:o.preconditionsUrl,preconditionNames:a,webhookSecret:s})}),[{project:S,workflow:k},A]=await Promise.all([X({label:"Run context resolved",fn:()=>Bf({config:o,workflowId:c})}),X({label:"Streaming run started",fn:()=>to({agentProfileId:t,config:o,runId:l})}),Nr({appUrl:n})]);p=k.name,u=A;let w=Wf(k.spec);R.info("Executing workflow: %s",k.name),await Mf(_f({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:d,config:o,headed:i,ownsBrowser:m,preconditionPromise:h,project:S,runId:l,specData:w,streaming:u,webhookSecret:s,workflow:k}),Ff())}catch(h){throw await If({browserPromise:d,error:h,ownsBrowser:m,runId:l,streaming:u,workflowName:p}),h}}function Of({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):X({label:"Browser launched",fn:()=>Ie({headed:t})})}async function If({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 Xa({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 _f({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:m}){let h=l??X({label:"Preconditions resolved",fn:()=>Kr({baseUrl:n,project:$f(s),webhookSecret:d,workflowSlug:m.slug})}),[S,k]=await Promise.all([h,r]);if(t!=null){a&&await k.close(),await Uf({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:i,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d,workflow:m});return}await Df({baseUrl:n,browser:k,preconditionResult:S,runId:c,specData:p,streaming:u,webhookSecret:d})}async function Uf({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 Vf({config:r,profileId:t});await fr({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 Is({preconditionResult:i,webhookSecret:c})}function $f(e){let t=(e.workflows??[]).map(n=>{let r=an(sn,n);return jf.parse(r)});return{preconditionApiPath:e.preconditionApiPath,workflows:t}}async function Df({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:i,webhookSecret:a}){let l=await X({label:"Spec executed",fn:()=>Fr({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,onStep:i.enqueueStep,runId:r,spec:o})});await Is({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;R.info("Run complete: %d passed, %d failed",s,c)}async function Is({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await Qr({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function Bf({config:e,workflowId:t}){let n=await j({config:e,document:Pf,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...an(Os,n.project),baseUrl:e.appUrl,...e.preconditionsUrl.length>0?{preconditionApiPath:e.preconditionsUrl}:{}},a=(o.workflows??[]).find(s=>an(sn,s).id===t);if(a==null)throw new Error(`Workflow ${t} not found`);let l=an(sn,a);return{project:o,workflow:l}}async function Vf({config:e,profileId:t}){let n=await j({config:e,document:Ef,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 R.info("Using agent profile: %s",r.name),cr({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function Wf(e){if(e==null)throw new Error("Workflow has no spec");return Vr.decode(e)}function Ff(){return qf.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Mf(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 xf,sn,Os,Pf,Ef,jf,qf,_s=g(()=>{"use strict";hs();dr();yr();St();Tr();wt();Ft();Mr();Y();Ze();Zr();no();xf=12e4,sn=ln(`
132
+ `)});import{z as be}from"zod";import{graphql as yn,readFragment as mn}from"gql.tada";async function uo({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:i,preconditionNames:a,runId:s,webhookSecret:l,workflowId:c}){let d="unknown",u,p,m=!1;try{m=r==null,p=Qy({externalBrowser:r,headed:i});let h=a==null?void 0:Y({label:"Preconditions resolved",fn:()=>ao({engineBaseUrl:o.engineUrl,preconditionNames:a,webhookSecret:l})}),[{project:S,workflow:k},w]=await Promise.all([Y({label:"Run context resolved",fn:()=>og({config:o,workflowId:c})}),Y({label:"Streaming run started",fn:()=>co({agentProfileId:t,config:o,runId:s})}),Or({appUrl:n})]);d=k.name,u=w;let b=ag(k.spec);A.info("Executing workflow: %s",k.name),await cg(Zy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:p,config:o,headed:i,ownsBrowser:m,preconditionPromise:h,project:S,runId:s,specData:b,streaming:u,webhookSecret:l,workflow:k}),lg())}catch(h){throw await Yy({browserPromise:p,error:h,ownsBrowser:m,runId:s,streaming:u,workflowName:d}),h}}function Qy({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):Y({label:"Browser launched",fn:()=>_e({headed:t})})}async function Yy({browserPromise:e,error:t,ownsBrowser:n,runId:r,streaming:o,workflowName:i}){let a=t instanceof Error?t.message:String(t),s=t instanceof Error?t.stack:void 0;await ds({error:a,runId:r,stack:s,workflowName:i}),o!=null&&await o.complete({statusOverride:"failed",steps:[],summary:a}).catch(()=>{}),n&&e!=null&&await(await e.catch(()=>{}))?.close()}async function Zy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:i,ownsBrowser:a,preconditionPromise:s,project:l,runId:c,specData:d,streaming:u,webhookSecret:p,workflow:m}){let h=s??Y({label:"Preconditions resolved",fn:()=>oo({project:ng(l),webhookSecret:p,workflowSlug:m.slug})}),[S,k]=await Promise.all([h,r]);if(t!=null){a&&await k.close(),await eg({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:i,preconditionResult:S,runId:c,specData:d,streaming:u,webhookSecret:p,workflow:m});return}await rg({baseUrl:n,browser:k,preconditionResult:S,runId:c,specData:d,streaming:u,webhookSecret:p})}async function eg({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:i,runId:a,specData:s,streaming:l,webhookSecret:c,workflow:d}){let u=e!=null&&e.length>0?e:await ig({config:r,profileId:t});await br({baseUrl:n,cookies:i.cookies,executedPreconditions:i.executed,extraVariables:i.data,headed:o,runId:a,serverUrl:r.ripploServerUrl,spec:s,streaming:l,systemPrompt:u,token:r.token,workflowContext:{description:d.name,expectedOutcome:d.name,name:d.name}}),await Zs({preconditionResult:i,webhookSecret:c})}function ng(e){let t=(e.workflows??[]).map(n=>{let r=mn(fn,n);return tg.parse(r)});return{engineBaseUrl:e.engineBaseUrl,workflows:t}}async function rg({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:i,webhookSecret:a}){let s=await Y({label:"Spec executed",fn:()=>no({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,observerTransport:n.apiUrl==null?void 0:{apiUrl:n.apiUrl,webhookSecret:a},onStep:i.enqueueStep,runId:r,spec:o})});await Zs({preconditionResult:n,webhookSecret:a}),await i.complete({statusOverride:void 0,steps:s,summary:void 0});let l=s.filter(d=>d.status==="passed").length,c=s.filter(d=>d.status==="failed").length;A.info("Run complete: %d passed, %d failed",l,c)}async function Zs({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await io({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function og({config:e,workflowId:t}){let n=await U({config:e,document:Gy,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...mn(Ys,n.project),...e.engineUrl.length>0?{engineBaseUrl:e.engineUrl}:{}},a=(o.workflows??[]).find(l=>mn(fn,l).id===t);if(a==null)throw new Error(`Workflow ${t} not found`);let s=mn(fn,a);return{project:o,workflow:s}}async function ig({config:e,profileId:t}){let n=await U({config:e,document:Ky,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 A.info("Using agent profile: %s",r.name),kr({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function ag(e){if(e==null)throw new Error("Workflow has no spec");return Xr.decode(e)}function lg(){return sg.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function cg(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 Xy,fn,Ys,Gy,Ky,tg,sg,el=f(()=>{"use strict";Us();Sr();Rr();Tt();Ir();Nt();Gt();ro();Q();it();so();po();Xy=12e4,fn=yn(`
133
133
  fragment WorkflowRun on Workflow {
134
134
  id
135
135
  slug
@@ -141,22 +141,22 @@ ${n}`].join(`
141
141
  preconditionName
142
142
  }
143
143
  }
144
- `),Os=ln(`
144
+ `),Ys=yn(`
145
145
  fragment ProjectRun on Project {
146
146
  id
147
- baseUrl
148
- preconditionApiPath
147
+ cloudBaseUrl
148
+ engineBaseUrl
149
149
  workflows {
150
150
  ...WorkflowRun
151
151
  }
152
152
  }
153
- `,[sn]),Pf=ln(`
153
+ `,[fn]),Gy=yn(`
154
154
  query ProjectRun($projectId: String!) {
155
155
  project(id: $projectId) {
156
156
  ...ProjectRun
157
157
  }
158
158
  }
159
- `,[Os]),Ef=ln(`
159
+ `,[Ys]),Ky=yn(`
160
160
  query AgentProfileRun($id: String!) {
161
161
  agentProfile(id: $id) {
162
162
  id
@@ -166,7 +166,13 @@ ${n}`].join(`
166
166
  successCriteria
167
167
  }
168
168
  }
169
- `);jf=Re.object({preconditions:Re.array(Re.string()),requiresKeys:Re.array(Re.object({namespace:Re.string(),preconditionName:Re.string()})),slug:Re.string()});qf=Re.coerce.number().int().positive().catch(xf)});var G=g(()=>{"use strict";Hn();lr();dr();yr();wr();St();rs();ss();Tr();wt();ls();vr();_s();Mr();qr();Ye();Y();Ze();Zr();Gr();ht();no();Ee()});import{z as Hs}from"zod";function $e(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return Tt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return Tt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return Tt().RIPPLO_SERVER_URL;let r=Iy[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function Tt(){return Js??=_y.parse(process.env),Js}var Py,Ey,Oy,Iy,_y,Js,rt=g(()=>{"use strict";Py="https://ripplo.ai",Ey="https://ripplo-dev.up.railway.app",Oy="https://localhost:3001",Iy={dev:Ey,local:Oy};_y=Hs.object({RIPPLO_SERVER_URL:Hs.string().min(1).default(Py)})});import Ct from"fs";function al(e){return Ae(e,gg)}function sl(e){let t=al(e);if(!Ct.existsSync(t))return!1;let n=Ct.statSync(t);return Date.now()-n.mtimeMs<=kg}function il(e){qe(e);let t=al(e),n=new Date;Ct.existsSync(t)?Ct.utimesSync(t,n,n):Ct.writeFileSync(t,"")}function ll(e){il(e);let t=setInterval(()=>{il(e)},hg);return()=>{clearInterval(t)}}var gg,hg,kg,lo=g(()=>{"use strict";G();gg="cli-heartbeat",hg=2e3,kg=1e4});import Rl from"crypto";import po from"fs";import bl from"path";import{watch as zg}from"chokidar";import{graphql as Hg}from"gql.tada";async function Nl(e){return Kg(e)}function uo({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let i=bl.join(t,Jg),a=n,l="",s,c=!1,p=!1,u=zg(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(()=>{m()},200)}}),u.on("error",S=>{let k=S instanceof Error?S.message:String(S);R.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";R.error("Sync failed: %s",k),r(k)}finally{c=!1,p&&d()}}async function h(){let S=Gg(i);if(S===l)return;l=S;let k=await O(t);if(!k.ok){r(k.error);return}await ue({cwd:t,result:k.result});let A=Ll(k.result),w=Cl(A);if(w===a)return;a=w;let P=await vl({config:e,payload:A});R.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 Gg(e){let t=Rl.createHash("sha256");return Tl(t,e),t.digest("hex")}function Tl(e,t){if(!po.existsSync(t))return;po.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=bl.join(t,r.name);r.isDirectory()?Tl(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(po.readFileSync(o)))})}function Ll(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 Cl(e){return Rl.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Kg(e){let t=await O(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Ll(t.result);return R.info("Synced %d test(s) + graph to dev session",t.result.tests.length),vl({config:e.config,payload:n})}async function vl({config:e,payload:t}){let n=Cl(t),r=await j({config:e,document:Xg,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 xl(e){return!1}function Pl(e){return!1}var Jg,Xg,mo=g(()=>{"use strict";Pe();G();J();Jg=".ripplo",Xg=Hg(`
169
+ `);tg=be.object({preconditions:be.array(be.string()),requiresKeys:be.array(be.object({namespace:be.string(),preconditionName:be.string()})),slug:be.string()});sg=be.coerce.number().int().positive().catch(Xy)});var J=f(()=>{"use strict";tr();hr();Sr();Rr();Pr();Tt();Ss();Rs();Ir();Nt();Ts();jr();el();ro();to();ot();Q();it();so();un();bt();po();Oe()});import dg from"fs";import pg from"path";async function tl(e){let t=pg.join(e,".ripplo","index.ts");if(!dg.existsSync(t))return{appUrl:void 0,config:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let n=await O(e);if(!n.ok)return{appUrl:void 0,config:void 0,engineUrl:void 0,errors:[{message:n.error,path:".ripplo/"}],valid:!1,warnings:[]};let{config:r}=n.result;return{appUrl:r.appUrl,config:r,engineUrl:r.engineUrl,errors:[],valid:!0,warnings:[]}}async function mo(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 nl({appUrl:e,engineUrl:t}){let n=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${n}/execute-preconditions`,{body:JSON.stringify({preconditions:[]}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Engine endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}var rl=f(()=>{"use strict";K()});import Lt from"fs";import ol from"path";import{chromium as ug}from"playwright";function il(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"engine-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 gn(e){let t=await yg(e),n=gg(e),r=hg(),o=await O(e),i=kg(o),a=Ag(o),s=await mg(e,o),l=fg(e),c=await bg(t,o);return[t,n,...c,i,a,s,l,r]}async function mg(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await Vt({cwd:e});return{status:Wt({compiled:t.result,existing:n}),type:"lockfile"}}function fg(e){let t=ol.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 yg(e){let t=await tl(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 gg(e){let t=ol.join(e,".ripplo",".local","token");return Lt.existsSync(t)?{exists:Lt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function hg(){let e=ug.executablePath();return{installed:Lt.existsSync(e),type:"browser"}}function kg(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=Sg(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function Sg(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}`})})}),wg(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function wg(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 Ag(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 bg(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await mo(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await Rg(n,t);return r.push(...i),r}async function Rg(e,t){let n=t.ok?Object.keys(t.result.preconditions).length:0,r=e.engineUrl.length>0,o={configured:r,count:n,endpointReachable:void 0,type:"preconditions"};if(n===0||!r)return[o];let i=Ng(e.appUrl,e.engineUrl);if(i==null)return[o];let a=await mo(i)==null,s=[];if(s.push({configured:!0,count:n,endpointReachable:a,type:"preconditions"}),al(e.engineUrl)&&s.push({reachable:a,type:"engine-endpoint",url:i}),!a)return s;let l=await nl({appUrl:e.appUrl,engineUrl:e.engineUrl});s.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await Tg({engineUrl:i,webhookSecret:e.webhookSecret});return s.push({status:c,type:"adapter-enabled",url:i}),s}async function Tg({engineUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let n=JSON.stringify({preconditions:[]});try{let r=await fetch(`${e}/execute-preconditions`,{body:n,headers:{"Content-Type":"application/json",...Be({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 vg(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 al(e){return e.startsWith("http://")||e.startsWith("https://")}function Ng(e,t){return al(t)?t:`${e}${t}`}function sl(e){switch(e.type){case"settings":return Pg(e);case"token":return xg(e);case"dev-server":return Eg(e);case"preconditions":return _g(e);case"webhook-verification":return Og(e);case"preconditions-validation":return Ug(e);case"workflows":return jg(e);case"browser":return Ig(e);case"engine-endpoint":return e.reachable?`\u2713 Engine endpoint: ${e.url} is reachable`:`\u2717 Engine endpoint: ${e.url} is not reachable`;case"adapter-enabled":return vg(e);case"lockfile":return Cg(e);case"pre-commit-hook":return Lg(e)}}function Cg(e){switch(e.status){case"match":return`\u2713 Lockfile: ${Se} is up to date`;case"missing":return`\u2717 Lockfile: ${Se} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${Se} is out of date \u2014 run \`ripplo compile\` and commit it`}}function Lg(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 Pg(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function xg(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Eg(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 Og(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 Ig(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function _g(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 engineUrl 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 jg(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=>$g(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
172
+ ${t.join(`
173
+ `)}`}function $g(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
174
+ `+t.join(`
175
+ `)}var fo=f(()=>{"use strict";J();Ee();rl();K()});import{z as ul}from"zod";function De(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return xt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return xt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return xt().RIPPLO_SERVER_URL;let r=Yg[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function xt(){return ml??=Zg.parse(process.env),ml}var Gg,Kg,Qg,Yg,Zg,ml,lt=f(()=>{"use strict";Gg="https://ripplo.ai",Kg="https://ripplo-dev.up.railway.app",Qg="https://localhost:3001",Yg={dev:Kg,local:Qg};Zg=ul.object({RIPPLO_SERVER_URL:ul.string().min(1).default(Gg)})});import Ot from"fs";function xl(e){return we(e,$h)}function El(e){let t=xl(e);if(!Ot.existsSync(t))return!1;let n=Ot.statSync(t);return Date.now()-n.mtimeMs<=Dh}function Pl(e){Je(e);let t=xl(e),n=new Date;Ot.existsSync(t)?Ot.utimesSync(t,n,n):Ot.writeFileSync(t,"")}function Ol(e){Pl(e);let t=setInterval(()=>{Pl(e)},Bh);return()=>{clearInterval(t)}}var $h,Bh,Dh,wo=f(()=>{"use strict";J();$h="cli-heartbeat",Bh=2e3,Dh=1e4});var zl={};Yo(zl,{redirectStdioToFile:()=>mk});import bn from"fs";import uk from"path";function mk(e){bn.mkdirSync(uk.dirname(e),{recursive:!0});let t=bn.openSync(e,"a"),n=process.stdout.write.bind(process.stdout),r=process.stderr.write.bind(process.stderr);function o(s,l,c){let d=typeof l=="string"?l:void 0,u=typeof s=="string"?Buffer.from(s,d??"utf8"):Buffer.from(s);bn.writeSync(t,u);let p=typeof l=="function"?l:c;return p?.(),!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,bn.closeSync(t))}}var Jl=f(()=>{"use strict"});import Xl from"crypto";import Ro from"fs";import Gl from"path";import{watch as fk}from"chokidar";import{graphql as yk}from"gql.tada";async function Kl(e){return Sk(e)}function To({config:e,cwd:t,lastHash:n,onSyncError:r,onSyncSuccess:o}){let i=Gl.join(t,gk),a=n,s="",l,c=!1,d=!1,u=fk(i,{depth:2,ignoreInitial:!0,persistent:!0});u.on("all",(S,k)=>{if(k.endsWith(".ts")){if(c){d=!0;return}l!=null&&clearTimeout(l),l=setTimeout(()=>{m()},200)}}),u.on("error",S=>{let k=S instanceof Error?S.message:String(S);A.error("File watcher error: %s",k)});function p(){d=!1,l=setTimeout(()=>{m()},200)}async function m(){c=!0,d=!1;try{await h()}catch(S){let k=S instanceof Error?S.message:"Unknown error";A.error("Sync failed: %s",k),r(k)}finally{c=!1,d&&p()}}async function h(){let S=kk(i);if(S===s)return;s=S;let k=await O(t);if(!k.ok){r(k.error);return}await ue({cwd:t,result:k.result});let w=Yl(k.result),b=Zl(w);if(b===a)return;a=b;let v=await ec({config:e,payload:w});A.info("Dev session synced (%d test(s))",k.result.tests.length),o({devSessionId:v.devSessionId,hash:v.hash})}return function(){l!=null&&clearTimeout(l),u.close()}}function kk(e){let t=Xl.createHash("sha256");return Ql(t,e),t.digest("hex")}function Ql(e,t){if(!Ro.existsSync(t))return;Ro.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Gl.join(t,r.name);r.isDirectory()?Ql(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(Ro.readFileSync(o)))})}function Yl(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 Zl(e){return Xl.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Sk(e){let t=await O(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=Yl(t.result);return A.info("Synced %d test(s) + graph to dev session",t.result.tests.length),ec({config:e.config,payload:n})}async function ec({config:e,payload:t}){let n=Zl(t),r=await U({config:e,document:hk,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 tc(e){return!1}function nc(e){return!1}var gk,hk,vo=f(()=>{"use strict";Ee();J();K();gk=".ripplo",hk=yk(`
170
176
  mutation SyncDevSession(
171
177
  $projectId: String!
172
178
  $preconditions: [SyncDevPreconditionInput!]!
@@ -176,7 +182,7 @@ ${n}`].join(`
176
182
  id
177
183
  }
178
184
  }
179
- `)});import{useCallback as Qg,useEffect as hn,useRef as Yg,useState as Zg}from"react";import{availableParallelism as El}from"os";import{useSubscription as fo}from"urql";import{graphql as Sn}from"gql.tada";async function Ol(){await(await kn).closeAll()}function Il({config:e,cwd:t,devSessionId:n}){let[r,o]=Zg({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:El()}),i=e,a=Yg(new Set);hn(()=>{kn.then(()=>{o(s=>({...s,browsersReady:!0}))})},[]);let l=Qg(s=>{_l({activeRunIds:a.current,baseUrl:i.appUrl,config:i,setState:o,...s})},[i]);return hn(()=>{n!=null&&o(s=>({...s,connected:!0}))},[n]),fo({pause:n==null,query:eh},(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}),fo({pause:n==null,query:nh,variables:{projectId:i.projectId}},(s,c)=>{let p=c.devWorkflowDeleteRequested?.slug;return p!=null&&xl({cwd:t,slug:p}),c}),fo({pause:n==null,query:rh,variables:{projectId:i.projectId}},(s,c)=>{let p=c.devWorkflowDuplicateRequested;return p!=null&&Pl({cwd:t,newSlug:p.newSlug,sourceSlug:p.sourceSlug}),c}),hn(()=>{if(n==null)return;let s=new AbortController;return ih({activeConfig:i,activeRunIds:a.current,devSessionId:n,setState:o,signal:s.signal}),()=>{s.abort()}},[i,n]),hn(()=>()=>{kn.then(s=>s.closeAll())},[]),r}function _l({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}))}ah({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,workflowId:s,workflowSlug:c}).finally(p)}async function ih({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(i=>{let a=setTimeout(i,oh);o.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})}),o.aborted)return;try{(await j({config:e,document:th,variables:{devSessionId:n}})).pendingDevRuns?.filter(a=>!t.has(a.id)).forEach(a=>{let l=a.workflow?.id;l!=null&&_l({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){R.error(i,"Runner error")}}}async function ah({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:i,workflowId:a,workflowSlug:l}){let s=await kn,c=await s.acquire();try{await br({maxRuns:100});let p=o!=null&&l!=null?await sh({cwd:o,workflowSlug:l}):void 0;await ro({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:c,config:r,headed:!1,preconditionNames:p,runId:i,webhookSecret:r.webhookSecret,workflowId:a})}catch(p){R.error(p,"Runner error")}finally{s.release(c)}}async function sh({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 eh,th,nh,rh,kn,oh,yo=g(()=>{"use strict";G();J();mo();eh=Sn(`
185
+ `)});import{useCallback as wk,useEffect as Rn,useRef as Ak,useState as bk}from"react";import{availableParallelism as rc}from"os";import{useSubscription as No}from"urql";import{graphql as vn}from"gql.tada";async function oc(){await(await Tn).closeAll()}function ic({config:e,cwd:t,devSessionId:n}){let[r,o]=bk({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:rc()}),i=e,a=Ak(new Set);Rn(()=>{Tn.then(()=>{o(l=>({...l,browsersReady:!0}))})},[]);let s=wk(l=>{ac({activeRunIds:a.current,baseUrl:i.appUrl,config:i,setState:o,...l})},[i]);return Rn(()=>{n!=null&&o(l=>({...l,connected:!0}))},[n]),No({pause:n==null,query:Rk},(l,c)=>{let d=c.runRequested;return d!=null&&s({agentProfileDescription:d.agentProfileDescription??void 0,agentProfileId:d.agentProfileId??void 0,cwd:t,runId:d.runId,workflowId:d.workflowId,workflowSlug:d.workflowSlug}),c}),No({pause:n==null,query:vk,variables:{projectId:i.projectId}},(l,c)=>{let d=c.devWorkflowDeleteRequested?.slug;return d!=null&&tc({cwd:t,slug:d}),c}),No({pause:n==null,query:Nk,variables:{projectId:i.projectId}},(l,c)=>{let d=c.devWorkflowDuplicateRequested;return d!=null&&nc({cwd:t,newSlug:d.newSlug,sourceSlug:d.sourceSlug}),c}),Rn(()=>{if(n==null)return;let l=new AbortController;return Lk({activeConfig:i,activeRunIds:a.current,devSessionId:n,setState:o,signal:l.signal}),()=>{l.abort()}},[i,n]),Rn(()=>()=>{Tn.then(l=>l.closeAll())},[]),r}function ac({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,setState:s,workflowId:l,workflowSlug:c}){if(e.has(a))return;e.add(a),s(u=>({...u,activeRunCount:e.size}));function d(){e.delete(a),s(u=>({...u,activeRunCount:e.size}))}Pk({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,workflowId:l,workflowSlug:c}).finally(d)}async function Lk({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(i=>{let a=setTimeout(i,Ck);o.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})}),o.aborted)return;try{(await U({config:e,document:Tk,variables:{devSessionId:n}})).pendingDevRuns?.filter(a=>!t.has(a.id)).forEach(a=>{let s=a.workflow?.id;s!=null&&ac({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:s,workflowSlug:void 0})})}catch(i){A.error(i,"Runner error")}}}async function Pk({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:i,workflowId:a,workflowSlug:s}){let l=await Tn,c=await l.acquire();try{await Er({maxRuns:100});let d=o!=null&&s!=null?await xk({cwd:o,workflowSlug:s}):void 0;await uo({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:c,config:r,headed:!1,preconditionNames:d,runId:i,webhookSecret:r.webhookSecret,workflowId:a})}catch(d){A.error(d,"Runner error")}finally{l.release(c)}}async function xk({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 Rk,Tk,vk,Nk,Tn,Ck,Co=f(()=>{"use strict";J();K();vo();Rk=vn(`
180
186
  subscription RunRequestedDashboard {
181
187
  runRequested {
182
188
  agentProfileDescription
@@ -187,7 +193,7 @@ ${n}`].join(`
187
193
  workflowSlug
188
194
  }
189
195
  }
190
- `),th=Sn(`
196
+ `),Tk=vn(`
191
197
  query PendingDevRunsDashboard($devSessionId: String!) {
192
198
  pendingDevRuns(devSessionId: $devSessionId) {
193
199
  id
@@ -200,14 +206,14 @@ ${n}`].join(`
200
206
  }
201
207
  }
202
208
  }
203
- `),nh=Sn(`
209
+ `),vk=vn(`
204
210
  subscription DevWorkflowDeleteDashboard($projectId: String!) {
205
211
  devWorkflowDeleteRequested(projectId: $projectId) {
206
212
  projectId
207
213
  slug
208
214
  }
209
215
  }
210
- `),rh=Sn(`
216
+ `),Nk=vn(`
211
217
  subscription DevWorkflowDuplicateDashboard($projectId: String!) {
212
218
  devWorkflowDuplicateRequested(projectId: $projectId) {
213
219
  projectId
@@ -215,7 +221,7 @@ ${n}`].join(`
215
221
  newSlug
216
222
  }
217
223
  }
218
- `),kn=Rr({headed:!1,size:El()});oh=5e3});import{initGraphQLTada as lh}from"gql.tada";import{readFragment as Sv}from"gql.tada";var go,Ul=g(()=>{"use strict";go=lh()});var ho,ko=g(()=>{"use strict";ho={__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:"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:[]}],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:"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:"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:"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 de(e,t,n){e.invalidate({__typename:t,id:n})}function dh({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 So({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 ph(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;So({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||de(e,"RunResult",r)}function Ao(e){return e==="completed"||e==="failed"}function uh(e,t){if(t.runId==null)return;let n=Ao(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(jl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function $l(e,t){e.invalidate({__typename:"Run",id:t},"results")}function mh(e,t){e.workflowId==null||e.runId==null||So({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function fh(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;uh(t,e),Ao(e.status)&&e.runId!=null&&$l(t,e.runId),n&&(B(t,"run"),yh(t,e)),mh(e,t)}function yh(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){B(e,"projectRuns");return}dh({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 gh(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 kh(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(hh,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function Sh(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&gh(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&&de(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(jl,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),So({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&de(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&de(n,"Workflow",r),B(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&de(n,"Project",r),B(n,"projects")},duplicateDevWorkflow(e,t,n){B(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&de(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&de(n,"ScopeItem",r)},removeScopeItem(e,t,n){de(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){B(n,"runs"),B(n,"projectRuns")},setHooksPaused(e,t,n){kh(n,t.paused)},setOverageCap(e,t,n){B(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&de(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&de(n,"User",r),B(n,"currentUser")}}}function wo(){return{keys:ch,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:ho,updates:{Mutation:Sh(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&de(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&&fh(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&ph(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&de(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&Ao(r.run.status)&&$l(n,r.run.id)}}}}}var ch,jl,hh,Dl=g(()=>{"use strict";Ul();ko();ch={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,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};jl=go(`
224
+ `),Tn=xr({headed:!1,size:rc()});Ck=5e3});import{initGraphQLTada as Ek}from"gql.tada";import{readFragment as eE}from"gql.tada";var Lo,sc=f(()=>{"use strict";Lo=Ek()});var Po,xo=f(()=>{"use strict";Po={__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:"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:"engineBaseUrl",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:"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:"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:"engineBaseUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},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:"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 V(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function de(e,t,n){e.invalidate({__typename:t,id:n})}function Ik({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(s=>typeof s=="string"?s:null);a.includes(n)||t.link("Query",o.fieldName,o.arguments,[n,...a])})}function Eo({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 s=e.keyOfEntity({__typename:n,id:t});if(s==null)return!1;let l=e.resolve(a,r);if(!Array.isArray(l))return!1;let c=l.map(d=>typeof d=="string"?d:null);return c.includes(s)||e.link(a,r,void 0,[...c,s]),!0}function _k(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Eo({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||de(e,"RunResult",r)}function Oo(e){return e==="completed"||e==="failed"}function Uk(e,t){if(t.runId==null)return;let n=Oo(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(lc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function cc(e,t){e.invalidate({__typename:"Run",id:t},"results")}function jk(e,t){e.workflowId==null||e.runId==null||Eo({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function $k(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;Uk(t,e),Oo(e.status)&&e.runId!=null&&cc(t,e.runId),n&&(V(t,"run"),Bk(t,e)),jk(e,t)}function Bk(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){V(e,"projectRuns");return}Ik({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)}}),V(e,"projectRuns")}function Dk(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(l=>typeof l=="string"?[l]:[]),s=e.keyOfEntity({__typename:"ScopeItem",id:n});s==null||a.includes(s)||e.link(o,"scopeItems",void 0,[...a,{__typename:"ScopeItem",id:n}])}function Wk(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(Vk,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function qk(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&Dk(n,t.projectId,r)},cancelAllPendingRuns(e,t,n){V(n,"workflows"),V(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&de(n,"Run",r)},cloneAgentTemplate(e,t,n){V(n,"agentProfiles")},createAgentProfile(e,t,n){V(n,"agentProfiles")},createRun(e,t,n){V(n,"run"),V(n,"runs"),V(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(lc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Eo({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&de(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&de(n,"Workflow",r),V(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&de(n,"Project",r),V(n,"projects")},duplicateDevWorkflow(e,t,n){V(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&de(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&de(n,"ScopeItem",r)},removeScopeItem(e,t,n){de(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){V(n,"runs"),V(n,"projectRuns")},setHooksPaused(e,t,n){Wk(n,t.paused)},setOverageCap(e,t,n){V(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&de(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&de(n,"User",r),V(n,"currentUser")}}}function Io(){return{keys:Ok,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:Po,updates:{Mutation:qk(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&de(n,"Project",r.projectId),r?.active===!1&&(V(n,"workflows"),V(n,"workflow"),V(n,"runs"),V(n,"run"),V(n,"projectRuns"))},devSessionSynced(e,t,n){V(n,"workflow"),V(n,"workflows")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&$k(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&_k(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&de(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&Oo(r.run.status)&&cc(n,r.run.id)}}}}}var Ok,lc,Vk,dc=f(()=>{"use strict";sc();xo();Ok={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};lc=Lo(`
219
225
  fragment RunCache on Run {
220
226
  id
221
227
  status
@@ -225,12 +231,12 @@ ${n}`].join(`
225
231
  id
226
232
  }
227
233
  }
228
- `);hh=go(`
234
+ `);Vk=Lo(`
229
235
  fragment HooksPausedPatch on DevSession {
230
236
  id
231
237
  hooksPaused
232
238
  }
233
- `)});var Bl=g(()=>{"use strict";Dl();ko()});import{Client as Ah,fetchExchange as wh,subscriptionExchange as Rh}from"urql";import{cacheExchange as bh}from"@urql/exchange-graphcache";import{createClient as Nh}from"graphql-sse";function Ro({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=Nh({headers:n,retryAttempts:1/0,url:t});return new Ah({exchanges:[bh(wo()),Rh({forwardSubscription:o=>({subscribe:i=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},i)}})}),wh],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var Vl=g(()=>{"use strict";Bl()});import{Box as Wl,Text as V,useInput as Th}from"ink";import{jsx as H,jsxs as Ce}from"react/jsx-runtime";function bo({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Th((o,i)=>{i.return&&!n&&r()}),t!=null?Ce(Wl,{flexDirection:"column",gap:1,children:[Ce(V,{children:[H(V,{color:"red",children:" \u2717 "}),H(V,{children:t})]}),Ce(V,{children:[H(V,{color:"cyan",children:" \u2192 "}),H(V,{children:"Press "}),H(V,{bold:!0,children:"Enter"}),H(V,{children:" to try again"})]})]}):e!=null?Ce(Wl,{flexDirection:"column",gap:1,paddingLeft:2,children:[Ce(V,{children:[H(V,{color:"yellow",children:"* "}),H(V,{children:"Your code: "}),H(V,{bold:!0,color:"white",children:e.userCode})]}),Ce(V,{children:[H(V,{color:"yellow",children:"* "}),H(V,{children:"Waiting for browser authorization..."})]}),Ce(V,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?Ce(V,{children:[H(V,{color:"yellow",children:" * "}),H(V,{children:"Opening browser..."})]}):Ce(V,{children:[H(V,{color:"cyan",children:" \u2192 "}),H(V,{children:"Press "}),H(V,{bold:!0,children:"Enter"}),H(V,{children:" to open browser for authentication"})]})}var ql=g(()=>{"use strict"});import{useState as Lh}from"react";import{Box as Ch,Text as An,useInput as vh}from"ink";import{jsx as wn,jsxs as xh}from"react/jsx-runtime";function Fl({items:e,onSelect:t}){let[n,r]=Lh(0);return vh((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)}}),wn(Ch,{flexDirection:"column",children:e.map((o,i)=>xh(An,{children:[i===n?wn(An,{color:"cyan",children:"> "}):wn(An,{children:" "}),wn(An,{bold:i===n,children:o.label})]},o.value))})}var Ml=g(()=>{"use strict"});import{Box as Ph,Text as De,useInput as Eh}from"ink";import{jsx as at,jsxs as No}from"react/jsx-runtime";function zl({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Eh((r,o)=>{o.return&&e()}),No(Ph,{flexDirection:"column",children:[No(De,{children:[at(De,{color:"cyan",children:" \u2192 "}),at(De,{children:"No projects found. Create one at: "}),at(De,{bold:!0,color:"cyan",children:n})]}),No(De,{children:[" ",at(De,{dimColor:!0,children:"Press "}),at(De,{bold:!0,children:"Enter"}),at(De,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var Hl=g(()=>{"use strict"});import{useEffect as Oh,useMemo as Ih,useRef as _h}from"react";import{Box as Jl,Text as Me}from"ink";import{useQuery as Uh}from"urql";import{graphql as jh}from"gql.tada";import{jsx as ze,jsxs as Rn}from"react/jsx-runtime";function Xl({selectProject:e,serverUrl:t}){let[n,r]=Uh({query:$h}),o=_h(!1),i=Ih(()=>n.data?.projects??[],[n.data?.projects]);if(Oh(()=>{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 Rn(Me,{children:[ze(Me,{color:"yellow",children:" * "}),ze(Me,{children:"Loading projects..."})]});if(n.error!=null)return Rn(Me,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(i.length===0)return ze(zl,{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 Rn(Jl,{flexDirection:"column",children:[Rn(Me,{children:[ze(Me,{color:"cyan",children:" \u2192 "}),ze(Me,{children:"Select a project:"})]}),ze(Jl,{marginLeft:4,marginTop:1,children:ze(Fl,{items:a,onSelect:l})})]})}var $h,Gl=g(()=>{"use strict";Ml();Hl();$h=jh(`
239
+ `)});var pc=f(()=>{"use strict";dc();xo()});import{Client as Fk,fetchExchange as Mk,subscriptionExchange as Hk}from"urql";import{cacheExchange as zk}from"@urql/exchange-graphcache";import{createClient as Jk}from"graphql-sse";function uc({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=Jk({headers:n,retryAttempts:1/0,url:t});return new Fk({exchanges:[zk(Io()),Hk({forwardSubscription:o=>({subscribe:i=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},i)}})}),Mk],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var mc=f(()=>{"use strict";pc()});import{Box as fc,Text as W,useInput as Xk}from"ink";import{jsx as X,jsxs as Ce}from"react/jsx-runtime";function yc({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Xk((o,i)=>{i.return&&!n&&r()}),t!=null?Ce(fc,{flexDirection:"column",gap:1,children:[Ce(W,{children:[X(W,{color:"red",children:" \u2717 "}),X(W,{children:t})]}),Ce(W,{children:[X(W,{color:"cyan",children:" \u2192 "}),X(W,{children:"Press "}),X(W,{bold:!0,children:"Enter"}),X(W,{children:" to try again"})]})]}):e!=null?Ce(fc,{flexDirection:"column",gap:1,paddingLeft:2,children:[Ce(W,{children:[X(W,{color:"yellow",children:"* "}),X(W,{children:"Your code: "}),X(W,{bold:!0,color:"white",children:e.userCode})]}),Ce(W,{children:[X(W,{color:"yellow",children:"* "}),X(W,{children:"Waiting for browser authorization..."})]}),Ce(W,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?Ce(W,{children:[X(W,{color:"yellow",children:" * "}),X(W,{children:"Opening browser..."})]}):Ce(W,{children:[X(W,{color:"cyan",children:" \u2192 "}),X(W,{children:"Press "}),X(W,{bold:!0,children:"Enter"}),X(W,{children:" to open browser for authentication"})]})}var gc=f(()=>{"use strict"});import{useState as Gk}from"react";import{Box as Kk,Text as Nn,useInput as Qk}from"ink";import{jsx as Cn,jsxs as Yk}from"react/jsx-runtime";function hc({items:e,onSelect:t}){let[n,r]=Gk(0);return Qk((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)}}),Cn(Kk,{flexDirection:"column",children:e.map((o,i)=>Yk(Nn,{children:[i===n?Cn(Nn,{color:"cyan",children:"> "}):Cn(Nn,{children:" "}),Cn(Nn,{bold:i===n,children:o.label})]},o.value))})}var kc=f(()=>{"use strict"});import{Box as Zk,Text as Ve,useInput as eS}from"ink";import{jsx as pt,jsxs as _o}from"react/jsx-runtime";function Sc({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return eS((r,o)=>{o.return&&e()}),_o(Zk,{flexDirection:"column",children:[_o(Ve,{children:[pt(Ve,{color:"cyan",children:" \u2192 "}),pt(Ve,{children:"No projects found. Create one at: "}),pt(Ve,{bold:!0,color:"cyan",children:n})]}),_o(Ve,{children:[" ",pt(Ve,{dimColor:!0,children:"Press "}),pt(Ve,{bold:!0,children:"Enter"}),pt(Ve,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var wc=f(()=>{"use strict"});import{useEffect as tS,useMemo as nS,useRef as rS}from"react";import{Box as Ac,Text as Ge}from"ink";import{useQuery as oS}from"urql";import{graphql as iS}from"gql.tada";import{jsx as Ke,jsxs as Ln}from"react/jsx-runtime";function bc({selectProject:e,serverUrl:t}){let[n,r]=oS({query:aS}),o=rS(!1),i=nS(()=>n.data?.projects??[],[n.data?.projects]);if(tS(()=>{let l=i[0];i.length===1&&l!=null&&(l.workflows?.length??0)===0&&!o.current&&(o.current=!0,e({id:l.id,name:l.name}))},[i,e]),n.fetching)return Ln(Ge,{children:[Ke(Ge,{color:"yellow",children:" * "}),Ke(Ge,{children:"Loading projects..."})]});if(n.error!=null)return Ln(Ge,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(i.length===0)return Ke(Sc,{reexecute:r,serverUrl:t});let a=i.map(l=>({label:l.name,value:l.id}));function s(l){let c=i.find(d=>d.id===l);c!=null&&e({id:c.id,name:c.name})}return Ln(Ac,{flexDirection:"column",children:[Ln(Ge,{children:[Ke(Ge,{color:"cyan",children:" \u2192 "}),Ke(Ge,{children:"Select a project:"})]}),Ke(Ac,{marginLeft:4,marginTop:1,children:Ke(hc,{items:a,onSelect:s})})]})}var aS,Rc=f(()=>{"use strict";kc();wc();aS=iS(`
234
240
  query SetupProjectSelect {
235
241
  projects {
236
242
  id
@@ -240,7 +246,11 @@ ${n}`].join(`
240
246
  }
241
247
  }
242
248
  }
243
- `)});import{Box as vt,Text as pe,useInput as Dh}from"ink";import Bh from"ink-spinner";import{jsx as ve,jsxs as he}from"react/jsx-runtime";function To({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}){return Dh((l,s)=>{a==="scaffolding-warnings"&&s.return&&n()}),he(vt,{flexDirection:"column",padding:1,children:[he(pe,{bold:!0,children:[" ","ripplo setup"]}),ve(pe,{children:""}),he(pe,{children:[ve(pe,{color:"green",children:" \u2713 "}),ve(pe,{children:"Authenticated"})]}),Vh({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}),t==null?null:ve(vt,{marginTop:1,children:he(pe,{color:"red",children:[" ","Error: ",t]})})]})}function Vh({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?he(pe,{children:[he(pe,{color:"cyan",children:[" ",ve(Bh,{type:"dots"})]}),he(pe,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?he(vt,{flexDirection:"column",marginTop:1,children:[ve(pe,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((i,a)=>he(vt,{flexDirection:"column",marginTop:1,children:[he(pe,{children:[" ",i.message]}),i.manualCommand==null?null:he(pe,{color:"cyan",children:[" $ ",i.manualCommand]})]},a)),ve(vt,{marginTop:1,children:ve(pe,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):ve(Xl,{selectProject:r,serverUrl:e.ripploServerUrl})}var Kl=g(()=>{"use strict";Gl()});import{useEffect as Wh,useState as qh}from"react";function st(){let[e,t]=qh(Ql);return Wh(()=>{function n(){t(Ql())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Ql(){return{height:process.stdout.rows,width:process.stdout.columns}}var bn=g(()=>{"use strict"});import{useEffect as Fh,useRef as Mh,useState as zh}from"react";function Yl({config:e,cwd:t}){let[n,r]=zh({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=Mh(void 0);return Fh(()=>{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 Nl({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{i({devSessionId:l}),o.current=uo({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=uo({config:e,cwd:t,lastHash:"",onSyncError:a,onSyncSuccess:i})}),()=>{o.current?.()}},[e,t]),n}var Zl=g(()=>{"use strict";mo()});import Lo from"fs";import{useEffect as Hh}from"react";import{useQuery as Jh,useSubscription as Xh}from"urql";import{graphql as tc}from"gql.tada";function nc({cwd:e,projectId:t}){let[{data:n}]=Jh({query:Gh,variables:{projectId:t}});Hh(()=>{let r=n?.project?.devSession?.hooksPaused;r!=null&&ec({cwd:e,paused:r})},[e,n]),Xh({query:Kh,variables:{projectId:t}},(r,o)=>{let i=o.hooksPausedRequested;return i!=null&&ec({cwd:e,paused:i.paused}),o})}function ec({cwd:e,paused:t}){let n=Ae(e,"hooks-paused");if(t){qe(e),Lo.writeFileSync(n,"");return}Lo.existsSync(n)&&Lo.unlinkSync(n)}var Gh,Kh,rc=g(()=>{"use strict";G();Gh=tc(`
249
+ `)});import{Box as _t,Text as pe,useInput as sS}from"ink";import lS from"ink-spinner";import{jsx as Le,jsxs as ke}from"react/jsx-runtime";function Tc({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}){return sS((s,l)=>{a==="scaffolding-warnings"&&l.return&&n()}),ke(_t,{flexDirection:"column",padding:1,children:[ke(pe,{bold:!0,children:[" ","ripplo setup"]}),Le(pe,{children:""}),ke(pe,{children:[Le(pe,{color:"green",children:" \u2713 "}),Le(pe,{children:"Authenticated"})]}),cS({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}),t==null?null:Le(_t,{marginTop:1,children:ke(pe,{color:"red",children:[" ","Error: ",t]})})]})}function cS({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?ke(pe,{children:[ke(pe,{color:"cyan",children:[" ",Le(lS,{type:"dots"})]}),ke(pe,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?ke(_t,{flexDirection:"column",marginTop:1,children:[Le(pe,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((i,a)=>ke(_t,{flexDirection:"column",marginTop:1,children:[ke(pe,{children:[" ",i.message]}),i.manualCommand==null?null:ke(pe,{color:"cyan",children:[" $ ",i.manualCommand]})]},a)),Le(_t,{marginTop:1,children:Le(pe,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):Le(bc,{selectProject:r,serverUrl:e.ripploServerUrl})}var vc=f(()=>{"use strict";Rc()});import{useEffect as dS,useState as pS}from"react";function ut(){let[e,t]=pS(Nc);return dS(()=>{function n(){t(Nc())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Nc(){return{height:process.stdout.rows,width:process.stdout.columns}}var Pn=f(()=>{"use strict"});import{useEffect as uS,useRef as mS,useState as fS}from"react";function Cc({config:e,cwd:t}){let[n,r]=fS({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=mS(void 0);return uS(()=>{function i({devSessionId:s}){r(l=>({...l,devSessionId:s,syncError:void 0,syncing:!1}))}function a(s){r(l=>({...l,syncError:s,syncing:!1}))}return Kl({config:e,cwd:t}).then(({devSessionId:s,hash:l})=>{i({devSessionId:s}),o.current=To({config:e,cwd:t,lastHash:l,onSyncError:a,onSyncSuccess:i})}).catch(s=>{let l=s instanceof Error?s.message:String(s);a(l),o.current=To({config:e,cwd:t,lastHash:"",onSyncError:a,onSyncSuccess:i})}),()=>{o.current?.()}},[e,t]),n}var Lc=f(()=>{"use strict";vo()});function xn(e){return{...yS(e),type:e.type}}function yS(e){switch(e.type){case"settings":return gS(e);case"token":return hS(e.exists);case"dev-server":return kS(e);case"preconditions":return TS(e);case"engine-endpoint":return SS(e);case"adapter-enabled":return NS(e.status);case"webhook-verification":return wS(e.rejectsUnsigned);case"preconditions-validation":return AS(e);case"workflows":return CS(e);case"browser":return bS(e.installed);case"lockfile":return PS(e.status);case"pre-commit-hook":return RS(e.installed)}}function gS(e){return e.valid?{detail:"configured",label:"Settings",tone:"ok"}:{detail:`missing ${e.missingFields.join(", ")}`,label:"Settings",tone:"error"}}function hS(e){return e?{detail:"signed in",label:"Auth",tone:"ok"}:{detail:"not signed in",label:"Auth",tone:"error"}}function kS(e){return e.reachable?{detail:e.appUrl,label:"Dev server",tone:"ok"}:{detail:`${e.appUrl} unreachable`,label:"Dev server",tone:"error"}}function SS(e){return e.reachable?{detail:e.url,label:"Endpoint",tone:"ok"}:{detail:`${e.url} unreachable`,label:"Endpoint",tone:"error"}}function wS(e){return e?{detail:"rejects unsigned",label:"Webhook auth",tone:"ok"}:{detail:"accepts unsigned!",label:"Webhook auth",tone:"error"}}function AS(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 bS(e){return e?{detail:"chromium installed",label:"Browser",tone:"ok"}:{detail:"chromium missing",label:"Browser",tone:"error"}}function RS(e){return e?{detail:"installed",label:"Pre-commit",tone:"ok"}:{detail:"not installed",label:"Pre-commit",tone:"warn"}}function TS(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 NS(e){let t=vS[e];return t??{detail:"unreachable",label:"Adapter",tone:"error"}}function CS(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 PS(e){let t=LS[e];return t??{detail:"stale (run ripplo compile)",label:"Lockfile",tone:"warn"}}var vS,LS,Pc,xc,Uo=f(()=>{"use strict";vS={"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"}};LS={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"}};Pc={"adapter-enabled":"ADAPTER_ENABLED",browser:"BROWSER","dev-server":"DEV_SERVER","engine-endpoint":"ENGINE_ENDPOINT",lockfile:"LOCKFILE","pre-commit-hook":"PRE_COMMIT_HOOK",preconditions:"PRECONDITIONS","preconditions-validation":"PRECONDITIONS_VALIDATION",settings:"SETTINGS",token:"TOKEN","webhook-verification":"WEBHOOK_VERIFICATION",workflows:"WORKFLOWS"},xc={error:"ERROR",info:"INFO",ok:"OK",warn:"WARN"}});import{useEffect as xS,useState as ES}from"react";import OS from"path";import{watch as IS}from"chokidar";import{graphql as _S}from"gql.tada";function Ec({config:e,cwd:t}){let[n,r]=ES({checks:[],lastRunAt:void 0,running:!1});return xS(()=>{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 gn(t);r({checks:c,lastRunAt:Date.now(),running:!1}),o.lastPushedKey=await $S({checks:c,config:e,lastPushedKey:o.lastPushedKey})}catch(c){A.error(c,"health check tick failed")}finally{o.inFlight=!1}}}function s(){o.cancelled||(i=setTimeout(()=>{a().finally(s)},US))}a().finally(s);let l=IS(OS.join(t,".ripplo","ripplo.lock"),{ignoreInitial:!0,persistent:!0});return l.on("all",()=>{a()}),()=>{o.cancelled=!0,i!=null&&clearTimeout(i),l.close()}},[e,t]),n}async function $S({checks:e,config:t,lastPushedKey:n}){if(t.projectId.length===0)return n;let r=e.map(i=>{let a=xn(i);return{detail:a.detail,tone:xc[a.tone],type:Pc[a.type]}}),o=JSON.stringify(r);if(o===n)return n;try{return await U({config:t,document:jS,variables:{checks:r,projectId:t.projectId}}),o}catch(i){return A.error(i,"Failed to push health checks"),n}}var US,jS,Oc=f(()=>{"use strict";J();fo();Uo();US=5e3,jS=_S(`
250
+ mutation PushHealthChecks($projectId: String!, $checks: [HealthCheckInput!]!) {
251
+ pushHealthChecks(projectId: $projectId, checks: $checks)
252
+ }
253
+ `)});import jo from"fs";import{useEffect as BS}from"react";import{useQuery as DS,useSubscription as VS}from"urql";import{graphql as _c}from"gql.tada";function Uc({cwd:e,projectId:t}){let[{data:n}]=DS({query:WS,variables:{projectId:t}});BS(()=>{let r=n?.project?.devSession?.hooksPaused;r!=null&&Ic({cwd:e,paused:r})},[e,n]),VS({query:qS,variables:{projectId:t}},(r,o)=>{let i=o.hooksPausedRequested;return i!=null&&Ic({cwd:e,paused:i.paused}),o})}function Ic({cwd:e,paused:t}){let n=we(e,"hooks-paused");if(t){Je(e),jo.writeFileSync(n,"");return}jo.existsSync(n)&&jo.unlinkSync(n)}var WS,qS,jc=f(()=>{"use strict";J();WS=_c(`
244
254
  query HooksPausedState($projectId: String!) {
245
255
  project(id: $projectId) {
246
256
  id
@@ -250,18 +260,63 @@ ${n}`].join(`
250
260
  }
251
261
  }
252
262
  }
253
- `),Kh=tc(`
263
+ `),qS=_c(`
254
264
  subscription HooksPausedRequested($projectId: String!) {
255
265
  hooksPausedRequested(projectId: $projectId) {
256
266
  paused
257
267
  projectId
258
268
  }
259
269
  }
260
- `)});import yx from"chalk";import{z as oc}from"zod";async function ic(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${Qh}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return Yh.parse(r).version}catch{return}finally{clearTimeout(t)}}var Co,Qh,Yh,ac=g(()=>{"use strict";G();Co="0.1.11",Qh="ripplo",Yh=oc.object({version:oc.string()})});import{useEffect as Zh,useState as ek}from"react";import{Text as He}from"ink";import{jsx as lt,jsxs as ok}from"react/jsx-runtime";function sc({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:i}){let a=rk(),l=a!=null&&a!==Co,s=tk({connected:n,syncError:o}),c=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${Co}`,d=l?` \u2192 v${a}`:"",m="q to quit",h=` ripplo ${u}${d} | ${r} ${s}${c}${p}`,S=Math.max(0,i-h.length-m.length-1);return ok(He,{inverse:!0,children:[lt(He,{bold:!0,children:" ripplo "}),lt(He,{dimColor:!0,children:u}),l?lt(He,{color:"yellow",children:` \u2192 v${a}`}):null,` | ${r} `,lt(He,{color:nk({connected:n,syncError:o}),children:s}),t?null:lt(He,{color:"yellow",children:c}),p," ".repeat(S),lt(He,{dimColor:!0,children:m})," "]})}function tk({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function nk({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function rk(){let[e,t]=ek();return Zh(()=>{ic().then(n=>{n!=null&&t(n)})},[]),e}var lc=g(()=>{"use strict";ac()});import{useEffect as ik}from"react";import{Box as Nn,Text as xt,useApp as ak,useInput as sk}from"ink";import{jsx as ct,jsxs as Tn}from"react/jsx-runtime";function cc({config:e,cwd:t}){let n=ak(),{height:r,width:o}=st(),{config:i,devSessionId:a,syncError:l}=Yl({config:e,cwd:t}),{activeRunCount:s,browsersReady:c,connected:p}=Il({config:i,cwd:t,devSessionId:a});nc({cwd:t,projectId:e.projectId}),ik(()=>ll(t),[t]),sk(d=>{d==="q"&&n.exit()});let u=`${i.ripploServerUrl}/projects/${i.projectId}/developer`;return Tn(Nn,{flexDirection:"column",height:r,width:o,children:[ct(sc,{activeRunCount:s,browsersReady:c,connected:p,ripploServerUrl:i.ripploServerUrl,syncError:l,width:o}),Tn(Nn,{flexDirection:"column",flexGrow:1,padding:1,children:[Tn(Nn,{children:[ct(xt,{children:"Developer dashboard: "}),ct(xt,{color:"cyan",children:u})]}),Tn(Nn,{marginTop:1,children:[ct(xt,{dimColor:!0,children:"Run "}),ct(xt,{color:"yellow",children:"ripplo doctor"}),ct(xt,{dimColor:!0,children:" for health checks"})]})]})]})}var dc=g(()=>{"use strict";lo();bn();Zl();rc();yo();lc()});import{Text as pc}from"ink";import lk from"ink-spinner";import{jsx as uc,jsxs as dk}from"react/jsx-runtime";function mc({loading:e}){return e?dk(pc,{color:ck,children:[uc(lk,{type:"dots"})," Starting..."]}):uc(pc,{children:""})}var ck,fc=g(()=>{"use strict";ck="#24CFFF"});import{useEffect as pk,useState as Pt}from"react";import{Box as Je,Text as vo,useInput as uk}from"ink";import{jsx as Be,jsxs as xo}from"react/jsx-runtime";function gc({onDismiss:e}){let{height:t,width:n}=st(),[r,o]=Pt(0),[i,a]=Pt(!1),[l,s]=Pt(!1),[c,p]=Pt(!1),[u,d]=Pt(!1);uk(()=>{u&&e()}),pk(()=>{let S=80+Ln.length*70+80,k=[...Ln.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 m=Ln.length+5,h=Math.max(0,Math.floor((t-m)/2));return xo(Je,{flexDirection:"column",height:t,width:n,children:[Be(Je,{height:h}),xo(Je,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Be(Je,{flexDirection:"column",children:Ln.map((S,k)=>Be(vo,{color:yc,children:k<r?S:""},S))}),xo(Je,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Be(vo,{bold:!0,color:yc,children:i?mk:""}),Be(Je,{marginTop:1,children:Be(vo,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),Be(Je,{marginTop:2,children:Be(mc,{loading:c})})]})]})]})}var Ln,yc,mk,hc=g(()=>{"use strict";bn();fc();Ln=[" 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 "],yc="#24CFFF",mk="ripplo"});import{createAuthClient as fk}from"better-auth/client";import{deviceAuthorizationClient as yk}from"better-auth/client/plugins";function Cn({baseURL:e}){return fk({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[yk()]})}var Po=g(()=>{"use strict"});import{exec as gk}from"child_process";async function Sc({cwd:e,onDeviceCode:t,url:n}){let r=n??Tt().RIPPLO_SERVER_URL,o=Cn({baseURL:r}),i=await o.device.code({client_id:kc});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}),bk(s);let c=await kk({authClient:o,deviceCode:a});return Pr(e,c),c}async function kk({authClient:e,deviceCode:t}){for(;;){await wk(hk);let n=await e.device.token({client_id:kc,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(!Ak(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function Ak(e){return Sk.has(e)}function wk(e){return new Promise(t=>{setTimeout(t,e)})}function Rk(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function bk(e){let t=Rk();gk(`${t} "${e}"`,()=>{})}var hk,kc,Sk,Ac=g(()=>{"use strict";G();Po();rt();hk=5e3,kc="ripplo-cli";Sk=new Set(["authorization_pending","slow_down"])});import{useCallback as vn,useEffect as Nk,useState as Ve}from"react";import{exec as Tk}from"child_process";import{promisify as Lk}from"util";import z from"fs";import K from"path";function Rc({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Ve(t==null?"login":"validating"),[i,a]=Ve(),[l,s]=Ve(),[c,p]=Ve(t),[u,d]=Ve(!1),[m,h]=Ve(),[S,k]=Ve(),[A,w]=Ve([]);Nk(()=>{if(t==null)return;Cn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(L=>{if(L.data==null){o("login");return}return Eo({cwd:e,serverUrl:n,token:t})}).then(L=>{if(L==null){o("select-project");return}a(L),o("complete")}).catch(L=>{s(L instanceof Error?L.message:String(L)),o("login")})},[e,t,n]);let P=vn(()=>{u||(d(!0),s(void 0),Sc({cwd:e,onDeviceCode:h,url:n}).then(x=>(p(x),Eo({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=vn(x=>{let L=i?.token??c??t;if(L==null){s("No authentication token available");return}o("scaffolding"),s(void 0),Pk({cwd:e,onStep:k,projectId:x.id}).then(async D=>{w(D);let We=await Eo({cwd:e,serverUrl:n,token:L});a(We??Ck({projectId:x.id,serverUrl:n,token:L})),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]),N=vn(()=>{o("complete")},[]),$=vn(()=>{a(void 0),o("login"),d(!1),h(void 0),s(void 0)},[]);return{config:i,deviceCodeInfo:m,dismissScaffoldWarnings:N,error:l,loginStarted:u,resetToLogin:$,scaffoldingStep:S,scaffoldWarnings:A,selectProject:E,setStage:o,stage:r,startLogin:P,token:c}}function Ck({projectId:e,serverUrl:t,token:n}){return{appUrl:"",preconditionsUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Eo({cwd:e,serverUrl:t,token:n}){let r=await O(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Pk({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Bk({cwd:e,projectId:n}),t("Updating .gitignore..."),zk(e),t("Marking ripplo.lock as generated..."),_k(e),t("Installing dependencies...");let r=await Ek(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 Ok(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await ur(),o}async function Ek(e){let t=Uk({cwd:e,pm:Dk(e)});R.info("Installing dependencies: %s",t);try{return await xk(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
261
- `)[0]??n.message:String(n);return R.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function Ok(e){try{await Ik(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return R.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 Ik(e){let t=await O(e);if(!t.ok){R.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await ue({cwd:e,result:t.result})}function _k(e){let t=K.join(e,".gitattributes"),n=z.existsSync(t)?z.readFileSync(t,"utf8"):"";if(n.includes(wc))return;let r=n.length===0||n.endsWith(`
270
+ `)});import{useEffect as FS,useState as $c}from"react";import{useQuery as MS,useSubscription as Bc}from"urql";import{graphql as $o}from"gql.tada";function Vc({projectId:e}){let[{data:t}]=MS({query:HS,variables:{projectId:e}}),[n,r]=$c(),[o,i]=$c();return FS(()=>{let a=t?.project?.devSession?.hooksPaused;a!=null&&r(a);let s=t?.project?.devSession?.scopeItems;s!=null&&i(s.map(l=>Dc(l)))},[t]),Bc({query:zS,variables:{projectId:e}},(a,s)=>{let l=s.hooksPausedRequested;return l!=null&&r(l.paused),s}),Bc({query:JS,variables:{projectId:e}},(a,s)=>{let l=s.scopeChanged?.devSession?.scopeItems;return l!=null&&i(l.map(c=>Dc(c))),s}),{paused:n??!1,projectName:t?.project?.name,scope:o??[]}}function Dc(e){let t=e.workflow;return t!=null?{id:e.id,label:t.name}:{id:e.id,label:e.label??"(intent)"}}var HS,zS,JS,Wc=f(()=>{"use strict";HS=$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
+ `),zS=$o(`
291
+ subscription HooksPausedDashboard($projectId: String!) {
292
+ hooksPausedRequested(projectId: $projectId) {
293
+ paused
294
+ projectId
295
+ }
296
+ }
297
+ `),JS=$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 XS,Text as Bo}from"ink";import{jsx as qc,jsxs as Fc}from"react/jsx-runtime";function Mc({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return Fc(XS,{paddingX:1,children:[qc(Bo,{dimColor:!0,children:"Activity "}),Fc(Bo,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),qc(Bo,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var Hc=f(()=>{"use strict"});import{Box as GS,Text as En}from"ink";import{jsx as On,jsxs as QS}from"react/jsx-runtime";function zc({check:e}){let{detail:t,label:n,tone:r}=xn(e),o=KS[r];return QS(GS,{children:[On(En,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),On(En,{children:" "}),On(En,{children:n.padEnd(18," ")}),On(En,{color:o,children:t})]})}var KS,Jc=f(()=>{"use strict";Uo();KS={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as YS,Text as Xc}from"ink";import{jsx as Do,jsxs as ZS}from"react/jsx-runtime";function Gc({checks:e}){return ZS(YS,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Do(Xc,{bold:!0,children:"Health"}),e.length===0?Do(Xc,{dimColor:!0,children:"Running first pass..."}):e.map(t=>Do(zc,{check:t},t.type))]})}var Kc=f(()=>{"use strict";Jc()});import{Box as In,Text as mt}from"ink";import{jsx as ft,jsxs as _n}from"react/jsx-runtime";function Qc({appUrl:e,developerUrl:t,projectName:n}){return _n(In,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[_n(In,{children:[ft(mt,{dimColor:!0,children:"Project "}),ft(mt,{bold:!0,children:n})]}),_n(In,{children:[ft(mt,{dimColor:!0,children:"App "}),ft(mt,{color:"cyan",children:e})]}),_n(In,{children:[ft(mt,{dimColor:!0,children:"Dashboard "}),ft(mt,{color:"cyan",children:t})]})]})}var Yc=f(()=>{"use strict"});import{Box as Vo,Text as We}from"ink";import{jsx as qe,jsxs as Wo}from"react/jsx-runtime";function Zc({paused:e,scope:t}){return Wo(Vo,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Wo(Vo,{children:[qe(We,{bold:!0,children:"Scope"}),qe(We,{dimColor:!0,children:` (${String(t.length)})`}),qe(We,{children:" "}),qe(We,{dimColor:!0,children:"Hooks "}),qe(We,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?qe(We,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>Wo(Vo,{children:[qe(We,{color:"cyan",children:"\u2022 "}),qe(We,{children:n.label})]},n.id))]})}var ed=f(()=>{"use strict"});import{Box as ew,Text as td}from"ink";import{jsx as tw,jsxs as nd}from"react/jsx-runtime";function rd({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 nd(ew,{marginTop:1,paddingX:1,children:[tw(td,{dimColor:!0,children:"Workflows "}),nd(td,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var od=f(()=>{"use strict"});import PO from"chalk";import{z as id}from"zod";async function ad(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${nw}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return rw.parse(r).version}catch{return}finally{clearTimeout(t)}}var qo,nw,rw,sd=f(()=>{"use strict";J();qo="0.2.0",nw="ripplo",rw=id.object({version:id.string()})});import{useEffect as ow,useState as iw}from"react";import{Text as Qe}from"ink";import{jsx as yt,jsxs as cw}from"react/jsx-runtime";function ld({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let s=lw(),l=s!=null&&s!==qo,c=aw({connected:n,syncError:i}),d=t?"":" warming up browsers...",u=e>0?` ${String(e)} running`:"",p=`v${qo}`,m=l?` \u2192 v${s}`:"",h=`project ${r} \xB7 q to quit`,S=` ripplo ${p}${m} | ${o} ${c}${d}${u}`,k=Math.max(0,a-S.length-h.length-1);return cw(Qe,{inverse:!0,children:[yt(Qe,{bold:!0,children:" ripplo "}),yt(Qe,{dimColor:!0,children:p}),l?yt(Qe,{color:"yellow",children:` \u2192 v${s}`}):null,` | ${o} `,yt(Qe,{color:sw({connected:n,syncError:i}),children:c}),t?null:yt(Qe,{color:"yellow",children:d}),u," ".repeat(k),yt(Qe,{dimColor:!0,children:h})," "]})}function aw({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function sw({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function lw(){let[e,t]=iw();return ow(()=>{ad().then(n=>{n!=null&&t(n)})},[]),e}var cd=f(()=>{"use strict";sd()});import{useEffect as dw}from"react";import{availableParallelism as pw}from"os";import{Box as Fo,Text as uw,useApp as mw,useInput as fw}from"ink";import{jsx as Fe,jsxs as dd}from"react/jsx-runtime";function pd({config:e,cwd:t}){let n=mw(),{height:r,width:o}=ut(),{config:i,devSessionId:a,syncError:s}=Cc({config:e,cwd:t}),{activeRunCount:l,browsersReady:c,connected:d}=ic({config:i,cwd:t,devSessionId:a}),{checks:u}=Ec({config:i,cwd:t}),{paused:p,projectName:m,scope:h}=Vc({projectId:e.projectId});Uc({cwd:t,projectId:e.projectId}),dw(()=>Ol(t),[t]),fw(T=>{T==="q"&&n.exit()});let S=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,k=u.filter(T=>yw.has(T.type)),w=u.find(T=>T.type==="workflows"),b=u.find(T=>T.type==="preconditions"),v=pw(),x=m??"\u2026";return dd(Fo,{flexDirection:"column",height:r,width:o,children:[Fe(ld,{activeRunCount:l,browsersReady:c,connected:d,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:s,width:o}),dd(Fo,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[Fe(Qc,{appUrl:i.appUrl,developerUrl:S,projectName:x}),Fe(Zc,{paused:p,scope:h}),Fe(Gc,{checks:k}),Fe(rd,{preconditions:b,workflows:w}),Fe(Mc,{activeRunCount:l,browsersReady:c,maxConcurrency:v}),Fe(Fo,{marginTop:1,paddingX:1,children:Fe(uw,{dimColor:!0,children:"q quit"})})]})]})}var yw,ud=f(()=>{"use strict";wo();Pn();Lc();Oc();jc();Wc();Co();Hc();Kc();Yc();ed();od();cd();yw=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as md}from"ink";import gw from"ink-spinner";import{jsx as fd,jsxs as kw}from"react/jsx-runtime";function yd({loading:e}){return e?kw(md,{color:hw,children:[fd(gw,{type:"dots"})," Starting..."]}):fd(md,{children:""})}var hw,gd=f(()=>{"use strict";hw="#24CFFF"});import{useEffect as Sw,useState as Ut}from"react";import{Box as Ye,Text as Mo,useInput as ww}from"ink";import{jsx as Me,jsxs as Ho}from"react/jsx-runtime";function kd({onDismiss:e}){let{height:t,width:n}=ut(),[r,o]=Ut(0),[i,a]=Ut(!1),[s,l]=Ut(!1),[c,d]=Ut(!1),[u,p]=Ut(!1);ww(()=>{u&&e()}),Sw(()=>{let S=80+Un.length*70+80,k=[...Un.map((w,b)=>setTimeout(()=>{o(b+1)},80+b*70)),setTimeout(()=>{a(!0)},S),setTimeout(()=>{l(!0)},S+200),setTimeout(()=>{d(!0)},S+400),setTimeout(()=>{d(!1),p(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{k.forEach(w=>{clearTimeout(w)})}},[e]);let m=Un.length+5,h=Math.max(0,Math.floor((t-m)/2));return Ho(Ye,{flexDirection:"column",height:t,width:n,children:[Me(Ye,{height:h}),Ho(Ye,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Me(Ye,{flexDirection:"column",children:Un.map((S,k)=>Me(Mo,{color:hd,children:k<r?S:""},S))}),Ho(Ye,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Me(Mo,{bold:!0,color:hd,children:i?Aw:""}),Me(Ye,{marginTop:1,children:Me(Mo,{color:"gray",dimColor:!0,children:s?"developer CLI":""})}),Me(Ye,{marginTop:2,children:Me(yd,{loading:c})})]})]})]})}var Un,hd,Aw,Sd=f(()=>{"use strict";Pn();gd();Un=[" 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 "],hd="#24CFFF",Aw="ripplo"});import{createAuthClient as bw}from"better-auth/client";import{deviceAuthorizationClient as Rw}from"better-auth/client/plugins";function jn({baseURL:e}){return bw({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Rw()]})}var zo=f(()=>{"use strict"});import{exec as Tw}from"child_process";async function Ad({cwd:e,onDeviceCode:t,url:n}){let r=n??xt().RIPPLO_SERVER_URL,o=jn({baseURL:r}),i=await o.device.code({client_id:wd});if(i.error!=null)throw new Error(`Failed to request device code: ${i.error.error_description}`);let{device_code:a,user_code:s,verification_uri_complete:l}=i.data;t({userCode:s,verificationUrl:l}),Ew(l);let c=await Nw({authClient:o,deviceCode:a});return Br(e,c),c}async function Nw({authClient:e,deviceCode:t}){for(;;){await Pw(vw);let n=await e.device.token({client_id:wd,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(!Lw(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function Lw(e){return Cw.has(e)}function Pw(e){return new Promise(t=>{setTimeout(t,e)})}function xw(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function Ew(e){let t=xw();Tw(`${t} "${e}"`,()=>{})}var vw,wd,Cw,bd=f(()=>{"use strict";J();zo();lt();vw=5e3,wd="ripplo-cli";Cw=new Set(["authorization_pending","slow_down"])});import{useCallback as $n,useEffect as Ow,useState as He}from"react";import{exec as Iw}from"child_process";import{promisify as _w}from"util";import M from"fs";import G from"path";function Td({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=He(t==null?"login":"validating"),[i,a]=He(),[s,l]=He(),[c,d]=He(t),[u,p]=He(!1),[m,h]=He(),[S,k]=He(),[w,b]=He([]);Ow(()=>{if(t==null)return;jn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(C=>{if(C.data==null){o("login");return}return Jo({cwd:e,serverUrl:n,token:t})}).then(C=>{if(C==null){o("select-project");return}a(C),o("complete")}).catch(C=>{l(C instanceof Error?C.message:String(C)),o("login")})},[e,t,n]);let v=$n(()=>{u||(p(!0),l(void 0),Ad({cwd:e,onDeviceCode:h,url:n}).then(E=>(d(E),Jo({cwd:e,serverUrl:n,token:E}))).then(E=>{E==null?o("select-project"):(a(E),o("complete"))}).catch(E=>{p(!1),h(void 0),l(E instanceof Error?E.message:String(E))}))},[e,u,n]),x=$n(E=>{let C=i?.token??c??t;if(C==null){l("No authentication token available");return}o("scaffolding"),l(void 0),Bw({cwd:e,onStep:k,projectId:E.id}).then(async D=>{b(D);let ze=await Jo({cwd:e,serverUrl:n,token:C});a(ze??Uw({projectId:E.id,serverUrl:n,token:C})),o(D.length>0?"scaffolding-warnings":"complete")}).catch(D=>{l(D instanceof Error?D.message:String(D)),o("select-project")})},[i,e,t,n,c]),T=$n(()=>{o("complete")},[]),$=$n(()=>{a(void 0),o("login"),p(!1),h(void 0),l(void 0)},[]);return{config:i,deviceCodeInfo:m,dismissScaffoldWarnings:T,error:s,loginStarted:u,resetToLogin:$,scaffoldingStep:S,scaffoldWarnings:w,selectProject:x,setStage:o,stage:r,startLogin:v,token:c}}function Uw({projectId:e,serverUrl:t,token:n}){return{appUrl:"",engineUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Jo({cwd:e,serverUrl:t,token:n}){let r=await O(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Bw({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Jw({cwd:e,projectId:n}),t("Updating .gitignore..."),Zw(e),t("Marking ripplo.lock as generated..."),qw(e),t("Installing dependencies...");let r=await Dw(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 Vw(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await wr(),o}async function Dw(e){let t=Fw({cwd:e,pm:zw(e)});A.info("Installing dependencies: %s",t);try{return await $w(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
316
+ `)[0]??n.message:String(n);return A.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function Vw(e){try{await Ww(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return A.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 Ww(e){let t=await O(e);if(!t.ok){A.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await ue({cwd:e,result:t.result})}function qw(e){let t=G.join(e,".gitattributes"),n=M.existsSync(t)?M.readFileSync(t,"utf8"):"";if(n.includes(Rd))return;let r=n.length===0||n.endsWith(`
262
317
  `)?"":`
263
- `;z.writeFileSync(t,`${n}${r}${wc}
264
- `)}function Uk({cwd:e,pm:t}){let n=vk.join(" ");return t==="pnpm"?jk(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?$k(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function jk(e){return z.existsSync(K.join(e,"pnpm-workspace.yaml"))||z.existsSync(K.join(e,"pnpm-workspace.yml"))}function $k(e){let t=K.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 Dk(e){return z.existsSync(K.join(e,"pnpm-lock.yaml"))?"pnpm":z.existsSync(K.join(e,"yarn.lock"))?"yarn":z.existsSync(K.join(e,"bun.lockb"))||z.existsSync(K.join(e,"bun.lock"))?"bun":"npm"}function Bk({cwd:e,projectId:t}){let n=K.join(e,".ripplo"),r=K.join(n,"tests"),o=K.join(n,"preconditions");z.mkdirSync(r,{recursive:!0}),z.mkdirSync(o,{recursive:!0}),xn(K.join(n,"ripplo.ts"),Vk(t)),xn(K.join(n,"index.ts"),qk),xn(K.join(n,".env"),Wk()),xn(K.join(n,"tsconfig.json"),Fk)}function xn(e,t){z.existsSync(e)||z.writeFileSync(e,t)}function Vk(e){return`import { config } from "dotenv";
318
+ `;M.writeFileSync(t,`${n}${r}${Rd}
319
+ `)}function Fw({cwd:e,pm:t}){let n=jw.join(" ");return t==="pnpm"?Mw(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?Hw(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function Mw(e){return M.existsSync(G.join(e,"pnpm-workspace.yaml"))||M.existsSync(G.join(e,"pnpm-workspace.yml"))}function Hw(e){let t=G.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 zw(e){return M.existsSync(G.join(e,"pnpm-lock.yaml"))?"pnpm":M.existsSync(G.join(e,"yarn.lock"))?"yarn":M.existsSync(G.join(e,"bun.lockb"))||M.existsSync(G.join(e,"bun.lock"))?"bun":"npm"}function Jw({cwd:e,projectId:t}){let n=G.join(e,".ripplo"),r=G.join(n,"tests"),o=G.join(n,"preconditions"),i=G.join(n,"observers");M.mkdirSync(r,{recursive:!0}),M.mkdirSync(o,{recursive:!0}),M.mkdirSync(i,{recursive:!0}),Bn(G.join(n,"ripplo.ts"),Xw(t)),Bn(G.join(n,"index.ts"),Kw),Bn(G.join(n,".env"),Gw()),Bn(G.join(n,"tsconfig.json"),Qw)}function Bn(e,t){M.existsSync(e)||M.writeFileSync(e,t)}function Xw(e){return`import { config } from "dotenv";
265
320
  import { createRipplo } from "@ripplo/testing";
266
321
  import { z } from "zod";
267
322
 
@@ -275,24 +330,24 @@ const env = z
275
330
 
276
331
  const ripplo = createRipplo({
277
332
  appUrl: "http://localhost:3000",
278
- preconditionsUrl: "http://localhost:3000/ripplo/preconditions",
333
+ engineUrl: "http://localhost:3000/ripplo",
279
334
  projectId: "${e}",
280
335
  webhookSecret: env.RIPPLO_WEBHOOK_SECRET,
281
336
  });
282
337
 
283
338
  export default ripplo;
284
- `}function Wk(){return`RIPPLO_WEBHOOK_SECRET="${Xr()}"
285
- `}function zk(e){let t=K.join(e,".gitignore");if(!z.existsSync(t))return;let n=z.readFileSync(t,"utf8"),r=Mk.filter(i=>!n.includes(i));if(r.length===0)return;let o=n.endsWith(`
339
+ `}function Gw(){return`RIPPLO_WEBHOOK_SECRET="${Zr()}"
340
+ `}function Zw(e){let t=G.join(e,".gitignore");if(!M.existsSync(t))return;let n=M.readFileSync(t,"utf8"),r=Yw.filter(i=>!n.includes(i));if(r.length===0)return;let o=n.endsWith(`
286
341
  `)?"":`
287
- `;z.writeFileSync(t,n+o+r.join(`
342
+ `;M.writeFileSync(t,n+o+r.join(`
288
343
  `)+`
289
- `)}var vk,xk,wc,qk,Fk,Mk,bc=g(()=>{"use strict";G();Pe();Ac();Po();J();vk=["@ripplo/testing","dotenv","zod"],xk=Lk(Tk);wc=".ripplo/ripplo.lock linguist-generated=true";qk=`// Register every precondition and test here. The CLI loads this one file \u2014
344
+ `)}var jw,$w,Rd,Kw,Qw,Yw,vd=f(()=>{"use strict";J();Ee();bd();zo();K();jw=["@ripplo/testing","dotenv","zod"],$w=_w(Iw);Rd=".ripplo/ripplo.lock linguist-generated=true";Kw=`// Register every precondition, observer, and test here. The CLI loads this one file \u2014
290
345
  // anything not imported from here is invisible to ripplo run / lint / status.
291
- // When you add a test under ./tests or a precondition under ./preconditions,
292
- // add a matching \`import "./..."\` line below.
346
+ // When you add a test under ./tests, a precondition under ./preconditions,
347
+ // or an observer under ./observers, add a matching \`import "./..."\` line below.
293
348
 
294
349
  export { default } from "./ripplo.js";
295
- `,Fk=`{
350
+ `,Qw=`{
296
351
  "compilerOptions": {
297
352
  "strict": true,
298
353
  "noUncheckedIndexedAccess": true,
@@ -305,38 +360,52 @@ export { default } from "./ripplo.js";
305
360
  "isolatedModules": true,
306
361
  "lib": ["ES2023"]
307
362
  },
308
- "include": ["*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
363
+ "include": ["*.ts", "observers/**/*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
309
364
  "exclude": ["node_modules"]
310
365
  }
311
- `,Mk=[".ripplo/debug/",".ripplo/.local/",".ripplo/.env"]});import{useCallback as Hk,useState as Jk}from"react";import{Box as Oo,Text as Io}from"ink";import{Provider as _o}from"urql";import{jsx as re,jsxs as Xk}from"react/jsx-runtime";function Nc({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Jk(!0),i=Rc({cwd:e,initialToken:t,serverUrl:n}),{height:a,width:l}=st(),s=Hk(()=>{o(!1)},[]);if(r)return re(gc,{onDismiss:s});if(i.stage==="validating")return re(Oo,{alignItems:"center",height:a,justifyContent:"center",width:l,children:Xk(Io,{children:[re(Io,{color:"yellow",children:"* "}),re(Io,{children:"Validating session..."})]})});if(i.stage==="login")return re(Oo,{alignItems:"center",height:a,justifyContent:"center",width:l,children:re(bo,{deviceCodeInfo:i.deviceCodeInfo,error:i.error,loginStarted:i.loginStarted,startLogin:i.startLogin})});if(i.config!=null){let c=Ro({config:i.config});return Uo({client:c,projectId:i.config.projectId}),i.stage==="complete"?re(_o,{value:c,children:re(cc,{config:i.config,cwd:e})}):re(_o,{value:c,children:re(To,{config:i.config,error:i.error,scaffoldingStep:i.scaffoldingStep,scaffoldWarnings:i.scaffoldWarnings,selectProject:i.selectProject,stage:i.stage,onDismissWarnings:i.dismissScaffoldWarnings})})}if(i.token!=null){let c={appUrl:"",preconditionsUrl:"",projectId:"",ripploServerUrl:n,token:i.token,webhookSecret:""},p=Ro({config:c});return re(_o,{value:p,children:re(To,{config:c,error:i.error,scaffoldingStep:i.scaffoldingStep,scaffoldWarnings:i.scaffoldWarnings,selectProject:i.selectProject,stage:i.stage,onDismissWarnings:i.dismissScaffoldWarnings})})}return re(Oo,{alignItems:"center",height:a,justifyContent:"center",width:l,children:re(bo,{deviceCodeInfo:i.deviceCodeInfo,error:i.error,loginStarted:i.loginStarted,startLogin:i.startLogin})})}var Tc=g(()=>{"use strict";jo();Vl();ql();Kl();dc();hc();bc();bn()});var Lc={};jc(Lc,{clearActiveSession:()=>Zk,launchDashboard:()=>tS,setActiveSession:()=>Uo});import Pn from"fs";import $o from"path";import Gk from"react";import{render as Kk}from"ink";import{graphql as Qk}from"gql.tada";function Uo({client:e,projectId:t}){En=e,On=t}function Zk(){En=void 0,On=void 0}function eS(){if(En==null||On==null)return Promise.resolve();let e=En.mutation(Yk,{projectId:On}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function tS(){let e=process.cwd(),t=$o.join(e,".ripplo","debug"),n=$o.join(t,"last-crash.log");function r(a){Pn.mkdirSync(t,{recursive:!0});let l=a instanceof Error?a.stack??a.message:String(a);Pn.writeFileSync(n,`${new Date().toISOString()}
312
- ${l}
313
- `),Ol().finally(()=>{process.exit(1)})}let o;try{let a=we(e),l=$e();ar({filePath:$o.join(t,"debug.log")}),o=Kk(Gk.createElement(Nc,{cwd:e,initialToken:a??void 0,serverUrl:l}),{alternateScreen:!0}),o.waitUntilExit().then(()=>eS()).then(()=>{process.exit(0)})}catch(a){r(a)}let i=!1;process.on("SIGINT",()=>{i||(i=!0,o?.unmount())}),process.on("SIGTERM",()=>{i||(i=!0,o?.unmount())}),process.on("uncaughtException",a=>{r(a)}),process.on("unhandledRejection",a=>{try{Pn.mkdirSync(t,{recursive:!0});let l=a instanceof Error?a.stack??a.message:String(a);Pn.appendFileSync(n,`${new Date().toISOString()} [unhandledRejection]
314
- ${l}
366
+ `,Yw=[".ripplo/debug/",".ripplo/.local/",".ripplo/.env"]});import{useCallback as eA,useEffect as tA,useMemo as Nd,useState as nA}from"react";import{Box as Cd,Text as Xo}from"ink";import{Provider as rA}from"urql";import{graphql as oA}from"gql.tada";import{jsx as Pe,jsxs as lA}from"react/jsx-runtime";function Ld({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=nA(!0),i=Td({cwd:e,initialToken:t,serverUrl:n}),{height:a,width:s}=ut(),l=Nd(()=>aA({serverUrl:n,setup:i}),[i,n]),c=Nd(()=>uc({config:l}),[l]);tA(()=>{i.config!=null&&(Go({client:c,projectId:i.config.projectId}),c.query(iA,{projectId:i.config.projectId}).toPromise())},[c,i.config]);let d=eA(()=>{o(!1)},[]);return Pe(rA,{value:c,children:sA({cwd:e,dismissSplash:d,effectiveConfig:l,height:a,setup:i,showSplash:r,width:s})})}function aA({serverUrl:e,setup:t}){return t.config!=null?t.config:{appUrl:"",engineUrl:"",projectId:"",ripploServerUrl:e,token:t.token??"",webhookSecret:""}}function sA({cwd:e,dismissSplash:t,effectiveConfig:n,height:r,setup:o,showSplash:i,width:a}){return i?Pe(kd,{onDismiss:t}):o.stage==="validating"?Pe(Cd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:lA(Xo,{children:[Pe(Xo,{color:"yellow",children:"* "}),Pe(Xo,{children:"Validating session..."})]})}):o.stage==="complete"&&o.config!=null?Pe(pd,{config:o.config,cwd:e}):o.stage==="login"||o.token==null?Pe(Cd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:Pe(yc,{deviceCodeInfo:o.deviceCodeInfo,error:o.error,loginStarted:o.loginStarted,startLogin:o.startLogin})}):Pe(Tc,{config:o.config??n,error:o.error,scaffoldingStep:o.scaffoldingStep,scaffoldWarnings:o.scaffoldWarnings,selectProject:o.selectProject,stage:o.stage,onDismissWarnings:o.dismissScaffoldWarnings})}var iA,Pd=f(()=>{"use strict";Ko();mc();gc();vc();ud();Sd();vd();Pn();iA=oA(`
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 xd={};Yo(xd,{clearActiveSession:()=>mA,launchDashboard:()=>yA,setActiveSession:()=>Go});import jt from"fs";import Qo from"path";import cA from"react";import{render as dA}from"ink";import{graphql as pA}from"gql.tada";function Go({client:e,projectId:t}){Dn=e,Vn=t}function mA(){Dn=void 0,Vn=void 0}function fA(){if(Dn==null||Vn==null)return Promise.resolve();let e=Dn.mutation(uA,{projectId:Vn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function yA({restoreStdio:e}){let t=process.cwd(),n=Qo.join(t,".ripplo","debug"),r=Qo.join(n,"debug.log"),o=Qo.join(n,"last-crash.log");jt.mkdirSync(n,{recursive:!0}),yr({filePath:r});function i(l){e(),jt.mkdirSync(n,{recursive:!0});let c=l instanceof Error?l.stack??l.message:String(l);jt.writeFileSync(o,`${new Date().toISOString()}
387
+ ${c}
388
+ `),oc().finally(()=>{process.exit(1)})}let a;try{let l=Ae(t),c=De();e(),a=dA(cA.createElement(Ld,{cwd:t,initialToken:l??void 0,serverUrl:c}),{alternateScreen:!0}),a.waitUntilExit().then(()=>fA()).then(()=>{process.exit(0)})}catch(l){i(l)}let s=!1;process.on("SIGINT",()=>{s||(s=!0,a?.unmount())}),process.on("SIGTERM",()=>{s||(s=!0,a?.unmount())}),process.on("uncaughtException",l=>{i(l)}),process.on("unhandledRejection",l=>{try{jt.mkdirSync(n,{recursive:!0});let c=l instanceof Error?l.stack??l.message:String(l);jt.appendFileSync(o,`${new Date().toISOString()} [unhandledRejection]
389
+ ${c}
315
390
 
316
- `)}catch{}})}var Yk,En,On,jo=g(()=>{"use strict";yo();G();Tc();rt();Yk=Qk(`
391
+ `)}catch{}})}var uA,Dn,Vn,Ko=f(()=>{"use strict";Co();J();Pd();lt();uA=pA(`
317
392
  mutation EndDevSessionExit($projectId: String!) {
318
393
  endDevSession(projectId: $projectId) {
319
394
  id
320
395
  }
321
396
  }
322
- `)});import{config as Cc}from"dotenv";import nS from"fs";import dt from"path";import{fileURLToPath as rS}from"url";import oS from"yargs";import{hideBin as iS}from"yargs/helpers";Pe();J();async function Qo(e){let t=process.cwd(),n=await O(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
323
- `),process.exit(1)),e.check){let r=await _t({cwd:t}),o=Ut({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${Se} is up to date
397
+ `)});import{config as Ed}from"dotenv";import gA from"fs";import Ze from"path";import{fileURLToPath as hA}from"url";import kA from"yargs";import{hideBin as SA}from"yargs/helpers";Ee();K();async function ui(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 Vt({cwd:t}),o=Wt({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${Se} is up to date
324
399
  `);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${Se} is ${i} \u2014 run \`ripplo compile\` and commit the result
325
400
  `),process.exit(1)}await ue({cwd:t,result:n.result}),process.stdout.write(`wrote ${Se}
326
- `)}G();Pe();import bt from"fs";import $s from"path";import{chromium as Jf}from"playwright";J();import zf from"fs";import Hf from"path";async function Us(e){let t=Hf.join(e,".ripplo","index.ts");if(!zf.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 oo(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 js({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}}J();function Ds(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 Bs(e){let t=await Kf(e),n=Qf(e),r=Yf(),o=await O(e),i=Zf(o),a=ny(o),l=await Xf(e,o),s=Gf(e),c=await ry(t,o);return[t,n,...c,i,a,l,s,r]}async function Xf(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await _t({cwd:e});return{status:Ut({compiled:t.result,existing:n}),type:"lockfile"}}function Gf(e){let t=$s.join(e,".git","hooks","pre-commit");return bt.existsSync(t)?{installed:bt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Kf(e){let t=await Us(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 Qf(e){let t=$s.join(e,".ripplo",".local","token");return bt.existsSync(t)?{exists:bt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function Yf(){let e=Jf.executablePath();return{installed:bt.existsSync(e),type:"browser"}}function Zf(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=ey(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function ey(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}`})})}),ty(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function ty(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 ny(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 ry(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await oo(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await oy(n,t);return r.push(...i),r}async function oy(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=sy(e.appUrl,e.preconditionsUrl);if(i==null)return[o];let a=await oo(i)==null,l=[];if(l.push({configured:!0,count:n,endpointReachable:a,type:"preconditions"}),Vs(e.preconditionsUrl)&&l.push({reachable:a,type:"precondition-endpoint",url:i}),!a)return l;let s=await js({appUrl:e.appUrl,preconditionsUrl:e.preconditionsUrl});l.push({rejectsUnsigned:s==null,type:"webhook-verification"});let c=await iy({preconditionUrl:i,webhookSecret:e.webhookSecret});return l.push({status:c,type:"adapter-enabled",url:i}),l}async function iy({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",...nt({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 ay(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 Vs(e){return e.startsWith("http://")||e.startsWith("https://")}function sy(e,t){return Vs(t)?t:`${e}${t}`}function Ws(e){switch(e.type){case"settings":return dy(e);case"token":return py(e);case"dev-server":return uy(e);case"preconditions":return yy(e);case"webhook-verification":return my(e);case"preconditions-validation":return gy(e);case"workflows":return hy(e);case"browser":return fy(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 ay(e);case"lockfile":return ly(e);case"pre-commit-hook":return cy(e)}}function ly(e){switch(e.status){case"match":return`\u2713 Lockfile: ${Se} is up to date`;case"missing":return`\u2717 Lockfile: ${Se} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${Se} is out of date \u2014 run \`ripplo compile\` and commit it`}}function cy(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 dy(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function py(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function uy(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 my(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 fy(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function yy(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 gy(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"}
327
- ${t.join(`
328
- `)}`}function hy(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=>ky(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
329
- ${t.join(`
330
- `)}`}function ky(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
331
- `+t.join(`
332
- `)}async function qs(){let e=process.cwd(),t=await Bs(e),n=t.map(o=>Ws(o));process.stdout.write(n.join(`
401
+ `)}fo();async function ll(){let e=process.cwd(),t=await gn(e),n=t.map(o=>sl(o));process.stdout.write(n.join(`
333
402
  `)+`
334
- `);let r=t.some(o=>Ds(o));process.exit(r?1:0)}G();import{graphql as cn,readFragment as Sy}from"gql.tada";import Fs from"figures";var Nt={cross:Fs.cross,tick:Fs.tick};var zs=cn(`
403
+ `);let r=t.some(o=>il(o));process.exit(r?1:0)}J();import{graphql as hn,readFragment as Bg}from"gql.tada";import cl from"figures";var Pt={cross:cl.cross,tick:cl.tick};var pl=hn(`
335
404
  fragment WorkflowIdMCP on Workflow {
336
405
  id
337
406
  slug
338
407
  }
339
- `),Ay=cn(`
408
+ `),Dg=hn(`
340
409
  query ProjectWorkflowIdsMCP($projectId: String!) {
341
410
  project(id: $projectId) {
342
411
  id
@@ -348,14 +417,14 @@ ${t.join(`
348
417
  }
349
418
  }
350
419
  }
351
- `,[zs]),wy=cn(`
420
+ `,[pl]),Vg=hn(`
352
421
  mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
353
422
  createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
354
423
  id
355
424
  status
356
425
  }
357
426
  }
358
- `),Ry=cn(`
427
+ `),Wg=hn(`
359
428
  query RunStatusMCP($id: String!) {
360
429
  run(id: $id) {
361
430
  id
@@ -382,16 +451,16 @@ ${t.join(`
382
451
  }
383
452
  }
384
453
  }
385
- `);async function dn({config:e,ids:t}){let n=await by({config:e,ids:t}),r=await Promise.allSettled(n.map(async({id:s,workflowId:c})=>{let p=await Ty({config:e,workflowId:c});return{id:s,runId:p}})),o=[],i=[];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);i.push({id:p.id,runId:"",summary:`ERROR creating run: ${u}`})}),(await Promise.allSettled(o.map(async({id:s,runId:c})=>{let p=await Cy({config:e,runId:c}),u=Ny({config:e,id:s,runId:c}),d=`.ripplo/debug/${c}/`;return{id:s,runId:c,summary:`View run: ${u}
386
- Debug artifacts: ${d}
454
+ `);async function kn({config:e,ids:t}){let n=await qg({config:e,ids:t}),r=await Promise.all(n.map(async a=>{try{let s=await Mg({config:e,workflowId:a.workflowId});return{entry:a,ok:!0,runId:s}}catch(s){let l=s instanceof Error?s.message:String(s);return{entry:a,message:l,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:s,runId:l}=a;try{let c=await zg({config:e,runId:l}),d=Fg({config:e,id:s.id,runId:l}),u=`.ripplo/debug/${l}/`;return{id:s.id,runId:l,summary:`View run: ${d}
455
+ Debug artifacts: ${u}
387
456
 
388
- ${p}`}}))).forEach((s,c)=>{let p=o[c];if(p==null)return;if(s.status==="fulfilled"){i.push(s.value);return}let u=s.reason instanceof Error?s.reason.message:String(s.reason);i.push({id:p.id,runId:p.runId,summary:`ERROR polling run ${p.runId}: ${u}`})});let l=i.map(s=>`**${s.id}:**
389
- ${s.summary}`).join(`
457
+ ${c}`}}catch(c){let d=c instanceof Error?c.message:String(c);return{id:s.id,runId:l,summary:`ERROR polling run ${l}: ${d}`}}})),i=o.map(a=>`**${a.id}:**
458
+ ${a.summary}`).join(`
390
459
 
391
460
  ---
392
461
 
393
- `);return{results:i,summary:l}}async function by({config:e,ids:t}){let n=await j({config:e,document:Ay,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=>Sy(zs,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 Ny({config:e,id:t,runId:n}){return`${e.ripploServerUrl.replace(/:3000\b/,":3001")}/projects/${e.projectId}/workflows/${t}/runs/${n}`}async function Ty({config:e,workflowId:t}){let n=await j({config:e,document:wy,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Ly=2e3,Ms=150;async function Cy({config:e,runId:t}){let n=0;for(;n<Ms;){await xy(Ly),n+=1;let o=(await j({config:e,document:Ry,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return vy({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(Ms)} times.`}function vy({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"?Nt.tick:Nt.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"?Nt.tick:Nt.cross,p=s.detail==null?"":` \u2014 ${s.detail}`;r.push(` ${c} ${s.description}${p}`)})})}),r.join(`
394
- `)}function xy(e){return new Promise(t=>{setTimeout(t,e)})}G();J();rt();import{graphql as Uy}from"gql.tada";var jy=Uy(`
462
+ `);return{results:o,summary:i}}async function qg({config:e,ids:t}){let n=await U({config:e,document:Dg,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=>Bg(pl,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 Fg({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 Mg({config:e,workflowId:t}){let n=await U({config:e,document:Vg,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Hg=2e3,dl=150;async function zg({config:e,runId:t}){let n=0;for(;n<dl;){await Xg(Hg),n+=1;let o=(await U({config:e,document:Wg,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return Jg({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(dl)} times.`}function Jg({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"?Pt.tick:Pt.cross,s=i.detail==null?"":` \u2014 ${i.detail}`;r.push(` ${a} ${i.title} (${String(i.duration)}ms)${s}`),i.assertions.forEach(l=>{let c=l.status==="passed"?Pt.tick:Pt.cross,d=l.detail==null?"":` \u2014 ${l.detail}`;r.push(` ${c} ${l.description}${d}`)})})}),r.join(`
463
+ `)}function Xg(e){return new Promise(t=>{setTimeout(t,e)})}J();K();lt();import{graphql as eh}from"gql.tada";var th=eh(`
395
464
  query DevSessionCheckPreflight($projectId: String!) {
396
465
  project(id: $projectId) {
397
466
  id
@@ -400,31 +469,31 @@ ${s.summary}`).join(`
400
469
  }
401
470
  }
402
471
  }
403
- `);async function be(){let e=process.cwd(),t=we(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}
404
- `),process.exit(1)),{...n.result.config,ripploServerUrl:$e(),token:t}}async function Ne(e){(await j({config:e,document:jy,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 Xs({id:e,runs:t}){let n=await be();await Ne(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
405
- `);let r=await Promise.allSettled(Array.from({length:t},()=>dn({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(`
406
- `).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(`
472
+ `);async function Re(){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:De(),token:t}}async function Te(e){(await U({config:e,document:th,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 fl({id:e,runs:t}){let n=await Re();await Te(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
474
+ `);let r=await Promise.allSettled(Array.from({length:t},()=>kn({config:n,ids:[e]}))),o=0,i=0,a=new Map;r.forEach(l=>{if(l.status==="rejected"){i++;let d=l.reason instanceof Error?l.reason.message:"unknown error";a.set(d,(a.get(d)??0)+1);return}let c=l.value.results[0];if(c==null){i++;return}if(c.summary.includes("FAILED")||c.summary.includes("ERROR")){i++;let d=c.summary.split(`
475
+ `).find(u=>u.includes("FAILED")||u.includes("ERROR"))??"unknown failure";a.set(d,(a.get(d)??0)+1)}else o++});let s=t>0?i/t*100:0;process.stdout.write(`
407
476
  Results: ${String(o)} passed, ${String(i)} failed out of ${String(t)} runs
408
- `),process.stdout.write(`Flake rate: ${l.toFixed(1)}%
477
+ `),process.stdout.write(`Flake rate: ${s.toFixed(1)}%
409
478
  `),a.size>0&&(process.stdout.write(`
410
479
  Failure patterns:
411
- `),a.forEach((s,c)=>{process.stdout.write(` ${String(s)}x: ${c}
412
- `)})),process.exit(i>0?1:0)}import so from"fs";import Ks from"path";Vn();jt();var Gs=Do(Jr(),1);import{z as Te}from"zod";import{z as ge}from"zod";var pn=["src/**","app/**","apps/**","pages/**","routes/**","components/**"],un=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md"],$y=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 eL=ge.object({preconditions:ge.array(ge.string().min(1))}),tL=ge.object({data:ge.record(ge.string(),ge.record(ge.string(),ge.string())),preconditions:ge.array(ge.string().min(1))});function ot(e){let t=[];return e.tests.forEach(n=>{let r=Dy(n),o=i=>{t.push({...i,test:n.slug})};og.forEach(i=>{i(r,n,o)})}),{diagnostics:t}}function Dy(e){let t=[],n=e.spec.entryNode,r=new Set;for(;n!=null&&!r.has(n);){r.add(n);let o=e.spec.nodes[n];if(o==null)break;t.push(o),n=o.next}return t}function By(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 Vy(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Jy(o.value)){let i=o.value.value;!Xy(i)&&Gy(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 Wy(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 qy(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 Fy(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 My(e,t,n){let r=0;e.forEach(o=>{it(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 zy(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!it(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 Hy(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Jy(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Xy(e){return e.includes("{{")}function Gy(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function it(e){return e.type.startsWith("assert")}var Ky=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function Qy(e){return Ky.has(e.type)}function Yy(e,t,n){!t.implemented||e.length===0||e.some(r=>it(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Zy(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(i=>it(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 io(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 eg(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let i=io(r);if(i==null)return;let a=e.slice(o+1,o+4);a.find(c=>c.type==="assertVisible"&&io(c)===i)==null||a.some(c=>Qy(c)||it(c)&&io(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 tg=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 ao(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!tg.has(t))}function ng(e){let t=e.label==null?[]:ao(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,...ao(r)]}function rg(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(ao(t.expectedOutcome));if(r.size===0)return;let o=e.filter(a=>it(a));if(o.length===0)return;o.some(a=>ng(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 og=[By,Vy,Wy,qy,Fy,My,zy,Hy,Yy,Zy,eg,rg];Pe();J();async function Qs(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await O(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
413
- `),process.exit(1)),await ue({cwd:r,result:o.result});let i=ot(o.result),a=t.length===0?i.diagnostics:i.diagnostics.filter(d=>t.includes(d.test)),l=new Map;a.forEach(d=>{let m=l.get(d.test)??[];l.set(d.test,[...m,d])}),l.forEach((d,m)=>{process.stderr.write(`
414
- ${m}
415
- `),d.forEach(h=>{let S=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${S}
480
+ `),a.forEach((l,c)=>{process.stdout.write(` ${String(l)}x: ${c}
481
+ `)})),process.exit(i>0?1:0)}import So from"fs";import Sl from"path";import*as wl from"remeda";Gn();qt();import{z as ve}from"zod";var yo=["src/**","app/**","apps/**","pages/**","routes/**","components/**"],go=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md"],nh=ve.object({appUrl:ve.string(),engineUrl:ve.string(),ignorePaths:ve.array(ve.string()).optional(),projectId:ve.string(),watchPaths:ve.array(ve.string()).optional(),webhookSecret:ve.string()});var yl=Zo(Yr(),1);import{z as B}from"zod";var LL=B.object({preconditions:B.array(B.string().min(1))}),PL=B.object({data:B.record(B.string(),B.record(B.string(),B.string())),preconditions:B.array(B.string().min(1))}),xL=B.object({observer:B.string().min(1).max(200),params:B.record(B.string().max(200),B.string())}),rh=B.discriminatedUnion("kind",[B.object({kind:B.literal("pass")}),B.object({kind:B.literal("retry"),reason:B.string()}),B.object({kind:B.literal("fail"),reason:B.string()})]),EL=B.object({error:B.string().optional(),outcome:rh.optional(),success:B.boolean()});function ct(e){let t=[];return e.tests.forEach(n=>{let r=oh(n),o=i=>{t.push({...i,test:n.slug})};vh.forEach(i=>{i(r,n,o)})}),{diagnostics:t}}function oh(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 ih(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 ah(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&hl(o.value)){let i=o.value.value;!kl(i)&&mh(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 sh(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 lh(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 ch(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 dh(e,t,n){let r=0;e.forEach(o=>{dt(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 ph(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!dt(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 uh(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function hl(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function kl(e){return e.includes("{{")}function mh(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function dt(e){return e.type.startsWith("assert")}var fh=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function yh(e){return fh.has(e.type)}function gh(e,t,n){!t.implemented||e.length===0||e.some(r=>dt(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function hh(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(i=>dt(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 ho(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 kh(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let i=ho(r);if(i==null)return;let a=e.slice(o+1,o+4);a.find(c=>c.type==="assertVisible"&&ho(c)===i)==null||a.some(c=>yh(c)||dt(c)&&ho(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 Sh=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 ko(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!Sh.has(t))}function wh(e){let t=e.label==null?[]:ko(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,...ko(r)]}function Ah(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(ko(t.expectedOutcome));if(r.size===0)return;let o=e.filter(a=>dt(a));if(o.length===0)return;o.some(a=>wh(a).some(s=>r.has(s)))||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 bh=/save|submit|create|delete|remove|send|invite|update|confirm|publish|apply|pay|subscribe|upgrade|cancel|archive|rename/i;function gl(e){if(e.type==="upload"||e.type==="handleDialog"&&e.action==="accept")return!0;if(e.type!=="click")return!1;let t=e.locator,n=t.by==="role"?t.name??"":t.value;return bh.test(n)}function Rh(e,t,n){!t.implemented||t.spec.uiOnly===!0||e.forEach((r,o)=>{if(!gl(r)||"uiOnly"in r&&r.uiOnly===!0)return;let i=e.slice(o+1),a=i.findIndex(d=>gl(d)),s=a===-1?i.length:a;i.slice(0,s).some(d=>d.type==="assertObserver")||n({message:`"${r.label??r.id}" looks like it mutates backend state but no assert.backend(...) observer verifies it \u2014 the test can pass while the server is broken. You need to add an observer that checks the persisted result (see .ripplo/observers/ for examples). Only if this action truly does NOT change any server state (pure client-side interaction, presentation toggle, etc.) should you fall back to marking the step { uiOnly: true } to silence this rule.`,rule:"mutation-without-observer-coverage",step:r.label??r.id})})}function Th(e,t,n){Object.keys(t.spec.variables??{}).length!==0&&e.forEach(o=>{if(o.type!=="assertObserver")return;let i=Object.entries(o.params);i.length===0||i.some(([,s])=>hl(s)&&kl(s.value))||n({message:`assert.backend "${o.label??o.id}" passes only hardcoded params while the test defines precondition variables \u2014 observer assertions should reference {{namespace.key}} so they match the actual precondition data`,rule:"observer-params-reference-variables",step:o.label??o.id})})}var vh=[ih,ah,sh,lh,ch,dh,ph,uh,gh,hh,kh,Ah,Rh,Th];Ee();K();async function Al(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 ue({cwd:r,result:o.result});let i=ct(o.result),a=t.length===0?i.diagnostics:i.diagnostics.filter(p=>t.includes(p.test)),s=wl.groupBy(a,p=>p.test);Object.entries(s).forEach(([p,m])=>{process.stderr.write(`
483
+ ${p}
484
+ `),m.forEach(h=>{let S=h.step==null?"":` at "${h.step}"`;process.stderr.write(` [${h.rule}]${S}
416
485
  `),process.stderr.write(` ${h.message}
417
- `)})});let s=new Set(o.builder.getUnimplemented().tests),c=n.filter(d=>s.has(d));c.length>0&&(process.stderr.write(`
486
+ `)})});let l=new Set(o.builder.getUnimplemented().tests),c=n.filter(p=>l.has(p));c.length>0&&(process.stderr.write(`
418
487
  not-implemented
419
- `),c.forEach(d=>{process.stderr.write(` ${d} is still marked .notImplemented()
420
- `)}));let p=sg(r);p.length>0&&(process.stderr.write(`
488
+ `),c.forEach(p=>{process.stderr.write(` ${p} is still marked .notImplemented()
489
+ `)}));let d=Lh(r);d.length>0&&(process.stderr.write(`
421
490
  preconditions
422
- `),p.forEach(d=>{process.stderr.write(` [hardcoded-identifier] ${d.file}
423
- `),process.stderr.write(` ${d.message}
424
- `)}));let u=a.length+c.length+p.length;u>0&&(process.stderr.write(`
491
+ `),d.forEach(p=>{process.stderr.write(` [hardcoded-identifier] ${p.file}
492
+ `),process.stderr.write(` ${p.message}
493
+ `)}));let u=a.length+c.length+d.length;u>0&&(process.stderr.write(`
425
494
  ${String(u)} error(s)
426
- `),process.exit(1))}var ig=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,ag=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function sg(e){let t=Ks.join(e,".ripplo","preconditions");return so.existsSync(t)?so.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>lg(Ks.join(t,r))):[]}function lg(e){let t=so.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=ig.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=ag.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 Ys(e){let t=await be();await Ne(t);let{results:n,summary:r}=await dn({config:t,ids:e});process.stdout.write(`${r}
427
- `);let o=n.some(i=>i.summary.includes("FAILED")||i.summary.includes("ERROR"));process.exit(o?1:0)}G();import{graphql as Lt}from"gql.tada";var cg=Lt(`
495
+ `),process.exit(1))}var Nh=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Ch=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function Lh(e){let t=Sl.join(e,".ripplo","preconditions");return So.existsSync(t)?So.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>Ph(Sl.join(t,r))):[]}function Ph(e){let t=So.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Nh.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=Ch.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 bl(e){let t=await Re();await Te(t);let{results:n,summary:r}=await kn({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 Et}from"gql.tada";var xh=Et(`
428
497
  query ScopeStatus($projectId: String!) {
429
498
  project(id: $projectId) {
430
499
  id
@@ -444,7 +513,7 @@ ${String(u)} error(s)
444
513
  }
445
514
  }
446
515
  }
447
- `),dg=Lt(`
516
+ `),Eh=Et(`
448
517
  query ScopeWorkflowBySlug($projectId: String!, $slug: String!) {
449
518
  project(id: $projectId) {
450
519
  id
@@ -457,42 +526,42 @@ ${String(u)} error(s)
457
526
  }
458
527
  }
459
528
  }
460
- `),pg=Lt(`
529
+ `),Oh=Et(`
461
530
  mutation ScopeAdd($projectId: String!, $workflowId: String!) {
462
531
  addScopeItem(projectId: $projectId, source: AGENT, workflowId: $workflowId) {
463
532
  id
464
533
  }
465
534
  }
466
- `),ug=Lt(`
535
+ `),Ih=Et(`
467
536
  mutation ScopeLink($id: ID!, $workflowId: String!) {
468
537
  linkScopeItem(id: $id, workflowId: $workflowId) {
469
538
  id
470
539
  }
471
540
  }
472
- `),mg=Lt(`
541
+ `),_h=Et(`
473
542
  mutation ScopeRemove($id: ID!) {
474
543
  removeScopeItem(id: $id)
475
544
  }
476
- `);async function Zs(e){let t=await be();await Ne(t);let r=(await j({config:t,document:cg,variables:{projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(r,null,2)}
545
+ `);async function Rl(e){let t=await Re();await Te(t);let r=(await U({config:t,document:xh,variables:{projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(r,null,2)}
477
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??""}
478
547
  `);return}let a=i.spec==null?"stub":"implemented";process.stdout.write(` [${a}] (${o.id}) ${i.slug} \u2014 ${i.name}
479
- `)})}async function el({testId:e}){let t=await be();await Ne(t);let n=await rl({cfg:t,slug:e}),r=await j({config:t,document:pg,variables:{projectId:t.projectId,workflowId:n}});process.stdout.write(`Added scope item ${r.addScopeItem?.id??"?"}
480
- `)}async function tl({id:e,testId:t}){let n=await be();await Ne(n);let r=await rl({cfg:n,slug:t});await j({config:n,document:ug,variables:{id:e,workflowId:r}}),process.stdout.write(`Linked scope item ${e} to ${t}
481
- `)}async function nl({id:e}){let t=await be();await Ne(t),await j({config:t,document:mg,variables:{id:e}}),process.stdout.write(`Removed scope item ${e}
482
- `)}async function rl({cfg:e,slug:t}){let r=(await j({config:e,document:dg,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.
483
- `),process.exit(1)),r.id}J();async function ol(e){let t=process.cwd(),n=await O(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
548
+ `)})}async function Tl({testId:e}){let t=await Re();await Te(t);let n=await Cl({cfg:t,slug:e}),r=await U({config:t,document:Oh,variables:{projectId:t.projectId,workflowId:n}});process.stdout.write(`Added scope item ${r.addScopeItem?.id??"?"}
549
+ `)}async function vl({id:e,testId:t}){let n=await Re();await Te(n);let r=await Cl({cfg:n,slug:t});await U({config:n,document:Ih,variables:{id:e,workflowId:r}}),process.stdout.write(`Linked scope item ${e} to ${t}
550
+ `)}async function Nl({id:e}){let t=await Re();await Te(t),await U({config:t,document:_h,variables:{id:e}}),process.stdout.write(`Removed scope item ${e}
551
+ `)}async function Cl({cfg:e,slug:t}){let r=(await U({config:e,document:Eh,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}K();async function Ll(e){let t=process.cwd(),n=await O(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
484
553
  `),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
485
554
  `);return}let o={tests:r.map(i=>({id:i,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
486
- `)}import{z as Le}from"zod";var fg=Le.object({agent_id:Le.string().optional(),cwd:Le.string().optional(),hook_event_name:Le.string().optional(),mode:Le.string().optional(),session_id:Le.string().optional(),tool_input:Le.looseObject({file_path:Le.string().optional()}).optional(),tool_name:Le.string().optional()});async function te(){let e=await yg();if(e.trim()==="")return{};let t=JSON.parse(e);return fg.parse(t)}function yg(){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)})}lo();G();import Sg from"fs";function Ag(e){return Ae(e,"hooks-paused")}function ne(e){return Sg.existsSync(Ag(e))?!1:sl(e)}import{execFileSync as wg}from"child_process";import{createHash as DL}from"crypto";import Rg from"process";import cl from"picomatch";function bg(e){return pl(["diff","--name-only","HEAD"],e).split(`
487
- `).filter(n=>n.length>0)}function dl({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=cl([...n]),o=cl([...t]);return bg(e).filter(i=>r(i)&&!o(i))}function mn(e,...t){return pl(["diff","--name-only","HEAD","--",...t],e).split(`
488
- `).filter(r=>r.length>0)}function Ng(){let e=Rg.env.GIT_BIN;return e!=null&&e.length>0?e:"/usr/bin/git"}var Tg=Ng();function pl(e,t){try{return wg(Tg,[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return""}}J();async function fn(e){let t=await O(e);if(!t.ok)return{ignorePaths:un,watchPaths:pn};let n=t.builder.getConfig();return{ignorePaths:n.ignorePaths??un,watchPaths:n.watchPaths??pn}}import Lg from"fs";import Cg from"path";function fe(e){return Lg.existsSync(Cg.join(e,".ripplo"))}async function ul(){await te();let e=process.cwd();if(!fe(e)||!ne(e))return;let{ignorePaths:t,watchPaths:n}=await fn(e),r=dl({cwd:e,ignoreGlobs:t,watchGlobs:n});r.length===0||mn(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.
489
- `)}import yn from"fs";import vg from"os";import ml from"path";function Fe(e){process.stderr.write(`${e}
490
- `),process.exit(2)}async function fl(){if((await te()).tool_name!=="ExitPlanMode"||!ne(process.cwd()))return;let t=xg();if(t==null)return;let n=yn.readFileSync(t,"utf8");/apps\/web|apps\/server|route|component|user flow/i.test(n)&&(/\.ripplo\/tests|Tests to implement/.test(n)||Fe(`Plan touches user-facing code but cites no .ripplo/tests stubs.
491
- Add a 'Tests to implement' section listing .notImplemented() test ids, or reference existing .ripplo/tests files.`))}function xg(){let e=ml.join(vg.homedir(),".claude","plans");return yn.existsSync(e)?yn.readdirSync(e).filter(n=>n.endsWith(".md")).map(n=>ml.join(e,n)).map(n=>({full:n,mtime:yn.statSync(n).mtimeMs})).sort((n,r)=>r.mtime-n.mtime)[0]?.full??null:null}J();async function yl(){if((await te()).mode!=="plan")return;let t=process.cwd();if(!fe(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()):
555
+ `)}import{z as Ne}from"zod";var Uh=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 oe(){let e=await jh();if(e.trim()==="")return{};let t=JSON.parse(e);return Uh.parse(t)}function jh(){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)})}wo();J();import Vh from"fs";function Wh(e){return we(e,"hooks-paused")}function ie(e){return Vh.existsSync(Wh(e))?!1:El(e)}import{execFileSync as qh}from"child_process";import{createHash as hP}from"crypto";import Ao from"process";import Il from"picomatch";function Fh(e){return Ul(["diff","--name-only","HEAD"],e).split(`
556
+ `).filter(n=>n.length>0)}function _l({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=Il([...n]),o=Il([...t]);return Fh(e).filter(i=>r(i)&&!o(i))}function Sn(e,...t){return Ul(["diff","--name-only","HEAD","--",...t],e).split(`
557
+ `).filter(r=>r.length>0)}var Mh=Ao.env.GIT_BIN!=null&&Ao.env.GIT_BIN.length>0?Ao.env.GIT_BIN:"git";function Hh(e){if(!(e instanceof Error)||!("status"in e))return null;let t=Reflect.get(e,"status");return typeof t=="number"?t:null}function zh(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 Ul(e,t){try{return qh(Mh,[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch(n){let r=Hh(n);if(r==null||r===0)return"";let o=zh(n).trim();throw new Error(`git ${e.join(" ")} failed (exit ${String(r)}): ${o}`)}}K();async function wn(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??go,watchPaths:n.watchPaths??yo}}import Jh from"fs";import Xh from"path";function ye(e){return Jh.existsSync(Xh.join(e,".ripplo"))}async function jl(){await oe();let e=process.cwd();if(!ye(e)||!ie(e))return;let{ignorePaths:t,watchPaths:n}=await wn(e),r=_l({cwd:e,ignoreGlobs:t,watchGlobs:n});r.length===0||Sn(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 It from"fs";import Gh from"os";import $l from"path";function Xe(e){process.stderr.write(`${e}
559
+ `),process.exit(2)}async function Bl(){if((await oe()).tool_name!=="ExitPlanMode"||!ie(process.cwd()))return;let t=Kh();if(t==null)return;let n=128*1024;if(It.statSync(t).size>n)return;let o=It.readFileSync(t,"utf8");/apps\/web|apps\/server|route|component|user flow/i.test(o)&&(/\.ripplo\/tests|Tests to implement/.test(o)||Xe(`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 Kh(){let e=$l.join(Gh.homedir(),".claude","plans");return It.existsSync(e)?It.readdirSync(e).filter(n=>n.endsWith(".md")).map(n=>$l.join(e,n)).map(n=>({full:n,mtime:It.statSync(n).mtimeMs})).sort((n,r)=>r.mtime-n.mtime)[0]?.full??null:null}K();async function Dl(){if((await oe()).mode!=="plan")return;let t=process.cwd();if(!ye(t)||!ie(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()):
492
561
  `),r.forEach(o=>process.stderr.write(` ${o}
493
- `)))}import Pg from"path";import gl from"picomatch";J();async function hl(){let t=(await te()).tool_input?.file_path;if(t==null)return;let n=process.cwd();if(!fe(n)||!ne(n))return;let r=Pg.relative(n,t);if(r.startsWith(".."))return;let{ignorePaths:o,watchPaths:i}=await fn(n),a=gl([...i]),l=gl([...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(", ")}
494
- `)}Pe();J();async function kl(){let t=(await te()).tool_input?.file_path;if(t==null||!/\/\.ripplo\/.*\.ts$/.test(t))return;let n=process.cwd();if(!fe(n)||!ne(n))return;let r=await O(n);r.ok||Fe(`Compilation failed: ${r.error}`),await ue({cwd:n,result:r.result});let{diagnostics:o}=ot(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}`});Fe(i.join(`
495
- `))}G();J();rt();import{graphql as Eg}from"gql.tada";var Og=Eg(`
562
+ `)))}import Qh from"path";import Vl from"picomatch";K();async function Wl(){let t=(await oe()).tool_input?.file_path;if(t==null)return;let n=process.cwd();if(!ye(n)||!ie(n))return;let r=Qh.relative(n,t);if(r.startsWith(".."))return;let{ignorePaths:o,watchPaths:i}=await wn(n),a=Vl([...i]),s=Vl([...o]);if(!a(r)||s(r))return;let l=await O(n);if(!l.ok)return;let{tests:c}=l.builder.getUnimplemented();c.length!==0&&process.stderr.write(`Reminder: .notImplemented() stubs still present \u2014 tests: ${c.join(", ")}
563
+ `)}Ee();K();async function ql(){let t=(await oe()).tool_input?.file_path;if(t==null||!/\/\.ripplo\/.*\.ts$/.test(t))return;let n=process.cwd();if(!ye(n)||!ie(n))return;let r=await O(n);r.ok||Xe(`Compilation failed: ${r.error}`),await ue({cwd:n,result:r.result});let{diagnostics:o}=ct(r.result);if(o.length===0)return;let i=o.map(a=>{let s=a.step==null?"":` at "${a.step}"`;return` [${a.rule}]${s} ${a.test}: ${a.message}`});Xe(i.join(`
564
+ `))}J();K();lt();import{graphql as Yh}from"gql.tada";var Zh=Yh(`
496
565
  query ScopeReminder($projectId: String!) {
497
566
  project(id: $projectId) {
498
567
  id
@@ -509,11 +578,12 @@ Add a 'Tests to implement' section listing .notImplemented() test ids, or refere
509
578
  }
510
579
  }
511
580
  }
512
- `);async function Sl(){await te();let e=process.cwd();if(!fe(e)||!ne(e))return;let t=we(e);if(t==null)return;let n=await O(e);if(!n.ok)return;let r={...n.result.config,ripploServerUrl:$e(),token:t},i=(await j({config:r,document:Og,variables:{projectId:r.projectId}}).catch(()=>null))?.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)}):
581
+ `);async function Fl(){await oe();let e=process.cwd();if(!ye(e)||!ie(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:De(),token:t},o=await U({config:r,document:Zh,variables:{projectId:r.projectId}}).catch(s=>{let l=s instanceof Error?s.message:String(s);return process.stderr.write(`Scope reminder unavailable: ${l}
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(s=>{let l=s.workflow;return l==null?` [intent] (${s.id}) ${s.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${s.id}) ${l.slug}`});process.stderr.write(`Testing Scope (${String(i.length)}):
513
583
  ${a.join(`
514
584
  `)}
515
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.
516
- `)}import{execFileSync as Ig}from"child_process";import _g from"path";import co from"process";Pe();G();import{graphql as Ug}from"gql.tada";import{z as gn}from"zod";J();rt();var jg=Ug(`
586
+ `)}import{execFileSync as ek}from"child_process";import tk from"path";import bo from"process";Ee();J();import{graphql as nk}from"gql.tada";import{z as An}from"zod";K();lt();var rk=nk(`
517
587
  query ScopeEnforce($projectId: String!) {
518
588
  project(id: $projectId) {
519
589
  id
@@ -532,23 +602,23 @@ If your next change touches an existing test's user flow, \`npx ripplo scope add
532
602
  }
533
603
  }
534
604
  }
535
- `);async function wl(){let e=await te();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=co.cwd();if(!fe(t)||!ne(t))return;let n=$g(t),r=await Dg(t,n);r.length>0&&Fe(r.join(`
605
+ `);async function Hl(){let e=await oe();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=bo.cwd();if(!ye(t)||!ie(t))return;let n=ok(t),r=await ik(t,n);r.length>0&&Xe(r.join(`
536
606
 
537
- `))}function $g(e){return mn(e,".ripplo/tests").filter(t=>t.endsWith(".ts")).map(t=>_g.basename(t,".ts"))}async function Dg(e,t){let n=await O(e);if(!n.ok)return[`--- Compilation failed ---
538
- ${n.error}`];await ue({cwd:e,result:n.result});let r=await Bg(e,n),o=[...new Set([...t,...r.scopedSlugsToRun])],i=Vg(n,t),a=Wg(n),l=qg(e,o);return[i,a,l,r.error].filter(s=>s!=null)}async function Bg(e,t){let n=we(e);if(n==null)return{error:null,scopedSlugsToRun:[]};let r={...t.result.config,ripploServerUrl:$e(),token:n},i=(await j({config:r,document:jg,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 ---
607
+ `))}function ok(e){return Sn(e,".ripplo/tests").filter(t=>t.endsWith(".ts")).map(t=>tk.basename(t,".ts"))}async function ik(e,t){let n=await O(e);if(!n.ok)return[`--- Compilation failed ---
608
+ ${n.error}`];await ue({cwd:e,result:n.result});let r=await ak(e,n),o=[...new Set([...t,...r.scopedSlugsToRun])],i=sk(n,t),a=lk(n),s=ck(e,o);return[i,a,s,r.error].filter(l=>l!=null)}async function ak(e,t){let n=Ae(e);if(n==null)return{error:null,scopedSlugsToRun:[]};let r={...t.result.config,ripploServerUrl:De(),token:n},i=(await U({config:r,document:rk,variables:{projectId:r.projectId}}).catch(()=>null))?.project?.devSession?.scopeItems??[],a=i.flatMap(c=>{let d=c.workflow;return d==null?[` [intent] ${c.label??"(no label)"} \u2014 stub a test for this flow`]:d.spec==null?[` [stub] ${d.slug} \u2014 implement \`${d.name}\``]:[]}),s=i.flatMap(c=>c.workflow?.spec==null?[]:[c.workflow.slug]);return{error:a.length===0?null:`--- Testing Scope ---
539
609
  ${a.join(`
540
610
  `)}
541
611
 
542
- Each scope item must reach an implemented workflow, or remove it via \`npx ripplo scope remove <id>\`.`,scopedSlugsToRun:l}}function Vg(e,t){let{diagnostics:n}=ot(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 ---
612
+ Each scope item must reach an implemented workflow, or remove it via \`npx ripplo scope remove <id>\`.`,scopedSlugsToRun:s}}function sk(e,t){let{diagnostics:n}=ct(e.result),r=new Set(e.builder.getUnimplemented().tests),o=t.filter(s=>r.has(s));if(n.length===0&&o.length===0)return null;let i=n.map(s=>{let l=s.step==null?"":` at "${s.step}"`;return` [${s.rule}]${l} ${s.test}: ${s.message}`}),a=o.map(s=>` [not-implemented] ${s} is still marked .notImplemented()`);return`--- Ripplo Lint ---
543
613
  ${[...i,...a].join(`
544
- `)}`}function Wg(e){let{tests:t}=e.builder.getUnimplemented();return t.length===0?null:`--- Unimplemented stubs remain ---
545
- tests: ${t.join(", ")}`}function qg(e,t){if(t.length===0)return null;let n=Mg(["run",...t],e);if(n.code===0)return null;let r=n.output.split(`
614
+ `)}`}function lk(e){let{tests:t}=e.builder.getUnimplemented();return t.length===0?null:`--- Unimplemented stubs remain ---
615
+ tests: ${t.join(", ")}`}function ck(e,t){if(t.length===0)return null;let n=pk(["run",...t],e);if(n.code===0)return null;let r=n.output.split(`
546
616
  `).filter(o=>/FAILED/.test(o)).join(`
547
617
  `);return r.length===0?null:`--- Ripplo Run Failures (${t.join(" ")}) ---
548
- ${r}`}var Fg=gn.object({status:gn.number().nullish(),stderr:gn.unknown().optional(),stdout:gn.unknown().optional()});function Al(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function Mg(e,t){let n=co.argv[1];if(n==null)return{code:1,output:""};try{return{code:0,output:Ig(co.execPath,[n,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(r){let o=Fg.safeParse(r);if(!o.success)return{code:1,output:""};let i=`${Al(o.data.stdout)}${Al(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}var vc=dt.resolve(dt.dirname(rS(import.meta.url)),"..");Cc({path:dt.join(vc,".env.local"),quiet:!0});Cc({path:dt.join(vc,".env"),quiet:!0});dS();var xc={"coverage-nudge":ul,"exit-plan-gate":fl,"plan-reminder":yl,"post-edit-flag-stubs":hl,"post-edit-lint":kl,"scope-reminder":Sl,"stop-enforce":wl};async function aS(){await oS(iS(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},sS).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=>Ys(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=>Qs({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=>Xs({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=>Qo({check:e.check})).command("doctor","Check project health",()=>{},()=>qs()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>ol({format:e.format})).command("scope <subcommand>","Manage testing scope",cS).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(xc),demandOption:!0,type:"string"}),e=>lS(e.name)).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}async function sS(){let{launchDashboard:e}=await Promise.resolve().then(()=>(jo(),Lc));e()}async function lS(e){let t=xc[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
549
- `),process.exit(1)),await t()}aS().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
550
- `),process.exit(1)});function cS(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>Zs({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=>el({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=>tl({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=>nl({id:t.id})).demandCommand(1)}function dS(){let e=process.cwd(),t=Pc(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
551
- `))}function Pc(e){let t=dt.dirname(e);return nS.existsSync(dt.join(e,".ripplo"))?e:t===e?null:Pc(t)}export{aS as main};
618
+ ${r}`}var dk=An.object({status:An.number().nullish(),stderr:An.unknown().optional(),stdout:An.unknown().optional()});function Ml(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function pk(e,t){let n=bo.argv[1];if(n==null)return{code:1,output:""};try{return{code:0,output:ek(bo.execPath,[n,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(r){let o=dk.safeParse(r);if(!o.success)return{code:1,output:""};let i=`${Ml(o.data.stdout)}${Ml(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}var Od=Ze.resolve(Ze.dirname(hA(import.meta.url)),"..");Ed({path:Ze.join(Od,".env.local"),quiet:!0});Ed({path:Ze.join(Od,".env"),quiet:!0});TA();var Id={"coverage-nudge":jl,"exit-plan-gate":Bl,"plan-reminder":Dl,"post-edit-flag-stubs":Wl,"post-edit-lint":ql,"scope-reminder":Fl,"stop-enforce":Hl};async function wA(){await kA(SA(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},AA).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=>bl(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=>Al({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=>fl({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=>ui({check:e.check})).command("doctor","Check project health",()=>{},()=>ll()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Ll({format:e.format})).command("scope <subcommand>","Manage testing scope",RA).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(Id),demandOption:!0,type:"string"}),e=>bA(e.name)).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}async function AA(){let{redirectStdioToFile:e}=await Promise.resolve().then(()=>(Jl(),zl)),t=e(Ze.join(process.cwd(),".ripplo","debug","debug.log")),{launchDashboard:n}=await Promise.resolve().then(()=>(Ko(),xd));n({restoreStdio:t})}async function bA(e){let t=Id[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
619
+ `),process.exit(1)),await t()}wA().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
620
+ `),process.exit(1)});function RA(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>Rl({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=>Tl({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=>vl({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=>Nl({id:t.id})).demandCommand(1)}function TA(){let e=process.cwd(),t=_d(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
621
+ `))}function _d(e){let t=Ze.dirname(e);return gA.existsSync(Ze.join(e,".ripplo"))?e:t===e?null:_d(t)}export{wA as main};
552
622
  /*! Bundled license information:
553
623
 
554
624
  mustache/mustache.mjs: