ripplo 0.9.6 → 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.
Files changed (44) hide show
  1. package/dist/{chunk-WCSDBWCI.js → chunk-22JUAYHM.js} +1 -1
  2. package/dist/{chunk-BDWNZMUM.js → chunk-2Q7VXQYN.js} +1 -1
  3. package/dist/{chunk-5IMT3SAH.js → chunk-6VUSLPQD.js} +1 -1
  4. package/dist/{chunk-CY5FJBHP.js → chunk-7CELUIVK.js} +1 -1
  5. package/dist/{chunk-DK4NUWRX.js → chunk-7W237JFM.js} +1 -1
  6. package/dist/{chunk-TPQIFYHW.js → chunk-AGK6XOX2.js} +1 -1
  7. package/dist/{chunk-TQANCEOL.js → chunk-BJWGAKKD.js} +3 -3
  8. package/dist/{chunk-NOT5PEHM.js → chunk-BNMS3N54.js} +1 -1
  9. package/dist/{chunk-VCY2CEE2.js → chunk-CAS7MBA7.js} +1 -1
  10. package/dist/{chunk-HD7WIBP2.js → chunk-CB74TAUC.js} +1 -1
  11. package/dist/{chunk-GKYP7AMJ.js → chunk-GZPE7I7U.js} +1 -1
  12. package/dist/{chunk-A5EBMT2E.js → chunk-IG7J452B.js} +1 -1
  13. package/dist/chunk-IPSXNIXC.js +48 -0
  14. package/dist/{chunk-6SYRXU4Q.js → chunk-N2OBRCPQ.js} +1 -1
  15. package/dist/{chunk-Z6UPZDW6.js → chunk-OAU4HUD2.js} +1 -1
  16. package/dist/{chunk-5D6PNHDQ.js → chunk-OES7HGNF.js} +1 -1
  17. package/dist/{chunk-36NPGS6X.js → chunk-R3DZ6JPY.js} +1 -1
  18. package/dist/{chunk-SXDYA2OR.js → chunk-SNU66GSR.js} +1 -1
  19. package/dist/{chunk-T76D4SYI.js → chunk-TPCKMDWU.js} +1 -1
  20. package/dist/{chunk-AIIZRQXH.js → chunk-TPHOSZAK.js} +1 -1
  21. package/dist/{chunk-NOKKMFJP.js → chunk-YQ2RBEOJ.js} +1 -1
  22. package/dist/daemon-3IWI7VQT.js +152 -0
  23. package/dist/{daemon-lock-YRKNXWGO.js → daemon-lock-OAARBZ4O.js} +1 -1
  24. package/dist/{exit-plan-gate-X3TX6QWS.js → exit-plan-gate-HSTV7UO4.js} +1 -1
  25. package/dist/hook.js +1 -1
  26. package/dist/index.js +2 -2
  27. package/dist/{plan-reminder-AR3TJXLA.js → plan-reminder-FZSSUVNB.js} +1 -1
  28. package/dist/{post-edit-VUBL7RDW.js → post-edit-333UCJ6G.js} +1 -1
  29. package/dist/{post-edit-analyze-ECCVJCPQ.js → post-edit-analyze-JFWA223C.js} +1 -1
  30. package/dist/{post-edit-flag-stubs-AHP6XA2S.js → post-edit-flag-stubs-IZSAIM4O.js} +1 -1
  31. package/dist/{pre-bash-run-gate-LQK52CAV.js → pre-bash-run-gate-B42YNDQF.js} +1 -1
  32. package/dist/{pre-edit-4MNJA3OT.js → pre-edit-WZJVD3J4.js} +1 -1
  33. package/dist/{pre-edit-ripplo-skill-gate-XJHLJN2F.js → pre-edit-ripplo-skill-gate-QHUD7QGU.js} +1 -1
  34. package/dist/{pre-edit-scope-gate-K5NYCES7.js → pre-edit-scope-gate-2YIFSEDY.js} +1 -1
  35. package/dist/{pre-edit-watch-gate-5YWMODVX.js → pre-edit-watch-gate-GQZYMDOC.js} +1 -1
  36. package/dist/{prompt-submit-PXMO75JB.js → prompt-submit-LE5LR62B.js} +1 -1
  37. package/dist/scope-reminder-DIDCHDAA.js +4 -0
  38. package/dist/{status-2FS6ZFIU.js → status-H5WYYH4J.js} +1 -1
  39. package/dist/{stop-enforce-56SLPUYT.js → stop-enforce-EH2SC7ND.js} +1 -1
  40. package/dist/{tasks-reminder-OJEB6HE5.js → tasks-reminder-SDS6RNLP.js} +1 -1
  41. package/package.json +2 -2
  42. package/dist/chunk-AJXAWZQO.js +0 -48
  43. package/dist/daemon-ZHTQ472Q.js +0 -152
  44. package/dist/scope-reminder-LDBXUQZH.js +0 -4
@@ -0,0 +1,152 @@
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,C as Xe,D as Ye,E as Ze,G as er,H as N,I as B,J as rr,K as nr,L as K,M as tr,e as Pe,i as Ue,j as We,k as $e,l as Me,m as _e,n as Oe,o as Fe,p as je,r as C,s as L,t as Ne,u as j,v as ze,w as Je,x as Ge,z as Ve}from"./chunk-BJWGAKKD.js";import{d as Te}from"./chunk-22JUAYHM.js";import{a as Be,c as Ke,d as Qe,e as h}from"./chunk-7CELUIVK.js";import{c as S}from"./chunk-7W237JFM.js";import{e as Ie}from"./chunk-TPHOSZAK.js";import{a as ue}from"./chunk-R4ZTRVDQ.js";import{c as se}from"./chunk-FEHVIHVA.js";import{b as me}from"./chunk-V4CLXOCP.js";import{a as P}from"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import{g as Re,h as T}from"./chunk-RIVHBABX.js";import{a as pe,l as k,m as fe,n as E}from"./chunk-L2ZJK7MP.js";import{e as be,f as Ee}from"./chunk-R3DZ6JPY.js";import{a as te,c as oe,d as u,f as s,g as ie,h as F,i as ae}from"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import{b as Ce,c as Le,d as Ae,e as De,f as qe,h as He}from"./chunk-GFKK7K6T.js";import{F as ge,I,J as Se,K as ke,M as he,N as we,Q as ve,X as xe,a as ye}from"./chunk-4GA5662U.js";import{K as le,R as de,X as ce}from"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import to from"path";import{createClient as oo}from"graphql-sse";import{graphql as ee}from"gql.tada";import An,{AbortError as Dn}from"p-retry";import{graphql as fn}from"gql.tada";import{print as mn}from"graphql";async function or({config:e,cwd:r,headed:n,pool:t,runId:o,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let c=await k(r);if(c.isErr())return await A({config:e,ownerToken:null,reason:`lockfile:${c.error.kind}`,runId:o}),{kind:"dispatch-error",reason:{detail:`lockfile:${c.error.kind}`,type:"generic"}};let p=pn(c.value,{testSlug:a,workflowSlug:d});if(p==null)return await A({config:e,ownerToken:null,reason:`no-test:${d}/${a}`,runId:o}),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let f=await C({headed:n,workClass:l,task:()=>t.execute({headed:n,runId:o,testRef:p},i)});return!f.serverNotified&&f.outcome.kind==="error"&&await A({config:e,ownerToken:null,reason:f.outcome.detail,runId:o}),f.outcome}function pn(e,{testSlug:r,workflowSlug:n}){let o=e.workflows.find(i=>ce(i.name)===n)?.tests.find(i=>i.slug===r);return o==null?void 0:ye(o)}var yn=6e4,gn=fn(`
5
+ subscription RunRequestedWatch($devSessionId: String!) {
6
+ runRequested(devSessionId: $devSessionId) {
7
+ runId
8
+ testSlug
9
+ workflowId
10
+ workflowSlug
11
+ }
12
+ }
13
+ `);async function ir(e){let r=Math.min(1e3*2**e,yn)+wn();await new Promise(n=>setTimeout(n,r))}function ar({claim:e,cwd:r,devSessionId:n,onSubscriptionDead:t,pool:o,sseClient:i,sseHealth:a}){let l=new Set,d=Sn(r);return i.subscribe({query:mn(gn),variables:{devSessionId:n}},{complete:()=>{s.warn("runRequested SSE completed unexpectedly; re-registering session"),t("stream completed")},error:c=>{let p=c instanceof Error?c.message:String(c);s.warn("runRequested SSE failed: %s; re-registering session",p),t(p)},next:c=>{kn({claim:e,dispatchConfig:d,event:c.data?.runRequested,inFlightRunIds:l,pool:o})}},{connected:()=>{a.onConnected()},connecting:c=>{a.onConnecting(c),c&&s.debug("runRequested SSE reconnecting")}})}function Sn(e){return se(e),{config:S(e).match(r=>r,r=>{s.error({failure:r},"failed to load env for run dispatch")}),cwd:e}}function kn({claim:e,dispatchConfig:r,event:n,inFlightRunIds:t,pool:o}){if(n==null)return;if(t.has(n.runId)){s.warn({runId:n.runId,workflowSlug:n.workflowSlug},"duplicate runRequested event; skipping dispatch");return}if(r.config==null){s.error({runId:n.runId},"run dispatch skipped, env failed to load at startup");return}t.add(n.runId),process.stdout.write(`ripplo: run ${n.workflowSlug}
14
+ `);let i=hn(e(n.runId),n);i.started(),or({config:r.config,cwd:r.cwd,headed:i.headed,pool:o,runId:n.runId,signal:i.signal,testSlug:n.testSlug,workClass:i.workClass,workflowSlug:n.workflowSlug}).then(a=>{i.finished(a)}).catch(a=>{s.error({err:a,runId:n.runId,workflowSlug:n.workflowSlug},"run execution failed; daemon continuing"),i.finished({detail:a instanceof Error?a.message:String(a),kind:"error"})}).finally(()=>{t.delete(n.runId)})}function hn(e,r){return e==null?(s.debug({runId:r.runId,workflowSlug:r.workflowSlug},"dispatching unclaimed run (externally triggered or replayed)"),{headed:!1,signal:new AbortController().signal,workClass:"p0-ui",finished:()=>{},started:()=>{}}):{headed:e.headed,signal:Je(e.token),workClass:"p1-cli",finished:n=>{e.finished(r.runId,n)},started:()=>{e.started(r.runId)}}}function wn(){return Math.floor(Math.random()*2700)+300}import{graphql as Q}from"gql.tada";import{print as vn}from"graphql";var xn=Q(`
15
+ subscription TeleportRequestedWatch($devSessionId: String!) {
16
+ teleportRequested(devSessionId: $devSessionId) {
17
+ runId
18
+ stepIndex
19
+ kind
20
+ testSlug
21
+ workflowSlug
22
+ }
23
+ }
24
+ `),Rn=Q(`
25
+ query TeleportRunRepro($id: String!) {
26
+ run(id: $id) {
27
+ id
28
+ reproJson
29
+ }
30
+ }
31
+ `),bn=Q(`
32
+ mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
33
+ reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
34
+ }
35
+ `);function sr({cwd:e,devSessionId:r,onSubscriptionDead:n,sseClient:t}){let o=new Set,i=t.subscribe({query:vn(xn),variables:{devSessionId:r}},{complete:()=>{s.warn("teleportRequested SSE completed unexpectedly; re-registering session"),n("stream completed")},error:a=>{let l=a instanceof Error?a.message:String(a);s.warn("teleportRequested SSE failed: %s; re-registering session",l),n(l)},next:a=>{En({cwd:e,devSessionId:r,event:a.data?.teleportRequested,running:o})}});return()=>{o.forEach(a=>{a.abort()}),o.clear(),i()}}function En({cwd:e,devSessionId:r,event:n,running:t}){if(n==null)return;let o=new AbortController;t.add(o),Pn({cwd:e,devSessionId:r,event:n,signal:o.signal}).catch(i=>{s.error({err:i},"teleport failed; daemon continuing")}).finally(()=>{t.delete(o)})}async function Pn({cwd:e,devSessionId:r,event:n,signal:t}){let o=d=>In({cwd:e,devSessionId:r,runId:n.runId,status:d}),i=await Tn(e,n);if(i==null){s.warn({runId:n.runId},"teleport could not resolve target"),await o("unplannable");return}process.stdout.write(`ripplo: teleport ${Ln(n)} step ${String(n.stepIndex+1)}
36
+ `);let l=await er({cwd:e,onReady:()=>{o("opened")},signal:t,step:n.stepIndex+1,target:i});l.kind==="done"&&l.result.kind==="handed-over"||(s.warn({kind:l.kind,runId:n.runId},"teleport could not open"),await o(l.kind==="unplannable"?"unplannable":"error"))}async function In({cwd:e,devSessionId:r,runId:n,status:t}){let o=S(e).match(i=>i,()=>null);o!=null&&await u({config:o,document:bn,variables:{devSessionId:r,runId:n,status:t}}).catch(()=>null)}async function Tn(e,r){if(r.kind==="explore"){let n=await Cn(e,r.runId);return n==null?null:{kind:"explore",repro:n}}return r.testSlug==null||r.workflowSlug==null?null:{kind:"test",ref:`${r.workflowSlug}/${r.testSlug}`}}async function Cn(e,r){let n=S(e).match(o=>o,()=>null);if(n==null)return null;let t=await u({config:n,document:Rn,variables:{id:r}}).catch(()=>null);return t?.run?.reproJson==null?null:I.parse(JSON.parse(t.run.reproJson))}function Ln(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function lr({claim:e,config:r,cwd:n,initialId:t,pool:o,sseClient:i,sseHealth:a}){let l=t,d=null,c=m=>{y(m)},p=()=>{let m=ar({claim:e,cwd:n,devSessionId:l,onSubscriptionDead:c,pool:o,sseClient:i,sseHealth:a}),g=sr({cwd:n,devSessionId:l,onSubscriptionDead:c,sseClient:i});return()=>{m(),g()}},f=p(),M=async m=>{a.markUnhealthy(m);let g=await E(n);if(g.isErr()){s.error("re-register: compile failed: %s",P(g.error));return}let _=await z(()=>Ke({config:r,cwd:n,lockfile:g.value}),{config:r,label:"re-register sync"});f(),l=_.devSessionId,f=p(),s.info("re-registered dev session as %s",l)},y=m=>(d!=null||(d=M(m).finally(()=>{d=null})),d);return{getId:()=>l,reregister:()=>y("dev session ended server-side"),stop:()=>{f()}}}function z(e,{config:r,label:n}){let t=r.ripploServerUrl.includes("localhost")||r.ripploServerUrl.includes("127.0.0.1");return An(async()=>{try{return await e()}catch(o){if(qn({config:r,error:o}),!(o instanceof te)){let i=o instanceof Error?o.message:String(o);throw s.error("%s failed: %s",n,i),new Dn(i)}throw o}},{factor:2,maxTimeout:t?2e3:1e4,minTimeout:t?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:o,error:i})=>{s.warn("%s attempt %d failed \u2014 retrying: %s",n,o,i.message)}})}function qn({config:e,error:r}){let n=oe(r);n==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${Ae()}
37
+ `),process.exit(1)),n==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${Le({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
38
+ `),process.exit(1))}import{graphql as dr}from"gql.tada";var Hn=dr(`
39
+ query OpenFindingsForRetire($projectId: String!) {
40
+ exploreFindings(projectId: $projectId, status: open) {
41
+ signature
42
+ reproRun {
43
+ reproJson
44
+ }
45
+ }
46
+ }
47
+ `),Un=dr(`
48
+ mutation RetireStaleFinding($projectId: String!, $signature: String!) {
49
+ retireStaleFinding(projectId: $projectId, signature: $signature)
50
+ }
51
+ `);async function cr({config:e,cwd:r,lockfile:n}){let o=(await u({config:e,document:Hn,variables:{projectId:e.projectId}})).exploreFindings,i=await T(r,n);if(i.isErr())return s.info({block:i.error.kind},"skipping finding retire until next compile"),!1;let a=await Wn(o,i.value);return a.length===0||(await Promise.all(a.map(l=>Mn(e,l))),s.info({count:a.length},"retired findings whose trail no longer replays")),!0}async function Wn(e,r){return(await Promise.all(e.map(async t=>await $n(t,r)?t.signature:null))).filter(t=>t!=null)}async function $n(e,r){let n=e.reproRun?.reproJson;if(n==null)return!1;let t=I.safeParse(JSON.parse(n));return t.success?(await xe(r,t.data)).kind==="unplannable":!1}function Mn(e,r){return u({config:e,document:Un,variables:{projectId:e.projectId,signature:r}})}var _n=6e4;function ur(e){let r={retiredKey:null,running:!1,stopped:!1},n=async()=>{if(!(r.running||r.stopped)){r.running=!0;try{r.retiredKey=await On(e,r.retiredKey)}catch(o){s.warn({err:o},"retire stale findings failed \u2014 retrying on next tick")}finally{r.running=!1}}},t={timer:setTimeout(function o(){n(),r.stopped||(t.timer=setTimeout(o,_n))},0)};return()=>{r.stopped=!0,clearTimeout(t.timer)}}async function On({config:e,cwd:r},n){let t=await h(r),o=pe();if(t==null||o==null)return n;let i=`${t}@${o}`;if(i===n)return n;let a=await k(r);return a.isErr()?n:await cr({config:e,cwd:r,lockfile:a.value})?i:n}import{Agent as Fn,fetch as jn}from"undici";var Nn=3e4;function pr(e=Nn){let r=new Fn({bodyTimeout:e});return(n,t)=>jn(n,{...t,dispatcher:r})}function fr(){let e=!0,r,n=null,t=()=>{n!=null&&(clearTimeout(n),n=null)};return{markUnhealthy:o=>{e=!1,r=o,t()},onConnected:()=>{t(),n=setTimeout(()=>{e=!0,r=void 0,n=null},1e4)},onConnecting:()=>{t()},snapshot:()=>({detail:r,ok:e})}}import Bn from"fs";import Sr from"net";import{err as kr,ok as Kn}from"neverthrow";async function hr({cwd:e,onConnection:r}){ae(e);let n=Te(e),t=await mr({onConnection:r,socketPath:n});return t.isOk()||t.error.kind!=="stale-candidate"?t.map(yr(n)).mapErr(gr(n)):await Qn(n)?kr({kind:"already-running",socketPath:n}):(wr(n),(await mr({onConnection:r,socketPath:n})).map(yr(n)).mapErr(gr(n)))}function Qn(e){return new Promise(r=>{let n=Sr.connect(e);n.once("connect",()=>{n.destroy(),r(!0)}),n.once("error",()=>{r(!1)})})}async function mr(e){let r=await zn(e);return r.kind==="listening"?Kn(r.server):kr(r.error)}function zn({onConnection:e,socketPath:r}){return new Promise(n=>{let t=Sr.createServer(e);t.once("error",o=>{n({error:o.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:o.message},kind:"failed"})}),t.listen(r,()=>{n({kind:"listening",server:t})})})}function yr(e){return r=>({socketPath:e,close:()=>{r.close(),wr(e)}})}function wr(e){Bn.rmSync(e,{force:!0})}function gr(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as tt,randomUUID as ot}from"crypto";function vr(){return{attempts:0,backoffUntil:0,consecutiveErrors:0,desired:{active:!1,localWorkers:rr,maxTrailLength:nr},executorLocal:!0,findings:0,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"loading"},prevInteractiveActive:0,stopped:!1,trails:new Map}}function xr(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"tick":return J(e,r.now,r.queue);case"desired-changed":return J({...e,desired:r.desired},r.now,r.queue);case"executor-changed":return{effects:[],state:{...e,executorLocal:r.local}};case"load-settled":return Gn(e,r.outcome);case"trail-started":return{effects:[],state:{...e,trails:new Map([...e.trails,[r.id,{startedAt:r.now}]])}};case"trail-settled":return Vn(e,r);case"stopped":return{effects:[{ids:[...e.trails.keys()],kind:"abort"}],state:{...e,stopped:!0,trails:new Map}}}}function Rr(e,r,n){return K(Er(e),Pr(e,r,n)).health}function J(e,r,n){let t=Jn(e,r,n),o={...e,...t,prevInteractiveActive:n.active},i=K(Er(o),Pr(o,r,n)),a=o.lockfile.kind!=="ready"&&!o.loading;return{effects:[...a?[{kind:"load"}]:[],...i.abortIds.length>0?[{ids:i.abortIds,kind:"abort"}]:[],...i.launchCount>0?[{count:i.launchCount,kind:"launch",maxTrailLength:o.desired.maxTrailLength}]:[]],state:{...o,loading:o.loading||a}}}function Jn(e,r,n){return n.active<e.prevInteractiveActive?{backoffUntil:Math.max(e.backoffUntil,r+B)}:{backoffUntil:e.backoffUntil}}function Gn(e,r){return r.kind==="blocked"?{effects:[],state:{...e,loading:!1,lockfile:{kind:"blocked",reason:r.reason}}}:{effects:[],state:{...e,consecutiveErrors:0,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"ready"}}}}function Vn(e,r){let n=new Map([...e.trails].filter(([i])=>i!==r.id)),t=Xn({...e,trails:n},r.settled,r.now),o=J(t.state,r.now,r.queue);return{effects:[...t.effects,...o.effects],state:o.state}}function Xn(e,r,n){switch(r.kind){case"aborted":case"crashed":return{effects:[],state:e};case"app-unreachable":return br({category:"driver",now:n,state:e,subject:"app-unreachable"});case"error":return Yn(e,r.error,n);case"done":return et(e,r.result)}}function Yn(e,r,n){if(r.source==="lockfile-stale")return{effects:[{kind:"reload"}],state:{...e,loading:!0,lockfile:{kind:"loading"}}};let t=Se(r);return t==="trail"?{effects:[],state:{...e,consecutiveErrors:0,lastUnhealthyReportAt:null}}:br({category:t,now:n,state:e,subject:Zn(r)})}function Zn(e){switch(e.source){case"transport":case"config":return`${e.source}: ${e.detail}`;case"runtime":return`runtime: ${e.kind}`;case"empty-trail":case"bad-assign":case"lockfile-stale":return e.source}}function et(e,r){let n=r.kind==="finding";return{effects:[{finding:n,kind:"report",result:r}],state:{...e,attempts:e.attempts+1,consecutiveErrors:0,findings:e.findings+(n?1:0),lastUnhealthyReportAt:null}}}var rt=6,nt=2e4;function br({category:e,now:r,state:n,subject:t}){let o=n.consecutiveErrors+1;if(o<rt)return{effects:[],state:{...n,consecutiveErrors:o}};let i=e==="driver"?Math.max(n.backoffUntil,r+B):n.backoffUntil,a=n.lastUnhealthyReportAt==null||r-n.lastUnhealthyReportAt>=nt;return{effects:a?[{kind:"report-unhealthy",subject:t}]:[],state:{...n,backoffUntil:i,consecutiveErrors:o,lastUnhealthyReportAt:a?r:n.lastUnhealthyReportAt}}}function Er(e){return{enabled:e.desired.active,executorLocal:e.executorLocal,maxTrailLength:e.desired.maxTrailLength,workers:e.desired.localWorkers}}function Pr(e,r,n){return{backoffActive:r<e.backoffUntil,headedActive:n.headedActive>0,interactiveActive:n.active,interactiveQueued:n.queued,lockfile:e.lockfile,poolSize:n.poolSize,trails:[...e.trails.entries()].map(([t,o])=>({ageMs:r-o.startedAt,id:t}))}}function Tr(e){let r=it(e),n=lt(()=>{r.dispatch(x())});return j(()=>{r.dispatch(x())}),r.dispatch(x()),{notifyQueueChange:()=>{r.dispatch({kind:"executor-changed",local:e.executorIsLocal()}),r.dispatch(x())},setDesired:t=>{r.dispatch({desired:t,kind:"desired-changed",now:Date.now(),queue:D()})},status:()=>st(r.current()),stop:()=>{n(),j(null),r.dispatch({kind:"stopped"})}}}function it(e){let r={draining:!1,queue:[],runtime:at(e)},n=i=>{r.runtime=i(r.runtime)},t=i=>{r.queue.push(i),!r.draining&&(r.draining=!0,o(),r.draining=!1)},o=()=>{let i=r.queue.shift();if(i==null)return;let a=xr(r.runtime.state,i);n(l=>({...l,state:a.state})),a.effects.forEach(l=>{dt({commit:n,dispatch:t,effect:l,params:e,runtime:r.runtime})}),o()};return{dispatch:t,current:()=>r.runtime}}function at(e){return{controllers:new Map,prepared:null,state:{...vr(),executorLocal:e.executorIsLocal()}}}function st(e){return{explorer:Rr(e.state,Date.now(),D()),exploring:e.state.trails.size,progress:{attempts:e.state.attempts,findings:e.state.findings}}}function D(){let e=Ne();return{active:e.active,headedActive:e.headedActive,poolSize:e.poolSize,queued:e.queued}}function x(){return{kind:"tick",now:Date.now(),queue:D()}}function lt(e){let r={timer:setTimeout(function n(){e(),r.timer=setTimeout(n,N)},N)};return()=>{clearTimeout(r.timer)}}function dt({commit:e,dispatch:r,effect:n,params:t,runtime:o}){switch(n.kind){case"load":case"reload":{ct(t.cwd,o.prepared).then(({outcome:i,prepared:a})=>{e(l=>({...l,prepared:a})),r({kind:"load-settled",now:Date.now(),outcome:i}),r(x())});return}case"abort":{n.ids.forEach(i=>{o.controllers.get(i)?.abort()});return}case"launch":{Array.from({length:n.count}).forEach(()=>{ut({commit:e,dispatch:r,maxTrailLength:n.maxTrailLength,params:t,prepared:o.prepared})});return}case"report":{t.report({attempts:1,findings:n.finding?1:0,result:n.result}),n.finding&&s.info("exploration finding recorded");return}case"report-unhealthy":s.warn("exploration unhealthy after repeated infra errors (last: %s)",n.subject),t.reportUnhealthy()}}async function ct(e,r){let n=await h(e);if(n==null)return{outcome:{kind:"blocked",reason:"no-lockfile"},prepared:null};if(r?.rawHash===n)return{outcome:{kind:"ready",rawHash:n},prepared:r};let{result:t}=await fe(e);if(t.isErr())return{outcome:{kind:"blocked",reason:"load-failed"},prepared:null};let o=await T(e,t.value);if(o.isErr())return{outcome:{kind:"blocked",reason:o.error.kind},prepared:null};let i=await he(o.value);return i==null?{outcome:{kind:"blocked",reason:"load-failed"},prepared:null}:{outcome:{kind:"ready",rawHash:n},prepared:{exploration:i,rawHash:n}}}function ut({commit:e,dispatch:r,maxTrailLength:n,params:t,prepared:o}){if(o==null)return;let i=we({lockfileHash:o.rawHash,prepared:o.exploration,random:pt,strategy:{...ge("even"),maxAttemptLength:n}});if(i==null)return;let a=`explore:${ot()}`,l=new AbortController;e(d=>({...d,controllers:new Map([...d.controllers,[a,l]])})),r({id:a,kind:"trail-started",now:Date.now()}),C({headed:!1,workClass:"p3-explore",task:()=>ft({assign:i,params:t,signal:l.signal})}).catch(d=>(s.debug({err:d},"exploration trail crashed"),{kind:"crashed"})).then(d=>{e(c=>({...c,controllers:new Map([...c.controllers].filter(([p])=>p!==a))})),r({id:a,kind:"trail-settled",now:Date.now(),queue:D(),settled:d})})}var Ir=2**31;function pt(){return tt(Ir)/Ir}async function ft({assign:e,params:r,signal:n}){let t=await r.executeTrail(e,n);return t.kind==="aborted"?{kind:"aborted"}:t.kind==="error"?mt(r,t.error):{kind:"done",result:t}}async function mt(e,r){let n=await Pe(e.appUrl);return n!=null?(s.debug("exploration app probe failed: %s",n),{kind:"app-unreachable"}):(s.debug({error:r},"exploration trail error"),{error:r,kind:"error"})}import{graphql as Lt}from"gql.tada";import{connect as gt}from"net";import St from"ssh2";import{WebSocket as Lr,createWebSocketStream as kt}from"ws";var yt="ripplo-";function G(e){return Object.entries(e).map(([r,n])=>`${yt}${r}.${n}`)}var{Server:ht,utils:Cr}=St;function Ar(){let e=Cr.generateKeyPairSync("ed25519"),r=Cr.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function Dr(e){return new Promise((r,n)=>{let t={closers:new Set,stopped:!1},o=new Lr(e.relayUrl,G({grant:e.grant,role:"daemon-control"}));o.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:wt(o,t)})}),o.on("message",i=>{vt(e,t,i)}),o.on("close",(i,a)=>{t.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),Ct(e,t)}),o.on("error",i=>{n(i instanceof Error?i:new Error(String(i)))})})}function wt(e,r){return()=>(r.stopped=!0,r.closers.forEach(n=>{n()}),e.close(),Promise.resolve())}function vt(e,r,n){let t=xt(n);t!=null&&bt(e,r,t.pipeId)}function xt(e){try{let r=JSON.parse(Rt(e));return typeof r=="object"&&r!=null&&"signal"in r&&r.signal==="open-data"&&"pipeId"in r&&typeof r.pipeId=="string"?{pipeId:r.pipeId}:null}catch{return null}}function Rt(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function bt(e,r,n){if(r.stopped)return;let t=new Lr(e.relayUrl,G({pipeId:n,role:"daemon-data"}));t.on("open",()=>{Et(e,r,t)}),t.on("error",o=>{s.warn({err:o},"cloud-executor relay data pipe error")})}function Et(e,r,n){let t=kt(n);t.on("error",()=>{});let o=new ht({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{It(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{Tt({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{n.close()};r.closers.add(i),n.on("close",()=>r.closers.delete(i)),Pt(o,t)}function Pt(e,r){e.injectSocket(r)}function It(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function Tt({accept:e,allowedPorts:r,deny:n,destPort:t}){if(!r.includes(t)){n();return}let o=!1,i=gt({autoSelectFamily:!0,host:"localhost",port:t},()=>{o=!0;let a=e();a.on("error",()=>{}),i.pipe(a).pipe(i)});i.on("error",()=>{o||n()})}function Ct(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(n=>{n()}),e.onFatal())}var At=Lt(`
52
+ mutation EnterCloudMode(
53
+ $devSessionId: String!
54
+ $localUrl: String!
55
+ $engineUrl: String!
56
+ $hostKeyFingerprint: String!
57
+ ) {
58
+ enterCloudMode(
59
+ devSessionId: $devSessionId
60
+ localUrl: $localUrl
61
+ engineUrl: $engineUrl
62
+ hostKeyFingerprint: $hostKeyFingerprint
63
+ ) {
64
+ __typename
65
+ ... on RelaySession {
66
+ generation
67
+ grant
68
+ relayUrl
69
+ secret
70
+ session
71
+ }
72
+ ... on DevSessionEndedError {
73
+ message
74
+ }
75
+ ... on TunnelNotConfiguredError {
76
+ message
77
+ }
78
+ }
79
+ }
80
+ `),q=class extends Error{failure;constructor(r){super(r.kind),this.failure=r}};async function Hr({config:e,devSessionId:r,onFatal:n}){let t=Ar(),i=(await u({config:e,document:At,variables:{devSessionId:r,engineUrl:e.engineUrl,hostKeyFingerprint:t.fingerprint,localUrl:e.appUrl}})).enterCloudMode;if(i==null)throw new q({kind:"empty-response"});if(i.__typename!=="RelaySession")throw new q({kind:"server-error",typename:i.__typename});let a=await Dr({allowedPorts:[...new Set([qr(e.appUrl),qr(e.engineUrl)])],grant:i.grant,hostKey:t,onFatal:n,relayUrl:i.relayUrl,secret:i.secret});return s.info({session:i.session},"cloud-executor relay up"),{stop:a.stop}}function qr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var Ur=[1e3,3e3,8e3,15e3];function Wr(){return{attempt:0,desired:"local",devSessionId:null,stopped:!1,tunnel:"down"}}function $r(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"requested":return qt(e,r.mode);case"connected":return V({...e,devSessionId:r.devSessionId},[]);case"tunnel-started":return Ht(e);case"tunnel-failed":case"tunnel-fatal":return Ut(e);case"retry-due":return e.tunnel==="down"?V(e,[]):{effects:[],state:e};case"stopped":return{effects:e.tunnel==="down"?[]:[{kind:"stop-tunnel"}],state:{...e,desired:"local",stopped:!0,tunnel:"down"}}}}function Dt(e){let r=Math.min(e,Ur.length-1),n=Ur[r];if(n==null)throw new Error("executor retry ladder is empty");return n}function qt(e,r){return r===e.desired?{effects:[],state:e}:V({...e,attempt:0,desired:r},[{kind:"notify-changed"}])}function V(e,r){return H(e)&&e.tunnel==="down"&&e.devSessionId!=null?{effects:[...r,{devSessionId:e.devSessionId,kind:"start-tunnel"}],state:{...e,tunnel:"starting"}}:!H(e)&&e.tunnel!=="down"?{effects:[...r,{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}:{effects:r,state:e}}function H(e){return e.desired==="cloud"&&e.devSessionId!=null&&!e.stopped}function Ht(e){return H(e)?{effects:[],state:{...e,attempt:0,tunnel:"up"}}:{effects:[{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}}function Ut(e){let r={...e,tunnel:"down"};return H(r)?{effects:[{delayMs:Dt(r.attempt),kind:"schedule-retry"}],state:{...r,attempt:r.attempt+1}}:{effects:[],state:r}}function Or(e){let r={draining:!1,io:Promise.resolve(),queue:[],retryTimer:null,state:Wr(),tunnel:null},n=t=>{r.queue.push(t),!r.draining&&(r.draining=!0,Fr(r,n,e),r.draining=!1)};return{connect:t=>{n({devSessionId:t,kind:"connected"})},current:()=>r.state.desired,request:t=>{n({kind:"requested",mode:t})},stop:async()=>{n({kind:"stopped"}),await r.io.catch(()=>{})}}}function Fr(e,r,n){let t=e.queue.shift();if(t==null)return;let o=$r(e.state,t);e.state=o.state,o.effects.forEach(i=>{Wt({cell:e,dispatch:r,effect:i,params:n})}),Fr(e,r,n)}function Wt({cell:e,dispatch:r,effect:n,params:t}){switch(n.kind){case"start-tunnel":{Mr(e,()=>$t({cell:e,devSessionId:n.devSessionId,dispatch:r,params:t}));return}case"stop-tunnel":{let o=e.tunnel;e.tunnel=null,_r(e),o!=null&&Mr(e,async()=>{await o.stop(),s.info("executor switched to local")});return}case"schedule-retry":{_r(e),s.warn({delayMs:n.delayMs},"cloud tunnel down; retrying \u2014 switch with npx ripplo executor local"),e.retryTimer=setTimeout(()=>{e.retryTimer=null,r({kind:"retry-due"})},n.delayMs);return}case"notify-changed":t.onChanged()}}async function $t({cell:e,devSessionId:r,dispatch:n,params:t}){try{let o=await Hr({config:t.config,devSessionId:r,onFatal:()=>{e.tunnel=null,n({kind:"tunnel-fatal"})}});e.tunnel=o,s.info("executor switched to cloud"),n({kind:"tunnel-started"})}catch(o){s.warn({err:o},"cloud tunnel failed to start; retrying in background"),n({kind:"tunnel-failed"})}}function Mr(e,r){e.io=e.io.then(r).catch(n=>{s.warn({err:n},"executor io failed")})}function _r(e){e.retryTimer!=null&&(clearTimeout(e.retryTimer),e.retryTimer=null)}import{readdir as Mt}from"fs/promises";import{existsSync as jr}from"fs";import X from"path";async function Nr({config:e,cwd:r}){let n=X.join(r,".ripplo","debug");await(await Mt(n,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!jr(X.join(n,i,ie))&&jr(X.join(n,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>Ve({config:e,debugDir:n,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as _t}from"child_process";import Br from"os";import{CancellationTokenSource as Kr,ResponseError as Qr}from"vscode-jsonrpc/node";function zr(e,r){return()=>{let n=_t(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:je(n),kill:()=>{Ot(n)},onExit:t=>{n.once("exit",t)}}}}function Jr(e){let r={closed:!1,devSessionId:e.devSessionId,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return Yr(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(n=>Y(n,r)))},execute:(n,t)=>Nt(n,t,r),exploreTrail:(n,t)=>Kt(n,t,r),routeSpan:(n,t)=>{let o=r.workers.find(i=>i.runId===n);o?.worker.connection.sendNotification(Oe,{runId:n,span:t})},setSize:n=>{zt(n,r)}}}function Ot(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var Ft=1e4,jt=1e4,Gr=-32800;async function Nt(e,r,n){let t=await Vr(n);if(t.runId=e.runId,!t.alive)return U(t,n),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let o=new Kr,i=()=>{o.cancel()};r.aborted&&o.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await t.worker.connection.sendRequest($e,e,o.token),l=Ue.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return Bt(a,t)}finally{r.removeEventListener("abort",i),o.dispose(),U(t,n)}}async function Vr(e){let r=e.workers.find(n=>n.alive&&n.runId===void 0);if(r!=null)return r.runId="pending",await r.ready,r;if(e.workers.length<e.size){let n=Xr(e);return n.runId="pending",await n.ready,n}return new Promise(n=>{e.waiters.push(t=>{t.runId="pending",n(t)})})}function Xr(e){let r=e.spawn(),n={resolve:()=>{}},t={alive:!0,id:e.nextId,ready:new Promise(o=>{n.resolve=o,r.connection.onNotification(We,o)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest(Me,()=>e.lockfileProvider()),r.onExit(()=>{t.alive=!1,e.workers=e.workers.filter(o=>o!==t),r.connection.dispose(),n.resolve()}),e.workers.push(t),t}function U(e,r){if(e.runId=void 0,!e.alive||r.closed)return;if(r.workers.length>r.size){Y(e,r);return}let n=r.waiters.shift();n?.(e)}async function Y(e,r){if(r.workers=r.workers.filter(o=>o!==e),!e.alive)return;let n=new Promise(o=>{e.worker.onExit(o)});await e.ready,await e.worker.connection.sendNotification(Fe).catch(()=>{});let t=setTimeout(()=>{e.worker.kill()},Ft);await n,clearTimeout(t)}function Bt(e,r){return e instanceof Qr&&e.code===Gr?{outcome:{detail:"aborted",kind:"error"},serverNotified:!1}:r.alive?{outcome:{detail:e instanceof Error?e.message:String(e),kind:"error"},serverNotified:!1}:{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1}}async function Kt(e,r,n){let t=await Vr(n);if(t.runId="explore",!t.alive)return U(t,n),{error:{detail:"worker-dead",source:"transport"},kind:"error"};let o=new Kr,i={cancel:()=>{}},a=()=>{o.cancel();let l=setTimeout(()=>{t.worker.kill()},jt);i.cancel=()=>{clearTimeout(l)}};r.aborted&&a(),r.addEventListener("abort",a,{once:!0});try{let l=await t.worker.connection.sendRequest(_e,{assign:e,devSessionId:n.devSessionId},o.token),d=ke.safeParse(l);return d.success?d.data:{error:{detail:"bad-result",source:"transport"},kind:"error"}}catch(l){return Qt(l)}finally{i.cancel(),r.removeEventListener("abort",a),o.dispose(),U(t,n)}}function Qt(e){return e instanceof Qr&&e.code===Gr?{kind:"aborted"}:{error:{detail:e instanceof Error?e.message.slice(0,120):"unknown",source:"transport"},kind:"error"}}function zt(e,r){r.size=e,e>Br.availableParallelism()&&s.warn({cores:Br.availableParallelism(),size:e},"worker pool size exceeds available cores");let n=r.workers.filter(o=>o.alive&&o.runId===void 0),t=r.workers.length-e;n.slice(0,Math.max(0,t)).forEach(o=>{Y(o,r)}),Yr(r)}function Yr(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{Xr(e)})}import W from"fs";import Jt from"p-retry";import{graphql as R}from"gql.tada";import{print as $}from"graphql";var Gt=R(`
81
+ query DaemonExploration($devSessionId: String!) {
82
+ exploration(devSessionId: $devSessionId) {
83
+ active
84
+ localWorkers
85
+ maxTrailLength
86
+ }
87
+ }
88
+ `),Vt=R(`
89
+ subscription WatchExplorationChanged($devSessionId: String!) {
90
+ explorationChanged(devSessionId: $devSessionId) {
91
+ exploration {
92
+ active
93
+ localWorkers
94
+ maxTrailLength
95
+ }
96
+ }
97
+ }
98
+ `);function Zr({config:e,devSessionId:r,exploration:n,sseClient:t}){return Jt(()=>Xt({config:e,devSessionId:r,exploration:n}),{factor:2,minTimeout:500,retries:6}).catch(o=>{s.warn({err:o},"initial exploration state read failed \u2014 explorer stays off")}),t.subscribe({query:$(Vt),variables:{devSessionId:r}},{complete:()=>{},error:o=>{s.error(o,"exploration subscription error")},next:o=>{en(n,o.data?.explorationChanged.exploration)}})}async function Xt({config:e,devSessionId:r,exploration:n}){let t=await u({config:e,document:Gt,variables:{devSessionId:r}});en(n,t.exploration)}function en(e,r){r!=null&&e.setDesired({active:r.active,localWorkers:r.localWorkers,maxTrailLength:r.maxTrailLength})}var Yt=R(`
99
+ subscription HooksPausedWatch($projectId: String!) {
100
+ hooksPausedRequested(projectId: $projectId) {
101
+ paused
102
+ projectId
103
+ }
104
+ }
105
+ `),Zt=R(`
106
+ subscription WatchLocalConcurrencyChanged {
107
+ myMaxLocalConcurrentRunsChanged
108
+ }
109
+ `);function rn({pool:e,sseClient:r}){return r.subscribe({query:$(Zt)},{complete:()=>{},error:n=>{s.error(n,"localConcurrency subscription error")},next:n=>{let t=n.data?.myMaxLocalConcurrentRunsChanged;t!=null&&(L(t),e.setSize(t))}})}var eo=R(`
110
+ subscription WatchExecutorChangeRequested($devSessionId: String!) {
111
+ executorChangeRequested(devSessionId: $devSessionId) {
112
+ executor
113
+ }
114
+ }
115
+ `);function nn({config:e,devSessionId:r,sseClient:n,switcher:t}){return t.connect(r),ro({config:e,switcher:t}),no({devSessionId:r,sseClient:n,switcher:t})}async function ro({config:e,switcher:r}){let n=await tr(e);if(n.isErr()){s.warn({error:n.error},"initial executor fetch failed, staying local");return}r.request(n.value)}function no({devSessionId:e,sseClient:r,switcher:n}){return r.subscribe({query:$(eo),variables:{devSessionId:e}},{complete:()=>{},error:t=>{s.error(t,"executor subscription error")},next:t=>{let o=t.data?.executorChangeRequested?.executor;o!=null&&n.request(o)}})}function tn({cwd:e,projectId:r,sseClient:n}){return n.subscribe({query:$(Yt),variables:{projectId:r}},{complete:()=>{},error:t=>{s.error(t,"hooksPaused subscription error")},next:t=>{let o=t.data?.hooksPausedRequested?.paused;o!=null&&Z({cwd:e,paused:o})}})}function Z({cwd:e,paused:r}){let n=Ie(e);if(r&&!W.existsSync(n)){W.writeFileSync(n,"");return}!r&&W.existsSync(n)&&W.unlinkSync(n)}var io=6e4,on=500,ao=15e3,so=ee(`
116
+ mutation HeartbeatDevSessionWatch($id: String!) {
117
+ heartbeatDevSession(id: $id) {
118
+ __typename
119
+ ... on DevSession {
120
+ id
121
+ }
122
+ ... on DevSessionEndedError {
123
+ message
124
+ }
125
+ }
126
+ }
127
+ `),lo=ee(`
128
+ query WatchLocalConcurrency {
129
+ currentUser {
130
+ id
131
+ maxLocalConcurrentRuns
132
+ }
133
+ }
134
+ `),co=ee(`
135
+ mutation EndDevSessionWatch($projectId: String!, $cwd: String!, $devSessionId: String) {
136
+ endDevSession(projectId: $projectId, cwd: $cwd, devSessionId: $devSessionId) {
137
+ __typename
138
+ ... on DevSession {
139
+ id
140
+ }
141
+ ... on NoActiveDevSessionError {
142
+ message
143
+ }
144
+ }
145
+ }
146
+ `);async function Ya(){bo();let e=xo(process.cwd()),r=e.cwd,n=ko(r),t={current:null},o={handler:()=>{}},i=Or({config:e,onChanged:()=>{o.handler()}}),a={handler:()=>{}},l=wo(),d=fr(),c=Ge({config:e,cwd:r,executor:i.current,ready:l.promise,explorationStatus:()=>t.current?.status()??uo(),onShutdownRequest:()=>{a.handler()},sseHealth:()=>d.snapshot()}),p=await vo({cwd:r,ipc:c,releasePid:n}),f=await E(r);f.isErr()&&(process.stderr.write(`ripplo: ${P(f.error)}
147
+ `),process.exit(1));let M=f.value,y=await z(()=>Qe({config:e,cwd:r,lockfile:M}),{config:e,label:"initial sync"}),m=await h(r);m!=null&&ze(m);let g=ur({config:e,cwd:r}),_=await Po(e);Z({cwd:r,paused:y.hooksPaused});let re=Be(r);re!=null&&s.info("watching branch %s in %s",re,r);let ne=oo({fetchFn:pr(),headers:{Authorization:`Bearer ${e.token}`},retry:ir,retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});Nr({config:e,cwd:r}).catch(()=>{});let w=So({cwd:r,devSessionId:y.devSessionId,initialConcurrency:_}),b=fo({config:e,devSessionId:y.devSessionId,pool:w,executorIsLocal:()=>i.current()==="local"});t.current=b,o.handler=b.notifyQueueChange;let an=await mo({cwd:r,pool:w}),O=lr({claim:c.claim,config:e,cwd:r,initialId:y.devSessionId,pool:w,sseClient:ne,sseHealth:d}),sn=po({config:e,devSessionId:y.devSessionId,executorSwitch:i,exploration:b,pool:w,sseClient:ne}),ln=go({config:e,session:O}),dn=Ro();l.resolve(),yo(y.devSessionId);let cn=async()=>{ln(),dn(),g(),b.stop(),p.close(),O.stop(),sn(),await w.close(),await i.stop(),await an.stop().catch(()=>{}),await Promise.race([u({config:e,document:co,variables:{cwd:e.cwd,devSessionId:O.getId(),projectId:e.projectId}}).catch(()=>{}),new Promise(un=>setTimeout(un,3e3))]),n()},v=()=>{cn().finally(()=>process.exit(0))};a.handler=v,process.on("SIGINT",v),process.on("SIGTERM",v),process.on("SIGHUP",v),process.on("SIGBREAK",v),await new Promise(()=>{})}function uo(){return{explorer:{kind:"off"},exploring:0,progress:{attempts:0,findings:0}}}function po({config:e,devSessionId:r,executorSwitch:n,exploration:t,pool:o,sseClient:i}){let a=[nn({config:e,devSessionId:r,sseClient:i,switcher:n}),tn({cwd:e.cwd,projectId:e.projectId,sseClient:i}),rn({pool:o,sseClient:i}),Zr({config:e,devSessionId:r,exploration:t,sseClient:i})];return()=>{a.forEach(l=>{l()})}}function fo({config:e,devSessionId:r,executorIsLocal:n,pool:t}){return Tr({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:n,executeTrail:(o,i)=>t.exploreTrail(o,i),report:o=>{Ye({attempts:o.attempts,config:e,devSessionId:r,findings:o.findings,trail:Xe(o.result)}).catch(i=>{s.warn({error:i},"exploration progress report failed")})},reportUnhealthy:()=>{Ze(e,r).catch(o=>{s.warn({error:o},"exploration unhealthy report failed")})}})}function mo({cwd:e,pool:r}){return ve({localDir:to.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:n=>{let t=n.attributes["ripplo.run"];t!=null&&r.routeSpan(t,n)}})}function yo(e){process.stdout.write(`${De({devSessionId:e,version:ue()})}
148
+ `)}function go({config:e,session:r}){let n=async()=>{try{let o=await u({config:e,document:so,variables:{id:r.getId()}});o.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(s.warn("dev session ended server-side (%s); re-registering",o.heartbeatDevSession.message),await r.reregister())}catch(o){s.warn("heartbeat failed: %s",o instanceof Error?o.message:String(o))}},t=setInterval(()=>{n()},ao);return()=>{clearInterval(t)}}function So({cwd:e,devSessionId:r,initialConcurrency:n}){return Jr({devSessionId:r,initialSize:n,spawn:zr(Io(),e),lockfileProvider:async()=>{let t=await k(e);if(t.isErr())return{unavailable:`daemon-load-failed:${t.error.kind}`};let o=await Re(e,t.value);return{lockfileJson:le(de,o)}}})}function ko(e){try{return Ee({cwd:e,onCompromised:ho})}catch(r){throw r instanceof be&&(process.stderr.write(`${qe({cwd:r.cwd,pid:r.pid})}
149
+ `),process.exit(1)),r}}function ho(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${He()}
150
+ `),process.exit(1)}function wo(){let e={handler:()=>{}};return{promise:new Promise(n=>{e.handler=n}),resolve:()=>{e.handler()}}}async function vo({cwd:e,ipc:r,releasePid:n}){return(await hr({cwd:e,onConnection:r.handleConnection})).match(o=>o,o=>{process.stderr.write(`${Ce(o)}
151
+ `),n(),process.exit(1)})}function xo(e){return S(e).match(r=>r,r=>{process.stderr.write(`${me(r)}
152
+ `),process.exit(1)})}function Ro(){F({maxRuns:on});let e=setInterval(()=>{F({maxRuns:on})},io);return()=>{clearInterval(e)}}function bo(){process.on("unhandledRejection",e=>{s.error({err:e},"unhandledRejection in watch; continuing")}),process.on("uncaughtException",e=>{s.error({err:e},"uncaughtException in watch; continuing")})}var Eo=4;async function Po(e){try{let n=(await u({config:e,document:lo,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(n!=null)return L(n),n}catch(r){s.warn({err:r},"failed to fetch local concurrency setting; using default")}return Eo}function Io(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{Ya as runDaemon};
@@ -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,b,c,d,e,f}from"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{e as DevLockHeldError,f as acquireDevLock,d as devPidPath,c as isDevSessionAlive,a as readDevPid,b as stopDevDaemon};
4
+ import{a,b,c,d,e,f}from"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{e as DevLockHeldError,f as acquireDevLock,d as devPidPath,c as isDevSessionAlive,a as readDevPid,b as stopDevDaemon};
@@ -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{f as r}from"./chunk-AIIZRQXH.js";import{c as s}from"./chunk-KOKEEAEF.js";import{a as n}from"./chunk-MHNGR6M7.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import t from"fs";import a from"os";import l from"path";var w=s("PreToolUse",o=>{if(o.tool_name!=="ExitPlanMode"||!r(o.cwd))return;let i=p();if(i==null)return{hookSpecificOutput:{additionalContext:`Ripplo plan gate: no plan file found \u2014 the "Tests to implement" requirement was not checked. Before implementing, stub a .ripplo/workflows/ workflow per affected flow. ${n("discover")}`,hookEventName:"PreToolUse"}};let e=t.readFileSync(i,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(e))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Plan must cite ripplo test stubs. Add a "Tests to implement" section listing .ripplo/workflows/<id>.ts per affected flow, OR add "No e2e coverage needed: <reason>" if this plan touches no user-facing behavior. ${n("discover")}`}}});function p(){let o=l.join(a.homedir(),".claude","plans");return t.existsSync(o)?t.readdirSync(o).filter(e=>e.endsWith(".md")).map(e=>l.join(o,e)).map(e=>({full:e,mtime:t.statSync(e).mtimeMs})).sort((e,m)=>m.mtime-e.mtime)[0]?.full??null:null}export{w as exitPlanGateHook};
4
+ import{f as r}from"./chunk-TPHOSZAK.js";import{c as s}from"./chunk-KOKEEAEF.js";import{a as n}from"./chunk-MHNGR6M7.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import t from"fs";import a from"os";import l from"path";var w=s("PreToolUse",o=>{if(o.tool_name!=="ExitPlanMode"||!r(o.cwd))return;let i=p();if(i==null)return{hookSpecificOutput:{additionalContext:`Ripplo plan gate: no plan file found \u2014 the "Tests to implement" requirement was not checked. Before implementing, stub a .ripplo/workflows/ workflow per affected flow. ${n("discover")}`,hookEventName:"PreToolUse"}};let e=t.readFileSync(i,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(e))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Plan must cite ripplo test stubs. Add a "Tests to implement" section listing .ripplo/workflows/<id>.ts per affected flow, OR add "No e2e coverage needed: <reason>" if this plan touches no user-facing behavior. ${n("discover")}`}}});function p(){let o=l.join(a.homedir(),".claude","plans");return t.existsSync(o)?t.readdirSync(o).filter(e=>e.endsWith(".md")).map(e=>l.join(o,e)).map(e=>({full:e,mtime:t.statSync(e).mtimeMs})).sort((e,m)=>m.mtime-e.mtime)[0]?.full??null:null}export{w as exitPlanGateHook};
package/dist/hook.js CHANGED
@@ -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{a as o,c as s}from"./chunk-5IMT3SAH.js";import{a as i}from"./chunk-R4ZTRVDQ.js";import{c as e}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as r}from"./chunk-LOEAZGYO.js";import"./chunk-KMZ3L5YA.js";o();e(process.cwd());r(i());s(process.argv[2]??"").catch(async t=>{let{renderTopLevelError:p}=await import("./cli-error-OIG4RO4E.js");process.stderr.write(`${p(t)}
4
+ import{a as o,c as s}from"./chunk-6VUSLPQD.js";import{a as i}from"./chunk-R4ZTRVDQ.js";import{c as e}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as r}from"./chunk-LOEAZGYO.js";import"./chunk-KMZ3L5YA.js";o();e(process.cwd());r(i());s(process.argv[2]??"").catch(async t=>{let{renderTopLevelError:p}=await import("./cli-error-OIG4RO4E.js");process.stderr.write(`${p(t)}
5
5
  `),process.exit(1)});
package/dist/index.js CHANGED
@@ -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 hn,c as kn,d as wn,e as bn,f as vn,g as me}from"./chunk-VCY2CEE2.js";import{a as Bn,b as qn,d as Vn,e as Hn,f as Kn,g as Gn,h as zn,i as Jn,j as Qn,k as Xn,l as Yn,m as Zn,n as et}from"./chunk-5E62BCS7.js";import{a as _n}from"./chunk-A5EBMT2E.js";import{b as mn,c as fn,d as gn,f as yn}from"./chunk-5D6PNHDQ.js";import{B as Nn,F as On,G as Fn,J as Wn,K as De,M as Dn,N as Un,a as an,b as ln,c as dn,d as un,e as Oe,f as cn,g as Cn,h as xn,j as Rn,k as $n,l as En,m as Pn,n as In,o as An,q as jn,w as We,y as Ln,z as K}from"./chunk-TQANCEOL.js";import{b as pn,c as H}from"./chunk-WCSDBWCI.js";import{a as tn}from"./chunk-MOI4L3EX.js";import{a as ue,b as on,c as pe,d as sn}from"./chunk-FJPJDGSS.js";import{a as $}from"./chunk-OQ6KNYPG.js";import{b as Z,c as Tn,e as Mn}from"./chunk-CY5FJBHP.js";import{a as R,b as Dr,c as y}from"./chunk-DK4NUWRX.js";import{a as Ur}from"./chunk-7WZ3VIUU.js";import{e as Fe}from"./chunk-AIIZRQXH.js";import{a as xr,b as rt,c as nt}from"./chunk-5IMT3SAH.js";import{a as w}from"./chunk-R4ZTRVDQ.js";import{b as Rr,c as X,d as $r,e as Er}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as Wr,b}from"./chunk-V4CLXOCP.js";import{a as q,b as Fr,c as Le,d as _r}from"./chunk-5DT43ABQ.js";import{a as x}from"./chunk-MHNGR6M7.js";import{e as rn,g as ce,j as nn}from"./chunk-RIVHBABX.js";import{b as Nr,g as Y,k as B,m as Or,n as se}from"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import{a as fr,b as gr,c as yr,d,f as U,g as hr,i as kr,k as P,l as wr,m as br,n as Me,o as vr,p as Sr,q as Cr}from"./chunk-AJXAWZQO.js";import{a as ie}from"./chunk-LOEAZGYO.js";import{k as _e,l as Sn}from"./chunk-GFKK7K6T.js";import{B as Kr,C as Gr,H as zr,I as le,L as Jr,O as Qr,P as Xr,R as Yr,U as de,V as Zr,Y as en,b as V,f as ae,g as c,h as Br,i as qr,n as Ne,o as Vr,r as Hr}from"./chunk-4GA5662U.js";import{K as Ar,L,R as A,S as jr,X as Tr,aa as Mr,ba as Lr,i as Pr,r as M,s as _,v as Ir}from"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{availableParallelism as $c}from"os";import{existsSync as tt}from"fs";function ot(){let e=new URL("solve-worker.js",import.meta.url);if(tt(e))return e;let r=new URL("../dist/solve-worker.js",import.meta.url);if(tt(r))return r;throw new Error("solve worker missing \u2014 run `pnpm --filter ripplo build` first (Z3 solves run in the built worker, even when the CLI runs from source)")}import Ec from"update-notifier";import Pc from"yargs";import{hideBin as Ic}from"yargs/helpers";function fe({current:e,latest:r}){return r==null?`ripplo v${e} (latest: unknown)`:r===e?`ripplo v${e} (latest)`:`ripplo v${e} (latest: v${r} \u2014 run \`npx ripplo update\`)`}function it(){return"Update available {currentVersion} \u2192 {latestVersion}\nRun `npx ripplo update`"}import{graphql as bs}from"gql.tada";import{exec as cs}from"child_process";import{createAuthClient as ds}from"better-auth/client";import{deviceAuthorizationClient as us}from"better-auth/client/plugins";function st({baseURL:e}){return ds({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[us()]})}import{err as at,ok as ps}from"neverthrow";var ms=5e3,lt="ripplo-cli";async function dt({onDeviceCode:e,url:r}){let n=r??Dr().RIPPLO_SERVER_URL,t=st({baseURL:n}),o=await t.device.code({client_id:lt});if(o.error!=null)return at({description:o.error.error_description,kind:"oauth-device-code-failed"});let{device_code:i,user_code:s,verification_uri_complete:a}=o.data;return e({userCode:s,verificationUrl:a}),ws(a),(await fs({authClient:t,deviceCode:i})).map(u=>(wr({serverUrl:n,token:u}),u))}async function fs({authClient:e,deviceCode:r}){for(;;){await hs(ms);let n=await e.device.token({client_id:lt,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return ps(n.data.access_token);if(n.error==null)continue;if(!ys(n.error.error))return at({code:n.error.error,description:n.error.error_description,kind:"oauth-authorization-failed"})}}var gs=new Set(["authorization_pending","slow_down"]);function ys(e){return gs.has(e)}function hs(e){return new Promise(r=>{setTimeout(r,e)})}function ks(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function ws(e){let r=ks();cs(`${r} "${e}"`,()=>{})}function j({serverUrl:e,token:r}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:r,webhookSecret:""}}var vs=bs(`
4
+ import{a as hn,c as kn,d as wn,e as bn,f as vn,g as me}from"./chunk-CAS7MBA7.js";import{a as Bn,b as qn,d as Vn,e as Hn,f as Kn,g as Gn,h as zn,i as Jn,j as Qn,k as Xn,l as Yn,m as Zn,n as et}from"./chunk-5E62BCS7.js";import{a as _n}from"./chunk-IG7J452B.js";import{b as mn,c as fn,d as gn,f as yn}from"./chunk-OES7HGNF.js";import{B as Nn,F as On,G as Fn,J as Wn,K as De,M as Dn,N as Un,a as an,b as ln,c as dn,d as un,e as Oe,f as cn,g as Cn,h as xn,j as Rn,k as $n,l as En,m as Pn,n as In,o as An,q as jn,w as We,y as Ln,z as K}from"./chunk-BJWGAKKD.js";import{b as pn,c as H}from"./chunk-22JUAYHM.js";import{a as tn}from"./chunk-MOI4L3EX.js";import{a as ue,b as on,c as pe,d as sn}from"./chunk-FJPJDGSS.js";import{a as $}from"./chunk-OQ6KNYPG.js";import{b as Z,c as Tn,e as Mn}from"./chunk-7CELUIVK.js";import{a as R,b as Dr,c as y}from"./chunk-7W237JFM.js";import{a as Ur}from"./chunk-7WZ3VIUU.js";import{e as Fe}from"./chunk-TPHOSZAK.js";import{a as xr,b as rt,c as nt}from"./chunk-6VUSLPQD.js";import{a as w}from"./chunk-R4ZTRVDQ.js";import{b as Rr,c as X,d as $r,e as Er}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as Wr,b}from"./chunk-V4CLXOCP.js";import{a as q,b as Fr,c as Le,d as _r}from"./chunk-5DT43ABQ.js";import{a as x}from"./chunk-MHNGR6M7.js";import{e as rn,g as ce,j as nn}from"./chunk-RIVHBABX.js";import{b as Nr,g as Y,k as B,m as Or,n as se}from"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import{a as fr,b as gr,c as yr,d,f as U,g as hr,i as kr,k as P,l as wr,m as br,n as Me,o as vr,p as Sr,q as Cr}from"./chunk-IPSXNIXC.js";import{a as ie}from"./chunk-LOEAZGYO.js";import{k as _e,l as Sn}from"./chunk-GFKK7K6T.js";import{B as Kr,C as Gr,H as zr,I as le,L as Jr,O as Qr,P as Xr,R as Yr,U as de,V as Zr,Y as en,b as V,f as ae,g as c,h as Br,i as qr,n as Ne,o as Vr,r as Hr}from"./chunk-4GA5662U.js";import{K as Ar,L,R as A,S as jr,X as Tr,aa as Mr,ba as Lr,i as Pr,r as M,s as _,v as Ir}from"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{availableParallelism as $c}from"os";import{existsSync as tt}from"fs";function ot(){let e=new URL("solve-worker.js",import.meta.url);if(tt(e))return e;let r=new URL("../dist/solve-worker.js",import.meta.url);if(tt(r))return r;throw new Error("solve worker missing \u2014 run `pnpm --filter ripplo build` first (Z3 solves run in the built worker, even when the CLI runs from source)")}import Ec from"update-notifier";import Pc from"yargs";import{hideBin as Ic}from"yargs/helpers";function fe({current:e,latest:r}){return r==null?`ripplo v${e} (latest: unknown)`:r===e?`ripplo v${e} (latest)`:`ripplo v${e} (latest: v${r} \u2014 run \`npx ripplo update\`)`}function it(){return"Update available {currentVersion} \u2192 {latestVersion}\nRun `npx ripplo update`"}import{graphql as bs}from"gql.tada";import{exec as cs}from"child_process";import{createAuthClient as ds}from"better-auth/client";import{deviceAuthorizationClient as us}from"better-auth/client/plugins";function st({baseURL:e}){return ds({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[us()]})}import{err as at,ok as ps}from"neverthrow";var ms=5e3,lt="ripplo-cli";async function dt({onDeviceCode:e,url:r}){let n=r??Dr().RIPPLO_SERVER_URL,t=st({baseURL:n}),o=await t.device.code({client_id:lt});if(o.error!=null)return at({description:o.error.error_description,kind:"oauth-device-code-failed"});let{device_code:i,user_code:s,verification_uri_complete:a}=o.data;return e({userCode:s,verificationUrl:a}),ws(a),(await fs({authClient:t,deviceCode:i})).map(u=>(wr({serverUrl:n,token:u}),u))}async function fs({authClient:e,deviceCode:r}){for(;;){await hs(ms);let n=await e.device.token({client_id:lt,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return ps(n.data.access_token);if(n.error==null)continue;if(!ys(n.error.error))return at({code:n.error.error,description:n.error.error_description,kind:"oauth-authorization-failed"})}}var gs=new Set(["authorization_pending","slow_down"]);function ys(e){return gs.has(e)}function hs(e){return new Promise(r=>{setTimeout(r,e)})}function ks(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function ws(e){let r=ks();cs(`${r} "${e}"`,()=>{})}function j({serverUrl:e,token:r}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:r,webhookSecret:""}}var vs=bs(`
5
5
  query AuthViewer {
6
6
  currentUser {
7
7
  name
@@ -447,7 +447,7 @@ ${e.contradictions.map(t=>Kr({contradiction:t,evidencePath:void 0})).join(`
447
447
  `);return}qu(e)}function qu(e){let r=`ripplo@${e}`,n=Ou("npm",["install","-g",r],{stdio:"inherit"});if(n.status!==0){let t=`exit ${String(n.status)}`;process.stderr.write(`${gi(t)}
448
448
  `),process.exit(1)}process.stdout.write(`${or({evicted:0,latest:e,mode:"global"})}
449
449
  `)}async function Vu(e){if((await yn(e)).kind==="not-running")return;let n=await gn(e);process.stdout.write(`${yi(n)}
450
- `)}async function ki({action:e}){if(e==="status"){let{statusCommand:n}=await import("./status-2FS6ZFIU.js");await n({format:"summary"});return}if(e==="stop"||e==="restart"){let n=await Hu();(e==="stop"||!n)&&process.exit(n?0:1)}Ku();let{runDaemon:r}=await import("./daemon-ZHTQ472Q.js");await r()}async function Hu(){let{stopDevDaemon:e}=await import("./daemon-lock-YRKNXWGO.js"),{renderDaemonStopResult:r}=await import("./daemon-WEKGUIRK.js"),n=await e(process.cwd());return process.stdout.write(`${r(n)}
450
+ `)}async function ki({action:e}){if(e==="status"){let{statusCommand:n}=await import("./status-H5WYYH4J.js");await n({format:"summary"});return}if(e==="stop"||e==="restart"){let n=await Hu();(e==="stop"||!n)&&process.exit(n?0:1)}Ku();let{runDaemon:r}=await import("./daemon-3IWI7VQT.js");await r()}async function Hu(){let{stopDevDaemon:e}=await import("./daemon-lock-OAARBZ4O.js"),{renderDaemonStopResult:r}=await import("./daemon-WEKGUIRK.js"),n=await e(process.cwd());return process.stdout.write(`${r(n)}
451
451
  `),n.kind!=="timeout"}function Ku(){let e=Se(H());e!=null&&process.stderr.write(`${e}
452
452
  `)}function wi(e){return`executor: ${e}`}function bi(e){return e==="cloud"?"executor set to cloud \u2014 the daemon is bringing the tunnel up, the next run dispatches to the cloud fleet":"executor set to local \u2014 the next run executes on this machine"}function vi(e){switch(e.kind){case"no-session":return"No active dev session for this directory. Start `npx ripplo daemon` first.";case"starting":return"Dev session is still syncing \u2014 the daemon just started. Retry in a moment.";case"session-ended":return"The dev session ended before the switch landed. Check `npx ripplo daemon status` and try again.";case"empty-response":return"The server returned no result for the switch. Try again."}}async function Si({mode:e}){let r=y(process.cwd()).match(t=>t,t=>{process.stderr.write(`${b(t)}
453
453
  `),process.exit(1)});(e==null?await Dn(r):await Un(r,e)).match(t=>{process.stdout.write(`${e==null?wi(t):bi(t)}
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-BDWNZMUM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
4
+ import{a}from"./chunk-2Q7VXQYN.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as t}from"./chunk-GKYP7AMJ.js";import"./chunk-HD7WIBP2.js";import{a as e}from"./chunk-NOT5PEHM.js";import"./chunk-6SYRXU4Q.js";import"./chunk-JJ4QQPAV.js";import"./chunk-MOI4L3EX.js";import"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import"./chunk-CY5FJBHP.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var r=o({event:"PostToolUse",handlers:[t,e],note:i=>({hookSpecificOutput:{additionalContext:i,hookEventName:"PostToolUse"}})});export{r as postEditHook};
4
+ import{a as t}from"./chunk-GZPE7I7U.js";import"./chunk-CB74TAUC.js";import{a as e}from"./chunk-BNMS3N54.js";import"./chunk-N2OBRCPQ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-MOI4L3EX.js";import"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import"./chunk-7CELUIVK.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var r=o({event:"PostToolUse",handlers:[t,e],note:i=>({hookSpecificOutput:{additionalContext:i,hookEventName:"PostToolUse"}})});export{r as postEditHook};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-GKYP7AMJ.js";import"./chunk-HD7WIBP2.js";import"./chunk-MOI4L3EX.js";import"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import"./chunk-CY5FJBHP.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditAnalyze};
4
+ import{a}from"./chunk-GZPE7I7U.js";import"./chunk-CB74TAUC.js";import"./chunk-MOI4L3EX.js";import"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import"./chunk-7CELUIVK.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditAnalyze};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-NOT5PEHM.js";import"./chunk-6SYRXU4Q.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditFlagStubs};
4
+ import{a}from"./chunk-BNMS3N54.js";import"./chunk-N2OBRCPQ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditFlagStubs};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{b as h}from"./chunk-OWN4P2K7.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f}from"./chunk-AIIZRQXH.js";import{c as y}from"./chunk-KOKEEAEF.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{parse as m}from"shell-quote";import*as l from"zod/mini";var R=l.looseObject({command:l.string()}),k="run",S=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),H=y("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let n=R.safeParse(e.tool_input);if(!n.success)return;let r=x(n.data.command),o=b(r),s=g(r,"compile");if(o==null&&s==null)return;let{cwd:t}=e;if(!c(t)||!f(t))return;let a=E({cwd:t,gate:o,pipedCompile:s,sessionId:e.session_id,tokens:r});return a==null?void 0:O(a)});function E({cwd:e,gate:n,pipedCompile:r,sessionId:o,tokens:s}){if(n!=null&&!h(e,o,n.skill))return n.reason;let t=n?.kind==="run"?g(s,"run"):null;return t!=null?`Don't pipe \`ripplo run\` through \`${t}\` \u2014 buffering filters hide live progress, and killing the pipeline mid-run orphans the run on the server. Redirect to a file instead (\`npx ripplo run <id> > /tmp/run.log 2>&1\` and Read it), or use \`run_in_background: true\`.`:r!=null?`Don't pipe \`ripplo compile\` through \`${r}\` \u2014 the piped process holds stdio open and the command hangs long after compile finishes. Run \`npx ripplo compile\` bare, its output is already short.`:null}var P=new Set(["comment","resolve","clarify","dismiss","start"]);function b(e){return v(e)?null:w(e)?{kind:"tasks",reason:"Changing a task with `ripplo tasks` requires the `/ripplo:tasks` skill loaded first. Load `/ripplo:tasks` then retry \u2014 it carries how to route the request and the proof bar for app changes: a run that exercises the broken condition, plus the exact frame and element that prove the fix.",skill:"tasks"}:A(e)?{kind:"replay",reason:"Running `ripplo explore replay` requires the `/ripplo:tasks` skill loaded first. Load `/ripplo:tasks` then retry \u2014 it carries the finding-triage loop and the add-vs-weaken guardrail for resolving findings.",skill:"tasks"}:I(e)?{kind:"run",reason:"Running `ripplo run` requires the `/ripplo:run` skill loaded first. Load `/ripplo:run` then retry \u2014 it carries the artifact-read order, the no-grep-piping guidance, the failure decision tree, and the caught-bug filing contract.",skill:k}:null}function w(e){return e.some((n,r)=>{let o=e[r+2];return n==="ripplo"&&e[r+1]==="tasks"&&typeof o=="string"&&P.has(o)})}function A(e){return e.some((n,r)=>n==="ripplo"&&e[r+1]==="replay")}function I(e){return e.some((n,r)=>n==="ripplo"&&e[r+1]==="run")}var _=new Set(["--help","-h","--version"]);function v(e){return e.some(n=>typeof n=="string"&&_.has(n))}function x(e){try{return m(e)}catch{return[]}}function u(e,n){return typeof e=="object"&&"op"in e&&n.has(e.op)}var D=new Set(["|"]),T=new Set([";","&&","||","&"]),L=new Set([">",">>","&>","1>"]);function g(e,n){let r=e.findIndex((i,p)=>i==="ripplo"&&e[p+1]===n);if(r===-1)return null;let o=e.slice(r+1),s=o.findIndex(i=>u(i,T)),t=s===-1?o:o.slice(0,s);if(t.some(i=>u(i,L)))return null;let a=t.find((i,p)=>{let d=t[p-1];return d!=null&&u(d,D)&&typeof i=="string"&&S.has(i)});return typeof a=="string"?a:null}function O(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}export{g as bufferingAfter,H as preBashRunGateHook};
4
+ import{b as h}from"./chunk-OWN4P2K7.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f}from"./chunk-TPHOSZAK.js";import{c as y}from"./chunk-KOKEEAEF.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{parse as m}from"shell-quote";import*as l from"zod/mini";var R=l.looseObject({command:l.string()}),k="run",S=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),H=y("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let n=R.safeParse(e.tool_input);if(!n.success)return;let r=x(n.data.command),o=b(r),s=g(r,"compile");if(o==null&&s==null)return;let{cwd:t}=e;if(!c(t)||!f(t))return;let a=E({cwd:t,gate:o,pipedCompile:s,sessionId:e.session_id,tokens:r});return a==null?void 0:O(a)});function E({cwd:e,gate:n,pipedCompile:r,sessionId:o,tokens:s}){if(n!=null&&!h(e,o,n.skill))return n.reason;let t=n?.kind==="run"?g(s,"run"):null;return t!=null?`Don't pipe \`ripplo run\` through \`${t}\` \u2014 buffering filters hide live progress, and killing the pipeline mid-run orphans the run on the server. Redirect to a file instead (\`npx ripplo run <id> > /tmp/run.log 2>&1\` and Read it), or use \`run_in_background: true\`.`:r!=null?`Don't pipe \`ripplo compile\` through \`${r}\` \u2014 the piped process holds stdio open and the command hangs long after compile finishes. Run \`npx ripplo compile\` bare, its output is already short.`:null}var P=new Set(["comment","resolve","clarify","dismiss","start"]);function b(e){return v(e)?null:w(e)?{kind:"tasks",reason:"Changing a task with `ripplo tasks` requires the `/ripplo:tasks` skill loaded first. Load `/ripplo:tasks` then retry \u2014 it carries how to route the request and the proof bar for app changes: a run that exercises the broken condition, plus the exact frame and element that prove the fix.",skill:"tasks"}:A(e)?{kind:"replay",reason:"Running `ripplo explore replay` requires the `/ripplo:tasks` skill loaded first. Load `/ripplo:tasks` then retry \u2014 it carries the finding-triage loop and the add-vs-weaken guardrail for resolving findings.",skill:"tasks"}:I(e)?{kind:"run",reason:"Running `ripplo run` requires the `/ripplo:run` skill loaded first. Load `/ripplo:run` then retry \u2014 it carries the artifact-read order, the no-grep-piping guidance, the failure decision tree, and the caught-bug filing contract.",skill:k}:null}function w(e){return e.some((n,r)=>{let o=e[r+2];return n==="ripplo"&&e[r+1]==="tasks"&&typeof o=="string"&&P.has(o)})}function A(e){return e.some((n,r)=>n==="ripplo"&&e[r+1]==="replay")}function I(e){return e.some((n,r)=>n==="ripplo"&&e[r+1]==="run")}var _=new Set(["--help","-h","--version"]);function v(e){return e.some(n=>typeof n=="string"&&_.has(n))}function x(e){try{return m(e)}catch{return[]}}function u(e,n){return typeof e=="object"&&"op"in e&&n.has(e.op)}var D=new Set(["|"]),T=new Set([";","&&","||","&"]),L=new Set([">",">>","&>","1>"]);function g(e,n){let r=e.findIndex((i,p)=>i==="ripplo"&&e[p+1]===n);if(r===-1)return null;let o=e.slice(r+1),s=o.findIndex(i=>u(i,T)),t=s===-1?o:o.slice(0,s);if(t.some(i=>u(i,L)))return null;let a=t.find((i,p)=>{let d=t[p-1];return d!=null&&u(d,D)&&typeof i=="string"&&S.has(i)});return typeof a=="string"?a:null}function O(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}export{g as bufferingAfter,H as preBashRunGateHook};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as e}from"./chunk-T76D4SYI.js";import{a as t}from"./chunk-SXDYA2OR.js";import{a as i}from"./chunk-NOKKMFJP.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
4
+ import{a as e}from"./chunk-TPCKMDWU.js";import{a as t}from"./chunk-SNU66GSR.js";import{a as i}from"./chunk-YQ2RBEOJ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-SXDYA2OR.js";import"./chunk-OWN4P2K7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditRipploSkillGate};
4
+ import{a}from"./chunk-SNU66GSR.js";import"./chunk-OWN4P2K7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditRipploSkillGate};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-NOKKMFJP.js";import"./chunk-JJ4QQPAV.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditScopeGate};
4
+ import{a}from"./chunk-YQ2RBEOJ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditScopeGate};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-T76D4SYI.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-MHNGR6M7.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
4
+ import{a}from"./chunk-TPCKMDWU.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-MHNGR6M7.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as e}from"./chunk-Z6UPZDW6.js";import{a as r}from"./chunk-WNAVYV4P.js";import"./chunk-LB65USNP.js";import{a as i}from"./chunk-TPQIFYHW.js";import{a as t}from"./chunk-BDWNZMUM.js";import"./chunk-HD7WIBP2.js";import"./chunk-6SYRXU4Q.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-5E62BCS7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
4
+ import{a as e}from"./chunk-OAU4HUD2.js";import{a as r}from"./chunk-WNAVYV4P.js";import"./chunk-LB65USNP.js";import{a as i}from"./chunk-AGK6XOX2.js";import{a as t}from"./chunk-2Q7VXQYN.js";import"./chunk-CB74TAUC.js";import"./chunk-N2OBRCPQ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-5E62BCS7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{a}from"./chunk-OAU4HUD2.js";import"./chunk-CB74TAUC.js";import"./chunk-N2OBRCPQ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as scopeReminder};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-A5EBMT2E.js";import"./chunk-5D6PNHDQ.js";import"./chunk-WCSDBWCI.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-GFKK7K6T.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
4
+ import{a}from"./chunk-IG7J452B.js";import"./chunk-OES7HGNF.js";import"./chunk-22JUAYHM.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-5DT43ABQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-GFKK7K6T.js";import"./chunk-4GA5662U.js";import"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as O,b as H,c as q}from"./chunk-HD7WIBP2.js";import{a as L,b as A,d as N,e as x,f as T,g as h}from"./chunk-VCY2CEE2.js";import{a as $,c as P,e as I}from"./chunk-5D6PNHDQ.js";import"./chunk-WCSDBWCI.js";import{a as S,c as v}from"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import{c as k}from"./chunk-DK4NUWRX.js";import{a as b}from"./chunk-7WZ3VIUU.js";import{f as C}from"./chunk-AIIZRQXH.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{c as D}from"./chunk-KOKEEAEF.js";import{a as w}from"./chunk-5DT43ABQ.js";import{a as c}from"./chunk-MHNGR6M7.js";import{e as E,f as j,i as y}from"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-36NPGS6X.js";import{d as m}from"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import{X as g}from"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import J from"path";import U from"process";import{CancellationTokenSource as _}from"vscode-jsonrpc/node";import{graphql as W}from"gql.tada";function F(n){return`--- Ripplo Run Failures (scope) ---
4
+ import{a as O,b as H,c as q}from"./chunk-CB74TAUC.js";import{a as L,b as A,d as N,e as x,f as T,g as h}from"./chunk-CAS7MBA7.js";import{a as $,c as P,e as I}from"./chunk-OES7HGNF.js";import"./chunk-22JUAYHM.js";import{a as S,c as v}from"./chunk-FJPJDGSS.js";import"./chunk-OQ6KNYPG.js";import{c as k}from"./chunk-7W237JFM.js";import{a as b}from"./chunk-7WZ3VIUU.js";import{f as C}from"./chunk-TPHOSZAK.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{c as D}from"./chunk-KOKEEAEF.js";import{a as w}from"./chunk-5DT43ABQ.js";import{a as c}from"./chunk-MHNGR6M7.js";import{e as E,f as j,i as y}from"./chunk-RIVHBABX.js";import"./chunk-L2ZJK7MP.js";import"./chunk-R3DZ6JPY.js";import{d as m}from"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-4GA5662U.js";import{X as g}from"./chunk-XJJDHGK4.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import J from"path";import U from"process";import{CancellationTokenSource as _}from"vscode-jsonrpc/node";import{graphql as W}from"gql.tada";function F(n){return`--- Ripplo Run Failures (scope) ---
5
5
  ${n.join(`
6
6
  `)}
7
7
  Artifacts: .ripplo/debug/<runId>/. ${c("run")}`}function R({lines:n,retried:e}){let r=e?"Already retried once, still unreachable.":"";return["--- Ripplo Run Not Verified (server unreachable) ---",...n,"Server-side transient \u2014 not the daemon, dev server, or auth (`npx ripplo doctor` is green).",r,"Wait a moment, then stop again to re-verify."].filter(t=>t.length>0).join(`
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a}from"./chunk-TPQIFYHW.js";import"./chunk-HD7WIBP2.js";import"./chunk-5E62BCS7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-DK4NUWRX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-AIIZRQXH.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-36NPGS6X.js";import"./chunk-AJXAWZQO.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as tasksReminder};
4
+ import{a}from"./chunk-AGK6XOX2.js";import"./chunk-CB74TAUC.js";import"./chunk-5E62BCS7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-7W237JFM.js";import"./chunk-7WZ3VIUU.js";import"./chunk-TPHOSZAK.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-R3DZ6JPY.js";import"./chunk-IPSXNIXC.js";import"./chunk-LOEAZGYO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as tasksReminder};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripplo",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "CLI for Ripplo — AI-powered end-to-end testing",
5
5
  "type": "module",
6
6
  "homepage": "https://ripplo.ai",
@@ -70,8 +70,8 @@
70
70
  "@ripplo/core": "^0.0.0",
71
71
  "@ripplo/eslint-config": "0.0.0",
72
72
  "@ripplo/graphql": "^0.0.0",
73
- "@ripplo/rrweb-bundle": "0.0.0",
74
73
  "@ripplo/run-report": "0.0.0",
74
+ "@ripplo/rrweb-bundle": "0.0.0",
75
75
  "@ripplo/runtime": "^0.0.0",
76
76
  "@ripplo/solver": "^0.0.0",
77
77
  "@ripplo/spec": "^0.0.0"
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __ripploCreateRequire } from "node:module";
3
- const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{b as E}from"./chunk-LOEAZGYO.js";import{a as $}from"./chunk-NNH3YVVO.js";import{b as U}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}),i=`${e.config.ripploServerUrl}/graphql`,c=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:i}),s=await J({res:c,url:i});if(!Q(s))throw new Error("Invalid GraphQL response");if(X(s))throw new u(s.errors);if(s.data==null)throw new Error("No data returned from server");return s.data}async function B({init:e,policy:r,serverUrl:t,url:n}){let o=1,i=await b({init:e,timeoutMs:r.timeoutMs,url:n});for(;i.retryable&&o<r.attempts;)await K(H(o)),o+=1,i=await b({init:e,timeoutMs:r.timeoutMs,url:n});if(i.response!=null)return i.response;throw new f({detail:i.detail,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(a=>a.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async a=>{let m=w.join(C,a.name),O=await re(m);return{dirPath:m,mtime:O.mtimeMs,pendingUpload:ne(m)}})),i=o.filter(a=>n-a.mtime>D),c=o.filter(a=>n-a.mtime<=D&&!a.pendingUpload).toSorted((a,m)=>m.mtime-a.mtime).slice(e),s=[...i,...c];if(s.length===0)return;await Promise.allSettled(s.map(a=>ee(a.dirPath,{force:!0,recursive:!0}))),y.debug("Pruned %d old debug run(s)",s.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 l 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);l.existsSync(r)||l.mkdirSync(r,{recursive:!0});let t=g.join(r,".gitignore");return l.existsSync(t)||l.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 l.existsSync(e)?l.chmodSync(e,448):l.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 d 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(!d.existsSync(t))return null;let n=d.readFileSync(t,"utf8").trim();return n.length===0?null:n}function ve({serverUrl:e,token:r}){S();let t=R(e);d.mkdirSync(_.dirname(t),{mode:448,recursive:!0}),d.writeFileSync(t,r+`
48
- `,{mode:384})}function he(e){let r=R(e);return d.existsSync(r)?(d.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,i=t.sign(n,o,e),c=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":i,"webhook-timestamp":String(c)}}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};