ripplo 0.3.9 → 0.3.11
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 +183 -187
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`}async function Ht({cwd:e}){let t=Gn.join(e,be),n=await su(t);return n==null?null:np(mi,n)}async function fe({cwd:e,result:t}){let n=fi(t),r=Gn.join(e,be);await Xn.mkdir(Gn.dirname(r),{recursive:!0}),await Xn.writeFile(r,Qn(n),"utf8")}function Mt({compiled:e,existing:t}){if(t==null)return"missing";let n=Qn(fi(e)),r=Qn(t);return n===r?"match":"stale"}async function su(e){try{return await Xn.readFile(e,"utf8")}catch(t){if(lu(t)&&t.code==="ENOENT")return null;throw t}}function lu(e){return e instanceof Error&&"code"in e}function cu(e){return function(n,r){return r===e||!du(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function du(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Zd,ep,tp,di,ap,sp,D,wt,lp,cp,Zn,dp,he,pp,up,P,si,mp,fp,yp,gp,hp,kp,Sp,wp,bp,Ap,Rp,vp,Tp,Np,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,Up,jp,$p,Dp,Bp,Vp,Wp,qp,Fp,Hp,Mp,Jp,zp,Xp,Gp,Kp,Qp,ui,Yp,Zp,eu,hA,kA,tu,nu,be,ru,ou,iu,au,mi,_e=f(()=>{"use strict";qt();Zd=Ft.object({__codec:Ft.string().min(1),data:Ft.unknown(),version:Ft.number().int().positive()}),ep=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}},tp=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};di=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."),ap=Ie.object({by:Ie.literal("testId"),value:Ie.string().min(1)}),sp=Ie.object({by:Ie.literal("role"),name:Ie.string().optional(),role:Ie.string().min(1)}),D=Ie.discriminatedUnion("by",[ap,sp]),wt=pi.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),lp=pi.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),cp=z.object({type:z.literal("static"),value:z.union([z.string(),z.number(),z.boolean()])}),Zn=z.object({name:z.string().min(1),type:z.literal("variable")}),dp=z.discriminatedUnion("type",[cp,Zn]),he=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.string()}),Zn]),pp=z.discriminatedUnion("type",[z.object({type:z.literal("static"),value:z.number().int().nonnegative()}),Zn]),up=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")})]),P={id:y.string().min(1).max(200),label:y.string().max(500).optional(),next:y.string().max(200).optional(),uiOnly:y.boolean().optional()},si=500,mp=y.object({...P,type:y.literal("goto"),url:he}),fp=y.object({...P,locator:D,type:y.literal("click")}),yp=y.object({...P,locator:D,type:y.literal("fill"),value:he}),gp=y.object({...P,locator:D,type:y.literal("select"),value:he}),hp=y.object({...P,locator:D,type:y.literal("hover")}),kp=y.object({...P,key:y.string().min(1),locator:D.optional(),type:y.literal("press")}),Sp=y.object({...P,locator:D,type:y.literal("check")}),wp=y.object({...P,locator:D,type:y.literal("uncheck")}),bp=y.object({...P,height:y.number().int().positive(),type:y.literal("setViewport"),width:y.number().int().positive()}),Ap=y.object({...P,message:y.string().min(1),type:y.literal("fail")}),Rp=y.object({...P,type:y.literal("setVariable"),value:dp,variable:y.string().min(1)}),vp=y.object({...P,locator:D,type:y.literal("extractText"),variable:y.string().min(1)}),Tp=y.object({...P,files:y.array(y.string()).min(1),locator:D,type:y.literal("upload")}),Np=y.object({...P,locator:D,type:y.literal("dblclick")}),Cp=y.object({...P,source:D,target:D,type:y.literal("drag")}),Lp=y.object({...P,locator:D,type:y.literal("scrollIntoView")}),xp=y.object({...P,locator:D,type:y.literal("type"),value:he}),Pp=y.object({...P,locator:D,type:y.literal("focus")}),Ep=y.object({...P,locator:D,type:y.literal("clear")}),Op=y.object({...P,locator:D,type:y.literal("rightClick")}),Ip=y.object({...P,action:y.enum(["accept","dismiss"]),promptText:y.string().optional(),type:y.literal("handleDialog")}),_p=y.object({...P,action:y.enum(["read","write"]),type:y.literal("clipboard"),value:he.optional(),variable:y.string().min(1).optional()}),Up=y.object({...P,permission:y.string().min(1),state:y.enum(["granted","prompt"]),type:y.literal("setPermission")}),jp=y.object({...P,locator:D,type:y.literal("assertVisible")}),$p=y.object({...P,locator:D,type:y.literal("assertNotVisible")}),Dp=y.object({...P,expected:he,locator:D,operator:wt,type:y.literal("assertText")}),Bp=y.object({...P,expected:he,operator:wt,type:y.literal("assertUrl")}),Vp=y.object({...P,expected:pp,locator:D,operator:lp,type:y.literal("assertCount")}),Wp=y.object({...P,expected:he,locator:D,operator:wt,type:y.literal("assertValue")}),qp=y.object({...P,attribute:y.string().min(1),expected:he,locator:D,operator:wt,type:y.literal("assertAttribute")}),Fp=y.object({...P,locator:D,type:y.literal("assertEnabled")}),Hp=y.object({...P,locator:D,type:y.literal("assertDisabled")}),Mp=y.object({...P,expected:he,operator:wt,type:y.literal("assertTitle")}),Jp=y.object({...P,locator:D,type:y.literal("assertChecked")}),zp=y.object({...P,locator:D,type:y.literal("assertNotChecked")}),Xp=y.object({...P,locator:D,type:y.literal("assertFocused")}),Gp=y.object({...P,locator:D,type:y.literal("assertNotFocused")}),Kp=y.object({...P,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",[mp,fp,yp,gp,hp,kp,Sp,wp,jp,$p,Dp,Bp,Vp,Wp,qp,Fp,Hp,bp,Ap,Rp,vp,Tp,Np,Cp,Lp,xp,Pp,Ep,Op,Ip,_p,Up,Mp,Jp,zp,Xp,Gp,Kp]),ui=y.object({entryNode:y.string().min(1).max(200),nodes:y.record(y.string().max(200),Qp).refine(e=>Object.keys(e).length<=si,`Workflow has more than ${String(si)} nodes`),uiOnly:y.boolean().optional(),variableNamespaces:y.record(y.string().max(200),y.string().max(500)).optional(),variables:y.record(y.string().max(200),up).optional()}),Yp=ai.record(ai.string().max(200),di),Zp={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},eu={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},hA=Yn("workflow-spec").legacy(Zp).initial(ui).build(),kA=Yn("precondition-map").legacy(eu).initial(Yp).build(),tu=["fast","slow","async"],nu=zn.object({budget:zn.enum(tu).describe("Polling budget tier: fast | slow | async"),description:zn.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."),be=".ripplo/ripplo.lock",ru=5e3,ou=ne.record(ne.string().max(200),ne.string().max(200)),iu=ne.object({expectedOutcome:ne.string().max(2e3),name:ne.string().max(200),preconditions:ne.array(ne.string().max(200)).max(1e3),requiresKeys:ou,slug:ne.string().max(200),spec:ui}),au=ne.object({observers:ne.record(ne.string().max(200),nu),preconditions:ne.record(ne.string().max(200),di),tests:ne.array(iu).max(ru)}),mi=Yn("ripplo-lockfile").initial(au).build()});function yi(e){return e.data}function gi(e){return{as(t){return{data:{label:t,node:e}}}}}var Jt=f(()=>{"use strict"});function zt(e){let t=e.getPreconditions(),n=e.getObservers(),r=e.getTests();pu(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=>uu(s,t));return{config:e.getConfig(),observers:i,preconditions:o,tests:a}}function pu(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 uu(e,t){let n=e.id,{accessedKeys:r,vars:o}=fu(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),s=i==null?a:[mu(i),...a],l=yu(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 p=hu(e.requires,t);return{additionalChecks:[],description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,preconditions:p,requiresKeys:{...e.requiresKeys},slug:n,spec:l,warnings:c}}function mu(e){return gi({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function fu(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 yu(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]=gu(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 gu(e,t,n){let{label:r,node:o}=yi(e);return{...o,id:t,label:r,next:n}}function hu(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 er=f(()=>{"use strict";Jt()});var hi=f(()=>{"use strict";er();Jt();qt()});import ku from"fs";import ki from"path";import{config as Su}from"dotenv";import{createJiti as wu}from"jiti";function Au(e){return e==null||typeof e!="object"?!1:bu.every(t=>typeof Reflect.get(e,t)=="function")}function Ru(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function vu(e){let t=ki.join(e,".ripplo",".env");ku.existsSync(t)&&Su({override:!0,path:t,quiet:!0})}async function I(e){vu(e);let t=ki.join(e,".ripplo","index.ts");try{let r=await wu(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!Au(o))return{error:`${t} must default-export a RipploBuilder (got ${Ru(o)})`,ok:!1};let i=zt(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var bu,K=f(()=>{"use strict";hi();bu=["getConfig","getObservers","getPreconditions","getTests","getUnimplemented"]});function nr(e){return typeof e=="function"}function Nu(e){return ot(e)?"array":typeof e}function tr(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function wi(e,t){return e!=null&&typeof e=="object"&&t in e}function Cu(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}function xu(e,t){return Lu.call(e,t)}function Eu(e){return!xu(Pu,e)}function Iu(e){return String(e).replace(/[&<>"'`=\/]/g,function(n){return Ou[n]})}function Du(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 p,u,m;function h(L){if(typeof L=="string"&&(L=L.split(Uu,2)),!ot(L)||L.length!==2)throw new Error("Invalid tags: "+L);p=new RegExp(tr(L[0])+"\\s*"),u=new RegExp("\\s*"+tr(L[1])),m=new RegExp("\\s*"+tr("}"+L[1]))}h(t||ye.tags);for(var S=new At(e),w,k,b,T,x,v;!S.eos();){if(w=S.pos,b=S.scanUntil(p),b)for(var U=0,O=b.length;U<O;++U)T=b.charAt(U),Eu(T)?(i.push(o.length),l+=T):(s=!0,n=!0,l+=" "),o.push(["text",T,w,w+1]),w+=1,T===`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`)};re.prototype.renderPartial=function(t,n,r,o){if(r){var i=this.getConfigTags(o),a=nr(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 p=this.parse(d,i);return this.renderTokens(p,n,r,d,o)}}};re.prototype.unescapedValue=function(t,n){var r=n.lookup(t[1]);if(r!=null)return r};re.prototype.escapedValue=function(t,n,r){var o=this.getConfigEscape(r)||ye.escape,i=n.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===ye.escape?String(i):o(i)};re.prototype.rawValue=function(t){return t[1]};re.prototype.getConfigTags=function(t){return ot(t)?t:t&&typeof t=="object"?t.tags:void 0};re.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!ot(t))return t.escape};ye={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){bt.templateCache=e},get templateCache(){return bt.templateCache}},bt=new re;ye.clearCache=function(){return bt.clearCache()};ye.parse=function(t,n){return bt.parse(t,n)};ye.render=function(t,n,r,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Nu(t)+'" was given as the first argument for mustache#render(template, view, partials)');return bt.render(t,n,r,o)};ye.escape=Iu;ye.Scanner=At;ye.Context=rt;ye.Writer=re;Ai=ye});function Rt({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,qu({def:n,name:t})]))}function qu({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??Wu[e.type]??""}function vt({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 oe({ref:e,variables:t}){let n=String(vt({ref:e,variables:t}));return rr({raw:n,variables:t})}function rr({raw:e,variables:t}){return Ai.render(e,t,{},{escape:n=>n})}function or({ref:e,variables:t}){let n=vt({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 Wu,Ue=f(()=>{"use strict";Ri();Wu={boolean:!1,number:0,string:""}});function F({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(vi(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:vi(e.name,n)})}}function vi(e,t){return t==null?e:rr({raw:e,variables:t})}var at=f(()=>{"use strict";Ue()});async function Ti({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 Ni({node:e,page:t,timeout:n}){await F({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function Ci({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 Li({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=oe({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 xi({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var Pi=f(()=>{"use strict";at();Ue()});async function ir({node:e,page:t,timeout:n,variables:r}){switch(e.type){case"click":case"check":case"uncheck":case"clear":case"dblclick":case"focus":case"hover":case"scrollIntoView":return Hu({node:e,page:t,timeout:n,variables:r});case"rightClick":return await Ni({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=oe({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 zu({node:e,page:t,timeout:n,variables:r});case"type":return Xu({node:e,page:t,timeout:n,variables:r});case"press":return await Mu({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Ti({node:e,page:t,timeout:n}),{variables:r};case"upload":return Gu({node:e,page:t,timeout:n,variables:r});case"extractText":return Ku({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=vt({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 Ci({node:e,page:t,variables:r});case"clipboard":return Li({node:e,page:t,variables:r});case"setPermission":return await xi({node:e,page:t}),{variables:r}}}async function Hu({node:e,page:t,timeout:n,variables:r}){return await F({locator:e.locator,page:t,variables:r})[Fu[e.type]]({timeout:n}),{variables:r}}async function Mu({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=oe({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function zu({node:e,page:t,timeout:n,variables:r}){let o=oe({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function Xu({node:e,page:t,timeout:n,variables:r}){let o=oe({ref:e.value,variables:r});return await F({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function Gu({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 Ku({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 Fu,ar=f(()=>{"use strict";Pi();at();Ue();Fu={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function je({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"}),Yu(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 Qu(e){return"locator"in e}async function Yu(e){return(await Promise.all(e.map(n=>Zu(n)))).filter(n=>n!=null)}async function Zu(e){if(!Qu(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 Xt({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(!em(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 em(e){return"locator"in e&&e.locator!=null}var Tt=f(()=>{"use strict";at()});import{z as tm}from"zod";function R({description:e,execute:t,name:n,schema:r}){let o=tm.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 C(e){let t=e.specNode==null?[]:Xt({node:e.specNode,page:e.page}),n=await je({page:e.page,runStartTime:e.runStartTime,targets:t}),r=[...e.assertions],o={annotations:n.annotations,assertions:r,detail:e.detail,duration:Math.round(e.duration),nodeId:`agent-step-${String(e.stepIndex)}`,nodeType:e.nodeType,screenshotBase64:n.screenshotBase64,snapshotTimestamp:n.snapshotTimestamp,status:e.status,stepIndex:e.stepIndex,title:e.title,url:n.url,viewportHeight:n.viewportHeight,viewportWidth:n.viewportWidth},i=r.length>0?r.map(a=>`${a.status}: ${a.description} \u2014 ${a.detail??""}`).join(`
|
|
7
|
-
`):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:i}}var $=f(()=>{"use strict";Tt()});import{z as Ei}from"zod";var nm,Oi,Ii=f(()=>{"use strict";$();nm=Ei.object({selector:Ei.string().describe("CSS selector for the checkbox or radio button")}),Oi=R({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:nm,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 C({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 _i}from"zod";var rm,Ui,ji=f(()=>{"use strict";$();rm=_i.object({selector:_i.string().describe("CSS selector for the element to check focus on")}),Ui=R({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:rm,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 C({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 sr}from"zod";var om,$i,Di=f(()=>{"use strict";$();om=sr.object({expected:sr.string().describe("The expected text content"),selector:sr.string().describe("CSS selector for the element to check")}),$i=R({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:om,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 C({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 lr}from"zod";function am({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 im,Bi,Vi=f(()=>{"use strict";$();im=lr.object({expected:lr.string().describe("Expected page title or substring"),operator:lr.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),Bi=R({description:"Assert that the page title matches an expected value",name:"assert_title",schema:im,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=am({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 C({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 Wi}from"zod";var sm,qi,Fi=f(()=>{"use strict";$();sm=Wi.object({selector:Wi.string().describe("CSS selector for the element to check")}),qi=R({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:sm,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 C({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 Hi}from"zod";var lm,Mi,Ji=f(()=>{"use strict";$();lm=Hi.object({selector:Hi.string().describe("CSS selector for the checkbox to check")}),Mi=R({description:"Check a checkbox matching the CSS selector",name:"check",schema:lm,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),C({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 zi}from"zod";var cm,Xi,Gi=f(()=>{"use strict";$();cm=zi.object({selector:zi.string().describe("CSS selector for the input to clear")}),Xi=R({description:"Clear the contents of an input field",name:"clear",schema:cm,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),C({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 Ki}from"zod";var dm,Qi,Yi=f(()=>{"use strict";$();dm=Ki.object({selector:Ki.string().describe("CSS selector for the element to click")}),Qi=R({description:"Click an element matching the CSS selector",name:"click",schema:dm,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),C({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 cr}from"zod";var pm,Zi,ea=f(()=>{"use strict";$();pm=cr.object({action:cr.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:cr.string().optional().describe("Text to write (required for write action)")}),Zi=R({description:"Read from or write to the browser clipboard. For write, provide the text value. For read, the clipboard contents are returned.",name:"clipboard",schema:pm,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 C({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 C({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 Gt}from"zod";var ta,na,ra=f(()=>{"use strict";ta=Gt.object({summary:Gt.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:Gt.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.")}),na={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:{...Gt.toJSONSchema(ta,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=ta.parse(t),r={kind:"verdict",summary:n.summary,toolOutput:`Verdict: ${n.verdict}
|
|
8
|
-
${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as oa}from"zod";var um,ia,aa=f(()=>{"use strict";$();um=oa.object({selector:oa.string().describe("CSS selector for the element to extract text from")}),ia=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:um,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return C({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 dr}from"zod";var mm,sa,la=f(()=>{"use strict";$();mm=dr.object({selector:dr.string().describe("CSS selector for the input element"),value:dr.string().describe("The text to type into the element")}),sa=R({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:mm,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),C({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 ca}from"zod";function ym(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var fm,da,pa=f(()=>{"use strict";$();fm=ca.object({level:ca.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),da=R({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:fm,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=>ym(o)).join(`
|
|
2
|
+
var ac=Object.defineProperty;var p=(e,t)=>()=>(e&&(t=e(e=0)),t);var jo=(e,t)=>{for(var n in t)ac(e,n,{get:t[n],enumerable:!0})};import{execFileSync as sc}from"child_process";import lc from"fs";import ct from"path";function xn(e){let t=cc(e);return t??$o(e)}function $o(e){let t=ct.dirname(e);return dc(ct.join(e,".ripplo"))?e:t===e?null:$o(t)}function dc(e){try{return lc.statSync(e).isDirectory()}catch{return!1}}function cc(e){let t=pc(["rev-parse","--git-common-dir"],e);if(t==null)return null;let n=t.trim();if(n.length===0)return null;let r=ct.isAbsolute(n)?n:ct.resolve(e,n);return ct.dirname(r)}function pc(e,t){try{return sc("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}var On=p(()=>{"use strict"});var Lt=p(()=>{"use strict"});import In from"fs/promises";import _n from"path";import{z as Pt}from"zod";import{z as Do}from"zod";import{z as Qe}from"zod";import{z as m}from"zod";import{z as Pe}from"zod";import{z as qo}from"zod";import{z as M}from"zod";import{z as se}from"zod";import{z as En}from"zod";import{z as ee}from"zod";function $n(e){return Vo({legacy:void 0,migrators:[],name:e,schemas:[]})}function yc(e,t){let n=JSON.parse(t);return e.decode(n)}function Vo(e){return{initial:t=>Un(t,{...e,schemas:[t]}),legacy:t=>Vo({...e,legacy:t})}}function Un(e,t){return{build:()=>gc(e,t),legacy:n=>Un(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Un(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function gc(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>hc(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function hc(e,t,n){let{data:r,version:o}=kc(t,n),i=Wo(t,r,o);return e.parse(i)}function kc(e,t){let n=uc.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new fc({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 Wo(e,t,n){let r=e.schemas.length;if(n>r)throw new mc({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 Wo(e,a(i),n+1)}function Jo(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 jn(e){let t=Ho.encode(e);return`${JSON.stringify(t,Ap(t),2)}
|
|
3
|
+
`}async function xt({cwd:e}){let t=_n.join(e,he),n=await wp(t);return n==null?null:yc(Ho,n)}async function pe({cwd:e,result:t}){let n=Jo(t),r=_n.join(e,he);await In.mkdir(_n.dirname(r),{recursive:!0}),await In.writeFile(r,jn(n),"utf8")}function Ot({compiled:e,existing:t}){if(t==null)return"missing";let n=jn(Jo(e)),r=jn(t);return n===r?"match":"stale"}async function wp(e){try{return await In.readFile(e,"utf8")}catch(t){if(bp(t)&&t.code==="ENOENT")return null;throw t}}function bp(e){return e instanceof Error&&"code"in e}function Ap(e){return function(n,r){return r===e||!Rp(r)?r:Object.fromEntries(Object.entries(r).toSorted(([o],[i])=>o.localeCompare(i)))}}function Rp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var uc,mc,fc,Fo,Sc,wc,E,pt,bc,Ac,Dn,Rc,me,Tc,Nc,N,Bo,vc,Cc,Lc,Pc,xc,Oc,Ec,Ic,_c,Uc,jc,$c,Dc,Bc,Vc,Wc,Fc,qc,Mc,Hc,Jc,zc,Xc,Gc,Kc,Qc,Yc,Zc,ep,tp,np,rp,op,ip,ap,sp,lp,dp,cp,Mo,pp,up,mp,Nb,vb,fp,yp,he,gp,hp,kp,Sp,Ho,xe=p(()=>{"use strict";Lt();uc=Pt.object({__codec:Pt.string().min(1),data:Pt.unknown(),version:Pt.number().int().positive()}),mc=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}},fc=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};Fo=Qe.object({depends:Qe.array(Qe.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Qe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Qe.array(Qe.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name."),Sc=Pe.object({by:Pe.literal("testId"),value:Pe.string().min(1)}),wc=Pe.object({by:Pe.literal("role"),name:Pe.string().optional(),role:Pe.string().min(1)}),E=Pe.discriminatedUnion("by",[Sc,wc]),pt=qo.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),bc=qo.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Ac=M.object({type:M.literal("static"),value:M.union([M.string(),M.number(),M.boolean()])}),Dn=M.object({name:M.string().min(1),type:M.literal("variable")}),Rc=M.discriminatedUnion("type",[Ac,Dn]),me=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.string()}),Dn]),Tc=M.discriminatedUnion("type",[M.object({type:M.literal("static"),value:M.number().int().nonnegative()}),Dn]),Nc=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")})]),N={id:m.string().min(1).max(200),label:m.string().max(500).optional(),next:m.string().max(200).optional(),uiOnly:m.boolean().optional()},Bo=500,vc=m.object({...N,type:m.literal("goto"),url:me}),Cc=m.object({...N,locator:E,type:m.literal("click")}),Lc=m.object({...N,locator:E,type:m.literal("fill"),value:me}),Pc=m.object({...N,locator:E,type:m.literal("select"),value:me}),xc=m.object({...N,locator:E,type:m.literal("hover")}),Oc=m.object({...N,key:m.string().min(1),locator:E.optional(),type:m.literal("press")}),Ec=m.object({...N,locator:E,type:m.literal("check")}),Ic=m.object({...N,locator:E,type:m.literal("uncheck")}),_c=m.object({...N,height:m.number().int().positive(),type:m.literal("setViewport"),width:m.number().int().positive()}),Uc=m.object({...N,message:m.string().min(1),type:m.literal("fail")}),jc=m.object({...N,type:m.literal("setVariable"),value:Rc,variable:m.string().min(1)}),$c=m.object({...N,locator:E,type:m.literal("extractText"),variable:m.string().min(1)}),Dc=m.object({...N,files:m.array(m.string()).min(1),locator:E,type:m.literal("upload")}),Bc=m.object({...N,locator:E,type:m.literal("dblclick")}),Vc=m.object({...N,source:E,target:E,type:m.literal("drag")}),Wc=m.object({...N,locator:E,type:m.literal("scrollIntoView")}),Fc=m.object({...N,locator:E,type:m.literal("type"),value:me}),qc=m.object({...N,locator:E,type:m.literal("focus")}),Mc=m.object({...N,locator:E,type:m.literal("clear")}),Hc=m.object({...N,locator:E,type:m.literal("rightClick")}),Jc=m.object({...N,action:m.enum(["accept","dismiss"]),promptText:m.string().optional(),type:m.literal("handleDialog")}),zc=m.object({...N,action:m.enum(["read","write"]),type:m.literal("clipboard"),value:me.optional(),variable:m.string().min(1).optional()}),Xc=m.object({...N,permission:m.string().min(1),state:m.enum(["granted","prompt"]),type:m.literal("setPermission")}),Gc=m.object({...N,locator:E,type:m.literal("assertVisible")}),Kc=m.object({...N,locator:E,type:m.literal("assertNotVisible")}),Qc=m.object({...N,expected:me,locator:E,operator:pt,type:m.literal("assertText")}),Yc=m.object({...N,expected:me,operator:pt,type:m.literal("assertUrl")}),Zc=m.object({...N,expected:Tc,locator:E,operator:bc,type:m.literal("assertCount")}),ep=m.object({...N,expected:me,locator:E,operator:pt,type:m.literal("assertValue")}),tp=m.object({...N,attribute:m.string().min(1),expected:me,locator:E,operator:pt,type:m.literal("assertAttribute")}),np=m.object({...N,locator:E,type:m.literal("assertEnabled")}),rp=m.object({...N,locator:E,type:m.literal("assertDisabled")}),op=m.object({...N,expected:me,operator:pt,type:m.literal("assertTitle")}),ip=m.object({...N,locator:E,type:m.literal("assertChecked")}),ap=m.object({...N,locator:E,type:m.literal("assertNotChecked")}),sp=m.object({...N,locator:E,type:m.literal("assertFocused")}),lp=m.object({...N,locator:E,type:m.literal("assertNotFocused")}),dp=m.object({...N,budget:m.enum(["fast","slow","async"]),observer:m.string().min(1).max(200),params:m.record(m.string().max(200),me),type:m.literal("assertObserver")}),cp=m.discriminatedUnion("type",[vc,Cc,Lc,Pc,xc,Oc,Ec,Ic,Gc,Kc,Qc,Yc,Zc,ep,tp,np,rp,_c,Uc,jc,$c,Dc,Bc,Vc,Wc,Fc,qc,Mc,Hc,Jc,zc,Xc,op,ip,ap,sp,lp,dp]),Mo=m.object({entryNode:m.string().min(1).max(200),nodes:m.record(m.string().max(200),cp).refine(e=>Object.keys(e).length<=Bo,`Workflow has more than ${String(Bo)} nodes`),uiOnly:m.boolean().optional(),variableNamespaces:m.record(m.string().max(200),m.string().max(500)).optional(),variables:m.record(m.string().max(200),Nc).optional()}),pp=Do.record(Do.string().max(200),Fo),up={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)},Nb=$n("workflow-spec").legacy(up).initial(Mo).build(),vb=$n("precondition-map").legacy(mp).initial(pp).build(),fp=["fast","slow","async"],yp=En.object({budget:En.enum(fp).describe("Polling budget tier: fast | slow | async"),description:En.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."),he=".ripplo/ripplo.lock",gp=5e3,hp=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:hp,slug:ee.string().max(200),spec:Mo}),Sp=ee.object({observers:ee.record(ee.string().max(200),yp),preconditions:ee.record(ee.string().max(200),Fo),tests:ee.array(kp).max(gp)}),Ho=$n("ripplo-lockfile").initial(Sp).build()});function zo(e){return e.data}function Xo(e){return{as(t){return{data:{label:t,node:e}}}}}var Et=p(()=>{"use strict"});function It(e){let t=e.getPreconditions(),n=e.getObservers(),r=e.getTests();Tp(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=>Np(s,t));return{config:e.getConfig(),observers:i,preconditions:o,tests:a}}function Tp(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 Np(e,t){let n=e.id,{accessedKeys:r,vars:o}=Cp(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),a=e.stepsFn==null?[]:e.stepsFn(o),s=i==null?a:[vp(i),...a],l=Lp(s,r,e.requiresKeys,e.uiOnly),d=[];Object.keys(e.requiresKeys).length>0&&r.size===0&&e.implemented&&d.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()");let u=xp(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:d}}function vp(e){return Xo({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function Cp(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 Lp(e,t,n,r){let o={};e.forEach((s,l)=>{let d=`step-${String(l)}`,c=l<e.length-1?`step-${String(l+1)}`:void 0;o[d]=Pp(s,d,c)});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 Pp(e,t,n){let{label:r,node:o}=zo(e);return{...o,id:t,label:r,next:n}}function xp(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 Bn=p(()=>{"use strict";Et()});var Go=p(()=>{"use strict";Bn();Et();Lt()});import Op from"fs";import Ko from"path";import{config as Ep}from"dotenv";import{createJiti as Ip}from"jiti";function Up(e){return e==null||typeof e!="object"?!1:_p.every(t=>typeof Reflect.get(e,t)=="function")}function jp(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function $p(e){let t=Ko.join(e,".ripplo",".env");Op.existsSync(t)&&Ep({override:!0,path:t,quiet:!0})}async function C(e){$p(e);let t=Ko.join(e,".ripplo","index.ts");try{let r=await Ip(import.meta.url,{moduleCache:!1}).import(t),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;if(!Up(o))return{error:`${t} must default-export a RipploBuilder (got ${jp(o)})`,ok:!1};let i=It(o);return{builder:o,ok:!0,result:i}}catch(n){return{error:n instanceof Error?n.message:String(n),ok:!1}}}var _p,X=p(()=>{"use strict";Go();_p=["getConfig","getObservers","getPreconditions","getTests","getUnimplemented"]});import Dp from"mustache";function ut({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Vp({def:n,name:t})]))}function Vp({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??Bp[e.type]??""}function mt({ref:e,variables:t}){if(e.type==="static")return e.value;let n=t[e.name];if(n==null||typeof n=="object")throw new Error(`Variable "${e.name}" is not defined`);return n}function te({ref:e,variables:t}){let n=String(mt({ref:e,variables:t}));return Vn({raw:n,variables:t})}function Vn({raw:e,variables:t}){return Dp.render(e,t,{},{escape:n=>n})}function Wn({ref:e,variables:t}){let n=mt({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 Ye({name:e,store:t,value:n}){return{...t,[e]:n}}var Bp,Oe=p(()=>{"use strict";Bp={boolean:!1,number:0,string:""}});function B({locator:e,page:t,variables:n}){switch(e.by){case"testId":return t.getByTestId(Yo(e.value,n));case"role":return t.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Yo(e.name,n)})}}function Yo(e,t){return t==null?e:Vn({raw:e,variables:t})}var Ze=p(()=>{"use strict";Oe()});async function Zo({node:e,page:t,timeout:n}){await B({locator:e.source,page:t,variables:void 0}).dragTo(B({locator:e.target,page:t,variables:void 0}),{timeout:n})}async function ei({node:e,page:t,timeout:n}){await B({locator:e.locator,page:t,variables:void 0}).click({button:"right",timeout:n})}function ti({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 ni({node:e,page:t,variables:n}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=te({ref:e.value,variables:n}),i=JSON.stringify(o);return await t.evaluate(`navigator.clipboard.writeText(${i})`),{variables:n}}if(e.variable==null)throw new Error("clipboard read requires a variable name to store the result");let r=String(await t.evaluate("navigator.clipboard.readText()"));return{variables:Ye({name:e.variable,store:n,value:r})}}async function ri({node:e,page:t}){let n=t.context();e.state==="granted"?await n.grantPermissions([e.permission]):await n.clearPermissions()}var oi=p(()=>{"use strict";Ze();Oe()});async function Fn({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 Fp({node:e,page:t,timeout:n,variables:r});case"rightClick":return await ei({node:e,page:t,timeout:n}),{variables:r};case"goto":{let o=te({ref:e.url,variables:r});return await t.goto(o,{timeout:n,waitUntil:"domcontentloaded"}),await t.waitForLoadState("load",{timeout:n}),await t.waitForFunction("document.body != null && document.body.childElementCount > 0 && (document.body.textContent?.trim().length ?? 0) > 0",void 0,{timeout:n}),await t.evaluate("new Promise((resolve) => { requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined))); })"),{variables:r}}case"fill":return Mp({node:e,page:t,timeout:n,variables:r});case"select":return Hp({node:e,page:t,timeout:n,variables:r});case"type":return Jp({node:e,page:t,timeout:n,variables:r});case"press":return await qp({node:e,page:t,timeout:n}),{variables:r};case"drag":return await Zo({node:e,page:t,timeout:n}),{variables:r};case"upload":return zp({node:e,page:t,timeout:n,variables:r});case"extractText":return Xp({node:e,page:t,timeout:n,variables:r});case"setVariable":{let o=mt({ref:e.value,variables:r});return{variables:Ye({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 ti({node:e,page:t,variables:r});case"clipboard":return ni({node:e,page:t,variables:r});case"setPermission":return await ri({node:e,page:t}),{variables:r}}}async function Fp({node:e,page:t,timeout:n,variables:r}){return await B({locator:e.locator,page:t,variables:r})[Wp[e.type]]({timeout:n}),{variables:r}}async function qp({node:e,page:t,timeout:n}){e.locator==null?await t.keyboard.press(e.key):await B({locator:e.locator,page:t,variables:void 0}).press(e.key,{timeout:n})}async function Mp({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).fill(o,{timeout:n}),{variables:r}}async function Hp({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).selectOption(o,{timeout:n}),{variables:r}}async function Jp({node:e,page:t,timeout:n,variables:r}){let o=te({ref:e.value,variables:r});return await B({locator:e.locator,page:t,variables:r}).pressSequentially(o,{timeout:n}),{variables:r}}async function zp({node:e,page:t,timeout:n,variables:r}){return await B({locator:e.locator,page:t,variables:r}).setInputFiles(e.files,{timeout:n}),{variables:r}}async function Xp({node:e,page:t,timeout:n,variables:r}){let o=await B({locator:e.locator,page:t,variables:r}).textContent({timeout:n});if(o==null)throw new Error("extractText: element had no text content");return{variables:Ye({name:e.variable,store:r,value:o})}}var Wp,qn=p(()=>{"use strict";oi();Ze();Oe();Wp={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"}});async function Ee({page:e,runStartTime:t,targets:n}){let r=e.viewportSize();if(r==null)throw new Error("Page has no viewport set");return{annotations:await Qp(n),snapshotTimestamp:Math.round(performance.now()-t),url:e.url(),viewportHeight:r.height,viewportWidth:r.width}}function Gp(e){return"locator"in e}function Kp(e){let t=globalThis.__ripploRrwebMirror?.getId(e);return t!=null&&t>0?t:void 0}async function Qp(e){return(await Promise.all(e.map(n=>Yp(n)))).filter(n=>n!=null)}async function Yp(e){if(!Gp(e))return{height:0,label:e.label,rrwebNodeId:void 0,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;let r=await e.locator.evaluate(Kp).catch(()=>{})??void 0;return{height:Math.round(n.height),label:e.label,rrwebNodeId:r,type:e.type,width:Math.round(n.width),x:Math.round(n.x),y:Math.round(n.y)}}function _t({node:e,page:t}){if(e.type==="assertUrl")return[{label:e.type,type:"urlBar"}];if(e.type==="drag"){let o=B({locator:e.source,page:t,variables:void 0}),i=B({locator:e.target,page:t,variables:void 0});return[{label:"drag-source",locator:o,type:"action"},{label:"drag-target",locator:i,type:"action"}]}if(!Zp(e))return[];let n=e.type.startsWith("assert")?"assertion":"action",r=B({locator:e.locator,page:t,variables:void 0});return[{label:e.type,locator:r,type:n}]}function Zp(e){return"locator"in e&&e.locator!=null}var ft=p(()=>{"use strict";Ze()});import{z as eu}from"zod";function h({description:e,execute:t,name:n,schema:r}){let o=eu.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 R(e){let t=e.specNode==null?[]:_t({node:e.specNode,page:e.page}),n=await Ee({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,recordingEndMs:void 0,recordingStartMs:void 0,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(`
|
|
4
|
+
`):`${e.status}: ${e.title}`;return{specNode:e.specNode,stepResult:o,toolOutput:i}}var x=p(()=>{"use strict";ft()});import{z as ii}from"zod";var tu,ai,si=p(()=>{"use strict";x();tu=ii.object({selector:ii.string().describe("CSS selector for the checkbox or radio button")}),ai=h({description:"Assert that a checkbox or radio button is checked",name:"assert_checked",schema:tu,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 R({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 li}from"zod";var nu,di,ci=p(()=>{"use strict";x();nu=li.object({selector:li.string().describe("CSS selector for the element to check focus on")}),di=h({description:"Assert that an element has keyboard focus. Use for accessibility tab-order testing.",name:"assert_focused",schema:nu,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 R({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 Mn}from"zod";var ru,pi,ui=p(()=>{"use strict";x();ru=Mn.object({expected:Mn.string().describe("The expected text content"),selector:Mn.string().describe("CSS selector for the element to check")}),pi=h({description:"Assert that an element's text content matches the expected value",name:"assert_text",schema:ru,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 R({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 Hn}from"zod";function iu({actual:e,expected:t,operator:n}){return n==="equals"?e===t:n==="contains"?e.includes(t):n==="startsWith"?e.startsWith(t):n==="endsWith"?e.endsWith(t):!1}var ou,mi,fi=p(()=>{"use strict";x();ou=Hn.object({expected:Hn.string().describe("Expected page title or substring"),operator:Hn.enum(["equals","contains","startsWith","endsWith"]).describe("Comparison operator").default("contains")}),mi=h({description:"Assert that the page title matches an expected value",name:"assert_title",schema:ou,execute:async(e,t)=>{let n=performance.now(),r=await e.page.title(),o=iu({actual:r,expected:t.expected,operator:t.operator}),i=o?"passed":"failed",a=[{description:`Title ${t.operator} "${t.expected}"`,detail:o?void 0:`Got: "${r}"`,status:i}],s=`agent-step-${String(e.stepIndex)}`,l={expected:{type:"static",value:t.expected},id:s,operator:t.operator,type:"assertTitle"};return R({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 yi}from"zod";var au,gi,hi=p(()=>{"use strict";x();au=yi.object({selector:yi.string().describe("CSS selector for the element to check")}),gi=h({description:"Assert that an element matching the selector is visible on the page",name:"assert_visible",schema:au,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 R({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 ki}from"zod";var su,Si,wi=p(()=>{"use strict";x();su=ki.object({selector:ki.string().describe("CSS selector for the checkbox to check")}),Si=h({description:"Check a checkbox matching the CSS selector",name:"check",schema:su,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).check({timeout:5e3}),R({assertions:[],detail:`Checked ${t.selector}`,duration:performance.now()-n,nodeType:"check",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Check ${t.selector}`})}})});import{z as bi}from"zod";var lu,Ai,Ri=p(()=>{"use strict";x();lu=bi.object({selector:bi.string().describe("CSS selector for the input to clear")}),Ai=h({description:"Clear the contents of an input field",name:"clear",schema:lu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).clear({timeout:5e3}),R({assertions:[],detail:`Cleared ${t.selector}`,duration:performance.now()-n,nodeType:"clear",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Clear ${t.selector}`})}})});import{z as Ti}from"zod";var du,Ni,vi=p(()=>{"use strict";x();du=Ti.object({selector:Ti.string().describe("CSS selector for the element to click")}),Ni=h({description:"Click an element matching the CSS selector",name:"click",schema:du,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({timeout:5e3}),R({assertions:[],detail:`Clicked ${t.selector}`,duration:performance.now()-n,nodeType:"click",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Click ${t.selector}`})}})});import{z as Jn}from"zod";var cu,Ci,Li=p(()=>{"use strict";x();cu=Jn.object({action:Jn.enum(["read","write"]).describe("Whether to read from or write to the clipboard"),value:Jn.string().optional().describe("Text to write (required for write action)")}),Ci=h({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:cu,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 R({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 R({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 Ut}from"zod";var Pi,xi,Oi=p(()=>{"use strict";Pi=Ut.object({summary:Ut.string().describe("This is the ONLY output the user sees. If the agent profile specifies an Output format, follow those instructions exactly. Otherwise, provide a summary of your findings."),verdict:Ut.enum(["pass","fail"]).describe("Whether the test passed or failed. If the agent profile defines Success Criteria, base this verdict on whether those criteria were met.")}),xi={anthropicTool:{description:"Call this tool when you have finished your evaluation. If the agent profile defines an Output section, the summary MUST follow those output instructions exactly. Otherwise, summarize your findings.",input_schema:{...Ut.toJSONSchema(Pi,{target:"draft-2020-12"}),type:"object"},name:"complete_test"},name:"complete_test",execute(e,t){let n=Pi.parse(t),r={kind:"verdict",summary:n.summary,toolOutput:`Verdict: ${n.verdict}
|
|
5
|
+
${n.summary}`,verdict:n.verdict};return Promise.resolve(r)}}});import{z as Ei}from"zod";var pu,Ii,_i=p(()=>{"use strict";x();pu=Ei.object({selector:Ei.string().describe("CSS selector for the element to extract text from")}),Ii=h({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:pu,execute:async(e,t)=>{let n=performance.now(),o=await e.page.locator(t.selector).textContent({timeout:5e3})??"";return R({assertions:[],detail:`Extracted text: "${o}"`,duration:performance.now()-n,nodeType:"extractText",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Extract text from ${t.selector}`})}})});import{z as zn}from"zod";var uu,Ui,ji=p(()=>{"use strict";x();uu=zn.object({selector:zn.string().describe("CSS selector for the input element"),value:zn.string().describe("The text to type into the element")}),Ui=h({description:"Clear and type text into an input element matching the CSS selector",name:"fill",schema:uu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).fill(t.value,{timeout:5e3}),R({assertions:[],detail:`Filled ${t.selector} with "${t.value}"`,duration:performance.now()-n,nodeType:"fill",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Fill ${t.selector}`})}})});import{z as $i}from"zod";function fu(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var mu,Di,Bi=p(()=>{"use strict";x();mu=$i.object({level:$i.string().describe("Filter by log level: 'error', 'warning', 'log', 'info', 'debug', or 'all'").default("all")}),Di=h({description:"Get console log messages from the browser. Optionally filter by level (error, warning, log, info, debug, all).",name:"get_console_logs",schema:mu,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=>fu(o)).join(`
|
|
9
6
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(n.length)} console messages:
|
|
10
|
-
${r}`}}})});import{z as
|
|
11
|
-
`),a=r.length>
|
|
12
|
-
(showing last ${String(
|
|
13
|
-
${i}`}}})});import{z as
|
|
7
|
+
${r}`}}})});import{z as Vi}from"zod";var Xn,yu,Wi,Fi=p(()=>{"use strict";x();Xn=50,yu=Vi.object({urlFilter:Vi.string().describe("Optional regex to filter network entries by URL. Omit to see all.").default("")}),Wi=h({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:yu,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(-Xn),i=o.map(s=>{let l=s.statusCode==null?"pending":String(s.statusCode),d=s.responseHeaders["content-type"]??"";return`${s.method} ${l} ${s.url} [${d}]`}).join(`
|
|
8
|
+
`),a=r.length>Xn?`
|
|
9
|
+
(showing last ${String(Xn)} of ${String(r.length)})`:"";return{specNode:void 0,stepResult:void 0,toolOutput:`${String(o.length)} network requests:${a}
|
|
10
|
+
${i}`}}})});import{z as qi}from"zod";var gu,Mi,Hi=p(()=>{"use strict";x();gu=qi.object({urlPattern:qi.string().describe("Regex pattern to match the request URL")}),Mi=h({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:gu,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,d])=>` ${l}: ${d}`).join(`
|
|
14
11
|
`),s=o.responseBody??"(no body captured)";return{specNode:void 0,stepResult:void 0,toolOutput:`${o.method} ${i} ${o.url}
|
|
15
12
|
|
|
16
13
|
Response Headers:
|
|
17
14
|
${a}
|
|
18
15
|
|
|
19
16
|
Body:
|
|
20
|
-
${s}`}}})});import{z as
|
|
17
|
+
${s}`}}})});import{z as Ji}from"zod";var hu,zi,Xi=p(()=>{"use strict";x();hu=Ji.object({selector:Ji.string().optional().describe("CSS selector to scope the tree to a subtree (defaults to full page)")}),zi=h({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:hu,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 ku}from"zod";var Su,Gi,Ki=p(()=>{"use strict";x();Su=ku.object({}),Gi=h({description:"Get a text representation of the current page content for inspection",name:"get_page_content",schema:Su,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
18
|
Title: ${o}
|
|
22
19
|
|
|
23
|
-
${n??""}`}}})});import{z as
|
|
20
|
+
${n??""}`}}})});import{z as wu}from"zod";var bu,Qi,Yi=p(()=>{"use strict";x();bu=wu.object({}),Qi=h({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:bu,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
21
|
${r}`).join(`
|
|
25
22
|
|
|
26
23
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(e.monitor.pageErrors.length)} page errors:
|
|
27
24
|
|
|
28
|
-
${n}`}}})});import{z as
|
|
25
|
+
${n}`}}})});import{z as Zi}from"zod";async function Ru(e){let t=await e.context().cookies();if(t.length===0)return`## Cookies
|
|
29
26
|
(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
27
|
${n.join(`
|
|
31
|
-
`)}`}async function
|
|
32
|
-
${String(n)}`}var
|
|
28
|
+
`)}`}async function ea(e,t){let n=await e.evaluate(`JSON.stringify(Object.fromEntries(Object.entries(${t})))`);return`## ${t}
|
|
29
|
+
${String(n)}`}var Au,ta,na=p(()=>{"use strict";x();Au=Zi.object({type:Zi.enum(["all","cookies","localStorage","sessionStorage"]).describe("Which storage to retrieve").default("all")}),ta=h({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:Au,execute:async(e,t)=>({specNode:void 0,stepResult:void 0,toolOutput:[...t.type==="all"||t.type==="cookies"?[await Ru(e.page)]:[],...t.type==="all"||t.type==="localStorage"?[await ea(e.page,"localStorage")]:[],...t.type==="all"||t.type==="sessionStorage"?[await ea(e.page,"sessionStorage")]:[]].join(`
|
|
33
30
|
|
|
34
|
-
`)})})});import{z as
|
|
31
|
+
`)})})});import{z as Gn}from"zod";var Tu,ra,oa=p(()=>{"use strict";x();Tu=Gn.object({action:Gn.enum(["accept","dismiss"]).describe("Whether to accept or dismiss the dialog"),promptText:Gn.string().optional().describe("Text to enter for prompt dialogs")}),ra=h({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:Tu,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 R({assertions:[],detail:`Dialog handler set: ${t.action}`,duration:performance.now()-n,nodeType:"handleDialog",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Handle dialog: ${t.action}`})}})});import{z as ia}from"zod";var Nu,aa,sa=p(()=>{"use strict";x();Nu=ia.object({selector:ia.string().describe("CSS selector for the element to hover over")}),aa=h({description:"Hover over an element matching the CSS selector",name:"hover",schema:Nu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).hover({timeout:5e3}),R({assertions:[],detail:`Hovered over ${t.selector}`,duration:performance.now()-n,nodeType:"hover",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Hover ${t.selector}`})}})});import{z as Kn}from"zod";var vu,la,da=p(()=>{"use strict";x();vu=Kn.object({permission:Kn.string().describe("Permission name (e.g. geolocation, notifications, camera, clipboard-read)"),state:Kn.enum(["granted","prompt"]).describe("Permission state to set")}),la=h({description:"Set a browser permission state (geolocation, notifications, camera, etc.)",name:"set_permission",schema:vu,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 R({assertions:[],detail:`Set ${t.permission} to ${t.state}`,duration:performance.now()-n,nodeType:"setPermission",page:e.page,runStartTime:e.runStartTime,specNode:i,status:"passed",stepIndex:e.stepIndex,title:`Set permission: ${t.permission} \u2192 ${t.state}`})}})});import{z as ca}from"zod";var Cu,pa,ua=p(()=>{"use strict";x();Cu=ca.object({url:ca.string().describe("The URL to navigate to")}),pa=h({description:"Navigate the browser to a URL",name:"navigate",schema:Cu,execute:async(e,t)=>{let n=performance.now();await e.page.goto(t.url,{waitUntil:"domcontentloaded"});let o={id:`agent-step-${String(e.stepIndex)}`,type:"goto",url:{type:"static",value:t.url}};return R({assertions:[],detail:`Navigated to ${t.url}`,duration:performance.now()-n,nodeType:"goto",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Navigate to ${t.url}`})}})});import{z as ma}from"zod";var Lu,fa,ya=p(()=>{"use strict";x();Lu=ma.object({key:ma.string().describe("Key to press, e.g. 'Enter', 'Tab', 'Escape'")}),fa=h({description:"Press a keyboard key",name:"press",schema:Lu,execute:async(e,t)=>{let n=performance.now();await e.page.keyboard.press(t.key);let o={id:`agent-step-${String(e.stepIndex)}`,key:t.key,type:"press"};return R({assertions:[],detail:`Pressed ${t.key}`,duration:performance.now()-n,nodeType:"press",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Press ${t.key}`})}})});import{z as Qn}from"zod";var Pu,ga,ha=p(()=>{"use strict";x();Pu=Qn.object({height:Qn.number().int().positive().describe("Viewport height in pixels"),width:Qn.number().int().positive().describe("Viewport width in pixels")}),ga=h({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:Pu,execute:async(e,t)=>{let n=performance.now();await e.page.setViewportSize({height:t.height,width:t.width});let r=`agent-step-${String(e.stepIndex)}`,o={height:t.height,id:r,type:"setViewport",width:t.width};return R({assertions:[],detail:`Resized viewport to ${String(t.width)}x${String(t.height)}`,duration:performance.now()-n,nodeType:"setViewport",page:e.page,runStartTime:e.runStartTime,specNode:o,status:"passed",stepIndex:e.stepIndex,title:`Resize viewport to ${String(t.width)}x${String(t.height)}`})}})});import{z as ka}from"zod";var xu,Sa,wa=p(()=>{"use strict";x();xu=ka.object({selector:ka.string().describe("CSS selector for the element to right-click")}),Sa=h({description:"Right-click an element to open the context menu",name:"right_click",schema:xu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).click({button:"right",timeout:5e3}),R({assertions:[],detail:`Right-clicked ${t.selector}`,duration:performance.now()-n,nodeType:"rightClick",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Right-click ${t.selector}`})}})});import{z as ba}from"zod";function Eu(e){let t=e.url.length>0?` (${e.url})`:"";return`[${e.level.toUpperCase()}] ${e.text}${t}`}var Ou,Aa,Ra=p(()=>{"use strict";x();Ou=ba.object({pattern:ba.string().describe("Regex pattern to search console log messages")}),Aa=h({description:"Search console log messages for a regex pattern. Returns matching entries.",name:"search_console",schema:Ou,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=>Eu(i)).join(`
|
|
35
32
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching console messages:
|
|
36
|
-
${o}`}}})});import{z as
|
|
33
|
+
${o}`}}})});import{z as Ta}from"zod";var Iu,Na,va=p(()=>{"use strict";x();Iu=Ta.object({pattern:Ta.string().describe("Regex pattern to search across network request URLs and response bodies")}),Na=h({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:Iu,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
34
|
`);return{specNode:void 0,stepResult:void 0,toolOutput:`${String(r.length)} matching network entries:
|
|
38
|
-
${o}`}}})});import{z as
|
|
39
|
-
`);i.push(
|
|
40
|
-
`),o
|
|
35
|
+
${o}`}}})});import{z as Ca}from"zod";function $u({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),d=Math.min(t.length-1,s+e),c=t.slice(l,d+1).map((u,y)=>{let S=l+y+1;return`${l+y===s?">":" "} ${String(S)}: ${u}`}).join(`
|
|
36
|
+
`);i.push(c)}),i}var _u,Uu,ju,La,Pa=p(()=>{"use strict";x();_u=20,Uu=2,ju=Ca.object({pattern:Ca.string().describe("Regex pattern to search for in the page HTML")}),La=h({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:ju,execute:async(e,t)=>{let r=(await e.page.content()).split(`
|
|
37
|
+
`),o=$u({contextLines:Uu,lines:r,maxResults:_u,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
38
|
---
|
|
42
|
-
`)}}})});import{z as
|
|
43
|
-
${
|
|
44
|
-
`)});import
|
|
39
|
+
`)}}})});import{z as Yn}from"zod";var Du,xa,Oa=p(()=>{"use strict";x();Du=Yn.object({selector:Yn.string().describe("CSS selector for the select element"),value:Yn.string().describe("The option value to select")}),xa=h({description:"Select an option from a dropdown/select element",name:"select",schema:Du,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).selectOption(t.value,{timeout:5e3}),R({assertions:[],detail:`Selected "${t.value}" in ${t.selector}`,duration:performance.now()-n,nodeType:"select",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Select ${t.value}`})}})});import{z as Ea}from"zod";var Bu,Ia,_a=p(()=>{"use strict";x();Bu=Ea.object({selector:Ea.string().describe("CSS selector for the checkbox to uncheck")}),Ia=h({description:"Uncheck a checkbox matching the CSS selector",name:"uncheck",schema:Bu,execute:async(e,t)=>{let n=performance.now();return await e.page.locator(t.selector).uncheck({timeout:5e3}),R({assertions:[],detail:`Unchecked ${t.selector}`,duration:performance.now()-n,nodeType:"uncheck",page:e.page,runStartTime:e.runStartTime,specNode:void 0,status:"passed",stepIndex:e.stepIndex,title:`Uncheck ${t.selector}`})}})});function yt(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 y=new jt(u);o.set(u,y),n.push(y)}function s(u){let y=o.get(u.request());y!=null&&(o.delete(u.request()),y.applyResponse(u))}function l(u){r.push(`${u.message}
|
|
40
|
+
${u.stack??""}`)}function d(u){let y=u.failure(),S=new jt(u);S.responseBody=`(request failed: ${y?.errorText??"unknown"})`,n.push(S)}e.on("console",i),e.on("request",a),e.on("response",s),e.on("pageerror",l),e.on("requestfailed",d);function c(){e.off("console",i),e.off("request",a),e.off("response",s),e.off("pageerror",l),e.off("requestfailed",d)}return{consoleEntries:t,detach:c,networkEntries:n,pageErrors:r}}var jt,Zn=p(()=>{"use strict";jt=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 ja({input:e,monitor:t,name:n,page:r,runStartTime:o,stepIndex:i}){let a=Vu.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 er,Vu,tr,Ua,$a=p(()=>{"use strict";si();ci();ui();fi();hi();wi();Ri();vi();Li();Oi();_i();ji();Bi();Fi();Hi();Xi();Ki();Yi();na();oa();sa();da();ua();ya();ha();wa();Ra();va();Pa();Oa();_a();Zn();er=[pa,Ni,Ui,fa,Si,Ia,xa,aa,Gi,La,Ai,Sa,ra,Ci,la,gi,pi,mi,ai,di,Di,Wi,Mi,Qi,zi,ta,Aa,Na,ga,Ii,xi],Vu=new Map(er.map(e=>[e.name,e])),tr=er.map(e=>e.anthropicTool),Ua=er.map(e=>`- **${e.name}**: ${e.anthropicTool.description??""}`).join(`
|
|
41
|
+
`)});import Da from"fs";import Wu from"path";import nr from"pino";function rr({filePath:e}){let t=Wu.dirname(e);Da.mkdirSync(t,{recursive:!0}),Da.writeFileSync(e,"");let n=nr.destination({dest:e,sync:!0}),r=nr({level:"info"},n);g.info=r.info.bind(r),g.warn=r.warn.bind(r),g.error=r.error.bind(r),g.debug=r.debug.bind(r),g.fatal=r.fatal.bind(r),g.trace=r.trace.bind(r)}var g,K=p(()=>{"use strict";g=nr({transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}})});import Fu from"@anthropic-ai/sdk";async function or({baseUrl:e,executedPreconditions:t,extraVariables:n,onStep:r,page:o,runId:i,serverUrl:a,spec:s,systemPrompt:l,token:d,workflowContext:c}){let u=new Fu({apiKey:"ripplo",baseURL:`${a}/api/proxy/anthropic`,defaultHeaders:{Authorization:`Bearer ${d}`,"x-run-id":i}}),y=performance.now(),S=yt(o);await Qu({baseUrl:e,page:o});let w=Ju({extraVariables:n,spec:s}),k=Xu({baseUrl:e,executedPreconditions:t,spec:s,systemPrompt:l,variables:w,workflowContext:c}),A=Gu({baseUrl:e,spec:s,variables:w}),O=[{content:Ku({page:o,startUrl:A}),role:"user"}],W=[],U=[],j={findings:"",stepIndex:0,verdict:void 0};j=await Mu({client:u,messages:O,monitor:S,onStep:r,page:o,runStartTime:y,specNodes:U,state:j,steps:W,system:k}),j.verdict==null&&(j=await Hu({client:u,messages:O,monitor:S,onStep:r,page:o,runStartTime:y,specNodes:U,state:j,steps:W,system:k}));let ae=Zu(U);return{findings:j.findings,generatedSpec:ae,monitor:S,steps:W,verdict:j.verdict??"fail"}}function Va({result:e,state:t}){return{findings:e.newFindings.length>0?e.newFindings:t.findings,stepIndex:e.nextStepIndex,verdict:e.verdict??t.verdict}}async function Mu({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:s,steps:l,system:d}){let c=s;for(let u=0;u<qu;u++){g.info("Agent iteration %d",u+1);let y=await e.messages.create({max_tokens:Ba,messages:t,model:"server-controlled",system:d,tools:tr}),S=await Wa({messages:t,monitor:n,onStep:r,page:o,response:y,runStartTime:i,specNodes:a,stepIndex:c.stepIndex,steps:l});if(c=Va({result:S,state:c}),!S.continueLoop)break}return c}async function Hu({client:e,messages:t,monitor:n,onStep:r,page:o,runStartTime:i,specNodes:a,state:s,steps:l,system:d}){g.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 c=await e.messages.create({max_tokens:Ba,messages:t,model:"server-controlled",system:d,tool_choice:{name:"complete_test",type:"tool"},tools:tr}),u=await Wa({messages:t,monitor:n,onStep:r,page:o,response:c,runStartTime:i,specNodes:a,stepIndex:s.stepIndex,steps:l});return Va({result:u,state:s})}function Ju({extraVariables:e,spec:t}){let n=zu(e,t?.variableNamespaces);return{...ut({defs:t?.variables}),...n}}function zu(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 Xu({baseUrl:e,executedPreconditions:t,spec:n,systemPrompt:r,variables:o,workflowContext:i}){let a=i==null?"":[`
|
|
45
42
|
|
|
46
43
|
## Workflow Under Test`,`**Name:** ${i.name}`,`**Description:** ${i.description}`,`**Expected Outcome:** ${i.expectedOutcome}`,`
|
|
47
44
|
Focus your testing ONLY on this specific workflow. Do not test unrelated parts of the application.`].join(`
|
|
@@ -50,66 +47,73 @@ Focus your testing ONLY on this specific workflow. Do not test unrelated parts o
|
|
|
50
47
|
Reference workflow spec (the steps a user would follow):
|
|
51
48
|
\`\`\`json
|
|
52
49
|
${JSON.stringify(n,null,2)}
|
|
53
|
-
\`\`\``,l=t.map(
|
|
54
|
-
`),
|
|
50
|
+
\`\`\``,l=t.map(S=>`- ${S}`).join(`
|
|
51
|
+
`),d=t.length===0?"":`
|
|
55
52
|
|
|
56
53
|
## Setup Already Completed
|
|
57
54
|
The following setup steps have already been run before your session started:
|
|
58
55
|
${l}
|
|
59
56
|
|
|
60
|
-
Do not repeat any of these steps.`,
|
|
61
|
-
`),
|
|
57
|
+
Do not repeat any of these steps.`,c=Object.entries(o),u=c.map(([S,w])=>`- **${S}:** ${typeof w=="object"?JSON.stringify(w):String(w)}`).join(`
|
|
58
|
+
`),y=c.length===0?"":`
|
|
62
59
|
|
|
63
60
|
## Resolved Variables
|
|
64
|
-
${
|
|
65
|
-
## Available Tools`,
|
|
61
|
+
${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.",`
|
|
62
|
+
## Available Tools`,Ua,a,d,s,y,`
|
|
66
63
|
## Agent Profile (HIGHEST PRIORITY \u2014 these instructions override any defaults above)`,r].join(`
|
|
67
|
-
`)}function
|
|
68
|
-
`),nextStepIndex:s,verdict:void 0};let
|
|
69
|
-
`);return{continueLoop:
|
|
64
|
+
`)}function Gu({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 Ku({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 Qu({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?(g.warn("Blocked navigation to off-origin URL: %s",o.url()),r.abort("blockedbyclient")):r.continue()})}async function Wa({messages:e,monitor:t,onStep:n,page:r,response:o,runStartTime:i,specNodes:a,stepIndex:s,steps:l}){let d=o.content.filter(A=>A.type==="text").map(A=>A.text),c=o.content.filter(A=>A.type==="tool_use");if(c.length===0)return{continueLoop:!1,newFindings:d.join(`
|
|
65
|
+
`),nextStepIndex:s,verdict:void 0};let u=[],y=s,S,w;for(let A of c){let T=await Yu({block:A,monitor:t,onStep:n,page:r,runStartTime:i,specNodes:a,stepIndex:y,steps:l});u.push(T.toolResult),y=T.nextStepIndex,T.verdict!=null&&(S=T.verdict,w=T.summary)}e.push({content:o.content,role:"assistant"},{content:u,role:"user"});let k=w??d.join(`
|
|
66
|
+
`);return{continueLoop:S==null&&o.stop_reason==="tool_use",newFindings:k,nextStepIndex:y,verdict:S}}async function Yu({block:e,monitor:t,onStep:n,page:r,runStartTime:o,specNodes:i,stepIndex:a,steps:s}){try{let l=await ja({input:e.input,monitor:t,name:e.name,page:r,runStartTime:o,stepIndex:a}),d={content:l.toolOutput,tool_use_id:e.id,type:"tool_result"};return l.kind==="verdict"?(g.info(" [%d] %s \u2014 verdict: %s",a,e.name,l.verdict),{nextStepIndex:a,summary:l.summary,toolResult:d,verdict:l.verdict}):(l.specNode!=null&&i.push(l.specNode),l.stepResult!=null?(s.push(l.stepResult),n?.(l.stepResult),g.info(" [%d] %s \u2014 %s",a,e.name,l.stepResult.status),{nextStepIndex:a+1,summary:void 0,toolResult:d,verdict:void 0}):(g.info(" [%d] %s \u2014 info",a,e.name),{nextStepIndex:a,summary:void 0,toolResult:d,verdict:void 0}))}catch(l){let d=l instanceof Error?l.message:"Unknown error";g.error(" [%d] %s \u2014 error: %s",a,e.name,d);let c=await Ee({page:r,runStartTime:o,targets:[]}),u={annotations:c.annotations,assertions:[],detail:`Error: ${d}`,duration:0,nodeId:`agent-step-${String(a)}`,nodeType:"click",recordingEndMs:void 0,recordingStartMs:void 0,snapshotTimestamp:c.snapshotTimestamp,status:"failed",stepIndex:a,title:`${e.name} (error)`,url:c.url,viewportHeight:c.viewportHeight,viewportWidth:c.viewportWidth};return s.push(u),n?.(u),{nextStepIndex:a+1,summary:void 0,toolResult:{content:`Error: ${d}`,is_error:!0,tool_use_id:e.id,type:"tool_result"},verdict:void 0}}}function Zu(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 qu,Ba,ir=p(()=>{"use strict";$a();K();ft();Oe();qu=50,Ba=16384});function ar({description:e,output:t,successCriteria:n}){let r=[`## Agent Identity
|
|
70
67
|
${e}`];t!=null&&t.length>0&&r.push(`## Output
|
|
71
68
|
${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.',
|
|
69
|
+
${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.',em({hasSuccessCriteria:n!=null&&n.length>0}),tm({hasOutput:t!=null&&t.length>0})];return r.push(o.join(`
|
|
73
70
|
`)),r.join(`
|
|
74
71
|
|
|
75
|
-
`)}function
|
|
72
|
+
`)}function em({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 tm({hasOutput:e}){return e?'The `summary` parameter is the ONLY output the user will see. You MUST use the `summary` field for EXACTLY the output described in the "Output" section above \u2014 nothing else. Do not describe what you did, do not list steps, do not add a test summary. The `summary` must contain ONLY what the Output section asks for, word for word if it specifies exact text.':"Include a brief summary of what you found in the `summary` parameter."}var sr=p(()=>{"use strict"});import{execFile as nm}from"child_process";import{createRequire as rm}from"module";import Fa from"fs";import qa from"path";import{chromium as Ma}from"playwright";async function Ie({headed:e}){process.env.PW_TEST_SCREENSHOT_NO_FONTS_READY="1";try{return await Ma.launch({headless:!e})}catch(t){throw om(t)?new Error(`Playwright browsers are not installed. Run:
|
|
76
73
|
|
|
77
74
|
npx playwright install chromium
|
|
78
|
-
`):t}}async function
|
|
75
|
+
`):t}}async function lr(){let e=Ma.executablePath();if(Fa.existsSync(e))return;g.info("Chromium not found. Installing via Playwright...");let t=rm(import.meta.url),n=qa.dirname(t.resolve("playwright/package.json")),r=qa.join(n,"cli.js");if(await new Promise((o,i)=>{nm(process.execPath,[r,"install","chromium"],a=>{if(a!=null){i(new Error(`Playwright install failed: ${a.message}`));return}o()})}),!Fa.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
|
|
79
76
|
|
|
80
77
|
npx playwright install chromium
|
|
81
|
-
`);
|
|
78
|
+
`);g.info("\u2713 Chromium installed")}function om(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}var gt=p(()=>{"use strict";K()});import{mkdir as dr,writeFile as fe}from"fs/promises";import ne from"path";async function $t({context:e,page:t,runId:n,stepIndex:r,stepResult:o}){try{let i=ne.join(process.cwd(),".ripplo","debug",n,"steps",String(r));await dr(i,{recursive:!0});let a={annotations:o.annotations,assertions:o.assertions,detail:o.detail,duration:o.duration,nodeId:o.nodeId,nodeType:o.nodeType,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth};await Promise.all([fe(ne.join(i,"info.json"),JSON.stringify(a,null,2)),im({context:e,page:t,stepDir:i})])}catch(i){let a=i instanceof Error?i.message:String(i);g.warn("Failed to write step debug data for step %d: %s",r,a)}}async function im({context:e,page:t,stepDir:n}){let[r,o,i,a]=await Promise.all([t.content().catch(()=>"(unable to capture DOM)"),am(t),sm({context:e,page:t}),t.screenshot({fullPage:!1}).catch(()=>{})]);await Promise.all([fe(ne.join(n,"dom.html"),r),fe(ne.join(n,"accessibility-tree.txt"),o),fe(ne.join(n,"storage.json"),JSON.stringify(i,null,2)),a==null?Promise.resolve():fe(ne.join(n,"screenshot.png"),a)])}async function am(e){try{return await e.locator(":root").ariaSnapshot()}catch{return"(unable to capture accessibility tree)"}}async function sm({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 Dt({monitor:e,runId:t,steps:n,summary:r}){try{let o=ne.join(process.cwd(),".ripplo","debug",t);await dr(o,{recursive:!0}),await Promise.all([fe(ne.join(o,"summary.txt"),lm({steps:n,summary:r})),fe(ne.join(o,"console.log"),dm(e.consoleEntries)),fe(ne.join(o,"network.jsonl"),cm(e.networkEntries)),fe(ne.join(o,"page-errors.log"),e.pageErrors.join(`
|
|
82
79
|
---
|
|
83
|
-
`))]),
|
|
84
|
-
`)}function
|
|
85
|
-
`)}function
|
|
86
|
-
`)}async function
|
|
80
|
+
`))]),g.info("Debug artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);g.warn("Failed to write run debug summary: %s",i)}}function lm({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(`
|
|
81
|
+
`)}function dm(e){return e.map(t=>`[${new Date(t.timestamp).toISOString()}] [${t.level.toUpperCase()}] (${t.url}) ${t.text}`).join(`
|
|
82
|
+
`)}function cm(e){return e.map(t=>JSON.stringify(t)).join(`
|
|
83
|
+
`)}async function Ha({error:e,runId:t,stack:n,workflowName:r}){try{let o=ne.join(process.cwd(),".ripplo","debug",t);await dr(o,{recursive:!0});let i=n==null?e:`${e}
|
|
87
84
|
|
|
88
85
|
${n}`,a=[`Run ID: ${t}`,`Workflow: ${r}`,"Status: failed","",`Error: ${e}`,"",n==null?"":`Stack trace:
|
|
89
86
|
${n}`].join(`
|
|
90
|
-
`);await Promise.all([
|
|
87
|
+
`);await Promise.all([fe(ne.join(o,"error.txt"),i),fe(ne.join(o,"summary.txt"),a)]),g.info("Debug error artifacts written to .ripplo/debug/%s/",t)}catch(o){let i=o instanceof Error?o.message:String(o);g.warn("Failed to write error debug artifacts: %s",i)}}var Bt=p(()=>{"use strict";K()});import{readFileSync as pm}from"fs";import{createRequire as um}from"module";import Ja from"path";import{gzipSync as mm}from"zlib";function wm(){return globalThis.__ripploRrwebStartedAt}function bm(){globalThis.__ripploRrwebStart?.()}function Am(){globalThis.__ripploRrwebStop?.()}function Rm(){return globalThis.__ripploRrwebDrain?.()??[]}async function Vt(e){let t,n=0;async function r(){await e.addScriptTag({content:Sm}).catch(()=>{})}await r(),e.on("load",()=>{r()});async function o(){await e.evaluate(bm).catch(()=>{});let l=await e.evaluate(wm).catch(()=>{});typeof l=="number"&&(t??=l)}function i(){if(t!=null)return Date.now()-t}async function a(){let l=await e.evaluate(Rm).catch(()=>[]),d=l[0],c=l.at(-1);if(d==null||c==null)return;t??=d.timestamp;let u=t,y=l.map(k=>JSON.stringify(k)).join(`
|
|
88
|
+
`),w={body:mm(Buffer.from(y,"utf8")),chunkIndex:n,endTimestamp:c.timestamp-u,eventCount:l.length,startTimestamp:d.timestamp-u};return n+=1,w}async function s(){await e.evaluate(Am).catch(()=>{})}return{currentOffsetMs:i,detach:s,start:o,takeChunk:a}}var fm,ym,gm,hm,km,Sm,cr=p(()=>{"use strict";fm=um(import.meta.url),ym=fm.resolve("rrweb"),gm=Ja.join(Ja.dirname(ym),"rrweb.umd.min.cjs"),hm=pm(gm,"utf8"),km=[";(function() {"," try {"," if (window.__ripploRrwebLoaded) return;"," window.__ripploRrwebLoaded = true;"," window.__ripploRrwebBuffer = [];"," window.__ripploRrwebDrain = function() {"," var out = window.__ripploRrwebBuffer;"," window.__ripploRrwebBuffer = [];"," return out;"," };"," var r = window.rrweb;"," if (r == null || r.record == null) {"," console.warn('[ripplo] rrweb global not found');"," return;"," }"," function startRecording() {"," if (window.__ripploRrwebStartedAt != null) return;"," window.__ripploRrwebStartedAt = Date.now();"," var stop = r.record({"," emit: function(event) { window.__ripploRrwebBuffer.push(event); },"," recordCanvas: false,"," recordCrossOriginIframes: false,"," });"," if (r.record.mirror) window.__ripploRrwebMirror = r.record.mirror;"," window.__ripploRrwebStop = stop;"," }"," window.__ripploRrwebStart = startRecording;"," // Auto-start on every bootstrap run so agent-driven tests (which don't"," // emit a 'first step' signal before navigating) capture from the start."," startRecording();"," } catch (err) {"," console.error('[ripplo] rrweb bootstrap failed', err && err.message ? err.message : err);"," }","})();"].join(`
|
|
89
|
+
`),Sm=hm+`
|
|
90
|
+
`+km});async function pr({baseUrl:e,cookies:t,executedPreconditions:n,extraVariables:r,headed:o,runId:i,serverUrl:a,spec:s,streaming:l,systemPrompt:d,token:c,workflowContext:u}){let y=await Ie({headed:o}),S=await y.newContext({baseURL:e});t.length>0&&(await S.addCookies([...t]),g.info("Injected %d cookies from preconditions",t.length));let w=await S.newPage(),k=await Vt(w);async function A(){let W=await k.takeChunk();W!=null&&l.enqueueRecordingChunk(W)}let T=setInterval(()=>{A()},2e3);await k.start();try{let W=function(z){let qe={...z,recordingEndMs:k.currentOffsetMs(),recordingStartMs:z.recordingStartMs??k.currentOffsetMs()};l.enqueueStep(qe),l.flushSteps(),$t({context:S,page:w,runId:i,stepIndex:qe.stepIndex,stepResult:qe})};var O=W;let U=await or({baseUrl:e,executedPreconditions:n,extraVariables:r,onStep:W,page:w,runId:i,serverUrl:a,spec:s,systemPrompt:d,token:c,workflowContext:u}),j=U.verdict==="pass"?"passed":"failed";await l.complete({statusOverride:j,steps:U.steps,summary:U.findings});let ae=U.steps.filter(z=>z.status==="passed").length,q=U.steps.filter(z=>z.status==="failed").length,_={duration:U.steps.reduce((z,qe)=>z+qe.duration,0),failCount:q,passCount:ae,runId:i,status:j,workflowName:u.name};await Dt({monitor:U.monitor,runId:i,steps:U.steps,summary:_}),g.info("Agent test complete: %d passed, %d failed",ae,q),g.info(`
|
|
91
91
|
=== Agent Summary ===
|
|
92
|
-
%s`,
|
|
92
|
+
%s`,U.findings)}finally{clearInterval(T),await k.detach(),await A(),await y.close()}}var ur=p(()=>{"use strict";gt();ir();Bt();K();cr()});async function mr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.textContent({timeout:r});return ht({actual:o??"",expected:e,label:"Text",operator:n})}function Wt({expected:e,operator:t,url:n}){return ht({actual:n,expected:e,label:"URL",operator:t})}async function fr({expected:e,locator:t,operator:n}){let r=await t.count();return es({actual:r,expected:e,label:"Count",operator:n})}async function yr({expected:e,locator:t,operator:n,timeout:r}){let o=await t.inputValue({timeout:r});return ht({actual:o,expected:e,label:"Value",operator:n})}async function gr({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 hr({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 za({attribute:e,expected:t,locator:n,operator:r,timeout:o}){let i=await n.getAttribute(e,{timeout:o});return ht({actual:i??"",expected:t,label:`Attribute "${e}"`,operator:r})}async function Xa({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 Ga({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 Ka({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 Qa({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 Ya({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 Za({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 ht(e){let t=`${e.label} ${e.operator} "${e.expected}"`,n=Tm(e),r=n?void 0:`Got: "${e.actual}"`;return{description:t,detail:r,status:n?"passed":"failed"}}function Tm({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 es(e){let t=`${e.label} ${e.operator} ${String(e.expected)}`,n=Nm(e),r=n?void 0:`Got: ${String(e.actual)}`;return{description:t,detail:r,status:n?"passed":"failed"}}function Nm({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 kr=p(()=>{"use strict"});async function Q({fn:e,label:t}){let n=performance.now(),r=await e();return g.info("%s: %dms",t,Math.round(performance.now()-n)),r}var et=p(()=>{"use strict";K()});async function Sr({headed:e,size:t}){let n=await Q({label:`Prewarmed ${String(t)} browsers`,fn:()=>Promise.all(Array.from({length:t},()=>Ie({headed:e})))}),r=new Set,o=[];function i(){let l=n.pop();return l!=null?(r.add(l),Promise.resolve(l)):new Promise(d=>{o.push(c=>{r.add(c),d(c)})})}function a(l){if(r.delete(l),!l.isConnected()){g.warn("Released browser is disconnected, launching replacement"),Ie({headed:e}).then(c=>{a(c)});return}let d=o.shift();if(d!=null){d(l);return}n.push(l)}async function s(){let l=[...n,...r];n.length=0,r.clear(),await Promise.allSettled(l.map(d=>d.close()))}return{acquire:i,closeAll:s,release:a}}var ts=p(()=>{"use strict";gt();K();et()});import{print as vm}from"graphql";async function L(e){let t=vm(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(Cm)})}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(!Lm(i))throw new Error("Invalid GraphQL response");if(Pm(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 Lm(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function Pm(e){return Array.isArray(e.errors)&&e.errors.length>0}var Cm,kt=p(()=>{"use strict";Cm=15e3});import{readdir as xm,rm as Om,stat as Em}from"fs/promises";import wN from"os";import os from"path";import{graphql as Im}from"gql.tada";async function wr({maxRuns:e}){try{let n=(await xm(ns,{withFileTypes:!0})).filter(d=>d.isDirectory()),r=Date.now(),o=await Promise.all(n.map(async d=>{let c=os.join(ns,d.name),u=await Em(c);return{dirPath:c,mtime:u.mtimeMs}})),i=o.filter(d=>r-d.mtime>rs),s=o.filter(d=>r-d.mtime<=rs).toSorted((d,c)=>c.mtime-d.mtime).slice(e),l=[...i,...s];if(l.length===0)return;await Promise.allSettled(l.map(d=>Om(d.dirPath,{force:!0,recursive:!0}))),g.info("Pruned %d old debug run(s)",l.length)}catch{g.warn("Debug run pruning failed, ignoring")}}var ns,rs,NN,is=p(()=>{"use strict";kt();K();ns=os.join(process.cwd(),".ripplo","debug"),rs=360*60*1e3,NN=Im(`
|
|
93
93
|
mutation RevokeCurrentCliToken {
|
|
94
94
|
revokeCurrentCliToken
|
|
95
95
|
}
|
|
96
|
-
`)});async function
|
|
97
|
-
`))}}var
|
|
98
|
-
`),t}function
|
|
99
|
-
`)}var Es=f(()=>{"use strict";Wr()});import{z as nn}from"zod";function an(e){return Os({legacy:void 0,migrators:[],name:e,schemas:[]})}function Os(e){return{initial:t=>Hr(t,{...e,schemas:[t]}),legacy:t=>Os({...e,legacy:t})}}function Hr(e,t){return{build:()=>Nf(e,t),legacy:n=>Hr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Hr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function Nf(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Cf(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Cf(e,t,n){let{data:r,version:o}=Lf(t,n),i=Is(t,r,o);return e.parse(i)}function Lf(e,t){let n=Tf.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new on({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 Is(e,t,n){let r=e.schemas.length;if(n>r)throw new rn({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 Is(e,a(i),n+1)}var Tf,rn,on,Mr=f(()=>{"use strict";Tf=nn.object({__codec:nn.string().min(1),data:nn.unknown(),version:nn.number().int().positive()}),rn=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}},on=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as lt}from"zod";var Jr,zr=f(()=>{"use strict";Jr=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 De}from"zod";var xf,Pf,j,Xr=f(()=>{"use strict";xf=De.object({by:De.literal("testId"),value:De.string().min(1)}),Pf=De.object({by:De.literal("role"),name:De.string().optional(),role:De.string().min(1)}),j=De.discriminatedUnion("by",[xf,Pf])});import{z as _s}from"zod";var Be,sn,Gr=f(()=>{"use strict";Be=_s.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),sn=_s.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as X}from"zod";var Ef,Kr,ln,ae,cn,Qr=f(()=>{"use strict";Ef=X.object({type:X.literal("static"),value:X.union([X.string(),X.number(),X.boolean()])}),Kr=X.object({name:X.string().min(1),type:X.literal("variable")}),ln=X.discriminatedUnion("type",[Ef,Kr]),ae=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.string()}),Kr]),cn=X.discriminatedUnion("type",[X.object({type:X.literal("static"),value:X.number().int().nonnegative()}),Kr])});import{z as ce}from"zod";var dn,Yr=f(()=>{"use strict";dn=ce.discriminatedUnion("type",[ce.object({default:ce.string().optional(),type:ce.literal("string")}),ce.object({default:ce.number().optional(),type:ce.literal("number")}),ce.object({default:ce.boolean().optional(),type:ce.literal("boolean")}),ce.object({key:ce.string().min(1),type:ce.literal("env")})])});import{z as g}from"zod";var E,Us,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,ay,sy,ly,cy,dy,py,uy,my,fy,yy,js,pn,un=f(()=>{"use strict";Xr();Gr();Qr();Yr();Xr();Gr();Qr();Yr();E={id:g.string().min(1).max(200),label:g.string().max(500).optional(),next:g.string().max(200).optional(),uiOnly:g.boolean().optional()},Us=500,Of=g.object({...E,type:g.literal("goto"),url:ae}),If=g.object({...E,locator:j,type:g.literal("click")}),_f=g.object({...E,locator:j,type:g.literal("fill"),value:ae}),Uf=g.object({...E,locator:j,type:g.literal("select"),value:ae}),jf=g.object({...E,locator:j,type:g.literal("hover")}),$f=g.object({...E,key:g.string().min(1),locator:j.optional(),type:g.literal("press")}),Df=g.object({...E,locator:j,type:g.literal("check")}),Bf=g.object({...E,locator:j,type:g.literal("uncheck")}),Vf=g.object({...E,height:g.number().int().positive(),type:g.literal("setViewport"),width:g.number().int().positive()}),Wf=g.object({...E,message:g.string().min(1),type:g.literal("fail")}),qf=g.object({...E,type:g.literal("setVariable"),value:ln,variable:g.string().min(1)}),Ff=g.object({...E,locator:j,type:g.literal("extractText"),variable:g.string().min(1)}),Hf=g.object({...E,files:g.array(g.string()).min(1),locator:j,type:g.literal("upload")}),Mf=g.object({...E,locator:j,type:g.literal("dblclick")}),Jf=g.object({...E,source:j,target:j,type:g.literal("drag")}),zf=g.object({...E,locator:j,type:g.literal("scrollIntoView")}),Xf=g.object({...E,locator:j,type:g.literal("type"),value:ae}),Gf=g.object({...E,locator:j,type:g.literal("focus")}),Kf=g.object({...E,locator:j,type:g.literal("clear")}),Qf=g.object({...E,locator:j,type:g.literal("rightClick")}),Yf=g.object({...E,action:g.enum(["accept","dismiss"]),promptText:g.string().optional(),type:g.literal("handleDialog")}),Zf=g.object({...E,action:g.enum(["read","write"]),type:g.literal("clipboard"),value:ae.optional(),variable:g.string().min(1).optional()}),ey=g.object({...E,permission:g.string().min(1),state:g.enum(["granted","prompt"]),type:g.literal("setPermission")}),ty=g.object({...E,locator:j,type:g.literal("assertVisible")}),ny=g.object({...E,locator:j,type:g.literal("assertNotVisible")}),ry=g.object({...E,expected:ae,locator:j,operator:Be,type:g.literal("assertText")}),oy=g.object({...E,expected:ae,operator:Be,type:g.literal("assertUrl")}),iy=g.object({...E,expected:cn,locator:j,operator:sn,type:g.literal("assertCount")}),ay=g.object({...E,expected:ae,locator:j,operator:Be,type:g.literal("assertValue")}),sy=g.object({...E,attribute:g.string().min(1),expected:ae,locator:j,operator:Be,type:g.literal("assertAttribute")}),ly=g.object({...E,locator:j,type:g.literal("assertEnabled")}),cy=g.object({...E,locator:j,type:g.literal("assertDisabled")}),dy=g.object({...E,expected:ae,operator:Be,type:g.literal("assertTitle")}),py=g.object({...E,locator:j,type:g.literal("assertChecked")}),uy=g.object({...E,locator:j,type:g.literal("assertNotChecked")}),my=g.object({...E,locator:j,type:g.literal("assertFocused")}),fy=g.object({...E,locator:j,type:g.literal("assertNotFocused")}),yy=g.object({...E,budget:g.enum(["fast","slow","async"]),observer:g.string().min(1).max(200),params:g.record(g.string().max(200),ae),type:g.literal("assertObserver")}),js=g.discriminatedUnion("type",[Of,If,_f,Uf,jf,$f,Df,Bf,ty,ny,ry,oy,iy,ay,sy,ly,cy,Vf,Wf,qf,Ff,Hf,Mf,Jf,zf,Xf,Gf,Kf,Qf,Yf,Zf,ey,dy,py,uy,my,fy,yy]),pn=g.object({entryNode:g.string().min(1).max(200),nodes:g.record(g.string().max(200),js).refine(e=>Object.keys(e).length<=Us,`Workflow has more than ${String(Us)} nodes`),uiOnly:g.boolean().optional(),variableNamespaces:g.record(g.string().max(200),g.string().max(500)).optional(),variables:g.record(g.string().max(200),dn).optional()})});import{z as $s}from"zod";var gy,hy,ky,Zr,Sy,Ds=f(()=>{"use strict";Mr();zr();un();gy=$s.record($s.string().max(200),Jr),hy={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},ky={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},Zr=an("workflow-spec").legacy(hy).initial(pn).build(),Sy=an("precondition-map").legacy(ky).initial(gy).build()});import{z as eo}from"zod";var Bs,wy,Vs=f(()=>{"use strict";Bs=["fast","slow","async"],wy=eo.object({budget:eo.enum(Bs).describe("Polling budget tier: fast | slow | async"),description:eo.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 Ws=f(()=>{"use strict";un()});var qs=f(()=>{"use strict";Mr();Ds();zr();Vs();un();Ws()});var Hs=Wt(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.timingSafeEqual=void 0;function Fs(e,t=""){if(!e)throw new Error(t)}function by(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)),Fs(e instanceof DataView),Fs(t instanceof DataView);let n=e.byteLength,r=0,o=-1;for(;++o<n;)r|=e.getUint8(o)^t.getUint8(o);return r===0}mn.timingSafeEqual=by});var zs=Wt(de=>{"use strict";var Ay=de&&de.__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(de,"__esModule",{value:!0});var H=256,to=(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,p=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)),p=this._decodeChar(t.charCodeAt(a+3)),o[i++]=l<<2|c>>>4,o[i++]=c<<4|d>>>2,o[i++]=d<<6|p,s|=l&H,s|=c&H,s|=d&H,s|=p&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&&(p=this._decodeChar(t.charCodeAt(a+3)),o[i++]=d<<6|p,s|=p&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})();de.Coder=to;var Pt=new to;function Ry(e){return Pt.encode(e)}de.encode=Ry;function vy(e){return Pt.decode(e)}de.decode=vy;var Ms=(function(e){Ay(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})(to);de.URLSafeCoder=Ms;var Js=new Ms;function Ty(e){return Js.encode(e)}de.encodeURLSafe=Ty;function Ny(e){return Js.decode(e)}de.decodeURLSafe=Ny;de.encodedLength=function(e){return Pt.encodedLength(e)};de.maxDecodedLength=function(e){return Pt.maxDecodedLength(e)};de.decodedLength=function(e){return Pt.decodedLength(e)}});var Gs=Wt((Xs,fn)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var o in n)r[o]=n[o];typeof fn=="object"&&typeof fn.exports=="object"?fn.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(Xs,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(p,u,m,h,S){for(var w,k,b,T,x,v,U,O,L,V,Xe,kt,Vt;S>=64;){for(w=u[0],k=u[1],b=u[2],T=u[3],x=u[4],v=u[5],U=u[6],O=u[7],V=0;V<16;V++)Xe=h+V*4,p[V]=(m[Xe]&255)<<24|(m[Xe+1]&255)<<16|(m[Xe+2]&255)<<8|m[Xe+3]&255;for(V=16;V<64;V++)L=p[V-2],kt=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,L=p[V-15],Vt=(L>>>7|L<<25)^(L>>>18|L<<14)^L>>>3,p[V]=(kt+p[V-7]|0)+(Vt+p[V-16]|0);for(V=0;V<64;V++)kt=(((x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7))+(x&v^~x&U)|0)+(O+(t[V]+p[V]|0)|0)|0,Vt=((w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10))+(w&k^w&b^k&b)|0,O=U,U=v,v=x,x=T+kt|0,T=b,b=k,k=w,w=kt+Vt|0;u[0]+=w,u[1]+=k,u[2]+=b,u[3]+=T,u[4]+=x,u[5]+=v,u[6]+=U,u[7]+=O,h+=64,S-=64}return h}var r=(function(){function p(){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 p.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},p.prototype.clean=function(){for(var u=0;u<this.buffer.length;u++)this.buffer[u]=0;for(var u=0;u<this.temp.length;u++)this.temp[u]=0;this.reset()},p.prototype.update=function(u,m){if(m===void 0&&(m=u.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++]=u[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,u,h,m),m%=64);m>0;)this.buffer[this.bufferLength++]=u[h++],m--;return this},p.prototype.finish=function(u){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++)u[b*4+0]=this.state[b]>>>24&255,u[b*4+1]=this.state[b]>>>16&255,u[b*4+2]=this.state[b]>>>8&255,u[b*4+3]=this.state[b]>>>0&255;return this},p.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},p.prototype._saveState=function(u){for(var m=0;m<this.state.length;m++)u[m]=this.state[m]},p.prototype._restoreState=function(u,m){for(var h=0;h<this.state.length;h++)this.state[h]=u[h];this.bytesHashed=m,this.finished=!1,this.bufferLength=0},p})();e.Hash=r;var o=(function(){function p(u){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(u.length>this.blockSize)new r().update(u).finish(m).clean();else for(var h=0;h<u.length;h++)m[h]=u[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 p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var u=0;u<this.istate.length;u++)this.ostate[u]=this.istate[u]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(u){return this.inner.update(u),this},p.prototype.finish=function(u){return this.outer.finished?this.outer.finish(u):(this.inner.finish(u),this.outer.update(u,this.digestLength).finish(u)),this},p.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},p})();e.HMAC=o;function i(p){var u=new r().update(p),m=u.digest();return u.clean(),m}e.hash=i,e.default=i;function a(p,u){var m=new o(p).update(u),h=m.digest();return m.clean(),h}e.hmac=a;function s(p,u,m,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");u.reset(),S>1&&u.update(p),m&&u.update(m),u.update(h),u.finish(p),h[0]++}var l=new Uint8Array(e.digestLength);function c(p,u,m,h){u===void 0&&(u=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),w=a(u,p),k=new o(w),b=new Uint8Array(k.digestLength),T=b.length,x=new Uint8Array(h),v=0;v<h;v++)T===b.length&&(s(b,k,m,S),T=0),x[v]=b[T++];return k.clean(),b.fill(0),S.fill(0),x}e.hkdf=c;function d(p,u,m,h){for(var S=new o(p),w=S.digestLength,k=new Uint8Array(4),b=new Uint8Array(w),T=new Uint8Array(w),x=new Uint8Array(h),v=0;v*w<h;v++){var U=v+1;k[0]=U>>>24&255,k[1]=U>>>16&255,k[2]=U>>>8&255,k[3]=U>>>0&255,S.reset(),S.update(u),S.update(k),S.finish(T);for(var O=0;O<w;O++)b[O]=T[O];for(var O=2;O<=m;O++){S.reset(),S.update(T).finish(T);for(var L=0;L<w;L++)b[L]^=T[L]}for(var O=0;O<w&&v*w+O<h;O++)x[v*w+O]=b[O]}for(var v=0;v<w;v++)b[v]=T[v]=0;for(var v=0;v<4;v++)k[v]=0;return S.clean(),x}e.pbkdf2=d})});var ro=Wt(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.Webhook=ct.WebhookVerificationError=void 0;var Cy=Hs(),Ks=zs(),Ly=Gs(),Qs=300,no=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},Ve=class e extends no{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};ct.WebhookVerificationError=Ve;var yn=class e{constructor(t,n){if(!t)throw new Error("Secret can't be empty.");if(n?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,r=>r.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=Ks.decode(t)}}verify(t,n){let r={};for(let u of Object.keys(n))r[u.toLowerCase()]=n[u];let o=r["webhook-id"],i=r["webhook-signature"],a=r["webhook-timestamp"];if(!i||!o||!a)throw new Ve("Missing required headers");let s=this.verifyTimestamp(a),c=this.sign(o,s,t).split(",")[1],d=i.split(" "),p=new globalThis.TextEncoder;for(let u of d){let[m,h]=u.split(",");if(m==="v1"&&(0,Cy.timingSafeEqual)(p.encode(h),p.encode(c)))return JSON.parse(t.toString())}throw new Ve("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,${Ks.encode(Ly.hmac(this.key,a))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new Ve("Invalid Signature Headers");if(n-r>Qs)throw new Ve("Message timestamp too old");if(r>n+Qs)throw new Ve("Message timestamp too new");return new Date(r*1e3)}};ct.Webhook=yn;yn.prefix="whsec_"});import Ys from"crypto";function We({body:e,secret:t}){let n=new Zs.Webhook(t),r=`msg_${Ys.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 oo(){return`whsec_${Ys.randomBytes(24).toString("base64")}`}var Zs,gn=f(()=>{"use strict";Zs=oi(ro(),1)});import{z as ge}from"zod";async function el({apiUrl:e,budget:t,observer:n,params:r,webhookSecret:o}){let i=Py[t],a=performance.now(),s={lastReason:void 0,pollCount:0};for(;performance.now()-a<i.timeoutMs;){s.pollCount+=1;let l=await _y({apiUrl:e,observer:n,params:r,webhookSecret:o}),c=Iy({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 p=Math.min(Uy({backoff:i.backoffMs,pollCount:s.pollCount}),d);await jy(p)}return{description:`observer "${n}"`,detail:`budget "${t}" exhausted after ${String(s.pollCount)} poll(s) (${tl(a)}); last: ${s.lastReason??"no retry reason"}
|
|
100
|
-
\u2192 /ripplo:debug \u2014 check .ripplo/debug/<runId>/ artifacts`,status:"failed"}}function
|
|
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 (${
|
|
102
|
-
\u2192 /ripplo:create`,status:"failed"}:(r.lastReason=t.reason,null)}async function _y({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",...We({body:o,secret:r})},method:"PUT",signal:AbortSignal.timeout(xy)});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=Oy.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 Uy({backoff:e,pollCount:t}){let n=Math.min(t-1,e.length-1);return e[n]??1e3}function tl(e){return`${String(Math.round(performance.now()-e))}ms`}async function jy(e){return new Promise(t=>setTimeout(t,e))}var xy,Py,Ey,Oy,nl=f(()=>{"use strict";Y();gn();xy=15e4,Py={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:5e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},Ey=ge.discriminatedUnion("kind",[ge.object({kind:ge.literal("pass")}),ge.object({kind:ge.literal("retry"),reason:ge.string()}),ge.object({kind:ge.literal("fail"),reason:ge.string()})]),Oy=ge.object({error:ge.string().optional(),outcome:Ey.optional(),success:ge.boolean()})});async function io({failFast:e,observerTransport:t,onStep:n,page:r,spec:o,variables:i}){let a=performance.now();return By({currentId:o.entryNode,failFast:e,observerTransport:t,onStep:n,page:r,runStartTime:a,spec:o,variables:i})}function Dy({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function By({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 p=a.nodes[d];if(p==null)throw new Error(`Node "${d}" not found in spec`);let u=d,m=p.label??`${p.type} (${d})`;A.info("Executing node: %s [%s]",m,p.type);let h=await Vy({node:p,nodeId:u,observerTransport:n,page:o,runStartTime:i,variables:c});if(Dy({onStep:r,steps:[h],target:l}),c=h.variables,t&&h.status==="failed")break;d=p.next}return{steps:l,variables:c}}async function Vy({node:e,nodeId:t,observerTransport:n,page:r,runStartTime:o,variables:i}){let a=performance.now(),s=e.label??`${e.type} (${e.id})`,l=$y,c=Xt({node:e,page:r});try{let d=await Wy({node:e,observerTransport:n,page:r,timeout:l,variables:i}),p=Math.round(performance.now()-a),u=d.assertions.some(h=>h.status==="failed"),m=await Z({label:`Snapshot [${s}]`,fn:()=>je({page:r,runStartTime:o,targets:c})});return{annotations:m.annotations,assertions:d.assertions,detail:void 0,duration:p,nodeId:t,nodeType:e.type,screenshotBase64:m.screenshotBase64,snapshotTimestamp:m.snapshotTimestamp,status:u?"failed":"passed",stepIndex:0,title:s,url:m.url,variables:d.variables,viewportHeight:m.viewportHeight,viewportWidth:m.viewportWidth}}catch(d){let p=Math.round(performance.now()-a),u=d instanceof Error?d.message:String(d),m=await Z({label:`Snapshot [${s}] (error)`,fn:()=>je({page:r,runStartTime:o,targets:c})});return{annotations:m.annotations,assertions:[],detail:u,duration:p,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 Wy({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(qy(e)){let a=await ir({node:e,page:n,timeout:r,variables:o});return{assertions:[],variables:a.variables}}return{assertions:await Hy({node:e,observerTransport:t,page:n,timeout:r,variables:o}),variables:o}}function qy(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 Fy(e){return e.type.startsWith("assert")}async function Hy({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(!Fy(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=oe({ref:i.expected,variables:o});return[await xr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertUrl":{let a=oe({ref:i.expected,variables:o});return[en({expected:a,operator:i.operator,url:n.url()})]}case"assertTitle":{let a=oe({ref:i.expected,variables:o});return[en({expected:a,operator:i.operator,url:await n.title()})]}case"assertCount":{let a=or({ref:i.expected,variables:o});return[await Pr({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator})]}case"assertValue":{let a=oe({ref:i.expected,variables:o});return[await Er({expected:a,locator:F({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertAttribute":{let a=oe({ref:i.expected,variables:o});return[await ks({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]=oe({ref:l,variables:o})}),[await el({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=My[e.type];return[await o({locator:F({locator:e.locator,page:t,variables:r}),timeout:n})]}var $y,My,ao=f(()=>{"use strict";ar();nl();_r();at();Y();st();Tt();Ue();$y=1e4;My={assertChecked:bs,assertDisabled:ws,assertEnabled:Ss,assertFocused:Rs,assertNotChecked:As,assertNotFocused:vs,assertNotVisible:Ir,assertVisible:Or}});async function so({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=Nt(c),p=[];function u(T){i?.(T),p.push(Qt({context:l,page:c,runId:a,stepIndex:T.stepIndex,stepResult:T}))}let m=zy(r,s.variableNamespaces),h={...Rt({defs:s.variables}),...m};A.info("Starting graph execution (entry: %s)",s.entryNode);let S=await io({failFast:!0,observerTransport:o,onStep:u,page:c,spec:s,variables:h});await Promise.allSettled(p);let w=S.steps.filter(T=>T.status==="passed").length,k=S.steps.filter(T=>T.status==="failed").length,b={duration:S.steps.reduce((T,x)=>T+x.duration,0),failCount:k,passCount:w,runId:a,status:k>0?"failed":"passed",workflowName:""};return await Yt({monitor:d,runId:a,steps:S.steps,summary:b}),await l.close(),S.steps}function zy(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 lo=f(()=>{"use strict";gr();Zt();ao();Y();Ue()});import{parseSetCookie as Xy}from"set-cookie-parser";import{z as pe}from"zod";async function co({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:ol({apiUrl:i,preconditionNames:a,webhookSecret:t})}async function po({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",...Zy({cookies:t}),...We({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(rl)});a.ok||A.error("Teardown returned %s",String(a.status))}catch{A.error("Teardown request failed")}}async function ol({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",...We({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(rl)});if(!i.ok){let c=await Qy(i);throw new Error(`execute-preconditions returned ${String(i.status)}: ${c}`)}let a=await i.json(),s=Gy.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=eg({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 Qy(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=Yy(t),r=n==null?null:Ky.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function Yy(e){try{return JSON.parse(e)}catch{return null}}function Zy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function eg({domain:e,res:t}){let n=t.headers.getSetCookie();return Xy(n,{decodeValues:!1}).map(o=>tg({cookie:o,domain:e}))}function tg({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=rg({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 rg({raw:e}){return ng[e.toLowerCase()]??"Lax"}async function uo({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:[]}:ol({apiUrl:r,preconditionNames:t,webhookSecret:n})}var rl,Gy,Ky,ng,mo=f(()=>{"use strict";Y();gn();rl=3e4,Gy=pe.object({data:pe.record(pe.string(),pe.record(pe.string(),pe.string())),error:pe.string().optional(),executed:pe.array(pe.string()),runId:pe.string(),success:pe.boolean()});Ky=pe.object({error:pe.string()});ng={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as fo}from"gql.tada";async function yo({agentProfileId:e,config:t,runId:n}){let r=await _({config:t,document:ig,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=og({config:t,runResultId:o,steps:[c]}).catch(p=>{A.error(p,"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:p}){await Z({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let u=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:sg,variables:{duration:h,failCount:m,passCount:u,runResultId:o,status:S,summary:p??null,warnCount:0}})})}return{complete:l,enqueueStep:a,flushSteps:s,runResultId:o}}async function og({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:ag,variables:{runResultId:t,steps:r}})}var ig,ag,sg,go=f(()=>{"use strict";xt();Y();st();ig=fo(`
|
|
96
|
+
`)});async function br({appUrl:e}){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(_m)})}catch(t){let n=t instanceof Error?t.message:String(t);throw g.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 _m,Ar=p(()=>{"use strict";K();_m=5e3});import Ft from"fs";import Rr from"path";function Tr(e){return Rr.join(e,".ripplo",Um)}function Me(e){let t=Tr(e);Ft.existsSync(t)||Ft.mkdirSync(t,{recursive:!0});let n=Rr.join(t,".gitignore");return Ft.existsSync(n)||Ft.writeFileSync(n,`*
|
|
98
|
+
`),t}function ke(e,t){return Rr.join(Tr(e),t)}var Um,Nr=p(()=>{"use strict";Um=".local"});import vr from"fs";function ye(e){let t=ke(e,"token");if(!vr.existsSync(t))return null;let n=vr.readFileSync(t,"utf8").trim();return n.length===0?null:n}function Cr(e,t){Me(e),vr.writeFileSync(ke(e,"token"),t+`
|
|
99
|
+
`)}var as=p(()=>{"use strict";Nr()});import{z as qt}from"zod";function Jt(e){return ss({legacy:void 0,migrators:[],name:e,schemas:[]})}function ss(e){return{initial:t=>Lr(t,{...e,schemas:[t]}),legacy:t=>ss({...e,legacy:t})}}function Lr(e,t){return{build:()=>$m(e,t),legacy:n=>Lr(e,{...t,legacy:n}),upgrade:(n,r)=>{let o=r;return Lr(n,{...t,migrators:[...t.migrators,o],schemas:[...t.schemas,n]})}}}function $m(e,t){let n=t.schemas.length;return{currentVersion:n,name:t.name,decode:r=>Dm(e,t,r),encode:r=>({__codec:t.name,data:r,version:n})}}function Dm(e,t,n){let{data:r,version:o}=Bm(t,n),i=ls(t,r,o);return e.parse(i)}function Bm(e,t){let n=jm.safeParse(t);if(n.success){if(n.data.__codec!==e.name)throw new Ht({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 Mt({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 jm,Mt,Ht,Pr=p(()=>{"use strict";jm=qt.object({__codec:qt.string().min(1),data:qt.unknown(),version:qt.number().int().positive()}),Mt=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}},Ht=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}}});import{z as tt}from"zod";var xr,Or=p(()=>{"use strict";xr=tt.object({depends:tt.array(tt.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:tt.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:tt.array(tt.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name.")});import{z as _e}from"zod";var Vm,Wm,P,Er=p(()=>{"use strict";Vm=_e.object({by:_e.literal("testId"),value:_e.string().min(1)}),Wm=_e.object({by:_e.literal("role"),name:_e.string().optional(),role:_e.string().min(1)}),P=_e.discriminatedUnion("by",[Vm,Wm])});import{z as ds}from"zod";var Ue,zt,Ir=p(()=>{"use strict";Ue=ds.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),zt=ds.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"])});import{z as H}from"zod";var Fm,_r,Xt,re,Gt,Ur=p(()=>{"use strict";Fm=H.object({type:H.literal("static"),value:H.union([H.string(),H.number(),H.boolean()])}),_r=H.object({name:H.string().min(1),type:H.literal("variable")}),Xt=H.discriminatedUnion("type",[Fm,_r]),re=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.string()}),_r]),Gt=H.discriminatedUnion("type",[H.object({type:H.literal("static"),value:H.number().int().nonnegative()}),_r])});import{z as le}from"zod";var Kt,jr=p(()=>{"use strict";Kt=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 f}from"zod";var v,cs,qm,Mm,Hm,Jm,zm,Xm,Gm,Km,Qm,Ym,Zm,ef,tf,nf,rf,of,af,sf,lf,df,cf,pf,uf,mf,ff,yf,gf,hf,kf,Sf,wf,bf,Af,Rf,Tf,Nf,vf,Cf,ps,Qt,Yt=p(()=>{"use strict";Er();Ir();Ur();jr();Er();Ir();Ur();jr();v={id:f.string().min(1).max(200),label:f.string().max(500).optional(),next:f.string().max(200).optional(),uiOnly:f.boolean().optional()},cs=500,qm=f.object({...v,type:f.literal("goto"),url:re}),Mm=f.object({...v,locator:P,type:f.literal("click")}),Hm=f.object({...v,locator:P,type:f.literal("fill"),value:re}),Jm=f.object({...v,locator:P,type:f.literal("select"),value:re}),zm=f.object({...v,locator:P,type:f.literal("hover")}),Xm=f.object({...v,key:f.string().min(1),locator:P.optional(),type:f.literal("press")}),Gm=f.object({...v,locator:P,type:f.literal("check")}),Km=f.object({...v,locator:P,type:f.literal("uncheck")}),Qm=f.object({...v,height:f.number().int().positive(),type:f.literal("setViewport"),width:f.number().int().positive()}),Ym=f.object({...v,message:f.string().min(1),type:f.literal("fail")}),Zm=f.object({...v,type:f.literal("setVariable"),value:Xt,variable:f.string().min(1)}),ef=f.object({...v,locator:P,type:f.literal("extractText"),variable:f.string().min(1)}),tf=f.object({...v,files:f.array(f.string()).min(1),locator:P,type:f.literal("upload")}),nf=f.object({...v,locator:P,type:f.literal("dblclick")}),rf=f.object({...v,source:P,target:P,type:f.literal("drag")}),of=f.object({...v,locator:P,type:f.literal("scrollIntoView")}),af=f.object({...v,locator:P,type:f.literal("type"),value:re}),sf=f.object({...v,locator:P,type:f.literal("focus")}),lf=f.object({...v,locator:P,type:f.literal("clear")}),df=f.object({...v,locator:P,type:f.literal("rightClick")}),cf=f.object({...v,action:f.enum(["accept","dismiss"]),promptText:f.string().optional(),type:f.literal("handleDialog")}),pf=f.object({...v,action:f.enum(["read","write"]),type:f.literal("clipboard"),value:re.optional(),variable:f.string().min(1).optional()}),uf=f.object({...v,permission:f.string().min(1),state:f.enum(["granted","prompt"]),type:f.literal("setPermission")}),mf=f.object({...v,locator:P,type:f.literal("assertVisible")}),ff=f.object({...v,locator:P,type:f.literal("assertNotVisible")}),yf=f.object({...v,expected:re,locator:P,operator:Ue,type:f.literal("assertText")}),gf=f.object({...v,expected:re,operator:Ue,type:f.literal("assertUrl")}),hf=f.object({...v,expected:Gt,locator:P,operator:zt,type:f.literal("assertCount")}),kf=f.object({...v,expected:re,locator:P,operator:Ue,type:f.literal("assertValue")}),Sf=f.object({...v,attribute:f.string().min(1),expected:re,locator:P,operator:Ue,type:f.literal("assertAttribute")}),wf=f.object({...v,locator:P,type:f.literal("assertEnabled")}),bf=f.object({...v,locator:P,type:f.literal("assertDisabled")}),Af=f.object({...v,expected:re,operator:Ue,type:f.literal("assertTitle")}),Rf=f.object({...v,locator:P,type:f.literal("assertChecked")}),Tf=f.object({...v,locator:P,type:f.literal("assertNotChecked")}),Nf=f.object({...v,locator:P,type:f.literal("assertFocused")}),vf=f.object({...v,locator:P,type:f.literal("assertNotFocused")}),Cf=f.object({...v,budget:f.enum(["fast","slow","async"]),observer:f.string().min(1).max(200),params:f.record(f.string().max(200),re),type:f.literal("assertObserver")}),ps=f.discriminatedUnion("type",[qm,Mm,Hm,Jm,zm,Xm,Gm,Km,mf,ff,yf,gf,hf,kf,Sf,wf,bf,Qm,Ym,Zm,ef,tf,nf,rf,of,af,sf,lf,df,cf,pf,uf,Af,Rf,Tf,Nf,vf,Cf]),Qt=f.object({entryNode:f.string().min(1).max(200),nodes:f.record(f.string().max(200),ps).refine(e=>Object.keys(e).length<=cs,`Workflow has more than ${String(cs)} nodes`),uiOnly:f.boolean().optional(),variableNamespaces:f.record(f.string().max(200),f.string().max(500)).optional(),variables:f.record(f.string().max(200),Kt).optional()})});import{z as us}from"zod";var Lf,Pf,xf,$r,Of,ms=p(()=>{"use strict";Pr();Or();Yt();Lf=us.record(us.string().max(200),xr),Pf={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},xf={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},$r=Jt("workflow-spec").legacy(Pf).initial(Qt).build(),Of=Jt("precondition-map").legacy(xf).initial(Lf).build()});import{z as Dr}from"zod";var fs,Ef,ys=p(()=>{"use strict";fs=["fast","slow","async"],Ef=Dr.object({budget:Dr.enum(fs).describe("Polling budget tier: fast | slow | async"),description:Dr.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 gs=p(()=>{"use strict";Yt()});var hs=p(()=>{"use strict";Pr();ms();Or();ys();Yt();gs()});import ks from"crypto";import{Webhook as If}from"standardwebhooks";function je({body:e,secret:t}){let n=new If(t),r=`msg_${ks.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 Br(){return`whsec_${ks.randomBytes(24).toString("base64")}`}var Zt=p(()=>{"use strict"});import{z as ue}from"zod";async function Ss({apiUrl:e,budget:t,observer:n,params:r,webhookSecret:o}){let i=Uf[t],a=performance.now(),s={lastReason:void 0,pollCount:0};for(;performance.now()-a<i.timeoutMs;){s.pollCount+=1;let l=await Bf({apiUrl:e,observer:n,params:r,webhookSecret:o}),d=Df({observer:n,outcome:l,start:a,state:s});if(d!=null)return d;let c=i.timeoutMs-(performance.now()-a);if(c<=0)break;let u=Math.min(Vf({backoff:i.backoffMs,pollCount:s.pollCount}),c);await Wf(u)}return{description:`observer "${n}"`,detail:`budget "${t}" exhausted after ${String(s.pollCount)} poll(s) (${ws(a)}); last: ${s.lastReason??"no retry reason"}
|
|
100
|
+
\u2192 /ripplo:debug \u2014 check .ripplo/debug/<runId>/ artifacts`,status:"failed"}}function Df({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
|
+
\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 (${ws(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 Bf({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",...je({body:o,secret:r})},method:"PUT",signal:AbortSignal.timeout(_f)});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=$f.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 g.error("observer request failed: %s",a),{kind:"transport-error",reason:a}}}function Vf({backoff:e,pollCount:t}){let n=Math.min(t-1,e.length-1);return e[n]??1e3}function ws(e){return`${String(Math.round(performance.now()-e))}ms`}async function Wf(e){return new Promise(t=>setTimeout(t,e))}var _f,Uf,jf,$f,bs=p(()=>{"use strict";K();Zt();_f=15e4,Uf={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:5e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},jf=ue.discriminatedUnion("kind",[ue.object({kind:ue.literal("pass")}),ue.object({kind:ue.literal("retry"),reason:ue.string()}),ue.object({kind:ue.literal("fail"),reason:ue.string()})]),$f=ue.object({error:ue.string().optional(),outcome:jf.optional(),success:ue.boolean()})});async function Vr({failFast:e,getRecordingOffsetMs:t,observerTransport:n,onStep:r,page:o,spec:i,variables:a}){let s=performance.now();return Mf({currentId:i.entryNode,failFast:e,getRecordingOffsetMs:t,observerTransport:n,onStep:r,page:o,runStartTime:s,spec:i,variables:a})}function qf({onStep:e,steps:t,target:n}){t.forEach(r=>{let o={...r,stepIndex:n.length};n.push(o),e?.(o)})}async function Mf({currentId:e,failFast:t,getRecordingOffsetMs:n,observerTransport:r,onStep:o,page:i,runStartTime:a,spec:s,variables:l}){let d=[],c=l,u=e;for(;u!=null;){let y=s.nodes[u];if(y==null)throw new Error(`Node "${u}" not found in spec`);let S=u,w=y.label??`${y.type} (${u})`;g.info("Executing node: %s [%s]",w,y.type);let k=await Hf({getRecordingOffsetMs:n,node:y,nodeId:S,observerTransport:r,page:i,runStartTime:a,variables:c});if(qf({onStep:o,steps:[k],target:d}),c=k.variables,t&&k.status==="failed")break;u=y.next}return{steps:d,variables:c}}async function Hf({getRecordingOffsetMs:e,node:t,nodeId:n,observerTransport:r,page:o,runStartTime:i,variables:a}){let s=performance.now(),l=e?.(),d=t.label??`${t.type} (${t.id})`,c=Ff,u=_t({node:t,page:o});try{let y=await Jf({node:t,observerTransport:r,page:o,timeout:c,variables:a}),S=Math.round(performance.now()-s),w=y.assertions.some(T=>T.status==="failed"),k=await Q({label:`Snapshot [${d}]`,fn:()=>Ee({page:o,runStartTime:i,targets:u})}),A=e?.();return{annotations:k.annotations,assertions:y.assertions,detail:void 0,duration:S,nodeId:n,nodeType:t.type,recordingEndMs:A,recordingStartMs:l,snapshotTimestamp:k.snapshotTimestamp,status:w?"failed":"passed",stepIndex:0,title:d,url:k.url,variables:y.variables,viewportHeight:k.viewportHeight,viewportWidth:k.viewportWidth}}catch(y){let S=Math.round(performance.now()-s),w=y instanceof Error?y.message:String(y),k=await Q({label:`Snapshot [${d}] (error)`,fn:()=>Ee({page:o,runStartTime:i,targets:u})}),A=e?.();return{annotations:k.annotations,assertions:[],detail:w,duration:S,nodeId:n,nodeType:t.type,recordingEndMs:A,recordingStartMs:l,snapshotTimestamp:k.snapshotTimestamp,status:"failed",stepIndex:0,title:d,url:k.url,variables:a,viewportHeight:k.viewportHeight,viewportWidth:k.viewportWidth}}}async function Jf({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(zf(e)){let a=await Fn({node:e,page:n,timeout:r,variables:o});return{assertions:[],variables:a.variables}}return{assertions:await Gf({node:e,observerTransport:t,page:n,timeout:r,variables:o}),variables:o}}function zf(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 Xf(e){return e.type.startsWith("assert")}async function Gf({node:e,observerTransport:t,page:n,timeout:r,variables:o}){if(!Xf(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 Qf({assertNode:i,page:n,timeout:r,variables:o});case"assertText":{let a=te({ref:i.expected,variables:o});return[await mr({expected:a,locator:B({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertUrl":{let a=te({ref:i.expected,variables:o});return[Wt({expected:a,operator:i.operator,url:n.url()})]}case"assertTitle":{let a=te({ref:i.expected,variables:o});return[Wt({expected:a,operator:i.operator,url:await n.title()})]}case"assertCount":{let a=Wn({ref:i.expected,variables:o});return[await fr({expected:a,locator:B({locator:i.locator,page:n,variables:o}),operator:i.operator})]}case"assertValue":{let a=te({ref:i.expected,variables:o});return[await yr({expected:a,locator:B({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertAttribute":{let a=te({ref:i.expected,variables:o});return[await za({attribute:i.attribute,expected:a,locator:B({locator:i.locator,page:n,variables:o}),operator:i.operator,timeout:r})]}case"assertObserver":{if(t==null)return[{description:`observer "${i.observer}"`,detail:"observer transport not configured \u2014 set engineUrl + webhookSecret in ripplo.config",status:"failed"}];let a={};return Object.entries(i.params).forEach(([s,l])=>{a[s]=te({ref:l,variables:o})}),[await Ss({apiUrl:t.apiUrl,budget:i.budget,observer:i.observer,params:a,webhookSecret:t.webhookSecret})]}}}async function Qf({assertNode:e,page:t,timeout:n,variables:r}){let o=Kf[e.type];return[await o({locator:B({locator:e.locator,page:t,variables:r}),timeout:n})]}var Ff,Kf,Wr=p(()=>{"use strict";qn();bs();kr();Ze();K();et();ft();Oe();Ff=1e4;Kf={assertChecked:Ka,assertDisabled:Ga,assertEnabled:Xa,assertFocused:Ya,assertNotChecked:Qa,assertNotFocused:Za,assertNotVisible:hr,assertVisible:gr}});async function Fr({baseUrl:e,browser:t,cookies:n,extraVariables:r,observerTransport:o,onRecordingChunk:i,onStep:a,runId:s,spec:l}){let d=await t.newContext({baseURL:e});g.info("Browser context created"),n.length>0&&await d.addCookies(n);let c=await d.newPage();g.info("Page created");let u=yt(c),y=await Vt(c);async function S(){let _=await y.takeChunk();_!=null&&i?.(_)}let w=setInterval(()=>{S()},2e3),k=[],A=!1;function T(_){a?.(_),A||(A=!0,y.start()),k.push($t({context:d,page:c,runId:s,stepIndex:_.stepIndex,stepResult:_}))}let O=Yf(r,l.variableNamespaces),W={...ut({defs:l.variables}),...O};g.info("Starting graph execution (entry: %s)",l.entryNode);let U=await Vr({failFast:!0,getRecordingOffsetMs:y.currentOffsetMs,observerTransport:o,onStep:T,page:c,spec:l,variables:W});await Promise.allSettled(k);let j=U.steps.filter(_=>_.status==="passed").length,ae=U.steps.filter(_=>_.status==="failed").length,q={duration:U.steps.reduce((_,z)=>_+z.duration,0),failCount:ae,passCount:j,runId:s,status:ae>0?"failed":"passed",workflowName:""};return await Dt({monitor:u,runId:s,steps:U.steps,summary:q}),clearInterval(w),await y.detach(),await S(),await d.close(),U.steps}function Yf(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 qr=p(()=>{"use strict";Zn();cr();Bt();Wr();K();Oe()});import{parseSetCookie as Zf}from"set-cookie-parser";import{z as de}from"zod";async function Mr({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:Rs({apiUrl:i,preconditionNames:a,webhookSecret:t})}async function Hr({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",...oy({cookies:t}),...je({body:i,secret:o})},method:"PUT",signal:AbortSignal.timeout(As)});a.ok||g.error("Teardown returned %s",String(a.status))}catch{g.error("Teardown request failed")}}async function Rs({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",...je({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(As)});if(!i.ok){let d=await ny(i);throw new Error(`execute-preconditions returned ${String(i.status)}: ${d}`)}let a=await i.json(),s=ey.safeParse(a);if(!s.success)throw new Error(`execute-preconditions response has invalid shape: ${s.error.message}`);if(!s.data.success){let d=s.data.error??"no error detail";throw new Error(`Precondition batch failed: ${d}`)}let l=iy({domain:new URL(e).hostname,res:i});return g.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 ny(e){let t=await e.text().catch(()=>"");if(t.length===0)return"no body";let n=ry(t),r=n==null?null:ty.safeParse(n);return r!=null&&r.success?r.data.error:t.slice(0,500)}function ry(e){try{return JSON.parse(e)}catch{return null}}function oy({cookies:e}){return e.length===0?{}:{Cookie:e.map(n=>`${n.name}=${n.value}`).join("; ")}}function iy({domain:e,res:t}){let n=t.headers.getSetCookie();return Zf(n,{decodeValues:!1}).map(o=>ay({cookie:o,domain:e}))}function ay({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=ly({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 ly({raw:e}){return sy[e.toLowerCase()]??"Lax"}async function Jr({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:[]}:Rs({apiUrl:r,preconditionNames:t,webhookSecret:n})}var As,ey,ty,sy,zr=p(()=>{"use strict";K();Zt();As=3e4,ey=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()});ty=de.object({error:de.string()});sy={lax:"Lax",none:"None",strict:"Strict"}});import{graphql as en}from"gql.tada";async function Xr({agentProfileId:e,config:t,runId:n}){let r=await L({config:t,document:py,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 u=cy({config:t,runResultId:o,steps:[c]}).catch(y=>{g.error(y,"Failed to submit step %d",c.stepIndex)});i.push(u)}function s(c){let u=dy({chunk:c,config:t,runResultId:o}).catch(y=>{g.error(y,"Failed to submit recording chunk %d",c.chunkIndex)});i.push(u)}async function l(){await Promise.all(i)}async function d({statusOverride:c,steps:u,summary:y}){await Q({label:`flushSteps (${String(i.length)} steps)`,fn:()=>Promise.all(i)});let S=u.filter(T=>T.status==="passed").length,w=u.filter(T=>T.status==="failed").length,k=u.reduce((T,O)=>T+O.duration,0),A=c??(w>0?"failed":"passed");await Q({label:"completeRun",fn:()=>L({config:t,document:fy,variables:{duration:k,failCount:w,passCount:S,runResultId:o,status:A,summary:y??null,warnCount:0}})})}return{complete:d,enqueueRecordingChunk:s,enqueueStep:a,flushSteps:l,runResultId:o}}async function dy({chunk:e,config:t,runResultId:n}){await L({config:t,document:my,variables:{input:{bodyBase64:e.body.toString("base64"),chunkIndex:e.chunkIndex,endTimestamp:e.endTimestamp,eventCount:e.eventCount,runResultId:n,startTimestamp:e.startTimestamp}}})}async function cy({config:e,runResultId:t,steps:n}){let r=n.map(o=>({annotations:o.annotations.map(i=>({height:i.height,label:i.label,rrwebNodeId:i.rrwebNodeId??null,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,recordingEndMs:o.recordingEndMs??null,recordingStartMs:o.recordingStartMs??null,snapshotTimestamp:o.snapshotTimestamp,status:o.status,stepIndex:o.stepIndex,title:o.title,url:o.url,viewportHeight:o.viewportHeight,viewportWidth:o.viewportWidth}));await L({config:e,document:uy,variables:{runResultId:t,steps:r}})}var py,uy,my,fy,Gr=p(()=>{"use strict";kt();K();et();py=en(`
|
|
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
|
+
`),uy=en(`
|
|
109
109
|
mutation SubmitRunStepsCLI($runResultId: String!, $steps: [StepInput!]!) {
|
|
110
110
|
submitRunSteps(runResultId: $runResultId, steps: $steps)
|
|
111
111
|
}
|
|
112
|
-
`),
|
|
112
|
+
`),my=en(`
|
|
113
|
+
mutation SubmitRunRecordingChunkCLI($input: SubmitRunRecordingChunkInput!) {
|
|
114
|
+
submitRunRecordingChunk(input: $input)
|
|
115
|
+
}
|
|
116
|
+
`),fy=en(`
|
|
113
117
|
mutation CompleteRunCLI(
|
|
114
118
|
$runResultId: String!
|
|
115
119
|
$status: String!
|
|
@@ -132,7 +136,7 @@ ${n}`].join(`
|
|
|
132
136
|
status
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
|
-
`)});import{z as
|
|
139
|
+
`)});import{z as be}from"zod";import{graphql as rn,readFragment as tn}from"gql.tada";async function Kr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:r,config:o,headed:i,preconditionNames:a,runId:s,webhookSecret:l,workflowId:d}){let c="unknown",u,y,S=!1;try{S=r==null,y=ky({externalBrowser:r,headed:i});let w=a==null?void 0:Q({label:"Preconditions resolved",fn:()=>Jr({engineBaseUrl:o.engineUrl,preconditionNames:a,webhookSecret:l})}),[{project:k,workflow:A},T]=await Promise.all([Q({label:"Run context resolved",fn:()=>Ny({config:o,workflowId:d})}),Q({label:"Streaming run started",fn:()=>Xr({agentProfileId:t,config:o,runId:s})}),br({appUrl:n})]);c=A.name,u=T;let O=Cy(A.spec);g.info("Executing workflow: %s",A.name),await xy(wy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:y,config:o,headed:i,ownsBrowser:S,preconditionPromise:w,project:k,runId:s,specData:O,streaming:u,webhookSecret:l,workflow:A}),Py())}catch(w){throw await Sy({browserPromise:y,error:w,ownsBrowser:S,runId:s,streaming:u,workflowName:c}),w}}function ky({externalBrowser:e,headed:t}){return e!=null?Promise.resolve(e):Q({label:"Browser launched",fn:()=>Ie({headed:t})})}async function Sy({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 Ha({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 wy({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browserPromise:r,config:o,headed:i,ownsBrowser:a,preconditionPromise:s,project:l,runId:d,specData:c,streaming:u,webhookSecret:y,workflow:S}){let w=s??Q({label:"Preconditions resolved",fn:()=>Mr({project:Ry(l),webhookSecret:y,workflowSlug:S.slug})}),[k,A]=await Promise.all([w,r]);if(t!=null){a&&await A.close(),await by({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:o,headed:i,preconditionResult:k,runId:d,specData:c,streaming:u,webhookSecret:y,workflow:S});return}await Ty({baseUrl:n,browser:A,preconditionResult:k,runId:d,specData:c,streaming:u,webhookSecret:y})}async function by({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,headed:o,preconditionResult:i,runId:a,specData:s,streaming:l,webhookSecret:d,workflow:c}){let u=e!=null&&e.length>0?e:await vy({config:r,profileId:t});await pr({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:c.name,expectedOutcome:c.name,name:c.name}}),await Ns({preconditionResult:i,webhookSecret:d})}function Ry(e){let t=(e.workflows??[]).map(n=>{let r=tn(nn,n);return Ay.parse(r)});return{engineBaseUrl:e.engineBaseUrl,workflows:t}}async function Ty({baseUrl:e,browser:t,preconditionResult:n,runId:r,specData:o,streaming:i,webhookSecret:a}){let s=await Q({label:"Spec executed",fn:()=>Fr({baseUrl:e,browser:t,cookies:n.cookies,extraVariables:n.data,observerTransport:n.apiUrl==null?void 0:{apiUrl:n.apiUrl,webhookSecret:a},onRecordingChunk:i.enqueueRecordingChunk,onStep:i.enqueueStep,runId:r,spec:o})});await Ns({preconditionResult:n,webhookSecret:a}),await i.complete({statusOverride:void 0,steps:s,summary:void 0});let l=s.filter(c=>c.status==="passed").length,d=s.filter(c=>c.status==="failed").length;g.info("Run complete: %d passed, %d failed",l,d)}async function Ns({preconditionResult:e,webhookSecret:t}){e.apiUrl!=null&&await Hr({apiUrl:e.apiUrl,cookies:e.cookies,data:e.data,executed:e.executed,webhookSecret:t})}async function Ny({config:e,workflowId:t}){let n=await L({config:e,document:gy,variables:{projectId:e.projectId}});if(n.project==null)throw new Error("Project not found");let o={...tn(Ts,n.project),...e.engineUrl.length>0?{engineBaseUrl:e.engineUrl}:{}},a=(o.workflows??[]).find(l=>tn(nn,l).id===t);if(a==null)throw new Error(`Workflow ${t} not found`);let s=tn(nn,a);return{project:o,workflow:s}}async function vy({config:e,profileId:t}){let n=await L({config:e,document:hy,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 g.info("Using agent profile: %s",r.name),ar({description:o,output:r.output??void 0,successCriteria:r.successCriteria??void 0})}function Cy(e){if(e==null)throw new Error("Workflow has no spec");return $r.decode(e)}function Py(){return Ly.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function xy(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,nn,Ts,gy,hy,Ay,Ly,vs=p(()=>{"use strict";hs();sr();ur();gt();Ar();kt();Bt();qr();K();et();zr();Gr();yy=12e4,nn=rn(`
|
|
136
140
|
fragment WorkflowRun on Workflow {
|
|
137
141
|
id
|
|
138
142
|
slug
|
|
@@ -144,7 +148,7 @@ ${n}`].join(`
|
|
|
144
148
|
preconditionName
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
`),
|
|
151
|
+
`),Ts=rn(`
|
|
148
152
|
fragment ProjectRun on Project {
|
|
149
153
|
id
|
|
150
154
|
cloudBaseUrl
|
|
@@ -153,13 +157,13 @@ ${n}`].join(`
|
|
|
153
157
|
...WorkflowRun
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
|
-
`,[
|
|
160
|
+
`,[nn]),gy=rn(`
|
|
157
161
|
query ProjectRun($projectId: String!) {
|
|
158
162
|
project(id: $projectId) {
|
|
159
163
|
...ProjectRun
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
|
-
`,[
|
|
166
|
+
`,[Ts]),hy=rn(`
|
|
163
167
|
query AgentProfileRun($id: String!) {
|
|
164
168
|
agentProfile(id: $id) {
|
|
165
169
|
id
|
|
@@ -169,13 +173,13 @@ ${n}`].join(`
|
|
|
169
173
|
successCriteria
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
|
-
`);
|
|
176
|
+
`);Ay=be.object({preconditions:be.array(be.string()),requiresKeys:be.array(be.object({namespace:be.string(),preconditionName:be.string()})),slug:be.string()});Ly=be.coerce.number().int().positive().catch(yy)});var J=p(()=>{"use strict";qn();ir();sr();ur();kr();gt();ts();is();Ar();kt();as();Nr();On();vs();qr();Wr();Ze();K();et();zr();Zt();ft();Gr();Oe()});import Oy from"fs";import Ey from"path";async function Cs(e){let t=Ey.join(e,".ripplo","index.ts");if(!Oy.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 C(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 Qr(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 Ls({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 Ps=p(()=>{"use strict";X()});import St from"fs";import xs from"path";import{chromium as Iy}from"playwright";function Os(e){switch(e.type){case"settings":return!e.valid;case"token":return!e.exists;case"dev-server":return!e.reachable;case"preconditions":return e.count>0&&!e.configured;case"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 on(e){let t=await jy(e),n=$y(e),r=Dy(),o=await C(e),i=By(o),a=Fy(o),s=await _y(e,o),l=Uy(e),d=await qy(t,o);return[t,n,...d,i,a,s,l,r]}async function _y(e,t){if(!t.ok)return{status:"missing",type:"lockfile"};let n=await xt({cwd:e});return{status:Ot({compiled:t.result,existing:n}),type:"lockfile"}}function Uy(e){let t=xs.join(e,".git","hooks","pre-commit");return St.existsSync(t)?{installed:St.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function jy(e){let t=await Cs(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 $y(e){let t=xs.join(e,".ripplo",".local","token");return St.existsSync(t)?{exists:St.readFileSync(t,"utf8").trim().length>0,type:"token"}:{exists:!1,type:"token"}}function Dy(){let e=Iy.executablePath();return{installed:St.existsSync(e),type:"browser"}}function By(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let t=Vy(e.result.preconditions,e.result.tests);return{errorCount:t.length,errors:t,found:!0,type:"preconditions-validation",valid:t.length===0}}function Vy(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}`})})}),Wy(e).forEach(o=>{n.push({message:o,path:"preconditions"})}),n}function Wy(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 Fy(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 qy(e,t){if(!e.valid||!t.ok)return[];let{config:n}=t.result,r=[],o=await Qr(n.appUrl)==null;r.push({appUrl:n.appUrl,reachable:o,type:"dev-server"});let i=await My(n,t);return r.push(...i),r}async function My(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=zy(e.appUrl,e.engineUrl);if(i==null)return[o];let a=await Qr(i)==null,s=[];if(s.push({configured:!0,count:n,endpointReachable:a,type:"preconditions"}),Es(e.engineUrl)&&s.push({reachable:a,type:"engine-endpoint",url:i}),!a)return s;let l=await Ls({appUrl:e.appUrl,engineUrl:e.engineUrl});s.push({rejectsUnsigned:l==null,type:"webhook-verification"});let d=await Hy({engineUrl:i,webhookSecret:e.webhookSecret});return s.push({status:d,type:"adapter-enabled",url:i}),s}async function Hy({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",...je({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 Jy(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 Es(e){return e.startsWith("http://")||e.startsWith("https://")}function zy(e,t){return Es(t)?t:`${e}${t}`}function Is(e){switch(e.type){case"settings":return Ky(e);case"token":return Qy(e);case"dev-server":return Yy(e);case"preconditions":return tg(e);case"webhook-verification":return Zy(e);case"preconditions-validation":return ng(e);case"workflows":return rg(e);case"browser":return eg(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 Jy(e);case"lockfile":return Xy(e);case"pre-commit-hook":return Gy(e)}}function Xy(e){switch(e.status){case"match":return`\u2713 Lockfile: ${he} is up to date`;case"missing":return`\u2717 Lockfile: ${he} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${he} is out of date \u2014 run \`ripplo compile\` and commit it`}}function Gy(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 Ky(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function Qy(e){return e.exists?"\u2713 Auth: Token found":"\u2717 Auth: No token found. Run `ripplo` to authenticate."}function Yy(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 Zy(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 eg(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function tg(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 ng(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
177
|
${t.join(`
|
|
174
|
-
`)}`}function
|
|
178
|
+
`)}`}function rg(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=>og(n));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
175
179
|
${t.join(`
|
|
176
|
-
`)}`}function
|
|
180
|
+
`)}`}function og(e){let t=e.errors.map(n=>" - "+(n.path===""?"":n.path+": ")+n.message);return" "+e.name+`:
|
|
177
181
|
`+t.join(`
|
|
178
|
-
`)}var
|
|
182
|
+
`)}var Yr=p(()=>{"use strict";J();xe();Ps();X()});import{z as Ds}from"zod";function Se(){let e=process.argv.findIndex(o=>o.startsWith("--env"));if(e===-1)return bt().RIPPLO_SERVER_URL;let t=process.argv[e];if(t==null)return bt().RIPPLO_SERVER_URL;let n=t.includes("=")?t.split("=")[1]:process.argv[e+1];if(n==null)return bt().RIPPLO_SERVER_URL;let r=Sg[n];if(r==null)throw new Error(`Unknown env "${n}". Use "dev" or "local".`);return r}function bt(){return Bs??=wg.parse(process.env),Bs}var gg,hg,kg,Sg,wg,Bs,He=p(()=>{"use strict";gg="https://ripplo.ai",hg="https://ripplo-dev.up.railway.app",kg="https://localhost:3001",Sg={dev:hg,local:kg};wg=Ds.object({RIPPLO_SERVER_URL:Ds.string().min(1).default(gg)})});import Rt from"fs";function el(e){return ke(e,lh)}function tl(e){let t=el(e);if(!Rt.existsSync(t))return!1;let n=Rt.statSync(t);return Date.now()-n.mtimeMs<=ch}function Zs(e){Me(e);let t=el(e),n=new Date;Rt.existsSync(t)?Rt.utimesSync(t,n,n):Rt.writeFileSync(t,"")}function nl(e){Zs(e);let t=setInterval(()=>{Zs(e)},dh);return()=>{clearInterval(t)}}var lh,dh,ch,oo=p(()=>{"use strict";J();lh="cli-heartbeat",dh=2e3,ch=1e4});var kl={};jo(kl,{redirectStdioToFile:()=>zh});import pn from"fs";import Jh from"path";function zh(e){pn.mkdirSync(Jh.dirname(e),{recursive:!0});let t=pn.openSync(e,"a"),n=process.stdout.write.bind(process.stdout),r=process.stderr.write.bind(process.stderr);function o(s,l,d){let c=typeof l=="string"?l:void 0,u=typeof s=="string"?Buffer.from(s,c??"utf8"):Buffer.from(s);pn.writeSync(t,u);let y=typeof l=="function"?l:d;return y?.(),!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,pn.closeSync(t))}}var Sl=p(()=>{"use strict"});import wl from"crypto";import so from"fs";import bl from"path";import{watch as Xh}from"chokidar";import{graphql as Gh}from"gql.tada";async function Al(e){return Zh(e)}function lo({config:e,cwd:t,devSessionId:n,lastHash:r,onSyncError:o,onSyncSuccess:i}){let a=bl.join(t,Kh),s=r,l=n,d="",c,u=!1,y=!1,S=Xh(a,{depth:2,ignoreInitial:!0,persistent:!0});S.on("all",(T,O)=>{if(O.endsWith(".ts")){if(u){y=!0;return}c!=null&&clearTimeout(c),c=setTimeout(()=>{k()},200)}}),S.on("error",T=>{let O=T instanceof Error?T.message:String(T);g.error("File watcher error: %s",O)});function w(){y=!1,c=setTimeout(()=>{k()},200)}async function k(){u=!0,y=!1;try{await A()}catch(T){let O=T instanceof Error?T.message:"Unknown error";g.error("Sync failed: %s",O),o(O)}finally{u=!1,y&&w()}}async function A(){let T=Yh(a);if(T===d)return;let O=await C(t);if(!O.ok){o(O.error);return}await pe({cwd:t,result:O.result});let W={...O.result.config,ripploServerUrl:e.ripploServerUrl,token:e.token},U=Tl(O.result),j=Nl(U);if(j===s){d=T,i({config:W,devSessionId:l,hash:j});return}let ae=await vl({config:W,payload:U});d=T,s=j,l=ae.devSessionId,g.info("Dev session synced (%d test(s))",O.result.tests.length),i({config:W,devSessionId:ae.devSessionId,hash:ae.hash})}return function(){c!=null&&clearTimeout(c),S.close()}}function Yh(e){let t=wl.createHash("sha256");return Rl(t,e),t.digest("hex")}function Rl(e,t){if(!so.existsSync(t))return;so.readdirSync(t,{withFileTypes:!0}).toSorted((r,o)=>r.name.localeCompare(o.name)).forEach(r=>{let o=bl.join(t,r.name);r.isDirectory()?Rl(e,o):r.name.endsWith(".ts")&&(e.update(r.name),e.update(so.readFileSync(o)))})}function Tl(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 Nl(e){return wl.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Zh(e){let t=await C(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=Tl(t.result);return g.info("Synced %d test(s) + graph to dev session",t.result.tests.length),{...await vl({config:n,payload:r}),config:n}}async function vl({config:e,payload:t}){let n=Nl(t),r=await L({config:e,document:Qh,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 Cl(e){return!1}function Ll(e){return!1}var Kh,Qh,co=p(()=>{"use strict";xe();J();X();Kh=".ripplo",Qh=Gh(`
|
|
179
183
|
mutation SyncDevSession(
|
|
180
184
|
$projectId: String!
|
|
181
185
|
$preconditions: [SyncDevPreconditionInput!]!
|
|
@@ -185,7 +189,7 @@ ${t.join(`
|
|
|
185
189
|
id
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
|
-
`)});import{useCallback as
|
|
192
|
+
`)});import{useCallback as ek,useEffect as un,useRef as tk,useState as nk}from"react";import{availableParallelism as Pl}from"os";import{useSubscription as po}from"urql";import{graphql as fn}from"gql.tada";async function xl(){await(await mn).closeAll()}function Ol({config:e,cwd:t,devSessionId:n}){let[r,o]=nk({activeRunCount:0,browsersReady:!1,connected:!1,maxConcurrency:Pl()}),i=e,a=tk(new Set);un(()=>{mn.then(()=>{o(l=>({...l,browsersReady:!0}))})},[]);let s=ek(l=>{El({activeRunIds:a.current,baseUrl:i.appUrl,config:i,setState:o,...l})},[i]);return un(()=>{n!=null&&o(l=>({...l,connected:!0}))},[n]),po({pause:n==null,query:rk},(l,d)=>{let c=d.runRequested;return c!=null&&s({agentProfileDescription:c.agentProfileDescription??void 0,agentProfileId:c.agentProfileId??void 0,cwd:t,runId:c.runId,workflowId:c.workflowId,workflowSlug:c.workflowSlug}),d}),po({pause:n==null,query:ik,variables:{projectId:i.projectId}},(l,d)=>{let c=d.devWorkflowDeleteRequested?.slug;return c!=null&&Cl({cwd:t,slug:c}),d}),po({pause:n==null,query:ak,variables:{projectId:i.projectId}},(l,d)=>{let c=d.devWorkflowDuplicateRequested;return c!=null&&Ll({cwd:t,newSlug:c.newSlug,sourceSlug:c.sourceSlug}),d}),un(()=>{if(n==null)return;let l=new AbortController;return lk({activeConfig:i,activeRunIds:a.current,devSessionId:n,setState:o,signal:l.signal}),()=>{l.abort()}},[i,n]),un(()=>()=>{mn.then(l=>l.closeAll())},[]),r}function El({activeRunIds:e,agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,setState:s,workflowId:l,workflowSlug:d}){if(e.has(a))return;e.add(a),s(u=>({...u,activeRunCount:e.size}));function c(){e.delete(a),s(u=>({...u,activeRunCount:e.size}))}dk({agentProfileDescription:t,agentProfileId:n,baseUrl:r,config:o,cwd:i,runId:a,workflowId:l,workflowSlug:d}).finally(c)}async function lk({activeConfig:e,activeRunIds:t,devSessionId:n,setState:r,signal:o}){for(;!o.aborted;){if(await new Promise(i=>{let a=setTimeout(i,sk);o.addEventListener("abort",()=>{clearTimeout(a),i()},{once:!0})}),o.aborted)return;try{(await L({config:e,document:ok,variables:{devSessionId:n}})).pendingDevRuns?.filter(a=>!t.has(a.id)).forEach(a=>{let s=a.workflow?.id;s!=null&&El({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){g.error(i,"Runner error")}}}async function dk({agentProfileDescription:e,agentProfileId:t,baseUrl:n,config:r,cwd:o,runId:i,workflowId:a,workflowSlug:s}){let l=await mn,d=await l.acquire();try{await wr({maxRuns:100});let c=o!=null&&s!=null?await ck({cwd:o,workflowSlug:s}):void 0;await Kr({agentProfileDescription:e,agentProfileId:t,baseUrl:n,browser:d,config:r,headed:!1,preconditionNames:c,runId:i,webhookSecret:r.webhookSecret,workflowId:a})}catch(c){g.error(c,"Runner error")}finally{l.release(d)}}async function ck({cwd:e,workflowSlug:t}){let n=await C(e);if(!n.ok)return;let r=n.result.tests.find(o=>o.slug===t);if(r!=null)return r.preconditions}var rk,ok,ik,ak,mn,sk,uo=p(()=>{"use strict";J();X();co();rk=fn(`
|
|
189
193
|
subscription RunRequestedDashboard {
|
|
190
194
|
runRequested {
|
|
191
195
|
agentProfileDescription
|
|
@@ -196,7 +200,7 @@ ${t.join(`
|
|
|
196
200
|
workflowSlug
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
|
-
`),
|
|
203
|
+
`),ok=fn(`
|
|
200
204
|
query PendingDevRunsDashboard($devSessionId: String!) {
|
|
201
205
|
pendingDevRuns(devSessionId: $devSessionId) {
|
|
202
206
|
id
|
|
@@ -209,14 +213,14 @@ ${t.join(`
|
|
|
209
213
|
}
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
|
-
`),
|
|
216
|
+
`),ik=fn(`
|
|
213
217
|
subscription DevWorkflowDeleteDashboard($projectId: String!) {
|
|
214
218
|
devWorkflowDeleteRequested(projectId: $projectId) {
|
|
215
219
|
projectId
|
|
216
220
|
slug
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
`),
|
|
223
|
+
`),ak=fn(`
|
|
220
224
|
subscription DevWorkflowDuplicateDashboard($projectId: String!) {
|
|
221
225
|
devWorkflowDuplicateRequested(projectId: $projectId) {
|
|
222
226
|
projectId
|
|
@@ -224,7 +228,7 @@ ${t.join(`
|
|
|
224
228
|
newSlug
|
|
225
229
|
}
|
|
226
230
|
}
|
|
227
|
-
`),Ln=Ur({headed:!1,size:pc()});eS=5e3});import{initGraphQLTada as oS}from"gql.tada";import{readFragment as yO}from"gql.tada";var Io,yc=f(()=>{"use strict";Io=oS()});var _o,Uo=f(()=>{"use strict";_o={__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:"addAgentScopeItems",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"ScopeItem",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowSlugs",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{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:"removeScopeItems",type:{kind:"SCALAR",name:"Any"},args:[{name:"ids",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{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 ue(e,t,n){e.invalidate({__typename:t,id:n})}function aS({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 jo({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 sS(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;jo({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ue(e,"RunResult",r)}function $o(e){return e==="completed"||e==="failed"}function lS(e,t){if(t.runId==null)return;let n=$o(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(gc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function hc(e,t){e.invalidate({__typename:"Run",id:t},"results")}function cS(e,t){e.workflowId==null||e.runId==null||jo({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function dS(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;lS(t,e),$o(e.status)&&e.runId!=null&&hc(t,e.runId),n&&(W(t,"run"),pS(t,e)),cS(e,t)}function pS(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){W(e,"projectRuns");return}aS({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 uS(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 fS(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(mS,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function yS(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&uS(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&&ue(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(gc,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),jo({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&ue(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&ue(n,"Workflow",r),W(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ue(n,"Project",r),W(n,"projects")},duplicateDevWorkflow(e,t,n){W(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ue(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&ue(n,"ScopeItem",r)},removeScopeItem(e,t,n){ue(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){W(n,"runs"),W(n,"projectRuns")},setHooksPaused(e,t,n){fS(n,t.paused)},setOverageCap(e,t,n){W(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&ue(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ue(n,"User",r),W(n,"currentUser")}}}function Do(){return{keys:iS,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:_o,updates:{Mutation:yS(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ue(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&&dS(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&sS(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&ue(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&$o(r.run.status)&&hc(n,r.run.id)}}}}}var iS,gc,mS,kc=f(()=>{"use strict";yc();Uo();iS={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};gc=Io(`
|
|
231
|
+
`),mn=Sr({headed:!1,size:Pl()});sk=5e3});import{initGraphQLTada as pk}from"gql.tada";import{readFragment as xO}from"gql.tada";var mo,Il=p(()=>{"use strict";mo=pk()});var fo,yo=p(()=>{"use strict";fo={__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:"addAgentScopeItems",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"ScopeItem",ofType:null}}},args:[{name:"projectId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}},{name:"workflowSlugs",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}}}]},{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:"removeScopeItems",type:{kind:"SCALAR",name:"Any"},args:[{name:"ids",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{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:"submitRunRecordingChunk",type:{kind:"SCALAR",name:"Any"},args:[{name:"input",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:"RunRecordingChunkAdded"},{kind:"OBJECT",name:"RunResultUpdated"},{kind:"OBJECT",name:"RunStatusChanged"},{kind:"OBJECT",name:"RunTraceEntryAdded"}]},{kind:"OBJECT",name:"RunRecordingChunk",fields:[{name:"byteSize",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"chunkIndex",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"endTimestamp",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"eventCount",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"signedUrl",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"startTimestamp",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"RunRecordingChunkAdded",fields:[{name:"chunk",type:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunRecordingChunk",ofType:null}},args:[]},{name:"runResultId",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{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:"recordingChunks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"RunRecordingChunk",ofType:null}}}},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:"recordingEndMs",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"recordingStartMs",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"screenshotUrl",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"status",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"statusCode",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"stepIndex",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"timestamp",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"title",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportHeight",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"viewportWidth",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"TrackedBranch",fields:[{name:"branchName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"headCommit",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditions",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Precondition",ofType:null}}},args:[]},{name:"snapshots",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"BranchSnapshot",ofType:null}}},args:[]},{name:"syncedAt",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"workflows",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Workflow",ofType:null}}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"User",fields:[{name:"email",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"image",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"username",type:{kind:"SCALAR",name:"Any"},args:[]}],interfaces:[]},{kind:"OBJECT",name:"Workflow",fields:[{name:"additionalChecks",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"agentProfiles",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"AgentProfile",ofType:null}}}},args:[]},{name:"codebaseScope",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"createdAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"devSessionId",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"expectedOutcome",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"isLocalOnly",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"latestRuns",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"name",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditions",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}}}},args:[]},{name:"project",type:{kind:"OBJECT",name:"Project",ofType:null},args:[]},{name:"requiresKeys",type:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"WorkflowRequiresKey",ofType:null}}},args:[]},{name:"runs",type:{kind:"NON_NULL",ofType:{kind:"LIST",ofType:{kind:"NON_NULL",ofType:{kind:"OBJECT",name:"Run",ofType:null}}}},args:[]},{name:"slug",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"source",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"spec",type:{kind:"SCALAR",name:"Any"},args:[]},{name:"updatedAt",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"OBJECT",name:"WorkflowRequiresKey",fields:[{name:"id",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"namespace",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]},{name:"preconditionName",type:{kind:"NON_NULL",ofType:{kind:"SCALAR",name:"Any"}},args:[]}],interfaces:[]},{kind:"SCALAR",name:"Any"}],directives:[]}}});function $(e,t){e.inspectFields("Query").filter(n=>n.fieldName===t).forEach(n=>{e.invalidate("Query",n.fieldName,n.arguments)})}function ie(e,t,n){e.invalidate({__typename:t,id:n})}function mk({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 yn({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 d=l.map(c=>typeof c=="string"?c:null);return d.includes(s)||e.link(a,r,void 0,[...d,s]),!0}function fk(e,t){let n=t.traceEntry?.id,r=t.runResultId;if(n==null||r==null)return;yn({cache:e,childId:n,childTypeName:"TraceEntry",fieldName:"traceEntries",parentId:r,parentTypeName:"RunResult"})||ie(e,"RunResult",r)}function yk(e,t){let n=t.chunk?.id,r=t.runResultId;if(n==null||r==null)return;yn({cache:e,childId:n,childTypeName:"RunRecordingChunk",fieldName:"recordingChunks",parentId:r,parentTypeName:"RunResult"})||ie(e,"RunResult",r)}function go(e){return e==="completed"||e==="failed"}function gk(e,t){if(t.runId==null)return;let n=go(t.status),r=t.completedAt??(n?new Date().toISOString():null);e.writeFragment(_l,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:r,createdAt:t.createdAt??new Date().toISOString(),id:t.runId,status:t.status??"pending"})}function Ul(e,t){e.invalidate({__typename:"Run",id:t},"results")}function hk(e,t){e.workflowId==null||e.runId==null||yn({cache:t,childId:e.runId,childTypeName:"Run",fieldName:"latestRuns",parentId:e.workflowId,parentTypeName:"Workflow"})}function kk(e,t){let n=e.runId!=null&&t.resolve({__typename:"Run",id:e.runId},"id")==null;gk(t,e),go(e.status)&&e.runId!=null&&Ul(t,e.runId),n&&($(t,"run"),Sk(t,e)),hk(e,t)}function Sk(e,t){if(t.runId==null)return;let n=e.keyOfEntity({__typename:"Run",id:t.runId});if(n==null){$(e,"projectRuns");return}mk({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)}}),$(e,"projectRuns")}function wk(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 Ak(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(bk,{hooksPaused:t,id:o.replace(/^DevSession:/,"")})})}function Rk(){return{addScopeItem(e,t,n){let r=e.addScopeItem?.id;r!=null&&wk(n,t.projectId,r)},cancelAllPendingRuns(e,t,n){$(n,"workflows"),$(n,"projectRuns")},cancelRun(e,t,n){let r=e.cancelRun?.id;r!=null&&ie(n,"Run",r)},cloneAgentTemplate(e,t,n){$(n,"agentProfiles")},createAgentProfile(e,t,n){$(n,"agentProfiles")},createRun(e,t,n){$(n,"run"),$(n,"runs"),$(n,"projectRuns");let r=e.createRun?.id;r!=null&&(n.writeFragment(_l,{agentProfile:t.agentProfileId==null?null:{id:t.agentProfileId},completedAt:null,createdAt:new Date().toISOString(),id:r,status:"pending"}),yn({cache:n,childId:r,childTypeName:"Run",fieldName:"latestRuns",parentId:t.workflowId,parentTypeName:"Workflow"}))},deleteAgentProfile(e,t,n){let r=e.deleteAgentProfile?.id;r!=null&&ie(n,"AgentProfile",r)},deleteDevWorkflow(e,t,n){let r=e.deleteDevWorkflow?.id;r!=null&&ie(n,"Workflow",r),$(n,"workflows")},deleteProject(e,t,n){let r=e.deleteProject?.id;r!=null&&ie(n,"Project",r),$(n,"projects")},duplicateDevWorkflow(e,t,n){$(n,"workflows")},endDevSession(e,t,n){let r=e.endDevSession?.id;r!=null&&ie(n,"DevSession",r)},linkScopeItem(e,t,n){let r=e.linkScopeItem?.id;r!=null&&ie(n,"ScopeItem",r)},removeScopeItem(e,t,n){ie(n,"ScopeItem",t.id)},runAllWorkflows(e,t,n){$(n,"runs"),$(n,"projectRuns")},setHooksPaused(e,t,n){Ak(n,t.paused)},setOverageCap(e,t,n){$(n,"organizationUsage")},updateProject(e,t,n){let r=e.updateProject?.id;r!=null&&ie(n,"Project",r)},updateUsername(e,t,n){let r=e.updateUsername?.id;r!=null&&ie(n,"User",r),$(n,"currentUser")}}}function ho(){return{keys:uk,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:fo,updates:{Mutation:Rk(),Subscription:{devSessionChanged(e,t,n){let r=e.devSessionChanged;r?.projectId!=null&&ie(n,"Project",r.projectId),r?.active===!1&&($(n,"workflows"),$(n,"workflow"),$(n,"runs"),$(n,"run"),$(n,"projectRuns"))},devSessionSynced(e,t,n){$(n,"workflow"),$(n,"workflows");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&&kk(r,n)},runProgress(e,t,n){let r=e.runProgress;r?.__typename==="RunTraceEntryAdded"&&fk(n,r),r?.__typename==="RunRecordingChunkAdded"&&yk(n,r),r?.__typename==="RunResultUpdated"&&r.runResult?.id!=null&&ie(n,"RunResult",r.runResult.id),r?.__typename==="RunStatusChanged"&&r.run?.id!=null&&go(r.run.status)&&Ul(n,r.run.id)}}}}}var uk,_l,bk,jl=p(()=>{"use strict";Il();yo();uk={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,RunRecordingChunk:e=>e.id??null,RunRecordingChunkAdded:()=>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};_l=mo(`
|
|
228
232
|
fragment RunCache on Run {
|
|
229
233
|
id
|
|
230
234
|
status
|
|
@@ -234,12 +238,12 @@ ${t.join(`
|
|
|
234
238
|
id
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
|
-
`);
|
|
241
|
+
`);bk=mo(`
|
|
238
242
|
fragment HooksPausedPatch on DevSession {
|
|
239
243
|
id
|
|
240
244
|
hooksPaused
|
|
241
245
|
}
|
|
242
|
-
`)});var
|
|
246
|
+
`)});var $l=p(()=>{"use strict";jl();yo()});import{Client as Tk,fetchExchange as Nk,subscriptionExchange as vk}from"urql";import{cacheExchange as Ck}from"@urql/exchange-graphcache";import{createClient as Lk}from"graphql-sse";function Dl({config:e}){let t=`${e.ripploServerUrl}/graphql`,n={Authorization:`Bearer ${e.token}`},r=Lk({headers:n,retryAttempts:1/0,url:t});return new Tk({exchanges:[Ck(ho()),vk({forwardSubscription:o=>({subscribe:i=>o.query==null?{unsubscribe:()=>{}}:{unsubscribe:r.subscribe({query:o.query,variables:o.variables},i)}})}),Nk],fetchOptions:{headers:n},requestPolicy:"cache-and-network",url:t})}var Bl=p(()=>{"use strict";$l()});import{Box as Vl,Text as D,useInput as Pk}from"ink";import{jsx as G,jsxs as ve}from"react/jsx-runtime";function Wl({deviceCodeInfo:e,error:t,loginStarted:n,startLogin:r}){return Pk((o,i)=>{i.return&&!n&&r()}),t!=null?ve(Vl,{flexDirection:"column",gap:1,children:[ve(D,{children:[G(D,{color:"red",children:" \u2717 "}),G(D,{children:t})]}),ve(D,{children:[G(D,{color:"cyan",children:" \u2192 "}),G(D,{children:"Press "}),G(D,{bold:!0,children:"Enter"}),G(D,{children:" to try again"})]})]}):e!=null?ve(Vl,{flexDirection:"column",gap:1,paddingLeft:2,children:[ve(D,{children:[G(D,{color:"yellow",children:"* "}),G(D,{children:"Your code: "}),G(D,{bold:!0,color:"white",children:e.userCode})]}),ve(D,{children:[G(D,{color:"yellow",children:"* "}),G(D,{children:"Waiting for browser authorization..."})]}),ve(D,{dimColor:!0,children:[" ",e.verificationUrl]})]}):n?ve(D,{children:[G(D,{color:"yellow",children:" * "}),G(D,{children:"Opening browser..."})]}):ve(D,{children:[G(D,{color:"cyan",children:" \u2192 "}),G(D,{children:"Press "}),G(D,{bold:!0,children:"Enter"}),G(D,{children:" to open browser for authentication"})]})}var Fl=p(()=>{"use strict"});import{useState as xk}from"react";import{Box as Ok,Text as gn,useInput as Ek}from"ink";import{jsx as hn,jsxs as Ik}from"react/jsx-runtime";function ql({items:e,onSelect:t}){let[n,r]=xk(0);return Ek((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)}}),hn(Ok,{flexDirection:"column",children:e.map((o,i)=>Ik(gn,{children:[i===n?hn(gn,{color:"cyan",children:"> "}):hn(gn,{children:" "}),hn(gn,{bold:i===n,children:o.label})]},o.value))})}var Ml=p(()=>{"use strict"});import{Box as _k,Text as $e,useInput as Uk}from"ink";import{jsx as it,jsxs as ko}from"react/jsx-runtime";function Hl({reexecute:e,serverUrl:t}){let n=`${t}/connect`;return Uk((r,o)=>{o.return&&e()}),ko(_k,{flexDirection:"column",children:[ko($e,{children:[it($e,{color:"cyan",children:" \u2192 "}),it($e,{children:"No projects found. Create one at: "}),it($e,{bold:!0,color:"cyan",children:n})]}),ko($e,{children:[" ",it($e,{dimColor:!0,children:"Press "}),it($e,{bold:!0,children:"Enter"}),it($e,{dimColor:!0,children:" to refresh after creating a project"})]})]})}var Jl=p(()=>{"use strict"});import{useEffect as jk,useMemo as $k,useRef as Dk}from"react";import{Box as zl,Text as Je}from"ink";import{useQuery as Bk}from"urql";import{graphql as Vk}from"gql.tada";import{jsx as ze,jsxs as kn}from"react/jsx-runtime";function Xl({selectProject:e,serverUrl:t}){let[n,r]=Bk({query:Wk}),o=Dk(!1),i=$k(()=>n.data?.projects??[],[n.data?.projects]);if(jk(()=>{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 kn(Je,{children:[ze(Je,{color:"yellow",children:" * "}),ze(Je,{children:"Loading projects..."})]});if(n.error!=null)return kn(Je,{color:"red",children:[" \u2717 ","Failed to fetch projects: ",n.error.message]});if(i.length===0)return ze(Hl,{reexecute:r,serverUrl:t});let a=i.map(l=>({label:l.name,value:l.id}));function s(l){let d=i.find(c=>c.id===l);d!=null&&e({id:d.id,name:d.name})}return kn(zl,{flexDirection:"column",children:[kn(Je,{children:[ze(Je,{color:"cyan",children:" \u2192 "}),ze(Je,{children:"Select a project:"})]}),ze(zl,{marginLeft:4,marginTop:1,children:ze(ql,{items:a,onSelect:s})})]})}var Wk,Gl=p(()=>{"use strict";Ml();Jl();Wk=Vk(`
|
|
243
247
|
query SetupProjectSelect {
|
|
244
248
|
projects {
|
|
245
249
|
id
|
|
@@ -249,11 +253,11 @@ ${t.join(`
|
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
|
-
`)});import{Box as
|
|
256
|
+
`)});import{Box as Tt,Text as ce,useInput as Fk}from"ink";import qk from"ink-spinner";import{jsx as Ce,jsxs as ge}from"react/jsx-runtime";function Kl({config:e,error:t,onDismissWarnings:n,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}){return Fk((s,l)=>{a==="scaffolding-warnings"&&l.return&&n()}),ge(Tt,{flexDirection:"column",padding:1,children:[ge(ce,{bold:!0,children:[" ","ripplo setup"]}),Ce(ce,{children:""}),ge(ce,{children:[Ce(ce,{color:"green",children:" \u2713 "}),Ce(ce,{children:"Authenticated"})]}),Mk({config:e,scaffoldingStep:r,scaffoldWarnings:o,selectProject:i,stage:a}),t==null?null:Ce(Tt,{marginTop:1,children:ge(ce,{color:"red",children:[" ","Error: ",t]})})]})}function Mk({config:e,scaffoldingStep:t,scaffoldWarnings:n,selectProject:r,stage:o}){return o==="scaffolding"?ge(ce,{children:[ge(ce,{color:"cyan",children:[" ",Ce(qk,{type:"dots"})]}),ge(ce,{children:[" ",t??"Setting up local environment..."]})]}):o==="scaffolding-warnings"?ge(Tt,{flexDirection:"column",marginTop:1,children:[Ce(ce,{color:"yellow",children:" \u26A0 Setup finished with warnings:"}),n.map((i,a)=>ge(Tt,{flexDirection:"column",marginTop:1,children:[ge(ce,{children:[" ",i.message]}),i.manualCommand==null?null:ge(ce,{color:"cyan",children:[" $ ",i.manualCommand]})]},a)),Ce(Tt,{marginTop:1,children:Ce(ce,{dimColor:!0,children:" Press enter to continue to the dashboard."})})]}):Ce(Xl,{selectProject:r,serverUrl:e.ripploServerUrl})}var Ql=p(()=>{"use strict";Gl()});import{useEffect as Hk,useState as Jk}from"react";function at(){let[e,t]=Jk(Yl);return Hk(()=>{function n(){t(Yl())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Yl(){return{height:process.stdout.rows,width:process.stdout.columns}}var Sn=p(()=>{"use strict"});import{useEffect as zk,useRef as Xk,useState as Gk}from"react";function Zl({config:e,cwd:t}){let[n,r]=Gk({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=Xk(void 0);return zk(()=>{function i({config:s,devSessionId:l}){r(d=>({...d,config:s,devSessionId:l,syncError:void 0,syncing:!1}))}function a(s){r(l=>({...l,syncError:s,syncing:!1}))}return Al({config:e,cwd:t}).then(({config:s,devSessionId:l,hash:d})=>{i({config:s,devSessionId:l}),o.current=lo({config:s,cwd:t,devSessionId:l,lastHash:d,onSyncError:a,onSyncSuccess:i})}).catch(s=>{let l=s instanceof Error?s.message:String(s);a(l),o.current=lo({config:e,cwd:t,devSessionId:"",lastHash:"",onSyncError:a,onSyncSuccess:i})}),()=>{o.current?.()}},[e,t]),n}var ed=p(()=>{"use strict";co()});function wn(e){return{...Kk(e),type:e.type}}function Kk(e){switch(e.type){case"settings":return Qk(e);case"token":return Yk(e.exists);case"dev-server":return Zk(e);case"preconditions":return iS(e);case"engine-endpoint":return eS(e);case"adapter-enabled":return sS(e.status);case"webhook-verification":return tS(e.rejectsUnsigned);case"preconditions-validation":return nS(e);case"workflows":return lS(e);case"browser":return rS(e.installed);case"lockfile":return cS(e.status);case"pre-commit-hook":return oS(e.installed)}}function Qk(e){return e.valid?{detail:"configured",label:"Settings",tone:"ok"}:{detail:`missing ${e.missingFields.join(", ")}`,label:"Settings",tone:"error"}}function Yk(e){return e?{detail:"signed in",label:"Auth",tone:"ok"}:{detail:"not signed in",label:"Auth",tone:"error"}}function Zk(e){return e.reachable?{detail:e.appUrl,label:"Dev server",tone:"ok"}:{detail:`${e.appUrl} unreachable`,label:"Dev server",tone:"error"}}function eS(e){return e.reachable?{detail:e.url,label:"Endpoint",tone:"ok"}:{detail:`${e.url} unreachable`,label:"Endpoint",tone:"error"}}function tS(e){return e?{detail:"rejects unsigned",label:"Webhook auth",tone:"ok"}:{detail:"accepts unsigned!",label:"Webhook auth",tone:"error"}}function nS(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 rS(e){return e?{detail:"chromium installed",label:"Browser",tone:"ok"}:{detail:"chromium missing",label:"Browser",tone:"error"}}function oS(e){return e?{detail:"installed",label:"Pre-commit",tone:"ok"}:{detail:"not installed",label:"Pre-commit",tone:"warn"}}function iS(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 sS(e){let t=aS[e];return t??{detail:"unreachable",label:"Adapter",tone:"error"}}function lS(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 cS(e){let t=dS[e];return t??{detail:"stale (run ripplo compile)",label:"Lockfile",tone:"warn"}}var aS,dS,td,nd,So=p(()=>{"use strict";aS={"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"}};dS={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"}};td={"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"},nd={error:"ERROR",info:"INFO",ok:"OK",warn:"WARN"}});import{useEffect as pS,useState as uS}from"react";import mS from"path";import{watch as fS}from"chokidar";import{graphql as yS}from"gql.tada";function rd({config:e,cwd:t}){let[n,r]=uS({checks:[],lastRunAt:void 0,running:!1});return pS(()=>{let o={cancelled:!1,inFlight:!1,lastPushedKey:void 0},i;async function a(){if(!(o.cancelled||o.inFlight)){o.inFlight=!0;try{let d=await on(t);r({checks:d,lastRunAt:Date.now(),running:!1}),o.lastPushedKey=await kS({checks:d,config:e,lastPushedKey:o.lastPushedKey})}catch(d){g.error(d,"health check tick failed")}finally{o.inFlight=!1}}}function s(){o.cancelled||(i=setTimeout(()=>{a().finally(s)},gS))}a().finally(s);let l=fS(mS.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 kS({checks:e,config:t,lastPushedKey:n}){if(t.projectId.length===0)return n;let r=e.map(i=>{let a=wn(i);return{detail:a.detail,tone:nd[a.tone],type:td[a.type]}}),o=JSON.stringify(r);if(o===n)return n;try{return await L({config:t,document:hS,variables:{checks:r,projectId:t.projectId}}),o}catch(i){return g.error(i,"Failed to push health checks"),n}}var gS,hS,od=p(()=>{"use strict";J();Yr();So();gS=5e3,hS=yS(`
|
|
253
257
|
mutation PushHealthChecks($projectId: String!, $checks: [HealthCheckInput!]!) {
|
|
254
258
|
pushHealthChecks(projectId: $projectId, checks: $checks)
|
|
255
259
|
}
|
|
256
|
-
`)});import
|
|
260
|
+
`)});import wo from"fs";import{useEffect as SS}from"react";import{useQuery as wS,useSubscription as bS}from"urql";import{graphql as ad}from"gql.tada";function sd({cwd:e,projectId:t}){let[{data:n}]=wS({query:AS,variables:{projectId:t}});SS(()=>{let r=n?.project?.devSession?.hooksPaused;r!=null&&id({cwd:e,paused:r})},[e,n]),bS({query:RS,variables:{projectId:t}},(r,o)=>{let i=o.hooksPausedRequested;return i!=null&&id({cwd:e,paused:i.paused}),o})}function id({cwd:e,paused:t}){let n=ke(e,"hooks-paused");if(t){Me(e),wo.writeFileSync(n,"");return}wo.existsSync(n)&&wo.unlinkSync(n)}var AS,RS,ld=p(()=>{"use strict";J();AS=ad(`
|
|
257
261
|
query HooksPausedState($projectId: String!) {
|
|
258
262
|
project(id: $projectId) {
|
|
259
263
|
id
|
|
@@ -263,14 +267,14 @@ ${t.join(`
|
|
|
263
267
|
}
|
|
264
268
|
}
|
|
265
269
|
}
|
|
266
|
-
`),
|
|
270
|
+
`),RS=ad(`
|
|
267
271
|
subscription HooksPausedRequested($projectId: String!) {
|
|
268
272
|
hooksPausedRequested(projectId: $projectId) {
|
|
269
273
|
paused
|
|
270
274
|
projectId
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
|
-
`)});import{useEffect as
|
|
277
|
+
`)});import{useEffect as TS,useState as dd}from"react";import{useQuery as NS,useSubscription as cd}from"urql";import{graphql as bo}from"gql.tada";function ud({projectId:e}){let[{data:t}]=NS({query:vS,variables:{projectId:e}}),[n,r]=dd(),[o,i]=dd();return TS(()=>{let a=t?.project?.devSession?.hooksPaused;a!=null&&r(a);let s=t?.project?.devSession?.scopeItems;s!=null&&i(s.map(l=>pd(l)))},[t]),cd({query:CS,variables:{projectId:e}},(a,s)=>{let l=s.hooksPausedRequested;return l!=null&&r(l.paused),s}),cd({query:LS,variables:{projectId:e}},(a,s)=>{let l=s.scopeChanged?.devSession?.scopeItems;return l!=null&&i(l.map(d=>pd(d))),s}),{paused:n??!1,projectName:t?.project?.name,scope:o??[]}}function pd(e){let t=e.workflow;return t!=null?{id:e.id,label:t.name}:{id:e.id,label:e.label??"(intent)"}}var vS,CS,LS,md=p(()=>{"use strict";vS=bo(`
|
|
274
278
|
query ProjectStateDashboard($projectId: String!) {
|
|
275
279
|
project(id: $projectId) {
|
|
276
280
|
id
|
|
@@ -290,14 +294,14 @@ ${t.join(`
|
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
|
-
`),
|
|
297
|
+
`),CS=bo(`
|
|
294
298
|
subscription HooksPausedDashboard($projectId: String!) {
|
|
295
299
|
hooksPausedRequested(projectId: $projectId) {
|
|
296
300
|
paused
|
|
297
301
|
projectId
|
|
298
302
|
}
|
|
299
303
|
}
|
|
300
|
-
`),
|
|
304
|
+
`),LS=bo(`
|
|
301
305
|
subscription ScopeChangedDashboard($projectId: String!) {
|
|
302
306
|
scopeChanged(projectId: $projectId) {
|
|
303
307
|
projectId
|
|
@@ -315,11 +319,11 @@ ${t.join(`
|
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
|
-
`)});import{Box as bw,Text as Fo}from"ink";import{jsx as Kc,jsxs as Qc}from"react/jsx-runtime";function Yc({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return Qc(bw,{paddingX:1,children:[Kc(Fo,{dimColor:!0,children:"Activity "}),Qc(Fo,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),Kc(Fo,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var Zc=f(()=>{"use strict"});import{Box as Aw,Text as Un}from"ink";import{jsx as jn,jsxs as vw}from"react/jsx-runtime";function ed({check:e}){let{detail:t,label:n,tone:r}=_n(e),o=Rw[r];return vw(Aw,{children:[jn(Un,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),jn(Un,{children:" "}),jn(Un,{children:n.padEnd(18," ")}),jn(Un,{color:o,children:t})]})}var Rw,td=f(()=>{"use strict";Vo();Rw={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as Tw,Text as nd}from"ink";import{jsx as Ho,jsxs as Nw}from"react/jsx-runtime";function rd({checks:e}){return Nw(Tw,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Ho(nd,{bold:!0,children:"Health"}),e.length===0?Ho(nd,{dimColor:!0,children:"Running first pass..."}):e.map(t=>Ho(ed,{check:t},t.type))]})}var od=f(()=>{"use strict";td()});import{Box as $n,Text as yt}from"ink";import{jsx as gt,jsxs as Dn}from"react/jsx-runtime";function id({appUrl:e,developerUrl:t,projectName:n}){return Dn($n,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[Dn($n,{children:[gt(yt,{dimColor:!0,children:"Project "}),gt(yt,{bold:!0,children:n})]}),Dn($n,{children:[gt(yt,{dimColor:!0,children:"App "}),gt(yt,{color:"cyan",children:e})]}),Dn($n,{children:[gt(yt,{dimColor:!0,children:"Dashboard "}),gt(yt,{color:"cyan",children:t})]})]})}var ad=f(()=>{"use strict"});import{Box as Mo,Text as Fe}from"ink";import{jsx as He,jsxs as Jo}from"react/jsx-runtime";function sd({paused:e,scope:t}){return Jo(Mo,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Jo(Mo,{children:[He(Fe,{bold:!0,children:"Scope"}),He(Fe,{dimColor:!0,children:` (${String(t.length)})`}),He(Fe,{children:" "}),He(Fe,{dimColor:!0,children:"Hooks "}),He(Fe,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?He(Fe,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>Jo(Mo,{children:[He(Fe,{color:"cyan",children:"\u2022 "}),He(Fe,{children:n.label})]},n.id))]})}var ld=f(()=>{"use strict"});import{Box as Cw,Text as cd}from"ink";import{jsx as Lw,jsxs as dd}from"react/jsx-runtime";function pd({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 dd(Cw,{marginTop:1,paddingX:1,children:[Lw(cd,{dimColor:!0,children:"Workflows "}),dd(cd,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var ud=f(()=>{"use strict"});import HI from"chalk";import{z as md}from"zod";async function fd(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${xw}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return Pw.parse(r).version}catch{return}finally{clearTimeout(t)}}var zo,xw,Pw,yd=f(()=>{"use strict";G();zo="0.3.9",xw="ripplo",Pw=md.object({version:md.string()})});import{useEffect as Ew,useState as Ow}from"react";import{Text as Ze}from"ink";import{jsx as ht,jsxs as jw}from"react/jsx-runtime";function gd({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let s=Uw(),l=s!=null&&s!==zo,c=Iw({connected:n,syncError:i}),d=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${zo}`,m=l?` \u2192 v${s}`:"",h=`project ${r} \xB7 q to quit`,S=` ripplo ${u}${m} | ${o} ${c}${d}${p}`,w=Math.max(0,a-S.length-h.length-1);return jw(Ze,{inverse:!0,children:[ht(Ze,{bold:!0,children:" ripplo "}),ht(Ze,{dimColor:!0,children:u}),l?ht(Ze,{color:"yellow",children:` \u2192 v${s}`}):null,` | ${o} `,ht(Ze,{color:_w({connected:n,syncError:i}),children:c}),t?null:ht(Ze,{color:"yellow",children:d}),p," ".repeat(w),ht(Ze,{dimColor:!0,children:h})," "]})}function Iw({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function _w({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function Uw(){let[e,t]=Ow();return Ew(()=>{fd().then(n=>{n!=null&&t(n)})},[]),e}var hd=f(()=>{"use strict";yd()});import{useEffect as $w}from"react";import{availableParallelism as Dw}from"os";import{Box as Xo,Text as Bw,useApp as Vw,useInput as Ww}from"ink";import{jsx as Me,jsxs as kd}from"react/jsx-runtime";function Sd({config:e,cwd:t}){let n=Vw(),{height:r,width:o}=ft(),{config:i,devSessionId:a,syncError:s}=Uc({config:e,cwd:t}),{activeRunCount:l,browsersReady:c,connected:d}=mc({config:i,cwd:t,devSessionId:a}),{checks:p}=Bc({config:i,cwd:t}),{paused:u,projectName:m,scope:h}=Xc({projectId:e.projectId});Fc({cwd:t,projectId:e.projectId}),$w(()=>Dl(t),[t]),Ww(v=>{v==="q"&&n.exit()});let S=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,w=p.filter(v=>qw.has(v.type)),k=p.find(v=>v.type==="workflows"),b=p.find(v=>v.type==="preconditions"),T=Dw(),x=m??"\u2026";return kd(Xo,{flexDirection:"column",height:r,width:o,children:[Me(gd,{activeRunCount:l,browsersReady:c,connected:d,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:s,width:o}),kd(Xo,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[Me(id,{appUrl:i.appUrl,developerUrl:S,projectName:x}),Me(sd,{paused:u,scope:h}),Me(rd,{checks:w}),Me(pd,{preconditions:b,workflows:k}),Me(Yc,{activeRunCount:l,browsersReady:c,maxConcurrency:T}),Me(Xo,{marginTop:1,paddingX:1,children:Me(Bw,{dimColor:!0,children:"q quit"})})]})]})}var qw,wd=f(()=>{"use strict";To();In();jc();Vc();Hc();Gc();Oo();Zc();od();ad();ld();ud();hd();qw=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as bd}from"ink";import Fw from"ink-spinner";import{jsx as Ad,jsxs as Mw}from"react/jsx-runtime";function Rd({loading:e}){return e?Mw(bd,{color:Hw,children:[Ad(Fw,{type:"dots"})," Starting..."]}):Ad(bd,{children:""})}var Hw,vd=f(()=>{"use strict";Hw="#24CFFF"});import{useEffect as Jw,useState as $t}from"react";import{Box as et,Text as Go,useInput as zw}from"ink";import{jsx as Je,jsxs as Ko}from"react/jsx-runtime";function Nd({onDismiss:e}){let{height:t,width:n}=ft(),[r,o]=$t(0),[i,a]=$t(!1),[s,l]=$t(!1),[c,d]=$t(!1),[p,u]=$t(!1);zw(()=>{p&&e()}),Jw(()=>{let S=80+Bn.length*70+80,w=[...Bn.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),u(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{w.forEach(k=>{clearTimeout(k)})}},[e]);let m=Bn.length+5,h=Math.max(0,Math.floor((t-m)/2));return Ko(et,{flexDirection:"column",height:t,width:n,children:[Je(et,{height:h}),Ko(et,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[Je(et,{flexDirection:"column",children:Bn.map((S,w)=>Je(Go,{color:Td,children:w<r?S:""},S))}),Ko(et,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[Je(Go,{bold:!0,color:Td,children:i?Xw:""}),Je(et,{marginTop:1,children:Je(Go,{color:"gray",dimColor:!0,children:s?"developer CLI":""})}),Je(et,{marginTop:2,children:Je(Rd,{loading:c})})]})]})]})}var Bn,Td,Xw,Cd=f(()=>{"use strict";In();vd();Bn=[" 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 "],Td="#24CFFF",Xw="ripplo"});import{createAuthClient as Gw}from"better-auth/client";import{deviceAuthorizationClient as Kw}from"better-auth/client/plugins";function Vn({baseURL:e}){return Gw({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Kw()]})}var Qo=f(()=>{"use strict"});import{exec as Qw}from"child_process";async function xd({cwd:e,onDeviceCode:t,url:n}){let r=n??It().RIPPLO_SERVER_URL,o=Vn({baseURL:r}),i=await o.device.code({client_id:Ld});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}),ob(l);let c=await Zw({authClient:o,deviceCode:a});return Fr(e,c),c}async function Zw({authClient:e,deviceCode:t}){for(;;){await nb(Yw);let n=await e.device.token({client_id:Ld,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(!tb(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function tb(e){return eb.has(e)}function nb(e){return new Promise(t=>{setTimeout(t,e)})}function rb(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function ob(e){let t=rb();Qw(`${t} "${e}"`,()=>{})}var Yw,Ld,eb,Pd=f(()=>{"use strict";G();Qo();Ke();Yw=5e3,Ld="ripplo-cli";eb=new Set(["authorization_pending","slow_down"])});import{useCallback as Wn,useEffect as ib,useState as ze}from"react";import{exec as ab}from"child_process";import{promisify as sb}from"util";import J from"fs";import M from"path";function Od({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=ze(t==null?"login":"validating"),[i,a]=ze(),[s,l]=ze(),[c,d]=ze(t),[p,u]=ze(!1),[m,h]=ze(),[S,w]=ze(),[k,b]=ze([]);ib(()=>{if(t==null)return;Vn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(L=>{if(L.data==null){o("login");return}return Yo({cwd:e,serverUrl:n,token:t})}).then(L=>{if(L==null){o("select-project");return}a(L),o("complete")}).catch(L=>{l(L instanceof Error?L.message:String(L)),o("login")})},[e,t,n]);let T=Wn(()=>{p||(u(!0),l(void 0),xd({cwd:e,onDeviceCode:h,url:n}).then(O=>(d(O),Yo({cwd:e,serverUrl:n,token:O}))).then(O=>{O==null?o("select-project"):(a(O),o("complete"))}).catch(O=>{u(!1),h(void 0),l(O instanceof Error?O.message:String(O))}))},[e,p,n]),x=Wn(O=>{let L=i?.token??c??t;if(L==null){l("No authentication token available");return}o("scaffolding"),l(void 0),pb({cwd:e,onStep:w,projectId:O.id}).then(async V=>{b(V);let Xe=await Yo({cwd:e,serverUrl:n,token:L});a(Xe??lb({projectId:O.id,serverUrl:n,token:L})),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]),v=Wn(()=>{o("complete")},[]),U=Wn(()=>{a(void 0),o("login"),u(!1),h(void 0),l(void 0)},[]);return{config:i,deviceCodeInfo:m,dismissScaffoldWarnings:v,error:s,loginStarted:p,resetToLogin:U,scaffoldingStep:S,scaffoldWarnings:k,selectProject:x,setStage:o,stage:r,startLogin:T,token:c}}function lb({projectId:e,serverUrl:t,token:n}){return{appUrl:"",engineUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Yo({cwd:e,serverUrl:t,token:n}){let r=await I(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function pb({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),wb({cwd:e,projectId:n}),t("Updating .gitignore..."),xb(e),t("Marking ripplo.lock as generated..."),yb(e),t("Installing dependencies...");let r=await ub(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 mb(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await Tr(),o}async function ub(e){let t=gb({cwd:e,pm:Sb(e)});A.info("Installing dependencies: %s",t);try{return await db(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
|
|
319
|
-
`)[0]??n.message:String(n);return
|
|
322
|
+
`)});import{Box as PS,Text as Ao}from"ink";import{jsx as fd,jsxs as yd}from"react/jsx-runtime";function gd({activeRunCount:e,browsersReady:t,maxConcurrency:n}){return yd(PS,{paddingX:1,children:[fd(Ao,{dimColor:!0,children:"Activity "}),yd(Ao,{children:[String(e),"/",String(n)," running \xB7 browsers"," "]}),fd(Ao,{color:t?"green":"yellow",children:t?"ready":"warming"})]})}var hd=p(()=>{"use strict"});import{Box as xS,Text as bn}from"ink";import{jsx as An,jsxs as ES}from"react/jsx-runtime";function kd({check:e}){let{detail:t,label:n,tone:r}=wn(e),o=OS[r];return ES(xS,{children:[An(bn,{color:o,children:r==="info"?"\u25CB":"\u25CF"}),An(bn,{children:" "}),An(bn,{children:n.padEnd(18," ")}),An(bn,{color:o,children:t})]})}var OS,Sd=p(()=>{"use strict";So();OS={error:"red",info:"gray",ok:"green",warn:"yellow"}});import{Box as IS,Text as wd}from"ink";import{jsx as Ro,jsxs as _S}from"react/jsx-runtime";function bd({checks:e}){return _S(IS,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[Ro(wd,{bold:!0,children:"Health"}),e.length===0?Ro(wd,{dimColor:!0,children:"Running first pass..."}):e.map(t=>Ro(kd,{check:t},t.type))]})}var Ad=p(()=>{"use strict";Sd()});import{Box as Rn,Text as st}from"ink";import{jsx as lt,jsxs as Tn}from"react/jsx-runtime";function Rd({appUrl:e,developerUrl:t,projectName:n}){return Tn(Rn,{borderColor:"gray",borderStyle:"round",flexDirection:"column",paddingX:1,children:[Tn(Rn,{children:[lt(st,{dimColor:!0,children:"Project "}),lt(st,{bold:!0,children:n})]}),Tn(Rn,{children:[lt(st,{dimColor:!0,children:"App "}),lt(st,{color:"cyan",children:e})]}),Tn(Rn,{children:[lt(st,{dimColor:!0,children:"Dashboard "}),lt(st,{color:"cyan",children:t})]})]})}var Td=p(()=>{"use strict"});import{Box as To,Text as De}from"ink";import{jsx as Be,jsxs as No}from"react/jsx-runtime";function Nd({paused:e,scope:t}){return No(To,{borderColor:"gray",borderStyle:"round",flexDirection:"column",marginTop:1,paddingX:1,children:[No(To,{children:[Be(De,{bold:!0,children:"Scope"}),Be(De,{dimColor:!0,children:` (${String(t.length)})`}),Be(De,{children:" "}),Be(De,{dimColor:!0,children:"Hooks "}),Be(De,{color:e?"yellow":"green",children:e?"paused":"active"})]}),t.length===0?Be(De,{dimColor:!0,children:"no scope items \u2014 add from the dashboard or `ripplo scope add`"}):t.map(n=>No(To,{children:[Be(De,{color:"cyan",children:"\u2022 "}),Be(De,{children:n.label})]},n.id))]})}var vd=p(()=>{"use strict"});import{Box as US,Text as Cd}from"ink";import{jsx as jS,jsxs as Ld}from"react/jsx-runtime";function Pd({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 Ld(US,{marginTop:1,paddingX:1,children:[jS(Cd,{dimColor:!0,children:"Workflows "}),Ld(Cd,{children:[String(n)," tests \xB7 ",String(o)," preconditions",r>0?` \xB7 ${String(r)} invalid`:""]})]})}var xd=p(()=>{"use strict"});import iI from"chalk";import{z as Od}from"zod";async function Ed(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${$S}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return DS.parse(r).version}catch{return}finally{clearTimeout(t)}}var vo,$S,DS,Id=p(()=>{"use strict";J();vo="0.3.11",$S="ripplo",DS=Od.object({version:Od.string()})});import{useEffect as BS,useState as VS}from"react";import{Text as Xe}from"ink";import{jsx as dt,jsxs as MS}from"react/jsx-runtime";function _d({activeRunCount:e,browsersReady:t,connected:n,projectId:r,ripploServerUrl:o,syncError:i,width:a}){let s=qS(),l=s!=null&&s!==vo,d=WS({connected:n,syncError:i}),c=t?"":" warming up browsers...",u=e>0?` ${String(e)} running`:"",y=`v${vo}`,S=l?` \u2192 v${s}`:"",w=`project ${r} \xB7 q to quit`,k=` ripplo ${y}${S} | ${o} ${d}${c}${u}`,A=Math.max(0,a-k.length-w.length-1);return MS(Xe,{inverse:!0,children:[dt(Xe,{bold:!0,children:" ripplo "}),dt(Xe,{dimColor:!0,children:y}),l?dt(Xe,{color:"yellow",children:` \u2192 v${s}`}):null,` | ${o} `,dt(Xe,{color:FS({connected:n,syncError:i}),children:d}),t?null:dt(Xe,{color:"yellow",children:c}),u," ".repeat(A),dt(Xe,{dimColor:!0,children:w})," "]})}function WS({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function FS({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function qS(){let[e,t]=VS();return BS(()=>{Ed().then(n=>{n!=null&&t(n)})},[]),e}var Ud=p(()=>{"use strict";Id()});import{useEffect as HS}from"react";import{availableParallelism as JS}from"os";import{Box as Co,Text as zS,useApp as XS,useInput as GS}from"ink";import{jsx as Ve,jsxs as jd}from"react/jsx-runtime";function $d({config:e,cwd:t}){let n=XS(),{height:r,width:o}=at(),{config:i,devSessionId:a,syncError:s}=Zl({config:e,cwd:t}),{activeRunCount:l,browsersReady:d,connected:c}=Ol({config:i,cwd:t,devSessionId:a}),{checks:u}=rd({config:i,cwd:t}),{paused:y,projectName:S,scope:w}=ud({projectId:e.projectId});sd({cwd:t,projectId:e.projectId}),HS(()=>nl(t),[t]),GS(j=>{j==="q"&&n.exit()});let k=`${i.ripploServerUrl}/projects/${i.projectId}/developer`,A=u.filter(j=>KS.has(j.type)),T=u.find(j=>j.type==="workflows"),O=u.find(j=>j.type==="preconditions"),W=JS(),U=S??"\u2026";return jd(Co,{flexDirection:"column",height:r,width:o,children:[Ve(_d,{activeRunCount:l,browsersReady:d,connected:c,projectId:i.projectId,ripploServerUrl:i.ripploServerUrl,syncError:s,width:o}),jd(Co,{flexDirection:"column",flexGrow:1,paddingX:1,paddingY:1,children:[Ve(Rd,{appUrl:i.appUrl,developerUrl:k,projectName:U}),Ve(Nd,{paused:y,scope:w}),Ve(bd,{checks:A}),Ve(Pd,{preconditions:O,workflows:T}),Ve(gd,{activeRunCount:l,browsersReady:d,maxConcurrency:W}),Ve(Co,{marginTop:1,paddingX:1,children:Ve(zS,{dimColor:!0,children:"q quit"})})]})]})}var KS,Dd=p(()=>{"use strict";oo();Sn();ed();od();ld();md();uo();hd();Ad();Td();vd();xd();Ud();KS=new Set(["dev-server","preconditions","adapter-enabled","webhook-verification","lockfile","pre-commit-hook","browser"])});import{Text as Bd}from"ink";import QS from"ink-spinner";import{jsx as Vd,jsxs as ZS}from"react/jsx-runtime";function Wd({loading:e}){return e?ZS(Bd,{color:YS,children:[Vd(QS,{type:"dots"})," Starting..."]}):Vd(Bd,{children:""})}var YS,Fd=p(()=>{"use strict";YS="#24CFFF"});import{useEffect as ew,useState as Nt}from"react";import{Box as Ge,Text as Lo,useInput as tw}from"ink";import{jsx as We,jsxs as Po}from"react/jsx-runtime";function Md({onDismiss:e}){let{height:t,width:n}=at(),[r,o]=Nt(0),[i,a]=Nt(!1),[s,l]=Nt(!1),[d,c]=Nt(!1),[u,y]=Nt(!1);tw(()=>{u&&e()}),ew(()=>{let k=80+Nn.length*70+80,A=[...Nn.map((T,O)=>setTimeout(()=>{o(O+1)},80+O*70)),setTimeout(()=>{a(!0)},k),setTimeout(()=>{l(!0)},k+200),setTimeout(()=>{c(!0)},k+400),setTimeout(()=>{c(!1),y(!0)},k+2e3),setTimeout(()=>{e()},k+2800)];return()=>{A.forEach(T=>{clearTimeout(T)})}},[e]);let S=Nn.length+5,w=Math.max(0,Math.floor((t-S)/2));return Po(Ge,{flexDirection:"column",height:t,width:n,children:[We(Ge,{height:w}),Po(Ge,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[We(Ge,{flexDirection:"column",children:Nn.map((k,A)=>We(Lo,{color:qd,children:A<r?k:""},k))}),Po(Ge,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[We(Lo,{bold:!0,color:qd,children:i?nw:""}),We(Ge,{marginTop:1,children:We(Lo,{color:"gray",dimColor:!0,children:s?"developer CLI":""})}),We(Ge,{marginTop:2,children:We(Wd,{loading:d})})]})]})]})}var Nn,qd,nw,Hd=p(()=>{"use strict";Sn();Fd();Nn=[" 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 "],qd="#24CFFF",nw="ripplo"});import{createAuthClient as rw}from"better-auth/client";import{deviceAuthorizationClient as ow}from"better-auth/client/plugins";function vn({baseURL:e}){return rw({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[ow()]})}var xo=p(()=>{"use strict"});import{exec as iw}from"child_process";async function zd({cwd:e,onDeviceCode:t,url:n}){let r=n??bt().RIPPLO_SERVER_URL,o=vn({baseURL:r}),i=await o.device.code({client_id:Jd});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}),uw(l);let d=await sw({authClient:o,deviceCode:a});return Cr(e,d),d}async function sw({authClient:e,deviceCode:t}){for(;;){await cw(aw);let n=await e.device.token({client_id:Jd,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(!dw(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function dw(e){return lw.has(e)}function cw(e){return new Promise(t=>{setTimeout(t,e)})}function pw(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function uw(e){let t=pw();iw(`${t} "${e}"`,()=>{})}var aw,Jd,lw,Xd=p(()=>{"use strict";J();xo();He();aw=5e3,Jd="ripplo-cli";lw=new Set(["authorization_pending","slow_down"])});import{useCallback as Cn,useEffect as mw,useState as Fe}from"react";import{exec as fw}from"child_process";import{promisify as yw}from"util";import F from"fs";import V from"path";function Kd({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Fe(t==null?"login":"validating"),[i,a]=Fe(),[s,l]=Fe(),[d,c]=Fe(t),[u,y]=Fe(!1),[S,w]=Fe(),[k,A]=Fe(),[T,O]=Fe([]);mw(()=>{if(t==null)return;vn({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(_=>{if(_.data==null){o("login");return}return Oo({cwd:e,serverUrl:n,token:t})}).then(_=>{if(_==null){o("select-project");return}a(_),o("complete")}).catch(_=>{l(_ instanceof Error?_.message:String(_)),o("login")})},[e,t,n]);let W=Cn(()=>{u||(y(!0),l(void 0),zd({cwd:e,onDeviceCode:w,url:n}).then(q=>(c(q),Oo({cwd:e,serverUrl:n,token:q}))).then(q=>{q==null?o("select-project"):(a(q),o("complete"))}).catch(q=>{y(!1),w(void 0),l(q instanceof Error?q.message:String(q))}))},[e,u,n]),U=Cn(q=>{let _=i?.token??d??t;if(_==null){l("No authentication token available");return}o("scaffolding"),l(void 0),Sw({cwd:e,onStep:A,projectId:q.id}).then(async z=>{O(z);let qe=await Oo({cwd:e,serverUrl:n,token:_});a(qe??gw({projectId:q.id,serverUrl:n,token:_})),o(z.length>0?"scaffolding-warnings":"complete")}).catch(z=>{l(z instanceof Error?z.message:String(z)),o("select-project")})},[i,e,t,n,d]),j=Cn(()=>{o("complete")},[]),ae=Cn(()=>{a(void 0),o("login"),y(!1),w(void 0),l(void 0)},[]);return{config:i,deviceCodeInfo:S,dismissScaffoldWarnings:j,error:s,loginStarted:u,resetToLogin:ae,scaffoldingStep:k,scaffoldWarnings:T,selectProject:U,setStage:o,stage:r,startLogin:W,token:d}}function gw({projectId:e,serverUrl:t,token:n}){return{appUrl:"",engineUrl:"",projectId:e,ripploServerUrl:t,token:n,webhookSecret:""}}async function Oo({cwd:e,serverUrl:t,token:n}){let r=await C(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Sw({cwd:e,onStep:t,projectId:n}){t("Scaffolding project files..."),Lw({cwd:e,projectId:n}),t("Updating .gitignore..."),$w(e),t("Marking ripplo.lock as generated..."),Rw(e),t("Installing dependencies...");let r=await ww(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 bw(e);i!=null&&o.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),await lr(),o}async function ww(e){let t=Tw({cwd:e,pm:Cw(e)});g.info("Installing dependencies: %s",t);try{return await kw(t,{cwd:e}),{ok:!0}}catch(n){let r=n instanceof Error?n.message.split(`
|
|
323
|
+
`)[0]??n.message:String(n);return g.warn("Install failed (%s): %s",t,r),{cmd:t,ok:!1,reason:r}}}async function bw(e){try{await Aw(e);return}catch(t){let n=t instanceof Error?t.message:String(t);return g.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 Aw(e){let t=await C(e);if(!t.ok){g.warn("Initial compile failed, skipping lockfile write: %s",t.error);return}await pe({cwd:e,result:t.result})}function Rw(e){let t=V.join(e,".gitattributes"),n=F.existsSync(t)?F.readFileSync(t,"utf8"):"";if(n.includes(Gd))return;let r=n.length===0||n.endsWith(`
|
|
320
324
|
`)?"":`
|
|
321
|
-
`;
|
|
322
|
-
`)}function
|
|
325
|
+
`;F.writeFileSync(t,`${n}${r}${Gd}
|
|
326
|
+
`)}function Tw({cwd:e,pm:t}){let n=hw.join(" ");return t==="pnpm"?Nw(e)?`pnpm add -wD ${n}`:`pnpm add -D ${n}`:t==="yarn"?vw(e)?`yarn add -WD ${n}`:`yarn add -D ${n}`:t==="bun"?`bun add -d ${n}`:`npm install -D ${n}`}function Nw(e){return F.existsSync(V.join(e,"pnpm-workspace.yaml"))||F.existsSync(V.join(e,"pnpm-workspace.yml"))}function vw(e){let t=V.join(e,"package.json");if(!F.existsSync(t))return!1;try{let n=JSON.parse(F.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 Cw(e){return F.existsSync(V.join(e,"pnpm-lock.yaml"))?"pnpm":F.existsSync(V.join(e,"yarn.lock"))?"yarn":F.existsSync(V.join(e,"bun.lockb"))||F.existsSync(V.join(e,"bun.lock"))?"bun":"npm"}function Lw({cwd:e,projectId:t}){let n=V.join(e,".ripplo"),r=V.join(n,"tests"),o=V.join(n,"preconditions"),i=V.join(n,"observers");F.mkdirSync(r,{recursive:!0}),F.mkdirSync(o,{recursive:!0}),F.mkdirSync(i,{recursive:!0}),Ke(V.join(n,"ripplo.ts"),Pw(t)),Ke(V.join(n,"index.ts"),Ow),Ke(V.join(o,"index.ts"),Ew),Ke(V.join(i,"index.ts"),Iw),Ke(V.join(r,"index.ts"),_w),Ke(V.join(n,".env"),xw()),Ke(V.join(n,"tsconfig.json"),Uw)}function Ke(e,t){F.existsSync(e)||F.writeFileSync(e,t)}function Pw(e){return`import { createRipplo } from "@ripplo/testing";
|
|
323
327
|
import { preconditions } from "./preconditions/index.js";
|
|
324
328
|
import { observers } from "./observers/index.js";
|
|
325
329
|
import { tests } from "./tests/index.js";
|
|
@@ -334,17 +338,17 @@ const ripplo = createRipplo(
|
|
|
334
338
|
);
|
|
335
339
|
|
|
336
340
|
export default ripplo;
|
|
337
|
-
`}function
|
|
338
|
-
`}function
|
|
341
|
+
`}function xw(){return`RIPPLO_WEBHOOK_SECRET="${Br()}"
|
|
342
|
+
`}function $w(e){let t=V.join(e,".gitignore");if(!F.existsSync(t))return;let n=F.readFileSync(t,"utf8"),r=jw.filter(i=>!n.includes(i));if(r.length===0)return;let o=n.endsWith(`
|
|
339
343
|
`)?"":`
|
|
340
|
-
`;
|
|
344
|
+
`;F.writeFileSync(t,n+o+r.join(`
|
|
341
345
|
`)+`
|
|
342
|
-
`)}var
|
|
346
|
+
`)}var hw,kw,Gd,Ow,Ew,Iw,_w,Uw,jw,Qd=p(()=>{"use strict";J();xe();Xd();xo();X();hw=["@ripplo/testing"],kw=yw(fw);Gd=".ripplo/ripplo.lock linguist-generated=true";Ow=`// Re-exports for CLI / adapter / server imports.
|
|
343
347
|
export { default } from "./ripplo.js";
|
|
344
348
|
export { preconditions } from "./preconditions/index.js";
|
|
345
349
|
export { observers } from "./observers/index.js";
|
|
346
350
|
export { tests } from "./tests/index.js";
|
|
347
|
-
`,
|
|
351
|
+
`,Ew=`// Declare preconditions with \`precondition(name)\` from @ripplo/testing and collect them
|
|
348
352
|
// in the \`preconditions\` registry below. Every handle in this registry must be implemented
|
|
349
353
|
// in your app server's \`createEngine(ripplo, { preconditions: {...}, observers: {...} })\` call.
|
|
350
354
|
//
|
|
@@ -358,7 +362,7 @@ export { tests } from "./tests/index.js";
|
|
|
358
362
|
// export const preconditions = { authLoggedIn };
|
|
359
363
|
|
|
360
364
|
export const preconditions = {};
|
|
361
|
-
`,
|
|
365
|
+
`,Iw=`// Declare observers with \`observer(name)\` from @ripplo/testing and collect them in
|
|
362
366
|
// the \`observers\` registry below. Use them in tests via \`assert.backend(handle, params)\`.
|
|
363
367
|
//
|
|
364
368
|
// Example:
|
|
@@ -371,7 +375,7 @@ export const preconditions = {};
|
|
|
371
375
|
// export const observers = { orgNameIs };
|
|
372
376
|
|
|
373
377
|
export const observers = {};
|
|
374
|
-
`,
|
|
378
|
+
`,_w=`// Each test file under ./tests exports a TestDefinition. Import them here and add them
|
|
375
379
|
// to the \`tests\` array \u2014 that's what \`createRipplo(..., { tests })\` receives.
|
|
376
380
|
//
|
|
377
381
|
// Example:
|
|
@@ -379,7 +383,7 @@ export const observers = {};
|
|
|
379
383
|
// export const tests = [myTest] as const;
|
|
380
384
|
|
|
381
385
|
export const tests = [] as const;
|
|
382
|
-
`,
|
|
386
|
+
`,Uw=`{
|
|
383
387
|
"compilerOptions": {
|
|
384
388
|
"strict": true,
|
|
385
389
|
"noUncheckedIndexedAccess": true,
|
|
@@ -395,7 +399,7 @@ export const tests = [] as const;
|
|
|
395
399
|
"include": ["*.ts", "observers/**/*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
|
|
396
400
|
"exclude": ["node_modules"]
|
|
397
401
|
}
|
|
398
|
-
`,
|
|
402
|
+
`,jw=[".ripplo/debug/",".ripplo/.local/",".ripplo/.env"]});import{useCallback as Dw,useEffect as Bw,useMemo as Yd,useState as Vw}from"react";import{Box as Zd,Text as Eo}from"ink";import{Provider as Ww}from"urql";import{graphql as Fw}from"gql.tada";import{jsx as Le,jsxs as Jw}from"react/jsx-runtime";function ec({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=Vw(!0),i=Kd({cwd:e,initialToken:t,serverUrl:n}),{height:a,width:s}=at(),l=Yd(()=>Mw({serverUrl:n,setup:i}),[i,n]),d=Yd(()=>Dl({config:l}),[l]);Bw(()=>{i.config!=null&&(Io({client:d,projectId:i.config.projectId}),d.query(qw,{projectId:i.config.projectId}).toPromise())},[d,i.config]);let c=Dw(()=>{o(!1)},[]);return Le(Ww,{value:d,children:Hw({cwd:e,dismissSplash:c,effectiveConfig:l,height:a,setup:i,showSplash:r,width:s})})}function Mw({serverUrl:e,setup:t}){return t.config!=null?t.config:{appUrl:"",engineUrl:"",projectId:"",ripploServerUrl:e,token:t.token??"",webhookSecret:""}}function Hw({cwd:e,dismissSplash:t,effectiveConfig:n,height:r,setup:o,showSplash:i,width:a}){return i?Le(Md,{onDismiss:t}):o.stage==="validating"?Le(Zd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:Jw(Eo,{children:[Le(Eo,{color:"yellow",children:"* "}),Le(Eo,{children:"Validating session..."})]})}):o.stage==="complete"&&o.config!=null?Le($d,{config:o.config,cwd:e}):o.stage==="login"||o.token==null?Le(Zd,{alignItems:"center",height:r,justifyContent:"center",width:a,children:Le(Wl,{deviceCodeInfo:o.deviceCodeInfo,error:o.error,loginStarted:o.loginStarted,startLogin:o.startLogin})}):Le(Kl,{config:o.config??n,error:o.error,scaffoldingStep:o.scaffoldingStep,scaffoldWarnings:o.scaffoldWarnings,selectProject:o.selectProject,stage:o.stage,onDismissWarnings:o.dismissScaffoldWarnings})}var qw,tc=p(()=>{"use strict";_o();Bl();Fl();Ql();Dd();Hd();Qd();Sn();qw=Fw(`
|
|
399
403
|
query PrefetchProjectState($projectId: String!) {
|
|
400
404
|
project(id: $projectId) {
|
|
401
405
|
id
|
|
@@ -415,31 +419,31 @@ export const tests = [] as const;
|
|
|
415
419
|
}
|
|
416
420
|
}
|
|
417
421
|
}
|
|
418
|
-
`)});var
|
|
419
|
-
${
|
|
420
|
-
`),
|
|
421
|
-
${
|
|
422
|
+
`)});var nc={};jo(nc,{clearActiveSession:()=>Qw,launchDashboard:()=>Zw,setActiveSession:()=>Io});import vt from"fs";import Uo from"path";import zw from"react";import{render as Xw}from"ink";import{graphql as Gw}from"gql.tada";function Io({client:e,projectId:t}){Ln=e,Pn=t}function Qw(){Ln=void 0,Pn=void 0}function Yw(){if(Ln==null||Pn==null)return Promise.resolve();let e=Ln.mutation(Kw,{projectId:Pn}).toPromise().then(()=>{}).catch(()=>{}),t=new Promise(n=>{setTimeout(n,3e3)});return Promise.race([e,t])}function Zw({restoreStdio:e}){let t=process.cwd(),n=Uo.join(t,".ripplo","debug"),r=Uo.join(n,"debug.log"),o=Uo.join(n,"last-crash.log");vt.mkdirSync(n,{recursive:!0}),rr({filePath:r});function i(l){e(),vt.mkdirSync(n,{recursive:!0});let d=l instanceof Error?l.stack??l.message:String(l);vt.writeFileSync(o,`${new Date().toISOString()}
|
|
423
|
+
${d}
|
|
424
|
+
`),xl().finally(()=>{process.exit(1)})}let a;try{let l=ye(t),d=Se();e(),a=Xw(zw.createElement(ec,{cwd:t,initialToken:l??void 0,serverUrl:d}),{alternateScreen:!0}),a.waitUntilExit().then(()=>Yw()).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{vt.mkdirSync(n,{recursive:!0});let d=l instanceof Error?l.stack??l.message:String(l);vt.appendFileSync(o,`${new Date().toISOString()} [unhandledRejection]
|
|
425
|
+
${d}
|
|
422
426
|
|
|
423
|
-
`)}catch{}})}var
|
|
427
|
+
`)}catch{}})}var Kw,Ln,Pn,_o=p(()=>{"use strict";uo();J();tc();He();Kw=Gw(`
|
|
424
428
|
mutation EndDevSessionExit($projectId: String!) {
|
|
425
429
|
endDevSession(projectId: $projectId) {
|
|
426
430
|
id
|
|
427
431
|
}
|
|
428
432
|
}
|
|
429
|
-
`)});
|
|
430
|
-
`),process.stderr.write(`${
|
|
431
|
-
`),process.exit(1)),e.check){let r=await
|
|
432
|
-
`);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${
|
|
433
|
-
`),process.stderr.write(`${
|
|
434
|
-
`),process.exit(1)}await
|
|
435
|
-
`)}
|
|
433
|
+
`)});On();import{config as rc}from"dotenv";import Ct from"path";import{fileURLToPath as eb}from"url";import tb from"yargs";import{hideBin as nb}from"yargs/helpers";xe();X();function b(e,t){return t==null?`\u2192 /ripplo:${e}`:`\u2192 /ripplo:${e} \u2014 ${t}`}async function Qo(e){let t=process.cwd(),n=await C(t);if(n.ok||(process.stderr.write(`Compilation failed: ${n.error}
|
|
434
|
+
`),process.stderr.write(`${b("create","DSL authoring + lint rules")}
|
|
435
|
+
`),process.exit(1)),e.check){let r=await xt({cwd:t}),o=Ot({compiled:n.result,existing:r});if(o==="match"){process.stdout.write(`${he} is up to date
|
|
436
|
+
`);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${he} is ${i} \u2014 run \`ripplo compile\` and commit the result
|
|
437
|
+
`),process.stderr.write(`${b("setup")}
|
|
438
|
+
`),process.exit(1)}await pe({cwd:t,result:n.result}),process.stdout.write(`wrote ${he}
|
|
439
|
+
`)}Yr();async function _s(){let e=process.cwd(),t=await on(e),n=t.map(o=>Is(o));process.stdout.write(n.join(`
|
|
436
440
|
`)+`
|
|
437
|
-
`);let r=t.some(o=>
|
|
441
|
+
`);let r=t.some(o=>Os(o));process.exit(r?1:0)}J();import{graphql as an,readFragment as ig}from"gql.tada";import Us from"figures";var wt={cross:Us.cross,tick:Us.tick};var $s=an(`
|
|
438
442
|
fragment WorkflowIdMCP on Workflow {
|
|
439
443
|
id
|
|
440
444
|
slug
|
|
441
445
|
}
|
|
442
|
-
`),
|
|
446
|
+
`),ag=an(`
|
|
443
447
|
query ProjectWorkflowIdsMCP($projectId: String!) {
|
|
444
448
|
project(id: $projectId) {
|
|
445
449
|
id
|
|
@@ -451,14 +455,14 @@ ${c}
|
|
|
451
455
|
}
|
|
452
456
|
}
|
|
453
457
|
}
|
|
454
|
-
`,[
|
|
458
|
+
`,[$s]),sg=an(`
|
|
455
459
|
mutation CreateRunMCP($workflowId: String!, $platforms: [String!]!, $concurrency: Int!) {
|
|
456
460
|
createRun(workflowId: $workflowId, platforms: $platforms, concurrency: $concurrency) {
|
|
457
461
|
id
|
|
458
462
|
status
|
|
459
463
|
}
|
|
460
464
|
}
|
|
461
|
-
`),
|
|
465
|
+
`),lg=an(`
|
|
462
466
|
query RunStatusMCP($id: String!) {
|
|
463
467
|
run(id: $id) {
|
|
464
468
|
id
|
|
@@ -485,19 +489,19 @@ ${c}
|
|
|
485
489
|
}
|
|
486
490
|
}
|
|
487
491
|
}
|
|
488
|
-
`);async function
|
|
489
|
-
${
|
|
490
|
-
Debug artifacts: ${
|
|
491
|
-
${
|
|
492
|
+
`);async function sn({config:e,ids:t}){let n=await dg({config:e,ids:t}),r=await Promise.all(n.map(async a=>{try{let s=await pg({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}
|
|
493
|
+
${b("setup","check auth + config")}`};let{entry:s,runId:l}=a;try{let d=await mg({config:e,runId:l}),c=cg({config:e,id:s.id,runId:l}),u=`.ripplo/debug/${l}/`;return{id:s.id,runId:l,summary:`View run: ${c}
|
|
494
|
+
Debug artifacts: ${u}
|
|
495
|
+
${b("debug","read summary.txt, accessibility-tree, network.jsonl before guessing")}
|
|
492
496
|
|
|
493
|
-
${
|
|
494
|
-
${
|
|
497
|
+
${d}`}}catch(d){let c=d instanceof Error?d.message:String(d);return{id:s.id,runId:l,summary:`ERROR polling run ${l}: ${c}
|
|
498
|
+
${b("debug")}`}}})),i=o.map(a=>`**${a.id}:**
|
|
495
499
|
${a.summary}`).join(`
|
|
496
500
|
|
|
497
501
|
---
|
|
498
502
|
|
|
499
|
-
`);return{results:o,summary:i}}async function
|
|
500
|
-
`)}function
|
|
503
|
+
`);return{results:o,summary:i}}async function dg({config:e,ids:t}){let n=await L({config:e,document:ag,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=>ig($s,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 cg({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 pg({config:e,workflowId:t}){let n=await L({config:e,document:sg,variables:{concurrency:1,platforms:["chromium"],workflowId:t}});if(n.createRun==null)throw new Error("Failed to create run");return n.createRun.id}var ug=2e3,js=150;async function mg({config:e,runId:t}){let n=0;for(;n<js;){await yg(ug),n+=1;let o=(await L({config:e,document:lg,variables:{id:t}})).run;if(o==null)throw new Error(`Run ${t} not found`);if(!(o.status==="pending"||o.status==="running"))return fg({results:o.results??[],runId:t,status:o.status})}return`Run ${t} timed out after polling ${String(js)} times.`}function fg({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"?wt.tick:wt.cross,s=i.detail==null?"":` \u2014 ${i.detail}`;r.push(` ${a} ${i.title} (${String(i.duration)}ms)${s}`),i.assertions.forEach(l=>{let d=l.status==="passed"?wt.tick:wt.cross,c=l.detail==null?"":` \u2014 ${l.detail}`;r.push(` ${d} ${l.description}${c}`)})})}),r.join(`
|
|
504
|
+
`)}function yg(e){return new Promise(t=>{setTimeout(t,e)})}J();X();He();import{graphql as bg}from"gql.tada";var Ag=bg(`
|
|
501
505
|
query DevSessionCheckPreflight($projectId: String!) {
|
|
502
506
|
project(id: $projectId) {
|
|
503
507
|
id
|
|
@@ -506,39 +510,39 @@ ${a.summary}`).join(`
|
|
|
506
510
|
}
|
|
507
511
|
}
|
|
508
512
|
}
|
|
509
|
-
`);async function
|
|
510
|
-
`),process.exit(1));let n=await
|
|
511
|
-
`),process.stderr.write(`${
|
|
512
|
-
`),process.exit(1)),{...n.result.config,ripploServerUrl:
|
|
513
|
-
`),process.exit(1))}async function
|
|
514
|
-
`);let r=await Promise.allSettled(Array.from({length:t},()=>
|
|
515
|
-
`).find(
|
|
513
|
+
`);async function Ae(){let e=process.cwd(),t=ye(e);t==null&&(process.stderr.write("Not authenticated. Run `ripplo` to set up your config first.\n"),process.stderr.write(`${b("setup")}
|
|
514
|
+
`),process.exit(1));let n=await C(e);return n.ok||(process.stderr.write(`Failed to compile DSL config: ${n.error}
|
|
515
|
+
`),process.stderr.write(`${b("setup")}
|
|
516
|
+
`),process.exit(1)),{...n.result.config,ripploServerUrl:Se(),token:t}}async function Re(e){(await L({config:e,document:Ag,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(`${b("setup")}
|
|
517
|
+
`),process.exit(1))}async function Vs({id:e,runs:t}){let n=await Ae();await Re(n),process.stdout.write(`Running "${e}" ${String(t)} times in parallel...
|
|
518
|
+
`);let r=await Promise.allSettled(Array.from({length:t},()=>sn({config:n,ids:[e]}))),o=0,i=0,a=new Map;r.forEach(l=>{if(l.status==="rejected"){i++;let c=l.reason instanceof Error?l.reason.message:"unknown error";a.set(c,(a.get(c)??0)+1);return}let d=l.value.results[0];if(d==null){i++;return}if(d.summary.includes("FAILED")||d.summary.includes("ERROR")){i++;let c=d.summary.split(`
|
|
519
|
+
`).find(u=>u.includes("FAILED")||u.includes("ERROR"))??"unknown failure";a.set(c,(a.get(c)??0)+1)}else o++});let s=t>0?i/t*100:0;process.stdout.write(`
|
|
516
520
|
Results: ${String(o)} passed, ${String(i)} failed out of ${String(t)} runs
|
|
517
521
|
`),process.stdout.write(`Flake rate: ${s.toFixed(1)}%
|
|
518
522
|
`),a.size>0&&(process.stdout.write(`
|
|
519
523
|
Failure patterns:
|
|
520
|
-
`),a.forEach((l,
|
|
521
|
-
`)})),i>0&&process.stderr.write(`${
|
|
522
|
-
`),process.exit(i>0?1:0)}import
|
|
523
|
-
`),process.stderr.write(`${
|
|
524
|
-
`),process.exit(1)),await
|
|
525
|
-
${
|
|
526
|
-
`),
|
|
527
|
-
`),process.stderr.write(` ${
|
|
528
|
-
`)})});let l=new Set(o.builder.getUnimplemented().tests),
|
|
524
|
+
`),a.forEach((l,d)=>{process.stdout.write(` ${String(l)}x: ${d}
|
|
525
|
+
`)})),i>0&&process.stderr.write(`${b("flake-detect","parallel safety + race conditions")}
|
|
526
|
+
`),process.exit(i>0?1:0)}import ro from"fs";import Ms from"path";import*as Hs from"remeda";import{z as we}from"zod";var Zr=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],eo=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md","**/.next/**","**/.turbo/**","**/.vercel/**","**/.svelte-kit/**","**/.nuxt/**","**/.astro/**","**/coverage/**","**/storybook-static/**","**/*.stories.*","**/*.story.*","**/__tests__/**","**/__mocks__/**","**/__fixtures__/**","**/*.config.*","**/*.setup.*","**/public/**","**/static/**","**/assets/**","**/migrations/**","**/prisma/migrations/**","**/scripts/**"],Rg=we.object({appUrl:we.string(),engineUrl:we.string(),ignorePaths:we.array(we.string()).optional(),projectId:we.string(),watchPaths:we.array(we.string()).optional(),webhookSecret:we.string()}),Tg=Rg.extend({webhookSecret:we.string().optional()});Bn();Et();import{Webhook as CL,WebhookVerificationError as LL}from"standardwebhooks";import{z as I}from"zod";var xL=I.object({preconditions:I.array(I.string().min(1))}),OL=I.object({data:I.record(I.string(),I.record(I.string(),I.string())),preconditions:I.array(I.string().min(1))}),EL=I.object({observer:I.string().min(1).max(200),params:I.record(I.string().max(200),I.string())}),Ng=I.discriminatedUnion("kind",[I.object({kind:I.literal("pass")}),I.object({kind:I.literal("retry"),reason:I.string()}),I.object({kind:I.literal("fail"),reason:I.string()})]),IL=I.object({error:I.string().optional(),outcome:Ng.optional(),success:I.boolean()});Lt();function nt(e){let t=[];return e.tests.forEach(n=>{let r=vg(n),o=i=>{t.push({...i,test:n.slug})};Xg.forEach(i=>{i(r,n,o)})}),{diagnostics:t}}function vg(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 Cg(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 Lg(e,t,n){Object.keys(t.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Fs(o.value)){let i=o.value.value;!qs(i)&&Ug(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 Pg(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 xg(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 Og(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 Eg(e,t,n){let r=0;e.forEach(o=>{rt(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 Ig(e,t,n){if(e.length===0)return;let r=e.at(-1);r!=null&&!rt(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 _g(e,t,n){t.implemented&&e.length===0&&n({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Fs(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function qs(e){return e.includes("{{")}function Ug(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function rt(e){return e.type.startsWith("assert")}var jg=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function $g(e){return jg.has(e.type)}function Dg(e,t,n){!t.implemented||e.length===0||e.some(r=>rt(r))||n({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function Bg(e,t,n){if(!t.implemented||e.length<=3)return;let r=e.filter(i=>rt(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 to(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 Vg(e,t,n){e.forEach((r,o)=>{if(r.type!=="click")return;let i=to(r);if(i==null)return;let a=e.slice(o+1,o+4);a.find(d=>d.type==="assertVisible"&&to(d)===i)==null||a.some(d=>$g(d)||rt(d)&&to(d)!==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 Wg=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 no(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>=3&&!Wg.has(t))}function Fg(e){let t=e.label==null?[]:no(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,...no(r)]}function qg(e,t,n){if(!t.implemented||e.length===0)return;let r=new Set(no(t.expectedOutcome));if(r.size===0)return;let o=e.filter(a=>rt(a));if(o.length===0)return;o.some(a=>Fg(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 Mg=/save|submit|create|delete|remove|send|invite|update|confirm|publish|apply|pay|subscribe|upgrade|cancel|archive|rename/i;function Ws(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 Mg.test(n)}function Hg(e,t,n){!t.implemented||t.spec.uiOnly===!0||e.forEach((r,o)=>{if(!Ws(r)||"uiOnly"in r&&r.uiOnly===!0)return;let i=e.slice(o+1),a=i.findIndex(c=>Ws(c)),s=a===-1?i.length:a;i.slice(0,s).some(c=>c.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 Jg(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])=>Fs(s)&&qs(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})})}function zg(e,t,n){let r=new Set(Object.keys(t.spec.variables??{})),o=/\{\{([^{}]+?)\}\}/g;e.forEach(i=>{let s=[...JSON.stringify(i).matchAll(o)],l=[...new Set(s.map(u=>u[1]).filter(u=>u!=null&&!r.has(u)))];if(l.length===0)return;let d=l.map(u=>`{{${u}}}`).join(", "),c=[...new Set(l.map(u=>u.split(".")[0]??u))].join(", ");n({message:`"${i.label??i.id}" contains literal template string(s) ${d} \u2014 destructure the proxy in .steps(({ ${c} }) => \u2026) and pass the proxy value (e.g. \`${l[0]??""}\`) directly. Writing the template as a string bypasses type-checking and silently accepts typos.`,rule:"no-literal-template-strings",step:i.label??i.id})})}var Xg=[Cg,Lg,zg,Pg,xg,Og,Eg,Ig,_g,Dg,Bg,Vg,qg,Hg,Jg];xe();X();async function Js(e){let{ids:t,requireImplemented:n}=e,r=process.cwd(),o=await C(r);o.ok||(process.stderr.write(`Compilation failed: ${o.error}
|
|
527
|
+
`),process.stderr.write(`${b("create","DSL authoring + lint rules")}
|
|
528
|
+
`),process.exit(1)),await pe({cwd:r,result:o.result});let i=nt(o.result),a=t.length===0?i.diagnostics:i.diagnostics.filter(y=>t.includes(y.test)),s=Hs.groupBy(a,y=>y.test);Object.entries(s).forEach(([y,S])=>{process.stderr.write(`
|
|
529
|
+
${y}
|
|
530
|
+
`),S.forEach(w=>{let k=w.step==null?"":` at "${w.step}"`;process.stderr.write(` [${w.rule}]${k}
|
|
531
|
+
`),process.stderr.write(` ${w.message}
|
|
532
|
+
`)})});let l=new Set(o.builder.getUnimplemented().tests),d=n.filter(y=>l.has(y));d.length>0&&(process.stderr.write(`
|
|
529
533
|
not-implemented
|
|
530
|
-
`),
|
|
531
|
-
`)}));let
|
|
534
|
+
`),d.forEach(y=>{process.stderr.write(` ${y} is still marked .notImplemented()
|
|
535
|
+
`)}));let c=Yg(r);c.length>0&&(process.stderr.write(`
|
|
532
536
|
preconditions
|
|
533
|
-
`),
|
|
534
|
-
`),process.stderr.write(` ${
|
|
535
|
-
`)}));let
|
|
536
|
-
${String(
|
|
537
|
-
`),
|
|
538
|
-
`))}var
|
|
537
|
+
`),c.forEach(y=>{process.stderr.write(` [hardcoded-identifier] ${y.file}
|
|
538
|
+
`),process.stderr.write(` ${y.message}
|
|
539
|
+
`)}));let u=a.length+d.length+c.length;u>0&&(process.stderr.write(`
|
|
540
|
+
${String(u)} error(s)
|
|
541
|
+
`),Gg({diagnostics:a,hardcodeWarnings:c,stillStubbed:d}),process.exit(1))}function Gg({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(`${b(o)}
|
|
542
|
+
`))}var Kg=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Qg=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function Yg(e){let t=Ms.join(e,".ripplo","preconditions");return ro.existsSync(t)?ro.readdirSync(t).filter(r=>r.endsWith(".ts")).flatMap(r=>Zg(Ms.join(t,r))):[]}function Zg(e){let t=ro.readFileSync(e,"utf8"),n=t.includes("ctx.uniqueEmail")||t.includes("ctx.uniqueId"),r=[],o=Kg.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=Qg.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 zs(e){let t=await Ae();await Re(t);let{results:n,summary:r}=await sn({config:t,ids:e});process.stdout.write(`${r}
|
|
539
543
|
`);let o=n.some(i=>i.summary.includes("FAILED")||i.summary.includes("ERROR"));o&&(process.stderr.write(`Artifacts for this run are fresh in .ripplo/debug/<runId>/. Read them before re-running \u2014 a rerun takes ~30-60s and almost never reveals more than summary.txt + steps/<failedIndex>/dom.html + accessibility-tree.txt already do. Only re-run after you've made a change you believe will fix the failure.
|
|
540
|
-
`),process.stderr.write(`${
|
|
541
|
-
`)),process.exit(o?1:0)}
|
|
544
|
+
`),process.stderr.write(`${b("debug")}
|
|
545
|
+
`)),process.exit(o?1:0)}J();import{graphql as At}from"gql.tada";var eh=At(`
|
|
542
546
|
query ScopeStatus($projectId: String!) {
|
|
543
547
|
project(id: $projectId) {
|
|
544
548
|
id
|
|
@@ -558,7 +562,7 @@ ${String(p)} error(s)
|
|
|
558
562
|
}
|
|
559
563
|
}
|
|
560
564
|
}
|
|
561
|
-
`),
|
|
565
|
+
`),th=At(`
|
|
562
566
|
query ScopeWorkflowBySlug($projectId: String!, $slug: String!) {
|
|
563
567
|
project(id: $projectId) {
|
|
564
568
|
id
|
|
@@ -571,7 +575,7 @@ ${String(p)} error(s)
|
|
|
571
575
|
}
|
|
572
576
|
}
|
|
573
577
|
}
|
|
574
|
-
`),
|
|
578
|
+
`),nh=At(`
|
|
575
579
|
mutation ScopeAddAgent($projectId: String!, $workflowSlugs: [String!]!) {
|
|
576
580
|
addAgentScopeItems(projectId: $projectId, workflowSlugs: $workflowSlugs) {
|
|
577
581
|
id
|
|
@@ -581,53 +585,53 @@ ${String(p)} error(s)
|
|
|
581
585
|
}
|
|
582
586
|
}
|
|
583
587
|
}
|
|
584
|
-
`),
|
|
588
|
+
`),rh=At(`
|
|
585
589
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
586
590
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
587
591
|
id
|
|
588
592
|
}
|
|
589
593
|
}
|
|
590
|
-
`),
|
|
594
|
+
`),oh=At(`
|
|
591
595
|
mutation ScopeRemoveMany($ids: [ID!]!) {
|
|
592
596
|
removeScopeItems(ids: $ids)
|
|
593
597
|
}
|
|
594
|
-
`);async function
|
|
598
|
+
`);async function Xs(e){let t=await Ae();await Re(t);let r=(await L({config:t,document:eh,variables:{projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(r,null,2)}
|
|
595
599
|
`);return}if(r.length===0){process.stdout.write("No scope items. Add via `ripplo scope add <test-ids..>` (variadic) or from the dashboard.\n");return}r.forEach(o=>{let i=o.workflow;if(i==null){process.stdout.write(` [intent] (${o.id}) ${o.label??""}
|
|
596
600
|
`);return}let a=i.spec==null?"stub":"implemented";process.stdout.write(` [${a}] (${o.id}) ${i.slug} \u2014 ${i.name}
|
|
597
|
-
`)})}async function
|
|
598
|
-
`)})}async function
|
|
599
|
-
`)}async function
|
|
600
|
-
`)}async function
|
|
601
|
-
`),process.stderr.write(`${
|
|
602
|
-
`),process.exit(1)),r.id}
|
|
601
|
+
`)})}async function Gs({testIds:e}){let t=await Ae();await Re(t),((await L({config:t,document:nh,variables:{projectId:t.projectId,workflowSlugs:[...e]}})).addAgentScopeItems??[]).forEach(o=>{process.stdout.write(`Added scope item ${o.id} (${o.workflow?.slug??"?"})
|
|
602
|
+
`)})}async function Ks({id:e,testId:t}){let n=await Ae();await Re(n);let r=await ih({cfg:n,slug:t});await L({config:n,document:rh,variables:{id:e,workflowId:r}}),process.stdout.write(`Linked scope item ${e} to ${t}
|
|
603
|
+
`)}async function Qs({ids:e}){let t=await Ae();await Re(t);let r=(await L({config:t,document:oh,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(r)} scope item(s)
|
|
604
|
+
`)}async function ih({cfg:e,slug:t}){let r=(await L({config:e,document:th,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.
|
|
605
|
+
`),process.stderr.write(`${b("create")}
|
|
606
|
+
`),process.exit(1)),r.id}X();async function Ys(e){let t=process.cwd(),n=await C(t);n.ok||(process.stderr.write(`Compilation failed: ${n.error}
|
|
603
607
|
`),process.exit(1));let{tests:r}=n.builder.getUnimplemented();if(e.format==="summary"){r.length>0&&process.stdout.write(`tests: ${r.join(", ")}
|
|
604
608
|
`);return}let o={tests:r.map(i=>({id:i,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
|
|
605
|
-
`)}import{z as
|
|
606
|
-
`).filter(n=>n.length>0)}function
|
|
607
|
-
`).filter(r=>r.length>0)}var
|
|
609
|
+
`)}import{z as Te}from"zod";var ah=Te.object({agent_id:Te.string().optional(),cwd:Te.string().optional(),hook_event_name:Te.string().optional(),mode:Te.string().optional(),session_id:Te.string().optional(),tool_input:Te.looseObject({file_path:Te.string().optional()}).optional(),tool_name:Te.string().optional()});async function Y(){let e=await sh();if(e.trim()==="")return{};let t=JSON.parse(e);return ah.parse(t)}function sh(){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)})}oo();J();import ph from"fs";function uh(e){return ke(e,"hooks-paused")}function Z(e){return ph.existsSync(uh(e))?!1:tl(e)}import{execFileSync as mh}from"child_process";import{createHash as PP}from"crypto";import io from"process";import rl from"picomatch";function fh(e){return il(["diff","--name-only","HEAD"],e).split(`
|
|
610
|
+
`).filter(n=>n.length>0)}function ol({cwd:e,ignoreGlobs:t,watchGlobs:n}){let r=rl([...n]),o=rl([...t]);return fh(e).filter(i=>r(i)&&!o(i))}function ln(e,...t){return il(["diff","--name-only","HEAD","--",...t],e).split(`
|
|
611
|
+
`).filter(r=>r.length>0)}var yh=io.env.GIT_BIN!=null&&io.env.GIT_BIN.length>0?io.env.GIT_BIN:"git";function gh(e){if(!(e instanceof Error)||!("status"in e))return null;let t=Reflect.get(e,"status");return typeof t=="number"?t:null}function hh(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 il(e,t){try{return mh(yh,[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch(n){let r=gh(n);if(r==null||r===0)return"";let o=hh(n).trim();throw new Error(`git ${e.join(" ")} failed (exit ${String(r)}): ${o}`)}}X();async function ot(e){let t=await C(e);if(!t.ok)throw new Error(`resolvePaths: DSL compile failed \u2014 ${t.error}`);let n=t.builder.getConfig();return{ignorePaths:n.ignorePaths??eo,watchPaths:n.watchPaths??Zr}}import kh from"fs";import Sh from"path";function oe(e){return kh.existsSync(Sh.join(e,".ripplo"))}async function al(){await Y();let e=process.cwd();if(!oe(e)||!Z(e))return;let{ignorePaths:t,watchPaths:n}=await ot(e),r=ol({cwd:e,ignoreGlobs:t,watchGlobs:n});r.length===0||ln(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.
|
|
608
612
|
Any e2e user flow these changes could affect MUST be in scope before you proceed:
|
|
609
613
|
- Existing test: \`npx ripplo scope add <id1> <id2>...\` (variadic)
|
|
610
614
|
- New flow: stub .ripplo/tests/<id>.ts with .notImplemented(), then scope add
|
|
611
615
|
Err on the side of breadth \u2014 missed flows become silent regressions the Stop gate can't catch.
|
|
612
|
-
${
|
|
613
|
-
${
|
|
614
|
-
`)}import
|
|
615
|
-
`),process.exit(2)}async function
|
|
616
|
+
${b("scope")}
|
|
617
|
+
${b("create")}
|
|
618
|
+
`)}import dn from"fs";import wh from"os";import sl from"path";function Ne(e){process.stderr.write(`${e}
|
|
619
|
+
`),process.exit(2)}async function ll(){if((await Y()).tool_name!=="ExitPlanMode"||!Z(process.cwd()))return;let t=bh();if(t==null)return;let n=dn.readFileSync(t,"utf8");/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(n)||Ne(`Plan must cite ripplo test stubs before exiting plan mode.
|
|
616
620
|
Add a "Tests to implement" section to the plan listing .ripplo/tests/<id>.ts files for every user flow touched. Stub template:
|
|
617
621
|
|
|
618
622
|
export const myFlow = test("my-flow").name("...").requires({...}).notImplemented();
|
|
619
623
|
|
|
620
624
|
If this plan genuinely touches no user-facing behavior (pure refactor, internal tooling, type-only change), add a "No e2e coverage needed: <reason>" line to the plan and re-exit.
|
|
621
625
|
It is YOUR job to keep scope accurate and sufficiently broad \u2014 err on the side of breadth, up to ~50 tests.
|
|
622
|
-
${
|
|
626
|
+
${b("explore")}`)}function bh(){let e=sl.join(wh.homedir(),".claude","plans");return dn.existsSync(e)?dn.readdirSync(e).filter(n=>n.endsWith(".md")).map(n=>sl.join(e,n)).map(n=>({full:n,mtime:dn.statSync(n).mtimeMs})).sort((n,r)=>r.mtime-n.mtime)[0]?.full??null:null}X();async function dl(){if((await Y()).mode!=="plan")return;let t=process.cwd();if(!oe(t)||!Z(t))return;let n=await C(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 existing test(s) from .ripplo/tests/ to scope (`npx ripplo scope add <test-ids..>` \u2014 variadic) so Stop validates they still pass, or\n \u2022 stub new `.notImplemented()` test(s) under .ripplo/tests/ and bulk scope-add them.\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()):
|
|
623
627
|
`),r.forEach(o=>process.stderr.write(` ${o}
|
|
624
|
-
`)))}import
|
|
625
|
-
`)}
|
|
626
|
-
${
|
|
628
|
+
`)))}import Ah from"path";import cl from"picomatch";X();async function pl(){let t=(await Y()).tool_input?.file_path;if(t==null)return;let n=process.cwd();if(!oe(n)||!Z(n))return;let r=Ah.relative(n,t);if(r.startsWith(".."))return;let{ignorePaths:o,watchPaths:i}=await ot(n),a=cl([...i]),s=cl([...o]);if(!a(r)||s(r))return;let l=await C(n);if(!l.ok)return;let{tests:d}=l.builder.getUnimplemented();d.length!==0&&process.stderr.write(`Reminder: .notImplemented() stubs still present \u2014 tests: ${d.join(", ")}
|
|
629
|
+
`)}xe();X();async function ul(){let t=(await Y()).tool_input?.file_path;if(t==null||!/\/\.ripplo\/.*\.ts$/.test(t))return;let n=process.cwd();if(!oe(n)||!Z(n))return;let r=await C(n);r.ok||Ne(`Compilation failed: ${r.error}
|
|
630
|
+
${b("create","DSL authoring + lint rules")}`),await pe({cwd:n,result:r.result});let{diagnostics:o}=nt(r.result);if(o.length===0){Rh(t);return}let i=o.map(a=>{let s=a.step==null?"":` at "${a.step}"`;return` [${a.rule}]${s} ${a.test}: ${a.message}`});Ne(`${i.join(`
|
|
627
631
|
`)}
|
|
628
|
-
${
|
|
629
|
-
${
|
|
630
|
-
`)}
|
|
632
|
+
${b("create")}`)}function Rh(e){/\/\.ripplo\/tests\/.*\.ts$/.test(e)&&process.stderr.write(`Reminder: after adding or changing a test, immediately \`npx ripplo scope add <id>\` (or bulk: \`scope add <id1> <id2>...\`) so it counts toward Stop validation. Stubs that aren't in scope are invisible to the gate.
|
|
633
|
+
${b("scope")}
|
|
634
|
+
`)}J();X();He();import Th from"path";import ml from"picomatch";import{graphql as Nh}from"gql.tada";var vh=new Set(["Edit","Write","NotebookEdit"]),Ch=Nh(`
|
|
631
635
|
query PreEditScopeGate($projectId: String!) {
|
|
632
636
|
project(id: $projectId) {
|
|
633
637
|
id
|
|
@@ -639,14 +643,14 @@ ${N("scope")}
|
|
|
639
643
|
}
|
|
640
644
|
}
|
|
641
645
|
}
|
|
642
|
-
`);async function
|
|
646
|
+
`);async function fl(){let e=await Y(),t=Lh(e);if(t==null)return;let n=process.cwd();await Ph(n,t)&&(await xh(n)||Ne(Oh(t)))}function Lh(e){if(e.tool_name==null||!vh.has(e.tool_name))return null;let t=e.tool_input?.file_path;if(t==null)return null;let n=process.cwd();if(!oe(n)||!Z(n))return null;let r=Th.relative(n,t);return r.startsWith("..")||r===".ripplo"||r.startsWith(".ripplo/")?null:r}async function Ph(e,t){let{ignorePaths:n,watchPaths:r}=await ot(e),o=ml([...r]),i=ml([...n]);return o(t)&&!i(t)}async function xh(e){let t=ye(e);if(t==null)return!0;let n=await C(e);if(!n.ok)return!0;let r={...n.result.config,ripploServerUrl:Se(),token:t},o=await L({config:r,document:Ch,variables:{projectId:r.projectId}}).catch(()=>null);return o==null?!0:(o.project?.devSession?.scopeItems??[]).length>0}function Oh(e){return`Ripplo scope is empty and this edit touches app code (${e}).
|
|
643
647
|
Before proceeding you MUST either:
|
|
644
648
|
1. Stub .notImplemented() tests under .ripplo/tests/ for the user flow(s) this change affects, then \`npx ripplo scope add <ids...>\` (variadic).
|
|
645
649
|
2. If this change genuinely touches no user-facing behavior (pure refactor, internal tooling, type-only), explicitly acknowledge that in your next response and retry \u2014 the hook will re-fire until scope is populated or the user pauses hooks in the dev dashboard.
|
|
646
650
|
Use \`npx ripplo scope remove <id>\` if a scoped test turns out not to apply \u2014 do not use it as a Stop-gate shortcut.
|
|
647
|
-
${
|
|
648
|
-
${
|
|
649
|
-
${
|
|
651
|
+
${b("explore")}
|
|
652
|
+
${b("scope")}
|
|
653
|
+
${b("create")}`}J();X();He();import{graphql as Eh}from"gql.tada";var Ih=Eh(`
|
|
650
654
|
query ScopeReminder($projectId: String!) {
|
|
651
655
|
project(id: $projectId) {
|
|
652
656
|
id
|
|
@@ -663,19 +667,19 @@ ${N("create")}`}G();K();Ke();import{graphql as Tk}from"gql.tada";var Nk=Tk(`
|
|
|
663
667
|
}
|
|
664
668
|
}
|
|
665
669
|
}
|
|
666
|
-
`);async function
|
|
670
|
+
`);async function yl(){await Y();let e=process.cwd();if(!oe(e)||!Z(e))return;let t=ye(e);if(t==null)return;let n=await C(e);if(!n.ok)return;let r={...n.result.config,ripploServerUrl:Se(),token:t},o=await L({config:r,document:Ih,variables:{projectId:r.projectId}}).catch(s=>{let l=s instanceof Error?s.message:String(s);return process.stderr.write(`Scope reminder unavailable: ${l}
|
|
667
671
|
`),null});if(o==null)return;let i=o.project?.devSession?.scopeItems??[];if(i.length===0){process.stderr.write(`RIPPLO SCOPE: empty.
|
|
668
672
|
Before editing app code for any user-facing change, you MUST either:
|
|
669
673
|
1. Stub tests: create .ripplo/tests/<id>.ts with .notImplemented(), then \`npx ripplo scope add <id1> <id2>...\`
|
|
670
674
|
2. Or, if a scoped test truly doesn't apply, use \`npx ripplo scope remove <id>\` \u2014 never as a Stop-gate shortcut.
|
|
671
675
|
It is YOUR job to keep scope accurate and sufficiently broad. Under-scoping is the default failure mode.
|
|
672
|
-
Skills: ${
|
|
676
|
+
Skills: ${b("explore")} ${b("scope")} ${b("create")}
|
|
673
677
|
`);return}let a=i.map(s=>{let l=s.workflow;return l==null?` [intent] (${s.id}) ${s.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${s.id}) ${l.slug}`});process.stderr.write(`RIPPLO SCOPE (${String(i.length)} items): each is a commitment that the app works AND a test passes this session. Stop hook will block otherwise.
|
|
674
678
|
${a.join(`
|
|
675
679
|
`)}
|
|
676
680
|
If your next change touches existing tests' user flows, \`npx ripplo scope add <test-ids..>\` (variadic) to mark them for Stop validation. If it introduces new flows, stub \`.notImplemented()\` tests and bulk scope-add them. \`scope remove <ids..>\` only for items genuinely out of scope \u2014 not as a Stop-gate shortcut.
|
|
677
|
-
${
|
|
678
|
-
`)}import{execFileSync as
|
|
681
|
+
${b("scope")}
|
|
682
|
+
`)}import{execFileSync as _h}from"child_process";import Uh from"path";import ao from"process";xe();J();import{graphql as jh}from"gql.tada";import{z as cn}from"zod";X();He();var $h=jh(`
|
|
679
683
|
query ScopeEnforce($projectId: String!) {
|
|
680
684
|
project(id: $projectId) {
|
|
681
685
|
id
|
|
@@ -694,39 +698,31 @@ ${N("scope")}
|
|
|
694
698
|
}
|
|
695
699
|
}
|
|
696
700
|
}
|
|
697
|
-
`);async function
|
|
701
|
+
`);async function hl(){let e=await Y();if(e.agent_id!=null&&e.agent_id.length>0)return;let t=ao.cwd();if(!oe(t)||!Z(t))return;let n=Dh(t),r=await Bh(t,n);r.length>0&&Ne(r.join(`
|
|
698
702
|
|
|
699
|
-
`))}function
|
|
703
|
+
`))}function Dh(e){return ln(e,".ripplo/tests").filter(t=>t.endsWith(".ts")).map(t=>Uh.basename(t,".ts")).filter(t=>t!=="index")}async function Bh(e,t){let n=await C(e);if(!n.ok)return[`--- Compilation failed ---
|
|
700
704
|
${n.error}
|
|
701
|
-
${
|
|
705
|
+
${b("create")}`];await pe({cwd:e,result:n.result});let r=await Vh(e,n),o=[...new Set([...t,...r.scopedSlugsToRun])],i=Wh(n,t),a=Fh(n),s=qh(e,o);return[i,a,s,r.error].filter(l=>l!=null)}async function Vh(e,t){let n=ye(e);if(n==null)return{error:null,scopedSlugsToRun:[]};let r={...t.result.config,ripploServerUrl:Se(),token:n},i=(await L({config:r,document:$h,variables:{projectId:r.projectId}}).catch(()=>null))?.project?.devSession?.scopeItems??[],a=i.flatMap(d=>{let c=d.workflow;return c==null?[` [intent] ${d.label??"(no label)"} \u2014 stub a test for this flow`]:c.spec==null?[` [stub] ${c.slug} \u2014 implement \`${c.name}\``]:[]}),s=i.flatMap(d=>d.workflow?.spec==null?[]:[d.workflow.slug]);return{error:a.length===0?null:`--- Testing Scope ---
|
|
702
706
|
${a.join(`
|
|
703
707
|
`)}
|
|
704
708
|
|
|
705
709
|
Scope is the contract for this session: each item represents a user-facing feature that should work end-to-end. "Done" means the app code delivers the behavior AND a passing test proves it \u2014 authoring a test against broken UI/API doesn't count. Work each item with \`/ripplo:create\` (one at a time is fine; the hook re-checks on stop).
|
|
706
710
|
|
|
707
711
|
Only use \`npx ripplo scope remove <ids..>\` if an item is genuinely out of scope or no longer needed \u2014 not as a shortcut when implementation feels long. If scope itself is wrong, raise it with the user before removing.
|
|
708
|
-
${
|
|
712
|
+
${b("create")}`,scopedSlugsToRun:s}}function Wh(e,t){let{diagnostics:n}=nt(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 ---
|
|
709
713
|
${[...i,...a].join(`
|
|
710
714
|
`)}
|
|
711
|
-
${
|
|
715
|
+
${b("create")}`}function Fh(e){let{tests:t}=e.builder.getUnimplemented();return t.length===0?null:`--- Unimplemented stubs remain ---
|
|
712
716
|
tests: ${t.join(", ")}
|
|
713
717
|
|
|
714
718
|
These are the user-facing flows you committed to this session. "Done" means: app code delivers the behavior AND a passing test proves it \u2014 both halves. Implement each with \`/ripplo:create <id>\`; the hook re-checks on stop. Only \`npx ripplo scope remove <ids..>\` items that are genuinely out of scope; don't remove just to clear the gate.
|
|
715
|
-
${
|
|
719
|
+
${b("create")}`}function qh(e,t){if(t.length===0)return null;let n=Hh(["run",...t],e);if(n.code===0)return null;let r=n.output.split(`
|
|
716
720
|
`).filter(o=>/FAILED/.test(o)).join(`
|
|
717
721
|
`);return r.length===0?null:`--- Ripplo Run Failures (${t.join(" ")}) ---
|
|
718
722
|
${r}
|
|
719
723
|
|
|
720
724
|
Artifacts are fresh in .ripplo/debug/<runId>/. Diagnose from those \u2014 don't re-run hoping for a different result. Open summary.txt \u2192 steps/<failedIndex>/{dom.html,accessibility-tree.txt,console.log,network.jsonl}, cite a specific line as evidence, then make ONE targeted fix and re-run.
|
|
721
|
-
${
|
|
722
|
-
`),process.exit(1)),await t()}
|
|
723
|
-
`),process.exit(1)});function
|
|
724
|
-
`))}export{
|
|
725
|
-
/*! Bundled license information:
|
|
726
|
-
|
|
727
|
-
mustache/mustache.mjs:
|
|
728
|
-
(*!
|
|
729
|
-
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
730
|
-
* http://github.com/janl/mustache.js
|
|
731
|
-
*)
|
|
732
|
-
*/
|
|
725
|
+
${b("debug")}`}var Mh=cn.object({status:cn.number().nullish(),stderr:cn.unknown().optional(),stdout:cn.unknown().optional()});function gl(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function Hh(e,t){let n=ao.argv[1];if(n==null)return{code:1,output:""};try{return{code:0,output:_h(ao.execPath,[n,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(r){let o=Mh.safeParse(r);if(!o.success)return{code:1,output:""};let i=`${gl(o.data.stdout)}${gl(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}var oc=Ct.resolve(Ct.dirname(eb(import.meta.url)),"..");rc({path:Ct.join(oc,".env.local"),quiet:!0});rc({path:Ct.join(oc,".env"),quiet:!0});sb();var ic={"coverage-nudge":al,"exit-plan-gate":ll,"plan-reminder":dl,"post-edit-flag-stubs":pl,"post-edit-lint":ul,"pre-edit-scope-gate":fl,"scope-reminder":yl,"stop-enforce":hl};async function rb(){await tb(nb(process.argv)).scriptName("ripplo").command("$0","Launch the interactive dashboard",()=>{},ob).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=>zs(e.ids)).command("lint [ids..]","Compile and lint tests (all or specific ids)",e=>{let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to lint (all if omitted)",type:"string"}).option("require-implemented",{array:!0,default:t,describe:"Test ids that must not be .notImplemented() \u2014 fails if any still are",type:"string"})},e=>Js({ids:e.ids,requireImplemented:e["require-implemented"]})).command("flake-detect <id>","Run a test N times in parallel to detect flakiness",e=>e.positional("id",{demandOption:!0,describe:"Test id to run flake detection against",type:"string"}).option("runs",{default:10,describe:"Number of parallel runs",type:"number"}),e=>Vs({id:e.id,runs:e.runs})).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>Qo({check:e.check})).command("doctor","Check project health",()=>{},()=>_s()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Ys({format:e.format})).command("scope <subcommand>","Manage testing scope",ab).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(ic),demandOption:!0,type:"string"}),e=>ib(e.name)).option("env",{choices:["dev","local"],describe:"Server environment",type:"string"}).strict().help().parse()}async function ob(){let{redirectStdioToFile:e}=await Promise.resolve().then(()=>(Sl(),kl)),t=e(Ct.join(process.cwd(),".ripplo","debug","debug.log")),{launchDashboard:n}=await Promise.resolve().then(()=>(_o(),nc));n({restoreStdio:t})}async function ib(e){let t=ic[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
|
|
726
|
+
`),process.exit(1)),await t()}rb().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
727
|
+
`),process.exit(1)});function ab(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>Xs({format:t.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",t=>{let n=[];return t.positional("test-ids",{array:!0,default:n,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},t=>Gs({testIds:t["test-ids"]})).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=>Ks({id:t.id,testId:t["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",t=>{let n=[];return t.positional("ids",{array:!0,default:n,demandOption:!0,describe:"Scope item ids",type:"string"})},t=>Qs({ids:t.ids})).demandCommand(1)}function sb(){let e=process.cwd(),t=xn(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
|
|
728
|
+
`))}export{rb as main};
|