ripplo 0.15.2 → 0.16.0

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 (75) hide show
  1. package/README.md +18 -142
  2. package/dist/index.js +56 -664
  3. package/package.json +8 -45
  4. package/dist/assets/browser-trace.js +0 -1
  5. package/dist/assets/rrweb.js +0 -54
  6. package/dist/capture-worker.js +0 -13892
  7. package/dist/chunk-3BPQWAUL.js +0 -4
  8. package/dist/chunk-47LLHHJH.js +0 -9
  9. package/dist/chunk-5HFJIZLI.js +0 -4
  10. package/dist/chunk-5RKZ44OU.js +0 -4
  11. package/dist/chunk-7WZ3VIUU.js +0 -4
  12. package/dist/chunk-AXROBTLA.js +0 -4
  13. package/dist/chunk-BFAWQ5U2.js +0 -61
  14. package/dist/chunk-BGY5F3IU.js +0 -5
  15. package/dist/chunk-BIB4JJKD.js +0 -84
  16. package/dist/chunk-C7SV6AR2.js +0 -48
  17. package/dist/chunk-CI6273ZU.js +0 -107
  18. package/dist/chunk-FEHVIHVA.js +0 -5
  19. package/dist/chunk-G6J2WIHJ.js +0 -4
  20. package/dist/chunk-HEOMRXZE.js +0 -4
  21. package/dist/chunk-HN55QF5N.js +0 -405
  22. package/dist/chunk-JJ4QQPAV.js +0 -4
  23. package/dist/chunk-JQ2CRYVX.js +0 -4
  24. package/dist/chunk-JS3DLVVI.js +0 -4
  25. package/dist/chunk-KH4QH23U.js +0 -4
  26. package/dist/chunk-KMZ3L5YA.js +0 -4
  27. package/dist/chunk-KOKEEAEF.js +0 -6
  28. package/dist/chunk-LCCJPRT5.js +0 -5
  29. package/dist/chunk-MHNGR6M7.js +0 -4
  30. package/dist/chunk-NNH3YVVO.js +0 -4
  31. package/dist/chunk-OQ6KNYPG.js +0 -4
  32. package/dist/chunk-PYDYI3AA.js +0 -23
  33. package/dist/chunk-Q2TF5WLS.js +0 -6
  34. package/dist/chunk-QEE4CNMY.js +0 -6
  35. package/dist/chunk-R4ZTRVDQ.js +0 -4
  36. package/dist/chunk-RIASQHPG.js +0 -4
  37. package/dist/chunk-RLB66SU3.js +0 -4
  38. package/dist/chunk-SXVWB7TZ.js +0 -6
  39. package/dist/chunk-T6WA2F3S.js +0 -16
  40. package/dist/chunk-TZPYILZK.js +0 -4
  41. package/dist/chunk-VHFITVRX.js +0 -13
  42. package/dist/chunk-W3CXPVVB.js +0 -7
  43. package/dist/chunk-WB3HHOCG.js +0 -11
  44. package/dist/chunk-XA6BMQTW.js +0 -8
  45. package/dist/chunk-XAMVRZJH.js +0 -23
  46. package/dist/chunk-Y52M43LO.js +0 -8
  47. package/dist/chunk-YD4VBOBY.js +0 -4
  48. package/dist/chunk-YRU6BOIP.js +0 -9
  49. package/dist/chunk-ZSD6QDYB.js +0 -56
  50. package/dist/cli-error-UYWIDE4L.js +0 -4
  51. package/dist/compile-write-QNV2EA5B.js +0 -4
  52. package/dist/daemon-D4UCHMHS.js +0 -175
  53. package/dist/daemon-LZTY7W4M.js +0 -4
  54. package/dist/daemon-lock-RPKO5SNE.js +0 -4
  55. package/dist/dsl-loader-G2CRA252.js +0 -4
  56. package/dist/dsl-typecheck-worker.js +0 -6
  57. package/dist/exit-plan-gate-44YWEKYS.js +0 -4
  58. package/dist/hook.js +0 -5
  59. package/dist/plan-reminder-EDDIUY43.js +0 -4
  60. package/dist/post-edit-4CM5P2G2.js +0 -4
  61. package/dist/post-edit-analyze-HKOTNA2H.js +0 -4
  62. package/dist/post-edit-flag-stubs-2HZMK4NQ.js +0 -4
  63. package/dist/pre-bash-run-gate-CDFNAIK3.js +0 -4
  64. package/dist/pre-edit-JZX36QX6.js +0 -4
  65. package/dist/pre-edit-ripplo-skill-gate-A6ETC3QN.js +0 -4
  66. package/dist/pre-edit-scope-gate-HNIQ7KOQ.js +0 -4
  67. package/dist/pre-edit-watch-gate-T2TWL66C.js +0 -4
  68. package/dist/prompt-submit-GVZHK3CI.js +0 -4
  69. package/dist/scope-reminder-A6GVTTVE.js +0 -4
  70. package/dist/session-preamble-IZQPIWST.js +0 -4
  71. package/dist/status-CNSPYNYP.js +0 -4
  72. package/dist/stop-enforce-NKKP2X4U.js +0 -64
  73. package/dist/tasks-reminder-TDWPD3KV.js +0 -4
  74. package/dist/track-skill-load-SXSDMHFO.js +0 -4
  75. package/dist/track-skill-prompt-7N4TQAD2.js +0 -4
@@ -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,b,c}from"./chunk-WB3HHOCG.js";import"./chunk-VHFITVRX.js";import"./chunk-MHNGR6M7.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-KMZ3L5YA.js";export{b as renderCliFailure,c as renderHookCrash,a as renderTopLevelError};
@@ -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{h as a,i as b,j as c,k as d,l as e,m as f}from"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as compileAndWrite,f as lockfileModelStatus,c as stampedLockfile,d as stampedLockfileFromDisk,e as stubbedWorkflows,b as writeStampedLockfile};
@@ -1,175 +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 er,B as rr,C as nr,E as or,F as q,J as tr,K as ir,L as ar,M as sr,O as lr,P as dr,R as K,S as H,T as cr,U as ur,V as Q,b as Oe,g as We,k as Ge,l as Ne,m as ze,n as Be,o as Ke,q as Qe,r as Je,s as Ve,t as Xe,u as Ye,w as A,x as L,y as Ze,z as B}from"./chunk-HN55QF5N.js";import{a as Me,b as $e,c as Ue,d as Fe,e as je,g as _e}from"./chunk-Q2TF5WLS.js";import{d as qe}from"./chunk-JQ2CRYVX.js";import{b as He}from"./chunk-WB3HHOCG.js";import{a as De,c as Ae,d as Le,e as h}from"./chunk-BFAWQ5U2.js";import{a as D}from"./chunk-VHFITVRX.js";import{c as m}from"./chunk-JS3DLVVI.js";import{a as se}from"./chunk-R4ZTRVDQ.js";import{c as ae}from"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{j as Ce,k as C}from"./chunk-5RKZ44OU.js";import{H as ve,J as we,K as xe,N as T,O as be,P as Re,S as Pe,T as Ee,Y as Ie,ba as Te,n as ke}from"./chunk-BIB4JJKD.js";import{k as S,l as he,m as I}from"./chunk-RLB66SU3.js";import{Ma as Se,U as ye,sa as ge}from"./chunk-ZSD6QDYB.js";import{e as me}from"./chunk-KH4QH23U.js";import{e as pe,f as fe}from"./chunk-RIASQHPG.js";import{a as le,c as de,d as p,f as s,g as ce,h as z,i as ue}from"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import{randomUUID as Ft}from"crypto";import jt from"path";import{createClient as _t}from"graphql-sse";import Gt,{AbortError as Nt}from"p-retry";import{graphql as wn}from"gql.tada";import{graphql as Cn}from"gql.tada";import{print as Dn}from"graphql";async function pr({config:e,cwd:r,headed:n,pool:o,runId:t,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let c=await S(r);if(c.isErr())return await q({config:e,ownerToken:null,reason:`lockfile:${c.error.kind}`,runId:t}),{kind:"dispatch-error",reason:{detail:`lockfile:${c.error.kind}`,type:"generic"}};let u=Tn(c.value,{testSlug:a,workflowSlug:d});if(u==null)return await q({config:e,ownerToken:null,reason:`no-test:${d}/${a}`,runId:t}),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let f=await A({headed:n,workClass:l,task:()=>o.execute({headed:n,runId:t,testRef:u},i)});return!f.serverNotified&&f.outcome.kind==="error"&&await q({config:e,ownerToken:null,reason:f.outcome.detail,runId:t}),f.outcome}function Tn(e,{testSlug:r,workflowSlug:n}){let t=e.workflows.find(i=>Se(i.name)===n)?.tests.find(i=>i.slug===r);return t==null?void 0:ke(t)}var An=6e4,Ln=Cn(`
5
- subscription RunRequestedWatch($devSessionId: String!) {
6
- runRequested(devSessionId: $devSessionId) {
7
- runId
8
- testSlug
9
- workflowId
10
- workflowSlug
11
- }
12
- }
13
- `);async function fr(e){let r=Math.min(1e3*2**e,An)+Mn();await new Promise(n=>setTimeout(n,r))}function mr({claim:e,cwd:r,devSessionId:n,pool:o,sseClient:t,sseHealth:i}){let a=new Set,l=Hn(r);return t.subscribe({query:Dn(Ln),variables:{devSessionId:n}},{complete:qn,error:d=>{let c=d instanceof Error?d.message:String(d);i.markUnhealthy(c),s.error({err:d},"runRequested subscription failed")},next:d=>{On({claim:e,dispatchConfig:l,event:d.data?.runRequested,inFlightRunIds:a,pool:o})}},{connected:()=>{i.onConnected()},connecting:d=>{i.onConnecting(d),d&&s.debug("runRequested SSE reconnecting")}})}function qn(){}function Hn(e){return ae(e),{config:m(e).match(r=>r,r=>{s.error({failure:r},"failed to load env for run dispatch")}),cwd:e}}function On({claim:e,dispatchConfig:r,event:n,inFlightRunIds:o,pool:t}){if(n==null)return;if(o.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}o.add(n.runId),process.stdout.write(`ripplo: run ${n.workflowSlug}
14
- `);let i=Wn(e(n.runId),n);i.started(),pr({config:r.config,cwd:r.cwd,headed:i.headed,pool:t,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(()=>{o.delete(n.runId)})}function Wn(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:rr(e.token),workClass:"p1-cli",finished:n=>{e.finished(r.runId,n)},started:()=>{e.started(r.runId)}}}function Mn(){return Math.floor(Math.random()*2700)+300}import{graphql as k}from"gql.tada";import{print as yr}from"graphql";import{clearTimeout as Un,setTimeout as Fn}from"timers";var jn=k(`
15
- subscription TeleportRequestedWatch($devSessionId: String!) {
16
- teleportRequested(devSessionId: $devSessionId) {
17
- runId
18
- stepIndex
19
- kind
20
- testSlug
21
- workflowSlug
22
- }
23
- }
24
- `),_n=k(`
25
- subscription DurableTeleportRequestedWatch($devSessionId: String!) {
26
- durableTeleportRequested(devSessionId: $devSessionId) {
27
- requestId
28
- runId
29
- stepIndex
30
- kind
31
- testSlug
32
- workflowSlug
33
- }
34
- }
35
- `),Gn=k(`
36
- query TeleportRunRepro($id: String!) {
37
- run(id: $id) {
38
- id
39
- reproJson
40
- }
41
- }
42
- `),Nn=k(`
43
- mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
44
- reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
45
- }
46
- `),zn=k(`
47
- mutation ClaimTeleportRequest($devSessionId: String!, $requestId: String!) {
48
- claimTeleportRequest(devSessionId: $devSessionId, requestId: $requestId)
49
- }
50
- `),Bn=k(`
51
- mutation ReportDurableTeleportResult(
52
- $devSessionId: String!
53
- $requestId: String!
54
- $status: TeleportOutcome!
55
- ) {
56
- reportDurableTeleportResult(devSessionId: $devSessionId, requestId: $requestId, status: $status)
57
- }
58
- `);function gr({cwd:e,devSessionId:r,sseClient:n}){let o=new Set,t=Kn({cwd:e,devSessionId:r,running:o,sseClient:n}),i=Qn({cwd:e,devSessionId:r,running:o,sseClient:n});return()=>{o.forEach(a=>{a.abort()}),o.clear(),t(),i()}}function Kn({cwd:e,devSessionId:r,running:n,sseClient:o}){return o.subscribe({query:yr(jn),variables:{devSessionId:r}},{complete:Sr,error:t=>{s.error({err:t},"teleportRequested subscription failed")},next:t=>{let i=t.data?.teleportRequested;hr({cwd:e,devSessionId:r,event:i==null?i:{...i,requestId:void 0},running:n})}})}function Sr(){}function Qn({cwd:e,devSessionId:r,running:n,sseClient:o}){return o.subscribe({query:yr(_n),variables:{devSessionId:r}},{complete:Sr,error:t=>{s.error({err:t},"durableTeleportRequested subscription failed")},next:t=>{hr({cwd:e,devSessionId:r,event:t.data?.durableTeleportRequested,running:n})}})}function hr({cwd:e,devSessionId:r,event:n,running:o}){if(n==null)return;let t=new AbortController;o.add(t),Jn({cwd:e,devSessionId:r,event:n,signal:t.signal}).catch(i=>{s.error({err:i},"teleport failed; daemon continuing")}).finally(()=>{o.delete(t)})}async function Jn({cwd:e,devSessionId:r,event:n,signal:o}){n.requestId!=null&&!await Yn({cwd:e,devSessionId:r,requestId:n.requestId})||await Vn({cwd:e,devSessionId:r,event:n,signal:o})}async function Vn({cwd:e,devSessionId:r,event:n,signal:o}){let t=c=>Xn({cwd:e,devSessionId:r,requestId:n.requestId,runId:n.runId,status:c}),i=to(o),a=await ro({cwd:e,event:n});if(a==null){i.clear(),s.warn({runId:n.runId},"teleport could not resolve target"),await t("unplannable");return}process.stdout.write(`ripplo: teleport ${oo(n)} step ${String(n.stepIndex+1)}
59
- `);let d=await lr({cwd:e,onReady:()=>{i.clear(),t("opened")},signal:i.signal,step:n.stepIndex+1,target:a});i.clear(),!(d.kind==="done"&&d.result.kind==="handed-over")&&(s.warn({kind:d.kind,runId:n.runId},"teleport could not open"),await t(d.kind==="unplannable"?"unplannable":"error"))}async function Xn({cwd:e,devSessionId:r,requestId:n,runId:o,status:t}){if(n!=null){await eo({cwd:e,devSessionId:r,requestId:n,status:t});return}await Zn({cwd:e,devSessionId:r,runId:o,status:t})}async function Yn({cwd:e,devSessionId:r,requestId:n}){let o=m(e).match(i=>i,()=>null);return o==null?!1:(await p({config:o,document:zn,variables:{devSessionId:r,requestId:n}}).catch(()=>null))?.claimTeleportRequest===!0}async function Zn({cwd:e,devSessionId:r,runId:n,status:o}){let t=m(e).match(i=>i,()=>null);t!=null&&await p({config:t,document:Nn,variables:{devSessionId:r,runId:n,status:o}}).catch(()=>null)}async function eo({cwd:e,devSessionId:r,requestId:n,status:o}){let t=m(e).match(i=>i,()=>null);t!=null&&await p({config:t,document:Bn,variables:{devSessionId:r,requestId:n,status:o}}).catch(()=>null)}async function ro({cwd:e,event:r}){if(r.kind==="explore"){let n=await no({cwd:e,runId: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 no({cwd:e,runId:r}){let n=m(e).match(i=>i,()=>null);if(n==null)return null;let o=await p({config:n,document:Gn,variables:{id:r}}).catch(()=>null);if(o?.run?.reproJson==null)return null;let t=T(o.run.reproJson);return t.kind==="valid"?t.repro:null}function oo(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function to(e){let r=new AbortController,n=Fn(()=>{r.abort()},3e4);return{signal:AbortSignal.any([e,r.signal]),clear:()=>{Un(n)}}}import O from"fs";import io from"p-retry";import{graphql as b}from"gql.tada";import{print as M}from"graphql";var ao=b(`
60
- query DaemonExploration($devSessionId: String!) {
61
- exploration(devSessionId: $devSessionId) {
62
- active
63
- localWorkers
64
- maxTrailLength
65
- }
66
- }
67
- `),so=b(`
68
- subscription WatchExplorationChanged($devSessionId: String!) {
69
- explorationChanged(devSessionId: $devSessionId) {
70
- exploration {
71
- active
72
- localWorkers
73
- maxTrailLength
74
- }
75
- }
76
- }
77
- `);function kr({config:e,devSessionId:r,exploration:n,lifetime:o,sseClient:t}){return io(()=>lo({config:e,devSessionId:r,exploration:n,lifetime:o}),{factor:2,minTimeout:500,retries:6}).catch(i=>{s.warn({err:i},"initial exploration state read failed \u2014 explorer stays off")}),t.subscribe({query:M(so),variables:{devSessionId:r}},{complete:U,error:i=>{$({error:i,stream:"explorationChanged"})},next:i=>{vr(n,i.data?.explorationChanged.exploration)}})}async function lo({config:e,devSessionId:r,exploration:n,lifetime:o}){if(W(o))return;let t=await p({config:e,document:ao,variables:{devSessionId:r}});W(o)||vr(n,t.exploration)}function vr(e,r){r!=null&&e.setDesired({active:r.active,localWorkers:r.localWorkers,maxTrailLength:r.maxTrailLength})}var co=b(`
78
- subscription HooksPausedWatch($projectId: String!) {
79
- hooksPausedRequested(projectId: $projectId) {
80
- paused
81
- projectId
82
- }
83
- }
84
- `),uo=b(`
85
- subscription WatchLocalConcurrencyChanged {
86
- myMaxLocalConcurrentRunsChanged
87
- }
88
- `);function wr({pool:e,sseClient:r}){return r.subscribe({query:M(uo)},{complete:U,error:n=>{$({error:n,stream:"myMaxLocalConcurrentRunsChanged"})},next:n=>{let o=n.data?.myMaxLocalConcurrentRunsChanged;o!=null&&(L(o),e.setSize(o))}})}var po=b(`
89
- subscription WatchExecutorChangeRequested($devSessionId: String!) {
90
- executorChangeRequested(devSessionId: $devSessionId) {
91
- executor
92
- }
93
- }
94
- `);function xr({config:e,devSessionId:r,lifetime:n,sseClient:o,switcher:t}){return t.connect(r),fo({config:e,lifetime:n,switcher:t}),mo({devSessionId:r,sseClient:o,switcher:t})}async function fo({config:e,lifetime:r,switcher:n}){if(W(r))return;let o=await dr(e);if(!W(r)){if(o.isErr()){s.warn({error:o.error},"initial executor fetch failed, staying local");return}n.request(o.value)}}function W(e){return e.aborted}function mo({devSessionId:e,sseClient:r,switcher:n}){return r.subscribe({query:M(po),variables:{devSessionId:e}},{complete:U,error:o=>{$({error:o,stream:"executorChangeRequested"})},next:o=>{let t=o.data?.executorChangeRequested?.executor;t!=null&&n.request(t)}})}function br({cwd:e,projectId:r,sseClient:n}){return n.subscribe({query:M(co),variables:{projectId:r}},{complete:U,error:o=>{$({error:o,stream:"hooksPausedRequested"})},next:o=>{let t=o.data?.hooksPausedRequested?.paused;t!=null&&R({cwd:e,paused:t})}})}function $({error:e,stream:r}){s.error({error:e},"%s subscription failed",r)}function U(){}function R({cwd:e,paused:r}){let n=me(e);if(r&&!O.existsSync(n)){O.writeFileSync(n,"");return}!r&&O.existsSync(n)&&O.unlinkSync(n)}function Rr({initialId:e,onSynchronized:r,subscribe:n,synchronize:o}){let t=e,i=null,a=!1,l=d();function d(){let f=new AbortController,y=n({devSessionId:t,lifetime:f.signal});return()=>{f.abort(),y()}}async function c(f){let y=await o(f);y==null||a||(l(),t=y.devSessionId,r(y),l=d())}function u(f){return a?Promise.resolve():(i!=null||(i=c(f).finally(()=>{i=null})),i)}return{getId:()=>t,reregister:()=>u("dev session ended server-side"),stop:()=>{a||(a=!0,l())}}}function Pr({claim:e,config:r,devSessionId:n,executorSwitch:o,exploration:t,onSynchronized:i,pool:a,sseClient:l,sseHealth:d}){return Rr({initialId:n,onSynchronized:c=>{i(c),R({cwd:r.cwd,paused:c.hooksPaused})},subscribe:({devSessionId:c,lifetime:u})=>yo({claim:e,config:r,devSessionId:c,executorSwitch:o,exploration:t,lifetime:u,pool:a,sseClient:l,sseHealth:d}),synchronize:c=>go({config:r,reason:c,sseHealth:d})})}function yo({claim:e,config:r,devSessionId:n,executorSwitch:o,exploration:t,lifetime:i,pool:a,sseClient:l,sseHealth:d}){let c=[xr({config:r,devSessionId:n,lifetime:i,sseClient:l,switcher:o}),br({cwd:r.cwd,projectId:r.projectId,sseClient:l}),wr({pool:a,sseClient:l}),kr({config:r,devSessionId:n,exploration:t,lifetime:i,sseClient:l}),mr({claim:e,cwd:r.cwd,devSessionId:n,pool:a,sseClient:l,sseHealth:d}),gr({cwd:r.cwd,devSessionId:n,sseClient:l})];return()=>{c.forEach(u=>{u()})}}async function go({config:e,reason:r,sseHealth:n}){n.markUnhealthy(r);let o=await I(e.cwd);return o.isErr()?(s.error("re-register: compile failed: %s",D(o.error)),null):Ae({config:e,cwd:e.cwd,lockfile:o.value})}import{createHash as So}from"crypto";import Er from"fs";function Ir(){return J===void 0&&(J=ho()),J}var J;function ho(){let e=process.argv[1];if(e==null)return null;try{let r=Er.readFileSync(Er.realpathSync(e));return So("sha256").update(r).digest("hex")}catch{return null}}import{graphql as Tr}from"gql.tada";var ko=Tr(`
95
- query OpenFindingsForRetire($projectId: String!) {
96
- exploreFindings(projectId: $projectId, status: open) {
97
- signature
98
- reproRun {
99
- reproJson
100
- }
101
- }
102
- }
103
- `),vo=Tr(`
104
- mutation RetireStaleFinding($projectId: String!, $signature: String!) {
105
- retireStaleFinding(projectId: $projectId, signature: $signature)
106
- }
107
- `);async function Cr({config:e,cwd:r,lockfile:n}){let t=(await p({config:e,document:ko,variables:{projectId:e.projectId}})).exploreFindings,i=await C(r,n);if(i.isErr())return s.info({block:i.error.kind},"skipping finding retire until next compile"),!1;let a=wo(t,i.value);return a.length===0||(await Promise.all(a.map(l=>bo(e,l))),s.info({count:a.length},"retired findings whose trail no longer replays")),!0}function wo(e,r){return e.map(n=>xo(n,r)?n.signature:null).filter(n=>n!=null)}function xo(e,r){let n=e.reproRun?.reproJson;if(n==null)return!0;let o=T(n);return o.kind==="rejected"?!0:Te(r,o.repro).kind==="unplannable"}function bo(e,r){return p({config:e,document:vo,variables:{projectId:e.projectId,signature:r}})}var Ro=6e4;function Dr(e){let r={retiredKey:null,running:!1,stopped:!1},n=async()=>{if(!(r.running||r.stopped)){r.running=!0;try{r.retiredKey=await Po(e,r.retiredKey)}catch(t){s.warn({err:t},"retire stale findings failed \u2014 retrying on next tick")}finally{r.running=!1}}},o={timer:setTimeout(function t(){n(),r.stopped||(o.timer=setTimeout(t,Ro))},0)};return()=>{r.stopped=!0,clearTimeout(o.timer)}}async function Po({config:e,cwd:r},n){let o=await h(r),t=Ir();if(o==null||t==null)return n;let i=`${o}@${t}`;if(i===n)return n;let a=await S(r);return a.isErr()?n:await Cr({config:e,cwd:r,lockfile:a.value})?i:n}import{Agent as Eo,fetch as Io}from"undici";var To=3e4;function Ar(e=To){let r=new Eo({bodyTimeout:e});return(n,o)=>Io(n,{...o,dispatcher:r})}function Lr(){let e=!0,r,n=null,o=()=>{n!=null&&(clearTimeout(n),n=null)};return{markUnhealthy:t=>{e=!1,r=t,o()},onConnected:()=>{o(),n=setTimeout(()=>{e=!0,r=void 0,n=null},1e4)},onConnecting:()=>{o()},snapshot:()=>({detail:r,ok:e})}}import Co from"fs";import Wr from"net";import{err as Mr,ok as Do}from"neverthrow";async function $r({cwd:e,onConnection:r}){ue(e);let n=qe(e),o=await qr({onConnection:r,socketPath:n});return o.isOk()||o.error.kind!=="stale-candidate"?o.map(Hr(n)).mapErr(Or(n)):await Ao(n)?Mr({kind:"already-running",socketPath:n}):(Ur(n),(await qr({onConnection:r,socketPath:n})).map(Hr(n)).mapErr(Or(n)))}function Ao(e){return new Promise(r=>{let n=Wr.connect(e);n.once("connect",()=>{n.destroy(),r(!0)}),n.once("error",()=>{r(!1)})})}async function qr(e){let r=await Lo(e);return r.kind==="listening"?Do(r.server):Mr(r.error)}function Lo({onConnection:e,socketPath:r}){return new Promise(n=>{let o=Wr.createServer(e);o.once("error",t=>{n({error:t.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:t.message},kind:"failed"})}),o.listen(r,()=>{n({kind:"listening",server:o})})})}function Hr(e){return r=>({socketPath:e,close:()=>{r.close(),Ur(e)}})}function Ur(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{randomUUID as zo}from"crypto";function Fr(){return{attempts:0,backoffUntil:0,consecutiveErrors:0,coverageWaiting:!1,desired:{active:!1,localWorkers:cr,maxTrailLength:ur},executorLocal:!0,findings:0,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"loading"},prevInteractiveActive:0,stopped:!1,trails:new Map}}function jr(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 Mo(e,r.outcome);case"trail-started":return{effects:[],state:{...e,coverageWaiting:!1,trails:new Map([...e.trails,[r.id,{startedAt:r.now}]])}};case"trail-settled":return $o(e,r);case"stopped":return{effects:[{ids:[...e.trails.keys()],kind:"abort"}],state:{...e,stopped:!0,trails:new Map}}}}function _r(e,r,n){return Q(Gr(e),Nr(e,r,n)).health}function V(e,r,n){let o=Wo(e,r,n),t={...e,...o,prevInteractiveActive:n.active},i=Q(Gr(t),Nr(t,r,n)),a=t.lockfile.kind!=="ready"&&!t.loading;return{effects:[...qo(a),...Ho(i.abortIds),...Oo({count:i.launchCount,maxTrailLength:t.desired.maxTrailLength})],state:{...t,loading:t.loading||a}}}function qo(e){return e?[{kind:"load"}]:[]}function Ho(e){return e.length>0?[{ids:e,kind:"abort"}]:[]}function Oo({count:e,maxTrailLength:r}){return e>0?[{count:e,kind:"launch",maxTrailLength:r}]:[]}function Wo(e,r,n){return n.active<e.prevInteractiveActive?{backoffUntil:Math.max(e.backoffUntil,r+H)}:{backoffUntil:e.backoffUntil}}function Mo(e,r){return r.kind==="blocked"?{effects:[],state:{...e,loading:!1,lockfile:{kind:"blocked",reason:r.reason}}}:{effects:[],state:{...e,consecutiveErrors:0,coverageWaiting:!1,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"ready"}}}}function $o(e,r){let n=new Map([...e.trails].filter(([i])=>i!==r.id)),o=Uo({...e,trails:n},r.settled,r.now),t=V(o.state,r.now,r.queue);return{effects:[...o.effects,...t.effects],state:t.state}}function Uo(e,r,n){switch(r.kind){case"aborted":return{effects:[],state:e};case"crashed":return X({now:n,state:e,subject:`exploration ${r.stage} crashed`});case"no-candidate":return{effects:[],state:{...e,backoffUntil:Math.max(e.backoffUntil,n+H),consecutiveErrors:0,coverageWaiting:xe(r.reason)}};case"app-unreachable":return X({now:n,state:e,subject:"app-unreachable"});case"error":return Fo(e,r.error,n);case"done":return _o(e,r.result)}}function Fo(e,r,n){return r.source==="lockfile-stale"?{effects:[{kind:"reload"}],state:{...e,loading:!0,lockfile:{kind:"loading"}}}:be(r)==="trail"?{effects:[],state:{...e,consecutiveErrors:0,lastUnhealthyReportAt:null}}:X({now:n,state:e,subject:jo(r)})}function jo(e){switch(e.source){case"transport":case"config":return`${e.source}: ${e.detail}`;case"runtime":return`runtime: ${e.detail}`;case"empty-trail":case"assignment-rejected":case"lockfile-stale":return e.source}}function _o(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 Go=6,No=2e4;function X({now:e,state:r,subject:n}){let o=r.consecutiveErrors+1,t=Math.max(r.backoffUntil,e+H);if(o<Go)return{effects:[],state:{...r,backoffUntil:t,consecutiveErrors:o}};let i=r.lastUnhealthyReportAt==null||e-r.lastUnhealthyReportAt>=No;return{effects:i?[{kind:"report-unhealthy",subject:n}]:[],state:{...r,backoffUntil:t,consecutiveErrors:o,lastUnhealthyReportAt:i?e:r.lastUnhealthyReportAt}}}function Gr(e){return{enabled:e.desired.active,executorLocal:e.executorLocal,maxTrailLength:e.desired.maxTrailLength,workers:e.desired.localWorkers}}function Nr(e,r,n){return{backoffActive:r<e.backoffUntil,coverageWaiting:e.coverageWaiting,headedActive:n.headedActive>0,interactiveActive:n.active,interactiveQueued:n.queued,lockfile:e.lockfile,poolSize:n.poolSize,trails:[...e.trails.entries()].map(([o,t])=>({ageMs:r-t.startedAt,id:o}))}}function Br(e){let r=Bo(e),n=Jo(()=>{r.dispatch(P())});return B(()=>{r.dispatch(P())}),r.dispatch(P()),{notifyQueueChange:()=>{r.dispatch({kind:"executor-changed",local:e.executorIsLocal()}),r.dispatch(P())},setDesired:o=>{r.dispatch({desired:o,kind:"desired-changed",now:Date.now(),queue:F()})},status:()=>Qo(r.current()),stop:()=>{n(),B(null),r.dispatch({kind:"stopped"})}}}function Bo(e){let r={draining:!1,planning:Promise.resolve(),queue:[],runtime:Ko(e)},n=a=>{r.runtime=a(r.runtime)},o=a=>{r.queue.push(a),!r.draining&&(r.draining=!0,i(),r.draining=!1)},t=a=>{r.planning=r.planning.then(a,a)},i=()=>{let a=r.queue.shift();if(a==null)return;let l=jr(r.runtime.state,a);n(d=>({...d,state:l.state})),l.effects.forEach(d=>{Vo({commit:n,dispatch:o,effect:d,params:e,queuePlanning:t,runtime:r.runtime,current:()=>r.runtime})}),i()};return{dispatch:o,current:()=>r.runtime}}function Ko(e){return{controllers:new Map,prepared:null,reservations:new Map,state:{...Fr(),executorLocal:e.executorIsLocal()}}}function Qo(e){return{explorer:_r(e.state,Date.now(),F()),exploring:e.state.trails.size,progress:{attempts:e.state.attempts,findings:e.state.findings}}}function F(){let e=Ze();return{active:e.active,headedActive:e.headedActive,poolSize:e.poolSize,queued:e.queued}}function P(){return{kind:"tick",now:Date.now(),queue:F()}}function Jo(e){let r={timer:setTimeout(function n(){e(),r.timer=setTimeout(n,K)},K)};return()=>{clearTimeout(r.timer)}}function Vo({commit:e,current:r,dispatch:n,effect:o,params:t,queuePlanning:i,runtime:a}){switch(o.kind){case"load":case"reload":{Yo(t.cwd,a.prepared).then(({outcome:l,prepared:d})=>{e(c=>({...c,prepared:d})),n({kind:"load-settled",now:Date.now(),outcome:l}),n(P())});return}case"abort":{o.ids.forEach(l=>{a.controllers.get(l)?.abort()});return}case"launch":{Array.from({length:o.count}).forEach(()=>{let l=Xo({commit:e,dispatch:n});i(()=>et({commit:e,controller:l.controller,dispatch:n,id:l.id,maxTrailLength:o.maxTrailLength,params:t,prepared:r().prepared,reservedSignatures:new Set(r().reservations.values())}))});return}case"report":{t.report({attempts:1,findings:o.finding?1:0,result:o.result}),o.finding&&s.info("exploration finding recorded");return}case"report-unhealthy":s.warn("exploration unhealthy after repeated infra errors (last: %s)",o.subject),t.reportUnhealthy()}}function Xo({commit:e,dispatch:r}){let n=`explore:${zo()}`,o=new AbortController;return e(t=>({...t,controllers:new Map([...t.controllers,[n,o]])})),r({id:n,kind:"trail-started",now:Date.now()}),{controller:o,id:n}}async function Yo(e,r){try{return await Zo(e,r)}catch(n){return s.warn({err:n},"Explorer couldn't load the model \u2014 retrying on the next tick"),{outcome:{kind:"blocked",reason:"load-failed"},prepared:null}}}async function Zo(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:o}=await he(e);if(o.isErr())return{outcome:{kind:"blocked",reason:"load-failed"},prepared:null};let t=await C(e,o.value);if(t.isErr())return{outcome:{kind:"blocked",reason:t.error.kind},prepared:null};let i=Pe(t.value);return i.kind==="model-empty"?{outcome:{kind:"blocked",reason:"model-empty"},prepared:null}:{outcome:{kind:"ready",rawHash:n},prepared:{exploration:i.value,rawHash:n}}}async function et({commit:e,controller:r,dispatch:n,id:o,maxTrailLength:t,params:i,prepared:a,reservedSignatures:l}){if(zr(r.signal)){v({commit:e,dispatch:n,id:o,settled:{kind:"aborted"}});return}if(a==null){v({commit:e,dispatch:n,id:o,settled:{kind:"crashed",stage:"planning"}});return}let d=await rt({maxTrailLength:t,params:i,prepared:a,reservedSignatures:l}).catch(u=>(s.warn({err:u},"Explorer couldn't plan a trail \u2014 retrying shortly"),null));if(d==null){v({commit:e,dispatch:n,id:o,settled:{kind:"crashed",stage:"planning"}});return}if(zr(r.signal)){v({commit:e,dispatch:n,id:o,settled:{kind:"aborted"}});return}if(i.onPlannerTrace?.(d),d.kind==="no-candidate"){v({commit:e,dispatch:n,id:o,settled:{kind:"no-candidate",reason:d.reason}});return}let c=d.assignment;e(u=>({...u,reservations:new Map([...u.reservations,[o,c.coverageSignature]])})),A({headed:!1,workClass:"p3-explore",task:()=>nt({assign:c,params:i,signal:r.signal})}).catch(u=>(s.warn({err:u},"Explorer couldn't run a trail \u2014 retrying shortly"),{kind:"crashed",stage:"execution"})).then(u=>{v({commit:e,dispatch:n,id:o,settled:u})})}function zr(e){return e.aborted}async function rt({maxTrailLength:e,params:r,prepared:n,reservedSignatures:o}){let t=Date.now(),i=await r.leaseOrdinal(),a=await Ee({attemptOrdinal:i,modelHash:n.rawHash,prepared:n.exploration,reservedSignatures:o,strategy:{...ve("even"),maxAttemptLength:e},targetGeneration:r.targetGeneration()});return s.debug({attemptOrdinal:i,beamMs:a.timing.beamMs,candidateMs:a.timing.candidateMs,candidates:a.trace.candidates,envelopesMs:a.timing.envelopesMs,expanded:a.trace.expanded,expansionMs:a.timing.expansionMs,kind:a.kind,planningMs:Date.now()-t,rejectedCycles:a.trace.rejectedCycles,rejectedReplays:a.trace.rejectedReplays,searchMs:a.timing.searchMs,selectionMs:a.timing.selectionMs,selectionTier:a.trace.selectionTier},"explorer planning completed"),a}function v({commit:e,dispatch:r,id:n,settled:o}){e(t=>({...t,controllers:new Map([...t.controllers].filter(([i])=>i!==n)),reservations:new Map([...t.reservations].filter(([i])=>i!==n))})),r({id:n,kind:"trail-settled",now:Date.now(),queue:F(),settled:o})}async function nt({assign:e,params:r,signal:n}){let o=await r.executeTrail(e,n);return o.kind==="aborted"?{kind:"aborted"}:o.kind==="error"?ot(r,o.error):{kind:"done",result:o}}async function ot(e,r){let n=await We(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 kt}from"gql.tada";import{connect as it}from"net";import at from"ssh2";import{WebSocket as Qr,createWebSocketStream as st}from"ws";var tt="ripplo-";function Y(e){return Object.entries(e).map(([r,n])=>`${tt}${r}.${n}`)}var{Server:lt,utils:Kr}=at;function Jr(){let e=Kr.generateKeyPairSync("ed25519"),r=Kr.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function Vr(e){return new Promise((r,n)=>{let o={closers:new Set,stopped:!1},t=new Qr(e.relayUrl,Y({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:dt(t,o)})}),t.on("message",i=>{ct(e,o,i)}),t.on("close",(i,a)=>{o.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),ht(e,o)}),t.on("error",i=>{n(i instanceof Error?i:new Error(String(i)))})})}function dt(e,r){return()=>(r.stopped=!0,r.closers.forEach(n=>{n()}),e.close(),Promise.resolve())}function ct(e,r,n){let o=ut(n);o!=null&&ft(e,r,o.pipeId)}function ut(e){try{let r=JSON.parse(pt(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 pt(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function ft(e,r,n){if(r.stopped)return;let o=new Qr(e.relayUrl,Y({pipeId:n,role:"daemon-data"}));o.on("open",()=>{mt(e,r,o)}),o.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function mt(e,r,n){let o=st(n);o.on("error",()=>{});let t=new lt({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{gt(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{St({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{n.close()};r.closers.add(i),n.on("close",()=>r.closers.delete(i)),yt(t,o)}function yt(e,r){e.injectSocket(r)}function gt(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function St({accept:e,allowedPorts:r,deny:n,destPort:o}){if(!r.includes(o)){s.warn({allowedPorts:r,destPort:o},"cloud-executor relay refused an unexpected port"),n();return}let t=!1,i=it({autoSelectFamily:!0,host:"localhost",port:o},()=>{t=!0;let a=e();a.on("error",()=>{}),i.pipe(a).pipe(i)});i.on("error",a=>{t||(s.warn({destPort:o,err:a},"cloud-executor relay could not reach the local app"),n())})}function ht(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(n=>{n()}),e.onFatal())}var vt=kt(`
108
- mutation EnterCloudMode(
109
- $devSessionId: String!
110
- $localUrl: String!
111
- $engineUrl: String!
112
- $hostKeyFingerprint: String!
113
- ) {
114
- enterCloudMode(
115
- devSessionId: $devSessionId
116
- localUrl: $localUrl
117
- engineUrl: $engineUrl
118
- hostKeyFingerprint: $hostKeyFingerprint
119
- ) {
120
- __typename
121
- ... on RelaySession {
122
- generation
123
- grant
124
- relayUrl
125
- secret
126
- session
127
- }
128
- ... on DevSessionEndedError {
129
- message
130
- }
131
- ... on TunnelNotConfiguredError {
132
- message
133
- }
134
- }
135
- }
136
- `),j=class extends Error{failure;constructor(r){super(r.kind),this.failure=r}};async function Yr({config:e,devSessionId:r,onFatal:n}){let o=Jr(),i=(await p({config:e,document:vt,variables:{devSessionId:r,engineUrl:e.engineUrl,hostKeyFingerprint:o.fingerprint,localUrl:e.appUrl}})).enterCloudMode;if(i==null)throw new j({kind:"empty-response"});if(i.__typename!=="RelaySession")throw new j({kind:"server-error",typename:i.__typename});let a=await Vr({allowedPorts:[...new Set([Xr(e.appUrl),Xr(e.engineUrl)])],grant:i.grant,hostKey:o,onFatal:n,relayUrl:i.relayUrl,secret:i.secret});return s.info({session:i.session},"cloud-executor relay up"),{stop:a.stop}}function Xr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var Zr=[1e3,3e3,8e3,15e3];function en(){return{attempt:0,desired:"local",devSessionId:null,stopped:!1,tunnel:"down"}}function rn(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"requested":return xt(e,r.mode);case"connected":return Z({...e,devSessionId:r.devSessionId},[]);case"tunnel-started":return bt(e);case"tunnel-failed":case"tunnel-fatal":return Rt(e);case"retry-due":return e.tunnel==="down"?Z(e,[]):{effects:[],state:e};case"stopped":return{effects:e.tunnel==="down"?[]:[{kind:"stop-tunnel"}],state:{...e,desired:"local",stopped:!0,tunnel:"down"}}}}function wt(e){let r=Math.min(e,Zr.length-1),n=Zr[r];if(n==null)throw new Error("executor retry ladder is empty");return n}function xt(e,r){return r===e.desired?{effects:[],state:e}:Z({...e,attempt:0,desired:r},[{kind:"notify-changed"}])}function Z(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 bt(e){return _(e)?{effects:[],state:{...e,attempt:0,tunnel:"up"}}:{effects:[{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}}function Rt(e){let r={...e,tunnel:"down"};return _(r)?{effects:[{delayMs:wt(r.attempt),kind:"schedule-retry"}],state:{...r,attempt:r.attempt+1}}:{effects:[],state:r}}function tn(e){let r={draining:!1,io:Promise.resolve(),queue:[],retryTimer:null,state:en(),tunnel:null},n=o=>{r.queue.push(o),!r.draining&&(r.draining=!0,an(r,n,e),r.draining=!1)};return{connect:o=>{n({devSessionId:o,kind:"connected"})},current:()=>r.state.desired,request:o=>{n({kind:"requested",mode:o})},stop:async()=>{n({kind:"stopped"}),await r.io.catch(()=>{})}}}function an(e,r,n){let o=e.queue.shift();if(o==null)return;let t=rn(e.state,o);e.state=t.state,t.effects.forEach(i=>{Pt({cell:e,dispatch:r,effect:i,params:n})}),an(e,r,n)}function Pt({cell:e,dispatch:r,effect:n,params:o}){switch(n.kind){case"start-tunnel":{nn(e,()=>Et({cell:e,devSessionId:n.devSessionId,dispatch:r,params:o}));return}case"stop-tunnel":{let t=e.tunnel;e.tunnel=null,on(e),t!=null&&nn(e,async()=>{await t.stop(),s.info("executor switched to local")});return}case"schedule-retry":{on(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":o.onChanged()}}async function Et({cell:e,devSessionId:r,dispatch:n,params:o}){try{let t=await Yr({config:o.config,devSessionId:r,onFatal:()=>{e.tunnel=null,n({kind:"tunnel-fatal"})}});e.tunnel=t,s.info("executor switched to cloud"),n({kind:"tunnel-started"})}catch(t){s.warn({err:t},"cloud tunnel failed to start; retrying in background"),n({kind:"tunnel-failed"})}}function nn(e,r){e.io=e.io.then(r).catch(n=>{s.warn({err:n},"executor io failed")})}function on(e){e.retryTimer!=null&&(clearTimeout(e.retryTimer),e.retryTimer=null)}import{graphql as It}from"gql.tada";var Tt=It(`
137
- mutation EndDevSessionWatch($projectId: String!, $cwd: String!, $devSessionId: String) {
138
- endDevSession(projectId: $projectId, cwd: $cwd, devSessionId: $devSessionId) {
139
- __typename
140
- ... on DevSession {
141
- id
142
- }
143
- ... on NoActiveDevSessionError {
144
- message
145
- }
146
- }
147
- }
148
- `);function sn(e){let r=async()=>{e.stops.forEach(o=>{o()}),e.exploration.stop(),e.socketHandle.close(),e.session.stop(),await e.pool.close(),await e.executorSwitch.stop(),await e.spanReceiver.stop().catch(()=>{}),await Promise.race([p({config:e.config,document:Tt,variables:{cwd:e.config.cwd,devSessionId:e.session.getId(),projectId:e.config.projectId}}).catch(()=>{}),new Promise(o=>setTimeout(o,3e3))]),e.releasePid()},n=()=>{r().finally(()=>process.exit(0))};e.shutdownRef.handler=n,process.on("SIGINT",n),process.on("SIGTERM",n),process.on("SIGHUP",n),process.on("SIGBREAK",n)}import{readdir as Ct}from"fs/promises";import{existsSync as ln}from"fs";import ee from"path";async function dn({config:e,cwd:r}){let n=ee.join(r,".ripplo","debug");await(await Ct(n,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!ln(ee.join(n,i,ce))&&ln(ee.join(n,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>or({config:e,debugDir:n,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as Dt}from"child_process";import cn from"os";import{CancellationTokenSource as un,ResponseError as pn}from"vscode-jsonrpc/node";function fn(e,r){return()=>{let n=Dt(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:Ye(n),kill:()=>{At(n)},onExit:o=>{n.once("exit",o)}}}}function mn(e){let r={closed:!1,devSessionId:e.devSessionId,lockfileProvider:e.lockfileProvider,nextId:0,onProgress:e.onProgress,size:e.initialSize,spawn:e.spawn,targetGeneration:e.targetGeneration,waiters:[],workers:[]};return hn(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(n=>re(n,r)))},execute:(n,o)=>Ht(n,o,r),exploreTrail:(n,o)=>Wt(n,o,r),routeSpan:(n,o)=>{let t=r.workers.find(i=>i.runId===n);t?.worker.connection.sendNotification(Je,{runId:n,span:o})},setSize:n=>{$t(n,r)},updateSession:n=>{r.devSessionId=n.devSessionId,r.targetGeneration=n.targetGeneration}}}function At(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var Lt=1e4,qt=1e4,yn=-32800;async function Ht(e,r,n){let o=await gn(n);if(o.runId=e.runId,!o.alive)return G(o,n),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let t=new un,i=()=>{t.cancel()};r.aborted&&t.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await o.worker.connection.sendRequest(Be,e,t.token),l=Ne.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return Ot(a,o)}finally{r.removeEventListener("abort",i),t.dispose(),G(o,n)}}async function gn(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=Sn(e);return n.runId="pending",await n.ready,n}return new Promise(n=>{e.waiters.push(o=>{o.runId="pending",n(o)})})}function Sn(e){let r=e.spawn(),n={resolve:()=>{}},o={alive:!0,id:e.nextId,ready:new Promise(t=>{n.resolve=t,r.connection.onNotification(ze,t)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest(Ke,()=>e.lockfileProvider()),r.connection.onNotification(Ve,t=>{let i=Ge.safeParse(t);i.success&&e.onProgress(i.data.runId,i.data.signal)}),r.onExit(()=>{o.alive=!1,e.workers=e.workers.filter(t=>t!==o),r.connection.dispose(),n.resolve()}),e.workers.push(o),o}function G(e,r){if(e.runId=void 0,!e.alive||r.closed)return;if(r.workers.length>r.size){re(e,r);return}let n=r.waiters.shift();n?.(e)}async function re(e,r){if(r.workers=r.workers.filter(t=>t!==e),!e.alive)return;let n=new Promise(t=>{e.worker.onExit(t)});await e.ready,await e.worker.connection.sendNotification(Xe).catch(()=>{});let o=setTimeout(()=>{e.worker.kill()},Lt);await n,clearTimeout(o)}function Ot(e,r){return e instanceof pn&&e.code===yn?{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 Wt(e,r,n){let o=await gn(n);if(o.runId="explore",!o.alive)return G(o,n),{error:{detail:"worker-dead",source:"transport"},kind:"error"};let t=new un,i={cancel:()=>{}},a=()=>{t.cancel();let l=setTimeout(()=>{o.worker.kill()},qt);i.cancel=()=>{clearTimeout(l)}};r.aborted&&a(),r.addEventListener("abort",a,{once:!0});try{let l=await o.worker.connection.sendRequest(Qe,{assign:e,currentTargetGeneration:n.targetGeneration,devSessionId:n.devSessionId},t.token),d=Re.safeParse(l);return d.success?d.data:{error:{detail:"bad-result",source:"transport"},kind:"error"}}catch(l){return Mt(l)}finally{i.cancel(),r.removeEventListener("abort",a),t.dispose(),G(o,n)}}function Mt(e){return e instanceof pn&&e.code===yn?{kind:"aborted",ranCount:0}:{error:{detail:e instanceof Error?e.message.slice(0,120):"unknown",source:"transport"},kind:"error"}}function $t(e,r){r.size=e,e>cn.availableParallelism()&&s.warn({cores:cn.availableParallelism(),size:e},"worker pool size exceeds available cores");let n=r.workers.filter(t=>t.alive&&t.runId===void 0),o=r.workers.length-e;n.slice(0,Math.max(0,o)).forEach(t=>{re(t,r)}),hn(r)}function hn(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{Sn(e)})}var zt=6e4,kn=500,Bt=15e3,Kt=wn(`
149
- mutation HeartbeatDevSessionWatch($id: String!, $teleportProtocolVersion: Int!) {
150
- heartbeatDevSession(id: $id, teleportProtocolVersion: $teleportProtocolVersion) {
151
- __typename
152
- ... on DevSession {
153
- id
154
- }
155
- ... on DevSessionEndedError {
156
- message
157
- }
158
- }
159
- }
160
- `),Qt=wn(`
161
- query WatchLocalConcurrency {
162
- currentUser {
163
- id
164
- maxLocalConcurrentRuns
165
- }
166
- }
167
- `);async function Zs({exploreDebug:e}){ui();let r=di(process.cwd()),n=r.cwd,o=Ft(),t=ii(n),i={current:null},a={handler:()=>{}},l=tn({config:r,onChanged:()=>{a.handler()}}),d={handler:()=>{}},c=si(),u=Lr(),f=nr({config:r,cwd:n,executor:l.current,ready:c.promise,explorationStatus:()=>i.current?.status()??Jt(),onShutdownRequest:()=>{d.handler()},sseHealth:()=>u.snapshot()}),y=await li({cwd:n,ipc:f,releasePid:t}),N=await I(n);N.isErr()&&(process.stderr.write(`ripplo: ${D(N.error)}
168
- `),process.exit(1));let xn=N.value,w=await ri({config:r,synchronize:()=>Le({config:r,cwd:n,lockfile:xn})}),ne=await h(n);ne!=null&&er(ne);let g={devSessionId:w.devSessionId,targetGeneration:vn({devSessionId:w.devSessionId,nonce:o})},bn=Dr({config:r,cwd:n});R({cwd:n,paused:w.hooksPaused});let oe=De(n);oe!=null&&s.info("watching branch %s in %s",oe,n);let Rn=_t({fetchFn:Ar(),headers:{Authorization:`Bearer ${r.token}`},retry:fr,retryAttempts:1/0,url:`${r.ripploServerUrl}/graphql`});dn({config:r,cwd:n}).catch(()=>{});let x=await oi({config:r,devSessionId:g.devSessionId,ipc:f,targetGeneration:g.targetGeneration}),E=Vt({config:r,exploreDebug:e,pool:x,currentSession:()=>g,executorIsLocal:()=>l.current()==="local"});i.current=E,a.handler=E.notifyQueueChange;let Pn=await Yt({cwd:n,pool:x}),te=Pr({claim:f.claim,config:r,devSessionId:w.devSessionId,executorSwitch:l,exploration:E,pool:x,sseClient:Rn,sseHealth:u,onSynchronized:ie=>{g.devSessionId=ie.devSessionId,g.targetGeneration=vn({devSessionId:ie.devSessionId,nonce:o}),x.updateSession(g)}}),En=ei({config:r,session:te}),In=ci();c.resolve(),await Oe("daemon_started"),Zt(w.devSessionId),sn({config:r,executorSwitch:l,exploration:E,pool:x,releasePid:t,session:te,shutdownRef:d,socketHandle:y,spanReceiver:Pn,stops:[En,In,bn]}),await new Promise(()=>{})}function Jt(){return{explorer:{kind:"off"},exploring:0,progress:{attempts:0,findings:0}}}function Vt({config:e,currentSession:r,executorIsLocal:n,exploreDebug:o,pool:t}){return Br({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:n,onPlannerTrace:o?Xt:void 0,executeTrail:(i,a)=>t.exploreTrail(i,a),leaseOrdinal:()=>ar({config:e,count:1,devSessionId:r().devSessionId}),report:i=>{ir({attempts:i.attempts,config:e,devSessionId:r().devSessionId,findings:i.findings,trail:tr(i.result)}).catch(a=>{s.warn({error:a},"exploration progress report failed")})},reportUnhealthy:()=>{sr(e,r().devSessionId).catch(i=>{s.warn({error:i},"exploration unhealthy report failed")})},targetGeneration:()=>r().targetGeneration})}function vn({devSessionId:e,nonce:r}){return{kind:"dev-session",value:`${e}:${r}`}}function Xt(e){we(e.trace).forEach(r=>{s.info({...r,explorerEvent:r.kind},"explorer planner")}),e.kind==="no-candidate"&&s.info({explorerEvent:"no-candidate",reason:e.reason},"explorer planner")}function Yt({cwd:e,pool:r}){return Ie({localDir:jt.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:n=>{let o=n.attributes["ripplo.run"];o!=null&&r.routeSpan(o,n)}})}function Zt(e){process.stdout.write(`${Fe({devSessionId:e,version:se()})}
169
- `)}function ei({config:e,session:r}){let n=async()=>{try{let t=await p({config:e,document:Kt,variables:{id:r.getId(),teleportProtocolVersion:2}});t.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(s.warn("dev session ended server-side (%s); re-registering",t.heartbeatDevSession.message),await r.reregister())}catch(t){s.warn("heartbeat failed: %s",t instanceof Error?t.message:String(t))}},o=setInterval(()=>{n()},Bt);return()=>{clearInterval(o)}}function ri({config:e,synchronize:r}){let n=e.ripploServerUrl.includes("localhost")||e.ripploServerUrl.includes("127.0.0.1");return Gt(async()=>{try{return await r()}catch(o){if(ni({config:e,error:o}),!(o instanceof le)){let t=o instanceof Error?o.message:String(o);throw s.error("initial sync failed: %s",t),new Nt(t)}throw o}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:o,error:t})=>{s.warn("initial sync attempt %d failed \u2014 retrying: %s",o,t.message)}})}function ni({config:e,error:r}){let n=de(r);n==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${Ue()}
170
- `),process.exit(1)),n==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${$e({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
171
- `),process.exit(1))}async function oi({config:e,devSessionId:r,ipc:n,targetGeneration:o}){let t=await fi(e);return ti({cwd:e.cwd,devSessionId:r,initialConcurrency:t,onProgress:n.progress,targetGeneration:o})}function ti({cwd:e,devSessionId:r,initialConcurrency:n,onProgress:o,targetGeneration:t}){return mn({devSessionId:r,initialSize:n,onProgress:o,spawn:fn(mi(),e),targetGeneration:t,lockfileProvider:async()=>{let i=await S(e);if(i.isErr())return{unavailable:`daemon-load-failed:${i.error.kind}`};let a=await Ce(e,i.value);return{lockfileJson:ye(ge,a)}}})}function ii(e){try{return fe({cwd:e,onCompromised:ai})}catch(r){throw r instanceof pe&&(process.stderr.write(`${je({cwd:r.cwd,pid:r.pid})}
172
- `),process.exit(1)),r}}function ai(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${_e()}
173
- `),process.exit(1)}function si(){let e={handler:()=>{}};return{promise:new Promise(n=>{e.handler=n}),resolve:()=>{e.handler()}}}async function li({cwd:e,ipc:r,releasePid:n}){return(await $r({cwd:e,onConnection:r.handleConnection})).match(t=>t,t=>{process.stderr.write(`${Me(t)}
174
- `),n(),process.exit(1)})}function di(e){return m(e).match(r=>r,r=>{process.stderr.write(`${He(r)}
175
- `),process.exit(1)})}function ci(){z({maxRuns:kn});let e=setInterval(()=>{z({maxRuns:kn})},zt);return()=>{clearInterval(e)}}function ui(){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 pi=4;async function fi(e){try{let n=(await p({config:e,document:Qt,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 pi}function mi(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{Zs 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,b,c,d,e,f,g,h,i,j,k}from"./chunk-Q2TF5WLS.js";import"./chunk-BIB4JJKD.js";import"./chunk-ZSD6QDYB.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as renderDaemonBindError,g as renderDaemonLockCompromised,e as renderDaemonLockHeld,d as renderDaemonReady,h as renderDaemonStatus,f as renderDaemonStopResult,j as renderDaemonVersionNote,i as renderExplorationProgress,c as renderNotSignedIn,b as renderProjectAccessDenied,k as wireOutcome};
@@ -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,b,c,d,e,f}from"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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 +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{j as a,k as b,l as c,m as d,n as e}from"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-KMZ3L5YA.js";export{a as LOCKFILE_RELATIVE_PATH,d as loadRipplo,b as loadRipploCached,c as loadRipploCachedWithFingerprint,e as ripploFingerprint};
@@ -1,6 +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"./chunk-KMZ3L5YA.js";import d from"fs";import r from"path";import o from"typescript";function l(t){let i=r.join(t,"index.ts"),e=g(t);d.mkdirSync(r.dirname(e.tsBuildInfoFile??""),{recursive:!0});let a=o.createIncrementalCompilerHost(e),s=o.createIncrementalProgram({host:a,options:e,rootNames:[i]}),u=[...s.getSyntacticDiagnostics(),...s.getSemanticDiagnostics()];s.emit();let c=u.filter(n=>f(n,t));if(c.length===0)return{diagnostics:[],ok:!0};let m={getCanonicalFileName:n=>n,getCurrentDirectory:()=>r.dirname(t),getNewLine:()=>`
5
- `};return{diagnostics:o.formatDiagnosticsWithColorAndContext(c,m).split(`
6
- `).filter(n=>n.length>0),ok:!1}}function f(t,i){let e=t.file?.fileName;return e==null?!0:e.startsWith(i)}var p=r.join(".local","tsbuildinfo");function g(t){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:o.ModuleKind.Preserve,moduleResolution:o.ModuleResolutionKind.Bundler,noEmit:!0,noUncheckedIndexedAccess:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!0,target:o.ScriptTarget.ES2022,tsBuildInfoFile:r.join(t,p)}}function h(){let t=process.argv[2];if(t==null)throw new Error("DSL typecheck worker needs the .ripplo directory");process.stdout.write(JSON.stringify(l(t)))}h();
@@ -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 n}from"./chunk-MHNGR6M7.js";import{c as r}from"./chunk-KOKEEAEF.js";import{f as s}from"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import t from"fs";import a from"os";import l from"path";var w=r("PreToolUse",o=>{if(o.tool_name!=="ExitPlanMode"||!s(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 DELETED
@@ -1,5 +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 r,c as s}from"./chunk-W3CXPVVB.js";import{a as i}from"./chunk-R4ZTRVDQ.js";import{c as o}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{b as e}from"./chunk-HEOMRXZE.js";import"./chunk-KMZ3L5YA.js";r();o(process.cwd());e(i());s(process.argv[2]??"").catch(async t=>{let{renderTopLevelError:p}=await import("./cli-error-UYWIDE4L.js");process.stderr.write(`${p(t)}
5
- `),process.exit(1)});
@@ -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-LCCJPRT5.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
@@ -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-XA6BMQTW.js";import{a as e}from"./chunk-YD4VBOBY.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-BFAWQ5U2.js";import"./chunk-QEE4CNMY.js";import"./chunk-OQ6KNYPG.js";import"./chunk-VHFITVRX.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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-XA6BMQTW.js";import"./chunk-BFAWQ5U2.js";import"./chunk-QEE4CNMY.js";import"./chunk-OQ6KNYPG.js";import"./chunk-VHFITVRX.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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-YD4VBOBY.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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{b as h}from"./chunk-G6J2WIHJ.js";import{c}from"./chunk-KOKEEAEF.js";import{a as f}from"./chunk-7WZ3VIUU.js";import{f as y}from"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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=c("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(!f(t)||!y(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 app-bug reporting bar.",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 +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-3BPQWAUL.js";import{a as t}from"./chunk-5HFJIZLI.js";import"./chunk-G6J2WIHJ.js";import{a as i}from"./chunk-T6WA2F3S.js";import"./chunk-JJ4QQPAV.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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-5HFJIZLI.js";import"./chunk-G6J2WIHJ.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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-T6WA2F3S.js";import"./chunk-JJ4QQPAV.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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-3BPQWAUL.js";import"./chunk-MHNGR6M7.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
@@ -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-PYDYI3AA.js";import{a as r}from"./chunk-AXROBTLA.js";import{a as i}from"./chunk-XAMVRZJH.js";import"./chunk-BGY5F3IU.js";import"./chunk-CI6273ZU.js";import"./chunk-SXVWB7TZ.js";import"./chunk-G6J2WIHJ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-47LLHHJH.js";import"./chunk-OQ6KNYPG.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import{a as t}from"./chunk-LCCJPRT5.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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};
@@ -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-PYDYI3AA.js";import"./chunk-BGY5F3IU.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as scopeReminder};
@@ -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{c as e}from"./chunk-KOKEEAEF.js";import{a as t}from"./chunk-7WZ3VIUU.js";import"./chunk-KMZ3L5YA.js";var n="# Ripplo \u2014 always-on session context\n\nEvery user-facing change leaves its affected critical journeys covered by passing typed workflows.\n\n## Load the matching skill first\n\nDo not edit `.ripplo/`, run `npx ripplo` commands, or diagnose Ripplo before loading the matching\nskill. The skills contain the current procedures and DSL rules.\n\n- `/ripplo:setup` initializes a project and connects state sources, sign-in, and browser readiness.\n- `/ripplo:discover` maps critical journeys and their state space.\n- `/ripplo:create` authors or strengthens a workflow.\n- `/ripplo:run` runs, diagnoses, scopes, and reports app bugs.\n- `/ripplo:tasks` handles user tasks and explorer findings.\n- `/ripplo:start` starts the app and daemon session.\n\n## Workflow authoring model\n\n- **One workflow, one critical user intent.** Follow the real multi-step click path from its natural\n entry point. Let earlier actions create state that later steps need.\n- **Start as wide as the whole journey allows.** `given` contains only meaningful presence,\n absence, relations, permissions, actor, and viewport preconditions required by every step.\n- **Keep values connected to state.** Use returned record handles and `arbitrary(field)` bindings\n in URLs, locators, inputs, conditions, and effects. Use `exact(value)` only when that concrete\n string or number drives behavior.\n- **Branch without fixing values.** Use `optional()` and named `when` branches when starting\n state changes the outcome but intent and path stay the same. Use another workflow when the intent\n or path differs.\n- **Declare the full transition.** Every mutation step declares its visible result and all\n application-state effects, including cascades. Undeclared observed state changes are frame\n violations.\n- **Every effect must definitely change state.** Use a before/after relation that excludes equality\n or model the real precondition. Do not hardcode a convenient previous value to make proof pass.\n- **Declare reachability.** An earlier durable `visible(...)` must establish every element an\n action touches. Use semantic locators. Add an accessible name to the app when one is missing.\n- **Facts keep their declared conditions.** Workflow assertions carry only under the complete state\n known at that step. Use `fact()` only for true app-wide invariants or permission boundaries.\n\n## Delivery rules\n\n- Run the app dev server and `npx ripplo daemon`. Use `npx ripplo doctor` or `/ripplo:start`.\n- Add every affected journey to Testing Scope. Implement stubs before finishing.\n- Fix app bugs in the app. Strengthen model gaps in the workflow. Do not weaken declarations to\n make a run pass.\n- Diagnose with `npx ripplo explain <runId>` and `.ripplo/debug/<runId>/behavior.jsonl` before\n re-running.\n- Keep the explorer on. Triage findings through `/ripplo:tasks`.\n- Commit `.ripplo/ripplo.lock`. Regenerate it with `npx ripplo compile`. Never edit it by hand.\n- Keep scratch output under `.ripplo/.local/`.\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/state.ts` \u2014 state schema and workflow handles. `.ripplo/workflows/index.ts` \u2014 workflow registry.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 HTTP state source and sign-in implementations, when used.\n- Browser bootstrap \u2014 browser source passed to `connect(engine)`, or `connect()` without browser\n state, followed by `connection.ready()` after the page is interactive.\n- `node_modules/@ripplo/testing/DSL.md` \u2014 full primitive catalog.\n",a=e("SessionStart",o=>{if(t(o.cwd))return{hookSpecificOutput:{additionalContext:n,hookEventName:"SessionStart"}}});export{a as sessionPreambleHook};
@@ -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-Y52M43LO.js";import"./chunk-Q2TF5WLS.js";import"./chunk-TZPYILZK.js";import"./chunk-JQ2CRYVX.js";import"./chunk-VHFITVRX.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-MHNGR6M7.js";import"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import"./chunk-ZSD6QDYB.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
@@ -1,64 +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 P,b as A,c as I}from"./chunk-BGY5F3IU.js";import{a as T,b as O,e as D,f as H,g as q,h}from"./chunk-YRU6BOIP.js";import{a as L,c as N,e as x}from"./chunk-TZPYILZK.js";import"./chunk-JQ2CRYVX.js";import{a as v,c as $}from"./chunk-QEE4CNMY.js";import"./chunk-OQ6KNYPG.js";import{a as C}from"./chunk-VHFITVRX.js";import{c as k}from"./chunk-JS3DLVVI.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{a as c}from"./chunk-MHNGR6M7.js";import{c as w}from"./chunk-KOKEEAEF.js";import{h as j,i as E,l as y}from"./chunk-5RKZ44OU.js";import"./chunk-BIB4JJKD.js";import"./chunk-RLB66SU3.js";import{Ma as g}from"./chunk-ZSD6QDYB.js";import{a as S}from"./chunk-7WZ3VIUU.js";import{f as b}from"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import{d as m}from"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.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
- ${n.join(`
6
- `)}
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(`
8
- `)}function M(n){return["--- Ripplo Run Rejected (server declined) ---",...n,"Not transient \u2014 retrying won't clear it. Resolve the stated cause (plan limit, missing test, repo link)."].join(`
9
- `)}function B(n){return["--- Open Tasks ---",...n,"Clear each: `npx ripplo tasks resolve <id> --run <runId>`, `clarify <id> <what you need>`, or `dismiss <id>`. Inspect with `tasks show <id>`."].join(`
10
- `)}function f(n){return`--- Ripplo Run Could Not Execute ---
11
- ${n}
12
- Fix the run environment (\`npx ripplo doctor\`) and re-run. ${c("start")}`}var Q=W(`
13
- query ScopeEnforce($projectId: String!, $cwd: String!) {
14
- project(id: $projectId) {
15
- id
16
- devSession(cwd: $cwd) {
17
- id
18
- scopeItems {
19
- id
20
- label
21
- workflow {
22
- id
23
- slug
24
- name
25
- spec
26
- }
27
- }
28
- }
29
- }
30
- }
31
- `),z=W(`
32
- query OpenTasks($projectId: String!, $cwd: String!) {
33
- project(id: $projectId) {
34
- id
35
- devSession(cwd: $cwd) {
36
- id
37
- tasks(status: open) {
38
- id
39
- kind
40
- title
41
- messages {
42
- body
43
- }
44
- }
45
- }
46
- }
47
- }
48
- `),Ae=w("Stop",async n=>{let{cwd:e}=n;if(!S(e)||!b(e)||n.stop_hook_active)return;let r=await ne(e),t=P(e),o=A(e,"stop-enforce")===t?Y:await G(e);I(e,"stop-enforce",t);let i=[...r==null?[]:[r],...o.errors];if(i.length!==0)return{decision:"block",reason:i.join(`
49
-
50
- `)}}),Y={errors:[]};async function G(n){let e=await j(n);if(e.isErr())return{errors:[`--- Compilation failed ---
51
- ${C(e.error)}
52
- ${c("create")}`]};let r=e.value,t=await Z(n,r),s=await K({cwd:n,lockfile:r}),o=X(r),i=t.runnableSlugs.length>0?await re(n):null;return{errors:[s,o,i?.error??null,t.error].filter(d=>d!=null)}}async function K({cwd:n,lockfile:e}){let r=v({cwd:n,lockfile:e});return await E(n,e),r.length===0?null:`--- Ripplo model analysis ---
53
- ${$(r)}
54
- ${c("create")}`}function X(n){let e=y(n);return e.length===0?null:`--- Unimplemented stubs ---
55
- ${e.join(", ")}
56
- Implement each critical journey with \`workflow("Intent", () => ({ given, steps }))\`. Add any state schema and source setup the journey needs.
57
- ${c("create")}`}async function Z(n,e){let r=new Set(y(e).map(a=>g(a))),t=new Set(e.workflows.map(a=>g(a.name))),s=(a,p)=>t.has(a)?r.has(a):ee(p),o=k(n).unwrapOr(void 0);if(o==null)return{error:`--- Testing Scope (not checked) ---
58
- No project config \u2014 \`npx ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${c("setup")}`,runnableSlugs:[]};let i=await m({config:o,document:Q,variables:{cwd:o.cwd,projectId:o.projectId}}).catch(()=>null);if(i==null)return{error:`--- Testing Scope (not checked) ---
59
- Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${c("start")}) before declaring work done.`,runnableSlugs:[]};let l=i.project?.devSession?.scopeItems??[],d=l.flatMap(a=>{let p=a.workflow;return p==null?[` [intent] ${a.label??"(no label)"} \u2014 write a test for this flow`]:s(p.slug,p.spec)?[` [stub] ${p.slug} \u2014 implement \`${p.name}\``]:[]}),u=l.flatMap(a=>a.workflow!=null&&!s(a.workflow.slug,a.workflow.spec)?[a.workflow.slug]:[]);return{error:d.length===0?null:`--- Testing Scope ---
60
- ${d.join(`
61
- `)}
62
- ${c("create")}`,runnableSlugs:u}}function ee(n){return typeof n=="object"&&n!=null&&Reflect.get(n,"stub")===!0}async function ne(n){let e=k(n).unwrapOr(void 0);if(e==null)return null;let r=await m({config:e,document:z,variables:{cwd:e.cwd,projectId:e.projectId}}).catch(()=>null);if(r==null)return null;let s=(r.project?.devSession?.tasks??[]).map(o=>{let i=o.title??o.messages?.[0]?.body??"(no description)";return` [${o.kind}] (${o.id}) ${i}`});return s.length===0?null:B(s)}async function re(n){let e=U.argv[1];if(e==null)return{error:f("CLI entry missing (process.argv[1])"),infra:!1};let r=await T(n);if(r!=null){let o=H(r);return O(r.serverUrl)?{error:f(o),infra:!1}:{error:R({lines:[o],retried:!1}),infra:!0}}let t=await L({cliEntry:e,cwd:n});if(t.isErr())return{error:f(h(t.error)),infra:!1};let s=t.value;try{return await te({connection:s,cwd:n})}finally{s.spawned&&await x(s),s.socket.destroy()}}async function te({connection:n,cwd:e}){let r=await V({connection:n,cwd:e,tests:[]});if(r.kind==="transport")return{error:f(r.message),infra:!1};let t=r.notRun.length>0?await V({connection:n,cwd:e,tests:r.notRun.map(d=>d.id)}):null,s=t==null||t.kind==="transport"?r.notRun:t.notRun,o=t!=null&&t.kind==="done",i=[...r.failedLines,...o?t.failedLines:[]],l=[...r.rejected,...o?t.rejected:[]];return oe({failedLines:i,notRun:s,rejected:l,retried:t!=null})}function oe({failedLines:n,notRun:e,rejected:r,retried:t}){if(n.length===0&&e.length===0&&r.length===0)return{error:null,infra:!1};let s=n.length>0?F(n):null,o=r.length>0?M(r):null,i=e.length>0?R({lines:e.map(l=>l.line),retried:t}):null;return{error:[s,o,i].filter(l=>l!=null).join(`
63
-
64
- `),infra:s==null}}async function V({connection:n,cwd:e,tests:r}){let t=[],s=[],o=[],i=J.join(e,".ripplo","debug"),l=new _;return(await N({connection:n,request:{all:!1,headed:!1,tests:[...r]},token:l.token,onEvent:u=>{se({debugDir:i,event:u,failedLines:t,notRun:s,rejected:o})}})).match(u=>u.kind==="daemon-error"?{kind:"transport",message:q(u.error)}:{failedLines:t,kind:"done",notRun:s,rejected:o},u=>({kind:"transport",message:h(u)}))}function se({debugDir:n,event:e,failedLines:r,notRun:t,rejected:s}){if(e.kind!=="test-outcome"||e.outcome.kind==="pass")return;let o=D({debugDir:n,event:e})??e.testName;if(e.outcome.kind==="dispatch-error"){s.push(o);return}if(e.outcome.kind==="dispatch-timeout"||e.outcome.kind==="infra-error"){t.push({id:`${e.workflowName}/${e.testName}`,line:o});return}r.push(o)}export{Ae as stopEnforceHook};
@@ -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-XAMVRZJH.js";import"./chunk-BGY5F3IU.js";import"./chunk-47LLHHJH.js";import"./chunk-OQ6KNYPG.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KH4QH23U.js";import"./chunk-RIASQHPG.js";import"./chunk-C7SV6AR2.js";import"./chunk-HEOMRXZE.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as tasksReminder};
@@ -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-CI6273ZU.js";import{a as c}from"./chunk-G6J2WIHJ.js";import{c as i}from"./chunk-KOKEEAEF.js";import{a as n}from"./chunk-7WZ3VIUU.js";import"./chunk-KMZ3L5YA.js";import*as e from"zod/mini";var m=e.looseObject({skill:e.string()}),u=i("PostToolUse",o=>{if(o.tool_name!=="Skill")return;let r=m.safeParse(o.tool_input);if(!r.success)return;let t=/^ripplo:(.+)$/.exec(r.data.skill);if(t==null)return;let l=t[1];if(l==null||!n(o.cwd))return;c(o.cwd,o.session_id,l);let s=a(o.cwd,o.session_id);if(s!=null)return{hookSpecificOutput:{additionalContext:s,hookEventName:"PostToolUse"}}});export{u as trackSkillLoadHook};
@@ -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-AXROBTLA.js";import"./chunk-CI6273ZU.js";import"./chunk-G6J2WIHJ.js";import"./chunk-7WZ3VIUU.js";import"./chunk-KMZ3L5YA.js";export{a as trackSkillPrompt};