ripplo 0.7.46 → 0.7.48
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-5BVPW4SP.js +279 -0
- package/dist/chunk-CUMINXFQ.js +135 -0
- package/dist/{chunk-LISHXK5I.js → chunk-KSMKOJFZ.js} +1 -1
- package/dist/{chunk-HX7AAG7Q.js → chunk-PATBTEVW.js} +1 -1
- package/dist/{daemon-TGDWNGEY.js → daemon-22CT3QG5.js} +1 -1
- package/dist/{daemon-BCDXDMIC.js → daemon-CVEOZQ4B.js} +1 -1
- package/dist/index.js +191 -190
- package/dist/status-K5YQY3ZG.js +2 -0
- package/package.json +4 -4
- package/dist/chunk-54ZXA3RS.js +0 -279
- package/dist/chunk-S3KN37I7.js +0 -135
- package/dist/status-C4N7AK45.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripplo",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.48",
|
|
4
4
|
"description": "CLI for Ripplo — AI-powered end-to-end testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://ripplo.ai",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"tsup": "^8.5.1",
|
|
62
62
|
"vitest": "^4.1.4",
|
|
63
63
|
"@ripplo/core": "^0.0.0",
|
|
64
|
+
"@ripplo/run-report": "0.0.0",
|
|
64
65
|
"@ripplo/eslint-config": "0.0.0",
|
|
65
|
-
"@ripplo/spec": "^0.0.0",
|
|
66
66
|
"@ripplo/graphql": "^0.0.0",
|
|
67
|
+
"@ripplo/runtime": "^0.0.0",
|
|
67
68
|
"@ripplo/rrweb-bundle": "0.0.0",
|
|
68
|
-
"@ripplo/
|
|
69
|
-
"@ripplo/runtime": "^0.0.0"
|
|
69
|
+
"@ripplo/spec": "^0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"dev": "tsx watch src/index.ts",
|
package/dist/chunk-54ZXA3RS.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{c as Oe}from"./chunk-4J4T7534.js";import{A as en,a as P,b as C,c as je,d as Me,e as $e,f as T,g as Fe,i as A,o as Je,p as Qe,s as ze,w as Ge,x as Ye,y as Xe,z as Ze}from"./chunk-LISHXK5I.js";import{b as Ee,d as c,e as f,h as Ie,i as Pe}from"./chunk-4K4VY5OR.js";import{A as qe,B as _e,E as He,S as We,T as Ve,W as Be,X as Ke,a as v,b as Ce,i as Te,j as Ae,k as m,l as De,m as R,n as E,o as Ue,s as Le,u as Ne,v as j}from"./chunk-S3KN37I7.js";import rn from"fs";import D from"path";import{config as lt}from"dotenv";import{z as F}from"zod";import{err as dt,ok as on}from"neverthrow";import $ from"fs";import ee from"path";import{err as X,ok as nn}from"neverthrow";import{z as M}from"zod";var ot=ee.join(".ripplo","project.json"),Z=[".env",".env.local"],it=M.object({envFiles:M.array(M.string().min(1)).optional(),projectId:M.string().min(1)});function tn(e){return ee.join(e,ot)}function ne(e){let n=tn(e);return $.existsSync(n)?at(n).andThen(t=>{let r=it.safeParse(t);return r.success?nn({envFiles:r.data.envFiles??Z,projectId:r.data.projectId}):X({issues:r.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`),kind:"project-file-invalid",path:n})}):X({kind:"project-file-missing",path:n})}function te(e){return ne(e).match(n=>n,()=>{})}function at(e){try{return nn(JSON.parse($.readFileSync(e,"utf8")))}catch(n){return X({issues:[n instanceof Error?n.message:String(n)],kind:"project-file-invalid",path:e})}}function ii({cwd:e,envFiles:n,projectId:t}){let r=tn(e);$.mkdirSync(ee.dirname(r),{recursive:!0});let o={projectId:t};n!=null&&!st(n)&&(o.envFiles=[...n]),$.writeFileSync(r,JSON.stringify(o,null,2)+`
|
|
3
|
-
`)}function st(e){return e.length!==Z.length?!1:e.every((n,t)=>n===Z[t])}function fi(e){let t=te(e)?.envFiles??[".env",".env.local"],r=D.join(e,".ripplo");t.forEach(o=>{let i=D.resolve(r,o);rn.existsSync(i)&<({override:!0,path:i,quiet:!0})}),O=void 0}var ct=F.object({RIPPLO_APP_URL:F.url(),RIPPLO_ENGINE_URL:F.url(),RIPPLO_WEBHOOK_SECRET:F.string().min(1)}),O;function U(){return O!=null?on(O):pt().map(e=>(O=e,e))}function ut(e){let t=te(e)?.envFiles??[],r=D.join(e,".ripplo");return t.map(o=>D.resolve(r,o)).filter(o=>!rn.existsSync(o))}function pt(){let e=ct.safeParse(process.env);if(!e.success)return dt({issues:e.error.issues.map(t=>`${t.path.join(".")}: ${t.message}`),kind:"env-invalid",missingEnvFiles:ut(process.cwd())});let n=e.data;return on({appUrl:n.RIPPLO_APP_URL,engineUrl:n.RIPPLO_ENGINE_URL,webhookSecret:n.RIPPLO_WEBHOOK_SECRET})}var L=class extends Error{failure;constructor(n){super(n.kind),this.name="CliError",this.failure=n}};function Si(e){return e instanceof L?re(e.failure):e instanceof Error?e.message:String(e)}function re(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).",Fe("setup")].join(`
|
|
4
|
-
`);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(`
|
|
5
|
-
`);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(`
|
|
6
|
-
`);case"env-invalid":return ft(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(`
|
|
7
|
-
`);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(`
|
|
8
|
-
`);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(`
|
|
9
|
-
`);case"compilation-failed":return A(e.error)}}function ft(e){let n=e.missingEnvFiles.length===0?[]:["Declared env files not found:",...e.missingEnvFiles.map(t=>` ${t}`),"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(t=>` ${t}`),"Add the missing values to the env files declared in .ripplo/project.json.",...n].join(`
|
|
10
|
-
`)}import{err as gt,ok as Rt}from"neverthrow";import{z as oe}from"zod";var yt="https://ripplo.ai";function sn(){return dn().RIPPLO_SERVER_URL}function ln(){return dn().RIPPLO_PROJECT_ID}var mt=oe.object({RIPPLO_PROJECT_ID:oe.string().min(1).optional(),RIPPLO_SERVER_URL:oe.string().min(1).default(yt)}),an;function dn(){return an??=mt.parse(process.env),an}import cn from"fs";import ie from"path";function un(e){let n=cn.realpathSync(e),t=n,r=ie.dirname(t);for(;r!==t;){if(cn.existsSync(ie.join(t,".git")))return t;t=r,r=ie.dirname(t)}return n}function N(e){return ne(e).andThen(n=>U().andThen(t=>{let r=sn(),o=Pe(r);return o==null?gt({kind:"not-authenticated"}):Rt({appUrl:t.appUrl,cwd:un(e),engineUrl:t.engineUrl,projectId:ln()??n.projectId,ripploServerUrl:r,token:o,tunnelAuth:void 0,webhookSecret:t.webhookSecret})}))}import ht from"p-queue";var St=4,kt={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},q=new ht({concurrency:St}),S={headedActive:0,interactiveActive:0,interactiveQueued:0},pn={current:null};function Fi({headed:e,task:n,workClass:t}){let r=kt[t];return t==="p3-explore"?q.add(n,{priority:r}):(S.interactiveQueued+=1,_(),q.add(()=>wt({headed:e,task:n}),{priority:r}))}function Oi(e){!Number.isFinite(e)||e<1||(q.concurrency=Math.floor(e),_())}function ae(){return{active:S.interactiveActive,headedActive:S.headedActive,poolSize:q.concurrency,queued:S.interactiveQueued}}function Di(e){pn.current=e}async function wt({headed:e,task:n}){S.interactiveQueued-=1,S.interactiveActive+=1,S.headedActive+=e?1:0,_();try{return await n()}finally{S.interactiveActive-=1,S.headedActive-=e?1:0,_()}}function _(){pn.current?.()}import se from"fs";import le from"path";function fn(e){try{let n=vt(e);if(n==null)return;let t=le.join(n,"HEAD"),r=se.readFileSync(t,"utf8").trim(),o="ref: refs/heads/";return r.startsWith(o)?r.slice(o.length):r.length===0?void 0:r.slice(0,7)}catch{return}}function vt(e){let n=le.join(e,".git");if(se.statSync(n).isDirectory())return n;let r=se.readFileSync(n,"utf8").trim(),o="gitdir:";if(!r.startsWith(o))return;let i=r.slice(o.length).trim();if(i.length!==0)return le.resolve(e,i)}import xt from"crypto";import{readFile as yn}from"fs/promises";import mn from"path";import{graphql as de}from"gql.tada";import{err as bt,ok as Et}from"neverthrow";var It=de(`
|
|
11
|
-
mutation SyncDevSession(
|
|
12
|
-
$projectId: String!
|
|
13
|
-
$cwd: String!
|
|
14
|
-
$branch: String
|
|
15
|
-
$lockfileContent: String
|
|
16
|
-
$fixtures: [SyncDevFixtureInput!]
|
|
17
|
-
$preconditions: [SyncDevPreconditionInput!]!
|
|
18
|
-
$singletons: [SyncDevSingletonInput!]
|
|
19
|
-
$workflows: [SyncDevWorkflowInput!]!
|
|
20
|
-
) {
|
|
21
|
-
syncDevSession(
|
|
22
|
-
projectId: $projectId
|
|
23
|
-
cwd: $cwd
|
|
24
|
-
branch: $branch
|
|
25
|
-
lockfileContent: $lockfileContent
|
|
26
|
-
fixtures: $fixtures
|
|
27
|
-
preconditions: $preconditions
|
|
28
|
-
singletons: $singletons
|
|
29
|
-
workflows: $workflows
|
|
30
|
-
) {
|
|
31
|
-
id
|
|
32
|
-
hooksPaused
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`);async function Yi(e,n){let t=await T(e);if(t.isErr())return bt({error:t.error,kind:"compilation-failed"});let r=await x({config:n,cwd:e,lockfile:t.value});return Et({devSessionId:r.devSessionId,lockfile:t.value})}async function x(e){let n=Te(e.lockfile);return Tt({config:e.config,cwd:e.cwd,fixtures:e.lockfile.fixtures,payload:n})}var Pt=de(`
|
|
36
|
-
query DevSessionSyncState($projectId: String!, $cwd: String!) {
|
|
37
|
-
project(id: $projectId) {
|
|
38
|
-
devSession(cwd: $cwd) {
|
|
39
|
-
id
|
|
40
|
-
hooksPaused
|
|
41
|
-
lockfileHash
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`),Ct=de(`
|
|
46
|
-
mutation AnnounceDevSessionActive($projectId: String!, $cwd: String!) {
|
|
47
|
-
announceDevSessionActive(projectId: $projectId, cwd: $cwd)
|
|
48
|
-
}
|
|
49
|
-
`);async function Xi(e){let n=await ce(e.cwd);if(n!=null){let r=(await c({config:e.config,document:Pt,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null))?.project?.devSession;if(r!=null&&r.lockfileHash===n)return await c({config:e.config,document:Ct,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null),{devSessionId:r.id,hooksPaused:r.hooksPaused}}return x(e)}async function ce(e){let n=await gn(e);return n==null?null:xt.createHash("sha256").update(n).digest("hex")}async function Tt({config:e,cwd:n,fixtures:t,payload:r}){let o=fn(n),i=await gn(n),s=await At(n,t),a=await c({config:e,document:It,variables:{branch:o??null,cwd:n,fixtures:s,lockfileContent:i,preconditions:r.preconditions.map(l=>({depends:[...l.depends],description:l.description,name:l.name,returns:[...l.returns]})),projectId:e.projectId,singletons:r.singletons.map(l=>({defaultValue:l.defaultValue,description:l.description,name:l.name,type:l.type})),workflows:r.workflows.map(l=>({expectedOutcome:l.expectedOutcome,name:l.name,preconditions:[...l.preconditions],requiresKeys:l.requiresKeys.map(u=>({namespace:u.namespace,preconditionName:u.preconditionName})),slug:l.slug,sourcePath:l.sourcePath,spec:JSON.stringify(l.spec)}))}});if(a.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:a.syncDevSession.id,hooksPaused:a.syncDevSession.hooksPaused}}async function At(e,n){let t=Object.entries(n);return Promise.all(t.map(async([r,o])=>({contentBase64:(await yn(mn.join(e,C,r))).toString("base64"),sha256:o.sha256})))}async function gn(e){try{return await yn(mn.join(e,je),"utf8")}catch{return null}}import{randomUUID as ir}from"crypto";import{createId as ar}from"@paralleldrive/cuid2";import{CancellationTokenSource as sr,ResponseError as lr}from"vscode-jsonrpc/node";import{graphql as jt}from"gql.tada";var Mt=jt(`
|
|
50
|
-
mutation DaemonCreateRun(
|
|
51
|
-
$id: String
|
|
52
|
-
$workflowId: String!
|
|
53
|
-
$testId: String
|
|
54
|
-
$clientVersion: String
|
|
55
|
-
$executor: RunExecutor
|
|
56
|
-
$target: RunTarget
|
|
57
|
-
$lockfileHash: String
|
|
58
|
-
) {
|
|
59
|
-
createRun(
|
|
60
|
-
id: $id
|
|
61
|
-
workflowId: $workflowId
|
|
62
|
-
testId: $testId
|
|
63
|
-
executor: $executor
|
|
64
|
-
target: $target
|
|
65
|
-
clientVersion: $clientVersion
|
|
66
|
-
lockfileHash: $lockfileHash
|
|
67
|
-
) {
|
|
68
|
-
__typename
|
|
69
|
-
... on MutationCreateRunSuccess {
|
|
70
|
-
data {
|
|
71
|
-
id
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
... on LimitExceededError {
|
|
75
|
-
code
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`);async function Rn(e){try{let t=(await c({config:e.config,document:Mt,variables:$t(e)})).createRun;return t==null?H({detail:"create-run-null",type:"generic"}):t.__typename==="MutationCreateRunSuccess"?null:t.__typename==="LimitExceededError"?H({code:t.code,type:"limit"}):H({detail:t.__typename,type:"generic"})}catch(n){return Ft(n)}}function $t({executor:e,lockfileHash:n,runId:t,target:r}){return{clientVersion:P(),executor:e,id:t,lockfileHash:n,target:e==="cloud"?"tunnel":void 0,testId:r.testId,workflowId:r.workflowId}}function H(e){return{kind:"dispatch-error",reason:e}}function Ft(e){return e instanceof Ee?{detail:e.message,kind:"infra-error"}:H({detail:e instanceof Error?e.message:String(e),type:"generic"})}import{graphql as Ot}from"gql.tada";async function hn(e,n){let r=(await c({config:e,document:Dt,variables:{cwd:n,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(r.flatMap(o=>o.tests.map(i=>[`${o.slug}/${i.slug}`,{testId:i.id,workflowId:o.id}])))}var Dt=Ot(`
|
|
80
|
-
query DaemonWorkflows($projectId: String!, $cwd: String!) {
|
|
81
|
-
project(id: $projectId) {
|
|
82
|
-
id
|
|
83
|
-
devSession(cwd: $cwd) {
|
|
84
|
-
id
|
|
85
|
-
workflows {
|
|
86
|
-
id
|
|
87
|
-
slug
|
|
88
|
-
tests {
|
|
89
|
-
id
|
|
90
|
-
slug
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
`);import{CancellationTokenSource as Ut}from"vscode-jsonrpc/node";function ue(e){return`${e.workflowSlug}/${e.testSlug}`}function Sn(e){let{headed:n,inflight:t,jobId:r,lockfileHashValue:o,onExpire:i,runId:s,selection:a,timeoutMs:l}=e,u=ue(a),p=`${u}@${o}@${String(n)}`,d=t.get(p);if(d!=null)return d.jobIds.add(r),null;let y={cancellation:new Ut,claimed:!1,claimKey:u,headed:n,inflightKey:p,jobIds:new Set([r]),runId:s,testName:a.testName,timer:null,workflowName:a.workflowName};return y.timer=setTimeout(()=>{W(t,y),i(y)},l),t.set(p,y),y}function W(e,n){n.timer!=null&&(clearTimeout(n.timer),n.timer=null),e.delete(n.inflightKey)}function pe(e,n){let t=[...e.values()].find(r=>r.runId===n&&!r.claimed);return t==null?null:(t.claimed=!0,t.timer!=null&&(clearTimeout(t.timer),t.timer=null),t)}function kn(e,n){[...e.values()].filter(t=>t.jobIds.has(n)).forEach(t=>{t.jobIds.delete(n),t.jobIds.size===0&&(W(e,t),t.cancellation.cancel())})}import{err as fe,ok as wn}from"neverthrow";function xn({all:e,ids:n,lockfile:t}){if(e&&n.length>0)return fe({kind:"conflicting-flags"});if(e)return wn(t.workflows.filter(i=>!i.stub).flatMap(i=>i.tests.map(s=>R(s))));if(n.length===0)return fe({kind:"nothing-selected"});let r=n.map(i=>({id:i,refs:Nt(t,i)})),o=r.filter(i=>i.refs.length===0).map(i=>i.id);return o.length>0?fe({kind:"unknown-ids",known:Lt(t),unknown:o}):wn([...new Set(r.flatMap(i=>i.refs))])}function bn(e,n){let t=new Map(E(e).map(r=>[r.ref,{testName:r.test.name,testSlug:r.test.slug,workflowName:r.workflow.name,workflowSlug:m(r.workflow.name)}]));return n.map(r=>{let o=t.get(r);if(o==null)throw new Error(`selectionsFor: ref not in lockfile: ${r}`);return o})}function Lt(e){return e.workflows.map(n=>m(n.name))}function Nt(e,n){let t=e.workflows.find(r=>r.name===n||m(r.name)===m(n));return t!=null?t.tests.map(r=>R(r)):E(e).filter(r=>r.ref===n||vn(r.ref)===vn(n)).map(r=>r.ref)}function vn(e){let n=e.lastIndexOf("/");return n===-1?m(e):`${m(e.slice(0,n))}/${m(e.slice(n+1))}`}import{err as ge,ok as Tn}from"neverthrow";import{graphql as An}from"gql.tada";import{graphql as Jt}from"gql.tada";import{execFileSync as qt}from"child_process";var _t=256*1024*1024;function V(e,n){return qt("git",[...e],{cwd:n,encoding:"utf8",maxBuffer:_t,stdio:["ignore","pipe","pipe"]})}import Bt from"fs";import Ht from"fs";import ye from"path";var Wt=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function En(e){let n=Vt(e);return n==null?!1:Wt.some(t=>Ht.existsSync(ye.join(n,t)))}function Vt(e){try{let n=V(["rev-parse","--git-dir"],e).trim();return n.length===0?null:ye.isAbsolute(n)?n:ye.resolve(e,n)}catch{return null}}function Kt(e){return Ie(e,"hooks-paused")}function In(e){return Bt.existsSync(Kt(e))||En(e)?!1:Oe(e)}var Qt=Jt(`
|
|
97
|
-
mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
98
|
-
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
99
|
-
__typename
|
|
100
|
-
... on MutationAddDirtyTestsToScopeSuccess {
|
|
101
|
-
data {
|
|
102
|
-
id
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
`);async function ja({cwd:e,lockfile:n}){if(!In(e))return{addedSlugs:[]};let t=me(e);if(t.length===0)return{addedSlugs:[]};let r=new Set(t),o=n.workflows.filter(l=>l.sourcePath!=null&&r.has(l.sourcePath)).map(l=>m(l.name));if(o.length===0)return{addedSlugs:[]};let i=N(e).unwrapOr(void 0);return i==null?{addedSlugs:[]}:await x({config:i,cwd:e,lockfile:n}).catch(l=>(f.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await zt({cfg:i,slugs:o})?o:[]}}async function zt({cfg:e,slugs:n}){let r=(await c({config:e,document:Qt,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...n]}}).catch(o=>(f.warn("auto-scope failed: %s",o instanceof Error?o.message:String(o)),null)))?.addDirtyTestsToScope;return r?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:r.data.length>0}var Pn=".ripplo/workflows/",Cn=" -> ";function me(e){let n;try{n=V(["status","--porcelain","-uall","--",".ripplo/workflows"],e)}catch{return[]}return n.split(`
|
|
108
|
-
`).map(t=>t.slice(3).trim()).map(t=>t.includes(Cn)?t.split(Cn)[1]:t).filter(t=>t!=null).filter(t=>t.startsWith(Pn)&&t.endsWith(".ts")).map(t=>t.slice(Pn.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}async function jn({config:e,cwd:n,lockfile:t}){await Yt({config:e,cwd:n,lockfile:t});let r=await Zt(e);if(r.isErr())return ge(r.error);let o=new Map(t.workflows.filter(s=>!s.stub).map(s=>[m(s.name),s])),i=[...new Set(r.value)].flatMap(s=>{let a=o.get(s);return a==null?[]:a.tests.map(l=>R(l))});return i.length===0?ge({kind:"scope-empty"}):Tn(i)}var Gt=An(`
|
|
109
|
-
mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
110
|
-
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
111
|
-
__typename
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
`);async function Yt({config:e,cwd:n,lockfile:t}){let r=new Set(me(n)),o=t.workflows.filter(i=>i.sourcePath!=null&&r.has(i.sourcePath)).map(i=>m(i.name));o.length!==0&&await c({config:e,document:Gt,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:o}}).catch(i=>{f.warn({err:i},"auto-scope of dirty tests failed")})}var Xt=An(`
|
|
115
|
-
query ScopeSelection($projectId: String!, $cwd: String!) {
|
|
116
|
-
project(id: $projectId) {
|
|
117
|
-
id
|
|
118
|
-
devSession(cwd: $cwd) {
|
|
119
|
-
id
|
|
120
|
-
scopeItems {
|
|
121
|
-
id
|
|
122
|
-
workflow {
|
|
123
|
-
id
|
|
124
|
-
slug
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
`);async function Zt(e){try{let t=(await c({config:e,document:Xt,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return Tn(t.flatMap(r=>r.workflow==null?[]:[r.workflow.slug]))}catch(n){return ge({detail:n instanceof Error?n.message:String(n),kind:"scope-fetch-failed"})}}import{graphql as er}from"gql.tada";var nr=2e3,tr=er(`
|
|
131
|
-
query DaemonCloudRunStatus($runId: String!) {
|
|
132
|
-
run(id: $runId) {
|
|
133
|
-
status
|
|
134
|
-
failureReason
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`);function $n({config:e,onComplete:n,onStarted:t,runId:r,signal:o}){let i=!1,s,a=!1,l=async()=>{if(i||o.aborted)return;let u=await rr(e,r).catch(()=>"unknown");if(!(i||o.aborted)){if(!a&&(u==="running"||Mn(u))&&(a=!0,t()),Mn(u)){i=!0,n(or(u));return}s=setTimeout(()=>{l()},nr)}};return l(),{stop:()=>{i=!0,s!=null&&clearTimeout(s)}}}async function rr(e,n){let r=(await c({config:e,document:tr,variables:{runId:n}})).run?.status;return r??"unknown"}function Mn(e){return e==="passed"||e==="failed"||e==="warning"||e==="cancelled"||e==="unready"}function or(e){return e==="passed"?{kind:"pass"}:e==="failed"?{detail:"failed",kind:"error"}:e==="warning"?{findingLines:[],kind:"findings"}:e==="cancelled"?{detail:"cancelled",kind:"error"}:e==="unready"?{detail:"unready",kind:"error"}:{detail:"unknown",kind:"error"}}var dr=12e4,cr=-32099,Re=new Set,Fn=new Map;function os(e){Re.add(e)}function ur(e){let n=new AbortController;return e.isCancellationRequested?(n.abort(),n.signal):(e.onCancellationRequested(()=>{n.abort()}),n.signal)}function is(e){let n={...e,inflight:new Map,jobs:new Map};return{claim:t=>gr(n,t),handleConnection:t=>{pr(n,t)},idle:()=>Un(n)}}function pr(e,n){let t=Je(n);t.onRequest(Ge,(r,o)=>fr({connection:t,ctx:e,params:r,token:o})),t.onRequest(Ye,()=>{let r=ae();return{active:r.active,queued:r.queued,sseHealth:e.sseHealth(),version:P(),...e.explorationStatus()}}),t.onRequest(Xe,()=>{let r=Un(e);return r&&e.onShutdownRequest(),r}),t.onClose(()=>{yr(e,t)}),t.onError(r=>{f.warn({err:r},"ipc connection error")}),n.on("error",r=>{f.warn({err:r},"ipc socket error")}),t.listen()}function Un(e){let n=ae();return e.jobs.size===0&&n.active===0&&n.queued===0}async function fr({connection:e,ctx:n,params:t,token:r}){let o=Qe.safeParse(t);if(!o.success)throw On({code:"bad-message"});await n.ready;let i=await hr({config:n.config,cwd:n.cwd,message:o.data});if(i.kind==="error")throw On(i.error);let s=ir(),a=new sr;return r.onCancellationRequested(()=>{Ln(n,s)}),n.jobs.set(s,{cancellation:a,connection:e,failed:0,notRun:0,passed:0,total:i.selections.length}),Pr({ctx:n,headed:o.data.headed,jobId:s,lockfileHashValue:i.lockfileHashValue,selections:i.selections,targetsByClaimKey:i.targetsByClaimKey,token:a.token}).catch(l=>{f.error({err:l},"ipc dispatch failed")}),{jobId:s,total:i.selections.length}}function On(e){return new lr(cr,e.code,e)}function Ln(e,n){let t=e.jobs.get(n);t!=null&&(t.cancellation.cancel(),e.jobs.delete(n),kn(e.inflight,n))}function yr(e,n){[...e.jobs.entries()].filter(([,t])=>t.connection===n).forEach(([t])=>{Ln(e,t)})}function Nn(e,n,t){let r=e.jobs.get(n);r!=null&&(Dn(()=>r.connection.sendNotification(Ze,{event:t,jobId:n})),t.kind==="test-outcome"&&(mr(r,t.outcome.kind),r.passed+r.failed+r.notRun>=r.total&&(Dn(()=>r.connection.sendNotification(en,{failed:r.failed,jobId:n,notRun:r.notRun,passed:r.passed})),e.jobs.delete(n))))}function Dn(e){Promise.resolve().then(e).catch(n=>{f.warn({err:n},"ipc notification failed")})}function mr(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 b(e,n,t){n.jobIds.forEach(r=>{Nn(e,r,t)})}function gr(e,n){let t=pe(e.inflight,n);return t==null?null:{headed:t.headed,token:t.cancellation.token,finished:(r,o)=>{e.inflight.delete(t.inflightKey),b(e,t,{kind:"test-outcome",outcome:o,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},started:()=>{b(e,t,{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}}}function Rr(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 hr({config:e,cwd:n,message:t}){return(await Me(n)).match(o=>Sr({config:e,cwd:n,lockfile:o,message:t}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...Rr(o)]},kind:"error"}))}async function Sr({config:e,cwd:n,lockfile:t,message:r}){let o=await vr(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await ce(n);if(i==null)return{error:{code:"sync-failed",detail:"lockfile-missing"},kind:"error"};if(!Re.has(i)){let a=await xr({config:e,cwd:n,lockfile:t});if(a!=null)return{error:{code:"sync-failed",detail:a},kind:"error"};Re.add(i)}return(await br({config:e,cwd:n,lockfile:t,message:r})).match(async a=>({kind:"ready",lockfileHashValue:i,selections:bn(t,a),targetsByClaimKey:await kr({config:e,cwd:n,hash:i})}),a=>Promise.resolve({error:a,kind:"error"}))}async function kr({config:e,cwd:n,hash:t}){let r=Fn.get(t);if(r!=null)return r;let o=await hn(e,n);return Fn.set(t,o),o}var wr=2e3;async function vr(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(wr)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function xr(e){try{return await x(e),null}catch(n){return n instanceof Error?n.message:String(n)}}async function br({config:e,cwd:n,lockfile:t,message:r}){return!r.all&&r.tests.length===0?(await jn({config:e,cwd:n,lockfile:t})).mapErr(Er):xn({all:r.all,ids:r.tests,lockfile:t}).mapErr(Ir)}function Er(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function Ir(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 Pr(e){await e.selections.reduce((n,t)=>n.then(()=>Cr(e,t)),Promise.resolve())}async function Cr(e,n){let{ctx:t,headed:r,jobId:o,lockfileHashValue:i,targetsByClaimKey:s,token:a}=e;if(a.isCancellationRequested)return;let l=ue(n),u=s.get(l);if(u==null){Nn(t,o,{kind:"test-outcome",outcome:{kind:"dispatch-error",reason:{detail:"test-not-found",type:"generic"}},runId:"",testName:n.testName,workflowName:n.workflowName});return}let p=Sn({headed:r,inflight:t.inflight,jobId:o,lockfileHashValue:i,runId:ar(),selection:n,timeoutMs:dr,onExpire:g=>{b(t,g,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-timeout"},runId:"",testName:g.testName,workflowName:g.workflowName})}});if(p==null)return;let d=t.executor(),y=await Tr({ctx:t,executor:d,lockfileHashValue:i,run:p,target:u});if(y!=null){W(t.inflight,p),b(t,p,{kind:"test-outcome",outcome:y,runId:"",testName:n.testName,workflowName:n.workflowName});return}d==="cloud"&&Ar(t,p)}function Tr({ctx:e,executor:n,lockfileHashValue:t,run:r,target:o}){return Rn({config:e.config,executor:n,lockfileHash:t,runId:r.runId,target:o})}function Ar(e,n){let t=pe(e.inflight,n.runId);t!=null&&$n({config:e.config,runId:t.runId,signal:ur(t.cancellation.token),onComplete:r=>{e.inflight.delete(t.inflightKey),b(e,t,{kind:"test-outcome",outcome:r,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},onStarted:()=>{b(e,t,{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}})}import jr from"fs";import Mr from"path";async function fs(e){let n=Mr.join(e,".ripplo","index.ts");if(!jr.existsSync(n))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let t=await T(e);return t.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:A(t.error),path:".ripplo/"}],valid:!1,warnings:[]}:U().match(r=>({appUrl:r.appUrl,engineUrl:r.engineUrl,errors:[],valid:!0,warnings:[]}),r=>({appUrl:void 0,engineUrl:void 0,errors:[{message:re(r),path:""}],valid:!1,warnings:[]}))}async function ys(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 ms({appUrl:e,engineUrl:n}){let t=n.startsWith("http://")||n.startsWith("https://")?n:`${e}${n}`;try{return(await fetch(`${t}/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 qn,IPCMessageReader as _n,IPCMessageWriter as Hn,NotificationType as $r,NotificationType0 as Wn,RequestType as Vn,RequestType0 as Fr}from"vscode-jsonrpc/node";import{z as h}from"zod";var ws=h.object({headed:h.boolean(),runId:h.string().min(1),testRef:h.string().min(1)}),vs=h.object({lockfileJson:h.string().optional(),unavailable:h.string().optional()}),xs=h.object({runId:h.string().min(1),span:Ce}),bs=h.object({outcome:ze,serverNotified:h.boolean()}),Es=new Wn("worker/ready"),Is=new Vn("worker/run"),Ps=new Fr("worker/lockfile"),Cs=new Vn("worker/exploreTrail"),Ts=new $r("worker/span"),As=new Wn("worker/shutdown");function js(e){let n=qn(new _n(e),new Hn(e));return n.listen(),n}function Ms(){let e=qn(new _n(process),new Hn(process));return e.listen(),e}import{graphql as k}from"gql.tada";import{gzip as Vr}from"zlib";import{promisify as Br}from"util";import{existsSync as Qn,readFileSync as zn}from"fs";import Gn from"path";import{graphql as I}from"gql.tada";function Bn(e){return[e.kind,e.target,e.value].filter(n=>n.length>0).join(" ")}var Or={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"},Dr={"data-rule":"dataRule",fact:"fact",step:"step"},Ur={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 Kn(e){return e.kind==="consistency"?{consistency:{mismatch:qr(e.mismatch),pending:e.pending}}:e.kind==="pending-check"?{pendingCheck:{budget:e.budget,source:Dr[e.source.kind],...Lr(e.source)}}:e.kind==="unrunnable"?{unrunnable:{reason:Or[e.reason]}}:e.kind==="lift-visibility"?{liftVisibility:{subject:v(e.locator)}}:e.kind==="driver-error"?{driverError:{errorKind:Ur[e.error.kind],message:Wr(e.error)}}:{impossibleAction:{subject:Nr(e.step.action)}}}function Lr(e){return"check"in e?Jn(e.check,!1):{checkKind:void 0,expected:void 0,negated:void 0,subject:void 0}}function Jn(e,n){return e.kind==="not"?Jn(e.inner,!n):e.kind==="browser"?{checkKind:"browser",expected:e.value??void 0,negated:n,subject:De(e.key)}:e.kind==="value"||e.kind==="text"?{checkKind:e.kind,expected:e.value,negated:n,subject:v(e.locator)}:{checkKind:e.kind,expected:void 0,negated:n,subject:v(e.locator)}}function Nr(e){let n=e.locator==null?e.url??"":v(e.locator);return`${e.kind} ${n}`.trim()}function qr(e){return e.kind==="wrong-value"?{wrongValue:{entity:e.entity,field:e.field,key:e.key,snapshot:B(e.snapshot),sut:B(e.sut)}}:e.kind==="expected-change"?{expectedChange:{entity:e.entity,field:e.field,key:e.key,value:B(e.value)}}:e.kind==="scalar-mismatch"?_r(e):e.kind==="unexpected-row"?{unexpectedRow:{entity:e.entity,key:e.key}}:{missingRow:{entity:e.entity,key:e.key}}}function _r(e){let n=e.subject.kind==="element"?e.subject:void 0,t=e.subject.kind==="variable"?e.subject:void 0;return{scalarMismatch:{checkKind:n?.state,singleton:t?.name,snapshot:_e(e.want),subject:Hr(e,n),sut:B(e.sut)}}}function Hr(e,n){if(n!=null)return v(n.locator);if(e.subject.kind!=="variable")return qe(e.subject)}function B(e){return e==null?null:String(e)}function Wr(e){return"message"in e?e.message:"detail"in e?e.detail:null}function K({config:e,fixturesDir:n,headed:t}){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:j,headed:t,secret:e.webhookSecret,tunnelAuth:e.tunnelAuth}}async function Se(e){let n=await J(e);await ke(e.config,e.runId,n)}async function J({config:e,debugDir:n,events:t,recordingOptional:r,runId:o,stepSources:i}){let s=we(t),a=zr(n,o);if(a==null&&!r)throw new Error("recording-missing");return await Promise.all([ro({aliases:[...Xr(t),...Zr(s)],config:e,generated:eo(t),generatedSingletons:no(t),origin:a==null?Qr(s):a.origin,records:s,rrwebEvents:a==null?[]:a.events,runId:o,stepSources:i}),a==null?Promise.resolve():uo(e,o,a)]),s}async function ke(e,n,t){let r=t.filter(s=>s.findings.length>0).length,o=t.length-r,i=t.reduce((s,a)=>s+Math.max(0,a.endMs-a.startMs),0);await c({config:e,document:mo,variables:{items:[{duration:i,failCount:r,passCount:o,runId:n,status:r>0?"failed":"passed",summary:null,warnCount:0}]}})}function we(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 Yn(e,n){await c({config:e,document:go,variables:{runIds:[n]}})}async function Kr({config:e,debugDir:n,runId:t}){let r=Gn.join(n,t,"behavior.jsonl");if(Qn(r))try{let o=await c({config:e,document:po,variables:{runId:t}}),i=await fetch(o.debugArtifactUploadUrl,{body:zn(r),headers:{"content-type":Jr},method:"PUT"});if(!i.ok){f.warn({runId:t,status:i.status},"behavior upload PUT failed");return}await Yn(e,t)}catch(o){f.warn({error:o,runId:t},"behavior upload failed")}}var Jr="application/x-ndjson";function Qr(e){return e.reduce((n,t)=>Math.min(n,t.startMs),e[0]?.startMs??0)}function zr(e,n){let t=Gn.join(e,n,"behavior.jsonl");if(!Qn(t))return null;let r=zn(t,"utf8").split(`
|
|
138
|
-
`).filter(i=>i.length>0).map(i=>Gr(i)).flatMap(i=>Yr(i)?[i.event]:[]),o=r[0];return o==null?null:{events:r,origin:o.timestamp}}function Gr(e){return JSON.parse(e)}function Yr(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}function Xr(e){return e.flatMap(n=>n.kind==="world"?n.aliases:[])}function Zr(e){return e.flatMap(n=>{let t=to(n.source);return t.flatMap(r=>{let i=t.filter(a=>a.entity===r.entity).indexOf(r),s=n.state.rows.filter(a=>a.status==="created"&&a.entity===r.entity).at(i);return s==null?[]:[{alias:r.as,entity:r.entity,key:s.key}]})})}function eo(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generated.map(t=>Xn(t)):[]))}function Xn({entity:e,field:n,key:t}){return`${e} ${t} ${n}`}function no(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generatedSingletons:[]))}function to(e){return e==null?[]:e.expect.flatMap(n=>he(n))}function he(e){return e.kind==="state"&&e.assertion.kind==="created"?[{as:e.assertion.as,entity:e.entity}]:e.kind==="and"?e.predicates.flatMap(n=>he(n)):e.kind==="when"?e.branches.flatMap(n=>n.consequence.flatMap(t=>he(t))):[]}async function ro({aliases:e,config:n,generated:t,generatedSingletons:r,origin:o,records:i,rrwebEvents:s,runId:a,stepSources:l}){let u=i.map((p,d)=>so({aliases:e,generated:t,generatedSingletons:r,origin:o,record:p,rrwebEvents:s,sourceTest:l?.[d]??null}));await c({config:n,document:fo,variables:{items:[{runId:a,steps:u}]}})}var oo=3,io=0;function ao({endMs:e,rrwebEvents:n,startMs:t}){let r=n.find(o=>o.type===oo&&o.data?.source===io&&o.timestamp>=t&&o.timestamp<=e);return r==null?t:r.timestamp}function so({aliases:e,generated:n,generatedSingletons:t,origin:r,record:o,rrwebEvents:i,sourceTest:s}){let a=Ae(o.source,o.index),l=ao({endMs:o.endMs,rrwebEvents:i,startMs:o.startMs}),u=o.annotations.map(d=>({kind:d.kind,label:d.label,outcome:d.outcome,recordingStartMs:Math.max(0,(d.kind==="action"?l:d.atMs)-r),rrwebIds:[...d.rrwebIds],url:d.url,value:d.value??null})),p=o.annotations.find(d=>d.kind==="action")?.rrwebIds??[];return{annotations:u,detail:null,duration:Math.max(0,o.endMs-o.startMs),findings:o.findings.map(d=>Kn(d)),nodeType:a.kind,recordingEndMs:Math.max(0,o.endMs-r),recordingStartMs:Math.max(0,l-r),rrwebIds:[...p],snapshotTimestamp:Math.max(0,o.endMs-r),sourceTest:s,stateRows:o.state.rows.map(d=>lo({aliases:e,generated:n,row:d})),stateSingletons:o.state.singletons.map(d=>({changed:d.changed,generated:t.has(d.name),name:d.name,value:d.value==null?null:String(d.value)})),status:o.findings.length>0?"failed":"passed",stepIndex:o.index,title:Bn(a),url:o.url}}function lo({aliases:e,generated:n,row:t}){let r=e.find(o=>o.entity===t.entity&&o.key===t.key);return{entity:t.entity,fields:t.fields.map(o=>({changed:o.changed,field:o.field,generated:n.has(Xn({entity:t.entity,field:o.field,key:t.key})),value:o.value==null?null:String(o.value)})),key:t.key,label:r?.alias??t.key,status:t.status}}var co=Br(Vr);async function uo(e,n,t){let r=t.events.map(s=>JSON.stringify(s)).join(`
|
|
139
|
-
`),o=await co(Buffer.from(r,"utf8")),i=t.events.at(-1);await c({config:e,document:yo,variables:{input:{bodyBase64:o.toString("base64"),chunkIndex:0,endTimestamp:Math.max(0,(i?.timestamp??t.origin)-t.origin),eventCount:t.events.length,runId:n,startTimestamp:0}}})}var po=I(`
|
|
140
|
-
mutation DebugArtifactUploadUrl($runId: String!) {
|
|
141
|
-
debugArtifactUploadUrl(runId: $runId)
|
|
142
|
-
}
|
|
143
|
-
`),fo=I(`
|
|
144
|
-
mutation SubmitRunStepsBatch($items: [SubmitRunStepsItem!]!) {
|
|
145
|
-
submitRunStepsBatch(items: $items)
|
|
146
|
-
}
|
|
147
|
-
`),yo=I(`
|
|
148
|
-
mutation SubmitRunRecordingChunk($input: SubmitRunRecordingChunkInput!) {
|
|
149
|
-
submitRunRecordingChunk(input: $input)
|
|
150
|
-
}
|
|
151
|
-
`),mo=I(`
|
|
152
|
-
mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
|
|
153
|
-
completeRunsBatch(items: $items) {
|
|
154
|
-
id
|
|
155
|
-
status
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`),go=I(`
|
|
159
|
-
mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
|
|
160
|
-
markRunArtifactsUploadedBatch(runIds: $runIds)
|
|
161
|
-
}
|
|
162
|
-
`);function Ro(e){let n=e.trail;if(!(n==null||!ho(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 ho(e){return e==="clean"||e==="flaky"||e==="finding"}async function ve({baseState:e,branchName:n,category:t,commitSha:r,config:o,debugDir:i,devSessionId:s,events:a,lockfileHash:l,reproJson:u,runId:p,signature:d,spec:y,stepSources:g}){await c({config:o,document:Eo,variables:{branchName:n??null,commitSha:r??null,devSessionId:s??null,lockfileHash:l??null,projectId:o.projectId,reproJson:u,runId:p,spec:y??null}}),await Se({config:o,debugDir:i,events:a,recordingOptional:!0,runId:p,stepSources:g}),await c({config:o,document:Io,variables:{baseState:e,category:t,projectId:o.projectId,reproRunId:p,signature:d}})}async function Q(e,n,t){return(await c({config:e,document:Po,variables:{lockfileHash:t,projectId:e.projectId,signature:n}})).exploreFindingExists}async function So({attempts:e,config:n,devSessionId:t,findings:r,trail:o}){await c({config:n,document:xo,variables:{attempts:e,devSessionId:t,findings:r,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 ko(e,n,t){let r=await c({config:e,document:wo,variables:{devSessionId:n}}).catch(i=>(f.warn({error:i},"fetchScopedTestRefs failed"),null)),o=new Set(r?.exploreScope??[]);return o.size===0?new Set:new Set(t.workflows.filter(i=>o.has(m(i.name))).flatMap(i=>i.tests.map(s=>R(s))))}var wo=k(`
|
|
163
|
-
query ExploreScope($devSessionId: String!) {
|
|
164
|
-
exploreScope(devSessionId: $devSessionId)
|
|
165
|
-
}
|
|
166
|
-
`);async function vo(e,n){return(await c({config:e,document:bo,variables:{devSessionId:n}}).catch(r=>(f.warn({error:r},"reportExploreUnhealthy failed"),null)))?.reportExploreUnhealthy??!1}var xo=k(`
|
|
167
|
-
mutation RecordExplorationProgress(
|
|
168
|
-
$devSessionId: String!
|
|
169
|
-
$attempts: Int!
|
|
170
|
-
$findings: Int!
|
|
171
|
-
$trail: ExploreTrailInput
|
|
172
|
-
) {
|
|
173
|
-
recordExplorationProgress(
|
|
174
|
-
devSessionId: $devSessionId
|
|
175
|
-
attempts: $attempts
|
|
176
|
-
findings: $findings
|
|
177
|
-
trail: $trail
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
`),bo=k(`
|
|
181
|
-
mutation ReportExploreUnhealthy($devSessionId: String!) {
|
|
182
|
-
reportExploreUnhealthy(devSessionId: $devSessionId)
|
|
183
|
-
}
|
|
184
|
-
`),Eo=k(`
|
|
185
|
-
mutation CreateExploreRun(
|
|
186
|
-
$projectId: String!
|
|
187
|
-
$runId: String!
|
|
188
|
-
$devSessionId: String
|
|
189
|
-
$branchName: String
|
|
190
|
-
$commitSha: String
|
|
191
|
-
$lockfileHash: String
|
|
192
|
-
$spec: String
|
|
193
|
-
$reproJson: String
|
|
194
|
-
) {
|
|
195
|
-
createExploreRun(
|
|
196
|
-
projectId: $projectId
|
|
197
|
-
runId: $runId
|
|
198
|
-
devSessionId: $devSessionId
|
|
199
|
-
branchName: $branchName
|
|
200
|
-
commitSha: $commitSha
|
|
201
|
-
lockfileHash: $lockfileHash
|
|
202
|
-
spec: $spec
|
|
203
|
-
reproJson: $reproJson
|
|
204
|
-
) {
|
|
205
|
-
id
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
`),Io=k(`
|
|
209
|
-
mutation SubmitExploreFinding(
|
|
210
|
-
$projectId: String!
|
|
211
|
-
$signature: String!
|
|
212
|
-
$baseState: String!
|
|
213
|
-
$category: ExploreFindingCategory!
|
|
214
|
-
$reproRunId: String!
|
|
215
|
-
) {
|
|
216
|
-
submitExploreFinding(
|
|
217
|
-
projectId: $projectId
|
|
218
|
-
signature: $signature
|
|
219
|
-
baseState: $baseState
|
|
220
|
-
category: $category
|
|
221
|
-
reproRunId: $reproRunId
|
|
222
|
-
) {
|
|
223
|
-
id
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
`),el=k(`
|
|
227
|
-
mutation SetExploreFindingStatus(
|
|
228
|
-
$projectId: String!
|
|
229
|
-
$signature: String!
|
|
230
|
-
$status: ExploreFindingStatus!
|
|
231
|
-
) {
|
|
232
|
-
setExploreFindingStatus(projectId: $projectId, signature: $signature, status: $status)
|
|
233
|
-
}
|
|
234
|
-
`),Po=k(`
|
|
235
|
-
query ExploreFindingExists($projectId: String!, $signature: String!, $lockfileHash: String!) {
|
|
236
|
-
exploreFindingExists(projectId: $projectId, signature: $signature, lockfileHash: $lockfileHash)
|
|
237
|
-
}
|
|
238
|
-
`);import Co from"path";import{graphql as To}from"gql.tada";async function Ao({config:e,cwd:n,fixturesDir:t,headed:r,lockfile:o,runId:i,session:s,signal:a,test:l}){if(!await Mo(e,i))return{outcome:{kind:"dispatch-failed",reason:"already-claimed",runId:i},persisted:Promise.resolve()};let p=Co.join(n,".ripplo","debug"),d=[];return(await s.runOnce({capture:!0,lockfile:o,onPhase:void 0,options:K({config:e,fixturesDir:t,headed:r}),params:void 0,runId:i,sequence:void 0,test:l,onEvent:g=>{d.push(g)}},a)).match(async g=>{let w=we(d),Y=w.flatMap(rt=>rt.findings),be=jo(Y);if(be!=null)return await J({config:e,debugDir:p,events:d,recordingOptional:!0,runId:i,stepSources:void 0}),{outcome:{error:be,kind:"error",runId:i},persisted:Promise.resolve()};await ke(e,i,w);let tt=J({config:e,debugDir:p,events:d,recordingOptional:!0,runId:i,stepSources:void 0}).then(()=>{});return{outcome:Y.length>0?{findings:Y,kind:"findings",runId:i}:{kind:"pass",runId:i},persisted:tt}},g=>Promise.resolve({outcome:{error:g,kind:"error",runId:i},persisted:Promise.resolve()}))}function jo(e){let n=e.find(t=>t.kind==="driver-error"&&Le(t.error));return n!=null&&n.kind==="driver-error"?n.error:void 0}async function Mo(e,n){return((await c({config:e,document:$o,variables:{runIds:[n]}})).startRunsBatch??[]).some(r=>r.id===n)}var $o=To(`
|
|
239
|
-
mutation StartRunsBatch($runIds: [String!]!) {
|
|
240
|
-
startRunsBatch(runIds: $runIds) {
|
|
241
|
-
id
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
`);import{graphql as xe}from"gql.tada";async function Fo(e,n,t){await c({config:e,document:Oo,variables:{reason:t,runId:n}}).catch(r=>{f.error(r,"failRun submission failed")})}var cl=xe(`
|
|
245
|
-
mutation ReleaseRun($runId: String!) {
|
|
246
|
-
releaseRun(runId: $runId)
|
|
247
|
-
}
|
|
248
|
-
`),Oo=xe(`
|
|
249
|
-
mutation FailRun($runId: String!, $reason: String!) {
|
|
250
|
-
failRun(runId: $runId, reason: $reason)
|
|
251
|
-
}
|
|
252
|
-
`),ul=xe(`
|
|
253
|
-
mutation MarkRunUnready($runId: String!, $cause: RunUnreadyCause!) {
|
|
254
|
-
markRunUnready(runId: $runId, cause: $cause)
|
|
255
|
-
}
|
|
256
|
-
`);import{randomUUID as Do}from"crypto";async function Uo({assign:e,config:n,debugDir:t,devSessionId:r,fixturesDir:o,headed:i,lockfile:s,report:a,session:l,signal:u}){let p=Ue(s);if(e.stepRuns.length===0)return{kind:"error",reason:"empty-trail"};let d=Ko(p,e.stepRuns),y=await Be({baseState:{name:R(e.baseStateTest),test:e.baseStateTest},corpus:p,lockfile:s,options:K({config:n,fixturesDir:o,headed:i}),seenSignature:a?w=>Q(n,w,e.lockfileHash):void 0,session:l,stepRuns:e.stepRuns,runIdFor:w=>`explore-${Do()}-${String(w)}`},u),g=a?await Wo({baseStateTest:e.baseStateTest,config:n,debugDir:t,devSessionId:r,lockfileHash:e.lockfileHash,outcome:y,reproJson:_o(p,e),stepSources:Ho(d)}):!1;return qo(y,d.length),Jo(y,g,Lo(d,e,y))}function Lo(e,n,t){if(t.kind==="error"||t.kind==="aborted")return;let r=t.timing.confirm;return{baseLabel:n.baseStateTest.intent,baseState:R(n.baseStateTest),durationMs:Math.round(z(t.timing.detect)+(r==null?0:z(r))),signature:t.kind==="finding"?t.signature:void 0,steps:No(e)}}function No(e){return e.flatMap(n=>{let t=n.label.split("#")[0]??n.label;return n.actions.map(r=>({test:t,text:r}))})}function z(e){return e.engineMs+e.worldMs+e.browserMs+e.driveMs+e.teardownMs}function qo(e,n){if(e.kind==="error"){f.info({detail:Ne(e.error),kind:e.kind,reason:e.error.kind,steps:n},"explore trail");return}if(e.kind==="aborted"){f.info({kind:e.kind,steps:n},"explore trail");return}let t=e.timing.detect,r=e.timing.confirm;f.info({browserMs:t.browserMs,confirmMs:r==null?void 0:z(r),detectMs:z(t),driveMs:t.driveMs,engineMs:t.engineMs,kind:e.kind,steps:n,teardownMs:t.teardownMs,worldMs:t.worldMs},"explore trail")}function _o(e,n){let t=n.stepRuns.flatMap(o=>{let i=e[o.idx];return i==null?[]:[{index:i.index,params:o.params,test:i.test}]}),r={baseStateRef:R(n.baseStateTest),steps:t};return JSON.stringify(r)}function Ho(e){return e.flatMap(n=>{let t=n.label.split("#")[0]??n.label;return n.actions.map(()=>t)})}async function Wo({baseStateTest:e,config:n,debugDir:t,devSessionId:r,lockfileHash:o,outcome:i,reproJson:s,stepSources:a}){return i.kind!=="finding"||i.captureEvents.length===0?!1:await Q(n,i.signature,o)?(f.info({devSessionId:r,signature:i.signature},"explore finding already reported, skipping duplicate"),!1):(await ve({baseState:i.baseState,branchName:void 0,category:Vo(i.verifierLayer),commitSha:void 0,config:n,debugDir:t,devSessionId:r,events:i.captureEvents,lockfileHash:o,reproJson:s,runId:i.runId,signature:i.signature,spec:Bo(e,i.captureEvents),stepSources:a}).catch(l=>{f.warn({error:l},"explore finding report failed")}),!0)}function Vo(e){return e==="data-rule"?"dataRule":e==="fact"?"fact":e}function Bo(e,n){let t=n.flatMap(o=>o.kind==="step"?[o.source]:[]),r={absent:e.absent,exclusive:e.exclusive,intent:e.intent,maybe:[],name:e.name,params:e.params,singletons:e.singletons,steps:t,stub:!1,tests:[],world:e.world};return JSON.stringify(r)}function Ko(e,n){return n.flatMap(t=>{let r=e[t.idx];return r==null?[]:[{actions:[...r.nav,...r.steps].map(o=>He(o.action)),label:`${r.test}#${String(r.index)}`}]})}function Jo(e,n,t){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:t}:{kind:e.kind,trail:t}}import Qo from"path";import{randomUUID as zo}from"crypto";async function Ol({cwd:e,onReady:n,signal:t,step:r,target:o}){let i=N(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 $e(e);if(a.result.isErr())return{error:a.result.error,kind:"compile-failed"};let l=a.result.value,u=await Go(l,o);return u.kind!=="ok"?u:(await We({lockfile:l,onReady:n,options:Yo(s),runId:`teleport-${zo()}`,sequence:u.sequence,stopAfterStep:r,test:u.test},t)).match(d=>({kind:"done",result:d}),d=>({error:d,kind:"run-failed"}))}async function Go(e,n){if(n.kind==="explore"){let r=await Ke(e,n.repro);return r.kind==="unplannable"?{kind:"unplannable"}:{kind:"ok",sequence:r.sequence,test:r.baseTest}}let t=E(e).find(r=>r.ref===n.ref);return t==null?{kind:"no-test",ref:n.ref}:{kind:"ok",sequence:Ve(e,t.test,void 0),test:t.test}}function Yo(e){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:Qo.join(e.cwd,C),generate:j,headed:!0,secret:e.webhookSecret,tunnelAuth:e.tunnelAuth}}import{graphql as Zn}from"gql.tada";import{err as G,ok as et}from"neverthrow";var Xo=Zn(`
|
|
257
|
-
query ExecutorSession($projectId: String!, $cwd: String!) {
|
|
258
|
-
project(id: $projectId) {
|
|
259
|
-
id
|
|
260
|
-
devSession(cwd: $cwd) {
|
|
261
|
-
id
|
|
262
|
-
executor
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
`),Zo=Zn(`
|
|
267
|
-
mutation SetDevSessionExecutor($devSessionId: String!, $executor: RunExecutor!) {
|
|
268
|
-
setDevSessionExecutor(devSessionId: $devSessionId, executor: $executor) {
|
|
269
|
-
__typename
|
|
270
|
-
... on DevSession {
|
|
271
|
-
id
|
|
272
|
-
executor
|
|
273
|
-
}
|
|
274
|
-
... on DevSessionEndedError {
|
|
275
|
-
message
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
`);async function ql(e){return(await nt(e)).map(t=>t.executor)}async function _l(e,n){let t=await nt(e);if(t.isErr())return G(t.error);let o=(await c({config:e,document:Zo,variables:{devSessionId:t.value.id,executor:n}})).setDevSessionExecutor;return o==null?G({kind:"empty-response"}):o.__typename!=="DevSession"?G({kind:"session-ended"}):et(o.executor)}async function nt(e){let t=(await c({config:e,document:Xo,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;return t==null?G({kind:"no-session"}):et({executor:t.executor,id:t.id})}export{ii as a,fi as b,U as c,ut as d,Si as e,re as f,sn as g,dn as h,N as i,V as j,En as k,fs as l,ys as m,ms as n,Kt as o,In as p,ws as q,xs as r,bs as s,Es as t,Is as u,Ps as v,Cs as w,Ts as x,As as y,js as z,Ms as A,Fi as B,Oi as C,ae as D,Di as E,fn as F,Yi as G,x as H,Xi as I,ce as J,ja as K,os as L,ur as M,is as N,Kr as O,Ao as P,Fo as Q,Ro as R,So as S,ko as T,vo as U,Uo as V,Ol as W,ql as X,_l as Y};
|