ripplo 0.7.57 → 0.7.59
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/chunk-2IWN2ZTE.js +287 -0
- package/dist/{chunk-Z3EBCNXG.js → chunk-6AY37H4A.js} +48 -48
- package/dist/chunk-ORRK3V4W.js +10 -0
- package/dist/{chunk-Q4US2KWY.js → chunk-QKILUEUW.js} +1 -1
- package/dist/{daemon-HW2TTEXZ.js → daemon-F37HB3DX.js} +1 -1
- package/dist/daemon-FU4HDRVQ.js +139 -0
- package/dist/index.js +217 -216
- package/dist/{status-BRGXIPVJ.js → status-UUQN6ZEI.js} +1 -1
- package/package.json +5 -5
- package/dist/chunk-L3IQRGAN.js +0 -12
- package/dist/chunk-PHP2RNJ4.js +0 -274
- package/dist/daemon-ZDKFGROH.js +0 -139
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{g as a}from"./chunk-
|
|
4
|
+
import{g as a}from"./chunk-QKILUEUW.js";import"./chunk-ORRK3V4W.js";import"./chunk-PXYDLKAG.js";import"./chunk-6AY37H4A.js";import"./chunk-63TU4VJ7.js";export{a as statusCommand};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripplo",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.59",
|
|
4
4
|
"description": "CLI for Ripplo — AI-powered end-to-end testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://ripplo.ai",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"@ripplo/core": "^0.0.0",
|
|
71
71
|
"@ripplo/eslint-config": "0.0.0",
|
|
72
72
|
"@ripplo/run-report": "0.0.0",
|
|
73
|
-
"@ripplo/graphql": "^0.0.0",
|
|
74
|
-
"@ripplo/rrweb-bundle": "0.0.0",
|
|
75
|
-
"@ripplo/runtime": "^0.0.0",
|
|
76
73
|
"@ripplo/solver": "^0.0.0",
|
|
77
|
-
"@ripplo/
|
|
74
|
+
"@ripplo/runtime": "^0.0.0",
|
|
75
|
+
"@ripplo/spec": "^0.0.0",
|
|
76
|
+
"@ripplo/rrweb-bundle": "0.0.0",
|
|
77
|
+
"@ripplo/graphql": "^0.0.0"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"dev": "tsx watch src/index.ts",
|
package/dist/chunk-L3IQRGAN.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{i as T}from"./chunk-PXYDLKAG.js";import{B as Y,D as Q,E as Z,f as R,g as p,h as q,i as l,m as X,n as V,o as B,p as K,z as G}from"./chunk-Z3EBCNXG.js";import{readFileSync as Se}from"fs";import{z as ee}from"zod";var Le=ee.object({version:ee.string()});function xt(){let e=Se(new URL("../package.json",import.meta.url),"utf8");return Le.parse(JSON.parse(e)).version}import w from"fs";import h from"path";import{createJiti as ze}from"jiti";import{err as E,ok as H,ResultAsync as He}from"neverthrow";import be from"fs";import S from"path";import f from"typescript";function te(e){let t=S.join(e,"index.ts"),n=ve(e);be.mkdirSync(S.dirname(n.tsBuildInfoFile??""),{recursive:!0});let o=f.createIncrementalCompilerHost(n),i=f.createIncrementalProgram({host:o,options:n,rootNames:[t]}),a=[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics()];i.emit();let u=a.filter(s=>we(s,e));if(u.length===0)return{diagnostics:[],ok:!0};let v={getCanonicalFileName:s=>s,getCurrentDirectory:()=>S.dirname(e),getNewLine:()=>`
|
|
5
|
-
`};return{diagnostics:f.formatDiagnosticsWithColorAndContext(u,v).split(`
|
|
6
|
-
`).filter(s=>s.length>0),ok:!1}}function we(e,t){let n=e.file?.fileName;return n==null?!0:n.startsWith(t)}var Ee=S.join(".local","tsbuildinfo");function ve(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:f.ModuleKind.Preserve,moduleResolution:f.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:f.ScriptTarget.ES2022,tsBuildInfoFile:S.join(e,Ee)}}import L from"fs";import A from"safe-stable-stringify";import{err as Re,ok as I}from"neverthrow";async function ne(e,t){let n={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces},o=m(t)?void 0:Ce(t),i=Pe(e,o);return(await e.workflows.reduce(async(u,v)=>{let d=await u;return d.isErr()?d:(await je({context:n,reusable:i,workflow:v})).map(D=>[...d.value,D])},Promise.resolve(I([])))).map(u=>({...e,workflows:[...u]}))}function m(e){let t=process.argv[1];if(t==null||!L.existsSync(e))return!1;try{return L.statSync(t).mtimeMs>L.statSync(e).mtimeMs}catch{return!1}}async function je({context:e,reusable:t,workflow:n}){let o=t.get(oe(n));if(o!=null)return I({...n,tests:o.tests});try{return I(await X({context:e,workflow:n}))}catch(i){let a=i instanceof Error?i.message:String(i);return Re({kind:"expand-failed",message:a,workflow:n.name})}}function oe(e){let t=A({...e,tests:[]});if(t==null)throw new Error("solver: workflow is not serializable");return t}function Pe(e,t){return t==null||A(re(t))!==A(re(e))?new Map:new Map(t.workflows.map(n=>[oe(n),n]))}function re(e){return{entities:e.entities,singletons:e.singletons,valueSpaces:e.valueSpaces}}function Ce(e){if(L.existsSync(e))try{return p(l,L.readFileSync(e,"utf8"))}catch{return}}import{createHash as Fe}from"crypto";import ie from"fs/promises";import M from"path";import{err as g,ok as O,Result as Te}from"neverthrow";var Ae=".ripplo/fixtures",$=10*1024*1024,_=50*1024*1024;async function ae(e,t){let n=Ie(t);if(n.length===0)return O({});let o=M.join(e,Ae),i=await Promise.all(n.map(a=>Me({fixturesRoot:o,name:a})));return Te.combine(i).andThen(Oe)}function Ie(e){let n=e.workflows.flatMap(o=>[...o.steps,...o.tests.flatMap(i=>i.steps)]).flatMap(o=>o.action.kind==="upload"?o.action.files:[]);return[...new Set(n)].toSorted((o,i)=>o.localeCompare(i))}async function Me({fixturesRoot:e,name:t}){if(t.includes("..")||M.isAbsolute(t))return g({kind:"fixture-invalid-name",name:t});let n=M.join(e,t),o=await ie.lstat(n).catch(()=>null);if(o==null)return g({kind:"fixture-missing",name:t,path:n});if(o.isSymbolicLink())return g({kind:"fixture-symlink",name:t});if(!o.isFile())return g({kind:"fixture-not-file",name:t});let i=await ie.readFile(n);if(i.byteLength>$)return g({kind:"fixture-too-large",name:t,size:i.byteLength});let a=Fe("sha256").update(i).digest("hex");return O([t,{sha256:a,size:i.byteLength}])}function Oe(e){let t=e.reduce((n,[,o])=>n+o.size,0);return t>_?g({kind:"fixtures-total-too-large",total:t}):O(Object.fromEntries(e))}import{createHash as $e}from"crypto";import y from"fs";import z from"path";import{z as N}from"zod";function se({cwd:e,fingerprint:t}){let n=Ne(e);if(n==null||n.fingerprint!==j(t))return;let o=z.join(e,".ripplo","ripplo.lock");if(!y.existsSync(o))return;let i=y.readFileSync(o,"utf8");if(j(i)===n.lockfileHash)try{return p(l,i)}catch{return}}function le({cwd:e,fingerprint:t,lockfile:n}){let o={fingerprint:j(t),lockfileHash:j(R(l,n))},i=ce(e);y.mkdirSync(z.dirname(i),{recursive:!0}),y.writeFileSync(i,JSON.stringify(o))}var _e=N.object({fingerprint:N.string(),lockfileHash:N.string()});function Ne(e){let t=ce(e);if(!(!y.existsSync(t)||m(t)))try{let n=_e.safeParse(JSON.parse(y.readFileSync(t,"utf8")));return n.success?n.data:void 0}catch{return}}function ce(e){return z.join(e,".ripplo",".local","load-cache.json")}function j(e){return $e("sha256").update(e).digest("base64")}var c=".ripplo/ripplo.lock",b;async function Qt(e){let{result:t}=await Je(e);return t}async function Je(e){let t=de(h.join(e,".ripplo"));if(b!=null&&b.fingerprint===t&&b.result.isOk())return{fingerprint:t,result:b.result};let n=await J(e);return b={fingerprint:t,result:n},{fingerprint:t,result:n}}async function J(e){let t=h.join(e,".ripplo"),n=h.join(t,"index.ts"),o=de(t),i=se({cwd:e,fingerprint:o});if(i!=null)return H(i);let a=te(t);if(!a.ok)return E({diagnostics:a.diagnostics,kind:"typecheck-failed"});let d=await(await De(n)).andThen(s=>Xe({entryPath:n,exported:s})).match(async s=>(await ae(e,s)).map(x=>({...s,fixtures:x})).mapErr(x=>({error:x,kind:"fixture-failed"})).asyncAndThen(x=>new He(ne(x,h.join(e,c))).mapErr(xe=>xe)),s=>Promise.resolve(E(s)));return d.isOk()&&le({cwd:e,fingerprint:o,lockfile:d.value}),d}var Ue=new Set([".local","debug","node_modules","ripplo.lock"]);function de(e){let t=h.join(e,"..","node_modules","@ripplo","testing","package.json");return[...ue(e),...We(t)].toSorted((n,o)=>n.localeCompare(o)).join("|")}function ue(e){return(w.existsSync(e)?w.readdirSync(e,{withFileTypes:!0}):[]).flatMap(n=>{if(Ue.has(n.name))return[];let o=h.join(e,n.name);if(n.isDirectory())return ue(o);let i=w.statSync(o);return[`${o}:${String(i.mtimeMs)}:${String(i.size)}`]})}function We(e){if(!w.existsSync(e))return[];let t=w.statSync(e);return[`${e}:${String(t.mtimeMs)}:${String(t.size)}`]}async function De(e){try{let n=await ze(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),o=n!=null&&typeof n=="object"&&"default"in n?Reflect.get(n,"default"):n;return H(o)}catch(t){return E({kind:"load-threw",message:qe(t)})}}function qe(e){return e instanceof Error?e.message:String(e)}function Xe({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return E({entryPath:e,kind:"not-ripplo"});let n=q.safeParse(Reflect.get(t,"lockfile"));return n.success?H(n.data):E({issues:n.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`),kind:"invalid-lockfile"})}function P(e,t){return t==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${t}.`}function er(e){return e.length===1?P(e[0]):`Before proceeding, load the ${e.map(n=>`\`/ripplo:${n}\``).join(" and ")} skills \u2014 every one, each carries rules the others don't.`}function ir(e){return[`Compilation failed: ${Ve(e)}`,P("create","DSL authoring rules")].join(`
|
|
7
|
-
`)}function ar(){return`${c} is up to date`}function sr(e){return[`${c} is ${e==="missing"?"missing":"out of date"} \u2014 run \`npx ripplo compile\` and commit the result`,P("setup")].join(`
|
|
8
|
-
`)}function lr(){return`Wrote ${c}`}function Ve(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...pe(e.diagnostics)].join(`
|
|
9
|
-
`);case"not-ripplo":return`${e.entryPath} must default-export a Ripplo (createRipplo({ entities, singletons, workflows })). Check that the default export is the value returned by createRipplo, not a function or a re-export.`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock?):",...pe(e.issues),"Regenerate with `npx ripplo compile` \u2014 never hand-edit the lockfile."].join(`
|
|
10
|
-
`);case"load-threw":return[`.ripplo/index.ts threw while loading: ${e.message}`,"Usually a bad import or a top-level throw in .ripplo/ \u2014 run `npx ripplo compile` for the stack."].join(`
|
|
11
|
-
`);case"fixture-failed":return Be(e.error);case"expand-failed":return[`Could not resolve tests for workflow "${e.workflow}": ${e.message}`,"Check the branch conditions and the seeded state in given \u2014 a branch may need state no seed can produce."].join(`
|
|
12
|
-
`)}}function pe(e,t=8){return e.length<=t?e:[...e.slice(0,t),`\u2026 and ${String(e.length-t)} more`]}function Be(e){switch(e.kind){case"fixture-missing":return`Fixture "${e.name}" not found at ${e.path} \u2014 add the file under .ripplo/fixtures/ or fix the upload() name.`;case"fixture-invalid-name":return`Invalid fixture name "${e.name}" \u2014 upload() takes a bare name under .ripplo/fixtures/, no .. or absolute paths.`;case"fixture-symlink":return`Fixture "${e.name}" is a symlink \u2014 only regular files are allowed.`;case"fixture-not-file":return`Fixture "${e.name}" is not a regular file.`;case"fixture-too-large":return`Fixture "${e.name}" is ${C(e.size)} \u2014 over the ${C($)} per-file limit.`;case"fixtures-total-too-large":return`Fixtures total ${C(e.total)} \u2014 over the ${C(_)} limit.`}}function C(e){return`${String(Math.round(e/(1024*1024)*10)/10)} MB`}import{writeFile as et}from"fs/promises";import tt from"path";import{createHash as fe}from"crypto";import k from"fs";import W from"path";import Ke from"safe-stable-stringify";import{z as U}from"zod";function me({context:e,cwd:t}){V(e);let n=Ye(t,F(e));n!=null&&B(e,n)}function xr({context:e,cwd:t}){let n=Ze(t);if(!(n==null||n.model!==F(e)))return n.cleanLockfile??void 0}function Sr({cleanLockfileHash:e,context:t,cwd:n}){let o=ge(n);k.mkdirSync(W.dirname(o),{recursive:!0}),k.writeFileSync(o,JSON.stringify({cleanLockfile:e,model:F(t)}))}function Lr(e){return fe("sha256").update(e).digest("base64")}var Ge=U.object({cleanLockfile:U.string().nullable(),model:U.string()});function Ye(e,t){let n=W.join(e,c);if(!k.existsSync(n)||m(n))return null;let o=Qe(n);return o==null?null:F({entities:o.entities,singletonSchemas:o.singletons,valueSpaces:o.valueSpaces})===t?o.solved:null}function Qe(e){try{return p(l,k.readFileSync(e,"utf8"))}catch{return null}}function F(e){let t=Ke({entities:e.entities,singletons:e.singletonSchemas,valueSpaces:e.valueSpaces});if(t==null)throw new Error("solve-cache: context is not serializable");return fe("sha256").update(t).digest("base64")}function Ze(e){let t=ge(e);if(!(!k.existsSync(t)||m(t)))try{let n=Ge.safeParse(JSON.parse(k.readFileSync(t,"utf8")));return n.success?n.data:void 0}catch{return}}function ge(e){return W.join(e,".ripplo",".local","solve-cache.json")}async function Fr(e){let t=await J(e);return t.isOk()&&await rt(e,t.value),t}async function rt(e,t){let n=await nt(e,t);return await et(tt.join(e,c),R(l,n)),n}var ye=new WeakMap;function nt(e,t){let n=ye.get(t);if(n!=null)return n;let o=ot(e,t);return ye.set(t,o),o}function Tr(e){return e.workflows.filter(t=>t.stub).map(t=>t.name)}async function ot(e,t){let n=Y(t);me({context:n,cwd:e});let o=await Z(t),i=await Q(t);await G({context:n,facts:i.facts});let a=await K(n);return{...t,checks:o,solved:a}}import{createMessageConnection as it,NotificationType as he,RequestType as at,RequestType0 as ke,SocketMessageReader as st,SocketMessageWriter as lt}from"vscode-jsonrpc/node";import{z as r}from"zod";var ct="daemon.sock",dt="daemon.log";function $r(e){return T(e,ct)}function _r(e){return T(e,dt)}function Nr(e){return it(new st(e),new lt(e))}var zr=r.object({all:r.boolean(),headed:r.boolean(),tests:r.array(r.string())}),Hr=r.object({jobId:r.string(),total:r.number()}),ut=r.enum(["on","off"]),pt=r.object({attempts:r.number(),findings:r.number()}),Jr=r.object({active:r.number(),explorer:ut,exploring:r.number(),progress:pt,queued:r.number(),sseHealth:r.object({detail:r.string().optional(),ok:r.boolean()}).optional(),version:r.string().optional()}),ft=r.enum(["MAX_RUNS","OVERAGE_CAP","MAX_AGENTS","MAX_CONCURRENT_RUNS","MAX_PROJECTS"]),mt=r.discriminatedUnion("type",[r.object({code:ft,type:r.literal("limit")}),r.object({detail:r.string(),type:r.literal("generic")})]),gt=r.discriminatedUnion("kind",[r.object({kind:r.literal("pass")}),r.object({findingLines:r.array(r.string()),kind:r.literal("findings")}),r.object({detail:r.string(),kind:r.literal("error")}),r.object({kind:r.literal("dispatch-error"),reason:mt}),r.object({detail:r.string(),kind:r.literal("dispatch-timeout")}),r.object({detail:r.string(),kind:r.literal("infra-error")})]),yt=r.discriminatedUnion("kind",[r.object({kind:r.literal("test-started"),runId:r.string(),testName:r.string(),workflowName:r.string()}),r.object({kind:r.literal("test-outcome"),outcome:gt,runId:r.string(),testName:r.string(),workflowName:r.string()})]),Ur=r.object({event:yt,jobId:r.string()}),Wr=r.object({failed:r.number(),jobId:r.string(),notRun:r.number(),passed:r.number()}),Dr=r.discriminatedUnion("code",[r.object({code:r.literal("compile-failed"),detail:r.string(),diagnostics:r.array(r.string()).default([])}),r.object({code:r.literal("selection-conflicting-flags")}),r.object({code:r.literal("selection-nothing-selected")}),r.object({code:r.literal("selection-unknown-ids"),known:r.array(r.string()),unknown:r.array(r.string())}),r.object({code:r.literal("scope-failed"),detail:r.string()}),r.object({code:r.literal("app-unreachable"),detail:r.string(),url:r.string()}),r.object({code:r.literal("sync-failed"),detail:r.string()}),r.object({code:r.literal("bad-message")})]),qr=new at("ripplo/enqueue"),Xr=new ke("ripplo/status"),Vr=new ke("ripplo/shutdownIfIdle"),Br=new he("ripplo/jobEvent"),Kr=new he("ripplo/jobDone");export{xt as a,Ae as b,c,Qt as d,Je as e,J as f,P as g,er as h,ir as i,ar as j,sr as k,lr as l,me as m,xr as n,Sr as o,Lr as p,Fr as q,rt as r,nt as s,Tr as t,$r as u,_r as v,Nr as w,zr as x,Hr as y,Jr as z,gt as A,Ur as B,Wr as C,Dr as D,qr as E,Xr as F,Vr as G,Br as H,Kr as I};
|
package/dist/chunk-PHP2RNJ4.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{c as an}from"./chunk-ZPCVY23H.js";import{A as dn,E as cn,F as un,G as pn,H as fn,I as yn,a as T,b as M,c as He,d as Be,e as Ve,f as $,g as Ke,i as O,w as sn,x as ln}from"./chunk-L3IQRGAN.js";import{b as Le,e as u,f as p,i as _e,j as Ne}from"./chunk-PXYDLKAG.js";import{N as Ge,O as Xe,P as v,Q as Ye,S as Ze,U as en,a as j,b as I,c as qe,da as nn,ea as rn,ha as tn,ia as on,j as We,k as F,l as m,q as Je,r as se,s as h,t as P,u as Qe,v as ze,x as D}from"./chunk-Z3EBCNXG.js";import Rn from"fs";import q from"path";import{config as Cr}from"dotenv";import{z as _}from"zod";import{err as Ar,ok as hn}from"neverthrow";import L from"fs";import ce from"path";import{err as le,ok as mn}from"neverthrow";import{z as U}from"zod";var br=ce.join(".ripplo","project.json"),de=[".env",".env.local"],Er=U.object({envFiles:U.array(U.string().min(1)).optional(),projectId:U.string().min(1)});function gn(e){return ce.join(e,br)}function ue(e){let n=gn(e);return L.existsSync(n)?Ir(n).andThen(r=>{let t=Er.safeParse(r);return t.success?mn({envFiles:t.data.envFiles??de,projectId:t.data.projectId}):le({issues:t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`),kind:"project-file-invalid",path:n})}):le({kind:"project-file-missing",path:n})}function pe(e){return ue(e).match(n=>n,()=>{})}function Ir(e){try{return mn(JSON.parse(L.readFileSync(e,"utf8")))}catch(n){return le({issues:[n instanceof Error?n.message:String(n)],kind:"project-file-invalid",path:e})}}function Ii({cwd:e,envFiles:n,projectId:r}){let t=gn(e);L.mkdirSync(ce.dirname(t),{recursive:!0});let o={projectId:r};n!=null&&!Pr(n)&&(o.envFiles=[...n]),L.writeFileSync(t,JSON.stringify(o,null,2)+`
|
|
5
|
-
`)}function Pr(e){return e.length!==de.length?!1:e.every((n,r)=>n===de[r])}function $i(e){let r=pe(e)?.envFiles??[".env",".env.local"],t=q.join(e,".ripplo");r.forEach(o=>{let i=q.resolve(t,o);Rn.existsSync(i)&&Cr({override:!0,path:i,quiet:!0})}),N=void 0}var Tr=_.object({RIPPLO_APP_URL:_.url(),RIPPLO_ENGINE_URL:_.url(),RIPPLO_WEBHOOK_SECRET:_.string().min(1)}),N;function W(){return N!=null?hn(N):Fr().map(e=>(N=e,e))}function jr(e){let r=pe(e)?.envFiles??[],t=q.join(e,".ripplo");return r.map(o=>q.resolve(t,o)).filter(o=>!Rn.existsSync(o))}function Fr(){let e=Tr.safeParse(process.env);if(!e.success)return Ar({issues:e.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"env-invalid",missingEnvFiles:jr(process.cwd())});let n=e.data;return hn({appUrl:n.RIPPLO_APP_URL,engineUrl:n.RIPPLO_ENGINE_URL,webhookSecret:n.RIPPLO_WEBHOOK_SECRET})}var H=class extends Error{failure;constructor(n){super(n.kind),this.name="CliError",this.failure=n}};function Ni(e){return e instanceof H?fe(e.failure):e instanceof Error?e.message:String(e)}function fe(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",Ke("setup")].join(`
|
|
6
|
-
`);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(n=>` ${n}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
|
|
7
|
-
`);case"not-authenticated":return["Not signed in. Run `npx ripplo auth login`.","(Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)"].join(`
|
|
8
|
-
`);case"env-invalid":return Mr(e);case"playwright-install-failed":return["Playwright browser install failed \u2014 Chromium is still missing.","Run `npx playwright install chromium` and check its output for network, proxy, or disk-space errors."].join(`
|
|
9
|
-
`);case"gitdir-unrecognized":return`Unrecognized .git file at ${e.marker} \u2014 expected a directory or a "gitdir:" pointer (worktree). Is the repo corrupted?`;case"gitdir-empty":return`Empty gitdir pointer at ${e.marker} \u2014 the worktree's .git file points nowhere. Re-create the worktree.`;case"oauth-device-code-failed":return[`Could not start sign-in (device-code request failed): ${e.description}`,"Is the Ripplo server reachable? Check RIPPLO_SERVER_URL and retry."].join(`
|
|
10
|
-
`);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `npx ripplo auth login` again.":"Run `npx ripplo auth login` to retry."].join(`
|
|
11
|
-
`);case"compilation-failed":return O(e.error)}}function Mr(e){let n=e.missingEnvFiles.length===0?[]:["Declared env files not found:",...e.missingEnvFiles.map(r=>` ${r}`),"In a git worktree? Env files aren't copied from the main checkout \u2014 recreate them, or symlink to a shared file outside the working tree."];return["Env config invalid:",...e.issues.map(r=>` ${r}`),"Add the missing values to the env files declared in .ripplo/project.json.",...n].join(`
|
|
12
|
-
`)}import{err as Dr,ok as Ur}from"neverthrow";import{z as ye}from"zod";var $r="https://ripplo.ai";function Sn(){return wn().RIPPLO_SERVER_URL}function vn(){return wn().RIPPLO_PROJECT_ID}var Or=ye.object({RIPPLO_PROJECT_ID:ye.string().min(1).optional(),RIPPLO_SERVER_URL:ye.string().min(1).default($r)}),kn;function wn(){return kn??=Or.parse(process.env),kn}import xn from"fs";import me from"path";function bn(e){let n=xn.realpathSync(e),r=n,t=me.dirname(r);for(;t!==r;){if(xn.existsSync(me.join(r,".git")))return r;r=t,t=me.dirname(r)}return n}function B(e){return ue(e).andThen(n=>W().andThen(r=>{let t=Sn(),o=Ne(t);return o==null?Dr({kind:"not-authenticated"}):Ur({appUrl:r.appUrl,cwd:bn(e),engineUrl:r.engineUrl,projectId:vn()??n.projectId,ripploServerUrl:t,token:o,webhookSecret:r.webhookSecret})}))}import Lr from"p-queue";var _r=4,Nr={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},V=new Lr({concurrency:_r}),k={headedActive:0,interactiveActive:0,interactiveQueued:0},En={current:null};function na({headed:e,task:n,workClass:r}){let t=Nr[r];return r==="p3-explore"?V.add(n,{priority:t}):(k.interactiveQueued+=1,K(),V.add(()=>qr({headed:e,task:n}),{priority:t}))}function ra(e){!Number.isFinite(e)||e<1||(V.concurrency=Math.floor(e),K())}function ge(){return{active:k.interactiveActive,headedActive:k.headedActive,poolSize:V.concurrency,queued:k.interactiveQueued}}function ta(e){En.current=e}async function qr({headed:e,task:n}){k.interactiveQueued-=1,k.interactiveActive+=1,k.headedActive+=e?1:0,K();try{return await n()}finally{k.interactiveActive-=1,k.headedActive-=e?1:0,K()}}function K(){En.current?.()}import Re from"fs";import he from"path";function In(e){try{let n=Wr(e);if(n==null)return;let r=he.join(n,"HEAD"),t=Re.readFileSync(r,"utf8").trim(),o="ref: refs/heads/";return t.startsWith(o)?t.slice(o.length):t.length===0?void 0:t.slice(0,7)}catch{return}}function Wr(e){let n=he.join(e,".git");if(Re.statSync(n).isDirectory())return n;let t=Re.readFileSync(n,"utf8").trim(),o="gitdir:";if(!t.startsWith(o))return;let i=t.slice(o.length).trim();if(i.length!==0)return he.resolve(e,i)}import Hr from"crypto";import{readFile as Pn}from"fs/promises";import Cn from"path";import{graphql as ke}from"gql.tada";import{err as Br,ok as Vr}from"neverthrow";var Kr=ke(`
|
|
13
|
-
mutation SyncDevSession(
|
|
14
|
-
$projectId: String!
|
|
15
|
-
$cwd: String!
|
|
16
|
-
$branch: String
|
|
17
|
-
$lockfileContent: String
|
|
18
|
-
$fixtures: [SyncDevFixtureInput!]
|
|
19
|
-
$preconditions: [SyncDevPreconditionInput!]!
|
|
20
|
-
$singletons: [SyncDevSingletonInput!]
|
|
21
|
-
$workflows: [SyncDevWorkflowInput!]!
|
|
22
|
-
) {
|
|
23
|
-
syncDevSession(
|
|
24
|
-
projectId: $projectId
|
|
25
|
-
cwd: $cwd
|
|
26
|
-
branch: $branch
|
|
27
|
-
lockfileContent: $lockfileContent
|
|
28
|
-
fixtures: $fixtures
|
|
29
|
-
preconditions: $preconditions
|
|
30
|
-
singletons: $singletons
|
|
31
|
-
workflows: $workflows
|
|
32
|
-
) {
|
|
33
|
-
id
|
|
34
|
-
hooksPaused
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`);async function ha(e,n){let r=await $(e);if(r.isErr())return Br({error:r.error,kind:"compilation-failed"});let t=await w({config:n,cwd:e,lockfile:r.value});return Vr({devSessionId:t.devSessionId,lockfile:r.value})}async function w(e){let n=We(e.lockfile);return zr({config:e.config,cwd:e.cwd,fixtures:e.lockfile.fixtures,payload:n})}var Jr=ke(`
|
|
38
|
-
query DevSessionSyncState($projectId: String!, $cwd: String!) {
|
|
39
|
-
project(id: $projectId) {
|
|
40
|
-
devSession(cwd: $cwd) {
|
|
41
|
-
id
|
|
42
|
-
hooksPaused
|
|
43
|
-
lockfileHash
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`),Qr=ke(`
|
|
48
|
-
mutation AnnounceDevSessionActive($projectId: String!, $cwd: String!) {
|
|
49
|
-
announceDevSessionActive(projectId: $projectId, cwd: $cwd)
|
|
50
|
-
}
|
|
51
|
-
`);async function ka(e){let n=await Se(e.cwd);if(n!=null){let t=(await u({config:e.config,document:Jr,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null))?.project?.devSession;if(t!=null&&t.lockfileHash===n)return await u({config:e.config,document:Qr,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null),{devSessionId:t.id,hooksPaused:t.hooksPaused}}return w(e)}async function Se(e){let n=await An(e);return n==null?null:Hr.createHash("sha256").update(n).digest("hex")}async function zr({config:e,cwd:n,fixtures:r,payload:t}){let o=In(n),i=await An(n),l=await Gr(n,r),a=await u({config:e,document:Kr,variables:{branch:o??null,cwd:n,fixtures:l,lockfileContent:i,preconditions:t.preconditions.map(s=>({depends:[...s.depends],description:s.description,name:s.name,returns:[...s.returns]})),projectId:e.projectId,singletons:t.singletons.map(s=>({defaultValue:s.defaultValue,description:s.description,name:s.name,type:s.type})),workflows:t.workflows.map(s=>({expectedOutcome:s.expectedOutcome,name:s.name,preconditions:[...s.preconditions],requiresKeys:s.requiresKeys.map(c=>({namespace:c.namespace,preconditionName:c.preconditionName})),slug:s.slug,sourcePath:s.sourcePath,spec:JSON.stringify(s.spec)}))}});if(a.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:a.syncDevSession.id,hooksPaused:a.syncDevSession.hooksPaused}}async function Gr(e,n){let r=Object.entries(n);return Promise.all(r.map(async([t,o])=>({contentBase64:(await Pn(Cn.join(e,M,t))).toString("base64"),sha256:o.sha256})))}async function An(e){try{return await Pn(Cn.join(e,He),"utf8")}catch{return null}}import{randomUUID as bt}from"crypto";import{createId as Et}from"@paralleldrive/cuid2";import{CancellationTokenSource as It,ResponseError as Pt}from"vscode-jsonrpc/node";import{graphql as Xr}from"gql.tada";var Yr=Xr(`
|
|
52
|
-
mutation DaemonCreateRun(
|
|
53
|
-
$id: String
|
|
54
|
-
$workflowId: String!
|
|
55
|
-
$testId: String
|
|
56
|
-
$clientVersion: String
|
|
57
|
-
$executor: RunExecutor
|
|
58
|
-
$target: RunTarget
|
|
59
|
-
$lockfileHash: String
|
|
60
|
-
) {
|
|
61
|
-
createRun(
|
|
62
|
-
id: $id
|
|
63
|
-
workflowId: $workflowId
|
|
64
|
-
testId: $testId
|
|
65
|
-
executor: $executor
|
|
66
|
-
target: $target
|
|
67
|
-
clientVersion: $clientVersion
|
|
68
|
-
lockfileHash: $lockfileHash
|
|
69
|
-
) {
|
|
70
|
-
__typename
|
|
71
|
-
... on MutationCreateRunSuccess {
|
|
72
|
-
data {
|
|
73
|
-
id
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
... on LimitExceededError {
|
|
77
|
-
code
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`);async function Tn(e){try{let r=(await u({config:e.config,document:Yr,variables:Zr(e)})).createRun;return r==null?J({detail:"create-run-null",type:"generic"}):r.__typename==="MutationCreateRunSuccess"?null:r.__typename==="LimitExceededError"?J({code:r.code,type:"limit"}):J({detail:r.__typename,type:"generic"})}catch(n){return et(n)}}function Zr({executor:e,lockfileHash:n,runId:r,target:t}){return{clientVersion:T(),executor:e,id:r,lockfileHash:n,target:e==="cloud"?"tunnel":void 0,testId:t.testId,workflowId:t.workflowId}}function J(e){return{kind:"dispatch-error",reason:e}}function et(e){return e instanceof Le?{detail:e.message,kind:"infra-error"}:J({detail:e instanceof Error?e.message:String(e),type:"generic"})}import{graphql as nt}from"gql.tada";async function jn(e,n){let t=(await u({config:e,document:rt,variables:{cwd:n,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(t.flatMap(o=>o.tests.map(i=>[`${o.slug}/${i.slug}`,{testId:i.id,workflowId:o.id}])))}var rt=nt(`
|
|
82
|
-
query DaemonWorkflows($projectId: String!, $cwd: String!) {
|
|
83
|
-
project(id: $projectId) {
|
|
84
|
-
id
|
|
85
|
-
devSession(cwd: $cwd) {
|
|
86
|
-
id
|
|
87
|
-
workflows {
|
|
88
|
-
id
|
|
89
|
-
slug
|
|
90
|
-
tests {
|
|
91
|
-
id
|
|
92
|
-
slug
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`);import{CancellationTokenSource as tt}from"vscode-jsonrpc/node";function ve(e){return`${e.workflowSlug}/${e.testSlug}`}function Fn(e){let{headed:n,inflight:r,jobId:t,lockfileHashValue:o,onExpire:i,runId:l,selection:a,timeoutMs:s}=e,c=ve(a),d=`${c}@${o}@${String(n)}`,f=r.get(d);if(f!=null)return f.jobIds.add(t),null;let y={cancellation:new tt,claimed:!1,claimKey:c,headed:n,inflightKey:d,jobIds:new Set([t]),runId:l,testName:a.testName,timer:null,workflowName:a.workflowName};return y.timer=setTimeout(()=>{Q(r,y),i(y)},s),r.set(d,y),y}function Q(e,n){n.timer!=null&&(clearTimeout(n.timer),n.timer=null),e.delete(n.inflightKey)}function we(e,n){let r=[...e.values()].find(t=>t.runId===n&&!t.claimed);return r==null?null:(r.claimed=!0,r.timer!=null&&(clearTimeout(r.timer),r.timer=null),r)}function Mn(e,n){[...e.values()].filter(r=>r.jobIds.has(n)).forEach(r=>{r.jobIds.delete(n),r.jobIds.size===0&&(Q(e,r),r.cancellation.cancel())})}import{err as xe,ok as $n}from"neverthrow";function Dn({all:e,ids:n,lockfile:r}){if(e&&n.length>0)return xe({kind:"conflicting-flags"});if(e)return $n(r.workflows.filter(i=>!i.stub).flatMap(i=>i.tests.map(l=>h(l))));if(n.length===0)return xe({kind:"nothing-selected"});let t=n.map(i=>({id:i,refs:it(r,i)})),o=t.filter(i=>i.refs.length===0).map(i=>i.id);return o.length>0?xe({kind:"unknown-ids",known:ot(r),unknown:o}):$n([...new Set(t.flatMap(i=>i.refs))])}function Un(e,n){let r=new Map(P(e).map(t=>[t.ref,{testName:t.test.name,testSlug:t.test.slug,workflowName:t.workflow.name,workflowSlug:m(t.workflow.name)}]));return n.map(t=>{let o=r.get(t);if(o==null)throw new Error(`selectionsFor: ref not in lockfile: ${t}`);return o})}function ot(e){return e.workflows.map(n=>m(n.name))}function it(e,n){let r=e.workflows.find(t=>t.name===n||m(t.name)===m(n));return r!=null?r.tests.map(t=>h(t)):P(e).filter(t=>t.ref===n||On(t.ref)===On(n)).map(t=>t.ref)}function On(e){let n=e.lastIndexOf("/");return n===-1?m(e):`${m(e.slice(0,n))}/${m(e.slice(n+1))}`}import{err as Ie,ok as Hn}from"neverthrow";import{graphql as Bn}from"gql.tada";import{graphql as pt}from"gql.tada";import{execFileSync as at}from"child_process";var st=256*1024*1024;function C(e,n){return at("git",[...e],{cwd:n,encoding:"utf8",maxBuffer:st,stdio:["ignore","pipe","pipe"]})}function Oa(e,n){try{return C(e,n)}catch{return""}}import ct from"fs";import lt from"fs";import be from"path";var dt=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function Na(e){return _n(e)!=null}function Ln(e){let n=_n(e);return n==null?!1:dt.some(r=>lt.existsSync(be.join(n,r)))}function _n(e){try{let n=C(["rev-parse","--git-dir"],e).trim();return n.length===0?null:be.isAbsolute(n)?n:be.resolve(e,n)}catch{return null}}function ut(e){return _e(e,"hooks-paused")}function Nn(e){return ct.existsSync(ut(e))||Ln(e)?!1:an(e)}var ft=pt(`
|
|
99
|
-
mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
100
|
-
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
101
|
-
__typename
|
|
102
|
-
... on MutationAddDirtyTestsToScopeSuccess {
|
|
103
|
-
data {
|
|
104
|
-
id
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
`);async function es({cwd:e,lockfile:n}){if(!Nn(e))return{addedSlugs:[]};let r=Ee(e);if(r.length===0)return{addedSlugs:[]};let t=new Set(r),o=n.workflows.filter(s=>s.sourcePath!=null&&t.has(s.sourcePath)).map(s=>m(s.name));if(o.length===0)return{addedSlugs:[]};let i=B(e).unwrapOr(void 0);return i==null?{addedSlugs:[]}:await w({config:i,cwd:e,lockfile:n}).catch(s=>(p.warn("auto-sync failed: %s",s instanceof Error?s.message:String(s)),null))==null?{addedSlugs:[]}:{addedSlugs:await yt({cfg:i,slugs:o})?o:[]}}async function yt({cfg:e,slugs:n}){let t=(await u({config:e,document:ft,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...n]}}).catch(o=>(p.warn("auto-scope failed: %s",o instanceof Error?o.message:String(o)),null)))?.addDirtyTestsToScope;return t?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:t.data.length>0}var qn=".ripplo/workflows/",Wn=" -> ";function Ee(e){let n;try{n=C(["status","--porcelain","-uall","--",".ripplo/workflows"],e)}catch{return[]}return n.split(`
|
|
110
|
-
`).map(r=>r.slice(3).trim()).map(r=>r.includes(Wn)?r.split(Wn)[1]:r).filter(r=>r!=null).filter(r=>r.startsWith(qn)&&r.endsWith(".ts")).map(r=>r.slice(qn.length)).filter(r=>r!=="index.ts"&&!r.endsWith("/index.ts"))}async function Vn({config:e,cwd:n,lockfile:r}){await gt({config:e,cwd:n,lockfile:r});let t=await ht(e);if(t.isErr())return Ie(t.error);let o=new Map(r.workflows.filter(l=>!l.stub).map(l=>[m(l.name),l])),i=[...new Set(t.value)].flatMap(l=>{let a=o.get(l);return a==null?[]:a.tests.map(s=>h(s))});return i.length===0?Ie({kind:"scope-empty"}):Hn(i)}var mt=Bn(`
|
|
111
|
-
mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
112
|
-
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
113
|
-
__typename
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`);async function gt({config:e,cwd:n,lockfile:r}){let t=new Set(Ee(n)),o=r.workflows.filter(i=>i.sourcePath!=null&&t.has(i.sourcePath)).map(i=>m(i.name));o.length!==0&&await u({config:e,document:mt,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:o}}).catch(i=>{p.warn({err:i},"auto-scope of dirty tests failed")})}var Rt=Bn(`
|
|
117
|
-
query ScopeSelection($projectId: String!, $cwd: String!) {
|
|
118
|
-
project(id: $projectId) {
|
|
119
|
-
id
|
|
120
|
-
devSession(cwd: $cwd) {
|
|
121
|
-
id
|
|
122
|
-
scopeItems {
|
|
123
|
-
id
|
|
124
|
-
workflow {
|
|
125
|
-
id
|
|
126
|
-
slug
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`);async function ht(e){try{let r=(await u({config:e,document:Rt,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return Hn(r.flatMap(t=>t.workflow==null?[]:[t.workflow.slug]))}catch(n){return Ie({detail:n instanceof Error?n.message:String(n),kind:"scope-fetch-failed"})}}import{graphql as kt}from"gql.tada";var St=2e3,vt=kt(`
|
|
133
|
-
query DaemonCloudRunStatus($runId: String!) {
|
|
134
|
-
run(id: $runId) {
|
|
135
|
-
status
|
|
136
|
-
failureReason
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
`);function Jn({config:e,onComplete:n,onStarted:r,runId:t,signal:o}){let i=!1,l,a=!1,s=async()=>{if(i||o.aborted)return;let c=await wt(e,t).catch(()=>"unknown");if(!(i||o.aborted)){if(!a&&(c==="running"||Kn(c))&&(a=!0,r()),Kn(c)){i=!0,n(xt(c));return}l=setTimeout(()=>{s()},St)}};return s(),{stop:()=>{i=!0,l!=null&&clearTimeout(l)}}}async function wt(e,n){let t=(await u({config:e,document:vt,variables:{runId:n}})).run?.status;return t??"unknown"}function Kn(e){return e==="passed"||e==="failed"||e==="cancelled"||e==="unready"}function xt(e){return e==="passed"?{kind:"pass"}:e==="failed"?{detail:"failed",kind:"error"}:e==="cancelled"?{detail:"cancelled",kind:"error"}:e==="unready"?{detail:"unready",kind:"error"}:{detail:"unknown",kind:"error"}}var Ct=12e4,At=-32099,Pe=new Set,Qn=new Map;function Ps(e){Pe.add(e)}function Tt(e){let n=new AbortController;return e.isCancellationRequested?(n.abort(),n.signal):(e.onCancellationRequested(()=>{n.abort()}),n.signal)}function Cs(e){let n={...e,inflight:new Map,jobs:new Map};return{claim:r=>Ot(n,r),handleConnection:r=>{jt(n,r)},idle:()=>Xn(n)}}function jt(e,n){let r=sn(n);r.onRequest(cn,(t,o)=>Ft({connection:r,ctx:e,params:t,token:o})),r.onRequest(un,()=>{let t=ge();return{active:t.active,queued:t.queued,sseHealth:e.sseHealth(),version:T(),...e.explorationStatus()}}),r.onRequest(pn,()=>{let t=Xn(e);return t&&e.onShutdownRequest(),t}),r.onClose(()=>{Mt(e,r)}),r.onError(t=>{p.warn({err:t},"ipc connection error")}),n.on("error",t=>{p.warn({err:t},"ipc socket error")}),r.listen()}function Xn(e){let n=ge();return e.jobs.size===0&&n.active===0&&n.queued===0}async function Ft({connection:e,ctx:n,params:r,token:t}){let o=ln.safeParse(r);if(!o.success)throw zn({code:"bad-message"});await n.ready;let i=await Ut({config:n.config,cwd:n.cwd,message:o.data});if(i.kind==="error")throw zn(i.error);let l=bt(),a=new It;return t.onCancellationRequested(()=>{Yn(n,l)}),n.jobs.set(l,{cancellation:a,connection:e,failed:0,notRun:0,passed:0,total:i.selections.length}),Kt({ctx:n,headed:o.data.headed,jobId:l,lockfileHashValue:i.lockfileHashValue,selections:i.selections,targetsByClaimKey:i.targetsByClaimKey,token:a.token}).catch(s=>{p.error({err:s},"ipc dispatch failed")}),{jobId:l,total:i.selections.length}}function zn(e){return new Pt(At,e.code,e)}function Yn(e,n){let r=e.jobs.get(n);r!=null&&(r.cancellation.cancel(),e.jobs.delete(n),Mn(e.inflight,n))}function Mt(e,n){[...e.jobs.entries()].filter(([,r])=>r.connection===n).forEach(([r])=>{Yn(e,r)})}function Zn(e,n,r){let t=e.jobs.get(n);t!=null&&(Gn(()=>t.connection.sendNotification(fn,{event:r,jobId:n})),r.kind==="test-outcome"&&($t(t,r.outcome.kind),t.passed+t.failed+t.notRun>=t.total&&(Gn(()=>t.connection.sendNotification(yn,{failed:t.failed,jobId:n,notRun:t.notRun,passed:t.passed})),e.jobs.delete(n))))}function Gn(e){Promise.resolve().then(e).catch(n=>{p.warn({err:n},"ipc notification failed")})}function $t(e,n){if(n==="pass"){e.passed+=1;return}if(n==="dispatch-error"||n==="dispatch-timeout"||n==="infra-error"){e.notRun+=1;return}e.failed+=1}function x(e,n,r){n.jobIds.forEach(t=>{Zn(e,t,r)})}function Ot(e,n){let r=we(e.inflight,n);return r==null?null:{headed:r.headed,token:r.cancellation.token,finished:(t,o)=>{e.inflight.delete(r.inflightKey),x(e,r,{kind:"test-outcome",outcome:o,runId:r.runId,testName:r.testName,workflowName:r.workflowName})},started:()=>{x(e,r,{kind:"test-started",runId:r.runId,testName:r.testName,workflowName:r.workflowName})}}}function Dt(e){return e.kind==="typecheck-failed"?e.diagnostics.slice(0,5):e.kind==="invalid-lockfile"?e.issues.slice(0,5):e.kind==="load-threw"?[e.message]:[]}async function Ut({config:e,cwd:n,message:r}){return(await Be(n)).match(o=>Lt({config:e,cwd:n,lockfile:o,message:r}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...Dt(o)]},kind:"error"}))}async function Lt({config:e,cwd:n,lockfile:r,message:t}){let o=await qt(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await Se(n);if(i==null)return{error:{code:"sync-failed",detail:"lockfile-missing"},kind:"error"};if(!Pe.has(i)){let a=await Wt({config:e,cwd:n,lockfile:r});if(a!=null)return{error:{code:"sync-failed",detail:a},kind:"error"};Pe.add(i)}return(await Ht({config:e,cwd:n,lockfile:r,message:t})).match(async a=>({kind:"ready",lockfileHashValue:i,selections:Un(r,a),targetsByClaimKey:await _t({config:e,cwd:n,hash:i})}),a=>Promise.resolve({error:a,kind:"error"}))}async function _t({config:e,cwd:n,hash:r}){let t=Qn.get(r);if(t!=null)return t;let o=await jn(e,n);return Qn.set(r,o),o}var Nt=2e3;async function qt(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(Nt)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function Wt(e){try{return await w(e),null}catch(n){return n instanceof Error?n.message:String(n)}}async function Ht({config:e,cwd:n,lockfile:r,message:t}){return!t.all&&t.tests.length===0?(await Vn({config:e,cwd:n,lockfile:r})).mapErr(Bt):Dn({all:t.all,ids:t.tests,lockfile:r}).mapErr(Vt)}function Bt(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function Vt(e){switch(e.kind){case"conflicting-flags":return{code:"selection-conflicting-flags"};case"nothing-selected":return{code:"selection-nothing-selected"};case"unknown-ids":return{code:"selection-unknown-ids",known:[...e.known],unknown:[...e.unknown]}}}async function Kt(e){await e.selections.reduce((n,r)=>n.then(()=>Jt(e,r)),Promise.resolve())}async function Jt(e,n){let{ctx:r,headed:t,jobId:o,lockfileHashValue:i,targetsByClaimKey:l,token:a}=e;if(a.isCancellationRequested)return;let s=ve(n),c=l.get(s);if(c==null){Zn(r,o,{kind:"test-outcome",outcome:{kind:"dispatch-error",reason:{detail:"test-not-found",type:"generic"}},runId:"",testName:n.testName,workflowName:n.workflowName});return}let d=Fn({headed:t,inflight:r.inflight,jobId:o,lockfileHashValue:i,runId:Et(),selection:n,timeoutMs:Ct,onExpire:g=>{x(r,g,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-timeout"},runId:"",testName:g.testName,workflowName:g.workflowName})}});if(d==null)return;let f=r.executor(),y=await Qt({ctx:r,executor:f,lockfileHashValue:i,run:d,target:c});if(y!=null){Q(r.inflight,d),x(r,d,{kind:"test-outcome",outcome:y,runId:"",testName:n.testName,workflowName:n.workflowName});return}f==="cloud"&&zt(r,d)}function Qt({ctx:e,executor:n,lockfileHashValue:r,run:t,target:o}){return Tn({config:e.config,executor:n,lockfileHash:r,runId:t.runId,target:o})}function zt(e,n){let r=we(e.inflight,n.runId);r!=null&&Jn({config:e.config,runId:r.runId,signal:Tt(r.cancellation.token),onComplete:t=>{e.inflight.delete(r.inflightKey),x(e,r,{kind:"test-outcome",outcome:t,runId:r.runId,testName:r.testName,workflowName:r.workflowName})},onStarted:()=>{x(e,r,{kind:"test-started",runId:r.runId,testName:r.testName,workflowName:r.workflowName})}})}import Gt from"fs";import Xt from"path";async function Ds(e){let n=Xt.join(e,".ripplo","index.ts");if(!Gt.existsSync(n))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await $(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:O(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:W().match(t=>({appUrl:t.appUrl,engineUrl:t.engineUrl,errors:[],valid:!0,warnings:[]}),t=>({appUrl:void 0,engineUrl:void 0,errors:[{message:fe(t),path:""}],valid:!1,warnings:[]}))}async function Us(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:n}){let r=n.startsWith("http://")||n.startsWith("https://")?n:`${e}${n}`;try{return(await fetch(`${r}/setup`,{body:JSON.stringify({}),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}}function Yt(e){let{backoffActive:n,exploreEnabled:r,headedActive:t,interactiveActive:o,interactiveQueued:i}=e,{explorationActive:l,exploreConcurrency:a,poolSize:s}=e;if(!r||t||i>0)return{abortCount:l,refillCount:0};if(n)return{abortCount:0,refillCount:0};let c=Math.min(a,s-1,s-o);return{abortCount:0,refillCount:Math.max(0,c-l)}}function Ns(e){let n={active:new Map,backoffUntil:0,cancelBackoffTimer:null,cancelHeartbeat:null,prevInteractiveActive:e.probe().interactiveActive,stopped:!1};return rr(n,e),{explorationActive:()=>n.active.size,notifyQueueChange:()=>{Zt(n,e)},stop:()=>{n.stopped=!0,n.cancelBackoffTimer?.(),n.cancelBackoffTimer=null,n.cancelHeartbeat?.(),n.cancelHeartbeat=null,tr(n,n.active.size)}}}function rr(e,n){e.stopped||(e.cancelHeartbeat=n.setTimer(()=>{z(e,n),rr(e,n)},15e3))}function z(e,n){if(e.stopped)return;let r=n.probe(),t=Yt({backoffActive:n.now()<e.backoffUntil,explorationActive:e.active.size,exploreConcurrency:n.exploreConcurrency(),exploreEnabled:n.exploreEnabled(),headedActive:r.headedActive>0,interactiveActive:r.interactiveActive,interactiveQueued:r.interactiveQueued,poolSize:r.poolSize});tr(e,t.abortCount),or({count:t.refillCount,params:n,state:e})}function tr(e,n){[...e.active.values()].slice(0,n).forEach(({controller:r})=>{r.abort()})}function Zt(e,n){let r=n.probe();r.interactiveActive<e.prevInteractiveActive&&eo(e,n),e.prevInteractiveActive=r.interactiveActive,z(e,n)}function eo(e,n){e.backoffUntil=n.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=n.setTimer(()=>{e.cancelBackoffTimer=null,z(e,n)},3e4)}function or({count:e,params:n,state:r}){if(e<=0)return;let t=no(n.sources);t!=null&&(ro({params:n,pulled:t,state:r}),or({count:e-1,params:n,state:r}))}function no(e){return e.reduce((n,r)=>{if(n!=null)return n;let t=r.next();return t==null?null:{job:t,source:r}},null)}function ro({params:e,pulled:n,state:r}){let{job:t,source:o}=n,i=new AbortController;r.active.set(t.id,{controller:i,job:t,source:o}),e.execute({job:t,priority:o.priority,signal:i.signal}).then(()=>{nr({job:t,outcome:er(i.signal,null),params:e,source:o,state:r})}).catch(l=>{nr({job:t,outcome:er(i.signal,{error:l}),params:e,source:o,state:r})})}function er(e,n){return e.aborted?{kind:"aborted"}:n==null?{kind:"completed"}:{error:n.error,kind:"error"}}function nr({job:e,outcome:n,params:r,source:t,state:o}){o.active.delete(e.id),t.onResult(e,n),z(o,r)}import{createMessageConnection as ir,IPCMessageReader as ar,IPCMessageWriter as sr,NotificationType as to,NotificationType0 as lr,RequestType as dr,RequestType0 as oo}from"vscode-jsonrpc/node";import{z as R}from"zod";var Ks=R.object({headed:R.boolean(),runId:R.string().min(1),testRef:R.string().min(1)}),Js=R.object({lockfileJson:R.string().optional(),unavailable:R.string().optional()}),Qs=R.object({runId:R.string().min(1),span:qe}),zs=R.object({outcome:dn,serverNotified:R.boolean()}),Gs=new lr("worker/ready"),Xs=new dr("worker/run"),Ys=new oo("worker/lockfile"),Zs=new dr("worker/exploreTrail"),el=new to("worker/span"),nl=new lr("worker/shutdown");function rl(e){let n=ir(new ar(e),new sr(e));return n.listen(),n}function tl(){let e=ir(new ar(process),new sr(process));return e.listen(),e}import{gzipSync as yo}from"zlib";import{appendFileSync as mo,existsSync as X,readFileSync as yr,writeFileSync as fr}from"fs";import S from"path";import{graphql as Ae}from"gql.tada";function G(e){return[e.kind,e.target,e.value].filter(n=>n.length>0).join(" ")}function cr(e,n){return{kind:"finding",payload:lo(e),source:"verifier",step:n.step,stepIndex:n.stepIndex,timeNanos:n.timeNanos}}var io={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"},ao={"data-rule":"dataRule",fact:"fact",step:"step"},so={aborted:"aborted","action-failed":"actionFailed","app-not-ready":"appNotReady","check-failed":"checkFailed","client-mount-missing":"clientMountMissing","conflicting-sessions":"conflictingSessions","driver-launch":"driverLaunch","engine-decode":"engineDecode","engine-http":"engineHttp","engine-network":"engineNetwork","engine-unreachable":"engineUnreachable","setup-missing-row":"setupMissingRow","state-identity":"stateIdentity"};function lo(e){return e.kind==="consistency"?{kind:"mismatch",mismatch:fo(e.mismatch),pending:e.pending,wait:e.budget,waitMs:se[e.budget]}:e.kind==="pending-check"?{...co(e.source),kind:"pendingCheck",source:ao[e.source.kind],wait:e.budget,waitMs:se[e.budget]}:e.kind==="unrunnable"?{kind:"unrunnable",reason:io[e.reason]}:e.kind==="impossible-action"?{action:uo(e.step.action),kind:"impossibleAction",subject:pr(e.step.action)}:e.kind==="lift-visibility"?{declaredIndex:e.declaredIndex,kind:"liftVisibility",subject:I(e.locator),visibleIndex:e.visibleIndex}:{errorKind:so[e.error.kind],kind:"driverError",message:po(e.error)}}function co(e){return"check"in e?ur(e.check,!1):{checkKind:null,expected:null,negated:!1,subject:Xe(e.dataRule)}}function ur(e,n){return e.kind==="not"?ur(e.inner,!n):e.kind==="browser"?{checkKind:"browser",expected:e.value??null,negated:n,subject:Je(e.key)}:e.kind==="value"||e.kind==="text"?{checkKind:e.kind,expected:e.value,negated:n,subject:I(e.locator)}:{checkKind:e.kind,expected:null,negated:n,subject:I(e.locator)}}function uo(e){return`${e.kind} ${pr(e)}`.trim()}function pr(e){return e.locator==null?e.url??"":I(e.locator)}function po(e){return"message"in e?e.message:"detail"in e?e.detail:null}function fo(e){if(e.kind==="wrong-value")return{actual:v(e.sut),entity:e.entity,expected:v(e.snapshot),field:e.field,key:e.key,kind:"wrongValue"};if(e.kind==="expected-change"){let n=e.direction==null?"change":e.direction.replace(/d$/,"");return{actual:v(e.value),entity:e.entity,expected:`${n} from ${v(e.from)}`,field:e.field,key:e.key,kind:"expectedChange"}}return e.kind==="scalar-mismatch"?{actual:v(e.sut),expected:Ye(e.want),kind:"scalarMismatch",subject:Ge(e.subject)}:e.kind==="missing-row"?{entity:e.entity,key:e.key,kind:"missingRow"}:{entity:e.entity,key:e.key,kind:"unexpectedRow"}}function Z({config:e,fixturesDir:n,headed:r}){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:j,headed:r,secret:e.webhookSecret}}async function Te(e){let n=ee(e);await je(e.config,e.runId,n)}function ee({debugDir:e,events:n,recordingOptional:r,runId:t,stepSources:o}){let i=Fe(n),l=xo(e,t);if(l==null&&!r)throw new Error("recording-missing");let a=i.map((c,d)=>$o({aliases:[...Io(n),...Po(i)],generated:Co(n),generatedSingletons:Ao(n),origin:l==null?wo(i):l.origin,record:c,rrwebEvents:l==null?[]:l.events,sourceTest:o?.[d]??null})),s=i.flatMap(c=>c.findings.map(d=>cr(d,{step:G(F(c.source,c.index)),stepIndex:c.index,timeNanos:mr(c)})));return go({debugDir:e,events:[...a,...s],runId:t}),i}function go({debugDir:e,events:n,runId:r}){if(n.length===0)return;let t=S.join(e,r,"behavior.jsonl");if(!X(t))return;let o=n.map(i=>JSON.stringify(i)).join(`
|
|
140
|
-
`);mo(t,`${o}
|
|
141
|
-
`)}function mr(e){return String(BigInt(Math.max(0,Math.round(e.endMs)))*1000000n)}async function je(e,n,r){let t=r.filter(l=>l.findings.length>0).length,o=r.length-t,i=r.reduce((l,a)=>l+Math.max(0,a.endMs-a.startMs),0);await u({config:e,document:Uo,variables:{items:[{duration:i,failCount:t,firstFailedStepTitle:Ro(r),passCount:o,runId:n,status:t>0?"failed":"passed"}]}})}function Ro(e){let n=e.filter(r=>r.findings.length>0).toSorted((r,t)=>r.index-t.index).at(0);return n==null?null:G(F(n.source,n.index))}function Fe(e){return e.flatMap(n=>n.kind==="step"?[{annotations:n.annotations,endMs:n.endMs,findings:n.findings,index:n.index,source:n.source,startMs:n.startMs,state:n.state,url:n.url}]:[])}async function gr(e,n){await u({config:e,document:Lo,variables:{runIds:[n]}})}var Y=".uploaded";async function ho({config:e,debugDir:n,runId:r}){let t=S.join(n,r),o=S.join(t,"behavior.jsonl");if(X(S.join(t,Y)))return;if(!X(o)){p.warn({runId:r},"behavior upload skipped: behavior.jsonl missing on disk");return}await[0,1e3,3e3].reduce((l,a)=>l.then(async s=>s?!0:(await new Promise(c=>setTimeout(c,a)),ko({behaviorPath:o,config:e,runDir:t,runId:r}))),Promise.resolve(!1))}async function ko({behaviorPath:e,config:n,runDir:r,runId:t}){try{let o=await u({config:n,document:Do,variables:{runId:t}}),i=await fetch(o.debugArtifactUploadUrl,{body:yo(yr(e)),headers:{"content-type":vo},method:"PUT"});return i.ok?(await gr(n,t),fr(S.join(r,Y),""),!0):(p.warn({runId:t,status:i.status},"behavior upload PUT failed"),!1)}catch(o){return So(o)?(p.warn({runId:t},"behavior upload refused by server; run unknown \u2014 not retrying"),fr(S.join(r,Y),""),!0):(p.warn({error:o,runId:t},"behavior upload failed"),!1)}}function So(e){if(typeof e!="object"||e==null||!("errors"in e))return!1;let{errors:n}=e;return Array.isArray(n)&&n.some(r=>{if(typeof r!="object"||r==null||!("extensions"in r))return!1;let{extensions:t}=r;return typeof t=="object"&&t!=null&&"code"in t&&t.code==="FORBIDDEN"})}var vo="application/x-ndjson";function wo(e){return e.reduce((n,r)=>Math.min(n,r.startMs),e[0]?.startMs??0)}function xo(e,n){let r=S.join(e,n,"behavior.jsonl");if(!X(r))return null;let t=yr(r,"utf8").split(`
|
|
142
|
-
`).filter(i=>i.length>0).map(i=>bo(i)).flatMap(i=>Eo(i)?[i.event]:[]),o=t[0];return o==null?null:{events:t,origin:o.timestamp}}function bo(e){return JSON.parse(e)}function Eo(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}function Io(e){return e.flatMap(n=>n.kind==="world"?n.aliases:[])}function Po(e){return e.flatMap(n=>{let r=To(n.source);return r.flatMap(t=>{let i=r.filter(a=>a.entity===t.entity).indexOf(t),l=n.state.rows.filter(a=>a.status==="created"&&a.entity===t.entity).at(i);return l==null?[]:[{alias:t.as,entity:t.entity,key:l.key}]})})}function Co(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generated.map(r=>Rr(r)):[]))}function Rr({entity:e,field:n,key:r}){return`${e} ${r} ${n}`}function Ao(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generatedSingletons:[]))}function To(e){return e==null?[]:e.expect.flatMap(n=>Ce(n))}function Ce(e){return e.kind==="state"&&e.assertion.kind==="created"?[{as:e.assertion.as,entity:e.entity}]:e.kind==="and"?e.predicates.flatMap(n=>Ce(n)):e.kind==="when"?e.branches.flatMap(n=>n.consequence.flatMap(r=>Ce(r))):[]}var jo=3,Fo=0;function Mo({endMs:e,rrwebEvents:n,startMs:r}){let t=n.find(o=>o.type===jo&&o.data?.source===Fo&&o.timestamp>=r&&o.timestamp<=e);return t==null?r:t.timestamp}function $o({aliases:e,generated:n,generatedSingletons:r,origin:t,record:o,rrwebEvents:i,sourceTest:l}){let a=F(o.source,o.index),s=Mo({endMs:o.endMs,rrwebEvents:i,startMs:o.startMs});return{annotations:[...o.annotations.map(d=>({ephemeral:d.ephemeral,kind:d.kind,label:d.label,outcome:d.outcome,recordingStartMs:Math.max(0,(d.kind==="action"?s:d.atMs)-t),rrwebIds:[...d.rrwebIds],url:d.url,value:d.value??null}))],duration:Math.max(0,o.endMs-o.startMs),kind:"step",nodeType:a.kind,pageUrl:o.url,recordingEndMs:Math.max(0,o.endMs-t),recordingStartMs:Math.max(0,s-t),source:"verifier",sourceTest:l,stateRows:o.state.rows.map(d=>Oo({aliases:e,generated:n,row:d})),stateSingletons:o.state.singletons.map(d=>({changed:d.changed,generated:r.has(d.name),name:d.name,value:d.value==null?null:String(d.value)})),stepIndex:o.index,timeNanos:mr(o),title:G(a)}}function Oo({aliases:e,generated:n,row:r}){let t=e.find(o=>o.entity===r.entity&&o.key===r.key);return{entity:r.entity,fields:r.fields.map(o=>({changed:o.changed,field:o.field,generated:n.has(Rr({entity:r.entity,field:o.field,key:r.key})),value:o.value==null?null:String(o.value)})),key:r.key,label:t?.alias??r.key,status:r.status}}var Do=Ae(`
|
|
143
|
-
mutation DebugArtifactUploadUrl($runId: String!) {
|
|
144
|
-
debugArtifactUploadUrl(runId: $runId)
|
|
145
|
-
}
|
|
146
|
-
`),Uo=Ae(`
|
|
147
|
-
mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
|
|
148
|
-
completeRunsBatch(items: $items) {
|
|
149
|
-
id
|
|
150
|
-
status
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
`),Lo=Ae(`
|
|
154
|
-
mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
|
|
155
|
-
markRunArtifactsUploadedBatch(runIds: $runIds)
|
|
156
|
-
}
|
|
157
|
-
`);import{graphql as b}from"gql.tada";function _o(e){let n=e.trail;if(!(n==null||!No(e.kind)))return{baseLabel:n.baseLabel,baseState:n.baseState,durationMs:n.durationMs,outcome:e.kind,runId:e.runId,signature:n.signature,steps:n.steps}}function No(e){return e==="clean"||e==="flaky"||e==="finding"}async function Me({baseState:e,category:n,config:r,debugDir:t,devSessionId:o,events:i,lockfileHash:l,reproJson:a,runId:s,signature:c,spec:d,stepSources:f,summary:y,workflowSlug:g}){await u({config:r,document:Vo,variables:{devSessionId:o??null,lockfileHash:l??null,projectId:r.projectId,reproJson:a,runId:s,spec:d??null,workflowSlug:g??null}}),await Te({config:r,debugDir:t,events:i,recordingOptional:!0,runId:s,stepSources:f}),await u({config:r,document:Ko,variables:{baseState:e,category:n,projectId:r.projectId,reproRunId:s,signature:c,summary:y}})}async function ne(e,n,r){return(await u({config:e,document:Jo,variables:{lockfileHash:r,projectId:e.projectId,signature:n}})).exploreFindingExists}async function qo({attempts:e,config:n,devSessionId:r,findings:t,trail:o}){await u({config:n,document:Ho,variables:{attempts:e,devSessionId:r,findings:t,trail:o==null?null:{baseLabel:o.baseLabel,baseState:o.baseState,durationMs:o.durationMs,findingRunId:o.runId??null,findingSignature:o.signature??null,outcome:o.outcome,steps:o.steps.map(i=>({test:i.test,text:i.text}))}}})}async function Wo(e,n){return(await u({config:e,document:Bo,variables:{devSessionId:n}}).catch(t=>(p.warn({error:t},"reportExploreUnhealthy failed"),null)))?.reportExploreUnhealthy??!1}var Ho=b(`
|
|
158
|
-
mutation RecordExplorationProgress(
|
|
159
|
-
$devSessionId: String!
|
|
160
|
-
$attempts: Int!
|
|
161
|
-
$findings: Int!
|
|
162
|
-
$trail: ExploreTrailInput
|
|
163
|
-
) {
|
|
164
|
-
recordExplorationProgress(
|
|
165
|
-
devSessionId: $devSessionId
|
|
166
|
-
attempts: $attempts
|
|
167
|
-
findings: $findings
|
|
168
|
-
trail: $trail
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
`),Bo=b(`
|
|
172
|
-
mutation ReportExploreUnhealthy($devSessionId: String!) {
|
|
173
|
-
reportExploreUnhealthy(devSessionId: $devSessionId)
|
|
174
|
-
}
|
|
175
|
-
`),Vo=b(`
|
|
176
|
-
mutation CreateExploreRun(
|
|
177
|
-
$projectId: String!
|
|
178
|
-
$runId: String!
|
|
179
|
-
$devSessionId: String
|
|
180
|
-
$lockfileHash: String
|
|
181
|
-
$spec: String
|
|
182
|
-
$reproJson: String
|
|
183
|
-
$workflowSlug: String
|
|
184
|
-
) {
|
|
185
|
-
createExploreRun(
|
|
186
|
-
projectId: $projectId
|
|
187
|
-
runId: $runId
|
|
188
|
-
devSessionId: $devSessionId
|
|
189
|
-
lockfileHash: $lockfileHash
|
|
190
|
-
spec: $spec
|
|
191
|
-
reproJson: $reproJson
|
|
192
|
-
workflowSlug: $workflowSlug
|
|
193
|
-
) {
|
|
194
|
-
id
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
`),Ko=b(`
|
|
198
|
-
mutation SubmitExploreFinding(
|
|
199
|
-
$projectId: String!
|
|
200
|
-
$signature: String!
|
|
201
|
-
$summary: String!
|
|
202
|
-
$baseState: String!
|
|
203
|
-
$category: ExploreFindingCategory!
|
|
204
|
-
$reproRunId: String!
|
|
205
|
-
) {
|
|
206
|
-
submitExploreFinding(
|
|
207
|
-
projectId: $projectId
|
|
208
|
-
signature: $signature
|
|
209
|
-
summary: $summary
|
|
210
|
-
baseState: $baseState
|
|
211
|
-
category: $category
|
|
212
|
-
reproRunId: $reproRunId
|
|
213
|
-
) {
|
|
214
|
-
id
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
`),wl=b(`
|
|
218
|
-
mutation SetExploreFindingStatus(
|
|
219
|
-
$projectId: String!
|
|
220
|
-
$signature: String!
|
|
221
|
-
$status: ExploreFindingStatus!
|
|
222
|
-
) {
|
|
223
|
-
setExploreFindingStatus(projectId: $projectId, signature: $signature, status: $status)
|
|
224
|
-
}
|
|
225
|
-
`),Jo=b(`
|
|
226
|
-
query ExploreFindingExists($projectId: String!, $signature: String!, $lockfileHash: String!) {
|
|
227
|
-
exploreFindingExists(projectId: $projectId, signature: $signature, lockfileHash: $lockfileHash)
|
|
228
|
-
}
|
|
229
|
-
`);import Go from"path";import{graphql as Xo}from"gql.tada";import{graphql as re}from"gql.tada";function $e(e){switch(e.kind){case"app-not-ready":return"appNotReady";case"client-mount-missing":return"appNotReady";case"engine-network":case"engine-http":return"backendUnreachable";case"engine-unreachable":return"engineUnreachable";case"engine-decode":case"state-identity":case"setup-missing-row":case"conflicting-sessions":case"driver-launch":case"action-failed":case"check-failed":case"aborted":return null}}async function Oe(e,n,r){await u({config:e,document:Qo,variables:{reason:r,runId:n}}).catch(t=>{p.error(t,"failRun submission failed")})}async function De(e,n,r){await u({config:e,document:zo,variables:{cause:r,runId:n}}).catch(t=>{p.error(t,"markRunUnready submission failed")})}var Il=re(`
|
|
230
|
-
mutation ReleaseRun($runId: String!) {
|
|
231
|
-
releaseRun(runId: $runId)
|
|
232
|
-
}
|
|
233
|
-
`),Pl=re(`
|
|
234
|
-
mutation HeartbeatRun($runId: String!) {
|
|
235
|
-
heartbeatRun(runId: $runId)
|
|
236
|
-
}
|
|
237
|
-
`),Qo=re(`
|
|
238
|
-
mutation FailRun($runId: String!, $reason: String!) {
|
|
239
|
-
failRun(runId: $runId, reason: $reason)
|
|
240
|
-
}
|
|
241
|
-
`),zo=re(`
|
|
242
|
-
mutation MarkRunUnready($runId: String!, $cause: RunUnreadyCause!) {
|
|
243
|
-
markRunUnready(runId: $runId, cause: $cause)
|
|
244
|
-
}
|
|
245
|
-
`);async function Yo({config:e,cwd:n,errorSettle:r,fixturesDir:t,headed:o,lockfile:i,onPhase:l,runId:a,session:s,signal:c,test:d}){if(!await ei(e,a))return{outcome:{kind:"dispatch-failed",reason:"already-claimed",runId:a},persisted:Promise.resolve()};let y=Go.join(n,".ripplo","debug"),g=[];return(await s.runOnce({capture:!0,lockfile:i,onPhase:l,options:Z({config:e,fixturesDir:t,headed:o}),params:void 0,runId:a,sequence:void 0,test:d,onEvent:E=>{g.push(E)}},c)).match(async E=>{let Ue=Fe(g),ie=Ue.flatMap(xr=>xr.findings),ae=Zo(ie);if(ae!=null)return ee({config:e,debugDir:y,events:g,recordingOptional:!0,runId:a,stepSources:void 0}),await hr({config:e,error:ae,errorSettle:r,runId:a}),{outcome:{error:ae,kind:"error",runId:a},persisted:Promise.resolve()};await je(e,a,Ue),ee({config:e,debugDir:y,events:g,recordingOptional:!0,runId:a,stepSources:void 0});let wr=Promise.resolve();return{outcome:ie.length>0?{findings:ie,kind:"findings",runId:a}:{kind:"pass",runId:a},persisted:wr}},async E=>(await hr({config:e,error:E,errorSettle:r,runId:a}),{outcome:{error:E,kind:"error",runId:a},persisted:Promise.resolve()}))}async function hr({config:e,error:n,errorSettle:r,runId:t}){if(r==="defer")return;let o=$e(n);if(o!=null){await De(e,t,o);return}await Oe(e,t,D(n))}function Zo(e){let n=e.find(r=>r.kind==="driver-error"&&ze(r.error));return n!=null&&n.kind==="driver-error"?n.error:void 0}async function ei(e,n){return((await u({config:e,document:ni,variables:{runIds:[n]}})).startRunsBatch??[]).some(t=>t.id===n)}var ni=Xo(`
|
|
246
|
-
mutation StartRunsBatch($runIds: [String!]!) {
|
|
247
|
-
startRunsBatch(runIds: $runIds) {
|
|
248
|
-
id
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
`);import{randomUUID as ri}from"crypto";async function ti({assign:e,config:n,debugDir:r,devSessionId:t,fixturesDir:o,headed:i,lockfile:l,report:a,session:s,signal:c}){let d=Qe(l);if(e.stepRuns.length===0)return{kind:"error",reason:"empty-trail"};let f=fi(d,e.stepRuns),y=await tn({baseState:{name:h(e.baseStateTest),test:e.baseStateTest},corpus:d,lockfile:l,options:Z({config:n,fixturesDir:o,headed:i}),seenSignature:a?A=>ne(n,A,e.lockfileHash):void 0,session:s,stepRuns:e.stepRuns,runIdFor:A=>`explore-${ri()}-${String(A)}`},c),g=a?await di({baseStateTest:e.baseStateTest,config:n,debugDir:r,devSessionId:t,lockfileHash:e.lockfileHash,outcome:y,reproJson:si(d,e),stepSources:li(f)}):!1;return ai(y,f.length),yi(y,g,oi(f,e,y))}function oi(e,n,r){if(r.kind==="error"||r.kind==="aborted")return;let t=r.timing.confirm;return{baseLabel:n.baseStateTest.intent,baseState:h(n.baseStateTest),durationMs:Math.round(te(r.timing.detect)+(t==null?0:te(t))),signature:r.kind==="finding"||r.kind==="seen"?r.signature:void 0,steps:ii(e.slice(0,r.ranCount))}}function ii(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(t=>({test:r,text:t}))})}function te(e){return e.engineMs+e.worldMs+e.browserMs+e.driveMs+e.teardownMs}function ai(e,n){if(e.kind==="error"){p.info({detail:D(e.error),kind:e.kind,reason:e.error.kind,steps:n},"explore trail");return}if(e.kind==="aborted"||e.kind==="seen"){p.info({kind:e.kind,steps:n},"explore trail");return}let r=e.timing.detect,t=e.timing.confirm;p.info({browserMs:r.browserMs,confirmMs:t==null?void 0:te(t),detectMs:te(r),driveMs:r.driveMs,engineMs:r.engineMs,kind:e.kind,steps:n,teardownMs:r.teardownMs,worldMs:r.worldMs},"explore trail")}function si(e,n){let r=n.stepRuns.flatMap(o=>{let i=e[o.idx];return i==null?[]:[{index:i.index,params:o.params,test:i.test}]}),t={baseStateRef:h(n.baseStateTest),steps:r};return JSON.stringify(t)}function li(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(()=>r)})}async function di({baseStateTest:e,config:n,debugDir:r,devSessionId:t,lockfileHash:o,outcome:i,reproJson:l,stepSources:a}){return i.kind!=="finding"||i.captureEvents.length===0?!1:await ne(n,i.signature,o)?(p.info({devSessionId:t,signature:i.signature},"explore finding already reported, skipping duplicate"),!1):(await Me({baseState:i.baseState,category:ci(i.verifierLayer),config:n,debugDir:r,devSessionId:t,events:i.captureEvents,lockfileHash:o,reproJson:l,runId:i.runId,signature:i.signature,spec:pi(e,i.captureEvents),stepSources:a,summary:ui(i.captureEvents,i.title),workflowSlug:i.sourceTest?.split("/")[0]}).catch(s=>{p.warn({error:s},"explore finding report failed")}),!0)}function ci(e){return e==="data-rule"?"dataRule":e==="model-drift"?"modelDrift":e}function ui(e,n){let r=e.flatMap(t=>t.kind==="step"?[...t.findings]:[]).at(0);if(r!=null)return Ze(r);if(n!=null)return n;throw new Error("explore finding has no findings to summarize")}function pi(e,n){let r=n.flatMap(o=>o.kind==="step"?[o.source]:[]),t={absent:e.absent,actor:e.actor,exclusive:e.exclusive,intent:e.intent,maybe:[],name:e.name,params:e.params,singletons:e.singletons,steps:r,stub:!1,tests:[],world:e.world};return JSON.stringify(t)}function fi(e,n){return n.flatMap(r=>{let t=e[r.idx];return t==null?[]:[{actions:[...t.nav,...t.steps].map(o=>en(o.action)),label:`${t.test}#${String(t.index)}`}]})}function yi(e,n,r){return e.kind==="error"?{kind:e.kind,reason:`runtime:${e.error.kind}`}:e.kind==="finding"?{kind:e.kind,runId:n?e.runId:void 0,trail:r}:{kind:e.kind,trail:r}}import mi from"path";import{randomUUID as gi}from"crypto";async function td({cwd:e,onReady:n,signal:r,step:t,target:o}){let i=B(e).match(f=>({config:f}),f=>({failure:f}));if("failure"in i)return{failure:i.failure,kind:"config-failed"};let l=i.config,a=await Ve(e);if(a.result.isErr())return{error:a.result.error,kind:"compile-failed"};let s=a.result.value,c=await Ri(s,o);return c.kind!=="ok"?c:(await nn({lockfile:s,onReady:n,options:hi(l),runId:`teleport-${gi()}`,sequence:c.sequence,stopAfterStep:t,test:c.test},r)).match(f=>({kind:"done",result:f}),f=>({error:f,kind:"run-failed"}))}async function Ri(e,n){if(n.kind==="explore"){let t=await on(e,n.repro);return t.kind==="unplannable"?{kind:"unplannable"}:{kind:"ok",sequence:t.sequence,test:t.baseTest}}let r=P(e).find(t=>t.ref===n.ref);return r==null?{kind:"no-test",ref:n.ref}:{kind:"ok",sequence:rn(e,r.test,void 0),test:r.test}}function hi(e){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:mi.join(e.cwd,M),generate:j,headed:!0,secret:e.webhookSecret}}import{graphql as kr}from"gql.tada";import{err as oe,ok as Sr}from"neverthrow";var ki=kr(`
|
|
252
|
-
query ExecutorSession($projectId: String!, $cwd: String!) {
|
|
253
|
-
project(id: $projectId) {
|
|
254
|
-
id
|
|
255
|
-
devSession(cwd: $cwd) {
|
|
256
|
-
id
|
|
257
|
-
executor
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
`),Si=kr(`
|
|
262
|
-
mutation SetDevSessionExecutor($devSessionId: String!, $executor: RunExecutor!) {
|
|
263
|
-
setDevSessionExecutor(devSessionId: $devSessionId, executor: $executor) {
|
|
264
|
-
__typename
|
|
265
|
-
... on DevSession {
|
|
266
|
-
id
|
|
267
|
-
executor
|
|
268
|
-
}
|
|
269
|
-
... on DevSessionEndedError {
|
|
270
|
-
message
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
`);async function ld(e){return(await vr(e)).map(r=>r.executor)}async function dd(e,n){let r=await vr(e);if(r.isErr())return oe(r.error);let o=(await u({config:e,document:Si,variables:{devSessionId:r.value.id,executor:n}})).setDevSessionExecutor;return o==null?oe({kind:"empty-response"}):o.__typename!=="DevSession"?oe({kind:"session-ended"}):Sr(o.executor)}async function vr(e){let r=(await u({config:e,document:ki,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;return r==null?oe({kind:"no-session"}):Sr({executor:r.executor,id:r.id})}export{Ii as a,$i as b,W as c,jr as d,Ni as e,fe as f,Sn as g,wn as h,B as i,Oa as j,Na as k,Ln as l,Ds as m,Us as n,Ls as o,ut as p,Nn as q,Ns as r,Ks as s,Qs as t,zs as u,Gs as v,Xs as w,Ys as x,Zs as y,el as z,nl as A,rl as B,tl as C,na as D,ra as E,ge as F,ta as G,In as H,ha as I,w as J,ka as K,Se as L,es as M,Ps as N,Tt as O,Cs as P,Y as Q,ho as R,Oe as S,Yo as T,_o as U,qo as V,Wo as W,ti as X,td as Y,ld as Z,dd as _};
|