ripplo 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +123 -123
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`}async function qt({cwd:e}){let t=Jn.join(e,we),n=await Yp(t);return n==null?null:zd(ci,n)}async function me({cwd:e,result:t}){let n=di(t),r=Jn.join(e,we);await Mn.mkdir(Jn.dirname(r),{recursive:!0}),await Mn.writeFile(r,Xn(n),"utf8")}function Ft({compiled:e,existing:t}){if(t==null)return"missing";let n=Xn(di(e)),r=Xn(t);return n===r?"match":"stale"}async function Yp(e){try{return await Mn.readFile(e,"utf8")}catch(t){if(Zp(t)&&t.code==="ENOENT")return null;throw t}}function Zp(e){return e instanceof Error&&"code"in e}function eu(e){return function(n,r){return r===e||!tu(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function tu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Hd,Md,Jd,ai,Qd,Yd,D,St,Zd,ep,Kn,tp,he,np,rp,x,ri,op,ip,ap,sp,lp,cp,dp,pp,up,mp,fp,yp,gp,hp,kp,Sp,wp,bp,Ap,Rp,Tp,vp,Np,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,Up,jp,$p,Dp,Bp,Vp,Wp,qp,li,Fp,Hp,Mp,Hb,Mb,Jp,zp,we,Xp,Gp,Kp,Qp,ci,Oe=f(()=>{"use strict";Hd=Wt.object({__codec:Wt.string().min(1),data:Wt.unknown(),version:Wt.number().int().positive()}),Md=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}},Jd=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};ai=nt.object({depends:nt.array(nt.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:nt.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:nt.array(nt.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."),Qd=Ee.object({by:Ee.literal("testId"),value:Ee.string().min(1)}),Yd=Ee.object({by:Ee.literal("role"),name:Ee.string().optional(),role:Ee.string().min(1)}),D=Ee.discriminatedUnion("by",[Qd,Yd]),St=si.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Zd=si.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),ep=z.object({type:z.literal("static"),value:z.union([z.string(),z.number(),z.boolean()])}),Kn=z.object({name:z.string().min(1),type:z.literal("variable")}),tp=z.discriminatedUnion("type",[ep,Kn]),he=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.string()}),Kn]),np=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.number().int().nonnegative()}),Kn]),rp=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")})]),x={id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),uiOnly:y.boolean().optional()},ri=500,op=y.object({...x,type:y.literal("goto"),url:he}),ip=y.object({...x,locator:D,type:y.literal("click")}),ap=y.object({...x,locator:D,type:y.literal("fill"),value:he}),sp=y.object({...x,locator:D,type:y.literal("select"),value:he}),lp=y.object({...x,locator:D,type:y.literal("hover")}),cp=y.object({...x,key:y.string().min(1),locator:D.optional(),type:y.literal("press")}),dp=y.object({...x,locator:D,type:y.literal("check")}),pp=y.object({...x,locator:D,type:y.literal("uncheck")}),up=y.object({...x,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),mp=y.object({...x,message:y.string().min(1),type:y.literal("fail")}),fp=y.object({...x,type:y.literal("setVariable"),value:tp,variable:y.string().min(1)}),yp=y.object({...x,locator:D,type:y.literal("extractText"),variable:y.string().min(1)}),gp=y.object({...x,files:y.array(y.string()).min(1),locator:D,type:y.literal("upload")}),hp=y.object({...x,locator:D,type:y.literal("dblclick")}),kp=y.object({...x,source:D,target:D,type:y.literal("drag")}),Sp=y.object({...x,locator:D,type:y.literal("scrollIntoView")}),wp=y.object({...x,locator:D,type:y.literal("type"),value:he}),bp=y.object({...x,locator:D,type:y.literal("focus")}),Ap=y.object({...x,locator:D,type:y.literal("clear")}),Rp=y.object({...x,locator:D,type:y.literal("rightClick")}),Tp=y.object({...x,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),vp=y.object({...x,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:he.optional(),variable:y.string().min(1).optional()}),Np=y.object({...x,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Cp=y.object({...x,locator:D,type:y.literal("assertVisible")}),Lp=y.object({...x,locator:D,type:y.literal("assertNotVisible")}),xp=y.object({...x,expected:he,locator:D,operator:St,type:y.literal("assertText")}),Pp=y.object({...x,expected:he,operator:St,type:y.literal("assertUrl")}),Ep=y.object({...x,expected:np,locator:D,operator:Zd,type:y.literal("assertCount")}),Op=y.object({...x,expected:he,locator:D,operator:St,type:y.literal("assertValue")}),Ip=y.object({...x,attribute:y.string().min(1),expected:he,locator:D,operator:St,type:y.literal("assertAttribute")}),_p=y.object({...x,locator:D,type:y.literal("assertEnabled")}),Up=y.object({...x,locator:D,type:y.literal("assertDisabled")}),jp=y.object({...x,expected:he,operator:St,type:y.literal("assertTitle")}),$p=y.object({...x,locator:D,type:y.literal("assertChecked")}),Dp=y.object({...x,locator:D,type:y.literal("assertNotChecked")}),Bp=y.object({...x,locator:D,type:y.literal("assertFocused")}),Vp=y.object({...x,locator:D,type:y.literal("assertNotFocused")}),Wp=y.object({...x,budget:y.enum(["fast","slow","async"]),observer:y.string().min(1).max(200),params:y.record(y.string().max(200),he),type:y.literal("assertObserver")}),qp=y.discriminatedUnion("type",[op,ip,ap,sp,lp,cp,dp,pp,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,Up,up,mp,fp,yp,gp,hp,kp,Sp,wp,bp,Ap,Rp,Tp,vp,Np,jp,$p,Dp,Bp,Vp,Wp]),li=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),qp).refine(e=>Object.keys(e).length<=ri,`Workflow has more than ${String(ri)} nodes`),uiOnly:y.boolean().optional(),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),rp).optional()}),Fp=ni.record(ni.string().max(200),ai),Hp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Mp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Hb=Gn("workflow-spec").legacy(Hp).initial(li).build(),Mb=Gn("precondition-map").legacy(Mp).initial(Fp).build(),Jp=["fast","slow","async"],zp=Hn.object({budget:Hn.enum(Jp).describe("Polling budget tier: fast | slow | async"),description:Hn.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."),we=".ripplo/ripplo.lock",Xp=5e3,Gp=ee.record(ee.string().max(200),ee.string().max(200)),Kp=ee.object({expectedOutcome:ee.string().max(2e3),name:ee.string().max(200),preconditions:ee.array(ee.string().max(200)).max(1e3),requiresKeys:Gp,slug:ee.string().max(200),spec:li}),Qp=ee.object({observers:ee.record(ee.string().max(200),zp),preconditions:ee.record(ee.string().max(200),ai),tests:ee.array(Kp).max(Xp)}),ci=Gn("ripplo-lockfile").initial(Qp).build()});function pi(e){return e.data}function ui(e){return{as(t){return{data:{label:t,node:e}}}}}var Ht=f(()=>{"use strict"});function Mt(e){let t=e.getPreconditions(),n=e.getObservers(),r=e.getTests();nu(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=>ru(s,t));return{config:e.getConfig(),observers:i,preconditions:o,tests:a}}function nu(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 ru(e,t){let n=e.id,{accessedKeys:r,vars:o}=iu(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),s=i==null?a:[ou(i),...a],l=au(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=lu(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 ou(e){return ui({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function iu(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 au(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]=su(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 su(e,t,n){let{label:r,node:o}=pi(e);return{...o,id:t,label:r,next:n}}function lu(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 Qn=f(()=>{"use strict";Ht()});var mi=f(()=>{"use strict";Qn();Ht()});import cu from"path";import{createJiti as du}from"jiti";function uu(e){return e==null||typeof e!="object"?!1:pu.every(t=>typeof Reflect.get(e,t)=="function")}function mu(e){return e===null?"null":Array.isArray(e)?"array":typeof e}async function _(e){let t=cu.join(e,".ripplo","index.ts");try{let r=await du(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!uu(o))return{error:`${t} must default-export a RipploBuilder (got ${mu(o)})`,ok:!1};let i=Mt(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var pu,Q=f(()=>{"use strict";mi();pu=["getConfig","getObservers","getPreconditions","getTests","getUnimplemented"]});function Zn(e){return typeof e=="function"}function yu(e){return ot(e)?"array":typeof e}function Yn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function yi(e,t){return e!=null&&typeof e=="object"&&t in e}function gu(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function ku(e,t){return hu.call(e,t)}function wu(e){return!ku(Su,e)}function Au(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return bu[n]})}function Cu(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(Tu,2)),!ot(C)||C.length!==2)throw new Error("Invalid tags: "+C);u=new RegExp(Yn(C[0])+"\\s*"),p=new RegExp("\\s*"+Yn(C[1])),m=new RegExp("\\s*"+Yn("}"+C[1]))}h(t||fe.tags);for(var S=new bt(e),w,k,b,v,L,T;!S.eos();){if(w=S.pos,b=S.scanUntil(u),b)for(var I=0,O=b.length;I<O;++I)v=b.charAt(I),wu(v)?(i.push(o.length),l+=v):(s=!0,n=!0,l+=" "),o.push(["text",v,w,w+1]),w+=1,v===`
|
|
4
|
-
`&&(d(),l="",c=0,n=!1);if(!S.scan(u))break;if(a=!0,k=S.scan(
|
|
2
|
+
var $d=Object.create;var qn=Object.defineProperty;var Dd=Object.getOwnPropertyDescriptor;var Bd=Object.getOwnPropertyNames;var Vd=Object.getPrototypeOf,Wd=Object.prototype.hasOwnProperty;var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var Vt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Zo=(e,t)=>{for(var n in t)qn(e,n,{get:t[n],enumerable:!0})},qd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bd(t))!Wd.call(e,o)&&o!==n&&qn(e,o,{get:()=>t[o],enumerable:!(r=Dd(t,o))||r.enumerable});return e};var ei=(e,t,n)=>(n=e!=null?$d(Vd(e)):{},qd(t||!e||!e.__esModule?qn(n,"default",{value:e,enumerable:!0}):n,e));import Hn from"fs/promises";import Mn from"path";import{z as Wt}from"zod";import{z as ti}from"zod";import{z as nt}from"zod";import{z as y}from"zod";import{z as Ee}from"zod";import{z as ai}from"zod";import{z}from"zod";import{z as se}from"zod";import{z as Fn}from"zod";import{z as ee}from"zod";function Xn(e){return ri({legacy:void 0,migrators:[],name:e,schemas:[]})}function Jd(e,t){let n=JSON.parse(t);return e.decode(n)}function ri(e){return{initial:t=>Jn(t,{...e,schemas:[t]}),legacy:t=>ri({...e,legacy:t})}}function Jn(e,t){return{build:()=>zd(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 zd(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Xd(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Xd(e,t,n){let{data:r,version:o}=Gd(t,n),i=oi(t,r,o);return e.parse(i)}function Gd(e,t){let n=Fd.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Md({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 oi(e,t,n){let r=e.schemas.length;if(n>r)throw new Hd({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 oi(e,a(i),n+1)}function ci(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=li.encode(e);return`${JSON.stringify(t,Zp(t),2)}
|
|
3
|
+
`}async function qt({cwd:e}){let t=Mn.join(e,we),n=await Qp(t);return n==null?null:Jd(li,n)}async function me({cwd:e,result:t}){let n=ci(t),r=Mn.join(e,we);await Hn.mkdir(Mn.dirname(r),{recursive:!0}),await Hn.writeFile(r,zn(n),"utf8")}function Ft({compiled:e,existing:t}){if(t==null)return"missing";let n=zn(ci(e)),r=zn(t);return n===r?"match":"stale"}async function Qp(e){try{return await Hn.readFile(e,"utf8")}catch(t){if(Yp(t)&&t.code==="ENOENT")return null;throw t}}function Yp(e){return e instanceof Error&&"code"in e}function Zp(e){return function(n,r){return r===e||!eu(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function eu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Fd,Hd,Md,ii,Kd,Qd,D,St,Yd,Zd,Gn,ep,he,tp,np,x,ni,rp,op,ip,ap,sp,lp,cp,dp,pp,up,mp,fp,yp,gp,hp,kp,Sp,wp,bp,Ap,Rp,Tp,vp,Np,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,Up,jp,$p,Dp,Bp,Vp,Wp,si,qp,Fp,Hp,Mb,Jb,Mp,Jp,we,zp,Xp,Gp,Kp,li,Oe=f(()=>{"use strict";Fd=Wt.object({__codec:Wt.string().min(1),data:Wt.unknown(),version:Wt.number().int().positive()}),Hd=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}},Md=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};ii=nt.object({depends:nt.array(nt.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:nt.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:nt.array(nt.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."),Kd=Ee.object({by:Ee.literal("testId"),value:Ee.string().min(1)}),Qd=Ee.object({by:Ee.literal("role"),name:Ee.string().optional(),role:Ee.string().min(1)}),D=Ee.discriminatedUnion("by",[Kd,Qd]),St=ai.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Yd=ai.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Zd=z.object({type:z.literal("static"),value:z.union([z.string(),z.number(),z.boolean()])}),Gn=z.object({name:z.string().min(1),type:z.literal("variable")}),ep=z.discriminatedUnion("type",[Zd,Gn]),he=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.string()}),Gn]),tp=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.number().int().nonnegative()}),Gn]),np=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")})]),x={id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),uiOnly:y.boolean().optional()},ni=500,rp=y.object({...x,type:y.literal("goto"),url:he}),op=y.object({...x,locator:D,type:y.literal("click")}),ip=y.object({...x,locator:D,type:y.literal("fill"),value:he}),ap=y.object({...x,locator:D,type:y.literal("select"),value:he}),sp=y.object({...x,locator:D,type:y.literal("hover")}),lp=y.object({...x,key:y.string().min(1),locator:D.optional(),type:y.literal("press")}),cp=y.object({...x,locator:D,type:y.literal("check")}),dp=y.object({...x,locator:D,type:y.literal("uncheck")}),pp=y.object({...x,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),up=y.object({...x,message:y.string().min(1),type:y.literal("fail")}),mp=y.object({...x,type:y.literal("setVariable"),value:ep,variable:y.string().min(1)}),fp=y.object({...x,locator:D,type:y.literal("extractText"),variable:y.string().min(1)}),yp=y.object({...x,files:y.array(y.string()).min(1),locator:D,type:y.literal("upload")}),gp=y.object({...x,locator:D,type:y.literal("dblclick")}),hp=y.object({...x,source:D,target:D,type:y.literal("drag")}),kp=y.object({...x,locator:D,type:y.literal("scrollIntoView")}),Sp=y.object({...x,locator:D,type:y.literal("type"),value:he}),wp=y.object({...x,locator:D,type:y.literal("focus")}),bp=y.object({...x,locator:D,type:y.literal("clear")}),Ap=y.object({...x,locator:D,type:y.literal("rightClick")}),Rp=y.object({...x,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),Tp=y.object({...x,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:he.optional(),variable:y.string().min(1).optional()}),vp=y.object({...x,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),Np=y.object({...x,locator:D,type:y.literal("assertVisible")}),Cp=y.object({...x,locator:D,type:y.literal("assertNotVisible")}),Lp=y.object({...x,expected:he,locator:D,operator:St,type:y.literal("assertText")}),xp=y.object({...x,expected:he,operator:St,type:y.literal("assertUrl")}),Pp=y.object({...x,expected:tp,locator:D,operator:Yd,type:y.literal("assertCount")}),Ep=y.object({...x,expected:he,locator:D,operator:St,type:y.literal("assertValue")}),Op=y.object({...x,attribute:y.string().min(1),expected:he,locator:D,operator:St,type:y.literal("assertAttribute")}),Ip=y.object({...x,locator:D,type:y.literal("assertEnabled")}),_p=y.object({...x,locator:D,type:y.literal("assertDisabled")}),Up=y.object({...x,expected:he,operator:St,type:y.literal("assertTitle")}),jp=y.object({...x,locator:D,type:y.literal("assertChecked")}),$p=y.object({...x,locator:D,type:y.literal("assertNotChecked")}),Dp=y.object({...x,locator:D,type:y.literal("assertFocused")}),Bp=y.object({...x,locator:D,type:y.literal("assertNotFocused")}),Vp=y.object({...x,budget:y.enum(["fast","slow","async"]),observer:y.string().min(1).max(200),params:y.record(y.string().max(200),he),type:y.literal("assertObserver")}),Wp=y.discriminatedUnion("type",[rp,op,ip,ap,sp,lp,cp,dp,Np,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,pp,up,mp,fp,yp,gp,hp,kp,Sp,wp,bp,Ap,Rp,Tp,vp,Up,jp,$p,Dp,Bp,Vp]),si=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),Wp).refine(e=>Object.keys(e).length<=ni,`Workflow has more than ${String(ni)} nodes`),uiOnly:y.boolean().optional(),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),np).optional()}),qp=ti.record(ti.string().max(200),ii),Fp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Hp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Mb=Xn("workflow-spec").legacy(Fp).initial(si).build(),Jb=Xn("precondition-map").legacy(Hp).initial(qp).build(),Mp=["fast","slow","async"],Jp=Fn.object({budget:Fn.enum(Mp).describe("Polling budget tier: fast | slow | async"),description:Fn.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."),we=".ripplo/ripplo.lock",zp=5e3,Xp=ee.record(ee.string().max(200),ee.string().max(200)),Gp=ee.object({expectedOutcome:ee.string().max(2e3),name:ee.string().max(200),preconditions:ee.array(ee.string().max(200)).max(1e3),requiresKeys:Xp,slug:ee.string().max(200),spec:si}),Kp=ee.object({observers:ee.record(ee.string().max(200),Jp),preconditions:ee.record(ee.string().max(200),ii),tests:ee.array(Gp).max(zp)}),li=Xn("ripplo-lockfile").initial(Kp).build()});function di(e){return e.data}function pi(e){return{as(t){return{data:{label:t,node:e}}}}}var Ht=f(()=>{"use strict"});function Mt(e){let t=e.getPreconditions(),n=e.getObservers(),r=e.getTests();tu(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=>nu(s,t));return{config:e.getConfig(),observers:i,preconditions:o,tests:a}}function tu(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 nu(e,t){let n=e.id,{accessedKeys:r,vars:o}=ou(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),s=i==null?a:[ru(i),...a],l=iu(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=su(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 ru(e){return pi({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function ou(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 iu(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]=au(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 au(e,t,n){let{label:r,node:o}=di(e);return{...o,id:t,label:r,next:n}}function su(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 Kn=f(()=>{"use strict";Ht()});var ui=f(()=>{"use strict";Kn();Ht()});import lu from"fs";import mi from"path";import{config as cu}from"dotenv";import{createJiti as du}from"jiti";function uu(e){return e==null||typeof e!="object"?!1:pu.every(t=>typeof Reflect.get(e,t)=="function")}function mu(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function fu(e){let t=mi.join(e,".ripplo",".env");lu.existsSync(t)&&cu({override:!0,path:t,quiet:!0})}async function _(e){fu(e);let t=mi.join(e,".ripplo","index.ts");try{let r=await du(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!uu(o))return{error:`${t} must default-export a RipploBuilder (got ${mu(o)})`,ok:!1};let i=Mt(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var pu,Q=f(()=>{"use strict";ui();pu=["getConfig","getObservers","getPreconditions","getTests","getUnimplemented"]});function Yn(e){return typeof e=="function"}function gu(e){return ot(e)?"array":typeof e}function Qn(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function yi(e,t){return e!=null&&typeof e=="object"&&t in e}function hu(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function Su(e,t){return ku.call(e,t)}function bu(e){return!Su(wu,e)}function Ru(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return Au[n]})}function Lu(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(vu,2)),!ot(C)||C.length!==2)throw new Error("Invalid tags: "+C);u=new RegExp(Qn(C[0])+"\\s*"),p=new RegExp("\\s*"+Qn(C[1])),m=new RegExp("\\s*"+Qn("}"+C[1]))}h(t||fe.tags);for(var S=new bt(e),w,k,b,v,L,T;!S.eos();){if(w=S.pos,b=S.scanUntil(u),b)for(var I=0,O=b.length;I<O;++I)v=b.charAt(I),bu(v)?(i.push(o.length),l+=v):(s=!0,n=!0,l+=" "),o.push(["text",v,w,w+1]),w+=1,v===`
|
|
4
|
+
`&&(d(),l="",c=0,n=!1);if(!S.scan(u))break;if(a=!0,k=S.scan(Cu)||"name",S.scan(Tu),k==="="?(b=S.scanUntil(gi),S.scan(gi),S.scanUntil(p)):k==="{"?(b=S.scanUntil(m),S.scan(Nu),S.scanUntil(p),k="&"):b=S.scanUntil(p),!S.scan(p))throw new Error("Unclosed tag at "+S.pos);if(k==">"?L=[k,b,w,S.pos,l,c,n]:L=[k,b,w,S.pos],c++,o.push(L),k==="#"||k==="^")r.push(L);else if(k==="/"){if(T=r.pop(),!T)throw new Error('Unopened section "'+b+'" at '+w);if(T[1]!==b)throw new Error('Unclosed section "'+T[1]+'" at '+w)}else k==="name"||k==="{"||k==="&"?s=!0:k==="="&&h(b)}if(d(),T=r.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+S.pos);return Pu(xu(o))}function xu(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 Pu(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 bt(e){this.string=e,this.tail=e,this.pos=0}function rt(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function te(){this.templateCache={_cache:{},set:function(t,n){this._cache[t]=n},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}var yu,ot,ku,wu,Au,Tu,vu,gi,Nu,Cu,fe,wt,hi,ki=f(()=>{"use strict";yu=Object.prototype.toString,ot=Array.isArray||function(t){return yu.call(t)==="[object Array]"};ku=RegExp.prototype.test;wu=/\S/;Au={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};Tu=/\s*/,vu=/\s+/,gi=/\s*=/,Nu=/\s*\}/,Cu=/#|\^|\/|>|\{|&|=|!/;bt.prototype.eos=function(){return this.tail===""};bt.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};bt.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};rt.prototype.push=function(t){return new rt(t,this)};rt.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=yi(i,a[s])||hu(i,a[s])),i=i[a[s++]];else i=o.view[t],l=yi(o.view,t);if(l){r=i;break}o=o.parent}n[t]=r}return Yn(r)&&(r=r.call(this.view)),r};te.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};te.prototype.parse=function(t,n){var r=this.templateCache,o=t+":"+(n||fe.tags).join(":"),i=typeof r<"u",a=i?r.get(o):void 0;return a==null&&(a=Lu(t,n),i&&r.set(o,a)),a};te.prototype.render=function(t,n,r,o){var i=this.getConfigTags(o),a=this.parse(t,i),s=n instanceof rt?n:new rt(n,void 0);return this.renderTokens(a,s,r,t,o)};te.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};te.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(ot(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(Yn(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}};te.prototype.renderInverted=function(t,n,r,o,i){var a=n.lookup(t[1]);if(!a||ot(a)&&a.length===0)return this.renderTokens(t[4],n,r,o,i)};te.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
|
-
`)};te.prototype.renderPartial=function(t,n,r,o){if(r){var i=this.getConfigTags(o),a=
|
|
7
|
-
`):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:i}}var j=f(()=>{"use strict";Tt()});import{z as Ni}from"zod";var
|
|
8
|
-
${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as Zi}from"zod";var
|
|
6
|
+
`)};te.prototype.renderPartial=function(t,n,r,o){if(r){var i=this.getConfigTags(o),a=Yn(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)}}};te.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};te.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||fe.escape,i=n.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===fe.escape?String(i):o(i)};te.prototype.rawValue=function(t){return t[1]};te.prototype.getConfigTags=function(t){return ot(t)?t:t&&typeof t=="object"?t.tags:void 0};te.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!ot(t))return t.escape};fe={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){wt.templateCache=e},get templateCache(){return wt.templateCache}},wt=new te;fe.clearCache=function(){return wt.clearCache()};fe.parse=function(t,n){return wt.parse(t,n)};fe.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+gu(t)+'" was given as the first argument for mustache#render(template, view, partials)');return wt.render(t,n,r,o)};fe.escape=Ru;fe.Scanner=bt;fe.Context=rt;fe.Writer=te;hi=fe});function At({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Ou({def:n,name:t})]))}function Ou({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??Eu[e.type]??""}function Rt({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 ne({ref:e,variables:t}){let n=String(Rt({ref:e,variables:t}));return Zn({raw:n,variables:t})}function Zn({raw:e,variables:t}){return hi.render(e,t,{},{escape:n=>n})}function er({ref:e,variables:t}){let n=Rt({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 it({name:e,store:t,value:n}){return{...t,[e]:n}}var Eu,Ie=f(()=>{"use strict";ki();Eu={boolean:!1,number:0,string:""}});function F({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Si(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Si(e.name,n)})}}function Si(e,t){return t==null?e:Zn({raw:e,variables:t})}var at=f(()=>{"use strict";Ie()});async function wi({node:e,page:t,timeout:n}){await F({locator:e.source,page:t,variables:void 0}).dragTo(F({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function bi({node:e,page:t,timeout:n}){await F({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Ai({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 Ri({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=ne({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:it({name:e.variable,store:n,value:r})}}async function Ti({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var vi=f(()=>{"use strict";at();Ie()});async function tr({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 _u({node:e,page:t,timeout:n,variables:r});case"rightClick":return await bi({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=ne({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 ju({node:e,page:t,timeout:n,variables:r});case"select":return $u({node:e,page:t,timeout:n,variables:r});case"type":return Du({node:e,page:t,timeout:n,variables:r});case"press":return await Uu({node:e,page:t,timeout:n}),{variables:r};case"drag":return await wi({node:e,page:t,timeout:n}),{variables:r};case"upload":return Bu({node:e,page:t,timeout:n,variables:r});case"extractText":return Vu({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=Rt({ref:e.value,variables:r});return{variables:it({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 Ai({node:e,page:t,variables:r});case"clipboard":return Ri({node:e,page:t,variables:r});case"setPermission":return await Ti({node:e,page:t}),{variables:r}}}async function _u({node:e,page:t,timeout:n,variables:r}){return await F({locator:e.locator,page:t,variables:r})[Iu[e.type]]({timeout:n}),{variables:r}}async function Uu({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await F({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function ju({node:e,page:t,timeout:n,variables:r}){let o=ne({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function $u({node:e,page:t,timeout:n,variables:r}){let o=ne({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function Du({node:e,page:t,timeout:n,variables:r}){let o=ne({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Bu({node:e,page:t,timeout:n,variables:r}){return await F({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function Vu({node:e,page:t,timeout:n,variables:r}){let o=await F({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:it({name:e.variable,store:r,value:o})}}var Iu,nr=f(()=>{"use strict";vi();at();Ie();Iu={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function _e({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"}),qu(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 Wu(e){return"locator"in e}async function qu(e){return(await Promise.all(e.map(n=>Fu(n)))).filter(n=>n!=null)}async function Fu(e){if(!Wu(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 Jt({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=F({locator:e.source,page:t,variables:void 0}),i=F({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:i,type:"action"}]}if(!Hu(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=F({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function Hu(e){return"locator"in e&&e.locator!=null}var Tt=f(()=>{"use strict";at()});import{z as Mu}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=Mu.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?[]:Jt({node:e.specNode,page:e.page}),n=await _e({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 j=f(()=>{"use strict";Tt()});import{z as Ni}from"zod";var Ju,Ci,Li=f(()=>{"use strict";j();Ju=Ni.object({selector:Ni.string().describe("CSS selector for the checkbox or radio button")}),Ci=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:Ju,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 xi}from"zod";var zu,Pi,Ei=f(()=>{"use strict";j();zu=xi.object({selector:xi.string().describe("CSS selector for the element to check focus on")}),Pi=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:zu,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 rr}from"zod";var Xu,Oi,Ii=f(()=>{"use strict";j();Xu=rr.object({expected:rr.string().describe("The expected text content"),selector:rr.string().describe("CSS selector for the element to check")}),Oi=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:Xu,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 or}from"zod";function Ku({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 Gu,_i,Ui=f(()=>{"use strict";j();Gu=or.object({expected:or.string().describe("Expected page title or substring"),operator:or.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),_i=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:Gu,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=Ku({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 ji}from"zod";var Qu,$i,Di=f(()=>{"use strict";j();Qu=ji.object({selector:ji.string().describe("CSS selector for the element to check")}),$i=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:Qu,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 Bi}from"zod";var Yu,Vi,Wi=f(()=>{"use strict";j();Yu=Bi.object({selector:Bi.string().describe("CSS selector for the checkbox to check")}),Vi=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:Yu,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 qi}from"zod";var Zu,Fi,Hi=f(()=>{"use strict";j();Zu=qi.object({selector:qi.string().describe("CSS selector for the input to clear")}),Fi=R({description:"Clear the contents of an input field",name:"clear",schema:Zu,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 Mi}from"zod";var em,Ji,zi=f(()=>{"use strict";j();em=Mi.object({selector:Mi.string().describe("CSS selector for the element to click")}),Ji=R({description:"Click an element matching the CSS selector",name:"click",schema:em,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 ir}from"zod";var tm,Xi,Gi=f(()=>{"use strict";j();tm=ir.object({action:ir.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:ir.string().optional().describe("Text to write (required for write action)")}),Xi=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:tm,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 zt}from"zod";var Ki,Qi,Yi=f(()=>{"use strict";Ki=zt.object({summary:zt.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:zt.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.")}),Qi={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:{...zt.toJSONSchema(Ki,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Ki.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 Zi}from"zod";var nm,ea,ta=f(()=>{"use strict";j();nm=Zi.object({selector:Zi.string().describe("CSS selector for the element to extract text from")}),ea=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:nm,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 ar}from"zod";var rm,na,ra=f(()=>{"use strict";j();rm=ar.object({selector:ar.string().describe("CSS selector for the input element"),value:ar.string().describe("The text to type into the element")}),na=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:rm,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 oa}from"zod";function im(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var om,ia,aa=f(()=>{"use strict";j();om=oa.object({level:oa.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),ia=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:om,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=>im(o)).join(`
|
|
9
9
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
|
|
10
|
-
${r}`}}})});import{z as sa}from"zod";var
|
|
11
|
-
`),a=r.length>
|
|
12
|
-
(showing last ${String(
|
|
13
|
-
${i}`}}})});import{z as da}from"zod";var
|
|
10
|
+
${r}`}}})});import{z as sa}from"zod";var sr,am,la,ca=f(()=>{"use strict";j();sr=50,am=sa.object({urlFilter:sa.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),la=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:am,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(-sr),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>sr?`
|
|
12
|
+
(showing last ${String(sr)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${a}
|
|
13
|
+
${i}`}}})});import{z as da}from"zod";var sm,pa,ua=f(()=>{"use strict";j();sm=da.object({urlPattern:da.string().describe("Regex pattern to match the request URL")}),pa=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:sm,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
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
|
-
${s}`}}})});import{z as ma}from"zod";var
|
|
20
|
+
${s}`}}})});import{z as ma}from"zod";var lm,fa,ya=f(()=>{"use strict";j();lm=ma.object({selector:ma.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),fa=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:lm,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 cm}from"zod";var dm,ga,ha=f(()=>{"use strict";j();dm=cm.object({}),ga=R({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:dm,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
|
|
23
|
+
${n??""}`}}})});import{z as pm}from"zod";var um,ka,Sa=f(()=>{"use strict";j();um=pm.object({}),ka=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:um,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 wa}from"zod";async function
|
|
28
|
+
${n}`}}})});import{z as wa}from"zod";async function fm(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
31
|
`)}`}async function ba(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
|
|
32
|
-
${String(n)}`}var
|
|
32
|
+
${String(n)}`}var mm,Aa,Ra=f(()=>{"use strict";j();mm=wa.object({type:wa.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),Aa=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:mm,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await fm(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await ba(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await ba(e.page,"sessionStorage")]:[]].join(`
|
|
33
33
|
|
|
34
|
-
`)})})});import{z as
|
|
34
|
+
`)})})});import{z as lr}from"zod";var ym,Ta,va=f(()=>{"use strict";j();ym=lr.object({action:lr.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:lr.string().optional().describe("Text to enter for prompt dialogs")}),Ta=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:ym,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 Na}from"zod";var gm,Ca,La=f(()=>{"use strict";j();gm=Na.object({selector:Na.string().describe("CSS selector for the element to hover over")}),Ca=R({description:"Hover over an element matching the CSS selector",name:"hover",schema:gm,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 cr}from"zod";var hm,xa,Pa=f(()=>{"use strict";j();hm=cr.object({permission:cr.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:cr.enum(["granted","prompt"]).describe("Permission state to set")}),xa=R({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:hm,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 Ea}from"zod";var km,Oa,Ia=f(()=>{"use strict";j();km=Ea.object({url:Ea.string().describe("The URL to navigate to")}),Oa=R({description:"Navigate the browser to a URL",name:"navigate",schema:km,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 _a}from"zod";var Sm,Ua,ja=f(()=>{"use strict";j();Sm=_a.object({key:_a.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),Ua=R({description:"Press a keyboard key",name:"press",schema:Sm,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 dr}from"zod";var wm,$a,Da=f(()=>{"use strict";j();wm=dr.object({height:dr.number().int().positive().describe("Viewport height in pixels"),width:dr.number().int().positive().describe("Viewport width in pixels")}),$a=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:wm,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 Ba}from"zod";var bm,Va,Wa=f(()=>{"use strict";j();bm=Ba.object({selector:Ba.string().describe("CSS selector for the element to right-click")}),Va=R({description:"Right-click an element to open the context menu",name:"right_click",schema:bm,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 qa}from"zod";function Rm(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Am,Fa,Ha=f(()=>{"use strict";j();Am=qa.object({pattern:qa.string().describe("Regex pattern to search console log messages")}),Fa=R({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:Am,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=>Rm(i)).join(`
|
|
35
35
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
|
|
36
|
-
${o}`}}})});import{z as Ma}from"zod";var
|
|
36
|
+
${o}`}}})});import{z as Ma}from"zod";var Tm,Ja,za=f(()=>{"use strict";j();Tm=Ma.object({pattern:Ma.string().describe("Regex pattern to search across network request URLs and response bodies")}),Ja=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:Tm,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 Xa}from"zod";function
|
|
39
|
-
`);i.push(d)}),i}var
|
|
40
|
-
`),o=
|
|
38
|
+
${o}`}}})});import{z as Xa}from"zod";function Lm({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 vm,Nm,Cm,Ga,Ka=f(()=>{"use strict";j();vm=20,Nm=2,Cm=Xa.object({pattern:Xa.string().describe("Regex pattern to search for in the page HTML")}),Ga=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:Cm,execute:async(e,t)=>{let r=(await e.page.content()).split(`
|
|
40
|
+
`),o=Lm({contextLines:Nm,lines:r,maxResults:vm,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
|
|
43
|
-
${u.stack??""}`)}function c(u){let p=u.failure(),m=new Xt(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 Xt,
|
|
44
|
-
`)});import is from"fs";import
|
|
42
|
+
`)}}})});import{z as pr}from"zod";var xm,Qa,Ya=f(()=>{"use strict";j();xm=pr.object({selector:pr.string().describe("CSS selector for the select element"),value:pr.string().describe("The option value to select")}),Qa=R({description:"Select an option from a dropdown/select element",name:"select",schema:xm,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 Za}from"zod";var Pm,es,ts=f(()=>{"use strict";j();Pm=Za.object({selector:Za.string().describe("CSS selector for the checkbox to uncheck")}),es=R({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:Pm,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 vt(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 Xt(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 Xt(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 Xt,ur=f(()=>{"use strict";Xt=class{method;requestHeaders;requestPostData;timestamp;url;responseBody=void 0;responseHeaders={};statusCode=void 0;constructor(t){this.method=t.method(),this.requestHeaders=t.headers(),this.requestPostData=t.postData()??void 0,this.timestamp=Date.now(),this.url=t.url()}applyResponse(t){this.statusCode=t.status(),this.responseHeaders=t.headers(),t.text().then(n=>{this.responseBody=n.length>1e5?`${n.slice(0,1e5)}... (truncated)`:n}).catch(()=>{this.responseBody="(unable to read body)"})}}});async function rs({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:i}){let a=Em.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 mr,Em,fr,ns,os=f(()=>{"use strict";Li();Ei();Ii();Ui();Di();Wi();Hi();zi();Gi();Yi();ta();ra();aa();ca();ua();ya();ha();Sa();Ra();va();La();Pa();Ia();ja();Da();Wa();Ha();za();Ka();Ya();ts();ur();mr=[Oa,Ji,na,Ua,Vi,es,Qa,Ca,ga,Ga,Fi,Va,Ta,Xi,xa,$i,Oi,_i,Ci,Pi,ia,la,pa,ka,fa,Aa,Fa,Ja,$a,ea,Qi],Em=new Map(mr.map(e=>[e.name,e])),fr=mr.map(e=>e.anthropicTool),ns=mr.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
|
|
44
|
+
`)});import is from"fs";import Om from"path";import yr from"pino";function gr({filePath:e}){let t=Om.dirname(e);is.mkdirSync(t,{recursive:!0}),is.writeFileSync(e,"");let n=yr.destination({dest:e,sync:!0}),r=yr({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,Y=f(()=>{"use strict";A=yr({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Im from"@anthropic-ai/sdk";async function hr({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 Im({apiKey:"ripplo",baseURL:`${a}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${c}`,"x-run-id":i}}),p=performance.now(),m=vt(o);await qm({baseUrl:e,page:o});let h=$m({extraVariables:n,spec:s}),S=Bm({baseUrl:e,executedPreconditions:t,spec:s,systemPrompt:l,variables:h,workflowContext:d}),w=Vm({baseUrl:e,spec:s,variables:h}),b=[{content:Wm({page:o,startUrl:w}),role:"user"}],v=[],L=[],T={findings:"",stepIndex:0,verdict:void 0};T=await Um({client:u,messages:b,monitor:m,onStep:r,page:o,runStartTime:p,specNodes:L,state:T,steps:v,system:S}),T.verdict==null&&(T=await jm({client:u,messages:b,monitor:m,onStep:r,page:o,runStartTime:p,specNodes:L,state:T,steps:v,system:S}));let I=Hm(L);return{findings:T.findings,generatedSpec:I,monitor:m,steps:v,verdict:T.verdict??"fail"}}function ss({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Um({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<_m;u++){A.info("Agent iteration %d",u+1);let p=await e.messages.create({max_tokens:as,messages:t,model:"server-controlled",system:c,tools:fr}),m=await ls({messages:t,monitor:n,onStep:r,page:o,response:p,runStartTime:i,specNodes:a,stepIndex:d.stepIndex,steps:l});if(d=ss({result:m,state:d}),!m.continueLoop)break}return d}async function jm({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:as,messages:t,model:"server-controlled",system:c,tool_choice:{name:"complete_test",type:"tool"},tools:fr}),u=await ls({messages:t,monitor:n,onStep:r,page:o,response:d,runStartTime:i,specNodes:a,stepIndex:s.stepIndex,steps:l});return ss({result:u,state:s})}function $m({extraVariables:e,spec:t}){let n=Dm(e,t?.variableNamespaces);return{...At({defs:t?.variables}),...n}}function Dm(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 Bm({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(`
|
|
@@ -64,52 +64,52 @@ Do not repeat any of these steps.`,d=Object.entries(o),u=d.map(([m,h])=>`- **${m
|
|
|
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
65
|
## Available Tools`,ns,a,c,s,p,`
|
|
66
66
|
## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
|
|
67
|
-
`)}function
|
|
68
|
-
`),nextStepIndex:s,verdict:void 0};let u=[],p=s,m,h;for(let w of d){let k=await
|
|
69
|
-
`);return{continueLoop:m==null&&o.stop_reason==="tool_use",newFindings:S,nextStepIndex:p,verdict:m}}async function
|
|
67
|
+
`)}function Vm({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 Wm({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 qm({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 ls({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:i,specNodes:a,stepIndex:s,steps:l}){let c=o.content.filter(w=>w.type==="text").map(w=>w.text),d=o.content.filter(w=>w.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 w of d){let k=await Fm({block:w,monitor:t,onStep:n,page:r,runStartTime:i,specNodes:a,stepIndex:p,steps:l});u.push(k.toolResult),p=k.nextStepIndex,k.verdict!=null&&(m=k.verdict,h=k.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 Fm({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:i,stepIndex:a,steps:s}){try{let l=await rs({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 _e({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 Hm(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 _m,as,kr=f(()=>{"use strict";os();Y();Tt();Ie();_m=50,as=16384});function Sr({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.',
|
|
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.',Mm({hasSuccessCriteria:n!=null&&n.length>0}),Jm({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
|
|
73
73
|
`)),r.join(`
|
|
74
74
|
|
|
75
|
-
`)}function
|
|
75
|
+
`)}function Mm({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 Jm({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 wr=f(()=>{"use strict"});import{execFile as zm}from"child_process";import{createRequire as Xm}from"module";import cs from"fs";import ds from"path";import{chromium as ps}from"playwright";async function Ue({headed:e}){try{return await ps.launch({headless:!e})}catch(t){throw Gm(t)?new Error(`Playwright browsers are not installed. Run:
|
|
76
76
|
|
|
77
77
|
npx playwright install chromium
|
|
78
|
-
`):t}}async function
|
|
78
|
+
`):t}}async function br(){let e=ps.executablePath();if(cs.existsSync(e))return;A.info("Chromium not found. Installing via Playwright...");let t=Xm(import.meta.url),n=ds.dirname(t.resolve("playwright/package.json")),r=ds.join(n,"cli.js");if(await new Promise((o,i)=>{zm(process.execPath,[r,"install","chromium"],a=>{if(a!=null){i(new Error(`Playwright install failed: ${a.message}`));return}o()})}),!cs.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
|
|
79
79
|
|
|
80
80
|
npx playwright install chromium
|
|
81
|
-
`);A.info("\u2713 Chromium installed")}function
|
|
81
|
+
`);A.info("\u2713 Chromium installed")}function Gm(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var Nt=f(()=>{"use strict";Y()});import{mkdir as Ar,writeFile as ke}from"fs/promises";import re from"path";async function Gt({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let i=re.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([ke(re.join(i,"info.json"),JSON.stringify(a,null,2)),ke(re.join(i,"screenshot.png"),Buffer.from(o.screenshotBase64,"base64")),Km({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 Km({context:e,page:t,stepDir:n}){let[r,o,i]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),Qm(t),Ym({context:e,page:t})]);await Promise.all([ke(re.join(n,"dom.html"),r),ke(re.join(n,"accessibility-tree.txt"),o),ke(re.join(n,"storage.json"),JSON.stringify(i,null,2))])}async function Qm(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function Ym({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 Kt({monitor:e,runId:t,steps:n,summary:r}){try{let o=re.join(process.cwd(),".ripplo","debug",t);await Ar(o,{recursive:!0}),await Promise.all([ke(re.join(o,"summary.txt"),Zm({steps:n,summary:r})),ke(re.join(o,"console.log"),ef(e.consoleEntries)),ke(re.join(o,"network.jsonl"),tf(e.networkEntries)),ke(re.join(o,"page-errors.log"),e.pageErrors.join(`
|
|
82
82
|
---
|
|
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
|
|
84
|
-
`)}function
|
|
85
|
-
`)}function
|
|
86
|
-
`)}async function us({error:e,runId:t,stack:n,workflowName:r}){try{let o=re.join(process.cwd(),".ripplo","debug",t);await
|
|
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 Zm({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 ef(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
|
|
85
|
+
`)}function tf(e){return e.map(t=>JSON.stringify(t)).join(`
|
|
86
|
+
`)}async function us({error:e,runId:t,stack:n,workflowName:r}){try{let o=re.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([ke(re.join(o,"error.txt"),i),ke(re.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 Qt=f(()=>{"use strict";Y()});async function
|
|
90
|
+
`);await Promise.all([ke(re.join(o,"error.txt"),i),ke(re.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 Qt=f(()=>{"use strict";Y()});async function Rr({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 Ue({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 w=function(I){l.enqueueStep(I),l.flushSteps(),Gt({context:m,page:h,runId:i,stepIndex:I.stepIndex,stepResult:I})};var S=w;let k=await hr({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:w,page:h,runId:i,serverUrl:a,spec:s,systemPrompt:c,token:d,workflowContext:u}),b=k.verdict==="pass"?"passed":"failed";await l.complete({statusOverride:b,steps:k.steps,summary:k.findings});let v=k.steps.filter(I=>I.status==="passed").length,L=k.steps.filter(I=>I.status==="failed").length,T={duration:k.steps.reduce((I,O)=>I+O.duration,0),failCount:L,passCount:v,runId:i,status:b,workflowName:u.name};await Kt({monitor:k.monitor,runId:i,steps:k.steps,summary:T}),A.info("Agent test complete: %d passed, %d failed",v,L),A.info(`
|
|
91
91
|
=== Agent Summary ===
|
|
92
|
-
%s`,k.findings)}finally{await p.close()}}var
|
|
92
|
+
%s`,k.findings)}finally{await p.close()}}var Tr=f(()=>{"use strict";Nt();kr();Qt();Y()});async function vr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return Ct({actual:o??"",expected:e,label:"Text",operator:n})}function Yt({expected:e,operator:t,url:n}){return Ct({actual:n,expected:e,label:"URL",operator:t})}async function Nr({expected:e,locator:t,operator:n}){let r=await t.count();return ws({actual:r,expected:e,label:"Count",operator:n})}async function Cr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return Ct({actual:o,expected:e,label:"Value",operator:n})}async function Lr({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),{description:"Element is visible",detail:void 0,status:"passed"}}catch{return{description:"Element is visible",detail:"Element not visible",status:"failed"}}}async function xr({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 ms({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let i=await n.getAttribute(e,{timeout:o});return Ct({actual:i??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function fs({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 ys({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 gs({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 hs({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 ks({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 Ss({locator:e,timeout:t}){try{return await e.waitFor({state:"visible",timeout:t}),!!await e.evaluate("(el) => document.activeElement === el")?{description:"Element is not focused",detail:"Element is focused",status:"failed"}:{description:"Element is not focused",detail:void 0,status:"passed"}}catch{return{description:"Element is not focused",detail:"Element not found",status:"failed"}}}function Ct(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=nf(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function nf({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 ws(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=rf(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function rf({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 Z({fn:e,label:t}){let n=performance.now(),r=await e();return A.info("%s: %dms",t,Math.round(performance.now()-n)),r}var st=f(()=>{"use strict";Y()});async function Er({headed:e,size:t}){let n=await Z({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>Ue({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"),Ue({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 bs=f(()=>{"use strict";Nt();Y();st()});import{print as of}from"graphql";async function $(e){let t=of(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(af)})}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(!sf(i))throw new Error("Invalid GraphQL response");if(lf(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 sf(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function lf(e){return Array.isArray(e.errors)&&e.errors.length>0}var af,Lt=f(()=>{"use strict";af=15e3});import{readdir as cf,rm as df,stat as pf}from"fs/promises";import _v from"os";import Ts from"path";import{graphql as uf}from"gql.tada";async function Or({maxRuns:e}){try{let n=(await cf(As,{withFileTypes:!0})).filter(c=>c.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async c=>{let d=Ts.join(As,c.name),u=await pf(d);return{dirPath:d,mtime:u.mtimeMs}})),i=o.filter(c=>r-c.mtime>Rs),s=o.filter(c=>r-c.mtime<=Rs).toSorted((c,d)=>d.mtime-c.mtime).slice(e),l=[...i,...s];if(l.length===0)return;await Promise.allSettled(l.map(c=>df(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 As,Rs,Bv,vs=f(()=>{"use strict";Lt();Y();As=Ts.join(process.cwd(),".ripplo","debug"),Rs=360*60*1e3,Bv=uf(`
|
|
93
93
|
mutation RevokeCurrentCliToken {
|
|
94
94
|
revokeCurrentCliToken
|
|
95
95
|
}
|
|
96
|
-
`)});async function
|
|
97
|
-
`))}}var
|
|
98
|
-
`),t}function be(e,t){return
|
|
99
|
-
`)}var Ns=f(()=>{"use strict";Dr()});import{z as en}from"zod";function rn(e){return Cs({legacy:void 0,migrators:[],name:e,schemas:[]})}function Cs(e){return{initial:t=>Wr(t,{...e,schemas:[t]}),legacy:t=>Cs({...e,legacy:t})}}function Wr(e,t){return{build:()=>yf(e,t),legacy:n=>Wr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Wr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function yf(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>gf(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function gf(e,t,n){let{data:r,version:o}=hf(t,n),i=Ls(t,r,o);return e.parse(i)}function hf(e,t){let n=ff.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new nn({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 Ls(e,t,n){let r=e.schemas.length;if(n>r)throw new tn({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 Ls(e,a(i),n+1)}var ff,tn,nn,qr=f(()=>{"use strict";ff=en.object({__codec:en.string().min(1),data:en.unknown(),version:en.number().int().positive()}),tn=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}},nn=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as lt}from"zod";var Fr,Hr=f(()=>{"use strict";Fr=lt.object({depends:lt.array(lt.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:lt.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:lt.array(lt.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 je}from"zod";var kf,Sf,U,Mr=f(()=>{"use strict";kf=je.object({by:je.literal("testId"),value:je.string().min(1)}),Sf=je.object({by:je.literal("role"),name:je.string().optional(),role:je.string().min(1)}),U=je.discriminatedUnion("by",[kf,Sf])});import{z as xs}from"zod";var $e,on,Jr=f(()=>{"use strict";$e=xs.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),on=xs.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as X}from"zod";var wf,zr,an,oe,sn,Xr=f(()=>{"use strict";wf=X.object({type:X.literal("static"),value:X.union([X.string(),X.number(),X.boolean()])}),zr=X.object({name:X.string().min(1),type:X.literal("variable")}),an=X.discriminatedUnion("type",[wf,zr]),oe=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.string()}),zr]),sn=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.number().int().nonnegative()}),zr])});import{z as le}from"zod";var ln,Gr=f(()=>{"use strict";ln=le.discriminatedUnion("type",[le.object({default:le.string().optional(),type:le.literal("string")}),le.object({default:le.number().optional(),type:le.literal("number")}),le.object({default:le.boolean().optional(),type:le.literal("boolean")}),le.object({key:le.string().min(1),type:le.literal("env")})])});import{z as g}from"zod";var E,Ps,bf,Af,Rf,Tf,vf,Nf,Cf,Lf,xf,Pf,Ef,Of,If,_f,Uf,jf,$f,Df,Bf,Vf,Wf,qf,Ff,Hf,Mf,Jf,zf,Xf,Gf,Kf,Qf,Yf,Zf,ey,ty,ny,ry,oy,Es,cn,dn=f(()=>{"use strict";Mr();Jr();Xr();Gr();Mr();Jr();Xr();Gr();E={id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),uiOnly:g.boolean().optional()},Ps=500,bf=g.object({...E,type:g.literal("goto"),url:oe}),Af=g.object({...E,locator:U,type:g.literal("click")}),Rf=g.object({...E,locator:U,type:g.literal("fill"),value:oe}),Tf=g.object({...E,locator:U,type:g.literal("select"),value:oe}),vf=g.object({...E,locator:U,type:g.literal("hover")}),Nf=g.object({...E,key:g.string().min(1),locator:U.optional(),type:g.literal("press")}),Cf=g.object({...E,locator:U,type:g.literal("check")}),Lf=g.object({...E,locator:U,type:g.literal("uncheck")}),xf=g.object({...E,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),Pf=g.object({...E,message:g.string().min(1),type:g.literal("fail")}),Ef=g.object({...E,type:g.literal("setVariable"),value:an,variable:g.string().min(1)}),Of=g.object({...E,locator:U,type:g.literal("extractText"),variable:g.string().min(1)}),If=g.object({...E,files:g.array(g.string()).min(1),locator:U,type:g.literal("upload")}),_f=g.object({...E,locator:U,type:g.literal("dblclick")}),Uf=g.object({...E,source:U,target:U,type:g.literal("drag")}),jf=g.object({...E,locator:U,type:g.literal("scrollIntoView")}),$f=g.object({...E,locator:U,type:g.literal("type"),value:oe}),Df=g.object({...E,locator:U,type:g.literal("focus")}),Bf=g.object({...E,locator:U,type:g.literal("clear")}),Vf=g.object({...E,locator:U,type:g.literal("rightClick")}),Wf=g.object({...E,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),qf=g.object({...E,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:oe.optional(),variable:g.string().min(1).optional()}),Ff=g.object({...E,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),Hf=g.object({...E,locator:U,type:g.literal("assertVisible")}),Mf=g.object({...E,locator:U,type:g.literal("assertNotVisible")}),Jf=g.object({...E,expected:oe,locator:U,operator:$e,type:g.literal("assertText")}),zf=g.object({...E,expected:oe,operator:$e,type:g.literal("assertUrl")}),Xf=g.object({...E,expected:sn,locator:U,operator:on,type:g.literal("assertCount")}),Gf=g.object({...E,expected:oe,locator:U,operator:$e,type:g.literal("assertValue")}),Kf=g.object({...E,attribute:g.string().min(1),expected:oe,locator:U,operator:$e,type:g.literal("assertAttribute")}),Qf=g.object({...E,locator:U,type:g.literal("assertEnabled")}),Yf=g.object({...E,locator:U,type:g.literal("assertDisabled")}),Zf=g.object({...E,expected:oe,operator:$e,type:g.literal("assertTitle")}),ey=g.object({...E,locator:U,type:g.literal("assertChecked")}),ty=g.object({...E,locator:U,type:g.literal("assertNotChecked")}),ny=g.object({...E,locator:U,type:g.literal("assertFocused")}),ry=g.object({...E,locator:U,type:g.literal("assertNotFocused")}),oy=g.object({...E,budget:g.enum(["fast","slow","async"]),observer:g.string().min(1).max(200),params:g.record(g.string().max(200),oe),type:g.literal("assertObserver")}),Es=g.discriminatedUnion("type",[bf,Af,Rf,Tf,vf,Nf,Cf,Lf,Hf,Mf,Jf,zf,Xf,Gf,Kf,Qf,Yf,xf,Pf,Ef,Of,If,_f,Uf,jf,$f,Df,Bf,Vf,Wf,qf,Ff,Zf,ey,ty,ny,ry,oy]),cn=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),Es).refine(e=>Object.keys(e).length<=Ps,`Workflow has more than ${String(Ps)} nodes`),uiOnly:g.boolean().optional(),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),ln).optional()})});import{z as Os}from"zod";var iy,ay,sy,Kr,ly,Is=f(()=>{"use strict";qr();Hr();dn();iy=Os.record(Os.string().max(200),Fr),ay={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},sy={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Kr=rn("workflow-spec").legacy(ay).initial(cn).build(),ly=rn("precondition-map").legacy(sy).initial(iy).build()});import{z as Qr}from"zod";var _s,cy,Us=f(()=>{"use strict";_s=["fast","slow","async"],cy=Qr.object({budget:Qr.enum(_s).describe("Polling budget tier: fast | slow | async"),description:Qr.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 js=f(()=>{"use strict";dn()});var $s=f(()=>{"use strict";qr();Is();Hr();Us();dn();js()});var Bs=Vt(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.timingSafeEqual=void 0;function Ds(e,t=""){if(!e)throw new Error(t)}function dy(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)),Ds(e instanceof DataView),Ds(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}pn.timingSafeEqual=dy});var qs=Vt(ce=>{"use strict";var py=ce&&ce.__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(ce,"__esModule",{value:!0});var H=256,Yr=(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&H,s|=c&H,s|=d&H,s|=u&H;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&H,s|=c&H),a<r-2&&(d=this._decodeChar(t.charCodeAt(a+2)),o[i++]=c<<4|d>>>2,s|=d&H),a<r-3&&(u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=d<<6|u,s|=u&H),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=H;return n+=(42-t&t-44)>>>8&-H+t-43+62,n+=(46-t&t-48)>>>8&-H+t-47+63,n+=(47-t&t-58)>>>8&-H+t-48+52,n+=(64-t&t-91)>>>8&-H+t-65+0,n+=(96-t&t-123)>>>8&-H+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})();ce.Coder=Yr;var xt=new Yr;function uy(e){return xt.encode(e)}ce.encode=uy;function my(e){return xt.decode(e)}ce.decode=my;var Vs=(function(e){py(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=H;return r+=(44-n&n-46)>>>8&-H+n-45+62,r+=(94-n&n-96)>>>8&-H+n-95+63,r+=(47-n&n-58)>>>8&-H+n-48+52,r+=(64-n&n-91)>>>8&-H+n-65+0,r+=(96-n&n-123)>>>8&-H+n-97+26,r},t})(Yr);ce.URLSafeCoder=Vs;var Ws=new Vs;function fy(e){return Ws.encode(e)}ce.encodeURLSafe=fy;function yy(e){return Ws.decode(e)}ce.decodeURLSafe=yy;ce.encodedLength=function(e){return xt.encodedLength(e)};ce.maxDecodedLength=function(e){return xt.maxDecodedLength(e)};ce.decodedLength=function(e){return xt.decodedLength(e)}});var Hs=Vt((Fs,un)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof un=="object"&&typeof un.exports=="object"?un.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Fs,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 w,k,b,v,L,T,I,O,C,V,ze,kt,Bt;S>=64;){for(w=p[0],k=p[1],b=p[2],v=p[3],L=p[4],T=p[5],I=p[6],O=p[7],V=0;V<16;V++)ze=h+V*4,u[V]=(m[ze]&255)<<24|(m[ze+1]&255)<<16|(m[ze+2]&255)<<8|m[ze+3]&255;for(V=16;V<64;V++)C=u[V-2],kt=(C>>>17|C<<15)^(C>>>19|C<<13)^C>>>10,C=u[V-15],Bt=(C>>>7|C<<25)^(C>>>18|C<<14)^C>>>3,u[V]=(kt+u[V-7]|0)+(Bt+u[V-16]|0);for(V=0;V<64;V++)kt=(((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&T^~L&I)|0)+(O+(t[V]+u[V]|0)|0)|0,Bt=((w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10))+(w&k^w&b^k&b)|0,O=I,I=T,T=L,L=v+kt|0,v=b,b=k,k=w,w=kt+Bt|0;p[0]+=w,p[1]+=k,p[2]+=b,p[3]+=v,p[4]+=L,p[5]+=T,p[6]+=I,p[7]+=O,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,w=m<<3,k=m%64<56?64:128;this.buffer[h]=128;for(var b=h+1;b<k-8;b++)this.buffer[b]=0;this.buffer[k-8]=S>>>24&255,this.buffer[k-7]=S>>>16&255,this.buffer[k-6]=S>>>8&255,this.buffer[k-5]=S>>>0&255,this.buffer[k-4]=w>>>24&255,this.buffer[k-3]=w>>>16&255,this.buffer[k-2]=w>>>8&255,this.buffer[k-1]=w>>>0&255,n(this.temp,this.state,this.buffer,0,k),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]),w=a(p,u),k=new o(w),b=new Uint8Array(k.digestLength),v=b.length,L=new Uint8Array(h),T=0;T<h;T++)v===b.length&&(s(b,k,m,S),v=0),L[T]=b[v++];return k.clean(),b.fill(0),S.fill(0),L}e.hkdf=c;function d(u,p,m,h){for(var S=new o(u),w=S.digestLength,k=new Uint8Array(4),b=new Uint8Array(w),v=new Uint8Array(w),L=new Uint8Array(h),T=0;T*w<h;T++){var I=T+1;k[0]=I>>>24&255,k[1]=I>>>16&255,k[2]=I>>>8&255,k[3]=I>>>0&255,S.reset(),S.update(p),S.update(k),S.finish(v);for(var O=0;O<w;O++)b[O]=v[O];for(var O=2;O<=m;O++){S.reset(),S.update(v).finish(v);for(var C=0;C<w;C++)b[C]^=v[C]}for(var O=0;O<w&&T*w+O<h;O++)L[T*w+O]=b[O]}for(var T=0;T<w;T++)b[T]=v[T]=0;for(var T=0;T<4;T++)k[T]=0;return S.clean(),L}e.pbkdf2=d})});var eo=Vt(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.Webhook=ct.WebhookVerificationError=void 0;var gy=Bs(),Ms=qs(),hy=Hs(),Js=300,Zr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},De=class e extends Zr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};ct.WebhookVerificationError=De;var mn=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=Ms.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 De("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,gy.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new De("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,${Ms.encode(hy.hmac(this.key,a))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new De("Invalid Signature Headers");if(n-r>Js)throw new De("Message timestamp too old");if(r>n+Js)throw new De("Message timestamp too new");return new Date(r*1e3)}};ct.Webhook=mn;mn.prefix="whsec_"});import zs from"crypto";function Be({body:e,secret:t}){let n=new Xs.Webhook(t),r=`msg_${zs.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 to(){return`whsec_${zs.randomBytes(24).toString("base64")}`}var Xs,fn=f(()=>{"use strict";Xs=ti(eo(),1)});import{z as ye}from"zod";async function Gs({apiUrl:e,budget:t,observer:n,params:r,webhookSecret:o}){let i=Sy[t],a=performance.now(),s={lastReason:void 0,pollCount:0};for(;performance.now()-a<i.timeoutMs;){s.pollCount+=1;let l=await Ry({apiUrl:e,observer:n,params:r,webhookSecret:o}),c=Ay({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(Ty({backoff:i.backoffMs,pollCount:s.pollCount}),d);await vy(u)}return{description:`observer "${n}"`,detail:`budget "${t}" exhausted after ${String(s.pollCount)} poll(s) (${Ks(a)}); last: ${s.lastReason??"no retry reason"}
|
|
100
|
-
\u2192 /ripplo:debug \u2014 check .ripplo/debug/<runId>/ artifacts`,status:"failed"}}function
|
|
96
|
+
`)});async function Ir({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(mf)})}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 mf,_r=f(()=>{"use strict";Y();mf=5e3});import Zt from"fs";import Ur from"path";function jr(e){return Ur.join(e,".ripplo",ff)}function Xe(e){let t=jr(e);Zt.existsSync(t)||Zt.mkdirSync(t,{recursive:!0});let n=Ur.join(t,".gitignore");return Zt.existsSync(n)||Zt.writeFileSync(n,`*
|
|
98
|
+
`),t}function be(e,t){return Ur.join(jr(e),t)}var ff,$r=f(()=>{"use strict";ff=".local"});import Dr from"fs";function Re(e){let t=be(e,"token");if(!Dr.existsSync(t))return null;let n=Dr.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Br(e,t){Xe(e),Dr.writeFileSync(be(e,"token"),t+`
|
|
99
|
+
`)}var Ns=f(()=>{"use strict";$r()});import{z as en}from"zod";function rn(e){return Cs({legacy:void 0,migrators:[],name:e,schemas:[]})}function Cs(e){return{initial:t=>Vr(t,{...e,schemas:[t]}),legacy:t=>Cs({...e,legacy:t})}}function Vr(e,t){return{build:()=>gf(e,t),legacy:n=>Vr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Vr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function gf(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>hf(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function hf(e,t,n){let{data:r,version:o}=kf(t,n),i=Ls(t,r,o);return e.parse(i)}function kf(e,t){let n=yf.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new nn({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 Ls(e,t,n){let r=e.schemas.length;if(n>r)throw new tn({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 Ls(e,a(i),n+1)}var yf,tn,nn,Wr=f(()=>{"use strict";yf=en.object({__codec:en.string().min(1),data:en.unknown(),version:en.number().int().positive()}),tn=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}},nn=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as lt}from"zod";var qr,Fr=f(()=>{"use strict";qr=lt.object({depends:lt.array(lt.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:lt.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:lt.array(lt.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 je}from"zod";var Sf,wf,U,Hr=f(()=>{"use strict";Sf=je.object({by:je.literal("testId"),value:je.string().min(1)}),wf=je.object({by:je.literal("role"),name:je.string().optional(),role:je.string().min(1)}),U=je.discriminatedUnion("by",[Sf,wf])});import{z as xs}from"zod";var $e,on,Mr=f(()=>{"use strict";$e=xs.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),on=xs.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as X}from"zod";var bf,Jr,an,oe,sn,zr=f(()=>{"use strict";bf=X.object({type:X.literal("static"),value:X.union([X.string(),X.number(),X.boolean()])}),Jr=X.object({name:X.string().min(1),type:X.literal("variable")}),an=X.discriminatedUnion("type",[bf,Jr]),oe=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.string()}),Jr]),sn=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.number().int().nonnegative()}),Jr])});import{z as le}from"zod";var ln,Xr=f(()=>{"use strict";ln=le.discriminatedUnion("type",[le.object({default:le.string().optional(),type:le.literal("string")}),le.object({default:le.number().optional(),type:le.literal("number")}),le.object({default:le.boolean().optional(),type:le.literal("boolean")}),le.object({key:le.string().min(1),type:le.literal("env")})])});import{z as g}from"zod";var E,Ps,Af,Rf,Tf,vf,Nf,Cf,Lf,xf,Pf,Ef,Of,If,_f,Uf,jf,$f,Df,Bf,Vf,Wf,qf,Ff,Hf,Mf,Jf,zf,Xf,Gf,Kf,Qf,Yf,Zf,ey,ty,ny,ry,oy,iy,Es,cn,dn=f(()=>{"use strict";Hr();Mr();zr();Xr();Hr();Mr();zr();Xr();E={id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),uiOnly:g.boolean().optional()},Ps=500,Af=g.object({...E,type:g.literal("goto"),url:oe}),Rf=g.object({...E,locator:U,type:g.literal("click")}),Tf=g.object({...E,locator:U,type:g.literal("fill"),value:oe}),vf=g.object({...E,locator:U,type:g.literal("select"),value:oe}),Nf=g.object({...E,locator:U,type:g.literal("hover")}),Cf=g.object({...E,key:g.string().min(1),locator:U.optional(),type:g.literal("press")}),Lf=g.object({...E,locator:U,type:g.literal("check")}),xf=g.object({...E,locator:U,type:g.literal("uncheck")}),Pf=g.object({...E,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),Ef=g.object({...E,message:g.string().min(1),type:g.literal("fail")}),Of=g.object({...E,type:g.literal("setVariable"),value:an,variable:g.string().min(1)}),If=g.object({...E,locator:U,type:g.literal("extractText"),variable:g.string().min(1)}),_f=g.object({...E,files:g.array(g.string()).min(1),locator:U,type:g.literal("upload")}),Uf=g.object({...E,locator:U,type:g.literal("dblclick")}),jf=g.object({...E,source:U,target:U,type:g.literal("drag")}),$f=g.object({...E,locator:U,type:g.literal("scrollIntoView")}),Df=g.object({...E,locator:U,type:g.literal("type"),value:oe}),Bf=g.object({...E,locator:U,type:g.literal("focus")}),Vf=g.object({...E,locator:U,type:g.literal("clear")}),Wf=g.object({...E,locator:U,type:g.literal("rightClick")}),qf=g.object({...E,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),Ff=g.object({...E,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:oe.optional(),variable:g.string().min(1).optional()}),Hf=g.object({...E,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),Mf=g.object({...E,locator:U,type:g.literal("assertVisible")}),Jf=g.object({...E,locator:U,type:g.literal("assertNotVisible")}),zf=g.object({...E,expected:oe,locator:U,operator:$e,type:g.literal("assertText")}),Xf=g.object({...E,expected:oe,operator:$e,type:g.literal("assertUrl")}),Gf=g.object({...E,expected:sn,locator:U,operator:on,type:g.literal("assertCount")}),Kf=g.object({...E,expected:oe,locator:U,operator:$e,type:g.literal("assertValue")}),Qf=g.object({...E,attribute:g.string().min(1),expected:oe,locator:U,operator:$e,type:g.literal("assertAttribute")}),Yf=g.object({...E,locator:U,type:g.literal("assertEnabled")}),Zf=g.object({...E,locator:U,type:g.literal("assertDisabled")}),ey=g.object({...E,expected:oe,operator:$e,type:g.literal("assertTitle")}),ty=g.object({...E,locator:U,type:g.literal("assertChecked")}),ny=g.object({...E,locator:U,type:g.literal("assertNotChecked")}),ry=g.object({...E,locator:U,type:g.literal("assertFocused")}),oy=g.object({...E,locator:U,type:g.literal("assertNotFocused")}),iy=g.object({...E,budget:g.enum(["fast","slow","async"]),observer:g.string().min(1).max(200),params:g.record(g.string().max(200),oe),type:g.literal("assertObserver")}),Es=g.discriminatedUnion("type",[Af,Rf,Tf,vf,Nf,Cf,Lf,xf,Mf,Jf,zf,Xf,Gf,Kf,Qf,Yf,Zf,Pf,Ef,Of,If,_f,Uf,jf,$f,Df,Bf,Vf,Wf,qf,Ff,Hf,ey,ty,ny,ry,oy,iy]),cn=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),Es).refine(e=>Object.keys(e).length<=Ps,`Workflow has more than ${String(Ps)} nodes`),uiOnly:g.boolean().optional(),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),ln).optional()})});import{z as Os}from"zod";var ay,sy,ly,Gr,cy,Is=f(()=>{"use strict";Wr();Fr();dn();ay=Os.record(Os.string().max(200),qr),sy={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},ly={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Gr=rn("workflow-spec").legacy(sy).initial(cn).build(),cy=rn("precondition-map").legacy(ly).initial(ay).build()});import{z as Kr}from"zod";var _s,dy,Us=f(()=>{"use strict";_s=["fast","slow","async"],dy=Kr.object({budget:Kr.enum(_s).describe("Polling budget tier: fast | slow | async"),description:Kr.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 js=f(()=>{"use strict";dn()});var $s=f(()=>{"use strict";Wr();Is();Fr();Us();dn();js()});var Bs=Vt(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.timingSafeEqual=void 0;function Ds(e,t=""){if(!e)throw new Error(t)}function py(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)),Ds(e instanceof DataView),Ds(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}pn.timingSafeEqual=py});var qs=Vt(ce=>{"use strict";var uy=ce&&ce.__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(ce,"__esModule",{value:!0});var H=256,Qr=(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&H,s|=c&H,s|=d&H,s|=u&H;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&H,s|=c&H),a<r-2&&(d=this._decodeChar(t.charCodeAt(a+2)),o[i++]=c<<4|d>>>2,s|=d&H),a<r-3&&(u=this._decodeChar(t.charCodeAt(a+3)),o[i++]=d<<6|u,s|=u&H),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=H;return n+=(42-t&t-44)>>>8&-H+t-43+62,n+=(46-t&t-48)>>>8&-H+t-47+63,n+=(47-t&t-58)>>>8&-H+t-48+52,n+=(64-t&t-91)>>>8&-H+t-65+0,n+=(96-t&t-123)>>>8&-H+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})();ce.Coder=Qr;var xt=new Qr;function my(e){return xt.encode(e)}ce.encode=my;function fy(e){return xt.decode(e)}ce.decode=fy;var Vs=(function(e){uy(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=H;return r+=(44-n&n-46)>>>8&-H+n-45+62,r+=(94-n&n-96)>>>8&-H+n-95+63,r+=(47-n&n-58)>>>8&-H+n-48+52,r+=(64-n&n-91)>>>8&-H+n-65+0,r+=(96-n&n-123)>>>8&-H+n-97+26,r},t})(Qr);ce.URLSafeCoder=Vs;var Ws=new Vs;function yy(e){return Ws.encode(e)}ce.encodeURLSafe=yy;function gy(e){return Ws.decode(e)}ce.decodeURLSafe=gy;ce.encodedLength=function(e){return xt.encodedLength(e)};ce.maxDecodedLength=function(e){return xt.maxDecodedLength(e)};ce.decodedLength=function(e){return xt.decodedLength(e)}});var Hs=Vt((Fs,un)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof un=="object"&&typeof un.exports=="object"?un.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Fs,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 w,k,b,v,L,T,I,O,C,V,ze,kt,Bt;S>=64;){for(w=p[0],k=p[1],b=p[2],v=p[3],L=p[4],T=p[5],I=p[6],O=p[7],V=0;V<16;V++)ze=h+V*4,u[V]=(m[ze]&255)<<24|(m[ze+1]&255)<<16|(m[ze+2]&255)<<8|m[ze+3]&255;for(V=16;V<64;V++)C=u[V-2],kt=(C>>>17|C<<15)^(C>>>19|C<<13)^C>>>10,C=u[V-15],Bt=(C>>>7|C<<25)^(C>>>18|C<<14)^C>>>3,u[V]=(kt+u[V-7]|0)+(Bt+u[V-16]|0);for(V=0;V<64;V++)kt=(((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&T^~L&I)|0)+(O+(t[V]+u[V]|0)|0)|0,Bt=((w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10))+(w&k^w&b^k&b)|0,O=I,I=T,T=L,L=v+kt|0,v=b,b=k,k=w,w=kt+Bt|0;p[0]+=w,p[1]+=k,p[2]+=b,p[3]+=v,p[4]+=L,p[5]+=T,p[6]+=I,p[7]+=O,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,w=m<<3,k=m%64<56?64:128;this.buffer[h]=128;for(var b=h+1;b<k-8;b++)this.buffer[b]=0;this.buffer[k-8]=S>>>24&255,this.buffer[k-7]=S>>>16&255,this.buffer[k-6]=S>>>8&255,this.buffer[k-5]=S>>>0&255,this.buffer[k-4]=w>>>24&255,this.buffer[k-3]=w>>>16&255,this.buffer[k-2]=w>>>8&255,this.buffer[k-1]=w>>>0&255,n(this.temp,this.state,this.buffer,0,k),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]),w=a(p,u),k=new o(w),b=new Uint8Array(k.digestLength),v=b.length,L=new Uint8Array(h),T=0;T<h;T++)v===b.length&&(s(b,k,m,S),v=0),L[T]=b[v++];return k.clean(),b.fill(0),S.fill(0),L}e.hkdf=c;function d(u,p,m,h){for(var S=new o(u),w=S.digestLength,k=new Uint8Array(4),b=new Uint8Array(w),v=new Uint8Array(w),L=new Uint8Array(h),T=0;T*w<h;T++){var I=T+1;k[0]=I>>>24&255,k[1]=I>>>16&255,k[2]=I>>>8&255,k[3]=I>>>0&255,S.reset(),S.update(p),S.update(k),S.finish(v);for(var O=0;O<w;O++)b[O]=v[O];for(var O=2;O<=m;O++){S.reset(),S.update(v).finish(v);for(var C=0;C<w;C++)b[C]^=v[C]}for(var O=0;O<w&&T*w+O<h;O++)L[T*w+O]=b[O]}for(var T=0;T<w;T++)b[T]=v[T]=0;for(var T=0;T<4;T++)k[T]=0;return S.clean(),L}e.pbkdf2=d})});var Zr=Vt(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.Webhook=ct.WebhookVerificationError=void 0;var hy=Bs(),Ms=qs(),ky=Hs(),Js=300,Yr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},De=class e extends Yr{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};ct.WebhookVerificationError=De;var mn=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=Ms.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 De("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,hy.timingSafeEqual)(u.encode(h),u.encode(c)))return JSON.parse(t.toString())}throw new De("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,${Ms.encode(ky.hmac(this.key,a))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new De("Invalid Signature Headers");if(n-r>Js)throw new De("Message timestamp too old");if(r>n+Js)throw new De("Message timestamp too new");return new Date(r*1e3)}};ct.Webhook=mn;mn.prefix="whsec_"});import zs from"crypto";function Be({body:e,secret:t}){let n=new Xs.Webhook(t),r=`msg_${zs.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 eo(){return`whsec_${zs.randomBytes(24).toString("base64")}`}var Xs,fn=f(()=>{"use strict";Xs=ei(Zr(),1)});import{z as ye}from"zod";async function Gs({apiUrl:e,budget:t,observer:n,params:r,webhookSecret:o}){let i=wy[t],a=performance.now(),s={lastReason:void 0,pollCount:0};for(;performance.now()-a<i.timeoutMs;){s.pollCount+=1;let l=await Ty({apiUrl:e,observer:n,params:r,webhookSecret:o}),c=Ry({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(vy({backoff:i.backoffMs,pollCount:s.pollCount}),d);await Ny(u)}return{description:`observer "${n}"`,detail:`budget "${t}" exhausted after ${String(s.pollCount)} poll(s) (${Ks(a)}); last: ${s.lastReason??"no retry reason"}
|
|
100
|
+
\u2192 /ripplo:debug \u2014 check .ripplo/debug/<runId>/ artifacts`,status:"failed"}}function Ry({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}
|
|
101
101
|
\u2192 /ripplo:setup \u2014 engine endpoint mounted? webhook secret matches?`,status:"failed"}:t.kind==="pass"?{description:`observer "${e}"`,detail:r.pollCount>1?`passed after ${String(r.pollCount)} polls (${Ks(n)})`:void 0,status:"passed"}:t.kind==="fail"?{description:`observer "${e}"`,detail:`failed (invariant): ${t.reason} (after ${String(r.pollCount)} poll(s)) \u2014 ctx.fail stops polling immediately and is reserved for invariant violations (wrong shape, contradictory/forbidden state). For transient conditions like "not yet committed", "status not yet X", or "row not found", use ctx.retry(reason) so the runtime keeps polling until the budget expires.
|
|
102
|
-
\u2192 /ripplo:create`,status:"failed"}:(r.lastReason=t.reason,null)}async function Ry({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(ky)});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=by.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 Ty({backoff:e,pollCount:t}){let n=Math.min(t-1,e.length-1);return e[n]??1e3}function Ks(e){return`${String(Math.round(performance.now()-e))}ms`}async function vy(e){return new Promise(t=>setTimeout(t,e))}var ky,Sy,wy,by,Qs=f(()=>{"use strict";Y();fn();ky=15e4,Sy={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:5e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},wy=ye.discriminatedUnion("kind",[ye.object({kind:ye.literal("pass")}),ye.object({kind:ye.literal("retry"),reason:ye.string()}),ye.object({kind:ye.literal("fail"),reason:ye.string()})]),by=ye.object({error:ye.string().optional(),outcome:wy.optional(),success:ye.boolean()})});async function no({failFast:e,observerTransport:t,onStep:n,page:r,spec:o,variables:i}){let a=performance.now();return Ly({currentId:o.entryNode,failFast:e,observerTransport:t,onStep:n,page:r,runStartTime:a,spec:o,variables:i})}function Cy({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Ly({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 xy({node:u,nodeId:p,observerTransport:n,page:o,runStartTime:i,variables:c});if(Cy({onStep:r,steps:[h],target:l}),c=h.variables,t&&h.status==="failed")break;d=u.next}return{steps:l,variables:c}}async function xy({node:e,nodeId:t,observerTransport:n,page:r,runStartTime:o,variables:i}){let a=performance.now(),s=e.label??`${e.type} (${e.id})`,l=Ny,c=Jt({node:e,page:r});try{let d=await Py({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 Z({label:`Snapshot [${s}]`,fn:()=>_e({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 Z({label:`Snapshot [${s}] (error)`,fn:()=>_e({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 Py({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(Ey(e)){let a=await nr({node:e,page:n,timeout:r,variables:o});return{assertions:[],variables:a.variables}}return{assertions:await Iy({node:e,observerTransport:t,page:n,timeout:r,variables:o}),variables:o}}function Ey(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 Oy(e){return e.type.startsWith("assert")}async function Iy({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(!Oy(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 Uy({assertNode:i,page:n,timeout:r,variables:o});case"assertText":{let a=ne({ref:i.expected,variables:o});return[await Nr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertUrl":{let a=ne({ref:i.expected,variables:o});return[Yt({expected:a,operator:i.operator,url:n.url()})]}case"assertTitle":{let a=ne({ref:i.expected,variables:o});return[Yt({expected:a,operator:i.operator,url:await n.title()})]}case"assertCount":{let a=tr({ref:i.expected,variables:o});return[await Cr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator})]}case"assertValue":{let a=ne({ref:i.expected,variables:o});return[await Lr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertAttribute":{let a=ne({ref:i.expected,variables:o});return[await ms({attribute:i.attribute,expected:a,locator:F({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]=ne({ref:l,variables:o})}),[await Gs({apiUrl:t.apiUrl,budget:i.budget,observer:i.observer,params:a,webhookSecret:t.webhookSecret})]}}}async function Uy({assertNode:e,page:t,timeout:n,variables:r}){let o=_y[e.type];return[await o({locator:F({locator:e.locator,page:t,variables:r}),timeout:n})]}var Ny,_y,ro=f(()=>{"use strict";rr();Qs();Er();at();Y();st();Tt();Ie();Ny=1e4;_y={assertChecked:gs,assertDisabled:ys,assertEnabled:fs,assertFocused:ks,assertNotChecked:hs,assertNotFocused:Ss,assertNotVisible:Pr,assertVisible:xr}});async function oo({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=vt(c),u=[];function p(v){i?.(v),u.push(Gt({context:l,page:c,runId:a,stepIndex:v.stepIndex,stepResult:v}))}let m=jy(r,s.variableNamespaces),h={...At({defs:s.variables}),...m};A.info("Starting graph execution (entry: %s)",s.entryNode);let S=await no({failFast:!0,observerTransport:o,onStep:p,page:c,spec:s,variables:h});await Promise.allSettled(u);let w=S.steps.filter(v=>v.status==="passed").length,k=S.steps.filter(v=>v.status==="failed").length,b={duration:S.steps.reduce((v,L)=>v+L.duration,0),failCount:k,passCount:w,runId:a,status:k>0?"failed":"passed",workflowName:""};return await Kt({monitor:d,runId:a,steps:S.steps,summary:b}),await l.close(),S.steps}function jy(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 io=f(()=>{"use strict";mr();Qt();ro();Y();Ie()});import{parseSetCookie as $y}from"set-cookie-parser";import{z as de}from"zod";async function ao({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:Zs({apiUrl:i,preconditionNames:a,webhookSecret:t})}async function so({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",...qy({cookies:t}),...Be({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(Ys)});a.ok||A.error("Teardown returned %s",String(a.status))}catch{A.error("Teardown request failed")}}async function Zs({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(Ys)});if(!i.ok){let c=await Vy(i);throw new Error(`execute-preconditions returned ${String(i.status)}: ${c}`)}let a=await i.json(),s=Dy.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=Fy({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 Vy(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=Wy(t),r=n==null?null:By.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function Wy(e){try{return JSON.parse(e)}catch{return null}}function qy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Fy({domain:e,res:t}){let n=t.headers.getSetCookie();return $y(n,{decodeValues:!1}).map(o=>Hy({cookie:o,domain:e}))}function Hy({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=Jy({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 Jy({raw:e}){return My[e.toLowerCase()]??"Lax"}async function lo({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:[]}:Zs({apiUrl:r,preconditionNames:t,webhookSecret:n})}var Ys,Dy,By,My,co=f(()=>{"use strict";Y();fn();Ys=3e4,Dy=de.object({data:de.record(de.string(),de.record(de.string(),de.string())),error:de.string().optional(),executed:de.array(de.string()),runId:de.string(),success:de.boolean()});By=de.object({error:de.string()});My={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as po}from"gql.tada";async function uo({agentProfileId:e,config:t,runId:n}){let r=await $({config:t,document:Xy,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=zy({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 Z({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let p=d.filter(w=>w.status==="passed").length,m=d.filter(w=>w.status==="failed").length,h=d.reduce((w,k)=>w+k.duration,0),S=c??(m>0?"failed":"passed");await Z({label:"completeRun",fn:()=>$({config:t,document:Ky,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 zy({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 $({config:e,document:Gy,variables:{runResultId:t,steps:r}})}var Xy,Gy,Ky,mo=f(()=>{"use strict";Lt();Y();st();Xy=po(`
|
|
102
|
+
\u2192 /ripplo:create`,status:"failed"}:(r.lastReason=t.reason,null)}async function Ty({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(Sy)});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=Ay.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 vy({backoff:e,pollCount:t}){let n=Math.min(t-1,e.length-1);return e[n]??1e3}function Ks(e){return`${String(Math.round(performance.now()-e))}ms`}async function Ny(e){return new Promise(t=>setTimeout(t,e))}var Sy,wy,by,Ay,Qs=f(()=>{"use strict";Y();fn();Sy=15e4,wy={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:5e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},by=ye.discriminatedUnion("kind",[ye.object({kind:ye.literal("pass")}),ye.object({kind:ye.literal("retry"),reason:ye.string()}),ye.object({kind:ye.literal("fail"),reason:ye.string()})]),Ay=ye.object({error:ye.string().optional(),outcome:by.optional(),success:ye.boolean()})});async function to({failFast:e,observerTransport:t,onStep:n,page:r,spec:o,variables:i}){let a=performance.now();return xy({currentId:o.entryNode,failFast:e,observerTransport:t,onStep:n,page:r,runStartTime:a,spec:o,variables:i})}function Ly({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function xy({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 Py({node:u,nodeId:p,observerTransport:n,page:o,runStartTime:i,variables:c});if(Ly({onStep:r,steps:[h],target:l}),c=h.variables,t&&h.status==="failed")break;d=u.next}return{steps:l,variables:c}}async function Py({node:e,nodeId:t,observerTransport:n,page:r,runStartTime:o,variables:i}){let a=performance.now(),s=e.label??`${e.type} (${e.id})`,l=Cy,c=Jt({node:e,page:r});try{let d=await Ey({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 Z({label:`Snapshot [${s}]`,fn:()=>_e({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 Z({label:`Snapshot [${s}] (error)`,fn:()=>_e({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 Ey({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(Oy(e)){let a=await tr({node:e,page:n,timeout:r,variables:o});return{assertions:[],variables:a.variables}}return{assertions:await _y({node:e,observerTransport:t,page:n,timeout:r,variables:o}),variables:o}}function Oy(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 Iy(e){return e.type.startsWith("assert")}async function _y({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(!Iy(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 jy({assertNode:i,page:n,timeout:r,variables:o});case"assertText":{let a=ne({ref:i.expected,variables:o});return[await vr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertUrl":{let a=ne({ref:i.expected,variables:o});return[Yt({expected:a,operator:i.operator,url:n.url()})]}case"assertTitle":{let a=ne({ref:i.expected,variables:o});return[Yt({expected:a,operator:i.operator,url:await n.title()})]}case"assertCount":{let a=er({ref:i.expected,variables:o});return[await Nr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator})]}case"assertValue":{let a=ne({ref:i.expected,variables:o});return[await Cr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertAttribute":{let a=ne({ref:i.expected,variables:o});return[await ms({attribute:i.attribute,expected:a,locator:F({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]=ne({ref:l,variables:o})}),[await Gs({apiUrl:t.apiUrl,budget:i.budget,observer:i.observer,params:a,webhookSecret:t.webhookSecret})]}}}async function jy({assertNode:e,page:t,timeout:n,variables:r}){let o=Uy[e.type];return[await o({locator:F({locator:e.locator,page:t,variables:r}),timeout:n})]}var Cy,Uy,no=f(()=>{"use strict";nr();Qs();Pr();at();Y();st();Tt();Ie();Cy=1e4;Uy={assertChecked:gs,assertDisabled:ys,assertEnabled:fs,assertFocused:ks,assertNotChecked:hs,assertNotFocused:Ss,assertNotVisible:xr,assertVisible:Lr}});async function ro({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=vt(c),u=[];function p(v){i?.(v),u.push(Gt({context:l,page:c,runId:a,stepIndex:v.stepIndex,stepResult:v}))}let m=$y(r,s.variableNamespaces),h={...At({defs:s.variables}),...m};A.info("Starting graph execution (entry: %s)",s.entryNode);let S=await to({failFast:!0,observerTransport:o,onStep:p,page:c,spec:s,variables:h});await Promise.allSettled(u);let w=S.steps.filter(v=>v.status==="passed").length,k=S.steps.filter(v=>v.status==="failed").length,b={duration:S.steps.reduce((v,L)=>v+L.duration,0),failCount:k,passCount:w,runId:a,status:k>0?"failed":"passed",workflowName:""};return await Kt({monitor:d,runId:a,steps:S.steps,summary:b}),await l.close(),S.steps}function $y(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 oo=f(()=>{"use strict";ur();Qt();no();Y();Ie()});import{parseSetCookie as Dy}from"set-cookie-parser";import{z as de}from"zod";async function io({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:Zs({apiUrl:i,preconditionNames:a,webhookSecret:t})}async function ao({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",...Fy({cookies:t}),...Be({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(Ys)});a.ok||A.error("Teardown returned %s",String(a.status))}catch{A.error("Teardown request failed")}}async function Zs({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(Ys)});if(!i.ok){let c=await Wy(i);throw new Error(`execute-preconditions returned ${String(i.status)}: ${c}`)}let a=await i.json(),s=By.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=Hy({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 Wy(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=qy(t),r=n==null?null:Vy.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function qy(e){try{return JSON.parse(e)}catch{return null}}function Fy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function Hy({domain:e,res:t}){let n=t.headers.getSetCookie();return Dy(n,{decodeValues:!1}).map(o=>My({cookie:o,domain:e}))}function My({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=zy({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 zy({raw:e}){return Jy[e.toLowerCase()]??"Lax"}async function so({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:[]}:Zs({apiUrl:r,preconditionNames:t,webhookSecret:n})}var Ys,By,Vy,Jy,lo=f(()=>{"use strict";Y();fn();Ys=3e4,By=de.object({data:de.record(de.string(),de.record(de.string(),de.string())),error:de.string().optional(),executed:de.array(de.string()),runId:de.string(),success:de.boolean()});Vy=de.object({error:de.string()});Jy={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as co}from"gql.tada";async function po({agentProfileId:e,config:t,runId:n}){let r=await $({config:t,document:Gy,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=Xy({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 Z({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let p=d.filter(w=>w.status==="passed").length,m=d.filter(w=>w.status==="failed").length,h=d.reduce((w,k)=>w+k.duration,0),S=c??(m>0?"failed":"passed");await Z({label:"completeRun",fn:()=>$({config:t,document:Qy,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 Xy({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 $({config:e,document:Ky,variables:{runResultId:t,steps:r}})}var Gy,Ky,Qy,uo=f(()=>{"use strict";Lt();Y();st();Gy=co(`
|
|
103
103
|
mutation StartRunCLI($runId: String!, $platform: String!, $agentProfileId: String) {
|
|
104
104
|
startRun(runId: $runId, platform: $platform, agentProfileId: $agentProfileId) {
|
|
105
105
|
id
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
`),
|
|
108
|
+
`),Ky=co(`
|
|
109
109
|
mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
|
|
110
110
|
submitRunSteps(runResultId: $runResultId, steps: $steps)
|
|
111
111
|
}
|
|
112
|
-
`),
|
|
112
|
+
`),Qy=co(`
|
|
113
113
|
mutation CompleteRunCLI(
|
|
114
114
|
$runResultId: String!
|
|
115
115
|
$status: String!
|
|
@@ -132,7 +132,7 @@ ${n}`].join(`
|
|
|
132
132
|
status
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
`)});import{z as Te}from"zod";import{graphql as hn,readFragment as yn}from"gql.tada";async function
|
|
135
|
+
`)});import{z as Te}from"zod";import{graphql as hn,readFragment as yn}from"gql.tada";async function mo({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=tg({externalBrowser:r,headed:i});let h=a==null?void 0:Z({label:"Preconditions resolved",fn:()=>so({engineBaseUrl:o.engineUrl,preconditionNames:a,webhookSecret:l})}),[{project:S,workflow:w},k]=await Promise.all([Z({label:"Run context resolved",fn:()=>lg({config:o,workflowId:c})}),Z({label:"Streaming run started",fn:()=>po({agentProfileId:t,config:o,runId:s})}),Ir({appUrl:n})]);d=w.name,u=k;let b=dg(w.spec);A.info("Executing workflow: %s",w.name),await mg(rg({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:w}),ug())}catch(h){throw await ng({browserPromise:p,error:h,ownsBrowser:m,runId:s,streaming:u,workflowName:d}),h}}function tg({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):Z({label:"Browser launched",fn:()=>Ue({headed:t})})}async function ng({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 us({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 rg({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??Z({label:"Preconditions resolved",fn:()=>io({project:ag(l),webhookSecret:p,workflowSlug:m.slug})}),[S,w]=await Promise.all([h,r]);if(t!=null){a&&await w.close(),await og({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:i,preconditionResult:S,runId:c,specData:d,streaming:u,webhookSecret:p,workflow:m});return}await sg({baseUrl:n,browser:w,preconditionResult:S,runId:c,specData:d,streaming:u,webhookSecret:p})}async function og({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 cg({config:r,profileId:t});await Rr({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 tl({preconditionResult:i,webhookSecret:c})}function ag(e){let t=(e.workflows??[]).map(n=>{let r=yn(gn,n);return ig.parse(r)});return{engineBaseUrl:e.engineBaseUrl,workflows:t}}async function sg({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:i,webhookSecret:a}){let s=await Z({label:"Spec executed",fn:()=>ro({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 tl({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 tl({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await ao({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function lg({config:e,workflowId:t}){let n=await $({config:e,document:Zy,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...yn(el,n.project),...e.engineUrl.length>0?{engineBaseUrl:e.engineUrl}:{}},a=(o.workflows??[]).find(l=>yn(gn,l).id===t);if(a==null)throw new Error(`Workflow ${t} not found`);let s=yn(gn,a);return{project:o,workflow:s}}async function cg({config:e,profileId:t}){let n=await $({config:e,document:eg,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),Sr({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function dg(e){if(e==null)throw new Error("Workflow has no spec");return Gr.decode(e)}function ug(){return pg.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function mg(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 Yy,gn,el,Zy,eg,ig,pg,nl=f(()=>{"use strict";$s();wr();Tr();Nt();_r();Lt();Qt();oo();Y();st();lo();uo();Yy=12e4,gn=hn(`
|
|
136
136
|
fragment WorkflowRun on Workflow {
|
|
137
137
|
id
|
|
138
138
|
slug
|
|
@@ -153,13 +153,13 @@ ${n}`].join(`
|
|
|
153
153
|
...WorkflowRun
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
`,[gn]),
|
|
156
|
+
`,[gn]),Zy=hn(`
|
|
157
157
|
query ProjectRun($projectId: String!) {
|
|
158
158
|
project(id: $projectId) {
|
|
159
159
|
...ProjectRun
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
`,[el]),
|
|
162
|
+
`,[el]),eg=hn(`
|
|
163
163
|
query AgentProfileRun($id: String!) {
|
|
164
164
|
agentProfile(id: $id) {
|
|
165
165
|
id
|
|
@@ -169,13 +169,13 @@ ${n}`].join(`
|
|
|
169
169
|
successCriteria
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
`);
|
|
172
|
+
`);ig=Te.object({preconditions:Te.array(Te.string()),requiresKeys:Te.array(Te.object({namespace:Te.string(),preconditionName:Te.string()})),slug:Te.string()});pg=Te.coerce.number().int().positive().catch(Yy)});var G=f(()=>{"use strict";nr();kr();wr();Tr();Pr();Nt();bs();vs();_r();Lt();Ns();$r();nl();oo();no();at();Y();st();lo();fn();Tt();uo();Ie()});import fg from"fs";import yg from"path";async function rl(e){let t=yg.join(e,".ripplo","index.ts");if(!fg.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 _(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 fo(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 ol({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 il=f(()=>{"use strict";Q()});import Pt from"fs";import al from"path";import{chromium as gg}from"playwright";function sl(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 kn(e){let t=await Sg(e),n=wg(e),r=bg(),o=await _(e),i=Ag(o),a=vg(o),s=await hg(e,o),l=kg(e),c=await Ng(t,o);return[t,n,...c,i,a,s,l,r]}async function hg(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await qt({cwd:e});return{status:Ft({compiled:t.result,existing:n}),type:"lockfile"}}function kg(e){let t=al.join(e,".git","hooks","pre-commit");return Pt.existsSync(t)?{installed:Pt.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Sg(e){let t=await rl(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 wg(e){let t=al.join(e,".ripplo",".local","token");return Pt.existsSync(t)?{exists:Pt.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function bg(){let e=gg.executablePath();return{installed:Pt.existsSync(e),type:"browser"}}function Ag(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=Rg(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function Rg(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}`})})}),Tg(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function Tg(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 vg(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 Ng(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await fo(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await Cg(n,t);return r.push(...i),r}async function Cg(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=Pg(e.appUrl,e.engineUrl);if(i==null)return[o];let a=await fo(i)==null,s=[];if(s.push({configured:!0,count:n,endpointReachable:a,type:"preconditions"}),ll(e.engineUrl)&&s.push({reachable:a,type:"engine-endpoint",url:i}),!a)return s;let l=await ol({appUrl:e.appUrl,engineUrl:e.engineUrl});s.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await Lg({engineUrl:i,webhookSecret:e.webhookSecret});return s.push({status:c,type:"adapter-enabled",url:i}),s}async function Lg({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 xg(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 ll(e){return e.startsWith("http://")||e.startsWith("https://")}function Pg(e,t){return ll(t)?t:`${e}${t}`}function cl(e){switch(e.type){case"settings":return Ig(e);case"token":return _g(e);case"dev-server":return Ug(e);case"preconditions":return Dg(e);case"webhook-verification":return jg(e);case"preconditions-validation":return Bg(e);case"workflows":return Vg(e);case"browser":return $g(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 xg(e);case"lockfile":return Eg(e);case"pre-commit-hook":return Og(e)}}function Eg(e){switch(e.status){case"match":return`\u2713 Lockfile: ${we} is up to date`;case"missing":return`\u2717 Lockfile: ${we} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${we} is out of date \u2014 run \`ripplo compile\` and commit it`}}function Og(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 Ig(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function _g(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Ug(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 jg(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 $g(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function Dg(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 Bg(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"}
|
|
173
173
|
${t.join(`
|
|
174
|
-
`)}`}function
|
|
174
|
+
`)}`}function Vg(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=>Wg(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
175
175
|
${t.join(`
|
|
176
|
-
`)}`}function
|
|
176
|
+
`)}`}function Wg(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
|
|
177
177
|
`+t.join(`
|
|
178
|
-
`)}var
|
|
178
|
+
`)}var yo=f(()=>{"use strict";G();Oe();il();Q()});import{z as fl}from"zod";function Ve(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return Ot().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return Ot().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return Ot().RIPPLO_SERVER_URL;let r=nh[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function Ot(){return yl??=rh.parse(process.env),yl}var Zg,eh,th,nh,rh,yl,dt=f(()=>{"use strict";Zg="https://ripplo.ai",eh="https://ripplo-dev.up.railway.app",th="https://localhost:3001",nh={dev:eh,local:th};rh=fl.object({RIPPLO_SERVER_URL:fl.string().min(1).default(Zg)})});import _t from"fs";function Ol(e){return be(e,Fh)}function Il(e){let t=Ol(e);if(!_t.existsSync(t))return!1;let n=_t.statSync(t);return Date.now()-n.mtimeMs<=Mh}function El(e){Xe(e);let t=Ol(e),n=new Date;_t.existsSync(t)?_t.utimesSync(t,n,n):_t.writeFileSync(t,"")}function _l(e){El(e);let t=setInterval(()=>{El(e)},Hh);return()=>{clearInterval(t)}}var Fh,Hh,Mh,bo=f(()=>{"use strict";G();Fh="cli-heartbeat",Hh=2e3,Mh=1e4});var Xl={};Zo(Xl,{redirectStdioToFile:()=>Sk});import Tn from"fs";import kk from"path";function Sk(e){Tn.mkdirSync(kk.dirname(e),{recursive:!0});let t=Tn.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);Tn.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,Tn.closeSync(t))}}var Gl=f(()=>{"use strict"});import Kl from"crypto";import To from"fs";import Ql from"path";import{watch as wk}from"chokidar";import{graphql as bk}from"gql.tada";async function Yl(e){return vk(e)}function vo({config:e,cwd:t,devSessionId:n,lastHash:r,onSyncError:o,onSyncSuccess:i}){let a=Ql.join(t,Ak),s=r,l=n,c="",d,u=!1,p=!1,m=wk(a,{depth:2,ignoreInitial:!0,persistent:!0});m.on("all",(k,b)=>{if(b.endsWith(".ts")){if(u){p=!0;return}d!=null&&clearTimeout(d),d=setTimeout(()=>{S()},200)}}),m.on("error",k=>{let b=k instanceof Error?k.message:String(k);A.error("File watcher error: %s",b)});function h(){p=!1,d=setTimeout(()=>{S()},200)}async function S(){u=!0,p=!1;try{await w()}catch(k){let b=k instanceof Error?k.message:"Unknown error";A.error("Sync failed: %s",b),o(b)}finally{u=!1,p&&h()}}async function w(){let k=Tk(a);if(k===c)return;let b=await _(t);if(!b.ok){o(b.error);return}await me({cwd:t,result:b.result});let v={...b.result.config,ripploServerUrl:e.ripploServerUrl,token:e.token},L=ec(b.result),T=tc(L);if(T===s){c=k,i({config:v,devSessionId:l,hash:T});return}let I=await nc({config:v,payload:L});c=k,s=T,l=I.devSessionId,A.info("Dev session synced (%d test(s))",b.result.tests.length),i({config:v,devSessionId:I.devSessionId,hash:I.hash})}return function(){d!=null&&clearTimeout(d),m.close()}}function Tk(e){let t=Kl.createHash("sha256");return Zl(t,e),t.digest("hex")}function Zl(e,t){if(!To.existsSync(t))return;To.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=Ql.join(t,r.name);r.isDirectory()?Zl(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(To.readFileSync(o)))})}function ec(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 tc(e){return Kl.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function vk(e){let t=await _(e.cwd);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n={...t.result.config,ripploServerUrl:e.config.ripploServerUrl,token:e.config.token},r=ec(t.result);return A.info("Synced %d test(s) + graph to dev session",t.result.tests.length),{...await nc({config:n,payload:r}),config:n}}async function nc({config:e,payload:t}){let n=tc(t),r=await $({config:e,document:Rk,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 rc(e){return!1}function oc(e){return!1}var Ak,Rk,No=f(()=>{"use strict";Oe();G();Q();Ak=".ripplo",Rk=bk(`
|
|
179
179
|
mutation SyncDevSession(
|
|
180
180
|
$projectId: String!
|
|
181
181
|
$preconditions: [SyncDevPreconditionInput!]!
|
|
@@ -185,7 +185,7 @@ ${t.join(`
|
|
|
185
185
|
id
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
`)});import{useCallback as
|
|
188
|
+
`)});import{useCallback as Nk,useEffect as vn,useRef as Ck,useState as Lk}from"react";import{availableParallelism as ic}from"os";import{useSubscription as Co}from"urql";import{graphql as Cn}from"gql.tada";async function ac(){await(await Nn).closeAll()}function sc({config:e,cwd:t,devSessionId:n}){let[r,o]=Lk({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:ic()}),i=e,a=Ck(new Set);vn(()=>{Nn.then(()=>{o(l=>({...l,browsersReady:!0}))})},[]);let s=Nk(l=>{lc({activeRunIds:a.current,baseUrl:i.appUrl,config:i,setState:o,...l})},[i]);return vn(()=>{n!=null&&o(l=>({...l,connected:!0}))},[n]),Co({pause:n==null,query:xk},(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}),Co({pause:n==null,query:Ek,variables:{projectId:i.projectId}},(l,c)=>{let d=c.devWorkflowDeleteRequested?.slug;return d!=null&&rc({cwd:t,slug:d}),c}),Co({pause:n==null,query:Ok,variables:{projectId:i.projectId}},(l,c)=>{let d=c.devWorkflowDuplicateRequested;return d!=null&&oc({cwd:t,newSlug:d.newSlug,sourceSlug:d.sourceSlug}),c}),vn(()=>{if(n==null)return;let l=new AbortController;return _k({activeConfig:i,activeRunIds:a.current,devSessionId:n,setState:o,signal:l.signal}),()=>{l.abort()}},[i,n]),vn(()=>()=>{Nn.then(l=>l.closeAll())},[]),r}function lc({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}))}Uk({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,workflowId:l,workflowSlug:c}).finally(d)}async function _k({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(i=>{let a=setTimeout(i,Ik);o.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})}),o.aborted)return;try{(await $({config:e,document:Pk,variables:{devSessionId:n}})).pendingDevRuns?.filter(a=>!t.has(a.id)).forEach(a=>{let s=a.workflow?.id;s!=null&&lc({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 Uk({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:i,workflowId:a,workflowSlug:s}){let l=await Nn,c=await l.acquire();try{await Or({maxRuns:100});let d=o!=null&&s!=null?await jk({cwd:o,workflowSlug:s}):void 0;await mo({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 jk({cwd:e,workflowSlug:t}){let n=await _(e);if(!n.ok)return;let r=n.result.tests.find(o=>o.slug===t);if(r!=null)return r.preconditions}var xk,Pk,Ek,Ok,Nn,Ik,Lo=f(()=>{"use strict";G();Q();No();xk=Cn(`
|
|
189
189
|
subscription RunRequestedDashboard {
|
|
190
190
|
runRequested {
|
|
191
191
|
agentProfileDescription
|
|
@@ -196,7 +196,7 @@ ${t.join(`
|
|
|
196
196
|
workflowSlug
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`),
|
|
199
|
+
`),Pk=Cn(`
|
|
200
200
|
query PendingDevRunsDashboard($devSessionId: String!) {
|
|
201
201
|
pendingDevRuns(devSessionId: $devSessionId) {
|
|
202
202
|
id
|
|
@@ -209,14 +209,14 @@ ${t.join(`
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
`),
|
|
212
|
+
`),Ek=Cn(`
|
|
213
213
|
subscription DevWorkflowDeleteDashboard($projectId: String!) {
|
|
214
214
|
devWorkflowDeleteRequested(projectId: $projectId) {
|
|
215
215
|
projectId
|
|
216
216
|
slug
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
`),
|
|
219
|
+
`),Ok=Cn(`
|
|
220
220
|
subscription DevWorkflowDuplicateDashboard($projectId: String!) {
|
|
221
221
|
devWorkflowDuplicateRequested(projectId: $projectId) {
|
|
222
222
|
projectId
|
|
@@ -224,7 +224,7 @@ ${t.join(`
|
|
|
224
224
|
newSlug
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
`),Cn=Or({headed:!1,size:ac()});Ok=5e3});import{initGraphQLTada as jk}from"gql.tada";import{readFragment as TE}from"gql.tada";var Po,dc=f(()=>{"use strict";Po=jk()});var Eo,Oo=f(()=>{"use strict";Eo={__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:"workflowDiff",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"DevSessionWorkflowDiff",ofType:null}},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:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionWorkflowDiff",fields:[{name:"added",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"modified",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"removed",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},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 W(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function pe(e,t,n){e.invalidate({__typename:t,id:n})}function Dk({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 Io({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 Bk(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Io({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||pe(e,"RunResult",r)}function _o(e){return e==="completed"||e==="failed"}function Vk(e,t){if(t.runId==null)return;let n=_o(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(pc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function uc(e,t){e.invalidate({__typename:"Run",id:t},"results")}function Wk(e,t){e.workflowId==null||e.runId==null||Io({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function qk(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;Vk(t,e),_o(e.status)&&e.runId!=null&&uc(t,e.runId),n&&(W(t,"run"),Fk(t,e)),Wk(e,t)}function Fk(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){W(e,"projectRuns");return}Dk({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)}}),W(e,"projectRuns")}function Hk(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 Jk(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(Mk,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function zk(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&Hk(n,t.projectId,r)},cancelAllPendingRuns(e,t,n){W(n,"workflows"),W(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&pe(n,"Run",r)},cloneAgentTemplate(e,t,n){W(n,"agentProfiles")},createAgentProfile(e,t,n){W(n,"agentProfiles")},createRun(e,t,n){W(n,"run"),W(n,"runs"),W(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(pc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Io({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&pe(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&pe(n,"Workflow",r),W(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&pe(n,"Project",r),W(n,"projects")},duplicateDevWorkflow(e,t,n){W(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&pe(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&pe(n,"ScopeItem",r)},removeScopeItem(e,t,n){pe(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){W(n,"runs"),W(n,"projectRuns")},setHooksPaused(e,t,n){Jk(n,t.paused)},setOverageCap(e,t,n){W(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&pe(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&pe(n,"User",r),W(n,"currentUser")}}}function Uo(){return{keys:$k,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:Eo,updates:{Mutation:zk(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&pe(n,"Project",r.projectId),r?.active===!1&&(W(n,"workflows"),W(n,"workflow"),W(n,"runs"),W(n,"run"),W(n,"projectRuns"))},devSessionSynced(e,t,n){W(n,"workflow"),W(n,"workflows");let r=e.devSessionSynced?.devSession?.id;r!=null&&n.invalidate({__typename:"DevSession",id:r},"workflowDiff")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&qk(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&Bk(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&pe(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&_o(r.run.status)&&uc(n,r.run.id)}}}}}var $k,pc,Mk,mc=f(()=>{"use strict";dc();Oo();$k={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,DevSessionWorkflowDiff:()=>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};pc=Po(`
|
|
227
|
+
`),Nn=Er({headed:!1,size:ic()});Ik=5e3});import{initGraphQLTada as $k}from"gql.tada";import{readFragment as NE}from"gql.tada";var xo,cc=f(()=>{"use strict";xo=$k()});var Po,Eo=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:"workflowDiff",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"DevSessionWorkflowDiff",ofType:null}},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:"devSession",type:{kind:"OBJECT",name:"DevSession",ofType:null},args:[]},{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"DevSessionWorkflowDiff",fields:[{name:"added",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"modified",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},args:[]},{name:"removed",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}}},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 W(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function pe(e,t,n){e.invalidate({__typename:t,id:n})}function Bk({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 Oo({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 Vk(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;Oo({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||pe(e,"RunResult",r)}function Io(e){return e==="completed"||e==="failed"}function Wk(e,t){if(t.runId==null)return;let n=Io(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(dc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function pc(e,t){e.invalidate({__typename:"Run",id:t},"results")}function qk(e,t){e.workflowId==null||e.runId==null||Oo({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function Fk(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;Wk(t,e),Io(e.status)&&e.runId!=null&&pc(t,e.runId),n&&(W(t,"run"),Hk(t,e)),qk(e,t)}function Hk(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){W(e,"projectRuns");return}Bk({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)}}),W(e,"projectRuns")}function Mk(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 zk(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(Jk,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function Xk(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&Mk(n,t.projectId,r)},cancelAllPendingRuns(e,t,n){W(n,"workflows"),W(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&pe(n,"Run",r)},cloneAgentTemplate(e,t,n){W(n,"agentProfiles")},createAgentProfile(e,t,n){W(n,"agentProfiles")},createRun(e,t,n){W(n,"run"),W(n,"runs"),W(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(dc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),Oo({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&pe(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&pe(n,"Workflow",r),W(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&pe(n,"Project",r),W(n,"projects")},duplicateDevWorkflow(e,t,n){W(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&pe(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&pe(n,"ScopeItem",r)},removeScopeItem(e,t,n){pe(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){W(n,"runs"),W(n,"projectRuns")},setHooksPaused(e,t,n){zk(n,t.paused)},setOverageCap(e,t,n){W(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&pe(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&pe(n,"User",r),W(n,"currentUser")}}}function _o(){return{keys:Dk,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:Xk(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&pe(n,"Project",r.projectId),r?.active===!1&&(W(n,"workflows"),W(n,"workflow"),W(n,"runs"),W(n,"run"),W(n,"projectRuns"))},devSessionSynced(e,t,n){W(n,"workflow"),W(n,"workflows");let r=e.devSessionSynced?.devSession?.id;r!=null&&n.invalidate({__typename:"DevSession",id:r},"workflowDiff")},projectRunStatusChanged(e,t,n){let r=e.projectRunStatusChanged;r!=null&&Fk(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&Vk(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&pe(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&Io(r.run.status)&&pc(n,r.run.id)}}}}}var Dk,dc,Jk,uc=f(()=>{"use strict";cc();Eo();Dk={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,DevSessionWorkflowDiff:()=>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};dc=xo(`
|
|
228
228
|
fragment RunCache on Run {
|
|
229
229
|
id
|
|
230
230
|
status
|
|
@@ -234,12 +234,12 @@ ${t.join(`
|
|
|
234
234
|
id
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
`);
|
|
237
|
+
`);Jk=xo(`
|
|
238
238
|
fragment HooksPausedPatch on DevSession {
|
|
239
239
|
id
|
|
240
240
|
hooksPaused
|
|
241
241
|
}
|
|
242
|
-
`)});var
|
|
242
|
+
`)});var mc=f(()=>{"use strict";uc();Eo()});import{Client as Gk,fetchExchange as Kk,subscriptionExchange as Qk}from"urql";import{cacheExchange as Yk}from"@urql/exchange-graphcache";import{createClient as Zk}from"graphql-sse";function fc({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=Zk({headers:n,retryAttempts:1/0,url:t});return new Gk({exchanges:[Yk(_o()),Qk({forwardSubscription:o=>({subscribe:i=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},i)}})}),Kk],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var yc=f(()=>{"use strict";mc()});import{Box as gc,Text as q,useInput as eS}from"ink";import{jsx as K,jsxs as Le}from"react/jsx-runtime";function hc({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return eS((o,i)=>{i.return&&!n&&r()}),t!=null?Le(gc,{flexDirection:"column",gap:1,children:[Le(q,{children:[K(q,{color:"red",children:" \u2717 "}),K(q,{children:t})]}),Le(q,{children:[K(q,{color:"cyan",children:" \u2192 "}),K(q,{children:"Press "}),K(q,{bold:!0,children:"Enter"}),K(q,{children:" to try again"})]})]}):e!=null?Le(gc,{flexDirection:"column",gap:1,paddingLeft:2,children:[Le(q,{children:[K(q,{color:"yellow",children:"* "}),K(q,{children:"Your code: "}),K(q,{bold:!0,color:"white",children:e.userCode})]}),Le(q,{children:[K(q,{color:"yellow",children:"* "}),K(q,{children:"Waiting for browser authorization..."})]}),Le(q,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?Le(q,{children:[K(q,{color:"yellow",children:" * "}),K(q,{children:"Opening browser..."})]}):Le(q,{children:[K(q,{color:"cyan",children:" \u2192 "}),K(q,{children:"Press "}),K(q,{bold:!0,children:"Enter"}),K(q,{children:" to open browser for authentication"})]})}var kc=f(()=>{"use strict"});import{useState as tS}from"react";import{Box as nS,Text as Ln,useInput as rS}from"ink";import{jsx as xn,jsxs as oS}from"react/jsx-runtime";function Sc({items:e,onSelect:t}){let[n,r]=tS(0);return rS((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)}}),xn(nS,{flexDirection:"column",children:e.map((o,i)=>oS(Ln,{children:[i===n?xn(Ln,{color:"cyan",children:"> "}):xn(Ln,{children:" "}),xn(Ln,{bold:i===n,children:o.label})]},o.value))})}var wc=f(()=>{"use strict"});import{Box as iS,Text as We,useInput as aS}from"ink";import{jsx as mt,jsxs as Uo}from"react/jsx-runtime";function bc({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return aS((r,o)=>{o.return&&e()}),Uo(iS,{flexDirection:"column",children:[Uo(We,{children:[mt(We,{color:"cyan",children:" \u2192 "}),mt(We,{children:"No projects found. Create one at: "}),mt(We,{bold:!0,color:"cyan",children:n})]}),Uo(We,{children:[" ",mt(We,{dimColor:!0,children:"Press "}),mt(We,{bold:!0,children:"Enter"}),mt(We,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var Ac=f(()=>{"use strict"});import{useEffect as sS,useMemo as lS,useRef as cS}from"react";import{Box as Rc,Text as Ke}from"ink";import{useQuery as dS}from"urql";import{graphql as pS}from"gql.tada";import{jsx as Qe,jsxs as Pn}from"react/jsx-runtime";function Tc({selectProject:e,serverUrl:t}){let[n,r]=dS({query:uS}),o=cS(!1),i=lS(()=>n.data?.projects??[],[n.data?.projects]);if(sS(()=>{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 Pn(Ke,{children:[Qe(Ke,{color:"yellow",children:" * "}),Qe(Ke,{children:"Loading projects..."})]});if(n.error!=null)return Pn(Ke,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(i.length===0)return Qe(bc,{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 Pn(Rc,{flexDirection:"column",children:[Pn(Ke,{children:[Qe(Ke,{color:"cyan",children:" \u2192 "}),Qe(Ke,{children:"Select a project:"})]}),Qe(Rc,{marginLeft:4,marginTop:1,children:Qe(Sc,{items:a,onSelect:s})})]})}var uS,vc=f(()=>{"use strict";wc();Ac();uS=pS(`
|
|
243
243
|
query SetupProjectSelect {
|
|
244
244
|
projects {
|
|
245
245
|
id
|
|
@@ -249,11 +249,11 @@ ${t.join(`
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
`)});import{Box as jt,Text as ue,useInput as
|
|
252
|
+
`)});import{Box as jt,Text as ue,useInput as mS}from"ink";import fS from"ink-spinner";import{jsx as xe,jsxs as Se}from"react/jsx-runtime";function Nc({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}){return mS((s,l)=>{a==="scaffolding-warnings"&&l.return&&n()}),Se(jt,{flexDirection:"column",padding:1,children:[Se(ue,{bold:!0,children:[" ","ripplo setup"]}),xe(ue,{children:""}),Se(ue,{children:[xe(ue,{color:"green",children:" \u2713 "}),xe(ue,{children:"Authenticated"})]}),yS({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}),t==null?null:xe(jt,{marginTop:1,children:Se(ue,{color:"red",children:[" ","Error: ",t]})})]})}function yS({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?Se(ue,{children:[Se(ue,{color:"cyan",children:[" ",xe(fS,{type:"dots"})]}),Se(ue,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?Se(jt,{flexDirection:"column",marginTop:1,children:[xe(ue,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((i,a)=>Se(jt,{flexDirection:"column",marginTop:1,children:[Se(ue,{children:[" ",i.message]}),i.manualCommand==null?null:Se(ue,{color:"cyan",children:[" $ ",i.manualCommand]})]},a)),xe(jt,{marginTop:1,children:xe(ue,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):xe(Tc,{selectProject:r,serverUrl:e.ripploServerUrl})}var Cc=f(()=>{"use strict";vc()});import{useEffect as gS,useState as hS}from"react";function ft(){let[e,t]=hS(Lc);return gS(()=>{function n(){t(Lc())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Lc(){return{height:process.stdout.rows,width:process.stdout.columns}}var En=f(()=>{"use strict"});import{useEffect as kS,useRef as SS,useState as wS}from"react";function xc({config:e,cwd:t}){let[n,r]=wS({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=SS(void 0);return kS(()=>{function i({config:s,devSessionId:l}){r(c=>({...c,config:s,devSessionId:l,syncError:void 0,syncing:!1}))}function a(s){r(l=>({...l,syncError:s,syncing:!1}))}return Yl({config:e,cwd:t}).then(({config:s,devSessionId:l,hash:c})=>{i({config:s,devSessionId:l}),o.current=vo({config:s,cwd:t,devSessionId:l,lastHash:c,onSyncError:a,onSyncSuccess:i})}).catch(s=>{let l=s instanceof Error?s.message:String(s);a(l),o.current=vo({config:e,cwd:t,devSessionId:"",lastHash:"",onSyncError:a,onSyncSuccess:i})}),()=>{o.current?.()}},[e,t]),n}var Pc=f(()=>{"use strict";No()});function On(e){return{...bS(e),type:e.type}}function bS(e){switch(e.type){case"settings":return AS(e);case"token":return RS(e.exists);case"dev-server":return TS(e);case"preconditions":return PS(e);case"engine-endpoint":return vS(e);case"adapter-enabled":return OS(e.status);case"webhook-verification":return NS(e.rejectsUnsigned);case"preconditions-validation":return CS(e);case"workflows":return IS(e);case"browser":return LS(e.installed);case"lockfile":return US(e.status);case"pre-commit-hook":return xS(e.installed)}}function AS(e){return e.valid?{detail:"configured",label:"Settings",tone:"ok"}:{detail:`missing ${e.missingFields.join(", ")}`,label:"Settings",tone:"error"}}function RS(e){return e?{detail:"signed in",label:"Auth",tone:"ok"}:{detail:"not signed in",label:"Auth",tone:"error"}}function TS(e){return e.reachable?{detail:e.appUrl,label:"Dev server",tone:"ok"}:{detail:`${e.appUrl} unreachable`,label:"Dev server",tone:"error"}}function vS(e){return e.reachable?{detail:e.url,label:"Endpoint",tone:"ok"}:{detail:`${e.url} unreachable`,label:"Endpoint",tone:"error"}}function NS(e){return e?{detail:"rejects unsigned",label:"Webhook auth",tone:"ok"}:{detail:"accepts unsigned!",label:"Webhook auth",tone:"error"}}function CS(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 LS(e){return e?{detail:"chromium installed",label:"Browser",tone:"ok"}:{detail:"chromium missing",label:"Browser",tone:"error"}}function xS(e){return e?{detail:"installed",label:"Pre-commit",tone:"ok"}:{detail:"not installed",label:"Pre-commit",tone:"warn"}}function PS(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 OS(e){let t=ES[e];return t??{detail:"unreachable",label:"Adapter",tone:"error"}}function IS(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 US(e){let t=_S[e];return t??{detail:"stale (run ripplo compile)",label:"Lockfile",tone:"warn"}}var ES,_S,Ec,Oc,jo=f(()=>{"use strict";ES={"bad-secret":{detail:"webhook secret mismatch",label:"Adapter",tone:"error"},disabled:{detail:"disabled (set ENABLE_RIPPLO_TESTING)",label:"Adapter",tone:"error"},enabled:{detail:"enabled",label:"Adapter",tone:"ok"},"no-secret":{detail:"no webhook secret",label:"Adapter",tone:"error"},unreachable:{detail:"unreachable",label:"Adapter",tone:"error"}};_S={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"}};Ec={"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"},Oc={error:"ERROR",info:"INFO",ok:"OK",warn:"WARN"}});import{useEffect as jS,useState as $S}from"react";import DS from"path";import{watch as BS}from"chokidar";import{graphql as VS}from"gql.tada";function Ic({config:e,cwd:t}){let[n,r]=$S({checks:[],lastRunAt:void 0,running:!1});return jS(()=>{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 kn(t);r({checks:c,lastRunAt:Date.now(),running:!1}),o.lastPushedKey=await FS({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)},WS))}a().finally(s);let l=BS(DS.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 FS({checks:e,config:t,lastPushedKey:n}){if(t.projectId.length===0)return n;let r=e.map(i=>{let a=On(i);return{detail:a.detail,tone:Oc[a.tone],type:Ec[a.type]}}),o=JSON.stringify(r);if(o===n)return n;try{return await $({config:t,document:qS,variables:{checks:r,projectId:t.projectId}}),o}catch(i){return A.error(i,"Failed to push health checks"),n}}var WS,qS,_c=f(()=>{"use strict";G();yo();jo();WS=5e3,qS=VS(`
|
|
253
253
|
mutation PushHealthChecks($projectId: String!, $checks: [HealthCheckInput!]!) {
|
|
254
254
|
pushHealthChecks(projectId: $projectId, checks: $checks)
|
|
255
255
|
}
|
|
256
|
-
`)});import
|
|
256
|
+
`)});import $o from"fs";import{useEffect as HS}from"react";import{useQuery as MS,useSubscription as JS}from"urql";import{graphql as jc}from"gql.tada";function $c({cwd:e,projectId:t}){let[{data:n}]=MS({query:zS,variables:{projectId:t}});HS(()=>{let r=n?.project?.devSession?.hooksPaused;r!=null&&Uc({cwd:e,paused:r})},[e,n]),JS({query:XS,variables:{projectId:t}},(r,o)=>{let i=o.hooksPausedRequested;return i!=null&&Uc({cwd:e,paused:i.paused}),o})}function Uc({cwd:e,paused:t}){let n=be(e,"hooks-paused");if(t){Xe(e),$o.writeFileSync(n,"");return}$o.existsSync(n)&&$o.unlinkSync(n)}var zS,XS,Dc=f(()=>{"use strict";G();zS=jc(`
|
|
257
257
|
query HooksPausedState($projectId: String!) {
|
|
258
258
|
project(id: $projectId) {
|
|
259
259
|
id
|
|
@@ -263,14 +263,14 @@ ${t.join(`
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
`),
|
|
266
|
+
`),XS=jc(`
|
|
267
267
|
subscription HooksPausedRequested($projectId: String!) {
|
|
268
268
|
hooksPausedRequested(projectId: $projectId) {
|
|
269
269
|
paused
|
|
270
270
|
projectId
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`)});import{useEffect as
|
|
273
|
+
`)});import{useEffect as GS,useState as Bc}from"react";import{useQuery as KS,useSubscription as Vc}from"urql";import{graphql as Do}from"gql.tada";function qc({projectId:e}){let[{data:t}]=KS({query:QS,variables:{projectId:e}}),[n,r]=Bc(),[o,i]=Bc();return GS(()=>{let a=t?.project?.devSession?.hooksPaused;a!=null&&r(a);let s=t?.project?.devSession?.scopeItems;s!=null&&i(s.map(l=>Wc(l)))},[t]),Vc({query:YS,variables:{projectId:e}},(a,s)=>{let l=s.hooksPausedRequested;return l!=null&&r(l.paused),s}),Vc({query:ZS,variables:{projectId:e}},(a,s)=>{let l=s.scopeChanged?.devSession?.scopeItems;return l!=null&&i(l.map(c=>Wc(c))),s}),{paused:n??!1,projectName:t?.project?.name,scope:o??[]}}function Wc(e){let t=e.workflow;return t!=null?{id:e.id,label:t.name}:{id:e.id,label:e.label??"(intent)"}}var QS,YS,ZS,Fc=f(()=>{"use strict";QS=Do(`
|
|
274
274
|
query ProjectStateDashboard($projectId: String!) {
|
|
275
275
|
project(id: $projectId) {
|
|
276
276
|
id
|
|
@@ -290,14 +290,14 @@ ${t.join(`
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
`),
|
|
293
|
+
`),YS=Do(`
|
|
294
294
|
subscription HooksPausedDashboard($projectId: String!) {
|
|
295
295
|
hooksPausedRequested(projectId: $projectId) {
|
|
296
296
|
paused
|
|
297
297
|
projectId
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
`),
|
|
300
|
+
`),ZS=Do(`
|
|
301
301
|
subscription ScopeChangedDashboard($projectId: String!) {
|
|
302
302
|
scopeChanged(projectId: $projectId) {
|
|
303
303
|
projectId
|
|
@@ -315,11 +315,11 @@ ${t.join(`
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
`)});import{Box as ZS,Text as Vo}from"ink";import{jsx as Mc,jsxs as Jc}from"react/jsx-runtime";function zc({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return Jc(ZS,{paddingX:1,children:[Mc(Vo,{dimColor:!0,children:"Activity "}),Jc(Vo,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),Mc(Vo,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var Xc=f(()=>{"use strict"});import{Box as ew,Text as _n}from"ink";import{jsx as Un,jsxs as nw}from"react/jsx-runtime";function Gc({check:e}){let{detail:t,label:n,tone:r}=In(e),o=tw[r];return nw(ew,{children:[Un(_n,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),Un(_n,{children:" "}),Un(_n,{children:n.padEnd(18," ")}),Un(_n,{color:o,children:t})]})}var tw,Kc=f(()=>{"use strict";$o();tw={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as rw,Text as Qc}from"ink";import{jsx as Wo,jsxs as ow}from"react/jsx-runtime";function Yc({checks:e}){return ow(rw,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Wo(Qc,{bold:!0,children:"Health"}),e.length===0?Wo(Qc,{dimColor:!0,children:"Running first pass..."}):e.map(t=>Wo(Gc,{check:t},t.type))]})}var Zc=f(()=>{"use strict";Kc()});import{Box as jn,Text as yt}from"ink";import{jsx as gt,jsxs as $n}from"react/jsx-runtime";function ed({appUrl:e,developerUrl:t,projectName:n}){return $n(jn,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[$n(jn,{children:[gt(yt,{dimColor:!0,children:"Project "}),gt(yt,{bold:!0,children:n})]}),$n(jn,{children:[gt(yt,{dimColor:!0,children:"App "}),gt(yt,{color:"cyan",children:e})]}),$n(jn,{children:[gt(yt,{dimColor:!0,children:"Dashboard "}),gt(yt,{color:"cyan",children:t})]})]})}var td=f(()=>{"use strict"});import{Box as qo,Text as qe}from"ink";import{jsx as Fe,jsxs as Fo}from"react/jsx-runtime";function nd({paused:e,scope:t}){return Fo(qo,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Fo(qo,{children:[Fe(qe,{bold:!0,children:"Scope"}),Fe(qe,{dimColor:!0,children:` (${String(t.length)})`}),Fe(qe,{children:" "}),Fe(qe,{dimColor:!0,children:"Hooks "}),Fe(qe,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?Fe(qe,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>Fo(qo,{children:[Fe(qe,{color:"cyan",children:"\u2022 "}),Fe(qe,{children:n.label})]},n.id))]})}var rd=f(()=>{"use strict"});import{Box as iw,Text as od}from"ink";import{jsx as aw,jsxs as id}from"react/jsx-runtime";function ad({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 id(iw,{marginTop:1,paddingX:1,children:[aw(od,{dimColor:!0,children:"Workflows "}),id(od,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var sd=f(()=>{"use strict"});import ZO from"chalk";import{z as ld}from"zod";async function cd(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${sw}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return lw.parse(r).version}catch{return}finally{clearTimeout(t)}}var Ho,sw,lw,dd=f(()=>{"use strict";G();Ho="0.3.1",sw="ripplo",lw=ld.object({version:ld.string()})});import{useEffect as cw,useState as dw}from"react";import{Text as Ye}from"ink";import{jsx as ht,jsxs as fw}from"react/jsx-runtime";function pd({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let s=mw(),l=s!=null&&s!==Ho,c=pw({connected:n,syncError:i}),d=t?"":" warming up browsers...",u=e>0?` ${String(e)} running`:"",p=`v${Ho}`,m=l?` \u2192 v${s}`:"",h=`project ${r} \xB7 q to quit`,S=` ripplo ${p}${m} | ${o} ${c}${d}${u}`,w=Math.max(0,a-S.length-h.length-1);return fw(Ye,{inverse:!0,children:[ht(Ye,{bold:!0,children:" ripplo "}),ht(Ye,{dimColor:!0,children:p}),l?ht(Ye,{color:"yellow",children:` \u2192 v${s}`}):null,` | ${o} `,ht(Ye,{color:uw({connected:n,syncError:i}),children:c}),t?null:ht(Ye,{color:"yellow",children:d}),u," ".repeat(w),ht(Ye,{dimColor:!0,children:h})," "]})}function pw({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function uw({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function mw(){let[e,t]=dw();return cw(()=>{cd().then(n=>{n!=null&&t(n)})},[]),e}var ud=f(()=>{"use strict";dd()});import{useEffect as yw}from"react";import{availableParallelism as gw}from"os";import{Box as Mo,Text as hw,useApp as kw,useInput as Sw}from"ink";import{jsx as He,jsxs as md}from"react/jsx-runtime";function fd({config:e,cwd:t}){let n=kw(),{height:r,width:o}=ft(),{config:i,devSessionId:a,syncError:s}=Pc({config:e,cwd:t}),{activeRunCount:l,browsersReady:c,connected:d}=lc({config:i,cwd:t,devSessionId:a}),{checks:u}=_c({config:i,cwd:t}),{paused:p,projectName:m,scope:h}=Fc({projectId:e.projectId});Dc({cwd:t,projectId:e.projectId}),yw(()=>_l(t),[t]),Sw(T=>{T==="q"&&n.exit()});let S=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,w=u.filter(T=>ww.has(T.type)),k=u.find(T=>T.type==="workflows"),b=u.find(T=>T.type==="preconditions"),v=gw(),L=m??"\u2026";return md(Mo,{flexDirection:"column",height:r,width:o,children:[He(pd,{activeRunCount:l,browsersReady:c,connected:d,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:s,width:o}),md(Mo,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[He(ed,{appUrl:i.appUrl,developerUrl:S,projectName:L}),He(nd,{paused:p,scope:h}),He(Yc,{checks:w}),He(ad,{preconditions:b,workflows:k}),He(zc,{activeRunCount:l,browsersReady:c,maxConcurrency:v}),He(Mo,{marginTop:1,paddingX:1,children:He(hw,{dimColor:!0,children:"q quit"})})]})]})}var ww,yd=f(()=>{"use strict";Ao();On();Ec();Uc();Bc();Hc();xo();Xc();Zc();td();rd();sd();ud();ww=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as gd}from"ink";import bw from"ink-spinner";import{jsx as hd,jsxs as Rw}from"react/jsx-runtime";function kd({loading:e}){return e?Rw(gd,{color:Aw,children:[hd(bw,{type:"dots"})," Starting..."]}):hd(gd,{children:""})}var Aw,Sd=f(()=>{"use strict";Aw="#24CFFF"});import{useEffect as Tw,useState as $t}from"react";import{Box as Ze,Text as Jo,useInput as vw}from"ink";import{jsx as Me,jsxs as zo}from"react/jsx-runtime";function bd({onDismiss:e}){let{height:t,width:n}=ft(),[r,o]=$t(0),[i,a]=$t(!1),[s,l]=$t(!1),[c,d]=$t(!1),[u,p]=$t(!1);vw(()=>{u&&e()}),Tw(()=>{let S=80+Dn.length*70+80,w=[...Dn.map((k,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()=>{w.forEach(k=>{clearTimeout(k)})}},[e]);let m=Dn.length+5,h=Math.max(0,Math.floor((t-m)/2));return zo(Ze,{flexDirection:"column",height:t,width:n,children:[Me(Ze,{height:h}),zo(Ze,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Me(Ze,{flexDirection:"column",children:Dn.map((S,w)=>Me(Jo,{color:wd,children:w<r?S:""},S))}),zo(Ze,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Me(Jo,{bold:!0,color:wd,children:i?Nw:""}),Me(Ze,{marginTop:1,children:Me(Jo,{color:"gray",dimColor:!0,children:s?"developer CLI":""})}),Me(Ze,{marginTop:2,children:Me(kd,{loading:c})})]})]})]})}var Dn,wd,Nw,Ad=f(()=>{"use strict";On();Sd();Dn=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],wd="#24CFFF",Nw="ripplo"});import{createAuthClient as Cw}from"better-auth/client";import{deviceAuthorizationClient as Lw}from"better-auth/client/plugins";function Bn({baseURL:e}){return Cw({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Lw()]})}var Xo=f(()=>{"use strict"});import{exec as xw}from"child_process";async function Td({cwd:e,onDeviceCode:t,url:n}){let r=n??Ot().RIPPLO_SERVER_URL,o=Bn({baseURL:r}),i=await o.device.code({client_id:Rd});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}),jw(l);let c=await Ew({authClient:o,deviceCode:a});return Vr(e,c),c}async function Ew({authClient:e,deviceCode:t}){for(;;){await _w(Pw);let n=await e.device.token({client_id:Rd,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(!Iw(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function Iw(e){return Ow.has(e)}function _w(e){return new Promise(t=>{setTimeout(t,e)})}function Uw(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function jw(e){let t=Uw();xw(`${t} "${e}"`,()=>{})}var Pw,Rd,Ow,vd=f(()=>{"use strict";G();Xo();dt();Pw=5e3,Rd="ripplo-cli";Ow=new Set(["authorization_pending","slow_down"])});import{useCallback as Vn,useEffect as $w,useState as Je}from"react";import{exec as Dw}from"child_process";import{promisify as Bw}from"util";import J from"fs";import M from"path";function Cd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Je(t==null?"login":"validating"),[i,a]=Je(),[s,l]=Je(),[c,d]=Je(t),[u,p]=Je(!1),[m,h]=Je(),[S,w]=Je(),[k,b]=Je([]);$w(()=>{if(t==null)return;Bn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(C=>{if(C.data==null){o("login");return}return Go({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=Vn(()=>{u||(p(!0),l(void 0),Td({cwd:e,onDeviceCode:h,url:n}).then(O=>(d(O),Go({cwd:e,serverUrl:n,token:O}))).then(O=>{O==null?o("select-project"):(a(O),o("complete"))}).catch(O=>{p(!1),h(void 0),l(O instanceof Error?O.message:String(O))}))},[e,u,n]),L=Vn(O=>{let C=i?.token??c??t;if(C==null){l("No authentication token available");return}o("scaffolding"),l(void 0),Fw({cwd:e,onStep:w,projectId:O.id}).then(async V=>{b(V);let ze=await Go({cwd:e,serverUrl:n,token:C});a(ze??Vw({projectId:O.id,serverUrl:n,token:C})),o(V.length>0?"scaffolding-warnings":"complete")}).catch(V=>{l(V instanceof Error?V.message:String(V)),o("select-project")})},[i,e,t,n,c]),T=Vn(()=>{o("complete")},[]),I=Vn(()=>{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:I,scaffoldingStep:S,scaffoldWarnings:k,selectProject:L,setStage:o,stage:r,startLogin:v,token:c}}function Vw({projectId:e,serverUrl:t,token:n}){return{appUrl:"",engineUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Go({cwd:e,serverUrl:t,token:n}){let r=await _(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Fw({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Yw({cwd:e,projectId:n}),t("Updating .gitignore..."),sb(e),t("Marking ripplo.lock as generated..."),zw(e),t("Installing dependencies...");let r=await Hw(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 Mw(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await Ar(),o}async function Hw(e){let t=Xw({cwd:e,pm:Qw(e)});A.info("Installing dependencies: %s",t);try{return await qw(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
|
|
319
|
-
`)[0]??n.message:String(n);return A.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function
|
|
318
|
+
`)});import{Box as ew,Text as Bo}from"ink";import{jsx as Hc,jsxs as Mc}from"react/jsx-runtime";function Jc({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return Mc(ew,{paddingX:1,children:[Hc(Bo,{dimColor:!0,children:"Activity "}),Mc(Bo,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),Hc(Bo,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var zc=f(()=>{"use strict"});import{Box as tw,Text as In}from"ink";import{jsx as _n,jsxs as rw}from"react/jsx-runtime";function Xc({check:e}){let{detail:t,label:n,tone:r}=On(e),o=nw[r];return rw(tw,{children:[_n(In,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),_n(In,{children:" "}),_n(In,{children:n.padEnd(18," ")}),_n(In,{color:o,children:t})]})}var nw,Gc=f(()=>{"use strict";jo();nw={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as ow,Text as Kc}from"ink";import{jsx as Vo,jsxs as iw}from"react/jsx-runtime";function Qc({checks:e}){return iw(ow,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Vo(Kc,{bold:!0,children:"Health"}),e.length===0?Vo(Kc,{dimColor:!0,children:"Running first pass..."}):e.map(t=>Vo(Xc,{check:t},t.type))]})}var Yc=f(()=>{"use strict";Gc()});import{Box as Un,Text as yt}from"ink";import{jsx as gt,jsxs as jn}from"react/jsx-runtime";function Zc({appUrl:e,developerUrl:t,projectName:n}){return jn(Un,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[jn(Un,{children:[gt(yt,{dimColor:!0,children:"Project "}),gt(yt,{bold:!0,children:n})]}),jn(Un,{children:[gt(yt,{dimColor:!0,children:"App "}),gt(yt,{color:"cyan",children:e})]}),jn(Un,{children:[gt(yt,{dimColor:!0,children:"Dashboard "}),gt(yt,{color:"cyan",children:t})]})]})}var ed=f(()=>{"use strict"});import{Box as Wo,Text as qe}from"ink";import{jsx as Fe,jsxs as qo}from"react/jsx-runtime";function td({paused:e,scope:t}){return qo(Wo,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[qo(Wo,{children:[Fe(qe,{bold:!0,children:"Scope"}),Fe(qe,{dimColor:!0,children:` (${String(t.length)})`}),Fe(qe,{children:" "}),Fe(qe,{dimColor:!0,children:"Hooks "}),Fe(qe,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?Fe(qe,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>qo(Wo,{children:[Fe(qe,{color:"cyan",children:"\u2022 "}),Fe(qe,{children:n.label})]},n.id))]})}var nd=f(()=>{"use strict"});import{Box as aw,Text as rd}from"ink";import{jsx as sw,jsxs as od}from"react/jsx-runtime";function id({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 od(aw,{marginTop:1,paddingX:1,children:[sw(rd,{dimColor:!0,children:"Workflows "}),od(rd,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var ad=f(()=>{"use strict"});import tI from"chalk";import{z as sd}from"zod";async function ld(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${lw}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return cw.parse(r).version}catch{return}finally{clearTimeout(t)}}var Fo,lw,cw,cd=f(()=>{"use strict";G();Fo="0.3.3",lw="ripplo",cw=sd.object({version:sd.string()})});import{useEffect as dw,useState as pw}from"react";import{Text as Ye}from"ink";import{jsx as ht,jsxs as yw}from"react/jsx-runtime";function dd({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let s=fw(),l=s!=null&&s!==Fo,c=uw({connected:n,syncError:i}),d=t?"":" warming up browsers...",u=e>0?` ${String(e)} running`:"",p=`v${Fo}`,m=l?` \u2192 v${s}`:"",h=`project ${r} \xB7 q to quit`,S=` ripplo ${p}${m} | ${o} ${c}${d}${u}`,w=Math.max(0,a-S.length-h.length-1);return yw(Ye,{inverse:!0,children:[ht(Ye,{bold:!0,children:" ripplo "}),ht(Ye,{dimColor:!0,children:p}),l?ht(Ye,{color:"yellow",children:` \u2192 v${s}`}):null,` | ${o} `,ht(Ye,{color:mw({connected:n,syncError:i}),children:c}),t?null:ht(Ye,{color:"yellow",children:d}),u," ".repeat(w),ht(Ye,{dimColor:!0,children:h})," "]})}function uw({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function mw({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function fw(){let[e,t]=pw();return dw(()=>{ld().then(n=>{n!=null&&t(n)})},[]),e}var pd=f(()=>{"use strict";cd()});import{useEffect as gw}from"react";import{availableParallelism as hw}from"os";import{Box as Ho,Text as kw,useApp as Sw,useInput as ww}from"ink";import{jsx as He,jsxs as ud}from"react/jsx-runtime";function md({config:e,cwd:t}){let n=Sw(),{height:r,width:o}=ft(),{config:i,devSessionId:a,syncError:s}=xc({config:e,cwd:t}),{activeRunCount:l,browsersReady:c,connected:d}=sc({config:i,cwd:t,devSessionId:a}),{checks:u}=Ic({config:i,cwd:t}),{paused:p,projectName:m,scope:h}=qc({projectId:e.projectId});$c({cwd:t,projectId:e.projectId}),gw(()=>_l(t),[t]),ww(T=>{T==="q"&&n.exit()});let S=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,w=u.filter(T=>bw.has(T.type)),k=u.find(T=>T.type==="workflows"),b=u.find(T=>T.type==="preconditions"),v=hw(),L=m??"\u2026";return ud(Ho,{flexDirection:"column",height:r,width:o,children:[He(dd,{activeRunCount:l,browsersReady:c,connected:d,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:s,width:o}),ud(Ho,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[He(Zc,{appUrl:i.appUrl,developerUrl:S,projectName:L}),He(td,{paused:p,scope:h}),He(Qc,{checks:w}),He(id,{preconditions:b,workflows:k}),He(Jc,{activeRunCount:l,browsersReady:c,maxConcurrency:v}),He(Ho,{marginTop:1,paddingX:1,children:He(kw,{dimColor:!0,children:"q quit"})})]})]})}var bw,fd=f(()=>{"use strict";bo();En();Pc();_c();Dc();Fc();Lo();zc();Yc();ed();nd();ad();pd();bw=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as yd}from"ink";import Aw from"ink-spinner";import{jsx as gd,jsxs as Tw}from"react/jsx-runtime";function hd({loading:e}){return e?Tw(yd,{color:Rw,children:[gd(Aw,{type:"dots"})," Starting..."]}):gd(yd,{children:""})}var Rw,kd=f(()=>{"use strict";Rw="#24CFFF"});import{useEffect as vw,useState as $t}from"react";import{Box as Ze,Text as Mo,useInput as Nw}from"ink";import{jsx as Me,jsxs as Jo}from"react/jsx-runtime";function wd({onDismiss:e}){let{height:t,width:n}=ft(),[r,o]=$t(0),[i,a]=$t(!1),[s,l]=$t(!1),[c,d]=$t(!1),[u,p]=$t(!1);Nw(()=>{u&&e()}),vw(()=>{let S=80+$n.length*70+80,w=[...$n.map((k,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()=>{w.forEach(k=>{clearTimeout(k)})}},[e]);let m=$n.length+5,h=Math.max(0,Math.floor((t-m)/2));return Jo(Ze,{flexDirection:"column",height:t,width:n,children:[Me(Ze,{height:h}),Jo(Ze,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Me(Ze,{flexDirection:"column",children:$n.map((S,w)=>Me(Mo,{color:Sd,children:w<r?S:""},S))}),Jo(Ze,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Me(Mo,{bold:!0,color:Sd,children:i?Cw:""}),Me(Ze,{marginTop:1,children:Me(Mo,{color:"gray",dimColor:!0,children:s?"developer CLI":""})}),Me(Ze,{marginTop:2,children:Me(hd,{loading:c})})]})]})]})}var $n,Sd,Cw,bd=f(()=>{"use strict";En();kd();$n=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],Sd="#24CFFF",Cw="ripplo"});import{createAuthClient as Lw}from"better-auth/client";import{deviceAuthorizationClient as xw}from"better-auth/client/plugins";function Dn({baseURL:e}){return Lw({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[xw()]})}var zo=f(()=>{"use strict"});import{exec as Pw}from"child_process";async function Rd({cwd:e,onDeviceCode:t,url:n}){let r=n??Ot().RIPPLO_SERVER_URL,o=Dn({baseURL:r}),i=await o.device.code({client_id:Ad});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}),$w(l);let c=await Ow({authClient:o,deviceCode:a});return Br(e,c),c}async function Ow({authClient:e,deviceCode:t}){for(;;){await Uw(Ew);let n=await e.device.token({client_id:Ad,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(!_w(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function _w(e){return Iw.has(e)}function Uw(e){return new Promise(t=>{setTimeout(t,e)})}function jw(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function $w(e){let t=jw();Pw(`${t} "${e}"`,()=>{})}var Ew,Ad,Iw,Td=f(()=>{"use strict";G();zo();dt();Ew=5e3,Ad="ripplo-cli";Iw=new Set(["authorization_pending","slow_down"])});import{useCallback as Bn,useEffect as Dw,useState as Je}from"react";import{exec as Bw}from"child_process";import{promisify as Vw}from"util";import J from"fs";import M from"path";function Nd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Je(t==null?"login":"validating"),[i,a]=Je(),[s,l]=Je(),[c,d]=Je(t),[u,p]=Je(!1),[m,h]=Je(),[S,w]=Je(),[k,b]=Je([]);Dw(()=>{if(t==null)return;Dn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(C=>{if(C.data==null){o("login");return}return Xo({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=Bn(()=>{u||(p(!0),l(void 0),Rd({cwd:e,onDeviceCode:h,url:n}).then(O=>(d(O),Xo({cwd:e,serverUrl:n,token:O}))).then(O=>{O==null?o("select-project"):(a(O),o("complete"))}).catch(O=>{p(!1),h(void 0),l(O instanceof Error?O.message:String(O))}))},[e,u,n]),L=Bn(O=>{let C=i?.token??c??t;if(C==null){l("No authentication token available");return}o("scaffolding"),l(void 0),Hw({cwd:e,onStep:w,projectId:O.id}).then(async V=>{b(V);let ze=await Xo({cwd:e,serverUrl:n,token:C});a(ze??Ww({projectId:O.id,serverUrl:n,token:C})),o(V.length>0?"scaffolding-warnings":"complete")}).catch(V=>{l(V instanceof Error?V.message:String(V)),o("select-project")})},[i,e,t,n,c]),T=Bn(()=>{o("complete")},[]),I=Bn(()=>{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:I,scaffoldingStep:S,scaffoldWarnings:k,selectProject:L,setStage:o,stage:r,startLogin:v,token:c}}function Ww({projectId:e,serverUrl:t,token:n}){return{appUrl:"",engineUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Xo({cwd:e,serverUrl:t,token:n}){let r=await _(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Hw({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Zw({cwd:e,projectId:n}),t("Updating .gitignore..."),lb(e),t("Marking ripplo.lock as generated..."),Xw(e),t("Installing dependencies...");let r=await Mw(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 Jw(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await br(),o}async function Mw(e){let t=Gw({cwd:e,pm:Yw(e)});A.info("Installing dependencies: %s",t);try{return await Fw(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
|
|
319
|
+
`)[0]??n.message:String(n);return A.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function Jw(e){try{await zw(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 zw(e){let t=await _(e);if(!t.ok){A.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await me({cwd:e,result:t.result})}function Xw(e){let t=M.join(e,".gitattributes"),n=J.existsSync(t)?J.readFileSync(t,"utf8"):"";if(n.includes(vd))return;let r=n.length===0||n.endsWith(`
|
|
320
320
|
`)?"":`
|
|
321
|
-
`;J.writeFileSync(t,`${n}${r}${
|
|
322
|
-
`)}function
|
|
321
|
+
`;J.writeFileSync(t,`${n}${r}${vd}
|
|
322
|
+
`)}function Gw({cwd:e,pm:t}){let n=qw.join(" ");return t==="pnpm"?Kw(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?Qw(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function Kw(e){return J.existsSync(M.join(e,"pnpm-workspace.yaml"))||J.existsSync(M.join(e,"pnpm-workspace.yml"))}function Qw(e){let t=M.join(e,"package.json");if(!J.existsSync(t))return!1;try{let n=JSON.parse(J.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 Yw(e){return J.existsSync(M.join(e,"pnpm-lock.yaml"))?"pnpm":J.existsSync(M.join(e,"yarn.lock"))?"yarn":J.existsSync(M.join(e,"bun.lockb"))||J.existsSync(M.join(e,"bun.lock"))?"bun":"npm"}function Zw({cwd:e,projectId:t}){let n=M.join(e,".ripplo"),r=M.join(n,"tests"),o=M.join(n,"preconditions"),i=M.join(n,"observers");J.mkdirSync(r,{recursive:!0}),J.mkdirSync(o,{recursive:!0}),J.mkdirSync(i,{recursive:!0}),et(M.join(n,"ripplo.ts"),eb(t)),et(M.join(n,"index.ts"),nb),et(M.join(o,"index.ts"),rb),et(M.join(i,"index.ts"),ob),et(M.join(r,"index.ts"),ib),et(M.join(n,".env"),tb()),et(M.join(n,"tsconfig.json"),ab)}function et(e,t){J.existsSync(e)||J.writeFileSync(e,t)}function eb(e){return`import { createRipplo } from "@ripplo/testing";
|
|
323
323
|
import { preconditions } from "./preconditions/index.js";
|
|
324
324
|
import { observers } from "./observers/index.js";
|
|
325
325
|
import { tests } from "./tests/index.js";
|
|
@@ -334,17 +334,17 @@ const ripplo = createRipplo(
|
|
|
334
334
|
);
|
|
335
335
|
|
|
336
336
|
export default ripplo;
|
|
337
|
-
`}function
|
|
338
|
-
`}function
|
|
337
|
+
`}function tb(){return`RIPPLO_WEBHOOK_SECRET="${eo()}"
|
|
338
|
+
`}function lb(e){let t=M.join(e,".gitignore");if(!J.existsSync(t))return;let n=J.readFileSync(t,"utf8"),r=sb.filter(i=>!n.includes(i));if(r.length===0)return;let o=n.endsWith(`
|
|
339
339
|
`)?"":`
|
|
340
340
|
`;J.writeFileSync(t,n+o+r.join(`
|
|
341
341
|
`)+`
|
|
342
|
-
`)}var
|
|
342
|
+
`)}var qw,Fw,vd,nb,rb,ob,ib,ab,sb,Cd=f(()=>{"use strict";G();Oe();Td();zo();Q();qw=["@ripplo/testing"],Fw=Vw(Bw);vd=".ripplo/ripplo.lock linguist-generated=true";nb=`// Re-exports for CLI / adapter / server imports.
|
|
343
343
|
export { default } from "./ripplo.js";
|
|
344
344
|
export { preconditions } from "./preconditions/index.js";
|
|
345
345
|
export { observers } from "./observers/index.js";
|
|
346
346
|
export { tests } from "./tests/index.js";
|
|
347
|
-
`,
|
|
347
|
+
`,rb=`// Declare preconditions with \`precondition(name)\` from @ripplo/testing and collect them
|
|
348
348
|
// in the \`preconditions\` registry below. Every handle in this registry must be implemented
|
|
349
349
|
// in your app server's \`createEngine(ripplo, { preconditions: {...}, observers: {...} })\` call.
|
|
350
350
|
//
|
|
@@ -358,7 +358,7 @@ export { tests } from "./tests/index.js";
|
|
|
358
358
|
// export const preconditions = { authLoggedIn };
|
|
359
359
|
|
|
360
360
|
export const preconditions = {};
|
|
361
|
-
`,
|
|
361
|
+
`,ob=`// Declare observers with \`observer(name)\` from @ripplo/testing and collect them in
|
|
362
362
|
// the \`observers\` registry below. Use them in tests via \`assert.backend(handle, params)\`.
|
|
363
363
|
//
|
|
364
364
|
// Example:
|
|
@@ -371,7 +371,7 @@ export const preconditions = {};
|
|
|
371
371
|
// export const observers = { orgNameIs };
|
|
372
372
|
|
|
373
373
|
export const observers = {};
|
|
374
|
-
`,
|
|
374
|
+
`,ib=`// Each test file under ./tests exports a TestDefinition. Import them here and add them
|
|
375
375
|
// to the \`tests\` array \u2014 that's what \`createRipplo(..., { tests })\` receives.
|
|
376
376
|
//
|
|
377
377
|
// Example:
|
|
@@ -379,7 +379,7 @@ export const observers = {};
|
|
|
379
379
|
// export const tests = [myTest] as const;
|
|
380
380
|
|
|
381
381
|
export const tests = [] as const;
|
|
382
|
-
`,
|
|
382
|
+
`,ab=`{
|
|
383
383
|
"compilerOptions": {
|
|
384
384
|
"strict": true,
|
|
385
385
|
"noUncheckedIndexedAccess": true,
|
|
@@ -395,7 +395,7 @@ export const tests = [] as const;
|
|
|
395
395
|
"include": ["*.ts", "observers/**/*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
|
|
396
396
|
"exclude": ["node_modules"]
|
|
397
397
|
}
|
|
398
|
-
`,
|
|
398
|
+
`,sb=[".ripplo/debug/",".ripplo/.local/",".ripplo/.env"]});import{useCallback as cb,useEffect as db,useMemo as Ld,useState as pb}from"react";import{Box as xd,Text as Go}from"ink";import{Provider as ub}from"urql";import{graphql as mb}from"gql.tada";import{jsx as Pe,jsxs as hb}from"react/jsx-runtime";function Pd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=pb(!0),i=Nd({cwd:e,initialToken:t,serverUrl:n}),{height:a,width:s}=ft(),l=Ld(()=>yb({serverUrl:n,setup:i}),[i,n]),c=Ld(()=>fc({config:l}),[l]);db(()=>{i.config!=null&&(Ko({client:c,projectId:i.config.projectId}),c.query(fb,{projectId:i.config.projectId}).toPromise())},[c,i.config]);let d=cb(()=>{o(!1)},[]);return Pe(ub,{value:c,children:gb({cwd:e,dismissSplash:d,effectiveConfig:l,height:a,setup:i,showSplash:r,width:s})})}function yb({serverUrl:e,setup:t}){return t.config!=null?t.config:{appUrl:"",engineUrl:"",projectId:"",ripploServerUrl:e,token:t.token??"",webhookSecret:""}}function gb({cwd:e,dismissSplash:t,effectiveConfig:n,height:r,setup:o,showSplash:i,width:a}){return i?Pe(wd,{onDismiss:t}):o.stage==="validating"?Pe(xd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:hb(Go,{children:[Pe(Go,{color:"yellow",children:"* "}),Pe(Go,{children:"Validating session..."})]})}):o.stage==="complete"&&o.config!=null?Pe(md,{config:o.config,cwd:e}):o.stage==="login"||o.token==null?Pe(xd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:Pe(hc,{deviceCodeInfo:o.deviceCodeInfo,error:o.error,loginStarted:o.loginStarted,startLogin:o.startLogin})}):Pe(Nc,{config:o.config??n,error:o.error,scaffoldingStep:o.scaffoldingStep,scaffoldWarnings:o.scaffoldWarnings,selectProject:o.selectProject,stage:o.stage,onDismissWarnings:o.dismissScaffoldWarnings})}var fb,Ed=f(()=>{"use strict";Qo();yc();kc();Cc();fd();bd();Cd();En();fb=mb(`
|
|
399
399
|
query PrefetchProjectState($projectId: String!) {
|
|
400
400
|
project(id: $projectId) {
|
|
401
401
|
id
|
|
@@ -415,31 +415,31 @@ export const tests = [] as const;
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
`)});var
|
|
418
|
+
`)});var Od={};Zo(Od,{clearActiveSession:()=>Ab,launchDashboard:()=>Tb,setActiveSession:()=>Ko});import Dt from"fs";import Yo from"path";import kb from"react";import{render as Sb}from"ink";import{graphql as wb}from"gql.tada";function Ko({client:e,projectId:t}){Vn=e,Wn=t}function Ab(){Vn=void 0,Wn=void 0}function Rb(){if(Vn==null||Wn==null)return Promise.resolve();let e=Vn.mutation(bb,{projectId:Wn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function Tb({restoreStdio:e}){let t=process.cwd(),n=Yo.join(t,".ripplo","debug"),r=Yo.join(n,"debug.log"),o=Yo.join(n,"last-crash.log");Dt.mkdirSync(n,{recursive:!0}),gr({filePath:r});function i(l){e(),Dt.mkdirSync(n,{recursive:!0});let c=l instanceof Error?l.stack??l.message:String(l);Dt.writeFileSync(o,`${new Date().toISOString()}
|
|
419
419
|
${c}
|
|
420
|
-
`),
|
|
420
|
+
`),ac().finally(()=>{process.exit(1)})}let a;try{let l=Re(t),c=Ve();e(),a=Sb(kb.createElement(Pd,{cwd:t,initialToken:l??void 0,serverUrl:c}),{alternateScreen:!0}),a.waitUntilExit().then(()=>Rb()).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{Dt.mkdirSync(n,{recursive:!0});let c=l instanceof Error?l.stack??l.message:String(l);Dt.appendFileSync(o,`${new Date().toISOString()} [unhandledRejection]
|
|
421
421
|
${c}
|
|
422
422
|
|
|
423
|
-
`)}catch{}})}var
|
|
423
|
+
`)}catch{}})}var bb,Vn,Wn,Qo=f(()=>{"use strict";Lo();G();Ed();dt();bb=wb(`
|
|
424
424
|
mutation EndDevSessionExit($projectId: String!) {
|
|
425
425
|
endDevSession(projectId: $projectId) {
|
|
426
426
|
id
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
`)});import{config as
|
|
429
|
+
`)});import{config as Id}from"dotenv";import vb from"fs";import tt from"path";import{fileURLToPath as Nb}from"url";import Cb from"yargs";import{hideBin as Lb}from"yargs/helpers";Oe();Q();function P(e,t){return t==null?`\u2192 /ripplo:${e}`:`\u2192 /ripplo:${e} \u2014 ${t}`}async function fi(e){let t=process.cwd(),n=await _(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
|
|
430
430
|
`),process.stderr.write(`${P("create","DSL authoring + lint rules")}
|
|
431
431
|
`),process.exit(1)),e.check){let r=await qt({cwd:t}),o=Ft({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${we} is up to date
|
|
432
432
|
`);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${we} is ${i} \u2014 run \`ripplo compile\` and commit the result
|
|
433
433
|
`),process.stderr.write(`${P("setup")}
|
|
434
434
|
`),process.exit(1)}await me({cwd:t,result:n.result}),process.stdout.write(`wrote ${we}
|
|
435
|
-
`)}
|
|
435
|
+
`)}yo();async function dl(){let e=process.cwd(),t=await kn(e),n=t.map(o=>cl(o));process.stdout.write(n.join(`
|
|
436
436
|
`)+`
|
|
437
|
-
`);let r=t.some(o=>sl(o));process.exit(r?1:0)}G();import{graphql as Sn,readFragment as
|
|
437
|
+
`);let r=t.some(o=>sl(o));process.exit(r?1:0)}G();import{graphql as Sn,readFragment as qg}from"gql.tada";import pl from"figures";var Et={cross:pl.cross,tick:pl.tick};var ml=Sn(`
|
|
438
438
|
fragment WorkflowIdMCP on Workflow {
|
|
439
439
|
id
|
|
440
440
|
slug
|
|
441
441
|
}
|
|
442
|
-
`),
|
|
442
|
+
`),Fg=Sn(`
|
|
443
443
|
query ProjectWorkflowIdsMCP($projectId: String!) {
|
|
444
444
|
project(id: $projectId) {
|
|
445
445
|
id
|
|
@@ -451,14 +451,14 @@ ${c}
|
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
`,[ml]),
|
|
454
|
+
`,[ml]),Hg=Sn(`
|
|
455
455
|
mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
|
|
456
456
|
createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
|
|
457
457
|
id
|
|
458
458
|
status
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
`),
|
|
461
|
+
`),Mg=Sn(`
|
|
462
462
|
query RunStatusMCP($id: String!) {
|
|
463
463
|
run(id: $id) {
|
|
464
464
|
id
|
|
@@ -485,8 +485,8 @@ ${c}
|
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
`);async function wn({config:e,ids:t}){let n=await
|
|
489
|
-
${P("setup","check auth + config")}`};let{entry:s,runId:l}=a;try{let c=await
|
|
488
|
+
`);async function wn({config:e,ids:t}){let n=await Jg({config:e,ids:t}),r=await Promise.all(n.map(async a=>{try{let s=await Xg({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}
|
|
489
|
+
${P("setup","check auth + config")}`};let{entry:s,runId:l}=a;try{let c=await Kg({config:e,runId:l}),d=zg({config:e,id:s.id,runId:l}),u=`.ripplo/debug/${l}/`;return{id:s.id,runId:l,summary:`View run: ${d}
|
|
490
490
|
Debug artifacts: ${u}
|
|
491
491
|
${P("debug","read summary.txt, accessibility-tree, network.jsonl before guessing")}
|
|
492
492
|
|
|
@@ -496,8 +496,8 @@ ${a.summary}`).join(`
|
|
|
496
496
|
|
|
497
497
|
---
|
|
498
498
|
|
|
499
|
-
`);return{results:o,summary:i}}async function
|
|
500
|
-
`)}function
|
|
499
|
+
`);return{results:o,summary:i}}async function Jg({config:e,ids:t}){let n=await $({config:e,document:Fg,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=>qg(ml,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 zg({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 Xg({config:e,workflowId:t}){let n=await $({config:e,document:Hg,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var Gg=2e3,ul=150;async function Kg({config:e,runId:t}){let n=0;for(;n<ul;){await Yg(Gg),n+=1;let o=(await $({config:e,document:Mg,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return Qg({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(ul)} times.`}function Qg({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"?Et.tick:Et.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"?Et.tick:Et.cross,d=l.detail==null?"":` \u2014 ${l.detail}`;r.push(` ${c} ${l.description}${d}`)})})}),r.join(`
|
|
500
|
+
`)}function Yg(e){return new Promise(t=>{setTimeout(t,e)})}G();Q();dt();import{graphql as oh}from"gql.tada";var ih=oh(`
|
|
501
501
|
query DevSessionCheckPreflight($projectId: String!) {
|
|
502
502
|
project(id: $projectId) {
|
|
503
503
|
id
|
|
@@ -509,7 +509,7 @@ ${a.summary}`).join(`
|
|
|
509
509
|
`);async function ve(){let e=process.cwd(),t=Re(e);t==null&&(process.stderr.write("Not authenticated. Run `ripplo` to set up your config first.\n"),process.stderr.write(`${P("setup")}
|
|
510
510
|
`),process.exit(1));let n=await _(e);return n.ok||(process.stderr.write(`Failed to compile DSL config: ${n.error}
|
|
511
511
|
`),process.stderr.write(`${P("setup")}
|
|
512
|
-
`),process.exit(1)),{...n.result.config,ripploServerUrl:Ve(),token:t}}async function Ne(e){(await $({config:e,document:
|
|
512
|
+
`),process.exit(1)),{...n.result.config,ripploServerUrl:Ve(),token:t}}async function Ne(e){(await $({config:e,document:ih,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.stderr.write(`${P("setup")}
|
|
513
513
|
`),process.exit(1))}async function gl({id:e,runs:t}){let n=await ve();await Ne(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
|
|
514
514
|
`);let r=await Promise.allSettled(Array.from({length:t},()=>wn({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(`
|
|
515
515
|
`).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(`
|
|
@@ -519,7 +519,7 @@ Results: ${String(o)} passed, ${String(i)} failed out of ${String(t)} runs
|
|
|
519
519
|
Failure patterns:
|
|
520
520
|
`),a.forEach((l,c)=>{process.stdout.write(` ${String(l)}x: ${c}
|
|
521
521
|
`)})),i>0&&process.stderr.write(`${P("flake-detect","parallel safety + race conditions")}
|
|
522
|
-
`),process.exit(i>0?1:0)}import
|
|
522
|
+
`),process.exit(i>0?1:0)}import wo from"fs";import bl from"path";import*as Al from"remeda";import{z as Ae}from"zod";var go=["src/**","app/**","apps/**","pages/**","routes/**","components/**"],ho=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md"],ah=Ae.object({appUrl:Ae.string(),engineUrl:Ae.string(),ignorePaths:Ae.array(Ae.string()).optional(),projectId:Ae.string(),watchPaths:Ae.array(Ae.string()).optional(),webhookSecret:Ae.string()}),sh=ah.extend({webhookSecret:Ae.string().optional()});Kn();Ht();var hl=ei(Zr(),1);import{z as B}from"zod";var VL=B.object({preconditions:B.array(B.string().min(1))}),WL=B.object({data:B.record(B.string(),B.record(B.string(),B.string())),preconditions:B.array(B.string().min(1))}),qL=B.object({observer:B.string().min(1).max(200),params:B.record(B.string().max(200),B.string())}),lh=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()})]),FL=B.object({error:B.string().optional(),outcome:lh.optional(),success:B.boolean()});function pt(e){let t=[];return e.tests.forEach(n=>{let r=ch(n),o=i=>{t.push({...i,test:n.slug})};Ph.forEach(i=>{i(r,n,o)})}),{diagnostics:t}}function ch(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 dh(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 ph(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Sl(o.value)){let i=o.value.value;!wl(i)&&kh(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 uh(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 mh(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 fh(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 yh(e,t,n){let r=0;e.forEach(o=>{ut(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 gh(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!ut(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 hh(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Sl(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function wl(e){return e.includes("{{")}function kh(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function ut(e){return e.type.startsWith("assert")}var Sh=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function wh(e){return Sh.has(e.type)}function bh(e,t,n){!t.implemented||e.length===0||e.some(r=>ut(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Ah(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(i=>ut(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 ko(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 Rh(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let i=ko(r);if(i==null)return;let a=e.slice(o+1,o+4);a.find(c=>c.type==="assertVisible"&&ko(c)===i)==null||a.some(c=>wh(c)||ut(c)&&ko(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 Th=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 So(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!Th.has(t))}function vh(e){let t=e.label==null?[]:So(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,...So(r)]}function Nh(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(So(t.expectedOutcome));if(r.size===0)return;let o=e.filter(a=>ut(a));if(o.length===0)return;o.some(a=>vh(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 Ch=/save|submit|create|delete|remove|send|invite|update|confirm|publish|apply|pay|subscribe|upgrade|cancel|archive|rename/i;function kl(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 Ch.test(n)}function Lh(e,t,n){!t.implemented||t.spec.uiOnly===!0||e.forEach((r,o)=>{if(!kl(r)||"uiOnly"in r&&r.uiOnly===!0)return;let i=e.slice(o+1),a=i.findIndex(d=>kl(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 xh(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])=>Sl(s)&&wl(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 Ph=[dh,ph,uh,mh,fh,yh,gh,hh,bh,Ah,Rh,Nh,Lh,xh];Oe();Q();async function Rl(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await _(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
|
|
523
523
|
`),process.stderr.write(`${P("create","DSL authoring + lint rules")}
|
|
524
524
|
`),process.exit(1)),await me({cwd:r,result:o.result});let i=pt(o.result),a=t.length===0?i.diagnostics:i.diagnostics.filter(p=>t.includes(p.test)),s=Al.groupBy(a,p=>p.test);Object.entries(s).forEach(([p,m])=>{process.stderr.write(`
|
|
525
525
|
${p}
|
|
@@ -528,16 +528,16 @@ Failure patterns:
|
|
|
528
528
|
`)})});let l=new Set(o.builder.getUnimplemented().tests),c=n.filter(p=>l.has(p));c.length>0&&(process.stderr.write(`
|
|
529
529
|
not-implemented
|
|
530
530
|
`),c.forEach(p=>{process.stderr.write(` ${p} is still marked .notImplemented()
|
|
531
|
-
`)}));let d=
|
|
531
|
+
`)}));let d=_h(r);d.length>0&&(process.stderr.write(`
|
|
532
532
|
preconditions
|
|
533
533
|
`),d.forEach(p=>{process.stderr.write(` [hardcoded-identifier] ${p.file}
|
|
534
534
|
`),process.stderr.write(` ${p.message}
|
|
535
535
|
`)}));let u=a.length+c.length+d.length;u>0&&(process.stderr.write(`
|
|
536
536
|
${String(u)} error(s)
|
|
537
|
-
`),
|
|
538
|
-
`))}var
|
|
537
|
+
`),Eh({diagnostics:a,hardcodeWarnings:d,stillStubbed:c}),process.exit(1))}function Eh({diagnostics:e,hardcodeWarnings:t,stillStubbed:n}){let r=new Set;(e.length>0||n.length>0)&&r.add("create"),t.length>0&&r.add("explore"),r.forEach(o=>process.stderr.write(`${P(o)}
|
|
538
|
+
`))}var Oh=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Ih=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function _h(e){let t=bl.join(e,".ripplo","preconditions");return wo.existsSync(t)?wo.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>Uh(bl.join(t,r))):[]}function Uh(e){let t=wo.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Oh.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=Ih.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 Tl(e){let t=await ve();await Ne(t);let{results:n,summary:r}=await wn({config:t,ids:e});process.stdout.write(`${r}
|
|
539
539
|
`);let o=n.some(i=>i.summary.includes("FAILED")||i.summary.includes("ERROR"));o&&process.stderr.write(`${P("debug","read .ripplo/debug/<runId>/summary.txt + artifacts before guessing")}
|
|
540
|
-
`),process.exit(o?1:0)}G();import{graphql as It}from"gql.tada";var
|
|
540
|
+
`),process.exit(o?1:0)}G();import{graphql as It}from"gql.tada";var jh=It(`
|
|
541
541
|
query ScopeStatus($projectId: String!) {
|
|
542
542
|
project(id: $projectId) {
|
|
543
543
|
id
|
|
@@ -557,7 +557,7 @@ ${String(u)} error(s)
|
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
`)
|
|
560
|
+
`),$h=It(`
|
|
561
561
|
query ScopeWorkflowBySlug($projectId: String!, $slug: String!) {
|
|
562
562
|
project(id: $projectId) {
|
|
563
563
|
id
|
|
@@ -570,48 +570,48 @@ ${String(u)} error(s)
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
`)
|
|
573
|
+
`),Dh=It(`
|
|
574
574
|
mutation ScopeAdd($projectId: String!, $workflowId: String!) {
|
|
575
575
|
addScopeItem(projectId: $projectId, source: AGENT, workflowId: $workflowId) {
|
|
576
576
|
id
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
`),
|
|
579
|
+
`),Bh=It(`
|
|
580
580
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
581
581
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
582
582
|
id
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
|
-
`),
|
|
585
|
+
`),Vh=It(`
|
|
586
586
|
mutation ScopeRemove($id: ID!) {
|
|
587
587
|
removeScopeItem(id: $id)
|
|
588
588
|
}
|
|
589
|
-
`);async function vl(e){let t=await ve();await Ne(t);let r=(await $({config:t,document:
|
|
589
|
+
`);async function vl(e){let t=await ve();await Ne(t);let r=(await $({config:t,document:jh,variables:{projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(r,null,2)}
|
|
590
590
|
`);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??""}
|
|
591
591
|
`);return}let a=i.spec==null?"stub":"implemented";process.stdout.write(` [${a}] (${o.id}) ${i.slug} \u2014 ${i.name}
|
|
592
|
-
`)})}async function Nl({testId:e}){let t=await ve();await Ne(t);let n=await xl({cfg:t,slug:e}),r=await $({config:t,document
|
|
593
|
-
`)}async function Cl({id:e,testId:t}){let n=await ve();await Ne(n);let r=await xl({cfg:n,slug:t});await $({config:n,document:
|
|
594
|
-
`)}async function Ll({id:e}){let t=await ve();await Ne(t),await $({config:t,document:
|
|
595
|
-
`)}async function xl({cfg:e,slug:t}){let r=(await $({config:e,document
|
|
592
|
+
`)})}async function Nl({testId:e}){let t=await ve();await Ne(t);let n=await xl({cfg:t,slug:e}),r=await $({config:t,document:Dh,variables:{projectId:t.projectId,workflowId:n}});process.stdout.write(`Added scope item ${r.addScopeItem?.id??"?"}
|
|
593
|
+
`)}async function Cl({id:e,testId:t}){let n=await ve();await Ne(n);let r=await xl({cfg:n,slug:t});await $({config:n,document:Bh,variables:{id:e,workflowId:r}}),process.stdout.write(`Linked scope item ${e} to ${t}
|
|
594
|
+
`)}async function Ll({id:e}){let t=await ve();await Ne(t),await $({config:t,document:Vh,variables:{id:e}}),process.stdout.write(`Removed scope item ${e}
|
|
595
|
+
`)}async function xl({cfg:e,slug:t}){let r=(await $({config:e,document:$h,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.
|
|
596
596
|
`),process.stderr.write(`${P("create")}
|
|
597
597
|
`),process.exit(1)),r.id}Q();async function Pl(e){let t=process.cwd(),n=await _(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
|
|
598
598
|
`),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
|
|
599
599
|
`);return}let o={tests:r.map(i=>({id:i,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
|
|
600
|
-
`)}import{z as Ce}from"zod";var
|
|
601
|
-
`).filter(n=>n.length>0)}function jl({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=Ul([...n]),o=Ul([...t]);return
|
|
602
|
-
`).filter(r=>r.length>0)}var
|
|
600
|
+
`)}import{z as Ce}from"zod";var Wh=Ce.object({agent_id:Ce.string().optional(),cwd:Ce.string().optional(),hook_event_name:Ce.string().optional(),mode:Ce.string().optional(),session_id:Ce.string().optional(),tool_input:Ce.looseObject({file_path:Ce.string().optional()}).optional(),tool_name:Ce.string().optional()});async function ie(){let e=await qh();if(e.trim()==="")return{};let t=JSON.parse(e);return Wh.parse(t)}function qh(){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)})}bo();G();import Jh from"fs";function zh(e){return be(e,"hooks-paused")}function ae(e){return Jh.existsSync(zh(e))?!1:Il(e)}import{execFileSync as Xh}from"child_process";import{createHash as Dx}from"crypto";import Ao from"process";import Ul from"picomatch";function Gh(e){return $l(["diff","--name-only","HEAD"],e).split(`
|
|
601
|
+
`).filter(n=>n.length>0)}function jl({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=Ul([...n]),o=Ul([...t]);return Gh(e).filter(i=>r(i)&&!o(i))}function bn(e,...t){return $l(["diff","--name-only","HEAD","--",...t],e).split(`
|
|
602
|
+
`).filter(r=>r.length>0)}var Kh=Ao.env.GIT_BIN!=null&&Ao.env.GIT_BIN.length>0?Ao.env.GIT_BIN:"git";function Qh(e){if(!(e instanceof Error)||!("status"in e))return null;let t=Reflect.get(e,"status");return typeof t=="number"?t:null}function Yh(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 $l(e,t){try{return Xh(Kh,[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch(n){let r=Qh(n);if(r==null||r===0)return"";let o=Yh(n).trim();throw new Error(`git ${e.join(" ")} failed (exit ${String(r)}): ${o}`)}}Q();async function An(e){let t=await _(e);if(!t.ok)throw new Error(`resolvePaths: DSL compile failed \u2014 ${t.error}`);let n=t.builder.getConfig();return{ignorePaths:n.ignorePaths??ho,watchPaths:n.watchPaths??go}}import Zh from"fs";import ek from"path";function ge(e){return Zh.existsSync(ek.join(e,".ripplo"))}async function Dl(){await ie();let e=process.cwd();if(!ge(e)||!ae(e))return;let{ignorePaths:t,watchPaths:n}=await An(e),r=jl({cwd:e,ignoreGlobs:t,watchGlobs:n});r.length===0||bn(e,".ripplo/tests",".ripplo/preconditions",".ripplo/observers").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.
|
|
603
603
|
${P("scope")}
|
|
604
604
|
${P("create")}
|
|
605
|
-
`)}import Ut from"fs";import
|
|
606
|
-
`),process.exit(2)}async function Vl(){if((await ie()).tool_name!=="ExitPlanMode"||!ae(process.cwd()))return;let t=
|
|
605
|
+
`)}import Ut from"fs";import tk from"os";import Bl from"path";function Ge(e){process.stderr.write(`${e}
|
|
606
|
+
`),process.exit(2)}async function Vl(){if((await ie()).tool_name!=="ExitPlanMode"||!ae(process.cwd()))return;let t=nk();if(t==null)return;let n=128*1024;if(Ut.statSync(t).size>n)return;let o=Ut.readFileSync(t,"utf8");/apps\/web|apps\/server|route|component|user flow/i.test(o)&&(/\.ripplo\/tests|Tests to implement/.test(o)||Ge(`Plan touches user-facing code but cites no .ripplo/tests stubs.
|
|
607
607
|
Add a 'Tests to implement' section listing .notImplemented() test ids, or reference existing .ripplo/tests files.
|
|
608
|
-
${P("explore")}`))}function
|
|
608
|
+
${P("explore")}`))}function nk(){let e=Bl.join(tk.homedir(),".claude","plans");return Ut.existsSync(e)?Ut.readdirSync(e).filter(n=>n.endsWith(".md")).map(n=>Bl.join(e,n)).map(n=>({full:n,mtime:Ut.statSync(n).mtimeMs})).sort((n,r)=>r.mtime-n.mtime)[0]?.full??null:null}Q();async function Wl(){if((await ie()).mode!=="plan")return;let t=process.cwd();if(!ge(t)||!ae(t))return;let n=await _(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()):
|
|
609
609
|
`),r.forEach(o=>process.stderr.write(` ${o}
|
|
610
|
-
`)))}import
|
|
610
|
+
`)))}import rk from"path";import ql from"picomatch";Q();async function Fl(){let t=(await ie()).tool_input?.file_path;if(t==null)return;let n=process.cwd();if(!ge(n)||!ae(n))return;let r=rk.relative(n,t);if(r.startsWith(".."))return;let{ignorePaths:o,watchPaths:i}=await An(n),a=ql([...i]),s=ql([...o]);if(!a(r)||s(r))return;let l=await _(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(", ")}
|
|
611
611
|
`)}Oe();Q();async function Hl(){let t=(await ie()).tool_input?.file_path;if(t==null||!/\/\.ripplo\/.*\.ts$/.test(t))return;let n=process.cwd();if(!ge(n)||!ae(n))return;let r=await _(n);r.ok||Ge(`Compilation failed: ${r.error}
|
|
612
612
|
${P("create","DSL authoring + lint rules")}`),await me({cwd:n,result:r.result});let{diagnostics:o}=pt(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}`});Ge(`${i.join(`
|
|
613
613
|
`)}
|
|
614
|
-
${P("create")}`)}G();Q();dt();import{graphql as
|
|
614
|
+
${P("create")}`)}G();Q();dt();import{graphql as ok}from"gql.tada";var ik=ok(`
|
|
615
615
|
query ScopeReminder($projectId: String!) {
|
|
616
616
|
project(id: $projectId) {
|
|
617
617
|
id
|
|
@@ -628,7 +628,7 @@ ${P("create")}`)}G();Q();dt();import{graphql as rk}from"gql.tada";var ok=rk(`
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
`);async function Ml(){await ie();let e=process.cwd();if(!ge(e)||!ae(e))return;let t=Re(e);if(t==null)return;let n=await _(e);if(!n.ok)return;let r={...n.result.config,ripploServerUrl:Ve(),token:t},o=await $({config:r,document:
|
|
631
|
+
`);async function Ml(){await ie();let e=process.cwd();if(!ge(e)||!ae(e))return;let t=Re(e);if(t==null)return;let n=await _(e);if(!n.ok)return;let r={...n.result.config,ripploServerUrl:Ve(),token:t},o=await $({config:r,document:ik,variables:{projectId:r.projectId}}).catch(s=>{let l=s instanceof Error?s.message:String(s);return process.stderr.write(`Scope reminder unavailable: ${l}
|
|
632
632
|
`),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>\`.
|
|
633
633
|
${P("create")}
|
|
634
634
|
${P("scope")}
|
|
@@ -637,7 +637,7 @@ ${a.join(`
|
|
|
637
637
|
`)}
|
|
638
638
|
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.
|
|
639
639
|
${P("scope")}
|
|
640
|
-
`)}import{execFileSync as
|
|
640
|
+
`)}import{execFileSync as ak}from"child_process";import sk from"path";import Ro from"process";Oe();G();import{graphql as lk}from"gql.tada";import{z as Rn}from"zod";Q();dt();var ck=lk(`
|
|
641
641
|
query ScopeEnforce($projectId: String!) {
|
|
642
642
|
project(id: $projectId) {
|
|
643
643
|
id
|
|
@@ -656,28 +656,28 @@ ${P("scope")}
|
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
`);async function zl(){let e=await ie();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=
|
|
659
|
+
`);async function zl(){let e=await ie();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=Ro.cwd();if(!ge(t)||!ae(t))return;let n=dk(t),r=await pk(t,n);r.length>0&&Ge(r.join(`
|
|
660
660
|
|
|
661
|
-
`))}function
|
|
661
|
+
`))}function dk(e){return bn(e,".ripplo/tests").filter(t=>t.endsWith(".ts")).map(t=>sk.basename(t,".ts")).filter(t=>t!=="index")}async function pk(e,t){let n=await _(e);if(!n.ok)return[`--- Compilation failed ---
|
|
662
662
|
${n.error}
|
|
663
|
-
${P("create")}`];await me({cwd:e,result:n.result});let r=await
|
|
663
|
+
${P("create")}`];await me({cwd:e,result:n.result});let r=await uk(e,n),o=[...new Set([...t,...r.scopedSlugsToRun])],i=mk(n,t),a=fk(n),s=yk(e,o);return[i,a,s,r.error].filter(l=>l!=null)}async function uk(e,t){let n=Re(e);if(n==null)return{error:null,scopedSlugsToRun:[]};let r={...t.result.config,ripploServerUrl:Ve(),token:n},i=(await $({config:r,document:ck,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 ---
|
|
664
664
|
${a.join(`
|
|
665
665
|
`)}
|
|
666
666
|
|
|
667
667
|
Each scope item must reach an implemented workflow, or remove it via \`npx ripplo scope remove <id>\`.
|
|
668
|
-
${P("create")}`,scopedSlugsToRun:s}}function
|
|
668
|
+
${P("create")}`,scopedSlugsToRun:s}}function mk(e,t){let{diagnostics:n}=pt(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 ---
|
|
669
669
|
${[...i,...a].join(`
|
|
670
670
|
`)}
|
|
671
|
-
${P("create")}`}function
|
|
671
|
+
${P("create")}`}function fk(e){let{tests:t}=e.builder.getUnimplemented();return t.length===0?null:`--- Unimplemented stubs remain ---
|
|
672
672
|
tests: ${t.join(", ")}
|
|
673
|
-
${P("create")}`}function
|
|
673
|
+
${P("create")}`}function yk(e,t){if(t.length===0)return null;let n=hk(["run",...t],e);if(n.code===0)return null;let r=n.output.split(`
|
|
674
674
|
`).filter(o=>/FAILED/.test(o)).join(`
|
|
675
675
|
`);return r.length===0?null:`--- Ripplo Run Failures (${t.join(" ")}) ---
|
|
676
676
|
${r}
|
|
677
|
-
${P("debug","read .ripplo/debug/<runId>/ artifacts")}`}var
|
|
678
|
-
`),process.exit(1)),await t()}
|
|
679
|
-
`),process.exit(1)});function
|
|
680
|
-
`))}function
|
|
677
|
+
${P("debug","read .ripplo/debug/<runId>/ artifacts")}`}var gk=Rn.object({status:Rn.number().nullish(),stderr:Rn.unknown().optional(),stdout:Rn.unknown().optional()});function Jl(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function hk(e,t){let n=Ro.argv[1];if(n==null)return{code:1,output:""};try{return{code:0,output:ak(Ro.execPath,[n,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(r){let o=gk.safeParse(r);if(!o.success)return{code:1,output:""};let i=`${Jl(o.data.stdout)}${Jl(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}var _d=tt.resolve(tt.dirname(Nb(import.meta.url)),"..");Id({path:tt.join(_d,".env.local"),quiet:!0});Id({path:tt.join(_d,".env"),quiet:!0});Ib();var Ud={"coverage-nudge":Dl,"exit-plan-gate":Vl,"plan-reminder":Wl,"post-edit-flag-stubs":Fl,"post-edit-lint":Hl,"scope-reminder":Ml,"stop-enforce":zl};async function xb(){await Cb(Lb(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},Pb).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=>Tl(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=>Rl({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=>gl({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=>fi({check:e.check})).command("doctor","Check project health",()=>{},()=>dl()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Pl({format:e.format})).command("scope <subcommand>","Manage testing scope",Ob).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(Ud),demandOption:!0,type:"string"}),e=>Eb(e.name)).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}async function Pb(){let{redirectStdioToFile:e}=await Promise.resolve().then(()=>(Gl(),Xl)),t=e(tt.join(process.cwd(),".ripplo","debug","debug.log")),{launchDashboard:n}=await Promise.resolve().then(()=>(Qo(),Od));n({restoreStdio:t})}async function Eb(e){let t=Ud[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
|
|
678
|
+
`),process.exit(1)),await t()}xb().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
679
|
+
`),process.exit(1)});function Ob(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>vl({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=>Nl({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=>Cl({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=>Ll({id:t.id})).demandCommand(1)}function Ib(){let e=process.cwd(),t=jd(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
|
|
680
|
+
`))}function jd(e){let t=tt.dirname(e);return vb.existsSync(tt.join(e,".ripplo"))?e:t===e?null:jd(t)}export{xb as main};
|
|
681
681
|
/*! Bundled license information:
|
|
682
682
|
|
|
683
683
|
mustache/mustache.mjs:
|