ripplo 0.8.0 → 0.8.1
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-3SCOYB4C.js +16 -0
- package/dist/chunk-42LZFMNX.js +4 -0
- package/dist/chunk-4AGLYPJ5.js +23 -0
- package/dist/chunk-4DXOF4WS.js +55 -0
- package/dist/chunk-7WZ3VIUU.js +4 -0
- package/dist/chunk-7YPITJA2.js +8 -0
- package/dist/chunk-CDPYJKK7.js +9 -0
- package/dist/chunk-CJUKILIO.js +4 -0
- package/dist/chunk-CLFA4JSB.js +4 -0
- package/dist/chunk-EXV2RD7Z.js +6 -0
- package/dist/chunk-FCEWYZLQ.js +4 -0
- package/dist/chunk-FEHVIHVA.js +5 -0
- package/dist/chunk-FZIMQTFG.js +4 -0
- package/dist/chunk-G22LPS47.js +4 -0
- package/dist/chunk-G7ZQUZ2X.js +242 -0
- package/dist/chunk-GD2AESFG.js +5 -0
- package/dist/chunk-HGL5SE75.js +4 -0
- package/dist/chunk-HYHAOKYP.js +7 -0
- package/dist/chunk-IW2P4NKR.js +4 -0
- package/dist/chunk-JJ4QQPAV.js +4 -0
- package/dist/chunk-KSNZWWHX.js +6 -0
- package/dist/chunk-LB2L72ZU.js +48 -0
- package/dist/chunk-LB65USNP.js +73 -0
- package/dist/chunk-MHNGR6M7.js +4 -0
- package/dist/chunk-MOI4L3EX.js +4 -0
- package/dist/chunk-NWWET7CM.js +11 -0
- package/dist/{chunk-SAYJ5AQK.js → chunk-OAXYJKXD.js} +19 -19
- package/dist/chunk-OQ6KNYPG.js +4 -0
- package/dist/chunk-OWN4P2K7.js +4 -0
- package/dist/chunk-PBL3TBB7.js +6 -0
- package/dist/chunk-R4ZTRVDQ.js +4 -0
- package/dist/chunk-S7GMY5LS.js +6 -0
- package/dist/chunk-TEP6ETHQ.js +7 -0
- package/dist/chunk-TPTG6RR4.js +8 -0
- package/dist/chunk-U4LC56T3.js +4 -0
- package/dist/chunk-VETETUHZ.js +8 -0
- package/dist/chunk-VYQ5CDRX.js +9 -0
- package/dist/chunk-WK7VO5JE.js +23 -0
- package/dist/chunk-WNAVYV4P.js +4 -0
- package/dist/{chunk-D6FZ55DP.js → chunk-WOHPPHUD.js} +1 -1
- package/dist/chunk-XGMM2RKR.js +5 -0
- package/dist/chunk-ZH3HY7BS.js +83 -0
- package/dist/cli-error-J7LD2VWZ.js +4 -0
- package/dist/compile-write-OKTXD7JL.js +4 -0
- package/dist/daemon-JJ6MZPIA.js +4 -0
- package/dist/{daemon-MBF7JVEN.js → daemon-O2VR45XP.js} +2 -2
- package/dist/daemon-lock-FLZHWM2F.js +4 -0
- package/dist/dsl-loader-IOQUYVQH.js +4 -0
- package/dist/exit-plan-gate-TTJ7U2AP.js +4 -0
- package/dist/hook.js +5 -0
- package/dist/index.js +202 -405
- package/dist/plan-reminder-Q4A5WM2G.js +4 -0
- package/dist/post-edit-PMSJ6CLE.js +4 -0
- package/dist/post-edit-analyze-2AJVDFTK.js +4 -0
- package/dist/post-edit-flag-stubs-ORFV452V.js +4 -0
- package/dist/pre-bash-run-gate-C73XUNRE.js +4 -0
- package/dist/pre-edit-H6ZOQSXF.js +4 -0
- package/dist/pre-edit-ripplo-skill-gate-63HGCUPG.js +4 -0
- package/dist/pre-edit-scope-gate-WIORRC2B.js +4 -0
- package/dist/pre-edit-watch-gate-3VSMTCE4.js +4 -0
- package/dist/prompt-submit-PSXSUTY3.js +4 -0
- package/dist/scope-reminder-TGDQCKLN.js +4 -0
- package/dist/session-preamble-HNQKBR27.js +4 -0
- package/dist/solve-worker.js +1 -1
- package/dist/status-QBBCVTXV.js +4 -0
- package/dist/stop-enforce-I27VU4IR.js +64 -0
- package/dist/tasks-reminder-A4AIFNQJ.js +4 -0
- package/dist/track-skill-load-3IPC45UX.js +4 -0
- package/dist/track-skill-prompt-YSB6OOQN.js +4 -0
- package/package.json +2 -2
- package/dist/chunk-E4AOUQQ7.js +0 -10
- package/dist/chunk-GOFUUPKD.js +0 -8
- package/dist/chunk-NIKFQP6W.js +0 -301
- package/dist/chunk-THHZNLXN.js +0 -48
- package/dist/chunk-VGYX2VAS.js +0 -85
- package/dist/daemon-VIHSG5KP.js +0 -4
- package/dist/daemon-lock-HIZ6UWXO.js +0 -4
- package/dist/status-G5OG62JI.js +0 -4
|
@@ -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,b,c}from"./chunk-NWWET7CM.js";import"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import"./chunk-KSNZWWHX.js";import"./chunk-OAXYJKXD.js";import"./chunk-KMZ3L5YA.js";export{b as renderCliFailure,c as renderHookCrash,a as renderTopLevelError};
|
|
@@ -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{e as a,f as b,g as c,h as d}from"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as compileAndWrite,c as stampedLockfile,d as stubbedWorkflows,b as writeStampedLockfile};
|
|
@@ -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,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-EXV2RD7Z.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{b as renderDaemonBindError,h as renderDaemonLockCompromised,f as renderDaemonLockHeld,e as renderDaemonReady,i as renderDaemonStatus,g as renderDaemonStopResult,k as renderDaemonVersionNote,j as renderExplorationProgress,d as renderNotSignedIn,c as renderProjectAccessDenied,a as renderTunnelProvisionFailed,l as wireOutcome};
|
|
@@ -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
|
|
4
|
+
import{A as Ne,B as je,C as T,E as Be,F as Ke,G as Ge,I as ze,J as Je,K as F,e as ge,g as ve,j as be,k as Ie,l as Ce,m as Te,n as Le,o as We,p as Ae,q as De,s as He,t as b,u as I,v as qe,w as $,x as $e,y as Fe,z as Oe}from"./chunk-G7ZQUZ2X.js";import{d as we}from"./chunk-FZIMQTFG.js";import{a as Ue,c as Me,d as _e,e as C}from"./chunk-4DXOF4WS.js";import{c as h}from"./chunk-42LZFMNX.js";import{e as Se}from"./chunk-HGL5SE75.js";import{a as ne}from"./chunk-R4ZTRVDQ.js";import{c as Z}from"./chunk-FEHVIHVA.js";import{b as ie}from"./chunk-NWWET7CM.js";import{a as _}from"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import{g as E}from"./chunk-IW2P4NKR.js";import{f as R,g as te,h as M}from"./chunk-KSNZWWHX.js";import{e as me,f as ye}from"./chunk-WOHPPHUD.js";import{c as Y,d as y,e as s,f as U,g as X}from"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import{b as he,c as ke,d as xe,e as Pe,f as Re,h as Ee}from"./chunk-EXV2RD7Z.js";import{M as le,O as de,P as ce,Q as ue,R as pe,S as fe,d as ae,h as se}from"./chunk-ZH3HY7BS.js";import{A as ee,H as re,N as oe}from"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import Pn from"path";import{createClient as Rn}from"graphql-sse";import En,{AbortError as bn}from"p-retry";import{graphql as V}from"gql.tada";import{graphql as Gr}from"gql.tada";import{print as zr}from"graphql";async function Qe({config:e,cwd:r,headed:o,pool:n,runId:t,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let c=await R(r);if(c.isErr())return await T(e,t,`lockfile:${c.error.kind}`),{kind:"dispatch-error",reason:{detail:`lockfile:${c.error.kind}`,type:"generic"}};let p=Kr(c.value,{testSlug:a,workflowSlug:d});if(p==null)return await T(e,t,`no-test:${d}/${a}`),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let u=await b({headed:o,workClass:l,task:()=>n.execute({headed:o,runId:t,testRef:p},i)});return!u.serverNotified&&u.outcome.kind==="error"&&await T(e,t,u.outcome.detail),u.outcome}function Kr(e,{testSlug:r,workflowSlug:o}){let t=e.workflows.find(i=>oe(i.name)===o)?.tests.find(i=>i.slug===r);return t==null?void 0:ae(t)}var Jr=6e4,Qr=Gr(`
|
|
5
5
|
subscription RunRequestedWatch($devSessionId: String!) {
|
|
6
6
|
runRequested(devSessionId: $devSessionId) {
|
|
7
7
|
runId
|
|
@@ -33,7 +33,7 @@ import{A as Te,B as Le,C as We,D as Ae,E as De,G as He,H as b,I,J as qe,K as $,L
|
|
|
33
33
|
reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
|
|
34
34
|
}
|
|
35
35
|
`);function Xe({cwd:e,devSessionId:r,onSubscriptionDead:o,sseClient:n}){let t=new Set,i=n.subscribe({query:Zr(eo),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),o(l)},next:a=>{no({cwd:e,devSessionId:r,event:a.data?.teleportRequested,running:t})}});return()=>{t.forEach(a=>{a.abort()}),t.clear(),i()}}function no({cwd:e,devSessionId:r,event:o,running:n}){if(o==null)return;let t=new AbortController;n.add(t),to({cwd:e,devSessionId:r,event:o,signal:t.signal}).catch(i=>{s.error({err:i},"teleport failed; daemon continuing")}).finally(()=>{n.delete(t)})}async function to({cwd:e,devSessionId:r,event:o,signal:n}){let t=d=>io({cwd:e,devSessionId:r,runId:o.runId,status:d}),i=await ao(e,o);if(i==null){s.warn({runId:o.runId},"teleport could not resolve target"),await t("unplannable");return}process.stdout.write(`ripplo: teleport ${lo(o)} step ${String(o.stepIndex+1)}
|
|
36
|
-
`);let l=await ze({cwd:e,onReady:()=>{t("opened")},signal:n,step:o.stepIndex+1,target:i});l.kind==="done"&&l.result.kind==="handed-over"||(s.warn({kind:l.kind,runId:o.runId},"teleport could not open"),await t(l.kind==="unplannable"?"unplannable":"error"))}async function io({cwd:e,devSessionId:r,runId:o,status:n}){let t=h(e).match(i=>i,()=>null);t!=null&&await y({config:t,document:oo,variables:{devSessionId:r,runId:o,status:n}}).catch(()=>null)}async function ao(e,r){if(r.kind==="explore"){let o=await so(e,r.runId);return o==null?null:{kind:"explore",repro:o}}return r.testSlug==null||r.workflowSlug==null?null:{kind:"test",ref:`${r.workflowSlug}/${r.testSlug}`}}async function so(e,r){let o=h(e).match(t=>t,()=>null);if(o==null)return null;let n=await y({config:o,document:ro,variables:{id:r}}).catch(()=>null);return n?.run?.reproJson==null?null:de.parse(JSON.parse(n.run.reproJson))}function lo(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function Ze(){let e=!0,r,o=null,n=()=>{o!=null&&(clearTimeout(o),o=null)};return{markUnhealthy:t=>{e=!1,r=t,n()},onConnected:()=>{n(),o=setTimeout(()=>{e=!0,r=void 0,o=null},1e4)},onConnecting:()=>{n()},snapshot:()=>({detail:r,ok:e})}}import co from"fs";import nr from"net";import{err as tr,ok as uo}from"neverthrow";async function ir({cwd:e,onConnection:r}){X(e);let o=we(e),n=await er({onConnection:r,socketPath:o});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(rr(o)).mapErr(or(o)):await po(o)?tr({kind:"already-running",socketPath:o}):(ar(o),(await er({onConnection:r,socketPath:o})).map(rr(o)).mapErr(or(o)))}function po(e){return new Promise(r=>{let o=nr.connect(e);o.once("connect",()=>{o.destroy(),r(!0)}),o.once("error",()=>{r(!1)})})}async function er(e){let r=await fo(e);return r.kind==="listening"?uo(r.server):tr(r.error)}function fo({onConnection:e,socketPath:r}){return new Promise(o=>{let n=nr.createServer(e);n.once("error",t=>{o({error:t.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:t.message},kind:"failed"})}),n.listen(r,()=>{o({kind:"listening",server:n})})})}function rr(e){return r=>({socketPath:e,close:()=>{r.close(),ar(e)}})}function ar(e){co.rmSync(e,{force:!0})}function or(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as mo,randomUUID as yo}from"crypto";function lr(e){let r={attempts:0,consecutiveErrors:0,driverBackoffUntil:0,findings:0,lastUnhealthyReportMs:0,lockfile:null,prepared:null,preparing:!1,refreshing:!1,windowAttempts:0,windowFindings:0,windowStartMs:Date.now()},o=N(e,r);return{priority:"p3",next:()=>xo(e,r),onResult:()=>{},ready:()=>o,status:()=>({attempts:r.attempts,findings:r.findings}),stop:()=>Promise.resolve()}}var go=10;async function N(e,r){if(!r.preparing){r.preparing=!0;try{let o=await e.loadLockfile(),n=o==null?null:await So(o);if(n==null||o==null)return;r.lockfile=o.lockfile,r.prepared=n,j(r),e.notifyWork()}finally{r.preparing=!1}}}async function So({lockfile:e,rawHash:r}){let o=await ue(e);return o==null?null:{exploration:o,lockfileHashValue:r,strategy:le("even")}}var wo=6,vo=3e4,ho=2e4;function j(e){e.consecutiveErrors=0,e.driverBackoffUntil=0,e.lastUnhealthyReportMs=0}async function ko(e,r){if(!(r.refreshing||r.preparing||r.prepared==null)){r.refreshing=!0;try{let o=await e.loadLockfile();if(o==null||o.rawHash===r.prepared.lockfileHashValue)return;s.info("workflow definitions changed, re-preparing exploration"),r.prepared=null,await N(e,r)}finally{r.refreshing=!1}}}function xo(e,r){ko(e,r);let o=r.prepared;if(o==null||Date.now()<r.driverBackoffUntil)return null;let n=pe({lockfileHash:o.lockfileHashValue,prepared:o.exploration,random:Po,strategy:{...o.strategy,maxAttemptLength:e.maxTrailLength()}});if(n==null)return null;let t=n.baseStateTest.name;return{id:`explore:${yo()}`,label:t,run:i=>Ro({assign:n,params:e,signal:i,state:r})}}var sr=2**31;function Po(){return mo(sr)/sr}async function Ro({assign:e,params:r,signal:o,state:n}){if(!await r.probeApp()){dr({params:r,reason:"app-unreachable",state:n});return}let t=await r.executeTrail(e,o);if(t.kind==="aborted")return;if(t.kind==="error"){bo({params:r,reason:t.reason,state:n});return}j(n),n.attempts+=1,n.windowAttempts+=1;let i=t.kind==="finding";i&&(n.findings+=1,n.windowFindings+=1,s.info("exploration finding recorded")),r.reportProgress({attempts:1,findings:i?1:0,result:t}),n.windowAttempts>=go&&Eo(n)}function Eo(e){let r=Date.now()-e.windowStartMs;s.info({attempts:e.windowAttempts,avgTrailMs:Math.round(r/e.windowAttempts),findings:e.windowFindings,windowMs:r,yield:Number((e.windowFindings/e.windowAttempts).toFixed(3))},"explore window"),e.windowAttempts=0,e.windowFindings=0,e.windowStartMs=Date.now()}function bo({params:e,reason:r,state:o}){if(r?.startsWith("lockfile:daemon-load-failed")===!0){Io(e,o);return}dr({params:e,reason:r,state:o})}function Io(e,r){r.preparing||(r.prepared=null,N(e,r))}function dr({params:e,reason:r,state:o}){let n=To(r);if(n==="trail"){j(o);return}o.consecutiveErrors+=1,s.debug("exploration infra error: %s",r),!(o.consecutiveErrors<wo)&&(n==="driver"&&(o.driverBackoffUntil=Date.now()+vo),Co({params:e,reason:r,state:o}))}function Co({params:e,reason:r,state:o}){let n=Date.now();n-o.lastUnhealthyReportMs<ho||(o.lastUnhealthyReportMs=n,s.warn("exploration unhealthy after %d consecutive infra errors (last: %s)",o.consecutiveErrors,r),e.reportUnhealthy())}function To(e){return e==="app-unreachable"?"driver":e==null||e==="error"||e.startsWith("transport:")?"infra":e.startsWith("runtime:")?Lo(e.slice(8)):"trail"}function Lo(e){return e==="driver-launch"?"driver":se(e)?"infra":"trail"}function B(e){return{priority:e,next:()=>null,onResult:()=>{}}}function cr({config:e,executorIsLocal:r,pool:o}){return Do({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:r,executeTrail:async(n,t)=>(await o).exploreTrail(n,t)})}function Do({appUrl:e,cwd:r,executeTrail:o,executorIsLocal:n}){let t={concurrency:2,enabled:!1,maxTrailLength:12},i={notify:()=>{}},a={report:p=>{}},l={report:()=>{}},d=Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:()=>t.maxTrailLength,notifyWork:()=>{i.notify()},reportProgress:p=>{a.report(p)},reportUnhealthy:()=>{l.report()}}),c=ve({now:Date.now,probe:Uo,setTimer:Mo,sources:[B("p0"),B("p1"),d],execute:({job:p,priority:u,signal:f})=>b({headed:!1,workClass:_o(u),task:()=>p.run(f)}),exploreConcurrency:()=>t.concurrency,exploreEnabled:()=>t.enabled&&n()});return $(()=>{c.notifyQueueChange()}),i.notify=()=>{c.notifyQueueChange()},{notifyExecutorChanged:()=>{c.notifyQueueChange()},progress:()=>d.status(),setConcurrency:p=>{n()&&p!==t.concurrency&&s.info({workers:p},"explore local worker count changed"),t.concurrency=p,c.notifyQueueChange()},setEnabled:p=>{t.enabled=p,c.notifyQueueChange()},setMaxTrailLength:p=>{t.maxTrailLength=p},setReportProgress:p=>{a.report=p},setReportUnhealthy:p=>{l.report=p},status:()=>({explorer:qo(t.enabled,c.stalled()),exploring:c.explorationActive(),progress:d.status()}),stop:()=>{c.stop(),$(null),d.stop()}}}function Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a}){return lr({cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a,loadLockfile:async()=>{let{fingerprint:l,result:d}=await te(r),c=await C(r);return c==null?null:d.match(async p=>({fingerprint:l,lockfile:await E(r,p),rawHash:c}),()=>Promise.resolve(null))},probeApp:async()=>await ge(e)==null})}function qo(e,r){return e?r>0?"stalled":"on":"off"}function Uo(){let e=qe();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function Mo(e,r){let o=setTimeout(e,r);return()=>{clearTimeout(o)}}function _o(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}import{graphql as en}from"gql.tada";import{connect as Fo}from"net";import Oo from"ssh2";import{WebSocket as pr,createWebSocketStream as No}from"ws";var $o="ripplo-";function K(e){return Object.entries(e).map(([r,o])=>`${$o}${r}.${o}`)}var{Server:jo,utils:ur}=Oo;function fr(){let e=ur.generateKeyPairSync("ed25519"),r=ur.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function mr(e){return new Promise((r,o)=>{let n={closers:new Set,stopped:!1},t=new pr(e.relayUrl,K({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:Bo(t,n)})}),t.on("message",i=>{Ko(e,n,i)}),t.on("close",(i,a)=>{n.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),Zo(e,n)}),t.on("error",i=>{o(i instanceof Error?i:new Error(String(i)))})})}function Bo(e,r){return()=>(r.stopped=!0,r.closers.forEach(o=>{o()}),e.close(),Promise.resolve())}function Ko(e,r,o){let n=Go(o);n!=null&&Jo(e,r,n.pipeId)}function Go(e){try{let r=JSON.parse(zo(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 zo(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function Jo(e,r,o){if(r.stopped)return;let n=new pr(e.relayUrl,K({pipeId:o,role:"daemon-data"}));n.on("open",()=>{Qo(e,r,n)}),n.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function Qo(e,r,o){let n=No(o);n.on("error",()=>{});let t=new jo({hostKeys:[e.hostKey.privateKey]},a=>{a.on("authentication",l=>{Yo(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{Xo({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{o.close()};r.closers.add(i),o.on("close",()=>r.closers.delete(i)),Vo(t,n)}function Vo(e,r){e.injectSocket(r)}function Yo(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function Xo({accept:e,allowedPorts:r,deny:o,destPort:n}){if(!r.includes(n)){o();return}let t=!1,i=Fo({autoSelectFamily:!0,host:"localhost",port:n},()=>{t=!0;let a=e();a.on("error",()=>{}),i.pipe(a).pipe(i)});i.on("error",()=>{t||o()})}function Zo(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(o=>{o()}),e.onFatal())}var rn=en(`
|
|
36
|
+
`);let l=await ze({cwd:e,onReady:()=>{t("opened")},signal:n,step:o.stepIndex+1,target:i});l.kind==="done"&&l.result.kind==="handed-over"||(s.warn({kind:l.kind,runId:o.runId},"teleport could not open"),await t(l.kind==="unplannable"?"unplannable":"error"))}async function io({cwd:e,devSessionId:r,runId:o,status:n}){let t=h(e).match(i=>i,()=>null);t!=null&&await y({config:t,document:oo,variables:{devSessionId:r,runId:o,status:n}}).catch(()=>null)}async function ao(e,r){if(r.kind==="explore"){let o=await so(e,r.runId);return o==null?null:{kind:"explore",repro:o}}return r.testSlug==null||r.workflowSlug==null?null:{kind:"test",ref:`${r.workflowSlug}/${r.testSlug}`}}async function so(e,r){let o=h(e).match(t=>t,()=>null);if(o==null)return null;let n=await y({config:o,document:ro,variables:{id:r}}).catch(()=>null);return n?.run?.reproJson==null?null:de.parse(JSON.parse(n.run.reproJson))}function lo(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function Ze(){let e=!0,r,o=null,n=()=>{o!=null&&(clearTimeout(o),o=null)};return{markUnhealthy:t=>{e=!1,r=t,n()},onConnected:()=>{n(),o=setTimeout(()=>{e=!0,r=void 0,o=null},1e4)},onConnecting:()=>{n()},snapshot:()=>({detail:r,ok:e})}}import co from"fs";import nr from"net";import{err as tr,ok as uo}from"neverthrow";async function ir({cwd:e,onConnection:r}){X(e);let o=we(e),n=await er({onConnection:r,socketPath:o});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(rr(o)).mapErr(or(o)):await po(o)?tr({kind:"already-running",socketPath:o}):(ar(o),(await er({onConnection:r,socketPath:o})).map(rr(o)).mapErr(or(o)))}function po(e){return new Promise(r=>{let o=nr.connect(e);o.once("connect",()=>{o.destroy(),r(!0)}),o.once("error",()=>{r(!1)})})}async function er(e){let r=await fo(e);return r.kind==="listening"?uo(r.server):tr(r.error)}function fo({onConnection:e,socketPath:r}){return new Promise(o=>{let n=nr.createServer(e);n.once("error",t=>{o({error:t.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:t.message},kind:"failed"})}),n.listen(r,()=>{o({kind:"listening",server:n})})})}function rr(e){return r=>({socketPath:e,close:()=>{r.close(),ar(e)}})}function ar(e){co.rmSync(e,{force:!0})}function or(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as mo,randomUUID as yo}from"crypto";function lr(e){let r={attempts:0,consecutiveErrors:0,driverBackoffUntil:0,findings:0,lastUnhealthyReportMs:0,lockfile:null,prepared:null,preparing:!1,refreshing:!1,windowAttempts:0,windowFindings:0,windowStartMs:Date.now()},o=N(e,r);return{priority:"p3",next:()=>xo(e,r),onResult:()=>{},ready:()=>o,status:()=>({attempts:r.attempts,findings:r.findings}),stop:()=>Promise.resolve()}}var go=10;async function N(e,r){if(!r.preparing){r.preparing=!0;try{let o=await e.loadLockfile(),n=o==null?null:await So(o);if(n==null||o==null)return;r.lockfile=o.lockfile,r.prepared=n,j(r),e.notifyWork()}finally{r.preparing=!1}}}async function So({lockfile:e,rawHash:r}){let o=await ue(e);return o==null?null:{exploration:o,lockfileHashValue:r,strategy:le("even")}}var wo=6,vo=3e4,ho=2e4;function j(e){e.consecutiveErrors=0,e.driverBackoffUntil=0,e.lastUnhealthyReportMs=0}async function ko(e,r){if(!(r.refreshing||r.preparing||r.prepared==null)){r.refreshing=!0;try{let o=await e.loadLockfile();if(o==null||o.rawHash===r.prepared.lockfileHashValue)return;s.info("workflow definitions changed, re-preparing exploration"),r.prepared=null,await N(e,r)}finally{r.refreshing=!1}}}function xo(e,r){ko(e,r);let o=r.prepared;if(o==null||Date.now()<r.driverBackoffUntil)return null;let n=pe({lockfileHash:o.lockfileHashValue,prepared:o.exploration,random:Po,strategy:{...o.strategy,maxAttemptLength:e.maxTrailLength()}});if(n==null)return null;let t=n.baseStateTest.name;return{id:`explore:${yo()}`,label:t,run:i=>Ro({assign:n,params:e,signal:i,state:r})}}var sr=2**31;function Po(){return mo(sr)/sr}async function Ro({assign:e,params:r,signal:o,state:n}){if(!await r.probeApp()){dr({params:r,reason:"app-unreachable",state:n});return}let t=await r.executeTrail(e,o);if(t.kind==="aborted")return;if(t.kind==="error"){bo({params:r,reason:t.reason,state:n});return}j(n),n.attempts+=1,n.windowAttempts+=1;let i=t.kind==="finding";i&&(n.findings+=1,n.windowFindings+=1,s.info("exploration finding recorded")),r.reportProgress({attempts:1,findings:i?1:0,result:t}),n.windowAttempts>=go&&Eo(n)}function Eo(e){let r=Date.now()-e.windowStartMs;s.info({attempts:e.windowAttempts,avgTrailMs:Math.round(r/e.windowAttempts),findings:e.windowFindings,windowMs:r,yield:Number((e.windowFindings/e.windowAttempts).toFixed(3))},"explore window"),e.windowAttempts=0,e.windowFindings=0,e.windowStartMs=Date.now()}function bo({params:e,reason:r,state:o}){if(r?.startsWith("lockfile:daemon-load-failed")===!0){Io(e,o);return}dr({params:e,reason:r,state:o})}function Io(e,r){r.preparing||(r.prepared=null,N(e,r))}function dr({params:e,reason:r,state:o}){let n=To(r);if(n==="trail"){j(o);return}o.consecutiveErrors+=1,s.debug("exploration infra error: %s",r),!(o.consecutiveErrors<wo)&&(n==="driver"&&(o.driverBackoffUntil=Date.now()+vo),Co({params:e,reason:r,state:o}))}function Co({params:e,reason:r,state:o}){let n=Date.now();n-o.lastUnhealthyReportMs<ho||(o.lastUnhealthyReportMs=n,s.warn("exploration unhealthy after %d consecutive infra errors (last: %s)",o.consecutiveErrors,r),e.reportUnhealthy())}function To(e){return e==="app-unreachable"?"driver":e==null||e==="error"||e.startsWith("transport:")?"infra":e.startsWith("runtime:")?Lo(e.slice(8)):"trail"}function Lo(e){return e==="driver-launch"?"driver":se(e)?"infra":"trail"}function B(e){return{priority:e,next:()=>null,onResult:()=>{}}}function cr({config:e,executorIsLocal:r,pool:o}){return Do({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:r,executeTrail:async(n,t)=>(await o).exploreTrail(n,t)})}function Do({appUrl:e,cwd:r,executeTrail:o,executorIsLocal:n}){let t={concurrency:2,enabled:!1,maxTrailLength:12},i={notify:()=>{}},a={report:p=>{}},l={report:()=>{}},d=Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:()=>t.maxTrailLength,notifyWork:()=>{i.notify()},reportProgress:p=>{a.report(p)},reportUnhealthy:()=>{l.report()}}),c=ve({now:Date.now,probe:Uo,setTimer:Mo,sources:[B("p0"),B("p1"),d],execute:({job:p,priority:u,signal:f})=>b({headed:!1,workClass:_o(u),task:()=>p.run(f)}),exploreConcurrency:()=>t.concurrency,exploreEnabled:()=>t.enabled&&n()});return $(()=>{c.notifyQueueChange()}),i.notify=()=>{c.notifyQueueChange()},{notifyExecutorChanged:()=>{c.notifyQueueChange()},progress:()=>d.status(),setConcurrency:p=>{n()&&p!==t.concurrency&&s.info({workers:p},"explore local worker count changed"),t.concurrency=p,c.notifyQueueChange()},setEnabled:p=>{t.enabled=p,c.notifyQueueChange()},setMaxTrailLength:p=>{t.maxTrailLength=p},setReportProgress:p=>{a.report=p},setReportUnhealthy:p=>{l.report=p},status:()=>({explorer:qo(t.enabled,c.stalled()),exploring:c.explorationActive(),progress:d.status()}),stop:()=>{c.stop(),$(null),d.stop()}}}function Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a}){return lr({cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a,loadLockfile:async()=>{let{fingerprint:l,result:d}=await te(r),c=await C(r);return c==null?null:d.match(async p=>({fingerprint:l,lockfile:await E(r,p),rawHash:c}),()=>Promise.resolve(null))},probeApp:async()=>await ge(e)==null})}function qo(e,r){return e?r>0?"stalled":"on":"off"}function Uo(){let e=qe();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function Mo(e,r){let o=setTimeout(e,r);return()=>{clearTimeout(o)}}function _o(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}import{graphql as en}from"gql.tada";import{connect as Fo}from"net";import Oo from"ssh2";import{WebSocket as pr,createWebSocketStream as No}from"ws";var $o="ripplo-";function K(e){return Object.entries(e).map(([r,o])=>`${$o}${r}.${o}`)}var{Server:jo,utils:ur}=Oo;function fr(){let e=ur.generateKeyPairSync("ed25519"),r=ur.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function mr(e){return new Promise((r,o)=>{let n={closers:new Set,stopped:!1},t=new pr(e.relayUrl,K({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:Bo(t,n)})}),t.on("message",i=>{Ko(e,n,i)}),t.on("close",(i,a)=>{n.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),Zo(e,n)}),t.on("error",i=>{o(i instanceof Error?i:new Error(String(i)))})})}function Bo(e,r){return()=>(r.stopped=!0,r.closers.forEach(o=>{o()}),e.close(),Promise.resolve())}function Ko(e,r,o){let n=Go(o);n!=null&&Jo(e,r,n.pipeId)}function Go(e){try{let r=JSON.parse(zo(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 zo(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function Jo(e,r,o){if(r.stopped)return;let n=new pr(e.relayUrl,K({pipeId:o,role:"daemon-data"}));n.on("open",()=>{Qo(e,r,n)}),n.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function Qo(e,r,o){let n=No(o);n.on("error",()=>{});let t=new jo({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{Yo(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{Xo({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{o.close()};r.closers.add(i),o.on("close",()=>r.closers.delete(i)),Vo(t,n)}function Vo(e,r){e.injectSocket(r)}function Yo(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function Xo({accept:e,allowedPorts:r,deny:o,destPort:n}){if(!r.includes(n)){o();return}let t=!1,i=Fo({autoSelectFamily:!0,host:"localhost",port:n},()=>{t=!0;let a=e();a.on("error",()=>{}),i.pipe(a).pipe(i)});i.on("error",()=>{t||o()})}function Zo(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(o=>{o()}),e.onFatal())}var rn=en(`
|
|
37
37
|
mutation EnterCloudMode(
|
|
38
38
|
$devSessionId: String!
|
|
39
39
|
$localUrl: String!
|
|
@@ -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,b,c,d,e,f}from"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.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};
|
|
@@ -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{e as a,f as b,g as c,h as d}from"./chunk-KSNZWWHX.js";import"./chunk-OAXYJKXD.js";import"./chunk-KMZ3L5YA.js";export{a as LOCKFILE_RELATIVE_PATH,d as loadRipplo,b as loadRipploCached,c as loadRipploCachedWithFingerprint};
|
|
@@ -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{f as r}from"./chunk-HGL5SE75.js";import{c as s}from"./chunk-S7GMY5LS.js";import{a as n}from"./chunk-MHNGR6M7.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.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
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
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 o,c as s}from"./chunk-HYHAOKYP.js";import{a as i}from"./chunk-R4ZTRVDQ.js";import{c as e}from"./chunk-FEHVIHVA.js";import"./chunk-S7GMY5LS.js";import{a as r}from"./chunk-CJUKILIO.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-J7LD2VWZ.js");process.stderr.write(`${p(t)}
|
|
5
|
+
`),process.exit(1)});
|