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
package/dist/daemon-3CCSJNDP.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{A as U,C as Ve,D as Xe,E as Ye,G as Ze,H as K,I as Q,J as er,K as rr,L as z,M as nr,e as Ee,i as He,j as Ue,k as We,l as $e,m as _e,n as Me,o as Oe,p as Fe,r as q,s as H,t as je,u as B,v as Qe,w as ze,x as Je,z as Ge}from"./chunk-JIMLVUPS.js";import{d as Ie}from"./chunk-B6OQ2JE2.js";import{a as Ne,c as Be,d as Ke,e as w}from"./chunk-PPB7QGV2.js";import{c as k}from"./chunk-KQWFJRIP.js";import{e as Pe}from"./chunk-3M2E253R.js";import{a as ce}from"./chunk-R4ZTRVDQ.js";import{c as ae}from"./chunk-FEHVIHVA.js";import{b as fe}from"./chunk-QIXJ7Z2L.js";import{a as L}from"./chunk-NBSDY7QG.js";import"./chunk-MHNGR6M7.js";import{g as xe,h as D}from"./chunk-GYH4P7SC.js";import{a as ue,i as v,j as pe,k as T}from"./chunk-XBN6AJVQ.js";import{e as Re,f as be}from"./chunk-INURHJF4.js";import{c as te,d as u,f as s,g as oe,h as N,i as ie}from"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import{b as Ce,c as Te,d as Le,e as Ae,f as De,h as qe}from"./chunk-2A6KSSUD.js";import{G as ye,J as A,K as ge,L as Se,N as ke,O as he,P as ve,W as we,a as me}from"./chunk-77DJHICC.js";import{K as se,R as le,X as de}from"./chunk-JNLHZVZJ.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import no from"path";import{createClient as to}from"graphql-sse";import{graphql as ne}from"gql.tada";import Ln,{AbortError as An}from"p-retry";import{graphql as pn}from"gql.tada";import{print as fn}from"graphql";async function tr({config:e,cwd:r,headed:n,pool:t,runId:o,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let c=await v(r);if(c.isErr())return await U(e,o,`lockfile:${c.error.kind}`),{kind:"dispatch-error",reason:{detail:`lockfile:${c.error.kind}`,type:"generic"}};let p=un(c.value,{testSlug:a,workflowSlug:d});if(p==null)return await U(e,o,`no-test:${d}/${a}`),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let f=await q({headed:n,workClass:l,task:()=>t.execute({headed:n,runId:o,testRef:p},i)});return!f.serverNotified&&f.outcome.kind==="error"&&await U(e,o,f.outcome.detail),f.outcome}function un(e,{testSlug:r,workflowSlug:n}){let o=e.workflows.find(i=>de(i.name)===n)?.tests.find(i=>i.slug===r);return o==null?void 0:me(o)}var mn=6e4,yn=pn(`
|
|
5
|
-
subscription RunRequestedWatch($devSessionId: String!) {
|
|
6
|
-
runRequested(devSessionId: $devSessionId) {
|
|
7
|
-
runId
|
|
8
|
-
testSlug
|
|
9
|
-
workflowId
|
|
10
|
-
workflowSlug
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`);async function or(e){let r=Math.min(1e3*2**e,mn)+hn();await new Promise(n=>setTimeout(n,r))}function ir({claim:e,cwd:r,devSessionId:n,onSubscriptionDead:t,pool:o,sseClient:i,sseHealth:a}){let l=new Set,d=gn(r);return i.subscribe({query:fn(yn),variables:{devSessionId:n}},{complete:()=>{},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=>{Sn({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 gn(e){return ae(e),{config:k(e).match(r=>r,r=>{s.error({failure:r},"failed to load env for run dispatch")}),cwd:e}}function Sn({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=kn(e(n.runId),n);i.started(),tr({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 kn(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:ze(e.token),workClass:"p1-cli",finished:n=>{e.finished(r.runId,n)},started:()=>{e.started(r.runId)}}}function hn(){return Math.floor(Math.random()*2700)+300}import{graphql as J}from"gql.tada";import{print as vn}from"graphql";var wn=J(`
|
|
15
|
-
subscription TeleportRequestedWatch($devSessionId: String!) {
|
|
16
|
-
teleportRequested(devSessionId: $devSessionId) {
|
|
17
|
-
runId
|
|
18
|
-
stepIndex
|
|
19
|
-
kind
|
|
20
|
-
testSlug
|
|
21
|
-
workflowSlug
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`),xn=J(`
|
|
25
|
-
query TeleportRunRepro($id: String!) {
|
|
26
|
-
run(id: $id) {
|
|
27
|
-
id
|
|
28
|
-
reproJson
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`),Rn=J(`
|
|
32
|
-
mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
|
|
33
|
-
reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
|
|
34
|
-
}
|
|
35
|
-
`);function ar({cwd:e,devSessionId:r,onSubscriptionDead:n,sseClient:t}){let o=new Set,i=t.subscribe({query:vn(wn),variables:{devSessionId:r}},{complete:()=>{},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=>{bn({cwd:e,devSessionId:r,event:a.data?.teleportRequested,running:o})}});return()=>{o.forEach(a=>{a.abort()}),o.clear(),i()}}function bn({cwd:e,devSessionId:r,event:n,running:t}){if(n==null)return;let o=new AbortController;t.add(o),En({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 En({cwd:e,devSessionId:r,event:n,signal:t}){let o=d=>Pn({cwd:e,devSessionId:r,runId:n.runId,status:d}),i=await In(e,n);if(i==null){s.warn({runId:n.runId},"teleport could not resolve target"),await o("unplannable");return}process.stdout.write(`ripplo: teleport ${Tn(n)} step ${String(n.stepIndex+1)}
|
|
36
|
-
`);let l=await Ze({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 Pn({cwd:e,devSessionId:r,runId:n,status:t}){let o=k(e).match(i=>i,()=>null);o!=null&&await u({config:o,document:Rn,variables:{devSessionId:r,runId:n,status:t}}).catch(()=>null)}async function In(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=k(e).match(o=>o,()=>null);if(n==null)return null;let t=await u({config:n,document:xn,variables:{id:r}}).catch(()=>null);return t?.run?.reproJson==null?null:A.parse(JSON.parse(t.run.reproJson))}function Tn(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}var sr=6e4,Dn=3;function lr({claim:e,config:r,cwd:n,initialId:t,pool:o,sseClient:i,sseHealth:a}){let l=t,d=null,c=0,p=0,f=y=>{I(y)},E=()=>{let y=ir({claim:e,cwd:n,devSessionId:l,onSubscriptionDead:f,pool:o,sseClient:i,sseHealth:a}),g=ar({cwd:n,devSessionId:l,onSubscriptionDead:f,sseClient:i});return()=>{y(),g()}},m=E(),P=async y=>{let g=Date.now();c=g-p>sr*2?1:c+1,p=g,c>=Dn&&a.markUnhealthy(y),await Un(Math.min(1e3*2**(c-1),sr));let h=await T(n);if(h.isErr()){s.error("re-register: compile failed: %s",L(h.error));return}let S=await G(()=>Be({config:r,cwd:n,lockfile:h.value}),{config:r,label:"re-register sync"});m(),l=S.devSessionId,m=E(),s.info("re-registered dev session as %s",l)},I=y=>(d!=null||(d=P(y).finally(()=>{d=null})),d);return{getId:()=>l,reregister:()=>I("dev session ended server-side"),stop:()=>{m()}}}function G(e,{config:r,label:n}){let t=r.ripploServerUrl.includes("localhost")||r.ripploServerUrl.includes("127.0.0.1");return Ln(async()=>{try{return await e()}catch(o){qn({config:r,error:o});let i=o instanceof Error?o.message:String(o);throw Hn(i)?o:(s.error("%s failed: %s",n,i),new An(i))}},{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=te(r);n==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${Le()}
|
|
37
|
-
`),process.exit(1)),n==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${Te({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
|
|
38
|
-
`),process.exit(1))}function Hn(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function Un(e){return new Promise(r=>setTimeout(r,e))}import{graphql as dr}from"gql.tada";var Wn=dr(`
|
|
39
|
-
query OpenFindingsForRetire($projectId: String!) {
|
|
40
|
-
exploreFindings(projectId: $projectId, status: open) {
|
|
41
|
-
signature
|
|
42
|
-
reproRun {
|
|
43
|
-
reproJson
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`),$n=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:Wn,variables:{projectId:e.projectId}})).exploreFindings,i=await D(r,n);if(i.isErr())return s.info({block:i.error.kind},"skipping finding retire until next compile"),!1;let a=await _n(o,i.value);return a.length===0||(await Promise.all(a.map(l=>On(e,l))),s.info({count:a.length},"retired findings whose trail no longer replays")),!0}async function _n(e,r){return(await Promise.all(e.map(async t=>await Mn(t,r)?t.signature:null))).filter(t=>t!=null)}async function Mn(e,r){let n=e.reproRun?.reproJson;if(n==null)return!1;let t=A.safeParse(JSON.parse(n));return t.success?(await we(r,t.data)).kind==="unplannable":!1}function On(e,r){return u({config:e,document:$n,variables:{projectId:e.projectId,signature:r}})}var Fn=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 jn(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,Fn))},0)};return()=>{r.stopped=!0,clearTimeout(t.timer)}}async function jn({config:e,cwd:r},n){let t=await w(r),o=ue();if(t==null||o==null)return n;let i=`${t}@${o}`;if(i===n)return n;let a=await v(r);return a.isErr()?n:await cr({config:e,cwd:r,lockfile:a.value})?i:n}function pr(){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 Nn from"fs";import gr from"net";import{err as Sr,ok as Bn}from"neverthrow";async function kr({cwd:e,onConnection:r}){ie(e);let n=Ie(e),t=await fr({onConnection:r,socketPath:n});return t.isOk()||t.error.kind!=="stale-candidate"?t.map(mr(n)).mapErr(yr(n)):await Kn(n)?Sr({kind:"already-running",socketPath:n}):(hr(n),(await fr({onConnection:r,socketPath:n})).map(mr(n)).mapErr(yr(n)))}function Kn(e){return new Promise(r=>{let n=gr.connect(e);n.once("connect",()=>{n.destroy(),r(!0)}),n.once("error",()=>{r(!1)})})}async function fr(e){let r=await Qn(e);return r.kind==="listening"?Bn(r.server):Sr(r.error)}function Qn({onConnection:e,socketPath:r}){return new Promise(n=>{let t=gr.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 mr(e){return r=>({socketPath:e,close:()=>{r.close(),hr(e)}})}function hr(e){Nn.rmSync(e,{force:!0})}function yr(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as nt,randomUUID as tt}from"crypto";function vr(){return{attempts:0,backoffUntil:0,consecutiveErrors:0,desired:{active:!1,localWorkers:er,maxTrailLength:rr},executorLocal:!0,findings:0,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"loading"},prevInteractiveActive:0,stopped:!1,trails:new Map}}function wr(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"tick":return V(e,r.now,r.queue);case"desired-changed":return V({...e,desired:r.desired},r.now,r.queue);case"executor-changed":return{effects:[],state:{...e,executorLocal:r.local}};case"load-settled":return Jn(e,r.outcome);case"trail-started":return{effects:[],state:{...e,trails:new Map([...e.trails,[r.id,{startedAt:r.now}]])}};case"trail-settled":return Gn(e,r);case"stopped":return{effects:[{ids:[...e.trails.keys()],kind:"abort"}],state:{...e,stopped:!0,trails:new Map}}}}function xr(e,r,n){return z(br(e),Er(e,r,n)).health}function V(e,r,n){let t=zn(e,r,n),o={...e,...t,prevInteractiveActive:n.active},i=z(br(o),Er(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 zn(e,r,n){return n.active<e.prevInteractiveActive?{backoffUntil:Math.max(e.backoffUntil,r+Q)}:{backoffUntil:e.backoffUntil}}function Jn(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 Gn(e,r){let n=new Map([...e.trails].filter(([i])=>i!==r.id)),t=Vn({...e,trails:n},r.settled,r.now),o=V(t.state,r.now,r.queue);return{effects:[...t.effects,...o.effects],state:o.state}}function Vn(e,r,n){switch(r.kind){case"aborted":case"crashed":return{effects:[],state:e};case"app-unreachable":return Rr({category:"driver",now:n,state:e,subject:"app-unreachable"});case"error":return Xn(e,r.error,n);case"done":return Zn(e,r.result)}}function Xn(e,r,n){if(r.source==="lockfile-stale")return{effects:[{kind:"reload"}],state:{...e,loading:!0,lockfile:{kind:"loading"}}};let t=ge(r);return t==="trail"?{effects:[],state:{...e,consecutiveErrors:0,lastUnhealthyReportAt:null}}:Rr({category:t,now:n,state:e,subject:Yn(r)})}function Yn(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 Zn(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 et=6,rt=2e4;function Rr({category:e,now:r,state:n,subject:t}){let o=n.consecutiveErrors+1;if(o<et)return{effects:[],state:{...n,consecutiveErrors:o}};let i=e==="driver"?Math.max(n.backoffUntil,r+Q):n.backoffUntil,a=n.lastUnhealthyReportAt==null||r-n.lastUnhealthyReportAt>=rt;return{effects:a?[{kind:"report-unhealthy",subject:t}]:[],state:{...n,backoffUntil:i,consecutiveErrors:o,lastUnhealthyReportAt:a?r:n.lastUnhealthyReportAt}}}function br(e){return{enabled:e.desired.active,executorLocal:e.executorLocal,maxTrailLength:e.desired.maxTrailLength,workers:e.desired.localWorkers}}function Er(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 Ir(e){let r=ot(e),n=st(()=>{r.dispatch(R())});return B(()=>{r.dispatch(R())}),r.dispatch(R()),{notifyQueueChange:()=>{r.dispatch({kind:"executor-changed",local:e.executorIsLocal()}),r.dispatch(R())},setDesired:t=>{r.dispatch({desired:t,kind:"desired-changed",now:Date.now(),queue:W()})},status:()=>at(r.current()),stop:()=>{n(),B(null),r.dispatch({kind:"stopped"})}}}function ot(e){let r={draining:!1,queue:[],runtime:it(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=wr(r.runtime.state,i);n(l=>({...l,state:a.state})),a.effects.forEach(l=>{lt({commit:n,dispatch:t,effect:l,params:e,runtime:r.runtime})}),o()};return{dispatch:t,current:()=>r.runtime}}function it(e){return{controllers:new Map,prepared:null,state:{...vr(),executorLocal:e.executorIsLocal()}}}function at(e){return{explorer:xr(e.state,Date.now(),W()),exploring:e.state.trails.size,progress:{attempts:e.state.attempts,findings:e.state.findings}}}function W(){let e=je();return{active:e.active,headedActive:e.headedActive,poolSize:e.poolSize,queued:e.queued}}function R(){return{kind:"tick",now:Date.now(),queue:W()}}function st(e){let r={timer:setTimeout(function n(){e(),r.timer=setTimeout(n,K)},K)};return()=>{clearTimeout(r.timer)}}function lt({commit:e,dispatch:r,effect:n,params:t,runtime:o}){switch(n.kind){case"load":case"reload":{dt(t.cwd,o.prepared).then(({outcome:i,prepared:a})=>{e(l=>({...l,prepared:a})),r({kind:"load-settled",now:Date.now(),outcome:i}),r(R())});return}case"abort":{n.ids.forEach(i=>{o.controllers.get(i)?.abort()});return}case"launch":{Array.from({length:n.count}).forEach(()=>{ct({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 dt(e,r){let n=await w(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 pe(e);if(t.isErr())return{outcome:{kind:"blocked",reason:"load-failed"},prepared:null};let o=await D(e,t.value);if(o.isErr())return{outcome:{kind:"blocked",reason:o.error.kind},prepared:null};let i=await ke(o.value);return i==null?{outcome:{kind:"blocked",reason:"load-failed"},prepared:null}:{outcome:{kind:"ready",rawHash:n},prepared:{exploration:i,rawHash:n}}}function ct({commit:e,dispatch:r,maxTrailLength:n,params:t,prepared:o}){if(o==null)return;let i=he({lockfileHash:o.rawHash,prepared:o.exploration,random:ut,strategy:{...ye("even"),maxAttemptLength:n}});if(i==null)return;let a=`explore:${tt()}`,l=new AbortController;e(d=>({...d,controllers:new Map([...d.controllers,[a,l]])})),r({id:a,kind:"trail-started",now:Date.now()}),q({headed:!1,workClass:"p3-explore",task:()=>pt({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:W(),settled:d})})}var Pr=2**31;function ut(){return nt(Pr)/Pr}async function pt({assign:e,params:r,signal:n}){let t=await r.executeTrail(e,n);return t.kind==="aborted"?{kind:"aborted"}:t.kind==="error"?ft(r,t.error):{kind:"done",result:t}}async function ft(e,r){let n=await Ee(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 Tt}from"gql.tada";import{connect as yt}from"net";import gt from"ssh2";import{WebSocket as Tr,createWebSocketStream as St}from"ws";var mt="ripplo-";function X(e){return Object.entries(e).map(([r,n])=>`${mt}${r}.${n}`)}var{Server:kt,utils:Cr}=gt;function Lr(){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 Ar(e){return new Promise((r,n)=>{let t={closers:new Set,stopped:!1},o=new Tr(e.relayUrl,X({grant:e.grant,role:"daemon-control"}));o.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:ht(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 ht(e,r){return()=>(r.stopped=!0,r.closers.forEach(n=>{n()}),e.close(),Promise.resolve())}function vt(e,r,n){let t=wt(n);t!=null&&Rt(e,r,t.pipeId)}function wt(e){try{let r=JSON.parse(xt(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 xt(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function Rt(e,r,n){if(r.stopped)return;let t=new Tr(e.relayUrl,X({pipeId:n,role:"daemon-data"}));t.on("open",()=>{bt(e,r,t)}),t.on("error",o=>{s.warn({err:o},"cloud-executor relay data pipe error")})}function bt(e,r,n){let t=St(n);t.on("error",()=>{});let o=new kt({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{Pt(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{It({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{n.close()};r.closers.add(i),n.on("close",()=>r.closers.delete(i)),Et(o,t)}function Et(e,r){e.injectSocket(r)}function Pt(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function It({accept:e,allowedPorts:r,deny:n,destPort:t}){if(!r.includes(t)){n();return}let o=!1,i=yt({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 Lt=Tt(`
|
|
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
|
-
`),$=class extends Error{failure;constructor(r){super(r.kind),this.failure=r}};async function qr({config:e,devSessionId:r,onFatal:n}){let t=Lr(),i=(await u({config:e,document:Lt,variables:{devSessionId:r,engineUrl:e.engineUrl,hostKeyFingerprint:t.fingerprint,localUrl:e.appUrl}})).enterCloudMode;if(i==null)throw new $({kind:"empty-response"});if(i.__typename!=="RelaySession")throw new $({kind:"server-error",typename:i.__typename});let a=await Ar({allowedPorts:[...new Set([Dr(e.appUrl),Dr(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 Dr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var Hr=[1e3,3e3,8e3,15e3];function Ur(){return{attempt:0,desired:"local",devSessionId:null,stopped:!1,tunnel:"down"}}function Wr(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"requested":return Dt(e,r.mode);case"connected":return Y({...e,devSessionId:r.devSessionId},[]);case"tunnel-started":return qt(e);case"tunnel-failed":case"tunnel-fatal":return Ht(e);case"retry-due":return e.tunnel==="down"?Y(e,[]):{effects:[],state:e};case"stopped":return{effects:e.tunnel==="down"?[]:[{kind:"stop-tunnel"}],state:{...e,desired:"local",stopped:!0,tunnel:"down"}}}}function At(e){let r=Math.min(e,Hr.length-1),n=Hr[r];if(n==null)throw new Error("executor retry ladder is empty");return n}function Dt(e,r){return r===e.desired?{effects:[],state:e}:Y({...e,attempt:0,desired:r},[{kind:"notify-changed"}])}function Y(e,r){return _(e)&&e.tunnel==="down"&&e.devSessionId!=null?{effects:[...r,{devSessionId:e.devSessionId,kind:"start-tunnel"}],state:{...e,tunnel:"starting"}}:!_(e)&&e.tunnel!=="down"?{effects:[...r,{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}:{effects:r,state:e}}function _(e){return e.desired==="cloud"&&e.devSessionId!=null&&!e.stopped}function qt(e){return _(e)?{effects:[],state:{...e,attempt:0,tunnel:"up"}}:{effects:[{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}}function Ht(e){let r={...e,tunnel:"down"};return _(r)?{effects:[{delayMs:At(r.attempt),kind:"schedule-retry"}],state:{...r,attempt:r.attempt+1}}:{effects:[],state:r}}function Mr(e){let r={draining:!1,io:Promise.resolve(),queue:[],retryTimer:null,state:Ur(),tunnel:null},n=t=>{r.queue.push(t),!r.draining&&(r.draining=!0,Or(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 Or(e,r,n){let t=e.queue.shift();if(t==null)return;let o=Wr(e.state,t);e.state=o.state,o.effects.forEach(i=>{Ut({cell:e,dispatch:r,effect:i,params:n})}),Or(e,r,n)}function Ut({cell:e,dispatch:r,effect:n,params:t}){switch(n.kind){case"start-tunnel":{$r(e,()=>Wt({cell:e,devSessionId:n.devSessionId,dispatch:r,params:t}));return}case"stop-tunnel":{let o=e.tunnel;e.tunnel=null,_r(e),o!=null&&$r(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 Wt({cell:e,devSessionId:r,dispatch:n,params:t}){try{let o=await qr({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 $r(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 $t}from"fs/promises";import{existsSync as Fr}from"fs";import Z from"path";async function jr({config:e,cwd:r}){let n=Z.join(r,".ripplo","debug");await(await $t(n,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!Fr(Z.join(n,i,oe))&&Fr(Z.join(n,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>Ge({config:e,debugDir:n,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as _t}from"child_process";import Nr from"os";import{CancellationTokenSource as Br,ResponseError as Kr}from"vscode-jsonrpc/node";function Qr(e,r){return()=>{let n=_t(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:Fe(n),kill:()=>{Mt(n)},onExit:t=>{n.once("exit",t)}}}}function zr(e){let r={closed:!1,devSessionId:e.devSessionId,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return Xr(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(n=>ee(n,r)))},execute:(n,t)=>jt(n,t,r),exploreTrail:(n,t)=>Bt(n,t,r),routeSpan:(n,t)=>{let o=r.workers.find(i=>i.runId===n);o?.worker.connection.sendNotification(Me,{runId:n,span:t})},setSize:n=>{Qt(n,r)}}}function Mt(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var Ot=1e4,Ft=1e4,Jr=-32800;async function jt(e,r,n){let t=await Gr(n);if(t.runId=e.runId,!t.alive)return M(t,n),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let o=new Br,i=()=>{o.cancel()};r.aborted&&o.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await t.worker.connection.sendRequest(We,e,o.token),l=He.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return Nt(a,t)}finally{r.removeEventListener("abort",i),o.dispose(),M(t,n)}}async function Gr(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=Vr(e);return n.runId="pending",await n.ready,n}return new Promise(n=>{e.waiters.push(t=>{t.runId="pending",n(t)})})}function Vr(e){let r=e.spawn(),n={resolve:()=>{}},t={alive:!0,id:e.nextId,ready:new Promise(o=>{n.resolve=o,r.connection.onNotification(Ue,o)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest($e,()=>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 M(e,r){if(e.runId=void 0,!e.alive||r.closed)return;if(r.workers.length>r.size){ee(e,r);return}let n=r.waiters.shift();n?.(e)}async function ee(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(Oe).catch(()=>{});let t=setTimeout(()=>{e.worker.kill()},Ot);await n,clearTimeout(t)}function Nt(e,r){return e instanceof Kr&&e.code===Jr?{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 Bt(e,r,n){let t=await Gr(n);if(t.runId="explore",!t.alive)return M(t,n),{error:{detail:"worker-dead",source:"transport"},kind:"error"};let o=new Br,i={cancel:()=>{}},a=()=>{o.cancel();let l=setTimeout(()=>{t.worker.kill()},Ft);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=Se.safeParse(l);return d.success?d.data:{error:{detail:"bad-result",source:"transport"},kind:"error"}}catch(l){return Kt(l)}finally{i.cancel(),r.removeEventListener("abort",a),o.dispose(),M(t,n)}}function Kt(e){return e instanceof Kr&&e.code===Jr?{kind:"aborted"}:{error:{detail:e instanceof Error?e.message.slice(0,120):"unknown",source:"transport"},kind:"error"}}function Qt(e,r){r.size=e,e>Nr.availableParallelism()&&s.warn({cores:Nr.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=>{ee(o,r)}),Xr(r)}function Xr(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{Vr(e)})}import O from"fs";import zt from"p-retry";import{graphql as b}from"gql.tada";import{print as F}from"graphql";var Jt=b(`
|
|
81
|
-
query DaemonExploration($devSessionId: String!) {
|
|
82
|
-
exploration(devSessionId: $devSessionId) {
|
|
83
|
-
active
|
|
84
|
-
localWorkers
|
|
85
|
-
maxTrailLength
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
`),Gt=b(`
|
|
89
|
-
subscription WatchExplorationChanged($devSessionId: String!) {
|
|
90
|
-
explorationChanged(devSessionId: $devSessionId) {
|
|
91
|
-
exploration {
|
|
92
|
-
active
|
|
93
|
-
localWorkers
|
|
94
|
-
maxTrailLength
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`);function Yr({config:e,devSessionId:r,exploration:n,sseClient:t}){return zt(()=>Vt({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:F(Gt),variables:{devSessionId:r}},{complete:()=>{},error:o=>{s.error(o,"exploration subscription error")},next:o=>{Zr(n,o.data?.explorationChanged.exploration)}})}async function Vt({config:e,devSessionId:r,exploration:n}){let t=await u({config:e,document:Jt,variables:{devSessionId:r}});Zr(n,t.exploration)}function Zr(e,r){r!=null&&e.setDesired({active:r.active,localWorkers:r.localWorkers,maxTrailLength:r.maxTrailLength})}var Xt=b(`
|
|
99
|
-
subscription HooksPausedWatch($projectId: String!) {
|
|
100
|
-
hooksPausedRequested(projectId: $projectId) {
|
|
101
|
-
paused
|
|
102
|
-
projectId
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`),Yt=b(`
|
|
106
|
-
subscription WatchLocalConcurrencyChanged {
|
|
107
|
-
myMaxLocalConcurrentRunsChanged
|
|
108
|
-
}
|
|
109
|
-
`);function en({pool:e,sseClient:r}){return r.subscribe({query:F(Yt)},{complete:()=>{},error:n=>{s.error(n,"localConcurrency subscription error")},next:n=>{let t=n.data?.myMaxLocalConcurrentRunsChanged;t!=null&&(H(t),e.setSize(t))}})}var Zt=b(`
|
|
110
|
-
subscription WatchExecutorChangeRequested($devSessionId: String!) {
|
|
111
|
-
executorChangeRequested(devSessionId: $devSessionId) {
|
|
112
|
-
executor
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
`);function rn({config:e,devSessionId:r,sseClient:n,switcher:t}){return t.connect(r),eo({config:e,switcher:t}),ro({devSessionId:r,sseClient:n,switcher:t})}async function eo({config:e,switcher:r}){let n=await nr(e);if(n.isErr()){s.warn({error:n.error},"initial executor fetch failed, staying local");return}r.request(n.value)}function ro({devSessionId:e,sseClient:r,switcher:n}){return r.subscribe({query:F(Zt),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 nn({cwd:e,projectId:r,sseClient:n}){return n.subscribe({query:F(Xt),variables:{projectId:r}},{complete:()=>{},error:t=>{s.error(t,"hooksPaused subscription error")},next:t=>{let o=t.data?.hooksPausedRequested?.paused;o!=null&&re({cwd:e,paused:o})}})}function re({cwd:e,paused:r}){let n=Pe(e);if(r&&!O.existsSync(n)){O.writeFileSync(n,"");return}!r&&O.existsSync(n)&&O.unlinkSync(n)}var oo=6e4,tn=500,io=15e3,ao=ne(`
|
|
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
|
-
`),so=ne(`
|
|
128
|
-
query WatchLocalConcurrency {
|
|
129
|
-
currentUser {
|
|
130
|
-
id
|
|
131
|
-
maxLocalConcurrentRuns
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
`),lo=ne(`
|
|
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 Ja(){Ro();let e=wo(process.cwd()),r=e.cwd,n=So(r),t={current:null},o={handler:()=>{}},i=Mr({config:e,onChanged:()=>{o.handler()}}),a={handler:()=>{}},l=ho(),d=pr(),c=Je({config:e,cwd:r,executor:i.current,ready:l.promise,explorationStatus:()=>t.current?.status()??co(),onShutdownRequest:()=>{a.handler()},sseHealth:()=>d.snapshot()}),p=await vo({cwd:r,ipc:c,releasePid:n}),f=await T(r);f.isErr()&&(process.stderr.write(`ripplo: ${L(f.error)}
|
|
147
|
-
`),process.exit(1));let E=f.value,m=await G(()=>Ke({config:e,cwd:r,lockfile:E}),{config:e,label:"initial sync"}),P=await w(r);P!=null&&Qe(P);let I=ur({config:e,cwd:r}),y=await Eo(e);re({cwd:r,paused:m.hooksPaused});let g=Ne(r);g!=null&&s.info("watching branch %s in %s",g,r);let h=to({headers:{Authorization:`Bearer ${e.token}`},retry:or,retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});jr({config:e,cwd:r}).catch(()=>{});let S=go({cwd:r,devSessionId:m.devSessionId,initialConcurrency:y}),C=po({config:e,devSessionId:m.devSessionId,pool:S,executorIsLocal:()=>i.current()==="local"});t.current=C,o.handler=C.notifyQueueChange;let on=await fo({cwd:r,pool:S}),j=lr({claim:c.claim,config:e,cwd:r,initialId:m.devSessionId,pool:S,sseClient:h,sseHealth:d}),an=uo({config:e,devSessionId:m.devSessionId,executorSwitch:i,exploration:C,pool:S,sseClient:h}),sn=yo({config:e,session:j}),ln=xo();l.resolve(),mo(m.devSessionId);let dn=async()=>{sn(),ln(),I(),C.stop(),p.close(),j.stop(),an(),await S.close(),await i.stop(),await on.stop().catch(()=>{}),await Promise.race([u({config:e,document:lo,variables:{cwd:e.cwd,devSessionId:j.getId(),projectId:e.projectId}}).catch(()=>{}),new Promise(cn=>setTimeout(cn,3e3))]),n()},x=()=>{dn().finally(()=>process.exit(0))};a.handler=x,process.on("SIGINT",x),process.on("SIGTERM",x),process.on("SIGHUP",x),process.on("SIGBREAK",x),await new Promise(()=>{})}function co(){return{explorer:{kind:"off"},exploring:0,progress:{attempts:0,findings:0}}}function uo({config:e,devSessionId:r,executorSwitch:n,exploration:t,pool:o,sseClient:i}){let a=[rn({config:e,devSessionId:r,sseClient:i,switcher:n}),nn({cwd:e.cwd,projectId:e.projectId,sseClient:i}),en({pool:o,sseClient:i}),Yr({config:e,devSessionId:r,exploration:t,sseClient:i})];return()=>{a.forEach(l=>{l()})}}function po({config:e,devSessionId:r,executorIsLocal:n,pool:t}){return Ir({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:n,executeTrail:(o,i)=>t.exploreTrail(o,i),report:o=>{Xe({attempts:o.attempts,config:e,devSessionId:r,findings:o.findings,trail:Ve(o.result)}).catch(i=>{s.warn({error:i},"exploration progress report failed")})},reportUnhealthy:()=>{Ye(e,r).catch(o=>{s.warn({error:o},"exploration unhealthy report failed")})}})}function fo({cwd:e,pool:r}){return ve({localDir:no.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:n=>{let t=n.attributes["ripplo.run"];t!=null&&r.routeSpan(t,n)}})}function mo(e){process.stdout.write(`${Ae({devSessionId:e,version:ce()})}
|
|
148
|
-
`)}function yo({config:e,session:r}){let n=async()=>{try{let o=await u({config:e,document:ao,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()},io);return()=>{clearInterval(t)}}function go({cwd:e,devSessionId:r,initialConcurrency:n}){return zr({devSessionId:r,initialSize:n,spawn:Qr(Po(),e),lockfileProvider:async()=>{let t=await v(e);if(t.isErr())return{unavailable:`daemon-load-failed:${t.error.kind}`};let o=await xe(e,t.value);return{lockfileJson:se(le,o)}}})}function So(e){try{return be({cwd:e,onCompromised:ko})}catch(r){throw r instanceof Re&&(process.stderr.write(`${De({cwd:r.cwd,pid:r.pid})}
|
|
149
|
-
`),process.exit(1)),r}}function ko(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${qe()}
|
|
150
|
-
`),process.exit(1)}function ho(){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 kr({cwd:e,onConnection:r.handleConnection})).match(o=>o,o=>{process.stderr.write(`${Ce(o)}
|
|
151
|
-
`),n(),process.exit(1)})}function wo(e){return k(e).match(r=>r,r=>{process.stderr.write(`${fe(r)}
|
|
152
|
-
`),process.exit(1)})}function xo(){N({maxRuns:tn});let e=setInterval(()=>{N({maxRuns:tn})},oo);return()=>{clearInterval(e)}}function Ro(){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 bo=4;async function Eo(e){try{let n=(await u({config:e,document:so,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(n!=null)return H(n),n}catch(r){s.warn({err:r},"failed to fetch local concurrency setting; using default")}return bo}function Po(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{Ja as runDaemon};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as t}from"./chunk-NJFCO7FT.js";import"./chunk-N45RSC6N.js";import{a as e}from"./chunk-VXJACUXK.js";import"./chunk-GAOLASGV.js";import"./chunk-JJ4QQPAV.js";import"./chunk-MOI4L3EX.js";import"./chunk-ESTPIODD.js";import"./chunk-OQ6KNYPG.js";import"./chunk-PPB7QGV2.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-NBSDY7QG.js";import"./chunk-MHNGR6M7.js";import"./chunk-GYH4P7SC.js";import"./chunk-XBN6AJVQ.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-77DJHICC.js";import"./chunk-JNLHZVZJ.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 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-NJFCO7FT.js";import"./chunk-N45RSC6N.js";import"./chunk-MOI4L3EX.js";import"./chunk-ESTPIODD.js";import"./chunk-OQ6KNYPG.js";import"./chunk-PPB7QGV2.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import"./chunk-NBSDY7QG.js";import"./chunk-MHNGR6M7.js";import"./chunk-GYH4P7SC.js";import"./chunk-XBN6AJVQ.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-77DJHICC.js";import"./chunk-JNLHZVZJ.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditAnalyze};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-VXJACUXK.js";import"./chunk-GAOLASGV.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-GYH4P7SC.js";import"./chunk-XBN6AJVQ.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-77DJHICC.js";import"./chunk-JNLHZVZJ.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditFlagStubs};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as e}from"./chunk-IA7TU3WW.js";import{a as t}from"./chunk-6FU7HD6D.js";import{a as i}from"./chunk-3OI2UH3H.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-XBN6AJVQ.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-JNLHZVZJ.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 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-6FU7HD6D.js";import"./chunk-OWN4P2K7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditRipploSkillGate};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-3OI2UH3H.js";import"./chunk-JJ4QQPAV.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditScopeGate};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-3PF5QK56.js";import"./chunk-N45RSC6N.js";import"./chunk-GAOLASGV.js";import"./chunk-JJ4QQPAV.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as scopeReminder};
|
package/dist/status-PUV7KG33.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-TRQDCBKV.js";import"./chunk-CUXFU3MF.js";import"./chunk-B6OQ2JE2.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-NBSDY7QG.js";import"./chunk-MHNGR6M7.js";import"./chunk-GYH4P7SC.js";import"./chunk-XBN6AJVQ.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-2A6KSSUD.js";import"./chunk-77DJHICC.js";import"./chunk-JNLHZVZJ.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-T46B2OPT.js";import"./chunk-N45RSC6N.js";import"./chunk-5E62BCS7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-KQWFJRIP.js";import"./chunk-7WZ3VIUU.js";import"./chunk-3M2E253R.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-INURHJF4.js";import"./chunk-52IE2PAQ.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as tasksReminder};
|