ripplo 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZW76MTLE.js → chunk-37NZ5HM2.js} +1 -1
- package/dist/{chunk-JMJXM477.js → chunk-4GIORBIH.js} +1 -1
- package/dist/{chunk-RYR5R3FA.js → chunk-5JD26R53.js} +1 -1
- package/dist/chunk-7E3AM2KY.js +83 -0
- package/dist/{chunk-SVM5ORF6.js → chunk-BOMK6ZXG.js} +1 -1
- package/dist/{chunk-6UJNBCPU.js → chunk-C63HR3XQ.js} +1 -1
- package/dist/{chunk-7JKAV7AT.js → chunk-CAGQ4M2W.js} +1 -1
- package/dist/{chunk-ORWKDV2H.js → chunk-D5F6DIXU.js} +1 -1
- package/dist/{chunk-2UJUWE7A.js → chunk-FAYHW72O.js} +1 -1
- package/dist/{chunk-77BRFU6M.js → chunk-GMOMT4D5.js} +1 -1
- package/dist/{chunk-BTNSUORZ.js → chunk-IUEJNPB6.js} +1 -1
- package/dist/{chunk-QK7AEQ3B.js → chunk-JTML352F.js} +2 -2
- package/dist/{chunk-XBAVNTRQ.js → chunk-K4GNKQB5.js} +1 -1
- package/dist/{chunk-KAD7UO53.js → chunk-KGCLJTPO.js} +21 -21
- package/dist/{chunk-UAWFWSKD.js → chunk-MBQEVGUG.js} +1 -1
- package/dist/{chunk-3FTGPUK3.js → chunk-NAXGHRI7.js} +1 -1
- package/dist/chunk-NRJUY625.js +360 -0
- package/dist/{chunk-3VL4ORWB.js → chunk-TLSVFIET.js} +1 -1
- package/dist/{chunk-7GY5ANXL.js → chunk-XUZZKRZB.js} +1 -1
- package/dist/{cli-error-PG24CNXE.js → cli-error-UKCCFGND.js} +1 -1
- package/dist/{compile-write-LMAPZGYL.js → compile-write-HYPPASGM.js} +1 -1
- package/dist/{daemon-SIPLLQJP.js → daemon-FPJC6UTS.js} +1 -1
- package/dist/{daemon-HTI5DVL2.js → daemon-JCI3PIF2.js} +1 -1
- package/dist/{dsl-loader-I6F73IFP.js → dsl-loader-3PR7GLST.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +180 -180
- package/dist/{plan-reminder-MR2UFQZE.js → plan-reminder-5IW6CHBL.js} +1 -1
- package/dist/{post-edit-76WC4SU3.js → post-edit-FXAZHTN6.js} +1 -1
- package/dist/post-edit-analyze-ZSZ6AO3U.js +4 -0
- package/dist/{post-edit-flag-stubs-UJ2SZJVQ.js → post-edit-flag-stubs-QMRDE3JW.js} +1 -1
- package/dist/{pre-edit-YGDITCNZ.js → pre-edit-PGV7XSGT.js} +1 -1
- package/dist/{pre-edit-watch-gate-4V2KYSIF.js → pre-edit-watch-gate-DQD7CWGN.js} +1 -1
- package/dist/{prompt-submit-ARRJRLMC.js → prompt-submit-PC4QIGY3.js} +1 -1
- package/dist/status-VQ57DB6M.js +4 -0
- package/dist/{stop-enforce-BLX3ZEDG.js → stop-enforce-U7PURAF5.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-RJ6MN3PT.js +0 -360
- package/dist/chunk-SQ4SBMKG.js +0 -83
- package/dist/post-edit-analyze-5F5VSL4T.js +0 -4
- package/dist/status-VWZXTEWF.js +0 -4
|
@@ -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{a}from"./chunk-
|
|
4
|
+
import{a}from"./chunk-MBQEVGUG.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
|
|
@@ -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{a as t}from"./chunk-
|
|
4
|
+
import{a as t}from"./chunk-5JD26R53.js";import{a as e}from"./chunk-XUZZKRZB.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-NAXGHRI7.js";import"./chunk-CAGQ4M2W.js";import"./chunk-OQ6KNYPG.js";import"./chunk-IUEJNPB6.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-BOMK6ZXG.js";import"./chunk-7E3AM2KY.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var r=o({event:"PostToolUse",handlers:[t,e],note:i=>({hookSpecificOutput:{additionalContext:i,hookEventName:"PostToolUse"}})});export{r as postEditHook};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{a}from"./chunk-5JD26R53.js";import"./chunk-NAXGHRI7.js";import"./chunk-CAGQ4M2W.js";import"./chunk-OQ6KNYPG.js";import"./chunk-IUEJNPB6.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-BOMK6ZXG.js";import"./chunk-7E3AM2KY.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditAnalyze};
|
|
@@ -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{a}from"./chunk-
|
|
4
|
+
import{a}from"./chunk-XUZZKRZB.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-BOMK6ZXG.js";import"./chunk-7E3AM2KY.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditFlagStubs};
|
|
@@ -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{a as e}from"./chunk-
|
|
4
|
+
import{a as e}from"./chunk-FAYHW72O.js";import{a as t}from"./chunk-5HFJIZLI.js";import"./chunk-G6J2WIHJ.js";import{a as i}from"./chunk-T6WA2F3S.js";import"./chunk-JJ4QQPAV.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
|
|
@@ -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{a}from"./chunk-
|
|
4
|
+
import{a}from"./chunk-FAYHW72O.js";import"./chunk-MHNGR6M7.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
|
|
@@ -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{a as e}from"./chunk-PYDYI3AA.js";import{a as r}from"./chunk-AXROBTLA.js";import{a as i}from"./chunk-XAMVRZJH.js";import"./chunk-BGY5F3IU.js";import"./chunk-CI6273ZU.js";import"./chunk-SXVWB7TZ.js";import"./chunk-G6J2WIHJ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-47LLHHJH.js";import"./chunk-OQ6KNYPG.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import{a as t}from"./chunk-
|
|
4
|
+
import{a as e}from"./chunk-PYDYI3AA.js";import{a as r}from"./chunk-AXROBTLA.js";import{a as i}from"./chunk-XAMVRZJH.js";import"./chunk-BGY5F3IU.js";import"./chunk-CI6273ZU.js";import"./chunk-SXVWB7TZ.js";import"./chunk-G6J2WIHJ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-47LLHHJH.js";import"./chunk-OQ6KNYPG.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import{a as t}from"./chunk-MBQEVGUG.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{a}from"./chunk-4GIORBIH.js";import"./chunk-37NZ5HM2.js";import"./chunk-GMOMT4D5.js";import"./chunk-C63HR3XQ.js";import"./chunk-IUEJNPB6.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-BOMK6ZXG.js";import"./chunk-7E3AM2KY.js";import"./chunk-D5F6DIXU.js";import"./chunk-KGCLJTPO.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
|
|
@@ -1,7 +1,7 @@
|
|
|
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{a as P,b as A,c as I}from"./chunk-BGY5F3IU.js";import{a as T,b as O,e as D,f as H,g as q,h}from"./chunk-
|
|
4
|
+
import{a as P,b as A,c as I}from"./chunk-BGY5F3IU.js";import{a as T,b as O,e as D,f as H,g as q,h}from"./chunk-TLSVFIET.js";import{a as L,c as N,e as x}from"./chunk-GMOMT4D5.js";import"./chunk-C63HR3XQ.js";import{a as v,c as $}from"./chunk-CAGQ4M2W.js";import"./chunk-OQ6KNYPG.js";import{a as C}from"./chunk-IUEJNPB6.js";import{c as k}from"./chunk-JS3DLVVI.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{a as c}from"./chunk-MHNGR6M7.js";import{c as w}from"./chunk-KOKEEAEF.js";import{h as j,i as E,l as y}from"./chunk-BOMK6ZXG.js";import"./chunk-7E3AM2KY.js";import"./chunk-D5F6DIXU.js";import{Ga as g}from"./chunk-KGCLJTPO.js";import{a as S}from"./chunk-7WZ3VIUU.js";import{f as b}from"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import{d as m}from"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import J from"path";import U from"process";import{CancellationTokenSource as _}from"vscode-jsonrpc/node";import{graphql as W}from"gql.tada";function F(n){return`--- Ripplo Run Failures (scope) ---
|
|
5
5
|
${n.join(`
|
|
6
6
|
`)}
|
|
7
7
|
Artifacts: .ripplo/debug/<runId>/. ${c("run")}`}function R({lines:n,retried:e}){let r=e?"Already retried once, still unreachable.":"";return["--- Ripplo Run Not Verified (server unreachable) ---",...n,"Server-side transient \u2014 not the daemon, dev server, or auth (`npx ripplo doctor` is green).",r,"Wait a moment, then stop again to re-verify."].filter(t=>t.length>0).join(`
|
package/package.json
CHANGED
package/dist/chunk-RJ6MN3PT.js
DELETED
|
@@ -1,360 +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{a as on,f as an,g as sn,j as ln,n as dn,o as un,p as cn,q as pn,r as gn}from"./chunk-6UJNBCPU.js";import{b as fn}from"./chunk-XBAVNTRQ.js";import{c as en,e as nn,g as rn}from"./chunk-3FTGPUK3.js";import{a as tn}from"./chunk-BTNSUORZ.js";import{c as H}from"./chunk-JS3DLVVI.js";import{a as U}from"./chunk-R4ZTRVDQ.js";import{d as be}from"./chunk-FEHVIHVA.js";import{i as Ye,j as Ze}from"./chunk-SVM5ORF6.js";import{$ as Ge,E as We,H as oe,K as Ve,L as Ke,P as Je,Q as Qe,U as ze,a as De,aa as Xe,b as qe,c as Ne,d as I,h as Le,i as He,k as _e,m as M,n as O,o as Be,q as C}from"./chunk-SQ4SBMKG.js";import{f as $e,k as Fe,l as je,m as Ue}from"./chunk-ORWKDV2H.js";import{Ba as L,Ca as k,J as Ae,L as te,U as N,V as Te,W as Me,X as Oe,s as q}from"./chunk-KAD7UO53.js";import{d as Ce}from"./chunk-KH4QH23U.js";import{c as D}from"./chunk-RIASQHPG.js";import{a as Ie,d as u,f as g,g as T}from"./chunk-C7SV6AR2.js";import hr from"p-queue";var kr=4,Sr={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},_=new hr({concurrency:kr}),w={headedActive:0,interactiveActive:0,interactiveQueued:0},yn={current:null};function yi({headed:e,task:n,workClass:r}){let t=Sr[r];return r==="p3-explore"?_.add(n,{priority:t}):(w.interactiveQueued+=1,B(),_.add(()=>wr({headed:e,task:n}),{priority:t}))}function mi(e){!Number.isFinite(e)||e<1||(_.concurrency=Math.floor(e),B())}function ie(){return{active:w.interactiveActive,headedActive:w.headedActive,poolSize:_.concurrency,queued:w.interactiveQueued}}function Ri(e){yn.current=e}async function wr({headed:e,task:n}){w.interactiveQueued-=1,w.interactiveActive+=1,w.headedActive+=e?1:0,B();try{return await n()}finally{w.interactiveActive-=1,w.headedActive-=e?1:0,B()}}function B(){yn.current?.()}async function mn(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(2e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function Rn(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(25e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}import{graphql as vr}from"gql.tada";async function hn(e,n){let t=(await u({config:e,document:Er,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 Er=vr(`
|
|
5
|
-
query DaemonWorkflows($projectId: String!, $cwd: String!) {
|
|
6
|
-
project(id: $projectId) {
|
|
7
|
-
id
|
|
8
|
-
devSession(cwd: $cwd) {
|
|
9
|
-
id
|
|
10
|
-
workflows {
|
|
11
|
-
id
|
|
12
|
-
slug
|
|
13
|
-
tests {
|
|
14
|
-
id
|
|
15
|
-
slug
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`);import{err as ae,ok as kn}from"neverthrow";function wn({all:e,ids:n,lockfile:r}){if(e&&n.length>0)return ae({kind:"conflicting-flags"});if(e)return kn(r.workflows.filter(i=>!i.stub).flatMap(i=>i.tests.map(s=>M(s))));if(n.length===0)return ae({kind:"nothing-selected"});let t=n.map(i=>({id:i,refs:Pr(r,i)})),o=t.filter(i=>i.refs.length===0).map(i=>i.id);return o.length>0?ae({kind:"unknown-ids",known:xr(r),unknown:o}):kn([...new Set(t.flatMap(i=>i.refs))])}function vn(e,n){let r=new Map(O(e).map(t=>[t.ref,{testName:t.test.name,testSlug:t.test.slug,workflowName:t.workflow.name,workflowSlug:k(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 xr(e){return e.workflows.map(n=>k(n.name))}function Pr(e,n){let r=e.workflows.find(t=>t.name===n||k(t.name)===k(n));return r!=null?r.tests.map(t=>M(t)):O(e).filter(t=>t.ref===n||Sn(t.ref)===Sn(n)).map(t=>t.ref)}function Sn(e){let n=e.lastIndexOf("/");return n===-1?k(e):`${k(e.slice(0,n))}/${k(e.slice(n+1))}`}import{err as se,ok as En}from"neverthrow";import{graphql as br}from"gql.tada";async function xn({config:e,cwd:n,lockfile:r}){await rn({cwd:n,editedPath:void 0,lockfile:r,requireHooks:!1,syncFirst:!1});let t=await Cr(e);if(t.isErr())return se(t.error);let o=new Map(r.workflows.filter(s=>!s.stub).map(s=>[k(s.name),s])),i=[...new Set(t.value)].flatMap(s=>{let a=o.get(s);return a==null?[]:a.tests.map(l=>M(l))});return i.length===0?se({kind:"scope-empty"}):En(i)}var Ir=br(`
|
|
22
|
-
query ScopeSelection($projectId: String!, $cwd: String!) {
|
|
23
|
-
project(id: $projectId) {
|
|
24
|
-
id
|
|
25
|
-
devSession(cwd: $cwd) {
|
|
26
|
-
id
|
|
27
|
-
scopeItems {
|
|
28
|
-
id
|
|
29
|
-
workflow {
|
|
30
|
-
id
|
|
31
|
-
slug
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`);async function Cr(e){try{let r=(await u({config:e,document:Ir,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return En(r.flatMap(t=>t.workflow==null?[]:[t.workflow.slug]))}catch(n){return se({detail:n instanceof Error?n.message:String(n),kind:"scope-fetch-failed"})}}var le=new Set,Pn=new Map;function Hi(e){le.add(e)}function Ar(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 bn({config:e,cwd:n,message:r}){return(await Fe(n)).match(o=>Tr({config:e,cwd:n,lockfile:o,message:r}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...Ar(o)]},kind:"error"}))}async function Tr({config:e,cwd:n,lockfile:r,message:t}){let o=await mn(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await Rn(e.engineUrl);if(i!=null)return{error:{code:"engine-unreachable",detail:i,url:e.engineUrl},kind:"error"};await Ye(n,r);let s=await nn(n);if(s==null)return{error:{code:"sync-failed",detail:"lockfile-missing"},kind:"error"};if(!le.has(s)){let l=await Or({config:e,cwd:n,lockfile:r});if(l!=null)return{error:{code:"sync-failed",detail:l},kind:"error"};le.add(s)}return(await $r({config:e,cwd:n,lockfile:r,message:t})).match(async l=>({kind:"ready",lockfileHashValue:s,selections:vn(r,l),targetsByClaimKey:await Mr({config:e,cwd:n,hash:s})}),l=>Promise.resolve({error:l,kind:"error"}))}async function Mr({config:e,cwd:n,hash:r}){let t=Pn.get(r);if(t!=null)return t;let o=await hn(e,n);return Pn.set(r,o),o}async function Or(e){try{return await en(e),null}catch(n){return n instanceof Error?n.message:String(n)}}async function $r({config:e,cwd:n,lockfile:r,message:t}){return!t.all&&t.tests.length===0?(await xn({config:e,cwd:n,lockfile:r})).mapErr(Fr):wn({all:t.all,ids:t.tests,lockfile:r}).mapErr(jr)}function Fr(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function jr(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]}}}import{randomUUID as tt}from"crypto";import{createId as ot}from"@paralleldrive/cuid2";import{CancellationTokenSource as Wn,ResponseError as it}from"vscode-jsonrpc/node";import{graphql as Ur}from"gql.tada";var Dr=Ur(`
|
|
38
|
-
mutation DaemonCreateRun(
|
|
39
|
-
$id: String
|
|
40
|
-
$workflowId: String!
|
|
41
|
-
$testId: String
|
|
42
|
-
$clientVersion: String
|
|
43
|
-
$executor: RunExecutor
|
|
44
|
-
$target: RunTarget
|
|
45
|
-
$lockfileHash: String
|
|
46
|
-
) {
|
|
47
|
-
createRun(
|
|
48
|
-
id: $id
|
|
49
|
-
workflowId: $workflowId
|
|
50
|
-
testId: $testId
|
|
51
|
-
executor: $executor
|
|
52
|
-
target: $target
|
|
53
|
-
clientVersion: $clientVersion
|
|
54
|
-
lockfileHash: $lockfileHash
|
|
55
|
-
) {
|
|
56
|
-
__typename
|
|
57
|
-
... on MutationCreateRunSuccess {
|
|
58
|
-
data {
|
|
59
|
-
id
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
... on LimitExceededError {
|
|
63
|
-
code
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`);async function In(e){try{let r=(await u({config:e.config,document:Dr,variables:qr(e)})).createRun;return r==null?W({detail:"create-run-null",type:"generic"}):r.__typename==="MutationCreateRunSuccess"?null:r.__typename==="LimitExceededError"?W({code:r.code,type:"limit"}):W({detail:r.__typename,type:"generic"})}catch(n){return Nr(n)}}function qr({executor:e,lockfileHash:n,runId:r,target:t}){return{clientVersion:U(),executor:e,id:r,lockfileHash:n,target:e==="cloud"?"tunnel":void 0,testId:t.testId,workflowId:t.workflowId}}function W(e){return{kind:"dispatch-error",reason:e}}function Nr(e){return e instanceof Ie?{detail:e.message,kind:"infra-error"}:W({detail:e instanceof Error?e.message:String(e),type:"generic"})}function Cn(){return new Map}function V(e){return`${e.workflowSlug}/${e.testSlug}`}function Lr(e){return`${V(e)}@${e.lockfileHash}@${String(e.headed)}`}function An(e,n){let r=Lr(n.identity),t=e.get(r);if(t!=null){let i={...t,jobIds:new Set([...t.jobIds,n.jobId])};return{entry:i,kind:"joined",state:de(e,i)}}let o={claimed:!1,claimKey:V(n.identity),deadlineAt:n.deadlineAt,headed:n.identity.headed,inflightKey:r,jobIds:new Set([n.jobId]),runId:n.runId,testName:n.testName,workflowName:n.workflowName};return{entry:o,kind:"created",state:de(e,o)}}function de(e,n){return new Map([...e,[n.inflightKey,n]])}function ue(e,n){let r=[...e.values()].find(o=>o.runId===n&&!o.claimed);if(r==null)return{entry:null,state:e};let t={...r,claimed:!0};return{entry:t,state:de(e,t)}}function Tn(e,n){return new Map([...e].filter(([r])=>r!==n))}function Mn(e,n){let r=[...e.values()].filter(a=>a.jobIds.has(n)),t=r.filter(a=>a.jobIds.size===1),o=r.filter(a=>a.jobIds.size>1).map(a=>({...a,jobIds:new Set([...a.jobIds].filter(l=>l!==n))})),i=new Set(t.map(a=>a.inflightKey)),s=new Map([...e].filter(([a])=>!i.has(a)).map(([a,l])=>{let p=o.find(c=>c.inflightKey===a);return[a,p??l]}));return{cancelled:t,state:s}}function On(e,n){let r=[...e.values()].filter(o=>!o.claimed&&o.deadlineAt<=n),t=new Set(r.map(o=>o.inflightKey));return{expired:r,state:new Map([...e].filter(([o])=>!t.has(o)))}}import{graphql as Kr}from"gql.tada";import{graphql as K,readFragment as $}from"gql.tada";var $n=K(`
|
|
68
|
-
fragment CloudRunProgressActionFields on RunProgressAction {
|
|
69
|
-
kind
|
|
70
|
-
path
|
|
71
|
-
target
|
|
72
|
-
source
|
|
73
|
-
key
|
|
74
|
-
}
|
|
75
|
-
`),Fn=K(`
|
|
76
|
-
fragment CloudExecutingStageFields on RunProgressExecutingStage {
|
|
77
|
-
kind
|
|
78
|
-
path
|
|
79
|
-
action {
|
|
80
|
-
...CloudRunProgressActionFields
|
|
81
|
-
}
|
|
82
|
-
remaining {
|
|
83
|
-
id
|
|
84
|
-
kind
|
|
85
|
-
check
|
|
86
|
-
negated
|
|
87
|
-
target
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`,[$n]),jn=K(`
|
|
91
|
-
fragment CloudExecutingProgressFields on ExecutingStepProgress {
|
|
92
|
-
stepIndex
|
|
93
|
-
stepCount
|
|
94
|
-
stepStage: stage {
|
|
95
|
-
...CloudExecutingStageFields
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`,[Fn]),J=K(`
|
|
99
|
-
fragment CloudRunProgressFields on RunProgress {
|
|
100
|
-
__typename
|
|
101
|
-
... on WaitingForRunnerProgress {
|
|
102
|
-
sequence
|
|
103
|
-
deadlineAt
|
|
104
|
-
retry {
|
|
105
|
-
attempt
|
|
106
|
-
limit
|
|
107
|
-
}
|
|
108
|
-
reason
|
|
109
|
-
capacity {
|
|
110
|
-
active
|
|
111
|
-
limit
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
... on SettingUpStateProgress {
|
|
115
|
-
sequence
|
|
116
|
-
deadlineAt
|
|
117
|
-
retry {
|
|
118
|
-
attempt
|
|
119
|
-
limit
|
|
120
|
-
}
|
|
121
|
-
setupStage: stage
|
|
122
|
-
activeSources
|
|
123
|
-
}
|
|
124
|
-
... on SigningInProgress {
|
|
125
|
-
sequence
|
|
126
|
-
deadlineAt
|
|
127
|
-
retry {
|
|
128
|
-
attempt
|
|
129
|
-
limit
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
... on StartingBrowserProgress {
|
|
133
|
-
sequence
|
|
134
|
-
deadlineAt
|
|
135
|
-
retry {
|
|
136
|
-
attempt
|
|
137
|
-
limit
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
... on ExecutingStepProgress {
|
|
141
|
-
sequence
|
|
142
|
-
deadlineAt
|
|
143
|
-
retry {
|
|
144
|
-
attempt
|
|
145
|
-
limit
|
|
146
|
-
}
|
|
147
|
-
...CloudExecutingProgressFields
|
|
148
|
-
}
|
|
149
|
-
... on FinishingProgress {
|
|
150
|
-
sequence
|
|
151
|
-
deadlineAt
|
|
152
|
-
retry {
|
|
153
|
-
attempt
|
|
154
|
-
limit
|
|
155
|
-
}
|
|
156
|
-
finishStage: stage
|
|
157
|
-
}
|
|
158
|
-
... on UploadingReplayProgress {
|
|
159
|
-
sequence
|
|
160
|
-
deadlineAt
|
|
161
|
-
retry {
|
|
162
|
-
attempt
|
|
163
|
-
limit
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
`,[jn]);function Un(e){let n=$(J,e),r=N.safeParse({activity:Hr(e),deadlineAt:n.deadlineAt,retry:n.retry});return r.success?{sequence:n.sequence,signal:r.data}:null}function Hr(e){let n=$(J,e);switch(n.__typename){case"WaitingForRunnerProgress":return{capacity:n.capacity,kind:"waitingForRunner",reason:n.reason};case"SettingUpStateProgress":return{activeSources:n.activeSources,kind:"settingUpState",stage:n.setupStage};case"SigningInProgress":return{kind:"signingIn"};case"StartingBrowserProgress":return{kind:"startingBrowser"};case"ExecutingStepProgress":return _r(n);case"FinishingProgress":return{kind:"finishing",stage:n.finishStage};case"UploadingReplayProgress":return{kind:"uploadingReplay"}}}function _r(e){let n=$(jn,e);return{kind:"executingStep",stage:Br(n.stepStage),stepCount:n.stepCount,stepIndex:n.stepIndex}}function Br(e){let n=$(Fn,e);switch(n.kind){case"performingAction":return{action:Wr(ce(n.action,"cloud-progress-action-missing")),kind:n.kind};case"waitingForApp":return{kind:n.kind,path:ce(n.path,"cloud-progress-path-missing")};case"checkingExpectations":return{kind:n.kind,remaining:ce(n.remaining,"cloud-progress-expectations-missing").map(r=>r.kind==="browser"?{id:r.id,kind:r.kind,negated:r.negated,subject:r.target}:{check:r.check,id:r.id,kind:r.kind,negated:r.negated,target:r.target})};case"readingState":case"verifyingEffects":return{kind:n.kind}}}function Wr(e){let n=$($n,e);switch(n.kind){case"goto":return{kind:n.kind,path:n.path};case"press":return{key:n.key,kind:n.kind,target:n.target};case"drag":return{kind:n.kind,source:n.source,target:n.target};case"actor":return{kind:n.kind};case"fill":case"clear":case"click":case"dblclick":case"select":case"check":case"uncheck":case"hover":case"upload":return{kind:n.kind,target:n.target}}}function ce(e,n){if(e==null)throw new TypeError(n);return e}function Dn(e){return e==null?"the run never became ready and the server did not record why":Vr[e]}var Vr={appNotReady:"your app never became ready \u2014 it did not respond at the workflow's first page before the timeout",backendUnreachable:"Ripplo could not reach your app's server",engineSignatureRejected:"your app rejected Ripplo's signed request \u2014 RIPPLO_WEBHOOK_SECRET in your app does not match the secret Ripplo holds for this project. Run `npx ripplo doctor` to compare them",engineUnreachable:"Ripplo could not reach your app's engine endpoint \u2014 check RIPPLO_ENGINE_URL and that the app is running",tunnelDisconnected:"the tunnel to your app dropped \u2014 cloud runs reach a local app through the daemon, so keep `npx ripplo daemon` running"};var Jr=2e3,Qr=Kr(`
|
|
168
|
-
query DaemonCloudRunStatus($runId: String!) {
|
|
169
|
-
run(id: $runId) {
|
|
170
|
-
status
|
|
171
|
-
failureReason
|
|
172
|
-
unreadyCause
|
|
173
|
-
progress {
|
|
174
|
-
...CloudRunProgressFields
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
`,[J]);function qn({config:e,onComplete:n,onProgress:r,onStarted:t,runId:o,signal:i}){let s=!1,a,l=!1,p=null,c=async()=>{if(s||i.aborted)return;let d=await Zr({config:e,runId:o}).catch(Ln);if(!Gr({signal:i,stopped:s})){if(l=Xr({onStarted:t,startedFired:l,state:d}),p=Yr({onProgress:r,progressMarker:p,state:d}),Nn(d.status)){s=!0,n(zr(d));return}a=setTimeout(()=>{c()},Jr)}};return c(),{stop:()=>{s=!0,a!=null&&clearTimeout(a)}}}function zr({failureReason:e,status:n,unreadyCause:r}){return n==="passed"?{kind:"pass"}:n==="failed"?{detail:e??"run failed without an error reason",kind:"error"}:n==="cancelled"?{detail:"cancelled",kind:"error"}:n==="unready"?{detail:Dn(r),kind:"error"}:{detail:"unknown",kind:"error"}}function Gr({signal:e,stopped:n}){return n||e.aborted}function Nn(e){return e==="passed"||e==="failed"||e==="cancelled"||e==="unready"}function Xr({onStarted:e,startedFired:n,state:r}){return n||r.status!=="running"&&!Nn(r.status)?n:(e(),!0)}function Yr({onProgress:e,progressMarker:n,state:r}){if(r.progress==null)return n;let t=JSON.stringify(r.progress);return t===n?n:(e(r.progress.signal),t)}async function Zr({config:e,runId:n}){let r=await u({config:e,document:Qr,variables:{runId:n}});return r.run==null?Ln():{failureReason:r.run.failureReason,progress:r.run.progress==null?null:Un(r.run.progress),status:r.run.status,unreadyCause:r.run.unreadyCause}}function Ln(){return{failureReason:null,progress:null,status:"unknown",unreadyCause:null}}import{z as pe}from"zod";var et=pe.looseObject({code:pe.string().optional(),message:pe.string().optional()}),nt=new Set(["ECONNRESET","EPIPE"]),rt=["socket has been ended","socket is closed","write after end"];function Q(e){if(Array.isArray(e))return e.some(r=>Q(r));let n=et.safeParse(e);return n.success?n.data.code!=null&&nt.has(n.data.code)||n.data.message!=null&&rt.some(r=>n.data.message?.toLowerCase().includes(r)):!1}var at=on(process.argv[1]),Hn=12e4,st=-32099;function lt(e){let n=new AbortController;return e.isCancellationRequested?(n.abort(),n.signal):(e.onCancellationRequested(()=>{n.abort()}),n.signal)}function ha(e){let n={...e,cancellations:new Map,cell:{inflight:Cn()},jobs:new Map,timers:new Map};return{claim:r=>ft(n,r),handleConnection:r=>{dt(n,r)},idle:()=>Kn(n),progress:(r,t)=>{Vn({ctx:n,runId:r,signal:t})}}}function Vn({ctx:e,runId:n,signal:r}){let t=[...e.cell.inflight.values()].find(o=>o.runId===n);t!=null&&x(e,t,{kind:"run-progress",runId:n,signal:r,testName:t.testName,workflowName:t.workflowName})}function dt(e,n){let r=an(n);r.onRequest(dn,(t,o)=>ut({connection:r,ctx:e,params:t,token:o})),r.onRequest(un,()=>{let t=ie();return{active:t.active,bundleMtimeMs:at,queued:t.queued,sseHealth:e.sseHealth(),version:U(),...e.explorationStatus()}}),r.onRequest(cn,()=>{let t=Kn(e);return t&&e.onShutdownRequest(),t}),r.onClose(()=>{gt(e,r)}),r.onError(t=>{Q(t)||g.warn({err:t},"ipc connection error")}),n.on("error",t=>{Q(t)||g.warn({err:t},"ipc socket error")}),r.listen()}function Kn(e){let n=ie();return e.jobs.size===0&&n.active===0&&n.queued===0}async function ut({connection:e,ctx:n,params:r,token:t}){let o=sn.safeParse(r);if(!o.success)throw _n({code:"bad-message"});await n.ready;let i=await bn({config:n.config,cwd:n.cwd,message:o.data});if(i.kind==="error")throw _n(i.error);let s=tt(),a=new Wn;return t.onCancellationRequested(()=>{Jn(n,s)}),n.jobs.set(s,{cancellation:a,connection:e,failed:0,notRun:0,passed:0,total:i.selections.length}),yt({ctx:n,headed:o.data.headed,jobId:s,lockfileHashValue:i.lockfileHashValue,selections:i.selections,targetsByClaimKey:i.targetsByClaimKey,token:a.token}).catch(l=>{g.error({err:l},"ipc dispatch failed")}),{jobId:s,total:i.selections.length}}function _n(e){return new it(st,e.code,e)}function Jn(e,n){let r=e.jobs.get(n);if(r==null)return;r.cancellation.cancel(),e.jobs.delete(n);let t=Mn(e.cell.inflight,n);e.cell.inflight=t.state,t.cancelled.forEach(o=>{j(e,o.inflightKey,"cancel")})}function j(e,n,r){let t=e.timers.get(n);t!=null&&(clearTimeout(t),e.timers.delete(n)),r==="cancel"&&(e.cancellations.get(n)?.cancel(),e.cancellations.delete(n))}function ge(e,n,r){e.cell.inflight=Tn(e.cell.inflight,n),j(e,n,r),r==="keep"&&e.cancellations.delete(n)}function ct(e){let n=On(e.cell.inflight,Date.now());e.cell.inflight=n.state,n.expired.forEach(r=>{j(e,r.inflightKey,"cancel"),x(e,r,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-timeout"},runId:"",testName:r.testName,workflowName:r.workflowName})})}function x(e,n,r){n.jobIds.forEach(t=>{Qn(e,t,r)})}function Qn(e,n,r){let t=e.jobs.get(n);t!=null&&(Bn(()=>t.connection.sendNotification(pn,{event:r,jobId:n})),r.kind==="test-outcome"&&(pt(t,r.outcome.kind),t.passed+t.failed+t.notRun>=t.total&&(Bn(()=>t.connection.sendNotification(gn,{failed:t.failed,jobId:n,notRun:t.notRun,passed:t.passed})),e.jobs.delete(n))))}function Bn(e){Promise.resolve().then(e).catch(n=>{g.warn({err:n},"ipc notification failed")})}function pt(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 gt(e,n){[...e.jobs.entries()].filter(([,r])=>r.connection===n).forEach(([r])=>{Jn(e,r)})}function ft(e,n){let r=ue(e.cell.inflight,n);e.cell.inflight=r.state;let t=r.entry;if(t==null)return null;j(e,t.inflightKey,"keep");let o=e.cancellations.get(t.inflightKey);return o==null?null:{headed:t.headed,token:o.token,finished:(i,s)=>{let a=F(e,t);ge(e,t.inflightKey,"keep"),x(e,a,{kind:"test-outcome",outcome:s,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},started:()=>{x(e,F(e,t),{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}}}async function yt(e){await e.selections.reduce((n,r)=>n.then(()=>mt(e,r)),Promise.resolve())}async function mt(e,n){let{ctx:r,headed:t,jobId:o,lockfileHashValue:i,targetsByClaimKey:s,token:a}=e;if(a.isCancellationRequested)return;let l=V(n),p=s.get(l);if(p==null){Qn(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 c=An(r.cell.inflight,{deadlineAt:Date.now()+Hn,identity:{headed:t,lockfileHash:i,testSlug:n.testSlug,workflowSlug:n.workflowSlug},jobId:o,runId:ot(),testName:n.testName,workflowName:n.workflowName});if(r.cell.inflight=c.state,c.kind==="joined")return;let d=c.entry;r.cancellations.set(d.inflightKey,new Wn),r.timers.set(d.inflightKey,setTimeout(()=>{ct(r)},Hn));let f=r.executor(),m=await Rt({ctx:r,entry:d,executor:f,lockfileHashValue:i,target:p});if(m!=null){let R=F(r,d);ge(r,d.inflightKey,"cancel"),x(r,R,{kind:"test-outcome",outcome:m,runId:"",testName:n.testName,workflowName:n.workflowName});return}f==="cloud"&&ht(r,d)}function F(e,n){return e.cell.inflight.get(n.inflightKey)??n}function Rt({ctx:e,entry:n,executor:r,lockfileHashValue:t,target:o}){return In({config:e.config,executor:r,lockfileHash:t,runId:n.runId,target:o})}function ht(e,n){let r=ue(e.cell.inflight,n.runId);e.cell.inflight=r.state;let t=r.entry;if(t==null)return;j(e,t.inflightKey,"keep");let o=e.cancellations.get(t.inflightKey);o!=null&&qn({config:e.config,runId:t.runId,signal:lt(o.token),onComplete:i=>{let s=F(e,t);ge(e,t.inflightKey,"keep"),x(e,s,{kind:"test-outcome",outcome:i,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},onProgress:i=>{Vn({ctx:e,runId:t.runId,signal:i})},onStarted:()=>{x(e,F(e,t),{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}})}import{graphql as b}from"gql.tada";import{gzipSync as vt}from"zlib";import{appendFileSync as Et,existsSync as G,readFileSync as Xn,writeFileSync as Gn}from"fs";import P from"path";import{graphql as fe}from"gql.tada";function z(e){return[e.kind,e.target,e.value].filter(n=>n.length>0).join(" ")}function zn(e,n){return{kind:"finding",payload:St(e),source:"verifier",step:n.step,stepIndex:n.stepIndex,timeNanos:n.timeNanos}}var kt={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"};function St(e){switch(e.kind){case"unrunnable":return{kind:"unrunnable",reason:kt[e.reason],unmet:e.unmet==null?null:He(e.unmet)};case"impossible-action":return{action:Le(e.step.action),kind:"impossibleAction",subject:wt(e.step.action)};case"lift-visibility":return{declaredIndex:e.declaredIndex,kind:"liftVisibility",subject:te(e.locator),visibleIndex:e.visibleIndex}}}function wt(e){return e.locator!=null?te(e.locator):e.url==null?"":Ae(e.url)}function Yn(e){return C(e.event).length>0}function X({config:e,fixturesDir:n,headed:r}){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:q,headed:r,secret:e.webhookSecret}}async function ye(e){let n=Y(e);await me({config:e.config,ownerToken:null,records:n,runId:e.runId})}function Y({debugDir:e,events:n,recordingOptional:r,runId:t,stepSources:o}){let i=Re(n),s=Ut(n,i),a=Mt(e,t);if(a==null&&!r)throw new Error("recording-missing");let l=i.map((c,d)=>jt({origin:a==null?Tt(i):a.origin,record:c,rrwebEvents:a==null?[]:a.events,sourceTest:o?.[d]??null,stateBindings:d===0?s:{}})),p=i.flatMap(c=>c.event.findings.map(d=>zn(d,{step:z(L(c.event.source,c.event.index)),stepIndex:c.event.index,timeNanos:Zn(c)})));return xt({debugDir:e,events:[...l,...p],runId:t}),i}function xt({debugDir:e,events:n,runId:r}){if(n.length===0)return;let t=P.join(e,r,"behavior.jsonl");if(!G(t))return;let o=n.map(i=>JSON.stringify(i)).join(`
|
|
179
|
-
`);Et(t,`${o}
|
|
180
|
-
`)}function Zn(e){return String(BigInt(Math.max(0,Math.round(e.event.endMs)))*1000000n)}async function me({config:e,ownerToken:n,records:r,runId:t}){let o=r.filter(a=>Yn(a)).length,i=r.length-o,s=r.reduce((a,l)=>a+Math.max(0,l.event.endMs-l.event.startMs),0);await u({config:e,document:qt,variables:{items:[{duration:s,failCount:o,firstFailedStepTitle:Pt(r),ownerToken:n,passCount:i,runId:t,status:o>0?"failed":"passed"}]}})}function Pt(e){let n=e.filter(r=>Yn(r)).toSorted((r,t)=>r.event.index-t.event.index).at(0);return n==null?null:z(L(n.event.source,n.event.index))}function Re(e){return e.flatMap(n=>n.kind==="step"?[{event:n}]:[])}async function er(e,n){await u({config:e,document:Nt,variables:{runIds:[n]}})}async function bt({config:e,debugDir:n,runId:r}){let t=P.join(n,r),o=P.join(t,"behavior.jsonl");if(G(P.join(t,T)))return;if(!G(o)){g.warn({runId:r},"behavior upload skipped: behavior.jsonl missing on disk");return}await[0,1e3,3e3].reduce((s,a)=>s.then(async l=>l?!0:(await new Promise(p=>setTimeout(p,a)),It({behaviorPath:o,config:e,runDir:t,runId:r}))),Promise.resolve(!1))}async function It({behaviorPath:e,config:n,runDir:r,runId:t}){try{let o=await u({config:n,document:Dt,variables:{runId:t}}),i=await fetch(o.debugArtifactUploadUrl,{body:vt(Xn(e)),headers:{"content-type":At},method:"PUT"});return i.ok?(await er(n,t),Gn(P.join(r,T),""),!0):(g.warn({runId:t,status:i.status},"behavior upload PUT failed"),!1)}catch(o){return Ct(o)?(g.warn({runId:t},"behavior upload refused by server; run unknown \u2014 not retrying"),Gn(P.join(r,T),""),!0):(g.warn({error:o,runId:t},"behavior upload failed"),!1)}}function Ct(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 At="application/x-ndjson";function Tt(e){return e.reduce((n,r)=>Math.min(n,r.event.startMs),e[0]?.event.startMs??0)}function Mt(e,n){let r=P.join(e,n,"behavior.jsonl");if(!G(r))return null;let t=Oe(Xn(r,"utf8")).flatMap(i=>i.kind==="rrweb"?[i.event]:[]),o=t[0];return o==null?null:{events:t,origin:o.timestamp}}var Ot=3,$t=0;function Ft({endMs:e,rrwebEvents:n,startMs:r}){let t=n.find(o=>o.type===Ot&&o.data?.source===$t&&o.timestamp>=r&&o.timestamp<=e);return t==null?r:t.timestamp}function jt({origin:e,record:n,rrwebEvents:r,sourceTest:t,stateBindings:o}){let{event:i}=n,s=L(i.source,i.index),a=Ft({endMs:i.endMs,rrwebEvents:r,startMs:i.startMs});return{duration:Math.max(0,i.endMs-i.startMs),executedBranches:[...i.executedBranches],kind:"step",nodeType:s.kind,pageUrl:i.url,recordingEndMs:Math.max(0,i.endMs-e),recordingStartMs:Math.max(0,a-e),source:"verifier",sourceTest:t,stateBindings:o,stateRows:[],stateSingletons:i.state.singletons.map(l=>({changed:l.changed,generated:!1,name:l.name,value:l.value==null?null:String(l.value)})),stepIndex:i.index,timeNanos:Zn(n),title:z(s)}}function Ut(e,n){let r=e.find(t=>t.kind==="state-setup");if(r?.kind!=="state-setup"&&n.length>0)throw new TypeError("state-setup-event-missing");return e.reduce((t,o)=>o.kind==="step"?{...t,...o.stateBindings}:t,r?.kind==="state-setup"?r.results:{})}var Dt=fe(`
|
|
181
|
-
mutation DebugArtifactUploadUrl($runId: String!) {
|
|
182
|
-
debugArtifactUploadUrl(runId: $runId)
|
|
183
|
-
}
|
|
184
|
-
`),qt=fe(`
|
|
185
|
-
mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
|
|
186
|
-
completeRunsBatch(items: $items) {
|
|
187
|
-
id
|
|
188
|
-
status
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
`),Nt=fe(`
|
|
192
|
-
mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
|
|
193
|
-
markRunArtifactsUploadedBatch(runIds: $runIds)
|
|
194
|
-
}
|
|
195
|
-
`);function Lt(e){if(e.kind!=="clean"&&e.kind!=="coverage-gap"&&e.kind!=="flaky"&&e.kind!=="finding"||(e.kind==="finding"||e.kind==="coverage-gap")&&e.runId==null)return;let{trail:n}=e;return{baseLabel:n.baseLabel,baseState:n.baseState,durationMs:n.durationMs,outcome:e.kind,runId:e.kind==="finding"||e.kind==="coverage-gap"?e.runId:void 0,signature:n.signature,steps:n.steps}}async function he({baseState:e,category:n,config:r,debugDir:t,devSessionId:o,events:i,lockfileHash:s,reproJson:a,runId:l,signature:p,spec:c,stepSources:d,summary:f,workflowSlug:m}){await u({config:r,document:Jt,variables:{devSessionId:o??null,lockfileHash:s,projectId:r.projectId,reproJson:a,runId:l,spec:c??null,workflowSlug:m??null}}),await ye({config:r,debugDir:t,events:i,recordingOptional:!0,runId:l,stepSources:d}),await u({config:r,document:Qt,variables:{baseState:e,category:n,projectId:r.projectId,reproRunId:l,signature:p,summary:f}})}async function Z(e,n,r){return(await u({config:e,document:zt,variables:{lockfileHash:r,projectId:e.projectId,signature:n}})).exploreFindingExists}async function Ht({attempts:e,config:n,devSessionId:r,findings:t,trail:o}){await u({config:n,document:Wt,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==="coverage-gap"?"finding":o.outcome,steps:o.steps.map(i=>({test:i.test,text:i.text}))}}})}async function _t({config:e,count:n,devSessionId:r}){return(await u({config:e,document:Vt,variables:{count:n,devSessionId:r}})).leaseExploreOrdinals}async function Bt(e,n){return(await u({config:e,document:Kt,variables:{devSessionId:n}}).catch(t=>(g.warn({error:t},"reportExploreUnhealthy failed"),null)))?.reportExploreUnhealthy??!1}var Wt=b(`
|
|
196
|
-
mutation RecordExplorationProgress(
|
|
197
|
-
$devSessionId: String!
|
|
198
|
-
$attempts: Int!
|
|
199
|
-
$findings: Int!
|
|
200
|
-
$trail: ExploreTrailInput
|
|
201
|
-
) {
|
|
202
|
-
recordExplorationProgress(
|
|
203
|
-
devSessionId: $devSessionId
|
|
204
|
-
attempts: $attempts
|
|
205
|
-
findings: $findings
|
|
206
|
-
trail: $trail
|
|
207
|
-
)
|
|
208
|
-
}
|
|
209
|
-
`),Vt=b(`
|
|
210
|
-
mutation LeaseExploreOrdinals($count: Int!, $devSessionId: String!) {
|
|
211
|
-
leaseExploreOrdinals(count: $count, devSessionId: $devSessionId)
|
|
212
|
-
}
|
|
213
|
-
`),Kt=b(`
|
|
214
|
-
mutation ReportExploreUnhealthy($devSessionId: String!) {
|
|
215
|
-
reportExploreUnhealthy(devSessionId: $devSessionId)
|
|
216
|
-
}
|
|
217
|
-
`),Jt=b(`
|
|
218
|
-
mutation CreateExploreRun(
|
|
219
|
-
$projectId: String!
|
|
220
|
-
$runId: String!
|
|
221
|
-
$devSessionId: String
|
|
222
|
-
$lockfileHash: String!
|
|
223
|
-
$spec: String
|
|
224
|
-
$reproJson: String
|
|
225
|
-
$workflowSlug: String
|
|
226
|
-
) {
|
|
227
|
-
createExploreRun(
|
|
228
|
-
projectId: $projectId
|
|
229
|
-
runId: $runId
|
|
230
|
-
devSessionId: $devSessionId
|
|
231
|
-
lockfileHash: $lockfileHash
|
|
232
|
-
spec: $spec
|
|
233
|
-
reproJson: $reproJson
|
|
234
|
-
workflowSlug: $workflowSlug
|
|
235
|
-
) {
|
|
236
|
-
id
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
`),Qt=b(`
|
|
240
|
-
mutation SubmitExploreFinding(
|
|
241
|
-
$projectId: String!
|
|
242
|
-
$signature: String!
|
|
243
|
-
$summary: String!
|
|
244
|
-
$baseState: String!
|
|
245
|
-
$category: ExploreFindingCategory!
|
|
246
|
-
$reproRunId: String!
|
|
247
|
-
) {
|
|
248
|
-
submitExploreFinding(
|
|
249
|
-
projectId: $projectId
|
|
250
|
-
signature: $signature
|
|
251
|
-
summary: $summary
|
|
252
|
-
baseState: $baseState
|
|
253
|
-
category: $category
|
|
254
|
-
reproRunId: $reproRunId
|
|
255
|
-
) {
|
|
256
|
-
id
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
`),Da=b(`
|
|
260
|
-
mutation SetExploreFindingStatus(
|
|
261
|
-
$projectId: String!
|
|
262
|
-
$signature: String!
|
|
263
|
-
$status: ExploreFindingStatus!
|
|
264
|
-
) {
|
|
265
|
-
setExploreFindingStatus(projectId: $projectId, signature: $signature, status: $status)
|
|
266
|
-
}
|
|
267
|
-
`),zt=b(`
|
|
268
|
-
query ExploreFindingExists($projectId: String!, $signature: String!, $lockfileHash: String!) {
|
|
269
|
-
exploreFindingExists(projectId: $projectId, signature: $signature, lockfileHash: $lockfileHash)
|
|
270
|
-
}
|
|
271
|
-
`);import wo from"path";import{graphql as vo}from"gql.tada";import{graphql as ee}from"gql.tada";import{clearInterval as nr,setInterval as Gt}from"timers";function ke(e){switch(e.kind){case"app-not-ready":return"appNotReady";case"engine-network":return"backendUnreachable";case"engine-unreachable":return"engineUnreachable";case"engine-http":return Ne(e)?"engineSignatureRejected":null;case"engine-decode":case"state-mismatch":case"page-read":case"driver-launch":case"actor-resolution":case"state-effect-reference":case"run-failed":case"model-preparation":case"workflow-plan":case"action-failed":case"check-failed":case"aborted":return null}}async function Se({config:e,ownerToken:n,reason:r,runId:t}){await u({config:e,document:eo,variables:{ownerToken:n,reason:r,runId:t}}).catch(o=>{g.error(o,"failRun submission failed")})}async function rr({config:e,runId:n}){return u({config:e,document:Zt,variables:{runId:n}}).then(()=>!0).catch(r=>(g.warn({error:r,runId:n},"run heartbeat submission failed; retrying on the next tick"),!1))}var Xt=5;function Yt({config:e,intervalMs:n,runId:r}){let t=!0,o=!1,i=0,s=async()=>{if(!t||o)return;o=!0;let l=await rr({config:e,runId:r});o=!1,i=l?0:i+1,i>=Xt&&(g.warn({consecutiveFailures:i,runId:r},"run heartbeat stopped after repeated submission failures"),t=!1,nr(a))},a=Gt(()=>{s()},n);return()=>{t=!1,nr(a)}}async function we({cause:e,config:n,ownerToken:r,reason:t,runId:o}){await u({config:n,document:no,variables:{cause:e,ownerToken:r,reason:t,runId:o}}).catch(i=>{g.error(i,"markRunUnready submission failed")})}var Ba=ee(`
|
|
272
|
-
mutation ReleaseRun($runId: String!, $ownerToken: String, $retryAttempt: Int, $retryLimit: Int) {
|
|
273
|
-
releaseRun(
|
|
274
|
-
runId: $runId
|
|
275
|
-
ownerToken: $ownerToken
|
|
276
|
-
retryAttempt: $retryAttempt
|
|
277
|
-
retryLimit: $retryLimit
|
|
278
|
-
)
|
|
279
|
-
}
|
|
280
|
-
`),Zt=ee(`
|
|
281
|
-
mutation HeartbeatRun($runId: String!) {
|
|
282
|
-
heartbeatRun(runId: $runId)
|
|
283
|
-
}
|
|
284
|
-
`),eo=ee(`
|
|
285
|
-
mutation FailRun($runId: String!, $reason: String!, $ownerToken: String) {
|
|
286
|
-
failRun(runId: $runId, reason: $reason, ownerToken: $ownerToken)
|
|
287
|
-
}
|
|
288
|
-
`),no=ee(`
|
|
289
|
-
mutation MarkRunUnready(
|
|
290
|
-
$runId: String!
|
|
291
|
-
$cause: RunUnreadyCause!
|
|
292
|
-
$ownerToken: String
|
|
293
|
-
$reason: String!
|
|
294
|
-
) {
|
|
295
|
-
markRunUnready(runId: $runId, cause: $cause, ownerToken: $ownerToken, reason: $reason)
|
|
296
|
-
}
|
|
297
|
-
`);import{graphql as ro}from"gql.tada";var to=10;function ve({config:e,onTransition:n,ownerToken:r,runId:t}){let o=0,i=!0,s=0,a=Promise.resolve(),l=[];return{report:c=>{let d=Date.now(),f=new Date(d).toISOString();l=[...l,{atMs:d,signal:c}],n?.(c),a=a.then(async()=>{if(!i)return;let m=o+1,R=await oo({config:e,ownerToken:r,runId:t,sequence:m,signal:c,startedAt:f}).catch(v=>(s+=1,s===1&&g.warn({error:v,runId:t},"run progress update failed; retrying on the next signal"),"failed"));R==="accepted"&&(s=0,o=m),R==="rejected"&&(s=0),R==="failed"&&s>=to&&(g.warn({consecutiveFailures:s,runId:t},"run progress reporting stopped after repeated submission failures"),i=!1)})},flush:async()=>a,history:()=>l}}async function oo({config:e,ownerToken:n,runId:r,sequence:t,signal:o,startedAt:i}){let a=(await u({config:e,document:So,variables:{input:io({sequence:t,signal:o,startedAt:i}),ownerToken:n,runId:r}})).reportRunProgress;if(a==null)throw new TypeError("run-progress-response-missing");return a.__typename==="MutationReportRunProgressSuccess"?"accepted":(g.warn({reason:a.reason,runId:r},"run progress update was rejected by the server"),a.reason==="stale"?"accepted":"rejected")}function io({sequence:e,signal:n,startedAt:r}){return{action:mo(n.activity),activeSources:ao(n.activity),appPath:so(n.activity),capacity:lo(n.activity),deadlineAt:n.deadlineAt,expectations:ho(n.activity),finishStage:uo(n.activity),phase:n.activity.kind,retry:n.retry,sequence:e,setupStage:co(n.activity),startedAt:r,stepCount:po(n.activity),stepIndex:go(n.activity),stepStage:fo(n.activity),waitReason:yo(n.activity)}}function ao(e){return e.kind==="settingUpState"?[...e.activeSources]:null}function so(e){return e.kind==="executingStep"&&e.stage.kind==="waitingForApp"?e.stage.path:null}function lo(e){return e.kind==="waitingForRunner"?e.capacity:null}function uo(e){return e.kind==="finishing"?e.stage:null}function co(e){return e.kind==="settingUpState"?e.stage:null}function po(e){return e.kind==="executingStep"?e.stepCount:null}function go(e){return e.kind==="executingStep"?e.stepIndex:null}function fo(e){return e.kind==="executingStep"?e.stage.kind:null}function yo(e){return e.kind==="waitingForRunner"?e.reason:null}function mo(e){return e.kind!=="executingStep"||e.stage.kind!=="performingAction"?null:Ro(e.stage.action)}function Ro(e){switch(e.kind){case"goto":return{kind:e.kind,path:e.path};case"fill":case"clear":case"click":case"dblclick":case"select":case"check":case"uncheck":case"hover":case"upload":return{kind:e.kind,target:e.target};case"press":return{key:e.key,kind:e.kind,target:e.target};case"drag":return{kind:e.kind,source:e.source,target:e.target};case"actor":return{kind:e.kind}}}function ho(e){return e.kind!=="executingStep"||e.stage.kind!=="checkingExpectations"?null:e.stage.remaining.map(n=>ko(n))}function ko(e){return e.kind==="browser"?{id:e.id,kind:e.kind,negated:e.negated,target:e.subject}:{check:e.check,id:e.id,kind:e.kind,negated:e.negated,target:e.target}}var So=ro(`
|
|
298
|
-
mutation ReportRunProgress(
|
|
299
|
-
$input: ReportRunProgressInput!
|
|
300
|
-
$ownerToken: String!
|
|
301
|
-
$runId: String!
|
|
302
|
-
) {
|
|
303
|
-
reportRunProgress(input: $input, ownerToken: $ownerToken, runId: $runId) {
|
|
304
|
-
__typename
|
|
305
|
-
... on MutationReportRunProgressSuccess {
|
|
306
|
-
data
|
|
307
|
-
}
|
|
308
|
-
... on RunProgressRejectedError {
|
|
309
|
-
reason
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
`);async function Eo({config:e,cwd:n,errorSettle:r,fixturesDir:t,headed:o,lockfile:i,onProgress:s,runId:a,session:l,signal:p,test:c}){let d=await Po(e,a);if(d==null)return{outcome:{kind:"dispatch-failed",reason:"already-claimed",runId:a},ownerToken:null,persisted:Promise.resolve(),progress:null};let f=ve({config:e,onTransition:s,ownerToken:d,runId:a}),m=wo.join(n,".ripplo","debug"),R=[];return(await l.runOnce({capture:!0,lockfile:i,onPhase:void 0,onProgress:f.report,options:X({config:e,fixturesDir:t,headed:o}),params:void 0,runId:a,sequence:void 0,startingStateSeed:a,test:c,onEvent:S=>{R.push(S)}},p)).match(async S=>{let E=Re(R),A=E.flatMap(Rr=>C(Rr.event)),h=xo(A);if(h!=null)return Y({config:e,debugDir:m,events:R,recordingOptional:!0,runId:a,stepSources:void 0}),await f.flush(),await tr({config:e,error:h,errorSettle:r,ownerToken:d,runId:a}),{outcome:{error:h,kind:"error",runId:a},ownerToken:d,persisted:Promise.resolve(),progress:f};f.report({activity:{kind:"finishing",stage:"savingResult"},deadlineAt:null,retry:null}),await f.flush(),await me({config:e,ownerToken:d,records:E,runId:a}),Y({config:e,debugDir:m,events:R,recordingOptional:!0,runId:a,stepSources:void 0});let mr=Promise.resolve();return{outcome:A.length>0?{contradictions:A,kind:"findings",runId:a}:{kind:"pass",runId:a},ownerToken:d,persisted:mr,progress:f}},async S=>(await f.flush(),await tr({config:e,error:S,errorSettle:r,ownerToken:d,runId:a}),{outcome:{error:S,kind:"error",runId:a},ownerToken:d,persisted:Promise.resolve(),progress:f}))}async function tr({config:e,error:n,errorSettle:r,ownerToken:t,runId:o}){if(r==="defer")return;let i=ke(n);if(i!=null){await we({cause:i,config:e,ownerToken:t,reason:I(n),runId:o});return}await Se({config:e,ownerToken:t,reason:I(n),runId:o})}function xo(e){let n=e.find(r=>r.kind==="stepError"&&De(r.record.error));return n!=null&&n.kind==="stepError"?n.record.error:void 0}async function Po(e,n){return((await u({config:e,document:bo,variables:{runIds:[n]}})).startRunsBatch??[]).find(o=>o.id===n)?.ownerToken??null}var bo=vo(`
|
|
314
|
-
mutation StartRunsBatch($runIds: [String!]!) {
|
|
315
|
-
startRunsBatch(runIds: $runIds) {
|
|
316
|
-
id
|
|
317
|
-
ownerToken
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
`);import{createHash as Io}from"crypto";import{appendFileSync as Co,existsSync as Ao,mkdirSync as To,statSync as Mo}from"fs";import or from"path";function Oo({debugDir:e,history:n,runId:r}){if(n.length===0)return;let t=or.join(e,r);To(t,{recursive:!0});let i=[...$o(n),...Fo({history:n,runId:r})].map(l=>JSON.stringify(l)).join(`
|
|
321
|
-
`),s=or.join(t,"behavior.jsonl"),a=Ao(s)&&Mo(s).size>0?"":`${Me()}
|
|
322
|
-
`;Co(s,`${a}${i}
|
|
323
|
-
`)}function $o(e){return e.map(n=>({kind:"progress",signal:n.signal,source:"runtime",timeNanos:xe(n.atMs)}))}function Fo({history:e,runId:n}){let r=e[0];if(r==null)return[];let t=Date.now(),o=Ee(`${n}:progress-trace`,32),i=Ee(`${n}:progress-root`,16),s={attributes:{"ripplo.run":n},durationMs:Math.max(0,t-r.atMs),kind:"span",name:"ripplo.run.progress",source:"server",spanId:i,spanKind:"internal",status:{code:"unset"},timeNanos:xe(r.atMs),traceId:o},a=e.map((l,p)=>{let c=e[p+1];return{attributes:jo({runId:n,signal:l.signal}),durationMs:Math.max(0,(c?.atMs??t)-l.atMs),kind:"span",name:`ripplo.run.progress.${ir(l.signal)}`,parentSpanId:i,source:"server",spanId:Ee(`${n}:progress:${String(p)}`,16),spanKind:"internal",status:{code:"unset"},timeNanos:xe(l.atMs),traceId:o}});return[s,...a]}function jo({runId:e,signal:n}){let r={"ripplo.progress.phase":n.activity.kind,"ripplo.progress.stage":ir(n),"ripplo.run":e};return n.retry==null?r:{...r,"ripplo.progress.retry_attempt":String(n.retry.attempt),"ripplo.progress.retry_limit":n.retry.limit==null?"unbounded":String(n.retry.limit)}}function ir(e){let n=e.activity;switch(n.kind){case"waitingForRunner":return n.reason;case"settingUpState":return n.stage;case"executingStep":return n.stage.kind;case"finishing":return n.stage;case"signingIn":case"startingBrowser":case"uploadingReplay":return n.kind}}function xe(e){return String(BigInt(Math.round(e))*1000000n)}function Ee(e,n){return Io("sha256").update(e).digest("hex").slice(0,n)}import{randomUUID as Uo}from"crypto";async function Do({assign:e,config:n,currentModelHash:r,currentTargetGeneration:t,debugDir:o,devSessionId:i,fixturesDir:s,headed:a,lockfile:l,report:p,session:c,signal:d}){let f=Be(l),m=Qe(l,{sweep:!1}),R=Je({assignment:e,corpus:f,currentModelHash:r,currentTargetGeneration:t,envelopeRefs:new Set(m.map(h=>h.name))});if(R.kind==="rejected")return{error:{reason:R.reason,source:"assignment-rejected"},kind:"error"};let v=m.find(h=>h.name===e.envelopeRef)?.test;if(v==null)throw new Error("validated exploration envelope is missing");let S=Jo(f,e.steps),E=await Ge({baseState:{name:e.envelopeRef,test:v},corpus:f,lockfile:l,options:X({config:n,fixturesDir:s,headed:a}),seenSignature:p?h=>Z(n,h,e.modelHash):void 0,session:c,startingStateSeed:e.assignmentSeed.value,stepRuns:e.steps,runIdFor:h=>`explore-${Uo()}-${String(h)}`},d),A=p?await Bo({baseStateTest:v,config:n,debugDir:o,devSessionId:i,lockfileHash:e.modelHash,outcome:E,reproJson:Ho(e),stepSources:_o(S)}):!1;return Lo(E,S.length),Qo(E,A,qo(S,e,v.intent,E))}function qo(e,n,r,t){if(t.kind==="error"||t.kind==="aborted")return;let o=t.timing.confirm;return{baseLabel:r,baseState:n.envelopeRef,durationMs:Math.round(ne(t.timing.detect)+(o==null?0:ne(o))),signature:t.kind==="coverage-gap"||t.kind==="finding"||t.kind==="seen"?t.signature:void 0,steps:No(e.slice(0,t.ranCount))}}function No(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(t=>({test:r,text:t}))})}function ne(e){return e.engineMs+e.worldMs+e.browserMs+e.driveMs+e.teardownMs}function Lo(e,n){if(e.kind==="error"){g.info({detail:I(e.error),kind:e.kind,reason:e.error.kind,steps:n},"explore trail");return}if(e.kind==="aborted"||e.kind==="seen"){g.info({kind:e.kind,steps:n},"explore trail");return}let r=e.timing.detect,t=e.timing.confirm;g.info({browserMs:r.browserMs,confirmMs:t==null?void 0:ne(t),detectMs:ne(r),driveMs:r.driveMs,engineMs:r.engineMs,kind:e.kind,steps:n,teardownMs:r.teardownMs,worldMs:r.worldMs},"explore trail")}function Ho(e){let n={envelopeRef:e.envelopeRef,seed:e.assignmentSeed.value,steps:e.steps,version:Ke};return JSON.stringify(n)}function _o(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(()=>r)})}async function Bo({baseStateTest:e,config:n,debugDir:r,devSessionId:t,lockfileHash:o,outcome:i,reproJson:s,stepSources:a}){return i.kind!=="finding"&&i.kind!=="coverage-gap"||i.captureEvents.length===0?!1:await Z(n,i.signature,o)?(g.info({devSessionId:t,signature:i.signature},"explore finding already reported, skipping duplicate"),!1):he({baseState:i.baseState,category:Wo(i),config:n,debugDir:r,devSessionId:t,events:i.captureEvents,lockfileHash:o,reproJson:s,runId:i.runId,signature:i.signature,spec:Ko(e,i.captureEvents),stepSources:a,summary:Vo(i.captureEvents,i.title),workflowSlug:i.sourceTest?.split("/")[0]}).then(()=>!0,l=>(g.warn({error:l},"explore finding report failed"),!1))}function Wo(e){if(e.kind==="coverage-gap")return"workflowCoverageGap";let n=e.verifierLayer;if(n==="data-rule")return"dataRule";if(n==="model-drift")throw new Error("unrunnable planner output cannot become an application finding");return n}function Vo(e,n){let r=e.flatMap(t=>t.kind==="step"?C(t):[]).at(0);if(r!=null)return We(r);if(n!=null)return n;throw new Error("explore finding has no findings to summarize")}function Ko(e,n){let r=n.flatMap(o=>o.kind==="step"?[o.source]:[]),t={actor:e.actor,intent:e.intent,name:e.name,params:e.params,startingState:e.startingState,steps:r,stub:!1,tests:[],viewports:[e.viewport]};return JSON.stringify(t)}function Jo(e,n){return n.flatMap(r=>{let t=e.find(o=>o.id===r.transitionId);return t==null?[]:[{actions:[...t.nav,...t.steps].map(o=>_e(o.action)),label:`${t.test}#${String(t.index)}`}]})}function Qo(e,n,r){if(e.kind==="aborted")return{kind:"aborted",ranCount:e.ranCount};if(e.kind==="error")return{error:{category:zo(e.error.kind),detail:I(e.error),kind:e.error.kind,source:"runtime"},kind:"error"};if(r==null)throw new Error("trail summary missing for completed trail");return e.kind==="finding"||e.kind==="coverage-gap"?{kind:e.kind,runId:n?e.runId:void 0,trail:r}:{kind:e.kind,trail:r}}function zo(e){return e==="driver-launch"?"driver":qe(e)?"infra":"trail"}import Go from"fs";import Xo from"path";async function Ts(e){let n=Xo.join(e,".ripplo","index.ts");if(!Go.existsSync(n))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await Ue(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:tn(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:be().match(t=>({appUrl:t.appUrl,engineUrl:t.engineUrl,errors:[],valid:!0,warnings:[]}),t=>({appUrl:void 0,engineUrl:void 0,errors:[{message:fn(t),path:""}],valid:!1,warnings:[]}))}async function Ms(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 Os({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}}import{createMessageConnection as ar,IPCMessageReader as sr,IPCMessageWriter as lr,NotificationType as dr,NotificationType0 as ur,RequestType as cr,RequestType0 as Yo}from"vscode-jsonrpc/node";import{z as y}from"zod";var Ns=y.object({headed:y.boolean(),runId:y.string().min(1),testRef:y.string().min(1)}),Ls=y.object({lockfileJson:y.string().optional(),unavailable:y.string().optional()}),Hs=y.object({runId:y.string().min(1),span:Te}),_s=y.object({runId:y.string().min(1),signal:N}),Bs=y.object({outcome:ln,serverNotified:y.boolean()}),Ws=new ur("worker/ready"),Vs=new cr("worker/run"),Ks=new Yo("worker/lockfile"),Js=y.object({assign:oe,currentTargetGeneration:oe.shape.targetGeneration,devSessionId:y.string().nullable()}),Qs=new cr("worker/exploreTrail"),zs=new dr("worker/span"),Gs=new dr("worker/progress"),Xs=new ur("worker/shutdown");function Ys(e){let n=ar(new sr(e),new lr(e));return n.listen(),n}function Zs(){let e=ar(new sr(process),new lr(process));return e.listen(),e}import Zo from"path";import{randomUUID as ei}from"crypto";async function ll({cwd:e,onReady:n,signal:r,step:t,target:o}){let i=H(e).match(d=>({config:d}),d=>({failure:d}));if("failure"in i)return{failure:i.failure,kind:"config-failed"};let s=i.config,a=await je(e);if(a.result.isErr())return{error:a.result.error,kind:"compile-failed"};let l=await Ze(e,a.result.value),p=ni(l,o);return p.kind!=="ok"?p:(await ze({lockfile:l,onReady:n,options:ri(s),runId:`teleport-${ei()}`,sequence:p.sequence,stopAfterStep:t,test:p.test},r)).match(d=>({kind:"done",result:d}),d=>({error:d,kind:"run-failed"}))}function ni(e,n){if(n.kind==="explore"){let t=Xe(e,n.repro);return t.kind==="unplannable"?{kind:"unplannable"}:{kind:"ok",sequence:t.sequence,test:t.baseTest}}let r=O(e).find(t=>t.ref===n.ref);return r==null?{kind:"no-test",ref:n.ref}:{kind:"ok",sequence:void 0,test:r.test}}function ri(e){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:Zo.join(e.cwd,$e),generate:q,headed:!0,secret:e.webhookSecret}}import{graphql as li}from"gql.tada";import{err as re,ok as fr}from"neverthrow";import ti,{AbortError as oi}from"p-retry";import{graphql as pr}from"gql.tada";var ii=pr(`
|
|
324
|
-
query AwaitDevSession($projectId: String!, $cwd: String!) {
|
|
325
|
-
project(id: $projectId) {
|
|
326
|
-
devSession(cwd: $cwd) {
|
|
327
|
-
id
|
|
328
|
-
executor
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
`);async function gr(e){return ti(async()=>{let t=(await u({config:e,document:ii,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;if(t!=null)return{executor:t.executor,id:t.id,kind:"active"};throw D(e.cwd)?new Error("starting"):new oi("missing")},{factor:1,maxTimeout:400,minTimeout:400,retries:25}).catch(()=>D(e.cwd)?{kind:"starting"}:{kind:"missing"})}var ai=pr(`
|
|
333
|
-
query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
|
|
334
|
-
activeDevSessions(projectId: $projectId) {
|
|
335
|
-
id
|
|
336
|
-
cwd
|
|
337
|
-
branch
|
|
338
|
-
}
|
|
339
|
-
project(id: $projectId) {
|
|
340
|
-
id
|
|
341
|
-
devSession(cwd: $cwd) {
|
|
342
|
-
id
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
`);function ml(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo daemon is live (hooks auto-paused while git is mid-merge/rebase/cherry-pick \u2014 they resume when the operation ends)":"\u2713 Dev session: ripplo daemon is live for this directory";case"starting":return"! Dev session: the daemon is running locally but hasn't registered with the server yet. Wait a few seconds and re-run `npx ripplo doctor`. If it persists, check the daemon output for auth or network errors.";case"missing":{let n="\u2717 Dev session: no daemon running for this directory. Start `npx ripplo daemon` as a background process (separate from your app's dev server). Without it, `npx ripplo run` refuses to dispatch and scope/coverage hooks won't arm.";return e.elsewhere.length===0?n:[n," A daemon is running for a different directory:",...si(e.elsewhere)].join(`
|
|
347
|
-
`)}}}async function Rl(e){let n=D(e),r=Ce(e),t=H(e).unwrapOr(void 0);if(t==null)return{elsewhere:[],gitMidOperation:r,status:n?"starting":"missing",type:"dev-session"};let o=await u({config:t,document:ai,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);return o?.project?.devSession!=null?{elsewhere:[],gitMidOperation:r,status:"active",type:"dev-session"}:{elsewhere:(o?.activeDevSessions??[]).filter(a=>a.cwd!==t.cwd).map(a=>({branch:a.branch,cwd:a.cwd})),gitMidOperation:r,status:n?"starting":"missing",type:"dev-session"}}function si(e){return e.map(n=>{let r=n.branch==null?"":` (${n.branch})`;return` - ${n.cwd}${r}`})}var di=li(`
|
|
348
|
-
mutation SetDevSessionExecutor($devSessionId: String!, $executor: RunExecutor!) {
|
|
349
|
-
setDevSessionExecutor(devSessionId: $devSessionId, executor: $executor) {
|
|
350
|
-
__typename
|
|
351
|
-
... on DevSession {
|
|
352
|
-
id
|
|
353
|
-
executor
|
|
354
|
-
}
|
|
355
|
-
... on DevSessionEndedError {
|
|
356
|
-
message
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
`);async function El(e){return(await yr(e)).map(r=>r.executor)}async function xl(e,n){let r=await yr(e);if(r.isErr())return re(r.error);let o=(await u({config:e,document:di,variables:{devSessionId:r.value.id,executor:n}})).setDevSessionExecutor;return o==null?re({kind:"empty-response"}):o.__typename!=="DevSession"?re({kind:"session-ended"}):fr(o.executor)}async function yr(e){let n=await gr(e);return n.kind==="active"?fr({executor:n.executor,id:n.id}):re({kind:n.kind==="starting"?"starting":"no-session"})}var Il=15e3,Cl=3e4,Al=2,Tl=12;function Ml(e,n){let r=ui(e,n);if(!e.enabled||!e.executorLocal)return{abortIds:Pe(n),health:{kind:"off"},launchCount:0};if(ci(n))return{abortIds:Pe(n),health:{kind:"paused",reason:"interactive-runs"},launchCount:0};if(n.lockfile.kind==="blocked")return{abortIds:Pe(n),health:{kind:"blocked",reason:n.lockfile.reason},launchCount:0};if(n.backoffActive||n.lockfile.kind==="loading")return{abortIds:r,health:pi(n),launchCount:0};let t=Math.min(e.workers,n.poolSize),o=n.trails.length-r.length;return{abortIds:r,health:{kind:"on"},launchCount:Math.max(0,t-o)}}function ui(e,n){let r=Ve(e.maxTrailLength);return n.trails.filter(t=>t.ageMs>=r).map(t=>t.id)}function Pe(e){return e.trails.map(n=>n.id)}function ci(e){return e.headedActive||e.interactiveActive>0||e.interactiveQueued>0}function pi(e){return e.coverageWaiting?{kind:"waiting"}:{kind:"paused",reason:e.lockfile.kind==="loading"?"loading":"cooldown"}}export{gr as a,ml as b,Rl as c,Ts as d,Ms as e,Os as f,Ns as g,Hs as h,_s as i,Bs as j,Ws as k,Vs as l,Ks as m,Js as n,Qs as o,zs as p,Gs as q,Xs as r,Ys as s,Zs as t,yi as u,mi as v,ie as w,Ri as x,Hi as y,lt as z,ha as A,ye as B,bt as C,Se as D,Yt as E,Eo as F,Oo as G,Lt as H,Ht as I,_t as J,Bt as K,Do as L,ll as M,El as N,xl as O,Il as P,Cl as Q,Al as R,Tl as S,Ml as T};
|