ripplo 0.9.5 → 0.9.7
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-22JUAYHM.js +4 -0
- package/dist/{chunk-ZYDCN5K2.js → chunk-2Q7VXQYN.js} +1 -1
- package/dist/chunk-4GA5662U.js +83 -0
- package/dist/{chunk-NBSDY7QG.js → chunk-5DT43ABQ.js} +1 -1
- package/dist/{chunk-74ZADYZC.js → chunk-6VUSLPQD.js} +3 -3
- package/dist/chunk-7CELUIVK.js +55 -0
- package/dist/{chunk-KQWFJRIP.js → chunk-7W237JFM.js} +1 -1
- package/dist/{chunk-T46B2OPT.js → chunk-AGK6XOX2.js} +1 -1
- package/dist/chunk-BJWGAKKD.js +224 -0
- package/dist/{chunk-VXJACUXK.js → chunk-BNMS3N54.js} +1 -1
- package/dist/{chunk-IDPYM454.js → chunk-CAS7MBA7.js} +5 -5
- package/dist/{chunk-N45RSC6N.js → chunk-CB74TAUC.js} +1 -1
- package/dist/chunk-FJPJDGSS.js +7 -0
- package/dist/{chunk-2A6KSSUD.js → chunk-GFKK7K6T.js} +1 -1
- package/dist/chunk-GZPE7I7U.js +8 -0
- package/dist/{chunk-TRQDCBKV.js → chunk-IG7J452B.js} +1 -1
- package/dist/chunk-IPSXNIXC.js +48 -0
- package/dist/chunk-L2ZJK7MP.js +6 -0
- package/dist/chunk-LOEAZGYO.js +4 -0
- package/dist/{chunk-GAOLASGV.js → chunk-N2OBRCPQ.js} +1 -1
- package/dist/{chunk-3PF5QK56.js → chunk-OAU4HUD2.js} +1 -1
- package/dist/{chunk-CUXFU3MF.js → chunk-OES7HGNF.js} +1 -1
- package/dist/{chunk-INURHJF4.js → chunk-R3DZ6JPY.js} +1 -1
- package/dist/chunk-RIVHBABX.js +4 -0
- package/dist/{chunk-6FU7HD6D.js → chunk-SNU66GSR.js} +1 -1
- package/dist/chunk-TPCKMDWU.js +4 -0
- package/dist/{chunk-3M2E253R.js → chunk-TPHOSZAK.js} +1 -1
- package/dist/{chunk-QIXJ7Z2L.js → chunk-V4CLXOCP.js} +1 -1
- package/dist/{chunk-JNLHZVZJ.js → chunk-XJJDHGK4.js} +19 -19
- package/dist/{chunk-3OI2UH3H.js → chunk-YQ2RBEOJ.js} +1 -1
- package/dist/{cli-error-MEC67EVT.js → cli-error-OIG4RO4E.js} +1 -1
- package/dist/{compile-write-F7D273JN.js → compile-write-OLP4DB4P.js} +1 -1
- package/dist/daemon-3IWI7VQT.js +152 -0
- package/dist/{daemon-QRMX6RPX.js → daemon-WEKGUIRK.js} +1 -1
- package/dist/{daemon-lock-67AFXXED.js → daemon-lock-OAARBZ4O.js} +1 -1
- package/dist/{dsl-loader-A2EMKCRL.js → dsl-loader-IRBKYLNW.js} +1 -1
- package/dist/{exit-plan-gate-WPHQII5J.js → exit-plan-gate-HSTV7UO4.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +174 -174
- package/dist/{plan-reminder-6E4CHEAZ.js → plan-reminder-FZSSUVNB.js} +1 -1
- package/dist/post-edit-333UCJ6G.js +4 -0
- package/dist/post-edit-analyze-JFWA223C.js +4 -0
- package/dist/post-edit-flag-stubs-IZSAIM4O.js +4 -0
- package/dist/{pre-bash-run-gate-WOGQZARU.js → pre-bash-run-gate-B42YNDQF.js} +1 -1
- package/dist/pre-edit-WZJVD3J4.js +4 -0
- package/dist/pre-edit-ripplo-skill-gate-QHUD7QGU.js +4 -0
- package/dist/pre-edit-scope-gate-2YIFSEDY.js +4 -0
- package/dist/{pre-edit-watch-gate-6MMET2NZ.js → pre-edit-watch-gate-GQZYMDOC.js} +1 -1
- package/dist/{prompt-submit-WMYBXZQN.js → prompt-submit-LE5LR62B.js} +1 -1
- package/dist/scope-reminder-DIDCHDAA.js +4 -0
- package/dist/solve-worker.js +1 -1
- package/dist/status-H5WYYH4J.js +4 -0
- package/dist/{stop-enforce-56SKN4RO.js → stop-enforce-EH2SC7ND.js} +1 -1
- package/dist/tasks-reminder-SDS6RNLP.js +4 -0
- package/package.json +2 -3
- package/dist/chunk-52IE2PAQ.js +0 -48
- package/dist/chunk-77DJHICC.js +0 -83
- package/dist/chunk-B6OQ2JE2.js +0 -4
- package/dist/chunk-CJUKILIO.js +0 -4
- package/dist/chunk-ESTPIODD.js +0 -7
- package/dist/chunk-GYH4P7SC.js +0 -4
- package/dist/chunk-IA7TU3WW.js +0 -4
- package/dist/chunk-JIMLVUPS.js +0 -229
- package/dist/chunk-NJFCO7FT.js +0 -8
- package/dist/chunk-PPB7QGV2.js +0 -55
- package/dist/chunk-XBN6AJVQ.js +0 -6
- package/dist/daemon-3CCSJNDP.js +0 -152
- package/dist/post-edit-VHZDDVV5.js +0 -4
- package/dist/post-edit-analyze-YAVEMK4O.js +0 -4
- package/dist/post-edit-flag-stubs-PMMITC7F.js +0 -4
- package/dist/pre-edit-R77BLLLQ.js +0 -4
- package/dist/pre-edit-ripplo-skill-gate-FXNQWVME.js +0 -4
- package/dist/pre-edit-scope-gate-ADO3NRVS.js +0 -4
- package/dist/scope-reminder-XTXZHPLU.js +0 -4
- package/dist/status-PUV7KG33.js +0 -4
- package/dist/tasks-reminder-PICFLMC2.js +0 -4
|
@@ -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 n}from"./chunk-MHNGR6M7.js";import{
|
|
4
|
+
import{a as n}from"./chunk-MHNGR6M7.js";import{h as o,i as a,k as i}from"./chunk-L2ZJK7MP.js";function c(e){return[`Compilation failed: ${s(e)}`,n("create","DSL authoring rules")].join(`
|
|
5
5
|
`)}function m(){return`${i} is up to date`}function g(e){return[`${i} is ${e==="missing"?"missing":"out of date"} \u2014 run \`npx ripplo compile\` and commit it`,n("setup")].join(`
|
|
6
6
|
`)}function x(){return`Wrote ${i}`}function s(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...l(e.diagnostics)].join(`
|
|
7
7
|
`);case"not-ripplo":return`${e.entryPath} must default-export createRipplo({ entities, singletons, workflows }).`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock):",...l(e.issues),"Regenerate with `npx ripplo compile`."].join(`
|
|
@@ -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,c as t}from"./chunk-KOKEEAEF.js";import{c as s}from"./chunk-
|
|
5
|
-
`))}var d={"exit-plan-gate":()=>import("./exit-plan-gate-
|
|
6
|
-
`),process.exit(1));let i=await m(),r=await p(await e(),i);if(r.kind==="crash"){let{renderHookCrash:a}=await import("./cli-error-
|
|
4
|
+
import{a as p,c as t}from"./chunk-KOKEEAEF.js";import{c as s}from"./chunk-LOEAZGYO.js";function l(){let o=process.cwd(),e=s(o);e!=null&&e!==o&&(process.chdir(e),process.stderr.write(`ripplo: resolved .ripplo/ at ${e}
|
|
5
|
+
`))}var d={"exit-plan-gate":()=>import("./exit-plan-gate-HSTV7UO4.js").then(o=>o.exitPlanGateHook),"plan-reminder":()=>import("./plan-reminder-FZSSUVNB.js").then(o=>t("UserPromptSubmit",o.planReminder)),"post-edit":()=>import("./post-edit-333UCJ6G.js").then(o=>o.postEditHook),"post-edit-analyze":()=>import("./post-edit-analyze-JFWA223C.js").then(o=>t("PostToolUse",o.postEditAnalyze)),"post-edit-flag-stubs":()=>import("./post-edit-flag-stubs-IZSAIM4O.js").then(o=>t("PostToolUse",o.postEditFlagStubs)),"pre-bash-run-gate":()=>import("./pre-bash-run-gate-B42YNDQF.js").then(o=>o.preBashRunGateHook),"pre-edit":()=>import("./pre-edit-WZJVD3J4.js").then(o=>o.preEditHook),"pre-edit-ripplo-skill-gate":()=>import("./pre-edit-ripplo-skill-gate-QHUD7QGU.js").then(o=>t("PreToolUse",o.preEditRipploSkillGate)),"pre-edit-scope-gate":()=>import("./pre-edit-scope-gate-2YIFSEDY.js").then(o=>t("PreToolUse",o.preEditScopeGate)),"pre-edit-watch-gate":()=>import("./pre-edit-watch-gate-GQZYMDOC.js").then(o=>t("PreToolUse",o.preEditWatchGate)),"prompt-submit":()=>import("./prompt-submit-LE5LR62B.js").then(o=>o.promptSubmitHook),"scope-reminder":()=>import("./scope-reminder-DIDCHDAA.js").then(o=>t("UserPromptSubmit",o.scopeReminder)),"session-preamble":()=>import("./session-preamble-ZYVRDSGA.js").then(o=>o.sessionPreambleHook),"stop-enforce":()=>import("./stop-enforce-EH2SC7ND.js").then(o=>o.stopEnforceHook),"tasks-reminder":()=>import("./tasks-reminder-SDS6RNLP.js").then(o=>t("UserPromptSubmit",o.tasksReminder)),"tasks-reminder-tool":()=>Promise.resolve(t("PostToolUse",()=>{})),"track-skill-load":()=>import("./track-skill-load-CJ74GD3Q.js").then(o=>o.trackSkillLoadHook),"track-skill-prompt":()=>import("./track-skill-prompt-YSB6OOQN.js").then(o=>t("UserPromptSubmit",o.trackSkillPrompt))},n=d;async function P(o){let e=n[o];e==null&&(process.stderr.write(`Unknown hook: ${o}
|
|
6
|
+
`),process.exit(1));let i=await m(),r=await p(await e(),i);if(r.kind==="crash"){let{renderHookCrash:a}=await import("./cli-error-OIG4RO4E.js");process.stderr.write(`${a(o,r.error)}
|
|
7
7
|
`),process.exit(0)}r.stdout!=null&&process.stdout.write(r.stdout),process.exit(0)}function m(){return new Promise((o,e)=>{if(process.stdin.isTTY){o("");return}let i=[];process.stdin.on("data",r=>i.push(r)),process.stdin.on("end",()=>{o(Buffer.concat(i).toString("utf8"))}),process.stdin.on("error",e)})}export{l as a,n as b,P as c};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{c as P}from"./chunk-7W237JFM.js";import{a as I,f as v}from"./chunk-TPHOSZAK.js";import{g as h,k as w,n as k}from"./chunk-L2ZJK7MP.js";import{d as a,f}from"./chunk-IPSXNIXC.js";import{V as S,X as m}from"./chunk-XJJDHGK4.js";import y from"fs";import p from"path";function D(e){try{let n=A(e);if(n==null)return;let t=p.join(n,"HEAD"),o=y.readFileSync(t,"utf8").trim(),r="ref: refs/heads/";return o.startsWith(r)?o.slice(r.length):o.length===0?void 0:o.slice(0,7)}catch{return}}function A(e){let n=p.join(e,".git");if(y.statSync(n).isDirectory())return n;let o=y.readFileSync(n,"utf8").trim(),r="gitdir:";if(!o.startsWith(r))return;let s=o.slice(r.length).trim();if(s.length!==0)return p.resolve(e,s)}import E from"crypto";import{readFile as R}from"fs/promises";import x from"path";import{graphql as g}from"gql.tada";import{err as L,ok as T}from"neverthrow";var C=g(`
|
|
5
|
+
mutation SyncDevSession(
|
|
6
|
+
$projectId: String!
|
|
7
|
+
$cwd: String!
|
|
8
|
+
$branch: String
|
|
9
|
+
$lockfileContent: String
|
|
10
|
+
$fixtures: [SyncDevFixtureInput!]
|
|
11
|
+
$entities: [SyncDevEntityInput!]!
|
|
12
|
+
$singletons: [SyncDevSingletonInput!]
|
|
13
|
+
$workflows: [SyncDevWorkflowInput!]!
|
|
14
|
+
) {
|
|
15
|
+
syncDevSession(
|
|
16
|
+
projectId: $projectId
|
|
17
|
+
cwd: $cwd
|
|
18
|
+
branch: $branch
|
|
19
|
+
lockfileContent: $lockfileContent
|
|
20
|
+
fixtures: $fixtures
|
|
21
|
+
entities: $entities
|
|
22
|
+
singletons: $singletons
|
|
23
|
+
workflows: $workflows
|
|
24
|
+
) {
|
|
25
|
+
id
|
|
26
|
+
hooksPaused
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`);async function ie(e,n){let t=await k(e);if(t.isErr())return L({error:t.error,kind:"compilation-failed"});let o=await u({config:n,cwd:e,lockfile:t.value});return T({devSessionId:o.devSessionId,lockfile:t.value})}async function u(e){let n=S(e.lockfile);return _({config:e.config,cwd:e.cwd,fixtures:e.lockfile.fixtures,payload:n})}var F=g(`
|
|
30
|
+
query DevSessionSyncState($projectId: String!, $cwd: String!) {
|
|
31
|
+
project(id: $projectId) {
|
|
32
|
+
devSession(cwd: $cwd) {
|
|
33
|
+
id
|
|
34
|
+
hooksPaused
|
|
35
|
+
lockfileHash
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`),W=g(`
|
|
40
|
+
mutation AnnounceDevSessionActive($projectId: String!, $cwd: String!) {
|
|
41
|
+
announceDevSessionActive(projectId: $projectId, cwd: $cwd)
|
|
42
|
+
}
|
|
43
|
+
`);async function se(e){let n=await O(e.cwd);if(n!=null){let o=(await a({config:e.config,document:F,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null))?.project?.devSession;if(o!=null&&o.lockfileHash===n)return await a({config:e.config,document:W,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null),{devSessionId:o.id,hooksPaused:o.hooksPaused}}return u(e)}async function O(e){let n=await $(e);return n==null?null:E.createHash("sha256").update(n).digest("hex")}async function _({config:e,cwd:n,fixtures:t,payload:o}){let r=D(n),s=await $(n),l=await H(n,t),c=await a({config:e,document:C,variables:{branch:r??null,cwd:n,entities:o.entities.map(i=>({description:i.description,name:i.name})),fixtures:l,lockfileContent:s,projectId:e.projectId,singletons:o.singletons.map(i=>({defaultValue:i.defaultValue,description:i.description,name:i.name,type:i.type})),workflows:o.workflows.map(i=>({entities:[...i.entities],expectedOutcome:i.expectedOutcome,name:i.name,slug:i.slug,sourcePath:i.sourcePath,spec:JSON.stringify(i.spec)}))}});if(c.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:c.syncDevSession.id,hooksPaused:c.syncDevSession.hooksPaused}}async function H(e,n){let t=Object.entries(n);return Promise.all(t.map(async([o,r])=>({contentBase64:(await R(x.join(e,h,o))).toString("base64"),sha256:r.sha256})))}async function $(e){try{return await R(x.join(e,w),"utf8")}catch{return null}}import{graphql as q}from"gql.tada";var B=q(`
|
|
44
|
+
mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
45
|
+
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
46
|
+
__typename
|
|
47
|
+
... on MutationAddDirtyTestsToScopeSuccess {
|
|
48
|
+
data {
|
|
49
|
+
id
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`);async function ge({cwd:e,editedPath:n,lockfile:t,requireHooks:o,syncFirst:r}){if(o&&!v(e))return{addedSlugs:[]};let s=new Set(X(e)),l=t.workflows.filter(d=>d.sourcePath!=null&&G({dirtySet:s,editedPath:n,sourcePath:d.sourcePath})).map(d=>m(d.name));if(l.length===0)return{addedSlugs:[]};let c=P(e).unwrapOr(void 0);return c==null?{addedSlugs:[]}:r&&!await M({cfg:c,cwd:e,lockfile:t})?{addedSlugs:[]}:{addedSlugs:await V({cfg:c,slugs:l})?l:[]}}async function M({cfg:e,cwd:n,lockfile:t}){return await u({config:e,cwd:n,lockfile:t}).catch(r=>(f.warn("auto-sync failed: %s",r instanceof Error?r.message:String(r)),null))!=null}async function V({cfg:e,slugs:n}){let o=(await a({config:e,document:B,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...n]}}).catch(r=>(f.warn("auto-scope failed: %s",r instanceof Error?r.message:String(r)),null)))?.addDirtyTestsToScope;return o?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:o.data.length>0}function G({dirtySet:e,editedPath:n,sourcePath:t}){return e.has(t)||n!=null&&n.endsWith(t)}var j=".ripplo/workflows/",b=" -> ";function X(e){let n;try{n=I(["status","--porcelain","-uall","--",".ripplo/workflows"],e)}catch{return[]}return n.split(`
|
|
55
|
+
`).map(t=>t.slice(3).trim()).map(t=>t.includes(b)?t.split(b)[1]:t).filter(t=>t!=null).filter(t=>t.startsWith(j)&&t.endsWith(".ts")).map(t=>t.slice(j.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}export{D as a,ie as b,u as c,se as d,O as e,ge as f};
|
|
@@ -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 c,d as s}from"./chunk-FEHVIHVA.js";import{k as l}from"./chunk-
|
|
4
|
+
import{a as c,d as s}from"./chunk-FEHVIHVA.js";import{k as l}from"./chunk-IPSXNIXC.js";import{err as h,ok as P}from"neverthrow";import{z as n}from"zod";var g="https://ripplo.ai";function a(){return u().RIPPLO_SERVER_URL}function m(){return u().RIPPLO_PROJECT_ID}var v=n.object({RIPPLO_PROJECT_ID:n.string().min(1).optional(),RIPPLO_SERVER_URL:n.string().min(1).default(g)}),f;function u(){return f??=v.parse(process.env),f}import d from"fs";import i from"path";function R(o){let t=d.realpathSync(o),r=t,e=i.dirname(r);for(;e!==r;){if(d.existsSync(i.join(r,".git")))return r;r=e,e=i.dirname(r)}return t}function x(o){return c(o).andThen(t=>s().andThen(r=>{let e=a(),p=l(e);return p==null?h({kind:"not-authenticated"}):P({appUrl:r.appUrl,cwd:R(o),engineUrl:r.engineUrl,projectId:m()??t.projectId,ripploServerUrl:e,token:p,webhookSecret:r.webhookSecret})}))}export{a,u as b,x as c};
|
|
@@ -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{b as m,c as p}from"./chunk-
|
|
4
|
+
import{b as m,c as p}from"./chunk-CB74TAUC.js";import{c as l}from"./chunk-5E62BCS7.js";import{c as d}from"./chunk-7W237JFM.js";import{a as i}from"./chunk-7WZ3VIUU.js";import{f as u}from"./chunk-TPHOSZAK.js";import{e as a}from"./chunk-IPSXNIXC.js";import{createHash as g}from"crypto";import{graphql as k}from"gql.tada";var c="tasks-reminder",y=k(`
|
|
5
5
|
query TasksReminder($projectId: String!, $cwd: String!) {
|
|
6
6
|
project(id: $projectId) {
|
|
7
7
|
id
|
|
@@ -0,0 +1,224 @@
|
|
|
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 Ne,f as qe,g as Le,j as He,n as _e,o as We,p as Be,q as Ke,r as Ve}from"./chunk-22JUAYHM.js";import{c as Qe,e as Je,f as ze}from"./chunk-7CELUIVK.js";import{c as O}from"./chunk-7W237JFM.js";import{d as Ue}from"./chunk-TPHOSZAK.js";import{a as $}from"./chunk-R4ZTRVDQ.js";import{d as me}from"./chunk-FEHVIHVA.js";import{b as xe}from"./chunk-V4CLXOCP.js";import{a as ve}from"./chunk-5DT43ABQ.js";import{g as Fe}from"./chunk-RIVHBABX.js";import{g as Re,l as ke,m as Se,n as we}from"./chunk-L2ZJK7MP.js";import{c as D}from"./chunk-R3DZ6JPY.js";import{a as ge,d as u,f,g as I}from"./chunk-IPSXNIXC.js";import{D as Ae,G as Me,S as $e,T as je,W as Oe,X as De,a as R,b as T,c as Ee,d as be,e as Ie,f as j,j as Te,k as Ce,m as Pe,p as v}from"./chunk-4GA5662U.js";import{W as M,X as h,i as A,l as G,q as he}from"./chunk-XJJDHGK4.js";import Wn from"p-queue";var Bn=4,Kn={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},F=new Wn({concurrency:Bn}),k={headedActive:0,interactiveActive:0,interactiveQueued:0},Ge={current:null};function ro({headed:e,task:n,workClass:r}){let t=Kn[r];return r==="p3-explore"?F.add(n,{priority:t}):(k.interactiveQueued+=1,U(),F.add(()=>Vn({headed:e,task:n}),{priority:t}))}function to(e){!Number.isFinite(e)||e<1||(F.concurrency=Math.floor(e),U())}function Y(){return{active:k.interactiveActive,headedActive:k.headedActive,poolSize:F.concurrency,queued:k.interactiveQueued}}function oo(e){Ge.current=e}async function Vn({headed:e,task:n}){k.interactiveQueued-=1,k.interactiveActive+=1,k.headedActive+=e?1:0,U();try{return await n()}finally{k.interactiveActive-=1,k.headedActive-=e?1:0,U()}}function U(){Ge.current?.()}async function Ye(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 Xe(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 Qn}from"gql.tada";async function Ze(e,n){let t=(await u({config:e,document:Jn,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 Jn=Qn(`
|
|
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 X,ok as en}from"neverthrow";function rn({all:e,ids:n,lockfile:r}){if(e&&n.length>0)return X({kind:"conflicting-flags"});if(e)return en(r.workflows.filter(i=>!i.stub).flatMap(i=>i.tests.map(s=>R(s))));if(n.length===0)return X({kind:"nothing-selected"});let t=n.map(i=>({id:i,refs:Gn(r,i)})),o=t.filter(i=>i.refs.length===0).map(i=>i.id);return o.length>0?X({kind:"unknown-ids",known:zn(r),unknown:o}):en([...new Set(t.flatMap(i=>i.refs))])}function tn(e,n){let r=new Map(T(e).map(t=>[t.ref,{testName:t.test.name,testSlug:t.test.slug,workflowName:t.workflow.name,workflowSlug:h(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 zn(e){return e.workflows.map(n=>h(n.name))}function Gn(e,n){let r=e.workflows.find(t=>t.name===n||h(t.name)===h(n));return r!=null?r.tests.map(t=>R(t)):T(e).filter(t=>t.ref===n||nn(t.ref)===nn(n)).map(t=>t.ref)}function nn(e){let n=e.lastIndexOf("/");return n===-1?h(e):`${h(e.slice(0,n))}/${h(e.slice(n+1))}`}import{err as Z,ok as on}from"neverthrow";import{graphql as Yn}from"gql.tada";async function an({config:e,cwd:n,lockfile:r}){await ze({cwd:n,editedPath:void 0,lockfile:r,requireHooks:!1,syncFirst:!1});let t=await Zn(e);if(t.isErr())return Z(t.error);let o=new Map(r.workflows.filter(s=>!s.stub).map(s=>[h(s.name),s])),i=[...new Set(t.value)].flatMap(s=>{let a=o.get(s);return a==null?[]:a.tests.map(l=>R(l))});return i.length===0?Z({kind:"scope-empty"}):on(i)}var Xn=Yn(`
|
|
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 Zn(e){try{let r=(await u({config:e,document:Xn,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return on(r.flatMap(t=>t.workflow==null?[]:[t.workflow.slug]))}catch(n){return Z({detail:n instanceof Error?n.message:String(n),kind:"scope-fetch-failed"})}}var ee=new Set,sn=new Map;function Co(e){ee.add(e)}function er(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 ln({config:e,cwd:n,message:r}){return(await ke(n)).match(o=>nr({config:e,cwd:n,lockfile:o,message:r}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...er(o)]},kind:"error"}))}async function nr({config:e,cwd:n,lockfile:r,message:t}){let o=await Ye(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await Xe(e.engineUrl);if(i!=null)return{error:{code:"engine-unreachable",detail:i,url:e.engineUrl},kind:"error"};let s=await Je(n);if(s==null)return{error:{code:"sync-failed",detail:"lockfile-missing"},kind:"error"};if(!ee.has(s)){let l=await tr({config:e,cwd:n,lockfile:r});if(l!=null)return{error:{code:"sync-failed",detail:l},kind:"error"};ee.add(s)}return(await or({config:e,cwd:n,lockfile:r,message:t})).match(async l=>({kind:"ready",lockfileHashValue:s,selections:tn(r,l),targetsByClaimKey:await rr({config:e,cwd:n,hash:s})}),l=>Promise.resolve({error:l,kind:"error"}))}async function rr({config:e,cwd:n,hash:r}){let t=sn.get(r);if(t!=null)return t;let o=await Ze(e,n);return sn.set(r,o),o}async function tr(e){try{return await Qe(e),null}catch(n){return n instanceof Error?n.message:String(n)}}async function or({config:e,cwd:n,lockfile:r,message:t}){return!t.all&&t.tests.length===0?(await an({config:e,cwd:n,lockfile:r})).mapErr(ir):rn({all:t.all,ids:t.tests,lockfile:r}).mapErr(ar)}function ir(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function ar(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 hr}from"crypto";import{createId as Rr}from"@paralleldrive/cuid2";import{CancellationTokenSource as Sn,ResponseError as kr}from"vscode-jsonrpc/node";import{graphql as sr}from"gql.tada";var lr=sr(`
|
|
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 dn(e){try{let r=(await u({config:e.config,document:lr,variables:dr(e)})).createRun;return r==null?N({detail:"create-run-null",type:"generic"}):r.__typename==="MutationCreateRunSuccess"?null:r.__typename==="LimitExceededError"?N({code:r.code,type:"limit"}):N({detail:r.__typename,type:"generic"})}catch(n){return cr(n)}}function dr({executor:e,lockfileHash:n,runId:r,target:t}){return{clientVersion:$(),executor:e,id:r,lockfileHash:n,target:e==="cloud"?"tunnel":void 0,testId:t.testId,workflowId:t.workflowId}}function N(e){return{kind:"dispatch-error",reason:e}}function cr(e){return e instanceof ge?{detail:e.message,kind:"infra-error"}:N({detail:e instanceof Error?e.message:String(e),type:"generic"})}function cn(){return new Map}function q(e){return`${e.workflowSlug}/${e.testSlug}`}function ur(e){return`${q(e)}@${e.lockfileHash}@${String(e.headed)}`}function un(e,n){let r=ur(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:ne(e,i)}}let o={claimed:!1,claimKey:q(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:ne(e,o)}}function ne(e,n){return new Map([...e,[n.inflightKey,n]])}function re(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:ne(e,t)}}function pn(e,n){return new Map([...e].filter(([r])=>r!==n))}function fn(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 d=o.find(p=>p.inflightKey===a);return[a,d??l]}));return{cancelled:t,state:s}}function yn(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 pr}from"gql.tada";var fr=2e3,yr=pr(`
|
|
68
|
+
query DaemonCloudRunStatus($runId: String!) {
|
|
69
|
+
run(id: $runId) {
|
|
70
|
+
status
|
|
71
|
+
failureReason
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`);function mn({config:e,onComplete:n,onStarted:r,runId:t,signal:o}){let i=!1,s,a=!1,l=async()=>{if(i||o.aborted)return;let d=await gr(e,t).catch(()=>"unknown");if(!(i||o.aborted)){if(!a&&(d==="running"||gn(d))&&(a=!0,r()),gn(d)){i=!0,n(mr(d));return}s=setTimeout(()=>{l()},fr)}};return l(),{stop:()=>{i=!0,s!=null&&clearTimeout(s)}}}async function gr(e,n){return(await u({config:e,document:yr,variables:{runId:n}})).run?.status??"unknown"}function gn(e){return e==="passed"||e==="failed"||e==="cancelled"||e==="unready"}function mr(e){return e==="passed"?{kind:"pass"}:e==="failed"?{detail:"failed",kind:"error"}:e==="cancelled"?{detail:"cancelled",kind:"error"}:e==="unready"?{detail:"unready",kind:"error"}:{detail:"unknown",kind:"error"}}var Sr=Ne(process.argv[1]),hn=12e4,wr=-32099;function vr(e){let n=new AbortController;return e.isCancellationRequested?(n.abort(),n.signal):(e.onCancellationRequested(()=>{n.abort()}),n.signal)}function Go(e){let n={...e,cancellations:new Map,cell:{inflight:cn()},jobs:new Map,timers:new Map};return{claim:r=>Cr(n,r),handleConnection:r=>{xr(n,r)},idle:()=>wn(n)}}function xr(e,n){let r=qe(n);r.onRequest(_e,(t,o)=>Er({connection:r,ctx:e,params:t,token:o})),r.onRequest(We,()=>{let t=Y();return{active:t.active,bundleMtimeMs:Sr,queued:t.queued,sseHealth:e.sseHealth(),version:$(),...e.explorationStatus()}}),r.onRequest(Be,()=>{let t=wn(e);return t&&e.onShutdownRequest(),t}),r.onClose(()=>{Tr(e,r)}),r.onError(t=>{f.warn({err:t},"ipc connection error")}),n.on("error",t=>{f.warn({err:t},"ipc socket error")}),r.listen()}function wn(e){let n=Y();return e.jobs.size===0&&n.active===0&&n.queued===0}async function Er({connection:e,ctx:n,params:r,token:t}){let o=Le.safeParse(r);if(!o.success)throw Rn({code:"bad-message"});await n.ready;let i=await ln({config:n.config,cwd:n.cwd,message:o.data});if(i.kind==="error")throw Rn(i.error);let s=hr(),a=new Sn;return t.onCancellationRequested(()=>{vn(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 Rn(e){return new kr(wr,e.code,e)}function vn(e,n){let r=e.jobs.get(n);if(r==null)return;r.cancellation.cancel(),e.jobs.delete(n);let t=fn(e.cell.inflight,n);e.cell.inflight=t.state,t.cancelled.forEach(o=>{P(e,o.inflightKey,"cancel")})}function P(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 te(e,n,r){e.cell.inflight=pn(e.cell.inflight,n),P(e,n,r),r==="keep"&&e.cancellations.delete(n)}function br(e){let n=yn(e.cell.inflight,Date.now());e.cell.inflight=n.state,n.expired.forEach(r=>{P(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=>{xn(e,t,r)})}function xn(e,n,r){let t=e.jobs.get(n);t!=null&&(kn(()=>t.connection.sendNotification(Ke,{event:r,jobId:n})),r.kind==="test-outcome"&&(Ir(t,r.outcome.kind),t.passed+t.failed+t.notRun>=t.total&&(kn(()=>t.connection.sendNotification(Ve,{failed:t.failed,jobId:n,notRun:t.notRun,passed:t.passed})),e.jobs.delete(n))))}function kn(e){Promise.resolve().then(e).catch(n=>{f.warn({err:n},"ipc notification failed")})}function Ir(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 Tr(e,n){[...e.jobs.entries()].filter(([,r])=>r.connection===n).forEach(([r])=>{vn(e,r)})}function Cr(e,n){let r=re(e.cell.inflight,n);e.cell.inflight=r.state;let t=r.entry;if(t==null)return null;P(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=C(e,t);te(e,t.inflightKey,"keep"),x(e,a,{kind:"test-outcome",outcome:s,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},started:()=>{x(e,C(e,t),{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}}}async function Pr(e){await e.selections.reduce((n,r)=>n.then(()=>Ar(e,r)),Promise.resolve())}async function Ar(e,n){let{ctx:r,headed:t,jobId:o,lockfileHashValue:i,targetsByClaimKey:s,token:a}=e;if(a.isCancellationRequested)return;let l=q(n),d=s.get(l);if(d==null){xn(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 p=un(r.cell.inflight,{deadlineAt:Date.now()+hn,identity:{headed:t,lockfileHash:i,testSlug:n.testSlug,workflowSlug:n.workflowSlug},jobId:o,runId:Rr(),testName:n.testName,workflowName:n.workflowName});if(r.cell.inflight=p.state,p.kind==="joined")return;let c=p.entry;r.cancellations.set(c.inflightKey,new Sn),r.timers.set(c.inflightKey,setTimeout(()=>{br(r)},hn));let y=r.executor(),g=await Mr({ctx:r,entry:c,executor:y,lockfileHashValue:i,target:d});if(g!=null){let w=C(r,c);te(r,c.inflightKey,"cancel"),x(r,w,{kind:"test-outcome",outcome:g,runId:"",testName:n.testName,workflowName:n.workflowName});return}y==="cloud"&&$r(r,c)}function C(e,n){return e.cell.inflight.get(n.inflightKey)??n}function Mr({ctx:e,entry:n,executor:r,lockfileHashValue:t,target:o}){return dn({config:e.config,executor:r,lockfileHash:t,runId:n.runId,target:o})}function $r(e,n){let r=re(e.cell.inflight,n.runId);e.cell.inflight=r.state;let t=r.entry;if(t==null)return;P(e,t.inflightKey,"keep");let o=e.cancellations.get(t.inflightKey);o!=null&&mn({config:e.config,runId:t.runId,signal:vr(o.token),onComplete:i=>{let s=C(e,t);te(e,t.inflightKey,"keep"),x(e,s,{kind:"test-outcome",outcome:i,runId:t.runId,testName:t.testName,workflowName:t.workflowName})},onStarted:()=>{x(e,C(e,t),{kind:"test-started",runId:t.runId,testName:t.testName,workflowName:t.workflowName})}})}import{graphql as E}from"gql.tada";import{gzipSync as Fr}from"zlib";import{appendFileSync as Ur,existsSync as H,readFileSync as In,writeFileSync as bn}from"fs";import S from"path";import{graphql as ie}from"gql.tada";function L(e){return[e.kind,e.target,e.value].filter(n=>n.length>0).join(" ")}function En(e,n){return{kind:"finding",payload:Or(e),source:"verifier",step:n.step,stepIndex:n.stepIndex,timeNanos:n.timeNanos}}var jr={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"};function Or(e){switch(e.kind){case"unrunnable":return{kind:"unrunnable",reason:jr[e.reason],unmet:e.unmet==null?null:Ce(e.unmet)};case"impossible-action":return{action:Te(e.step.action),kind:"impossibleAction",subject:Dr(e.step.action)};case"lift-visibility":return{declaredIndex:e.declaredIndex,kind:"liftVisibility",subject:G(e.locator),visibleIndex:e.visibleIndex}}}function Dr(e){return e.locator==null?e.url??"":G(e.locator)}function Tn(e){return v(e.event).length>0}function _({config:e,fixturesDir:n,headed:r}){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:A,headed:r,secret:e.webhookSecret}}async function ae(e){let n=W(e);await se({config:e.config,ownerToken:null,records:n,runId:e.runId})}function W({debugDir:e,events:n,recordingOptional:r,runId:t,stepSources:o}){let i=le(n),s=Kr(e,t);if(s==null&&!r)throw new Error("recording-missing");let a=i.map((d,p)=>rt({aliases:[...Jr(n),...zr(i)],generated:Gr(n),generatedSingletons:Yr(n),origin:s==null?Br(i):s.origin,record:d,rrwebEvents:s==null?[]:s.events,sourceTest:o?.[p]??null})),l=i.flatMap(d=>d.event.findings.map(p=>En(p,{step:L(M(d.event.source,d.event.index)),stepIndex:d.event.index,timeNanos:Cn(d)})));return Nr({debugDir:e,events:[...a,...l],runId:t}),i}function Nr({debugDir:e,events:n,runId:r}){if(n.length===0)return;let t=S.join(e,r,"behavior.jsonl");if(!H(t))return;let o=n.map(i=>JSON.stringify(i)).join(`
|
|
75
|
+
`);Ur(t,`${o}
|
|
76
|
+
`)}function Cn(e){return String(BigInt(Math.max(0,Math.round(e.event.endMs)))*1000000n)}async function se({config:e,ownerToken:n,records:r,runId:t}){let o=r.filter(a=>Tn(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:it,variables:{items:[{duration:s,failCount:o,firstFailedStepTitle:qr(r),ownerToken:n,passCount:i,runId:t,status:o>0?"failed":"passed"}]}})}function qr(e){let n=e.filter(r=>Tn(r)).toSorted((r,t)=>r.event.index-t.event.index).at(0);return n==null?null:L(M(n.event.source,n.event.index))}function le(e){return e.flatMap(n=>n.kind==="step"?[{event:n}]:[])}async function Pn(e,n){await u({config:e,document:at,variables:{runIds:[n]}})}async function Lr({config:e,debugDir:n,runId:r}){let t=S.join(n,r),o=S.join(t,"behavior.jsonl");if(H(S.join(t,I)))return;if(!H(o)){f.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(d=>setTimeout(d,a)),Hr({behaviorPath:o,config:e,runDir:t,runId:r}))),Promise.resolve(!1))}async function Hr({behaviorPath:e,config:n,runDir:r,runId:t}){try{let o=await u({config:n,document:ot,variables:{runId:t}}),i=await fetch(o.debugArtifactUploadUrl,{body:Fr(In(e)),headers:{"content-type":Wr},method:"PUT"});return i.ok?(await Pn(n,t),bn(S.join(r,I),""),!0):(f.warn({runId:t,status:i.status},"behavior upload PUT failed"),!1)}catch(o){return _r(o)?(f.warn({runId:t},"behavior upload refused by server; run unknown \u2014 not retrying"),bn(S.join(r,I),""),!0):(f.warn({error:o,runId:t},"behavior upload failed"),!1)}}function _r(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 Wr="application/x-ndjson";function Br(e){return e.reduce((n,r)=>Math.min(n,r.event.startMs),e[0]?.event.startMs??0)}function Kr(e,n){let r=S.join(e,n,"behavior.jsonl");if(!H(r))return null;let t=In(r,"utf8").split(`
|
|
77
|
+
`).filter(i=>i.length>0).map(i=>Vr(i)).flatMap(i=>Qr(i)?[i.event]:[]),o=t[0];return o==null?null:{events:t,origin:o.timestamp}}function Vr(e){return JSON.parse(e)}function Qr(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}function Jr(e){return e.flatMap(n=>n.kind==="world"?n.aliases:[])}function zr(e){return e.flatMap(n=>{let r=Xr(n.event.source);return r.flatMap(t=>{let i=r.filter(a=>a.entity===t.entity).indexOf(t),s=n.event.state.rows.filter(a=>a.status==="created"&&a.entity===t.entity).at(i);return s==null?[]:[{alias:t.as,entity:t.entity,key:s.key}]})})}function Gr(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generated.map(r=>An(r)):[]))}function An({entity:e,field:n,key:r}){return`${e} ${r} ${n}`}function Yr(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generatedSingletons:[]))}function Xr(e){return e==null?[]:e.expect.flatMap(n=>oe(n))}function oe(e){return e.kind==="state"&&e.assertion.kind==="created"?[{as:e.assertion.as,entity:e.entity}]:e.kind==="and"?e.predicates.flatMap(n=>oe(n)):e.kind==="when"?e.branches.flatMap(n=>n.consequence.flatMap(r=>oe(r))):[]}var Zr=3,et=0;function nt({endMs:e,rrwebEvents:n,startMs:r}){let t=n.find(o=>o.type===Zr&&o.data?.source===et&&o.timestamp>=r&&o.timestamp<=e);return t==null?r:t.timestamp}function rt({aliases:e,generated:n,generatedSingletons:r,origin:t,record:o,rrwebEvents:i,sourceTest:s}){let{event:a}=o,l=M(a.source,a.index),d=nt({endMs:a.endMs,rrwebEvents:i,startMs:a.startMs});return{duration:Math.max(0,a.endMs-a.startMs),executedBranches:[...a.executedBranches],kind:"step",nodeType:l.kind,pageUrl:a.url,recordingEndMs:Math.max(0,a.endMs-t),recordingStartMs:Math.max(0,d-t),source:"verifier",sourceTest:s,stateRows:a.state.rows.map(p=>tt({aliases:e,generated:n,row:p})),stateSingletons:a.state.singletons.map(p=>({changed:p.changed,generated:r.has(p.name),name:p.name,value:p.value==null?null:String(p.value)})),stepIndex:a.index,timeNanos:Cn(o),title:L(l)}}function tt({aliases:e,generated:n,row:r}){let t=e.find(o=>o.entity===r.entity&&o.key===r.key);return{entity:r.entity,fields:r.fields.map(o=>({changed:o.changed,field:o.field,generated:n.has(An({entity:r.entity,field:o.field,key:r.key})),value:o.value==null?null:String(o.value)})),key:r.key,label:t?.alias??r.key,status:r.status}}var ot=ie(`
|
|
78
|
+
mutation DebugArtifactUploadUrl($runId: String!) {
|
|
79
|
+
debugArtifactUploadUrl(runId: $runId)
|
|
80
|
+
}
|
|
81
|
+
`),it=ie(`
|
|
82
|
+
mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
|
|
83
|
+
completeRunsBatch(items: $items) {
|
|
84
|
+
id
|
|
85
|
+
status
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`),at=ie(`
|
|
89
|
+
mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
|
|
90
|
+
markRunArtifactsUploadedBatch(runIds: $runIds)
|
|
91
|
+
}
|
|
92
|
+
`);function st(e){if(e.kind!=="clean"&&e.kind!=="flaky"&&e.kind!=="finding")return;let{trail:n}=e;return{baseLabel:n.baseLabel,baseState:n.baseState,durationMs:n.durationMs,outcome:e.kind,runId:e.kind==="finding"?e.runId:void 0,signature:n.signature,steps:n.steps}}async function de({baseState:e,category:n,config:r,debugDir:t,devSessionId:o,events:i,lockfileHash:s,reproJson:a,runId:l,signature:d,spec:p,stepSources:c,summary:y,workflowSlug:g}){await u({config:r,document:pt,variables:{devSessionId:o??null,lockfileHash:s,projectId:r.projectId,reproJson:a,runId:l,spec:p??null,workflowSlug:g??null}}),await ae({config:r,debugDir:t,events:i,recordingOptional:!0,runId:l,stepSources:c}),await u({config:r,document:ft,variables:{baseState:e,category:n,projectId:r.projectId,reproRunId:l,signature:d,summary:y}})}async function B(e,n,r){return(await u({config:e,document:yt,variables:{lockfileHash:r,projectId:e.projectId,signature:n}})).exploreFindingExists}async function lt({attempts:e,config:n,devSessionId:r,findings:t,trail:o}){await u({config:n,document:ct,variables:{attempts:e,devSessionId:r,findings:t,trail:o==null?null:{baseLabel:o.baseLabel,baseState:o.baseState,durationMs:o.durationMs,findingRunId:o.runId??null,findingSignature:o.signature??null,outcome:o.outcome,steps:o.steps.map(i=>({test:i.test,text:i.text}))}}})}async function dt(e,n){return(await u({config:e,document:ut,variables:{devSessionId:n}}).catch(t=>(f.warn({error:t},"reportExploreUnhealthy failed"),null)))?.reportExploreUnhealthy??!1}var ct=E(`
|
|
93
|
+
mutation RecordExplorationProgress(
|
|
94
|
+
$devSessionId: String!
|
|
95
|
+
$attempts: Int!
|
|
96
|
+
$findings: Int!
|
|
97
|
+
$trail: ExploreTrailInput
|
|
98
|
+
) {
|
|
99
|
+
recordExplorationProgress(
|
|
100
|
+
devSessionId: $devSessionId
|
|
101
|
+
attempts: $attempts
|
|
102
|
+
findings: $findings
|
|
103
|
+
trail: $trail
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
`),ut=E(`
|
|
107
|
+
mutation ReportExploreUnhealthy($devSessionId: String!) {
|
|
108
|
+
reportExploreUnhealthy(devSessionId: $devSessionId)
|
|
109
|
+
}
|
|
110
|
+
`),pt=E(`
|
|
111
|
+
mutation CreateExploreRun(
|
|
112
|
+
$projectId: String!
|
|
113
|
+
$runId: String!
|
|
114
|
+
$devSessionId: String
|
|
115
|
+
$lockfileHash: String!
|
|
116
|
+
$spec: String
|
|
117
|
+
$reproJson: String
|
|
118
|
+
$workflowSlug: String
|
|
119
|
+
) {
|
|
120
|
+
createExploreRun(
|
|
121
|
+
projectId: $projectId
|
|
122
|
+
runId: $runId
|
|
123
|
+
devSessionId: $devSessionId
|
|
124
|
+
lockfileHash: $lockfileHash
|
|
125
|
+
spec: $spec
|
|
126
|
+
reproJson: $reproJson
|
|
127
|
+
workflowSlug: $workflowSlug
|
|
128
|
+
) {
|
|
129
|
+
id
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`),ft=E(`
|
|
133
|
+
mutation SubmitExploreFinding(
|
|
134
|
+
$projectId: String!
|
|
135
|
+
$signature: String!
|
|
136
|
+
$summary: String!
|
|
137
|
+
$baseState: String!
|
|
138
|
+
$category: ExploreFindingCategory!
|
|
139
|
+
$reproRunId: String!
|
|
140
|
+
) {
|
|
141
|
+
submitExploreFinding(
|
|
142
|
+
projectId: $projectId
|
|
143
|
+
signature: $signature
|
|
144
|
+
summary: $summary
|
|
145
|
+
baseState: $baseState
|
|
146
|
+
category: $category
|
|
147
|
+
reproRunId: $reproRunId
|
|
148
|
+
) {
|
|
149
|
+
id
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`),gi=E(`
|
|
153
|
+
mutation SetExploreFindingStatus(
|
|
154
|
+
$projectId: String!
|
|
155
|
+
$signature: String!
|
|
156
|
+
$status: ExploreFindingStatus!
|
|
157
|
+
) {
|
|
158
|
+
setExploreFindingStatus(projectId: $projectId, signature: $signature, status: $status)
|
|
159
|
+
}
|
|
160
|
+
`),yt=E(`
|
|
161
|
+
query ExploreFindingExists($projectId: String!, $signature: String!, $lockfileHash: String!) {
|
|
162
|
+
exploreFindingExists(projectId: $projectId, signature: $signature, lockfileHash: $lockfileHash)
|
|
163
|
+
}
|
|
164
|
+
`);import ht from"path";import{graphql as Rt}from"gql.tada";import{graphql as K}from"gql.tada";function ce(e){switch(e.kind){case"app-not-ready":return"appNotReady";case"client-mount-missing":return"appNotReady";case"engine-network":case"engine-http":return"backendUnreachable";case"engine-unreachable":return"engineUnreachable";case"engine-decode":case"state-identity":case"setup-missing-row":case"page-read":case"driver-launch":case"action-failed":case"check-failed":case"aborted":return null}}async function ue({config:e,ownerToken:n,reason:r,runId:t}){await u({config:e,document:gt,variables:{ownerToken:n,reason:r,runId:t}}).catch(o=>{f.error(o,"failRun submission failed")})}async function pe({cause:e,config:n,ownerToken:r,runId:t}){await u({config:n,document:mt,variables:{cause:e,ownerToken:r,runId:t}}).catch(o=>{f.error(o,"markRunUnready submission failed")})}var ki=K(`
|
|
165
|
+
mutation ReleaseRun($runId: String!, $ownerToken: String) {
|
|
166
|
+
releaseRun(runId: $runId, ownerToken: $ownerToken)
|
|
167
|
+
}
|
|
168
|
+
`),Si=K(`
|
|
169
|
+
mutation HeartbeatRun($runId: String!) {
|
|
170
|
+
heartbeatRun(runId: $runId)
|
|
171
|
+
}
|
|
172
|
+
`),gt=K(`
|
|
173
|
+
mutation FailRun($runId: String!, $reason: String!, $ownerToken: String) {
|
|
174
|
+
failRun(runId: $runId, reason: $reason, ownerToken: $ownerToken)
|
|
175
|
+
}
|
|
176
|
+
`),mt=K(`
|
|
177
|
+
mutation MarkRunUnready($runId: String!, $cause: RunUnreadyCause!, $ownerToken: String) {
|
|
178
|
+
markRunUnready(runId: $runId, cause: $cause, ownerToken: $ownerToken)
|
|
179
|
+
}
|
|
180
|
+
`);async function kt({config:e,cwd:n,errorSettle:r,fixturesDir:t,headed:o,lockfile:i,onPhase:s,runId:a,session:l,signal:d,test:p}){let c=await wt(e,a);if(c==null)return{outcome:{kind:"dispatch-failed",reason:"already-claimed",runId:a},ownerToken:null,persisted:Promise.resolve()};let y=ht.join(n,".ripplo","debug"),g=[];return(await l.runOnce({capture:!0,lockfile:i,onPhase:s,options:_({config:e,fixturesDir:t,headed:o}),params:void 0,runId:a,sequence:void 0,test:p,onEvent:b=>{g.push(b)}},d)).match(async b=>{let ye=le(g),J=ye.flatMap(_n=>v(_n.event)),z=St(J);if(z!=null)return W({config:e,debugDir:y,events:g,recordingOptional:!0,runId:a,stepSources:void 0}),await Mn({config:e,error:z,errorSettle:r,ownerToken:c,runId:a}),{outcome:{error:z,kind:"error",runId:a},ownerToken:c,persisted:Promise.resolve()};await se({config:e,ownerToken:c,records:ye,runId:a}),W({config:e,debugDir:y,events:g,recordingOptional:!0,runId:a,stepSources:void 0});let Hn=Promise.resolve();return{outcome:J.length>0?{contradictions:J,kind:"findings",runId:a}:{kind:"pass",runId:a},ownerToken:c,persisted:Hn}},async b=>(await Mn({config:e,error:b,errorSettle:r,ownerToken:c,runId:a}),{outcome:{error:b,kind:"error",runId:a},ownerToken:c,persisted:Promise.resolve()}))}async function Mn({config:e,error:n,errorSettle:r,ownerToken:t,runId:o}){if(r==="defer")return;let i=ce(n);if(i!=null){await pe({cause:i,config:e,ownerToken:t,runId:o});return}await ue({config:e,ownerToken:t,reason:j(n),runId:o})}function St(e){let n=e.find(r=>r.kind==="stepError"&&be(r.record.error));return n!=null&&n.kind==="stepError"?n.record.error:void 0}async function wt(e,n){return((await u({config:e,document:vt,variables:{runIds:[n]}})).startRunsBatch??[]).find(o=>o.id===n)?.ownerToken??null}var vt=Rt(`
|
|
181
|
+
mutation StartRunsBatch($runIds: [String!]!) {
|
|
182
|
+
startRunsBatch(runIds: $runIds) {
|
|
183
|
+
id
|
|
184
|
+
ownerToken
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
`);import{randomUUID as xt}from"crypto";async function Et({assign:e,config:n,debugDir:r,devSessionId:t,fixturesDir:o,headed:i,lockfile:s,report:a,session:l,signal:d}){let p=Ee(s);if(e.stepRuns.length===0)return{error:{source:"empty-trail"},kind:"error"};let c=Ot(p,e.stepRuns),y=await Oe({baseState:{name:R(e.baseStateTest),test:e.baseStateTest},corpus:p,lockfile:s,options:_({config:n,fixturesDir:o,headed:i}),seenSignature:a?w=>B(n,w,e.lockfileHash):void 0,session:l,stepRuns:e.stepRuns,runIdFor:w=>`explore-${xt()}-${String(w)}`},d),g=a?await At({baseStateTest:e.baseStateTest,config:n,debugDir:r,devSessionId:t,lockfileHash:e.lockfileHash,outcome:y,reproJson:Ct(p,e),stepSources:Pt(c)}):!1;return Tt(y,c.length),Dt(y,g,bt(c,e,y))}function bt(e,n,r){if(r.kind==="error"||r.kind==="aborted")return;let t=r.timing.confirm;return{baseLabel:n.baseStateTest.intent,baseState:R(n.baseStateTest),durationMs:Math.round(V(r.timing.detect)+(t==null?0:V(t))),signature:r.kind==="finding"||r.kind==="seen"?r.signature:void 0,steps:It(e.slice(0,r.ranCount))}}function It(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(t=>({test:r,text:t}))})}function V(e){return e.engineMs+e.worldMs+e.browserMs+e.driveMs+e.teardownMs}function Tt(e,n){if(e.kind==="error"){f.info({detail:j(e.error),kind:e.kind,reason:e.error.kind,steps:n},"explore trail");return}if(e.kind==="aborted"||e.kind==="seen"){f.info({kind:e.kind,steps:n},"explore trail");return}let r=e.timing.detect,t=e.timing.confirm;f.info({browserMs:r.browserMs,confirmMs:t==null?void 0:V(t),detectMs:V(r),driveMs:r.driveMs,engineMs:r.engineMs,kind:e.kind,steps:n,teardownMs:r.teardownMs,worldMs:r.worldMs},"explore trail")}function Ct(e,n){let r=n.stepRuns.flatMap(o=>{let i=e[o.idx];return i==null?[]:[{index:i.index,params:o.params,test:i.test}]}),t={baseStateRef:R(n.baseStateTest),steps:r};return JSON.stringify(t)}function Pt(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(()=>r)})}async function At({baseStateTest:e,config:n,debugDir:r,devSessionId:t,lockfileHash:o,outcome:i,reproJson:s,stepSources:a}){return i.kind!=="finding"||i.captureEvents.length===0?!1:await B(n,i.signature,o)?(f.info({devSessionId:t,signature:i.signature},"explore finding already reported, skipping duplicate"),!1):(await de({baseState:i.baseState,category:Mt(i.verifierLayer),config:n,debugDir:r,devSessionId:t,events:i.captureEvents,lockfileHash:o,reproJson:s,runId:i.runId,signature:i.signature,spec:jt(e,i.captureEvents),stepSources:a,summary:$t(i.captureEvents,i.title),workflowSlug:i.sourceTest?.split("/")[0]}).catch(l=>{f.warn({error:l},"explore finding report failed")}),!0)}function Mt(e){return e==="data-rule"?"dataRule":e==="model-drift"?"modelDrift":e}function $t(e,n){let r=e.flatMap(t=>t.kind==="step"?v(t):[]).at(0);if(r!=null)return Ae(r);if(n!=null)return n;throw new Error("explore finding has no findings to summarize")}function jt(e,n){let r=n.flatMap(o=>o.kind==="step"?[o.source]:[]),t={absent:e.absent,actor:e.actor,exclusive:e.exclusive,intent:e.intent,maybe:[],name:e.name,params:e.params,singletons:e.singletons,steps:r,stub:!1,tests:[],viewports:[e.viewport],world:e.world};return JSON.stringify(t)}function Ot(e,n){return n.flatMap(r=>{let t=e[r.idx];return t==null?[]:[{actions:[...t.nav,...t.steps].map(o=>Pe(o.action)),label:`${t.test}#${String(t.index)}`}]})}function Dt(e,n,r){if(e.kind==="aborted")return{kind:"aborted"};if(e.kind==="error")return{error:{category:Ft(e.error.kind),kind:e.error.kind,source:"runtime"},kind:"error"};if(r==null)throw new Error("trail summary missing for completed trail");return e.kind==="finding"?{kind:e.kind,runId:n?e.runId:void 0,trail:r}:{kind:e.kind,trail:r}}function Ft(e){return e==="driver-launch"?"driver":Ie(e)?"infra":"trail"}import Ut from"fs";import Nt from"path";async function Yi(e){let n=Nt.join(e,".ripplo","index.ts");if(!Ut.existsSync(n))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await we(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:ve(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:me().match(t=>({appUrl:t.appUrl,engineUrl:t.engineUrl,errors:[],valid:!0,warnings:[]}),t=>({appUrl:void 0,engineUrl:void 0,errors:[{message:xe(t),path:""}],valid:!1,warnings:[]}))}async function Xi(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 Zi({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 $n,IPCMessageReader as jn,IPCMessageWriter as On,NotificationType as qt,NotificationType0 as Dn,RequestType as Fn,RequestType0 as Lt}from"vscode-jsonrpc/node";import{z as m}from"zod";var ia=m.object({headed:m.boolean(),runId:m.string().min(1),testRef:m.string().min(1)}),aa=m.object({lockfileJson:m.string().optional(),unavailable:m.string().optional()}),sa=m.object({runId:m.string().min(1),span:he}),la=m.object({outcome:He,serverNotified:m.boolean()}),da=new Dn("worker/ready"),ca=new Fn("worker/run"),ua=new Lt("worker/lockfile"),pa=new Fn("worker/exploreTrail"),fa=new qt("worker/span"),ya=new Dn("worker/shutdown");function ga(e){let n=$n(new jn(e),new On(e));return n.listen(),n}function ma(){let e=$n(new jn(process),new On(process));return e.listen(),e}import Ht from"path";import{randomUUID as _t}from"crypto";async function ba({cwd:e,onReady:n,signal:r,step:t,target:o}){let i=O(e).match(c=>({config:c}),c=>({failure:c}));if("failure"in i)return{failure:i.failure,kind:"config-failed"};let s=i.config,a=await Se(e);if(a.result.isErr())return{error:a.result.error,kind:"compile-failed"};let l=await Fe(e,a.result.value),d=await Wt(l,o);return d.kind!=="ok"?d:(await $e({lockfile:l,onReady:n,options:Bt(s),runId:`teleport-${_t()}`,sequence:d.sequence,stopAfterStep:t,test:d.test},r)).match(c=>({kind:"done",result:c}),c=>({error:c,kind:"run-failed"}))}async function Wt(e,n){if(n.kind==="explore"){let t=await De(e,n.repro);return t.kind==="unplannable"?{kind:"unplannable"}:{kind:"ok",sequence:t.sequence,test:t.baseTest}}let r=T(e).find(t=>t.ref===n.ref);return r==null?{kind:"no-test",ref:n.ref}:{kind:"ok",sequence:je(e,r.test,void 0),test:r.test}}function Bt(e){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:Ht.join(e.cwd,Re),generate:A,headed:!0,secret:e.webhookSecret}}var Ca=15e3,Pa=3e4,Aa=2,Ma=12;function $a(e,n){let r=Kt(e,n);if(!e.enabled||!e.executorLocal)return{abortIds:fe(n),health:{kind:"off"},launchCount:0};if(Vt(n))return{abortIds:fe(n),health:{kind:"paused"},launchCount:0};if(n.lockfile.kind==="blocked")return{abortIds:fe(n),health:{kind:"blocked",reason:n.lockfile.reason},launchCount:0};if(n.backoffActive||n.lockfile.kind==="loading")return{abortIds:r,health:{kind:"paused"},launchCount:0};let t=Math.min(e.workers,n.poolSize-1),o=n.trails.length-r.length;return{abortIds:r,health:{kind:"on"},launchCount:Math.max(0,t-o)}}function Kt(e,n){let r=Me(e.maxTrailLength);return n.trails.filter(t=>t.ageMs>=r).map(t=>t.id)}function fe(e){return e.trails.map(n=>n.id)}function Vt(e){return e.headedActive||e.interactiveActive>0||e.interactiveQueued>0}import{graphql as Xt}from"gql.tada";import{err as Q,ok as qn}from"neverthrow";import Qt,{AbortError as Jt}from"p-retry";import{graphql as Un}from"gql.tada";var zt=Un(`
|
|
188
|
+
query AwaitDevSession($projectId: String!, $cwd: String!) {
|
|
189
|
+
project(id: $projectId) {
|
|
190
|
+
devSession(cwd: $cwd) {
|
|
191
|
+
id
|
|
192
|
+
executor
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
`);async function Nn(e){return Qt(async()=>{let t=(await u({config:e,document:zt,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 Jt("missing")},{factor:1,maxTimeout:400,minTimeout:400,retries:25}).catch(()=>D(e.cwd)?{kind:"starting"}:{kind:"missing"})}var Gt=Un(`
|
|
197
|
+
query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
|
|
198
|
+
activeDevSessions(projectId: $projectId) {
|
|
199
|
+
id
|
|
200
|
+
cwd
|
|
201
|
+
branch
|
|
202
|
+
}
|
|
203
|
+
project(id: $projectId) {
|
|
204
|
+
id
|
|
205
|
+
devSession(cwd: $cwd) {
|
|
206
|
+
id
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
`);function La(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:",...Yt(e.elsewhere)].join(`
|
|
211
|
+
`)}}}async function Ha(e){let n=D(e),r=Ue(e),t=O(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:Gt,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 Yt(e){return e.map(n=>{let r=n.branch==null?"":` (${n.branch})`;return` - ${n.cwd}${r}`})}var Zt=Xt(`
|
|
212
|
+
mutation SetDevSessionExecutor($devSessionId: String!, $executor: RunExecutor!) {
|
|
213
|
+
setDevSessionExecutor(devSessionId: $devSessionId, executor: $executor) {
|
|
214
|
+
__typename
|
|
215
|
+
... on DevSession {
|
|
216
|
+
id
|
|
217
|
+
executor
|
|
218
|
+
}
|
|
219
|
+
... on DevSessionEndedError {
|
|
220
|
+
message
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
`);async function Qa(e){return(await Ln(e)).map(r=>r.executor)}async function Ja(e,n){let r=await Ln(e);if(r.isErr())return Q(r.error);let o=(await u({config:e,document:Zt,variables:{devSessionId:r.value.id,executor:n}})).setDevSessionExecutor;return o==null?Q({kind:"empty-response"}):o.__typename!=="DevSession"?Q({kind:"session-ended"}):qn(o.executor)}async function Ln(e){let n=await Nn(e);return n.kind==="active"?qn({executor:n.executor,id:n.id}):Q({kind:n.kind==="starting"?"starting":"no-session"})}export{Nn as a,La as b,Ha as c,Yi as d,Xi as e,Zi as f,ia as g,sa as h,la as i,da as j,ca as k,ua as l,pa as m,fa as n,ya as o,ga as p,ma as q,ro as r,to as s,Y as t,oo as u,Co as v,vr as w,Go as x,ae as y,Lr as z,ue as A,kt as B,st as C,lt as D,dt as E,Et as F,ba as G,Ca as H,Pa as I,Aa as J,Ma as K,$a as L,Qa as M,Ja as N};
|
|
@@ -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{b as u}from"./chunk-
|
|
4
|
+
import{b as u}from"./chunk-N2OBRCPQ.js";import{a as f}from"./chunk-JJ4QQPAV.js";import{a as m}from"./chunk-7WZ3VIUU.js";import{f as c}from"./chunk-TPHOSZAK.js";import{i as p}from"./chunk-RIVHBABX.js";import{n as l}from"./chunk-L2ZJK7MP.js";import v from"path";import h from"picomatch";import*as s from"zod/mini";var w=s.looseObject({file_path:s.string()}),R=async n=>{let i=w.safeParse(n.tool_input);if(!i.success)return;let d=i.data.file_path,{cwd:t}=n;if(!m(t)||!c(t))return;let r=v.relative(t,d);if(r.startsWith(".."))return;let{ignorePaths:b,watchPaths:k}=f(),P=h([...k]),g=h([...b]);if(!P(r)||g(r))return;let o=await l(t);if(u({cwd:t,tests:o.isOk()?o.value.workflows.map(e=>({intent:e.intent,name:e.name,sourcePath:e.sourcePath??null,stub:e.stub})):void 0}),o.isErr())return;let a=p(o.value);if(a.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: stub workflows still unimplemented \u2014 ${a.join(", ")}. Implement with \`workflow("Intent", () => ({ given, steps }))\`.`,hookEventName:"PostToolUse"}}};export{R as a};
|
|
@@ -1,9 +1,9 @@
|
|
|
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 c}from"./chunk-OQ6KNYPG.js";import{c as p}from"./chunk-
|
|
5
|
-
`)}}}function A({failed:e,notRun:n,passed:r}){let o=n>0?`, ${String(n)} not run`:"";return`${String(r)} passed, ${String(e)} failed${o} (${String(r+e+n)} total)`}function
|
|
6
|
-
`);case"error":return`${t.bad("error")} ${r} \u2014 ${w(n.outcome.detail)} ${t.dim(n.runId)}`;case"dispatch-error":return`${t.bad("error")} ${r} \u2014 ${y(n.outcome.reason)}`;case"dispatch-timeout":return`${t.bad("error")} ${r} \u2014 not run: dispatch timed out (transient): ${n.outcome.detail}`;case"infra-error":return`${t.bad("error")} ${r} \u2014 not run: Ripplo server unreachable: ${n.outcome.detail}`}}var h={MAX_AGENTS:"agent limit reached for your plan \u2014 upgrade to add more",MAX_CONCURRENT_RUNS:"concurrent run limit reached for your plan \u2014 upgrade or wait for runs to finish",MAX_PROJECTS:"project limit reached for your plan \u2014 upgrade to add more",MAX_RUNS:"run limit reached for your plan \u2014 enable overage or upgrade",OVERAGE_CAP:"overage cap reached \u2014 raise the cap or upgrade"};function
|
|
4
|
+
import{a as c}from"./chunk-OQ6KNYPG.js";import{c as p}from"./chunk-7W237JFM.js";import{c as l}from"./chunk-FEHVIHVA.js";import{a}from"./chunk-MHNGR6M7.js";import{g as t,l as u}from"./chunk-4GA5662U.js";import{X as d}from"./chunk-XJJDHGK4.js";var g=3e3;async function R(e){l(e);let n=p(e).unwrapOr(void 0);if(n==null)return null;try{return await fetch(`${n.ripploServerUrl}/health`,{signal:AbortSignal.timeout(g)}),null}catch(r){return{detail:r instanceof Error?r.message:String(r),serverUrl:n.ripploServerUrl}}}function m(e){return e.includes("localhost")||e.includes("127.0.0.1")}import f from"fuse.js";function s(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return`No tests selected \u2014 scope empty, no dirty .ripplo/workflows files. Pass test ids, add to scope (${a("run")}), or use --all.`;case"unknown-ids":{let n=e.known,r=e.unknown.flatMap(i=>b(i,n)),o=r.length>0?[`Did you mean: ${[...new Set(r)].join(", ")}`]:[];return[`Unknown ${e.unknown.length===1?"id":"ids"}: ${e.unknown.join(", ")}`,...o,"Pass a workflow slug for all its tests, or workflow/test for one. Known workflows:",...n.map(i=>` ${i}`)].join(`
|
|
5
|
+
`)}}}function A({failed:e,notRun:n,passed:r}){let o=n>0?`, ${String(n)} not run`:"";return`${String(r)} passed, ${String(e)} failed${o} (${String(r+e+n)} total)`}function N({debugDir:e,event:n}){let r=`${n.workflowName} \u2192 ${n.testName}`;if(n.kind==="test-started")return`${t.dim("run ")} ${r}`;switch(n.outcome.kind){case"pass":return`${t.good("pass")} ${r} ${t.dim(n.runId)}`;case"findings":return[`${t.bad("fail")} ${r} \u2014 ${c(n.outcome.findingLines.length,"finding")}`,...n.outcome.findingLines,u({debugDir:e,runId:n.runId}),`${t.dim("why")} npx ripplo explain ${n.runId}`].join(`
|
|
6
|
+
`);case"error":return`${t.bad("error")} ${r} \u2014 ${w(n.outcome.detail)} ${t.dim(n.runId)}`;case"dispatch-error":return`${t.bad("error")} ${r} \u2014 ${y(n.outcome.reason)}`;case"dispatch-timeout":return`${t.bad("error")} ${r} \u2014 not run: dispatch timed out (transient): ${n.outcome.detail}`;case"infra-error":return`${t.bad("error")} ${r} \u2014 not run: Ripplo server unreachable: ${n.outcome.detail}`}}var h={CLOUD_EXECUTOR:"cloud runs are not included on your plan \u2014 upgrade to run in the cloud",MAX_AGENTS:"agent limit reached for your plan \u2014 upgrade to add more",MAX_CONCURRENT_RUNS:"concurrent run limit reached for your plan \u2014 upgrade or wait for runs to finish",MAX_PROJECTS:"project limit reached for your plan \u2014 upgrade to add more",MAX_RUNS:"run limit reached for your plan \u2014 enable overage or upgrade",MEMBER_CEILING:"member ceiling reached for the target plan \u2014 remove members or pick a bigger plan",OVERAGE_CAP:"overage cap reached \u2014 raise the cap or upgrade",REVIEW_QUOTA:"review quota reached for your plan \u2014 set an overage cap or upgrade"};function j({detail:e,serverUrl:n}){return m(n)?`Ripplo server at ${n} not running (${e}). Start the dev server with \`pnpm dev\`.`:`Ripplo server at ${n} unreachable (${e}) \u2014 server-side, not your local environment.`}function _(e){switch(e.code){case"compile-failed":{let n=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for full output.`,...n].join(`
|
|
7
7
|
`)}case"selection-conflicting-flags":return s({kind:"conflicting-flags"});case"selection-nothing-selected":return s({kind:"nothing-selected"});case"selection-unknown-ids":return s({kind:"unknown-ids",known:e.known,unknown:e.unknown});case"app-unreachable":return`Your dev server not responding at ${e.url} (${e.detail}) \u2014 your local environment, not the Ripplo server.`;case"engine-unreachable":return`Ripplo engine not responding at ${e.url} (${e.detail}) \u2014 adapter unmounted, behind a build error, or RIPPLO_ENGINE_URL points at the wrong path.`;case"scope-failed":return`Could not resolve the dev-session scope: ${e.detail}
|
|
8
|
-
Check the dev session is live (\`npx ripplo doctor\`, ${a("start")}), or pass test ids / --all.`;case"sync-failed":{let n=/401|unauthor/i.test(e.detail)?"\nAuth failure \u2014 run `npx ripplo auth login`.":"";return`Sync to the Ripplo server failed: ${e.detail}${n}`}case"bad-message":return"Daemon rejected the request \u2014 protocol mismatch, rebuild the CLI and restart the daemon."}}function
|
|
9
|
-
`);case"connection-lost":return"Lost the daemon connection mid-run \u2014 it crashed or was killed. Check .ripplo/.local/daemon.log, restart `npx ripplo daemon`.";case"not-running":return"No ripplo daemon running for this directory. Start it with `npx ripplo daemon` as a background process, separate from your app's dev server.";case"bad-frame":return"Malformed frame from the daemon \u2014 version mismatch, rebuild the CLI and restart the daemon."}}function $(e){return e.includes("ENOENT")?`${e} \u2014 node or the CLI entry not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}function w(e){return e==="worker-exit"?"run worker exited before reporting \u2014 usually a stale build. Run `pnpm build`, then `npx ripplo daemon stop` and start it again, then rerun.":e}function y(e){return e.type==="limit"?h[e.code]:`failed to dispatch (${e.detail})`}function b(e,n){return new
|
|
8
|
+
Check the dev session is live (\`npx ripplo doctor\`, ${a("start")}), or pass test ids / --all.`;case"sync-failed":{let n=/401|unauthor/i.test(e.detail)?"\nAuth failure \u2014 run `npx ripplo auth login`.":"";return`Sync to the Ripplo server failed: ${e.detail}${n}`}case"bad-message":return"Daemon rejected the request \u2014 protocol mismatch, rebuild the CLI and restart the daemon."}}function M(e){switch(e.kind){case"spawn-failed":return`Failed to start \`npx ripplo daemon\`: ${$(e.message)}`;case"connect-timeout":return[`Daemon did not come up within ${String(Math.round(e.deadlineMs/1e3))}s.`,`Check ${e.logPath} for startup errors.`,"Common causes: a stale daemon (`npx ripplo daemon stop`, then start it again), another daemon holding the dev lock, or the Ripplo server unreachable."].join(`
|
|
9
|
+
`);case"connection-lost":return"Lost the daemon connection mid-run \u2014 it crashed or was killed. Check .ripplo/.local/daemon.log, restart `npx ripplo daemon`.";case"not-running":return"No ripplo daemon running for this directory. Start it with `npx ripplo daemon` as a background process, separate from your app's dev server.";case"bad-frame":return"Malformed frame from the daemon \u2014 version mismatch, rebuild the CLI and restart the daemon."}}function $(e){return e.includes("ENOENT")?`${e} \u2014 node or the CLI entry not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}function w(e){return e==="worker-exit"?"run worker exited before reporting \u2014 usually a stale build. Run `pnpm build`, then `npx ripplo daemon stop` and start it again, then rerun.":e}function y(e){return e.type==="limit"?h[e.code]:`failed to dispatch (${e.detail})`}function b(e,n){return new f(n,{includeScore:!0,threshold:.5}).search(d(e)).slice(0,3).map(o=>o.item)}export{R as a,m as b,A as c,N as d,j as e,_ as f,M as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
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{b as s,c as u}from"./chunk-
|
|
4
|
+
import{b as s,c as u}from"./chunk-TPHOSZAK.js";import{createHash as d}from"crypto";import{mkdirSync as h,readdirSync as g,readFileSync as p,writeFileSync as m}from"fs";import i from"path";var l=[".ts",".tsx",".js",".jsx"],y=new Set([".local","debug"]);function v(r){let t=d("sha256");return u(r)?(t.update(s(["rev-parse","HEAD"],r)),t.update("\0"),t.update(s(["diff","HEAD"],r)),t.update("\0"),s(["ls-files","--others","--exclude-standard"],r).split(`
|
|
5
5
|
`).filter(e=>e.length>0).filter(e=>l.some(n=>e.endsWith(n))).toSorted((e,n)=>e.localeCompare(n)).forEach(e=>{t.update(e),t.update("\0"),t.update(c(i.join(r,e))),t.update("\0")}),t.digest("hex")):S(r,t)}function A(r,t){try{return p(f(r,t),"utf8").trim()}catch{return null}}function D(r,t,o){let e=f(r,t);h(i.dirname(e),{recursive:!0}),m(e,o)}function S(r,t){let o=i.join(r,".ripplo");return x(o).filter(n=>l.some(a=>n.endsWith(a))).filter(n=>!y.has(n.split(i.sep)[0]??"")).toSorted((n,a)=>n.localeCompare(a)).forEach(n=>{t.update(n),t.update("\0"),t.update(c(i.join(o,n))),t.update("\0")}),t.digest("hex")}function x(r){try{return g(r,{recursive:!0}).filter(t=>typeof t=="string")}catch{return[]}}function c(r){try{return p(r)}catch{return Buffer.alloc(0)}}function f(r,t){return i.join(r,".ripplo",".local",`${t}.hash`)}export{v as a,A as b,D as c};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 r}from"./chunk-OQ6KNYPG.js";import{a as s}from"./chunk-MHNGR6M7.js";import{a as k,b as C,c as F,d as b}from"./chunk-RIVHBABX.js";import{A as v,E as $,c as u,g as o,q as c,s as f,u as m,v as p,w as g,x as y,y as h,z as S}from"./chunk-4GA5662U.js";import{K as d,R as l}from"./chunk-XJJDHGK4.js";async function P({cwd:e,lockfile:n}){let i=c(n),a=b(d(l,n));if(C({context:i,cwd:e})===a)return[];k({context:i,cwd:e});let t=await x(n);return F({cleanLockfileHash:t.length===0?a:null,context:i,cwd:e}),t}async function x(e){let n=u(e),i=await f(e),a=await m({context:c(e),facts:i.facts});return[...g(e).map(t=>({kind:"missing-precondition",missing:t})),...p(n,i.dataRules).map(t=>({gap:t,kind:"cascade-gap"})),...a.map(t=>({conflict:t,kind:"fact-conflict"})),...y(e).map(t=>({kind:"unreachable-interaction",violation:t})),...h(e).map(t=>({kind:"redundant-assertion",redundancy:t})),...S(e).map(t=>({kind:"unmodeled-surface",surface:t})),...v(e).map(t=>({content:t,kind:"unpinned-surface-content"}))]}function U(e){return`${o.good("ok")} \u2014 no static model violations (${r(e,"test")})`}function O(e){let i=e.some(a=>a.kind==="unmodeled-surface")?[`Elements that hide together are one surface. ${s("create","surfaces")}`]:[];return[`${o.bad("fail")} \u2014 ${r(e.length,"static model violation")}:`,...e.map(a=>$(a)),...i].join(`
|
|
5
|
+
|
|
6
|
+
`)}function E(e){return[`${o.warn("warn")} \u2014 ${r(e.length,"model coverage gap")} (not blocking):`,...e.map(n=>` ${A(n)}`),`Stub the missing flows. ${s("discover")}`].join(`
|
|
7
|
+
`)}function A(e){switch(e.kind){case"entity-never-given":return`${e.entity} \u2014 declared but no test seeds it`;case"entity-never-mutated":return`${e.entity} \u2014 seeded but never asserted created/updated/deleted`;case"unmatchable-delete-key":return`test ${e.workflow}/${e.testSlug} asserts ${e.entity} deleted with literal ${e.field} but no seeded ${e.entity} sets ${e.field} \u2014 solver treats it as no-match`}}export{P as a,U as b,O as c,E as d};
|
|
@@ -1,6 +1,6 @@
|
|
|
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{
|
|
4
|
+
import{B as i,f as t}from"./chunk-4GA5662U.js";function m(e){switch(e.kind){case"empty-response":return"ripplo daemon: cloud tunnel provisioning returned no result. Check server logs and retry.";case"server-error":return`ripplo daemon: cloud tunnel provisioning failed (${e.typename}). Run \`npx ripplo doctor\` to check your setup.`}}function g(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function f({projectId:e,serverUrl:n}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${n}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
|
|
5
5
|
`)}function h(){return"Not signed in. Run `npx ripplo auth login`, then start the daemon again."}function x({devSessionId:e,version:n}){return`ripplo daemon: v${n} ready as local executor for session ${e} (switch with \`npx ripplo executor cloud\` \u2014 Ctrl-C to stop)`}function k({cwd:e,pid:n}){return`ripplo daemon: another daemon is already running for this project${n==null?"":` (pid ${String(n)})`} (cwd ${e}) \u2014 this one is exiting. Run \`npx ripplo daemon status\` to inspect it, or \`npx ripplo daemon stop\` to stop it.`}function y(e){switch(e.kind){case"not-running":return"ripplo daemon: not running.";case"stopped":return`ripplo daemon: stopped (pid ${String(e.pid)}).`;case"timeout":return`ripplo daemon: pid ${String(e.pid)} did not exit within 10s \u2014 it may be finishing a run. Check again with \`npx ripplo daemon status\`.`}}function $(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function w(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but no reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:n}=e,r=n.version==null?"version unknown (pre-0.7.8)":`v${n.version}`,s=`${String(n.active)} active, ${String(n.queued)} queued`,p=l(n.explorer,n.exploring),o=`daemon: running (${r} | ${s} | ${p} | ${d(n.progress)})`;if(n.sseHealth!=null&&!n.sseHealth.ok){let a=n.sseHealth.detail==null?"":`: ${n.sseHealth.detail}`;return`${o}
|
|
6
6
|
daemon: cannot subscribe to run dispatch${a} \u2014 server-side, restarting the daemon will not help`}return o}function d(e){return e.attempts===0?"explore: idle":`explore: ${String(e.attempts)} attempts, ${String(e.findings)} findings`}function b(e){let n=e.daemonVersion==null?"an older build":`v${e.daemonVersion}`;return e.kind==="restarted"?`ripplo: daemon was on ${n} \u2014 restarted on the current build`:`ripplo: daemon is on a stale build (${n}) with runs in flight \u2014 rerun once it drains, or npx ripplo daemon restart`}function v(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.contradictions.map(n=>i({contradiction:n,evidencePath:`.ripplo/debug/${e.runId}/behavior.jsonl`})),kind:"findings"};case"error":return{detail:t(e.error),kind:"error"};case"dispatch-failed":return{kind:"dispatch-error",reason:{detail:e.reason,type:"generic"}}}}function l(e,n){switch(e.kind){case"off":return"explorer: off";case"on":return`explorer: on, ${String(n)} exploring`;case"paused":return"explorer: paused for active runs or a short cooldown \u2014 resumes on its own";case"blocked":return`explorer: blocked \u2014 ${u(e.reason)}`}}function u(e){switch(e){case"no-lockfile":return"no lockfile found, run npx ripplo compile";case"unstamped":return"lockfile has no compiled checks, run npx ripplo compile";case"expander-newer":return"lockfile predates the current CLI build, run npx ripplo compile";case"dsl-drift":return"workflow sources changed since the last compile, run npx ripplo compile";case"load-failed":return"workflow definitions do not compile, run npx ripplo compile for details"}}export{m as a,g as b,f as c,h as d,x as e,k as f,y as g,$ as h,w as i,d as j,b as k,v as l};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{b as w,c as P}from"./chunk-CB74TAUC.js";import{a as m}from"./chunk-MOI4L3EX.js";import{a as u,c as y,d as g}from"./chunk-FJPJDGSS.js";import{a as h}from"./chunk-OQ6KNYPG.js";import{f as S}from"./chunk-7CELUIVK.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f as k}from"./chunk-TPHOSZAK.js";import{a as l}from"./chunk-5DT43ABQ.js";import{a as s}from"./chunk-MHNGR6M7.js";import{e as f,f as p}from"./chunk-RIVHBABX.js";import{b as d}from"./chunk-4GA5662U.js";import{createHash as b}from"crypto";import*as a from"zod/mini";var v=a.looseObject({file_path:a.string()}),J=async e=>{let o=v.safeParse(e.tool_input);if(!o.success||!/\/\.ripplo\/.*\.ts$/.test(o.data.file_path))return;let{cwd:t}=e;if(!c(t))return;if(!k(t))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL compile and lockfile sync did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let r=await f(t);if(r.isErr())return{decision:"block",reason:`${l(r.error)}
|
|
5
|
+
${s("create","DSL authoring rules")}`};let n=await F({cwd:t,filePath:o.data.file_path,lockfile:r.value});if("block"in n)return{decision:"block",reason:n.block};let{addedSlugs:i}=await S({cwd:t,editedPath:o.data.file_path,lockfile:r.value,requireHooks:!0,syncFirst:!0});return L(z({addedSlugs:i,cwd:t,elsewhere:n.elsewhere,lockfile:r.value}))};function z({addedSlugs:e,cwd:o,elsewhere:t,lockfile:r}){return[...e.length>0?[`Auto-scoped ${e.join(", ")} (dirty tests).`]:[],...t>0?[A(t).trimStart()]:[],...H(o,r)]}async function F({cwd:e,filePath:o,lockfile:t}){let r=await u({cwd:e,lockfile:t});await p(e,t);let n=N(r,t,o),i=r.length-n.length;return n.length===0?{elsewhere:i}:{block:`${y(n)}${A(i)}
|
|
6
|
+
${s("create")}`}}function N(e,o,t){let r=new Set(d(o).filter(({workflow:n})=>n.sourcePath!=null&&t.endsWith(n.sourcePath)).map(({ref:n})=>n));return r.size===0?e:e.filter(n=>{let i=R(n);return i==null||r.has(i)})}function R(e){return e.kind==="unreachable-interaction"?e.violation.test:e.kind==="redundant-assertion"?e.redundancy.test:e.kind==="missing-precondition"?e.missing.test:null}function A(e){return e===0?"":`
|
|
7
|
+
${h(e,"finding")} in other files \u2014 \`npx ripplo compile\` for the full list.`}function L(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
|
|
8
|
+
`),hookEventName:"PostToolUse"}}}function H(e,o){let t=m(o),r=b("sha256").update(JSON.stringify(t)).digest("hex");return w(e,"coverage-warn")===r?[]:(P(e,"coverage-warn",r),t.length===0?[]:[g(t)])}export{J as a};
|
|
@@ -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{f as a}from"./chunk-
|
|
4
|
+
import{f as a}from"./chunk-OES7HGNF.js";import{a as n}from"./chunk-5DT43ABQ.js";import{i}from"./chunk-RIVHBABX.js";import{n as e}from"./chunk-L2ZJK7MP.js";import{i as u}from"./chunk-GFKK7K6T.js";async function x(m){let o=process.cwd(),r=await e(o);r.isErr()&&(process.stderr.write(`${n(r.error)}
|
|
5
5
|
`),process.exit(1));let s=i(r.value),t=await a(o);if(m.format==="summary"){s.length>0&&process.stdout.write(`stub workflows: ${s.join(", ")}
|
|
6
6
|
`),process.stdout.write(`${u(t)}
|
|
7
7
|
`);return}let p={daemon:t.kind==="running"?{active:t.status.active,explorer:t.status.explorer,exploring:t.status.exploring,progress:t.status.progress,queued:t.status.queued,running:!0}:{running:t.kind==="unresponsive",state:t.kind},tests:s.map(d=>({id:d,implemented:!1}))};process.stdout.write(`${JSON.stringify(p,null,2)}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
+
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
+
import{b as E}from"./chunk-LOEAZGYO.js";import{a as U}from"./chunk-NNH3YVVO.js";import{b as $}from"./chunk-KMZ3L5YA.js";var F=15e3,G=3,L=300,f=class extends Error{detail;serverUrl;constructor({detail:r,serverUrl:t}){super(`Failed to connect to Ripplo server at ${t}. Check the server is running and reachable. Details: ${r}`),this.name="GqlConnectionError",this.detail=r,this.serverUrl=t}},u=class extends Error{errors;constructor(r){super(r.map(t=>t.message).join(", ")),this.name="GqlRequestError",this.errors=r}};function N(e){if(e instanceof u)return e.errors[0]?.extensions?.code}var j={attempts:G,timeoutMs:F},V={attempts:1,timeoutMs:3e3};async function x(e){return T(e,j)}async function W(e){return T(e,V)}async function T(e,r){let{print:t}=await import("graphql"),n=t(e.document),o=JSON.stringify({query:n,variables:e.variables}),a=`${e.config.ripploServerUrl}/graphql`,s=await B({init:{body:o,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json",...E()},method:"POST"},policy:r,serverUrl:e.config.ripploServerUrl,url:a}),l=await J({res:s,url:a});if(!Q(l))throw new Error("Invalid GraphQL response");if(X(l))throw new u(l.errors);if(l.data==null)throw new Error("No data returned from server");return l.data}async function B({init:e,policy:r,serverUrl:t,url:n}){let o=1,a=await b({init:e,timeoutMs:r.timeoutMs,url:n});for(;a.retryable&&o<r.attempts;)await K(H(o)),o+=1,a=await b({init:e,timeoutMs:r.timeoutMs,url:n});let{response:s}=a;if(s!=null&&s.status<500)return s;throw new f({detail:s==null?a.detail:`server returned status ${String(s.status)}`,serverUrl:t})}async function b({init:e,timeoutMs:r,url:t}){try{let n=await fetch(t,{...e,signal:AbortSignal.timeout(r)});return{detail:"",response:n,retryable:n.status>=500}}catch(n){return{detail:n instanceof Error?n.message:String(n),response:void 0,retryable:!0}}}function H(e){return L*3**(e-1)*(.5+Math.random())}function K(e){return new Promise(r=>{setTimeout(r,e)})}async function J({res:e,url:r}){let t=await e.text();if(t.length===0)throw new Error(`Empty response from Ripplo server at ${r} (status ${String(e.status)}). The server may have restarted or the request was rejected before a body was sent.`);try{return JSON.parse(t)}catch{throw new Error(`Non-JSON response from Ripplo server at ${r} (status ${String(e.status)}): ${t.slice(0,200)}`)}}function Q(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function X(e){return Array.isArray(e.errors)&&e.errors.length>0}import Y from"pino";import z from"pino-pretty";var y=Y({level:process.env.LOG_LEVEL??"info"},z({ignore:"pid,hostname"}));import{readdir as Z,rm as ee,stat as re}from"fs/promises";import{existsSync as k}from"fs";import w from"path";var v=".uploaded";var C=w.join(process.cwd(),".ripplo","debug"),D=360*60*1e3;async function te({maxRuns:e}){try{let t=(await Z(C,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let m=w.join(C,i.name),O=await re(m);return{dirPath:m,mtime:O.mtimeMs,pendingUpload:ne(m)}})),a=o.filter(i=>n-i.mtime>D),s=o.filter(i=>n-i.mtime<=D&&!i.pendingUpload).toSorted((i,m)=>m.mtime-i.mtime).slice(e),l=[...a,...s];if(l.length===0)return;await Promise.allSettled(l.map(i=>ee(i.dirPath,{force:!0,recursive:!0}))),y.debug("Pruned %d old debug run(s)",l.length)}catch{y.warn("Debug run pruning failed, ignoring")}}function ne(e){return k(w.join(e,"behavior.jsonl"))&&!k(w.join(e,v))}import d from"fs";import oe from"os";import g from"path";var ie=".local",ae=".ripplo";function h(e){return g.join(e,".ripplo",ie)}function se(e){let r=h(e);d.existsSync(r)||d.mkdirSync(r,{recursive:!0});let t=g.join(r,".gitignore");return d.existsSync(t)||d.writeFileSync(t,`*
|
|
5
|
+
`),r}function le(e,r){return g.join(h(e),r)}function P(){return g.join(oe.homedir(),ae)}function S(){let e=P();return d.existsSync(e)?d.chmodSync(e,448):d.mkdirSync(e,{mode:448,recursive:!0}),e}function A(e){return g.join(P(),e)}import{Agent as de,RetryAgent as ce,setGlobalDispatcher as me}from"undici";var ue=1500,ge=4e3,pe=3,fe=50,ye=100,I=!1;function we(){if(I)return;I=!0;let e=new de({connections:ye,keepAliveMaxTimeout:ge,keepAliveTimeout:ue}),r=new ce(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:pe,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:fe});me(r)}import{graphql as p}from"gql.tada";var We=p(`
|
|
6
|
+
query AgentReviewContextWorker($reviewId: String!) {
|
|
7
|
+
agentReview(id: $reviewId) {
|
|
8
|
+
id
|
|
9
|
+
runId
|
|
10
|
+
agentProfile {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
description
|
|
14
|
+
output
|
|
15
|
+
successCriteria
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`);var Be=p(`
|
|
20
|
+
mutation StartAgentReviewWorker($reviewId: String!) {
|
|
21
|
+
startAgentReview(reviewId: $reviewId)
|
|
22
|
+
}
|
|
23
|
+
`);var He=p(`
|
|
24
|
+
mutation CompleteAgentReviewWorker(
|
|
25
|
+
$reviewId: String!
|
|
26
|
+
$markdown: String!
|
|
27
|
+
$shortSummary: String!
|
|
28
|
+
$verdict: AgentReviewVerdict!
|
|
29
|
+
$comments: [AgentReviewCommentInput!]!
|
|
30
|
+
) {
|
|
31
|
+
completeAgentReview(
|
|
32
|
+
reviewId: $reviewId
|
|
33
|
+
markdown: $markdown
|
|
34
|
+
shortSummary: $shortSummary
|
|
35
|
+
verdict: $verdict
|
|
36
|
+
comments: $comments
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
`);var Ke=p(`
|
|
40
|
+
mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
|
|
41
|
+
updateAgentReviewProgress(reviewId: $reviewId, text: $text)
|
|
42
|
+
}
|
|
43
|
+
`);var Je=p(`
|
|
44
|
+
mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
|
|
45
|
+
failAgentReview(reviewId: $reviewId, reason: $reason)
|
|
46
|
+
}
|
|
47
|
+
`);import c from"fs";import _ from"path";function Re(e){let r=process.env.RIPPLO_TOKEN;if(r!=null&&r.trim().length>0)return r.trim();let t=R(e);if(!c.existsSync(t))return null;let n=c.readFileSync(t,"utf8").trim();return n.length===0?null:n}function ve({serverUrl:e,token:r}){S();let t=R(e);c.mkdirSync(_.dirname(t),{mode:448,recursive:!0}),c.writeFileSync(t,r+`
|
|
48
|
+
`,{mode:384})}function he(e){let r=R(e);return c.existsSync(r)?(c.unlinkSync(r),!0):!1}function R(e){return A(_.join("tokens",Pe(e)))}function Pe(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var M=$(U(),1);import q from"crypto";function Se({body:e,secret:r}){let t=new M.Webhook(r),n=`msg_${q.randomUUID()}`,o=new Date,a=t.sign(n,o,e),s=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":a,"webhook-timestamp":String(s)}}function Ae(){return`whsec_${q.randomBytes(24).toString("base64")}`}export{f as a,u as b,N as c,x as d,W as e,y as f,v as g,te as h,se as i,le as j,Re as k,ve as l,he as m,R as n,we as o,Se as p,Ae as q};
|