ripplo 0.15.1 → 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 -643
  3. package/package.json +7 -43
  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-47LLHHJH.js +0 -9
  8. package/dist/chunk-5HFJIZLI.js +0 -4
  9. package/dist/chunk-5JXP37ET.js +0 -4
  10. package/dist/chunk-5PICILBD.js +0 -9
  11. package/dist/chunk-7WZ3VIUU.js +0 -4
  12. package/dist/chunk-ANAQCK5G.js +0 -4
  13. package/dist/chunk-AUXGLJ3J.js +0 -8
  14. package/dist/chunk-AXROBTLA.js +0 -4
  15. package/dist/chunk-BGY5F3IU.js +0 -5
  16. package/dist/chunk-BTIQ5H3K.js +0 -4
  17. package/dist/chunk-C7SV6AR2.js +0 -48
  18. package/dist/chunk-CI6273ZU.js +0 -107
  19. package/dist/chunk-EVEITUJH.js +0 -4
  20. package/dist/chunk-EYILCSW6.js +0 -11
  21. package/dist/chunk-F4UCCW7Q.js +0 -83
  22. package/dist/chunk-FEHVIHVA.js +0 -5
  23. package/dist/chunk-G6J2WIHJ.js +0 -4
  24. package/dist/chunk-HEOMRXZE.js +0 -4
  25. package/dist/chunk-IRT6UHD3.js +0 -61
  26. package/dist/chunk-IVW5DUE4.js +0 -360
  27. package/dist/chunk-JJ4QQPAV.js +0 -4
  28. package/dist/chunk-JPXTGKSB.js +0 -7
  29. package/dist/chunk-JS3DLVVI.js +0 -4
  30. package/dist/chunk-KH4QH23U.js +0 -4
  31. package/dist/chunk-KL6TIUNF.js +0 -4
  32. package/dist/chunk-KMZ3L5YA.js +0 -4
  33. package/dist/chunk-KOKEEAEF.js +0 -6
  34. package/dist/chunk-KOZTQJBB.js +0 -56
  35. package/dist/chunk-MHNGR6M7.js +0 -4
  36. package/dist/chunk-NNH3YVVO.js +0 -4
  37. package/dist/chunk-NUBMOTH6.js +0 -6
  38. package/dist/chunk-O4A5UISQ.js +0 -6
  39. package/dist/chunk-OQ6KNYPG.js +0 -4
  40. package/dist/chunk-PYDYI3AA.js +0 -23
  41. package/dist/chunk-QQ6VKZ6A.js +0 -5
  42. package/dist/chunk-QSKOYBDO.js +0 -8
  43. package/dist/chunk-R4ZTRVDQ.js +0 -4
  44. package/dist/chunk-RIASQHPG.js +0 -4
  45. package/dist/chunk-RXLDAR2J.js +0 -13
  46. package/dist/chunk-SXVWB7TZ.js +0 -6
  47. package/dist/chunk-T6WA2F3S.js +0 -16
  48. package/dist/chunk-XAMVRZJH.js +0 -23
  49. package/dist/chunk-XPOOWIRL.js +0 -4
  50. package/dist/cli-error-7LCAN3Z5.js +0 -4
  51. package/dist/compile-write-Y5III4OM.js +0 -4
  52. package/dist/daemon-6UYMYGPI.js +0 -175
  53. package/dist/daemon-EITBDEP7.js +0 -4
  54. package/dist/daemon-lock-RPKO5SNE.js +0 -4
  55. package/dist/dsl-loader-ASNZDV7E.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-6VWOS6HD.js +0 -4
  60. package/dist/post-edit-A5Y26UH5.js +0 -4
  61. package/dist/post-edit-analyze-2SBNWX6Y.js +0 -4
  62. package/dist/post-edit-flag-stubs-I43B5QPO.js +0 -4
  63. package/dist/pre-bash-run-gate-CDFNAIK3.js +0 -4
  64. package/dist/pre-edit-HJVNM7U5.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-G6BVWIDL.js +0 -4
  68. package/dist/prompt-submit-OXYVNXHK.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-XUIBJXNP.js +0 -4
  72. package/dist/stop-enforce-BP6IIW3D.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
- function n(r,t){return t==null?`Load \`/ripplo:${r}\` skill for instructions.`:`Load \`/ripplo:${r}\` skill for instructions on ${t}.`}function e(r){return r.length===1?n(r[0]):`Before proceeding, load the ${r.map(i=>`\`/ripplo:${i}\``).join(" and ")} skills \u2014 every one, each carries rules the others don't.`}export{n as a,e as b};
@@ -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 P}from"./chunk-KMZ3L5YA.js";var T=P(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.timingSafeEqual=void 0;function N(n,e=""){if(!n)throw new Error(e)}function F(n,e){if(n.byteLength!==e.byteLength)return!1;n instanceof DataView||(n=new DataView(ArrayBuffer.isView(n)?n.buffer:n)),e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),N(n instanceof DataView),N(e instanceof DataView);let r=n.byteLength,i=0,a=-1;for(;++a<r;)i|=n.getUint8(a)^e.getUint8(a);return i===0}V.timingSafeEqual=F});var W=P(S=>{"use strict";var G=S&&S.__extends||(function(){var n=function(e,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var g in a)a.hasOwnProperty(g)&&(i[g]=a[g])},n(e,r)};return function(e,r){n(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}})();Object.defineProperty(S,"__esModule",{value:!0});var l=256,z=(function(){function n(e){e===void 0&&(e="="),this._paddingCharacter=e}return n.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},n.prototype.encode=function(e){for(var r="",i=0;i<e.length-2;i+=3){var a=e[i]<<16|e[i+1]<<8|e[i+2];r+=this._encodeByte(a>>>18&63),r+=this._encodeByte(a>>>12&63),r+=this._encodeByte(a>>>6&63),r+=this._encodeByte(a>>>0&63)}var g=e.length-i;if(g>0){var a=e[i]<<16|(g===2?e[i+1]<<8:0);r+=this._encodeByte(a>>>18&63),r+=this._encodeByte(a>>>12&63),g===2?r+=this._encodeByte(a>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},n.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},n.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},n.prototype.decode=function(e){if(e.length===0)return new Uint8Array(0);for(var r=this._getPaddingLength(e),i=e.length-r,a=new Uint8Array(this.maxDecodedLength(i)),g=0,p=0,m=0,E=0,C=0,A=0,s=0;p<i-4;p+=4)E=this._decodeChar(e.charCodeAt(p+0)),C=this._decodeChar(e.charCodeAt(p+1)),A=this._decodeChar(e.charCodeAt(p+2)),s=this._decodeChar(e.charCodeAt(p+3)),a[g++]=E<<2|C>>>4,a[g++]=C<<4|A>>>2,a[g++]=A<<6|s,m|=E&l,m|=C&l,m|=A&l,m|=s&l;if(p<i-1&&(E=this._decodeChar(e.charCodeAt(p)),C=this._decodeChar(e.charCodeAt(p+1)),a[g++]=E<<2|C>>>4,m|=E&l,m|=C&l),p<i-2&&(A=this._decodeChar(e.charCodeAt(p+2)),a[g++]=C<<4|A>>>2,m|=A&l),p<i-3&&(s=this._decodeChar(e.charCodeAt(p+3)),a[g++]=A<<6|s,m|=s&l),m!==0)throw new Error("Base64Coder: incorrect characters for decoding");return a},n.prototype._encodeByte=function(e){var r=e;return r+=65,r+=25-e>>>8&6,r+=51-e>>>8&-75,r+=61-e>>>8&-15,r+=62-e>>>8&3,String.fromCharCode(r)},n.prototype._decodeChar=function(e){var r=l;return r+=(42-e&e-44)>>>8&-l+e-43+62,r+=(46-e&e-48)>>>8&-l+e-47+63,r+=(47-e&e-58)>>>8&-l+e-48+52,r+=(64-e&e-91)>>>8&-l+e-65+0,r+=(96-e&e-123)>>>8&-l+e-97+26,r},n.prototype._getPaddingLength=function(e){var r=0;if(this._paddingCharacter){for(var i=e.length-1;i>=0&&e[i]===this._paddingCharacter;i--)r++;if(e.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},n})();S.Coder=z;var D=new z;function Q(n){return D.encode(n)}S.encode=Q;function X(n){return D.decode(n)}S.decode=X;var I=(function(n){G(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype._encodeByte=function(r){var i=r;return i+=65,i+=25-r>>>8&6,i+=51-r>>>8&-75,i+=61-r>>>8&-13,i+=62-r>>>8&49,String.fromCharCode(i)},e.prototype._decodeChar=function(r){var i=l;return i+=(44-r&r-46)>>>8&-l+r-45+62,i+=(94-r&r-96)>>>8&-l+r-95+63,i+=(47-r&r-58)>>>8&-l+r-48+52,i+=(64-r&r-91)>>>8&-l+r-65+0,i+=(96-r&r-123)>>>8&-l+r-97+26,i},e})(z);S.URLSafeCoder=I;var R=new I;function Z(n){return R.encode(n)}S.encodeURLSafe=Z;function ee(n){return R.decode(n)}S.decodeURLSafe=ee;S.encodedLength=function(n){return D.encodedLength(n)};S.maxDecodedLength=function(n){return D.maxDecodedLength(n)};S.decodedLength=function(n){return D.decodedLength(n)}});var K=P(($,j)=>{"use strict";(function(n,e){var r={};e(r);var i=r.default;for(var a in r)i[a]=r[a];typeof j=="object"&&typeof j.exports=="object"?j.exports=i:typeof define=="function"&&define.amd?define(function(){return i}):n.sha256=i})($,function(n){"use strict";n.__esModule=!0,n.digestLength=32,n.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(s,t,o,f,x){for(var c,u,h,_,v,d,U,b,w,y,B,O,M;x>=64;){for(c=t[0],u=t[1],h=t[2],_=t[3],v=t[4],d=t[5],U=t[6],b=t[7],y=0;y<16;y++)B=f+y*4,s[y]=(o[B]&255)<<24|(o[B+1]&255)<<16|(o[B+2]&255)<<8|o[B+3]&255;for(y=16;y<64;y++)w=s[y-2],O=(w>>>17|w<<15)^(w>>>19|w<<13)^w>>>10,w=s[y-15],M=(w>>>7|w<<25)^(w>>>18|w<<14)^w>>>3,s[y]=(O+s[y-7]|0)+(M+s[y-16]|0);for(y=0;y<64;y++)O=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&d^~v&U)|0)+(b+(e[y]+s[y]|0)|0)|0,M=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&u^c&h^u&h)|0,b=U,U=d,d=v,v=_+O|0,_=h,h=u,u=c,c=O+M|0;t[0]+=c,t[1]+=u,t[2]+=h,t[3]+=_,t[4]+=v,t[5]+=d,t[6]+=U,t[7]+=b,f+=64,x-=64}return f}var i=(function(){function s(){this.digestLength=n.digestLength,this.blockSize=n.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return s.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},s.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(var t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},s.prototype.update=function(t,o){if(o===void 0&&(o=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=o,this.bufferLength>0){for(;this.bufferLength<64&&o>0;)this.buffer[this.bufferLength++]=t[f++],o--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(o>=64&&(f=r(this.temp,this.state,t,f,o),o%=64);o>0;)this.buffer[this.bufferLength++]=t[f++],o--;return this},s.prototype.finish=function(t){if(!this.finished){var o=this.bytesHashed,f=this.bufferLength,x=o/536870912|0,c=o<<3,u=o%64<56?64:128;this.buffer[f]=128;for(var h=f+1;h<u-8;h++)this.buffer[h]=0;this.buffer[u-8]=x>>>24&255,this.buffer[u-7]=x>>>16&255,this.buffer[u-6]=x>>>8&255,this.buffer[u-5]=x>>>0&255,this.buffer[u-4]=c>>>24&255,this.buffer[u-3]=c>>>16&255,this.buffer[u-2]=c>>>8&255,this.buffer[u-1]=c>>>0&255,r(this.temp,this.state,this.buffer,0,u),this.finished=!0}for(var h=0;h<8;h++)t[h*4+0]=this.state[h]>>>24&255,t[h*4+1]=this.state[h]>>>16&255,t[h*4+2]=this.state[h]>>>8&255,t[h*4+3]=this.state[h]>>>0&255;return this},s.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},s.prototype._saveState=function(t){for(var o=0;o<this.state.length;o++)t[o]=this.state[o]},s.prototype._restoreState=function(t,o){for(var f=0;f<this.state.length;f++)this.state[f]=t[f];this.bytesHashed=o,this.finished=!1,this.bufferLength=0},s})();n.Hash=i;var a=(function(){function s(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var o=new Uint8Array(this.blockSize);if(t.length>this.blockSize)new i().update(t).finish(o).clean();else for(var f=0;f<t.length;f++)o[f]=t[f];for(var f=0;f<o.length;f++)o[f]^=54;this.inner.update(o);for(var f=0;f<o.length;f++)o[f]^=106;this.outer.update(o),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var f=0;f<o.length;f++)o[f]=0}return s.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},s.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},s.prototype.update=function(t){return this.inner.update(t),this},s.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},s.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},s})();n.HMAC=a;function g(s){var t=new i().update(s),o=t.digest();return t.clean(),o}n.hash=g,n.default=g;function p(s,t){var o=new a(s).update(t),f=o.digest();return o.clean(),f}n.hmac=p;function m(s,t,o,f){var x=f[0];if(x===0)throw new Error("hkdf: cannot expand more");t.reset(),x>1&&t.update(s),o&&t.update(o),t.update(f),t.finish(s),f[0]++}var E=new Uint8Array(n.digestLength);function C(s,t,o,f){t===void 0&&(t=E),f===void 0&&(f=32);for(var x=new Uint8Array([1]),c=p(t,s),u=new a(c),h=new Uint8Array(u.digestLength),_=h.length,v=new Uint8Array(f),d=0;d<f;d++)_===h.length&&(m(h,u,o,x),_=0),v[d]=h[_++];return u.clean(),h.fill(0),x.fill(0),v}n.hkdf=C;function A(s,t,o,f){for(var x=new a(s),c=x.digestLength,u=new Uint8Array(4),h=new Uint8Array(c),_=new Uint8Array(c),v=new Uint8Array(f),d=0;d*c<f;d++){var U=d+1;u[0]=U>>>24&255,u[1]=U>>>16&255,u[2]=U>>>8&255,u[3]=U>>>0&255,x.reset(),x.update(t),x.update(u),x.finish(_);for(var b=0;b<c;b++)h[b]=_[b];for(var b=2;b<=o;b++){x.reset(),x.update(_).finish(_);for(var w=0;w<c;w++)h[w]^=_[w]}for(var b=0;b<c&&d*c+b<f;b++)v[d*c+b]=h[b]}for(var d=0;d<c;d++)h[d]=_[d]=0;for(var d=0;d<4;d++)u[d]=0;return x.clean(),v}n.pbkdf2=A})});var ie=P(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.Webhook=L.WebhookVerificationError=void 0;var te=T(),J=W(),re=K(),Y=300,H=class n extends Error{constructor(e){super(e),Object.setPrototypeOf(this,n.prototype),this.name="ExtendableError",this.stack=new Error(e).stack}},k=class n extends H{constructor(e){super(e),Object.setPrototypeOf(this,n.prototype),this.name="WebhookVerificationError"}};L.WebhookVerificationError=k;var q=class n{constructor(e,r){if(!e)throw new Error("Secret can't be empty.");if(r?.format==="raw")e instanceof Uint8Array?this.key=e:this.key=Uint8Array.from(e,i=>i.charCodeAt(0));else{if(typeof e!="string")throw new Error("Expected secret to be of type string");e.startsWith(n.prefix)&&(e=e.substring(n.prefix.length)),this.key=J.decode(e)}}verify(e,r){let i={};for(let t of Object.keys(r))i[t.toLowerCase()]=r[t];let a=i["webhook-id"],g=i["webhook-signature"],p=i["webhook-timestamp"];if(!g||!a||!p)throw new k("Missing required headers");let m=this.verifyTimestamp(p),C=this.sign(a,m,e).split(",")[1],A=g.split(" "),s=new globalThis.TextEncoder;for(let t of A){let[o,f]=t.split(",");if(o==="v1"&&(0,te.timingSafeEqual)(s.encode(f),s.encode(C)))return JSON.parse(e.toString())}throw new k("No matching signature found")}sign(e,r,i){if(typeof i!="string")if(i.constructor.name==="Buffer")i=i.toString();else throw new Error("Expected payload to be of type string or Buffer.");let a=new TextEncoder,g=Math.floor(r.getTime()/1e3),p=a.encode(`${e}.${g}.${i}`);return`v1,${J.encode(re.hmac(this.key,p))}`}verifyTimestamp(e){let r=Math.floor(Date.now()/1e3),i=parseInt(e,10);if(isNaN(i))throw new k("Invalid Signature Headers");if(r-i>Y)throw new k("Message timestamp too old");if(i>r+Y)throw new k("Message timestamp too new");return new Date(i*1e3)}};L.Webhook=q;q.prefix="whsec_"});export{ie as a};
@@ -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{a as o}from"./chunk-OQ6KNYPG.js";import{a as r}from"./chunk-MHNGR6M7.js";import{a as h,c as y,d as F,e as k,f as C,g as b}from"./chunk-BTIQ5H3K.js";import{A as p,B as u,C as g,G as S,f as a,t as c,v as d,w as s,x as f,y as l,z as m}from"./chunk-F4UCCW7Q.js";import A from"safe-stable-stringify";function z({cwd:i,lockfile:e}){let t=b(A(h(e)));if(k({cwd:i})===t)return[];y({cwd:i});let n=H(e);return F({cwd:i}),C({cleanLockfileHash:n.length===0?t:null,cwd:i}),n}function H(i){let e=c(i),t=d({facts:e.facts});return[...s(i).map(n=>({effect:n,kind:"possible-noop-effect"})),...f(i).map(n=>({consequence:n,kind:"undecided-action-consequence"})),...t.map(n=>({conflict:n,kind:"fact-conflict"})),...l(i).map(n=>({kind:"unreachable-interaction",violation:n})),...m(i).map(n=>({kind:"redundant-assertion",redundancy:n})),...p(i).map(n=>({kind:"unmodeled-surface",surface:n})),...g(i).map(n=>({content:n,kind:"unpinned-surface-content"})),...u(i).map(n=>({binding:n,kind:"stringified-binding"}))]}function q(i){return`${a.good("ok")} \u2014 no static model violations (${o(i,"test")})`}function E(i){let t=i.some(n=>n.kind==="unmodeled-surface")?[`Elements that hide together are one surface. ${r("create","surfaces")}`]:[];return[`${a.bad("fail")} \u2014 ${o(i.length,"static model violation")}:`,...i.map(n=>S(n)),...t].join(`
5
-
6
- `)}export{z as a,q as b,E as c};
@@ -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{D as i,e as t}from"./chunk-F4UCCW7Q.js";function f(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function g({projectId:e,serverUrl:n}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${n}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
5
- `)}function h(){return"Not signed in. Run `npx ripplo auth login`, then start the daemon again."}function x({devSessionId:e,version:n}){return`ripplo daemon: v${n} ready as local executor for session ${e} (switch with \`npx ripplo executor cloud\` \u2014 Ctrl-C to stop)`}function k({cwd:e,pid:n}){return`ripplo daemon: another daemon is already running for this project${n==null?"":` (pid ${String(n)})`} (cwd ${e}) \u2014 this one is exiting. Run \`npx ripplo daemon status\` to inspect it, or \`npx ripplo daemon stop\` to stop it.`}function w(e){switch(e.kind){case"not-running":return"ripplo daemon: not running.";case"stopped":return`ripplo daemon: stopped (pid ${String(e.pid)}).`;case"timeout":return`ripplo daemon: pid ${String(e.pid)} did not exit within 10s \u2014 it may be finishing a run. Check again with \`npx ripplo daemon status\`.`}}function y(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function $(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but no reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:n}=e,r=n.version==null?"version unknown (pre-0.7.8)":`v${n.version}`,s=`${String(n.active)} active, ${String(n.queued)} queued`,a=l(n.explorer,n.exploring),o=`daemon: running (${r} | ${s} | ${a} | ${p(n.progress)})`;if(n.sseHealth!=null&&!n.sseHealth.ok){let d=n.sseHealth.detail==null?"":`: ${n.sseHealth.detail}`;return`${o}
6
- daemon: cannot subscribe to run dispatch${d} \u2014 server-side, restarting the daemon will not help`}return o}function p(e){return e.attempts===0?"explore: idle":`explore: ${String(e.attempts)} attempts, ${String(e.findings)} findings`}function b(e){let n=e.daemonVersion==null?"an older build":`v${e.daemonVersion}`;return e.kind==="restarted"?`ripplo: daemon was on ${n} \u2014 restarted on the current build`:`ripplo: daemon is on a stale build (${n}) with runs in flight \u2014 rerun once it drains, or npx ripplo daemon restart`}function S(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.contradictions.map(n=>i({contradiction:n,evidencePath:`.ripplo/debug/${e.runId}/behavior.jsonl`})),kind:"findings"};case"error":return{detail:t(e.error),kind:"error"};case"dispatch-failed":return{kind:"dispatch-error",reason:{detail:e.reason,type:"generic"}}}}function l(e,n){switch(e.kind){case"off":return"explorer: off";case"on":return`explorer: on, ${String(n)} exploring`;case"paused":return`explorer: ${u(e.reason)}`;case"waiting":return"explorer: waiting for more workflow coverage \u2014 run npx ripplo explore analyze";case"blocked":return`explorer: blocked \u2014 ${c(e.reason)}`}}function u(e){return e==="interactive-runs"?"paused while your runs execute \u2014 resumes when they finish":e==="loading"?"paused while the model loads":"paused for a short cooldown \u2014 resumes on its own"}function c(e){switch(e){case"no-lockfile":return"no lockfile found, run npx ripplo compile";case"unstamped":return"lockfile has no compiled checks, run npx ripplo compile";case"dsl-drift":return"workflow sources changed since the last compile, run npx ripplo compile";case"load-failed":return"workflow definitions do not compile, run npx ripplo compile for details";case"model-empty":return"no workflow interactions can be explored, run npx ripplo explore analyze"}}export{f as a,g as b,h as c,x as d,k as e,w as f,y as g,$ as h,p as i,b as j,S as k};
@@ -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
- function o(r,t,n){let i=r===1?t:n??`${t}s`;return`${String(r)} ${i}`}export{o as a};
@@ -1,23 +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 f,b as g,c as w}from"./chunk-BGY5F3IU.js";import{a as d}from"./chunk-SXVWB7TZ.js";import{c as m}from"./chunk-JS3DLVVI.js";import{a as i}from"./chunk-MHNGR6M7.js";import{a as u}from"./chunk-7WZ3VIUU.js";import{f as c}from"./chunk-KH4QH23U.js";import{e as a}from"./chunk-C7SV6AR2.js";import{graphql as h}from"gql.tada";var S=h(`
5
- query ScopeReminder($projectId: String!, $cwd: String!) {
6
- project(id: $projectId) {
7
- id
8
- devSession(cwd: $cwd) {
9
- id
10
- scopeItems {
11
- id
12
- label
13
- workflow {
14
- slug
15
- spec
16
- }
17
- }
18
- }
19
- }
20
- }
21
- `),x=async t=>{let{cwd:e}=t;if(!u(e)||!c(e))return;let p=f(e);if(g(e,"scope-reminder")===p)return;let r=m(e).unwrapOr(void 0);if(r==null)return;let s=await a({config:r,document:S,variables:{cwd:r.cwd,projectId:r.projectId}}).catch(()=>null);w(e,"scope-reminder",p);let n=s?.project?.devSession?.scopeItems??[];return d({cwd:e,scope:{available:s!=null,items:n.map(o=>b(o))}}),s==null?{hookSpecificOutput:{additionalContext:`Ripplo scope: unknown \u2014 server unreachable, scope guardrails are not enforcing. Check the dev session (\`npx ripplo doctor\`). ${i("start")}`,hookEventName:"UserPromptSubmit"}}:{hookSpecificOutput:{additionalContext:n.length===0?`Ripplo scope: empty. ${i("run")}`:`Ripplo scope (${String(n.length)}):
22
- ${n.map(o=>{let l=o.workflow;return l==null?` [intent] (${o.id}) ${o.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${o.id}) ${l.slug}`}).join(`
23
- `)}`,hookEventName:"UserPromptSubmit"}}};function b(t){let e=t.workflow;return e==null?{label:t.label,slug:null,status:"intent"}:{label:t.label,slug:e.slug,status:e.spec==null?"stub":"implemented"}}export{x as a};
@@ -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 n}from"./chunk-7WZ3VIUU.js";import{f as r}from"./chunk-KH4QH23U.js";var m=async o=>{if(o.permission_mode!=="plan"||!n(o.cwd)||!r(o.cwd))return;let{loadRipplo:s}=await import("./dsl-loader-ASNZDV7E.js"),{stubbedWorkflows:a}=await import("./compile-write-Y5III4OM.js"),t=await s(o.cwd);if(t.isErr())return;let e=a(t.value),i=['Plan must include "Tests to implement" with a .ripplo/workflows/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `workflow("Intent")` (no body).'];return e.length>0&&i.push(`Existing stubs: ${e.join(", ")}`),{hookSpecificOutput:{additionalContext:i.join(`
5
- `),hookEventName:"UserPromptSubmit"}}};export{m as a};
@@ -1,8 +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{g as m}from"./chunk-IRT6UHD3.js";import{a as f,c as k}from"./chunk-NUBMOTH6.js";import{a as h}from"./chunk-OQ6KNYPG.js";import{a as y}from"./chunk-RXLDAR2J.js";import{a as s}from"./chunk-MHNGR6M7.js";import{h as d,i as p}from"./chunk-BTIQ5H3K.js";import{o as u}from"./chunk-F4UCCW7Q.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f as l}from"./chunk-KH4QH23U.js";import*as a from"zod/mini";var S=a.looseObject({file_path:a.string()}),H=async e=>{let n=S.safeParse(e.tool_input);if(!n.success||!/\/\.ripplo\/.*\.ts$/.test(n.data.file_path))return;let{cwd:o}=e;if(!c(o))return;if(!l(o))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL compile and lockfile sync did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let r=await d(o);if(r.isErr())return{decision:"block",reason:`${y(r.error)}
5
- ${s("create","DSL authoring rules")}`};let t=await b({cwd:o,filePath:n.data.file_path,lockfile:r.value});if("block"in t)return{decision:"block",reason:t.block};let{addedSlugs:i}=await m({cwd:o,editedPath:n.data.file_path,lockfile:r.value,requireHooks:!0,syncFirst:!0});return z(P({addedSlugs:i,elsewhere:t.elsewhere}))};function P({addedSlugs:e,elsewhere:n}){return[...e.length>0?[`Auto-scoped ${e.join(", ")} (dirty tests).`]:[],...n>0?[g(n).trimStart()]:[]]}async function b({cwd:e,filePath:n,lockfile:o}){let r=f({cwd:e,lockfile:o});await p(e,o);let t=A(r,o,n),i=r.length-t.length;return t.length===0?{elsewhere:i}:{block:`${k(t)}${g(i)}
6
- ${s("create")}`}}function A(e,n,o){let r=new Set(u(n).filter(({workflow:t})=>t.sourcePath!=null&&o.endsWith(t.sourcePath)).map(({ref:t})=>t));return r.size===0?e:e.filter(t=>{let i=w(t);return i==null||r.has(i)})}function w(e){return e.kind==="unreachable-interaction"?e.violation.test:e.kind==="redundant-assertion"?e.redundancy.test:e.kind==="undecided-action-consequence"?e.consequence.test:null}function g(e){return e===0?"":`
7
- ${h(e,"finding")} in other files \u2014 \`npx ripplo compile\` for the full list.`}function z(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
8
- `),hookEventName:"PostToolUse"}}}export{H as a};
@@ -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{readFileSync as o}from"fs";import*as r from"zod/mini";var n=r.object({version:r.string()});function s(){let e=o(new URL("../package.json",import.meta.url),"utf8");return n.parse(JSON.parse(e)).version}export{s as a};
@@ -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{i as s,j as a}from"./chunk-C7SV6AR2.js";import d from"fs";import{setTimeout as p}from"timers/promises";import{checkSync as m,lockSync as f}from"proper-lockfile";var y="dev.pid",l=15e3,h=1e4,k=250;function g(n){return u(i(n))}async function b(n){let r=g(n);if(r==null||!c(n))return{kind:"not-running"};try{process.kill(r,"SIGTERM")}catch{return{kind:"not-running"}}let e=Date.now()+h;for(;Date.now()<e;){if(!c(n))return{kind:"stopped",pid:r};await p(k)}return{kind:"timeout",pid:r}}function c(n){try{return m(i(n),{realpath:!1,stale:l})}catch{return!1}}function i(n){return a(n,y)}var o=class extends Error{pid;cwd;constructor({cwd:r,pid:e}){super("dev-lock-held"),this.name="DevLockHeldError",this.pid=e,this.cwd=r}};function E({cwd:n,onCompromised:r}){s(n);let e=i(n),t=w({cwd:n,onCompromised:r,path:e});return d.writeFileSync(e,String(process.pid)),()=>{try{t()}catch{}}}function w({cwd:n,onCompromised:r,path:e}){try{return f(e,{realpath:!1,stale:l,onCompromised:()=>{r()}})}catch(t){throw D(t)?new o({cwd:n,pid:u(e)}):t}}function D(n){if(!(n instanceof Error)||!("code"in n))return!1;let{code:r}=n;return r==="ELOCKED"}function u(n){try{let r=d.readFileSync(n,"utf8").trim(),e=Number.parseInt(r,10);return Number.isFinite(e)&&e>0?e:null}catch{return null}}export{g as a,b,c,i as d,o as e,E as f};
@@ -1,13 +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-MHNGR6M7.js";import{g as o,h as a,j as i}from"./chunk-5JXP37ET.js";function h(e){return e.kind==="authoring-error"?["Compilation failed",e.message,t("create","DSL authoring rules")].join(`
5
-
6
- `):[`Compilation failed: ${l(e)}`,t("create","DSL authoring rules")].join(`
7
- `)}function x(){return`${i} is up to date`}function $(e){return[`${i} is ${e==="missing"?"missing":"out of date"} \u2014 run \`npx ripplo compile\` and commit it`,t("setup")].join(`
8
- `)}function L(){return`Wrote ${i}`}function l(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...e.diagnostics].join(`
9
- `);case"not-ripplo":return`${e.entryPath} must default-export createRipplo({ state, workflows }).`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock):",...e.issues,"Regenerate with `npx ripplo compile`."].join(`
10
- `);case"load-threw":return u(e.message);case"authoring-error":return e.message;case"fixture-failed":return p(e.error);case"expand-failed":return`Could not resolve tests for workflow "${e.workflow}": ${e.message}`}}var s="state-selection-condition-requires-closed";function u(e){return e===s?["A state condition queries a collection whose full contents are unknown.","Add closed(record) for every collection used by that condition so the solver can prove the result.",`Diagnostic code: ${e}`].join(`
11
- `):c(e)?["Ripplo rejected the workflow model while loading .ripplo/index.ts.",`${d(e)} Load /ripplo:create for the matching DSL rule.`,`Diagnostic code: ${e}`].join(`
12
- `):[".ripplo/index.ts could not be loaded:",e].join(`
13
- `)}function c(e){return/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/u.test(e)}function d(e){let r=e.replaceAll("-"," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}.`}function p(e){switch(e.kind){case"fixture-missing":return`Fixture "${e.name}" not found at ${e.path}.`;case"fixture-invalid-name":return`Invalid fixture name "${e.name}" \u2014 bare name under .ripplo/fixtures/, no .. or absolute paths.`;case"fixture-symlink":return`Fixture "${e.name}" is a symlink \u2014 only regular files allowed.`;case"fixture-not-file":return`Fixture "${e.name}" is not a regular file.`;case"fixture-too-large":return`Fixture "${e.name}" is ${n(e.size)} \u2014 over the ${n(o)} per-file limit.`;case"fixtures-total-too-large":return`Fixtures total ${n(e.total)} \u2014 over the ${n(a)} limit.`}}function n(e){return`${String(Math.round(e/(1024*1024)*10)/10)} MB`}export{h as a,x as b,$ as c,L as d};
@@ -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{a as p}from"./chunk-JJ4QQPAV.js";import{b as l}from"./chunk-KH4QH23U.js";import{j as c}from"./chunk-C7SV6AR2.js";import{createHash as S}from"crypto";import{mkdirSync as b,readFileSync as v,writeFileSync as A}from"fs";import F from"path";import*as e from"zod/mini";import a from"picomatch";function m(t){return l(["diff","--name-only","HEAD"],t).split(`
5
- `).filter(n=>n.length>0)}function g({cwd:t,ignoreGlobs:n,watchGlobs:r}){let o=a([...r]),i=a([...n]);return m(t).filter(s=>o(s)&&!i(s))}function z(t){return l(["ls-files","--others","--exclude-standard"],t).split(`
6
- `).filter(n=>n.length>0)}function d({cwd:t,ignoreGlobs:n,watchGlobs:r}){let o=a([...r]),i=a([...n]);return z(t).filter(s=>o(s)&&!i(s))}var x=e.object({label:e.nullable(e.string()),slug:e.nullable(e.string()),status:e.enum(["intent","stub","implemented"])}),C=e.object({intent:e.string(),name:e.string(),sourcePath:e.nullable(e.string()),stub:e.boolean()}),k=e.object({changedAppFiles:e.readonly(e.array(e.string())),scope:e.object({available:e.boolean(),items:e.readonly(e.array(x))}),tests:e._default(e.readonly(e.array(C)),[]),untrackedAppFiles:e.readonly(e.array(e.string()))});function O({cwd:t,scope:n}){let r=y(t);u(t,{...f(t),scope:n,tests:r?.tests??[]})}function T({cwd:t,tests:n}){let r=y(t);u(t,{...f(t),scope:r?.scope??{available:!1,items:[]},tests:n??r?.tests??[]})}function y(t){let n=k.safeParse(I(h(t)));return n.success?n.data:null}function I(t){try{return JSON.parse(v(t,"utf8"))}catch{return null}}function h(t){return c(t,"coverage-context.json")}function u(t,n){let r=h(t);b(F.dirname(r),{recursive:!0});let o=S("sha256").update(JSON.stringify(n)).digest("hex");A(r,JSON.stringify({...n,inputHash:o},null,2))}function f(t){let{ignorePaths:n,watchPaths:r}=p(),o={cwd:t,ignoreGlobs:n,watchGlobs:r};return{changedAppFiles:g(o),untrackedAppFiles:d(o)}}export{O as a,T as b};
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __ripploCreateRequire } from "node:module";
3
- const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as u}from"./chunk-JJ4QQPAV.js";import{c as d}from"./chunk-JS3DLVVI.js";import{b as p}from"./chunk-MHNGR6M7.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f as a}from"./chunk-KH4QH23U.js";import{e as s}from"./chunk-C7SV6AR2.js";import g from"path";import h from"picomatch";import{graphql as b}from"gql.tada";import*as i from"zod/mini";import{existsSync as S,readdirSync as k}from"fs";import l from"path";function f(e){let o=l.join(e,".ripplo","workflows");return S(o)?m(o,0)>0:!1}function m(e,o){return k(e,{withFileTypes:!0}).reduce((t,r)=>{if(r.isDirectory())return t+m(l.join(e,r.name),o+1);let n=o===0&&r.name==="index.ts";return r.name.endsWith(".ts")&&!n&&r.name!=="givens.ts"?t+1:t},0)}var w=new Set(["Edit","Write","NotebookEdit"]),P=i.looseObject({file_path:i.string()}),y=b(`
5
- query PreEditScopeGate($projectId: String!, $cwd: String!) {
6
- project(id: $projectId) {
7
- id
8
- devSession(cwd: $cwd) {
9
- id
10
- scopeItems {
11
- id
12
- }
13
- }
14
- }
15
- }
16
- `),N=async e=>{if(!w.has(e.tool_name))return;let o=P.safeParse(e.tool_input);if(!o.success)return;let{cwd:t}=e;if(!j(t))return;let r=g.relative(t,o.data.file_path);if(!v(r))return;let n=await R(t);return n.populated?n.degradedReason!=null?{hookSpecificOutput:{additionalContext:`Scope check skipped (${n.degradedReason}) \u2014 edit allowed through, but the scope guardrail isn't enforcing on this edit.`,hookEventName:"PreToolUse"}}:void 0:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Scope is empty but this edit touches app code (${r}). Stub a test or \`npx ripplo scope add <test-id>\` before proceeding. Hook re-fires until scope is populated \u2014 if this change genuinely needs no coverage, pause hooks with \`npx ripplo hooks pause\`. ${p(["run","create"])}`}}};function j(e){return c(e)&&a(e)&&f(e)}function v(e){return e.startsWith("..")||e===".ripplo"||e.startsWith(".ripplo/")?!1:!E(e)&&I(e)}function E(e){let o=e.split(g.sep);return o.includes("test")||o.includes("ripplo")}function I(e){let{ignorePaths:o,watchPaths:t}=u(),r=h([...t]),n=h([...o]);return r(e)&&!n(e)}async function R(e){let o=d(e).unwrapOr(void 0);if(o==null)return{degradedReason:"no project config \u2014 `npx ripplo init` not run here",populated:!0};let t=await s({config:o,document:y,variables:{cwd:o.cwd,projectId:o.projectId}}).catch(()=>null);return t==null?{degradedReason:"server unreachable",populated:!0}:{degradedReason:null,populated:(t.project?.devSession?.scopeItems??[]).length>0}}export{N as a};
@@ -1,23 +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 l,c as m}from"./chunk-BGY5F3IU.js";import{c as p}from"./chunk-47LLHHJH.js";import{c as u}from"./chunk-JS3DLVVI.js";import{a as d}from"./chunk-7WZ3VIUU.js";import{f as i}from"./chunk-KH4QH23U.js";import{e as a}from"./chunk-C7SV6AR2.js";import{createHash as g}from"crypto";import{graphql as k}from"gql.tada";var c="tasks-reminder",y=k(`
5
- query TasksReminder($projectId: String!, $cwd: String!) {
6
- project(id: $projectId) {
7
- id
8
- devSession(cwd: $cwd) {
9
- id
10
- tasks(status: open) {
11
- id
12
- kind
13
- status
14
- title
15
- updatedAt
16
- messages {
17
- body
18
- }
19
- }
20
- }
21
- }
22
- }
23
- `),q=async r=>{let t=await h(r.cwd);if(t!=null)return{hookSpecificOutput:{additionalContext:t,hookEventName:"UserPromptSubmit"}}};async function h(r){if(!d(r)||!i(r))return null;let t=u(r).unwrapOr(void 0);if(t==null)return null;let e=await a({config:t,document:y,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);if(e==null)return null;let n=e.project?.devSession?.tasks??[],o=S(n);if(l(r,c)===o||(m(r,c,o),n.length===0))return null;let f=n.map(s=>({id:s.id,kind:s.kind,lastMessage:s.messages?.[0]?.body??null,status:s.status,title:s.title}));return p(f)}function S(r){let t=g("sha256");return r.map(e=>`${e.id}:${String(e.updatedAt)}`).toSorted((e,n)=>e.localeCompare(n)).forEach(e=>{t.update(e),t.update("\0")}),t.digest("hex")}export{q as a};
@@ -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 i}from"./chunk-MHNGR6M7.js";import{m as p}from"./chunk-5JXP37ET.js";import{a}from"./chunk-7WZ3VIUU.js";import{e as s}from"./chunk-KH4QH23U.js";import{c as n}from"./chunk-RIASQHPG.js";import l from"fs";import d from"path";import*as r from"zod/mini";var c=new Set(["Edit","Write","NotebookEdit"]),u=r.looseObject({file_path:r.string()}),D=async t=>{if(!c.has(t.tool_name))return;let e=m(t);if(e==null)return;let{cwd:o}=t;return l.existsSync(s(o))||n(o)?void 0:(await p(o)).isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL isn't compiling, so this edit is allowed through without dev-mode guardrails. Run \`npx ripplo compile\` to see the errors, or \`/ripplo:start\` to bring the daemon up. ${i("create","DSL authoring rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running \u2014 this edit to \`${e}\` won't sync and dev-mode guardrails won't fire. Run \`/ripplo:start\`, then retry (\`npx ripplo doctor\` checks the daemon and dev server). If the daemon can't start, the user can bypass with \`npx ripplo hooks pause\`. ${i("start")}`}}};function m(t){let e=u.safeParse(t.tool_input);if(!e.success||!a(t.cwd))return null;let o=d.relative(t.cwd,e.data.file_path);return o.startsWith("..")||o!==".ripplo"&&!o.startsWith(".ripplo/")?null:o}export{D as a};
@@ -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-EYILCSW6.js";import"./chunk-RXLDAR2J.js";import"./chunk-MHNGR6M7.js";import"./chunk-5JXP37ET.js";import"./chunk-KOZTQJBB.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-BTIQ5H3K.js";import"./chunk-F4UCCW7Q.js";import"./chunk-5JXP37ET.js";import"./chunk-KOZTQJBB.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 rr,C as nr,D as q,H as or,I as tr,J as ir,K as ar,M as sr,N as lr,P as K,Q as H,R as dr,S as cr,T as Q,e as Oe,i as _e,j as Ge,k as Ne,l as ze,m as Be,o as Ke,p as Qe,q as Je,r as Ve,s as Xe,u as A,v as L,w as Ye,x as B,y as Ze,z as er}from"./chunk-IVW5DUE4.js";import{a as We,b as Me,c as $e,d as Ue,e as Fe,g as je}from"./chunk-O4A5UISQ.js";import{d as qe}from"./chunk-ANAQCK5G.js";import{b as He}from"./chunk-EYILCSW6.js";import{a as De,c as Ae,d as Le,e as h}from"./chunk-IRT6UHD3.js";import{a as D}from"./chunk-RXLDAR2J.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-BTIQ5H3K.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-F4UCCW7Q.js";import{k as S,l as he,m as I}from"./chunk-5JXP37ET.js";import{Ma as Se,U as ye,sa as ge}from"./chunk-KOZTQJBB.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 Ut}from"crypto";import Ft from"path";import{createClient as jt}from"graphql-sse";import _t,{AbortError as Gt}from"p-retry";import{graphql as vn}from"gql.tada";import{graphql as Tn}from"gql.tada";import{print as Cn}from"graphql";async function ur({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=In(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 In(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 Dn=6e4,An=Tn(`
5
- subscription RunRequestedWatch($devSessionId: String!) {
6
- runRequested(devSessionId: $devSessionId) {
7
- runId
8
- testSlug
9
- workflowId
10
- workflowSlug
11
- }
12
- }
13
- `);async function pr(e){let r=Math.min(1e3*2**e,Dn)+Wn();await new Promise(n=>setTimeout(n,r))}function fr({claim:e,cwd:r,devSessionId:n,pool:o,sseClient:t,sseHealth:i}){let a=new Set,l=qn(r);return t.subscribe({query:Cn(An),variables:{devSessionId:n}},{complete:Ln,error:d=>{let c=d instanceof Error?d.message:String(d);i.markUnhealthy(c),s.error({err:d},"runRequested subscription failed")},next:d=>{Hn({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 Ln(){}function qn(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 Hn({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=On(e(n.runId),n);i.started(),ur({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 On(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:er(e.token),workClass:"p1-cli",finished:n=>{e.finished(r.runId,n)},started:()=>{e.started(r.runId)}}}function Wn(){return Math.floor(Math.random()*2700)+300}import{graphql as k}from"gql.tada";import{print as mr}from"graphql";import{clearTimeout as $n,setTimeout as Un}from"timers";var Fn=k(`
15
- subscription TeleportRequestedWatch($devSessionId: String!) {
16
- teleportRequested(devSessionId: $devSessionId) {
17
- runId
18
- stepIndex
19
- kind
20
- testSlug
21
- workflowSlug
22
- }
23
- }
24
- `),jn=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
- `),_n=k(`
36
- query TeleportRunRepro($id: String!) {
37
- run(id: $id) {
38
- id
39
- reproJson
40
- }
41
- }
42
- `),Gn=k(`
43
- mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
44
- reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
45
- }
46
- `),Nn=k(`
47
- mutation ClaimTeleportRequest($devSessionId: String!, $requestId: String!) {
48
- claimTeleportRequest(devSessionId: $devSessionId, requestId: $requestId)
49
- }
50
- `),zn=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 yr({cwd:e,devSessionId:r,sseClient:n}){let o=new Set,t=Bn({cwd:e,devSessionId:r,running:o,sseClient:n}),i=Kn({cwd:e,devSessionId:r,running:o,sseClient:n});return()=>{o.forEach(a=>{a.abort()}),o.clear(),t(),i()}}function Bn({cwd:e,devSessionId:r,running:n,sseClient:o}){return o.subscribe({query:mr(Fn),variables:{devSessionId:r}},{complete:gr,error:t=>{s.error({err:t},"teleportRequested subscription failed")},next:t=>{let i=t.data?.teleportRequested;Sr({cwd:e,devSessionId:r,event:i==null?i:{...i,requestId:void 0},running:n})}})}function gr(){}function Kn({cwd:e,devSessionId:r,running:n,sseClient:o}){return o.subscribe({query:mr(jn),variables:{devSessionId:r}},{complete:gr,error:t=>{s.error({err:t},"durableTeleportRequested subscription failed")},next:t=>{Sr({cwd:e,devSessionId:r,event:t.data?.durableTeleportRequested,running:n})}})}function Sr({cwd:e,devSessionId:r,event:n,running:o}){if(n==null)return;let t=new AbortController;o.add(t),Qn({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 Qn({cwd:e,devSessionId:r,event:n,signal:o}){n.requestId!=null&&!await Xn({cwd:e,devSessionId:r,requestId:n.requestId})||await Jn({cwd:e,devSessionId:r,event:n,signal:o})}async function Jn({cwd:e,devSessionId:r,event:n,signal:o}){let t=c=>Vn({cwd:e,devSessionId:r,requestId:n.requestId,runId:n.runId,status:c}),i=oo(o),a=await eo({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 ${no(n)} step ${String(n.stepIndex+1)}
59
- `);let d=await sr({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 Vn({cwd:e,devSessionId:r,requestId:n,runId:o,status:t}){if(n!=null){await Zn({cwd:e,devSessionId:r,requestId:n,status:t});return}await Yn({cwd:e,devSessionId:r,runId:o,status:t})}async function Xn({cwd:e,devSessionId:r,requestId:n}){let o=m(e).match(i=>i,()=>null);return o==null?!1:(await p({config:o,document:Nn,variables:{devSessionId:r,requestId:n}}).catch(()=>null))?.claimTeleportRequest===!0}async function Yn({cwd:e,devSessionId:r,runId:n,status:o}){let t=m(e).match(i=>i,()=>null);t!=null&&await p({config:t,document:Gn,variables:{devSessionId:r,runId:n,status:o}}).catch(()=>null)}async function Zn({cwd:e,devSessionId:r,requestId:n,status:o}){let t=m(e).match(i=>i,()=>null);t!=null&&await p({config:t,document:zn,variables:{devSessionId:r,requestId:n,status:o}}).catch(()=>null)}async function eo({cwd:e,event:r}){if(r.kind==="explore"){let n=await ro({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 ro({cwd:e,runId:r}){let n=m(e).match(i=>i,()=>null);if(n==null)return null;let o=await p({config:n,document:_n,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 no(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function oo(e){let r=new AbortController,n=Un(()=>{r.abort()},3e4);return{signal:AbortSignal.any([e,r.signal]),clear:()=>{$n(n)}}}import O from"fs";import to from"p-retry";import{graphql as b}from"gql.tada";import{print as M}from"graphql";var io=b(`
60
- query DaemonExploration($devSessionId: String!) {
61
- exploration(devSessionId: $devSessionId) {
62
- active
63
- localWorkers
64
- maxTrailLength
65
- }
66
- }
67
- `),ao=b(`
68
- subscription WatchExplorationChanged($devSessionId: String!) {
69
- explorationChanged(devSessionId: $devSessionId) {
70
- exploration {
71
- active
72
- localWorkers
73
- maxTrailLength
74
- }
75
- }
76
- }
77
- `);function hr({config:e,devSessionId:r,exploration:n,lifetime:o,sseClient:t}){return to(()=>so({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(ao),variables:{devSessionId:r}},{complete:U,error:i=>{$({error:i,stream:"explorationChanged"})},next:i=>{kr(n,i.data?.explorationChanged.exploration)}})}async function so({config:e,devSessionId:r,exploration:n,lifetime:o}){if(W(o))return;let t=await p({config:e,document:io,variables:{devSessionId:r}});W(o)||kr(n,t.exploration)}function kr(e,r){r!=null&&e.setDesired({active:r.active,localWorkers:r.localWorkers,maxTrailLength:r.maxTrailLength})}var lo=b(`
78
- subscription HooksPausedWatch($projectId: String!) {
79
- hooksPausedRequested(projectId: $projectId) {
80
- paused
81
- projectId
82
- }
83
- }
84
- `),co=b(`
85
- subscription WatchLocalConcurrencyChanged {
86
- myMaxLocalConcurrentRunsChanged
87
- }
88
- `);function vr({pool:e,sseClient:r}){return r.subscribe({query:M(co)},{complete:U,error:n=>{$({error:n,stream:"myMaxLocalConcurrentRunsChanged"})},next:n=>{let o=n.data?.myMaxLocalConcurrentRunsChanged;o!=null&&(L(o),e.setSize(o))}})}var uo=b(`
89
- subscription WatchExecutorChangeRequested($devSessionId: String!) {
90
- executorChangeRequested(devSessionId: $devSessionId) {
91
- executor
92
- }
93
- }
94
- `);function wr({config:e,devSessionId:r,lifetime:n,sseClient:o,switcher:t}){return t.connect(r),po({config:e,lifetime:n,switcher:t}),fo({devSessionId:r,sseClient:o,switcher:t})}async function po({config:e,lifetime:r,switcher:n}){if(W(r))return;let o=await lr(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 fo({devSessionId:e,sseClient:r,switcher:n}){return r.subscribe({query:M(uo),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 xr({cwd:e,projectId:r,sseClient:n}){return n.subscribe({query:M(lo),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 br({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 Rr({claim:e,config:r,devSessionId:n,executorSwitch:o,exploration:t,onSynchronized:i,pool:a,sseClient:l,sseHealth:d}){return br({initialId:n,onSynchronized:c=>{i(c),R({cwd:r.cwd,paused:c.hooksPaused})},subscribe:({devSessionId:c,lifetime:u})=>mo({claim:e,config:r,devSessionId:c,executorSwitch:o,exploration:t,lifetime:u,pool:a,sseClient:l,sseHealth:d}),synchronize:c=>yo({config:r,reason:c,sseHealth:d})})}function mo({claim:e,config:r,devSessionId:n,executorSwitch:o,exploration:t,lifetime:i,pool:a,sseClient:l,sseHealth:d}){let c=[wr({config:r,devSessionId:n,lifetime:i,sseClient:l,switcher:o}),xr({cwd:r.cwd,projectId:r.projectId,sseClient:l}),vr({pool:a,sseClient:l}),hr({config:r,devSessionId:n,exploration:t,lifetime:i,sseClient:l}),fr({claim:e,cwd:r.cwd,devSessionId:n,pool:a,sseClient:l,sseHealth:d}),yr({cwd:r.cwd,devSessionId:n,sseClient:l})];return()=>{c.forEach(u=>{u()})}}async function yo({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 go}from"crypto";import Pr from"fs";function Er(){return J===void 0&&(J=So()),J}var J;function So(){let e=process.argv[1];if(e==null)return null;try{let r=Pr.readFileSync(Pr.realpathSync(e));return go("sha256").update(r).digest("hex")}catch{return null}}import{graphql as Ir}from"gql.tada";var ho=Ir(`
95
- query OpenFindingsForRetire($projectId: String!) {
96
- exploreFindings(projectId: $projectId, status: open) {
97
- signature
98
- reproRun {
99
- reproJson
100
- }
101
- }
102
- }
103
- `),ko=Ir(`
104
- mutation RetireStaleFinding($projectId: String!, $signature: String!) {
105
- retireStaleFinding(projectId: $projectId, signature: $signature)
106
- }
107
- `);async function Tr({config:e,cwd:r,lockfile:n}){let t=(await p({config:e,document:ho,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=vo(t,i.value);return a.length===0||(await Promise.all(a.map(l=>xo(e,l))),s.info({count:a.length},"retired findings whose trail no longer replays")),!0}function vo(e,r){return e.map(n=>wo(n,r)?n.signature:null).filter(n=>n!=null)}function wo(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 xo(e,r){return p({config:e,document:ko,variables:{projectId:e.projectId,signature:r}})}var bo=6e4;function Cr(e){let r={retiredKey:null,running:!1,stopped:!1},n=async()=>{if(!(r.running||r.stopped)){r.running=!0;try{r.retiredKey=await Ro(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,bo))},0)};return()=>{r.stopped=!0,clearTimeout(o.timer)}}async function Ro({config:e,cwd:r},n){let o=await h(r),t=Er();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 Tr({config:e,cwd:r,lockfile:a.value})?i:n}import{Agent as Po,fetch as Eo}from"undici";var Io=3e4;function Dr(e=Io){let r=new Po({bodyTimeout:e});return(n,o)=>Eo(n,{...o,dispatcher:r})}function Ar(){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 To from"fs";import Or from"net";import{err as Wr,ok as Co}from"neverthrow";async function Mr({cwd:e,onConnection:r}){ue(e);let n=qe(e),o=await Lr({onConnection:r,socketPath:n});return o.isOk()||o.error.kind!=="stale-candidate"?o.map(qr(n)).mapErr(Hr(n)):await Do(n)?Wr({kind:"already-running",socketPath:n}):($r(n),(await Lr({onConnection:r,socketPath:n})).map(qr(n)).mapErr(Hr(n)))}function Do(e){return new Promise(r=>{let n=Or.connect(e);n.once("connect",()=>{n.destroy(),r(!0)}),n.once("error",()=>{r(!1)})})}async function Lr(e){let r=await Ao(e);return r.kind==="listening"?Co(r.server):Wr(r.error)}function Ao({onConnection:e,socketPath:r}){return new Promise(n=>{let o=Or.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 qr(e){return r=>({socketPath:e,close:()=>{r.close(),$r(e)}})}function $r(e){To.rmSync(e,{force:!0})}function Hr(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomUUID as No}from"crypto";function Ur(){return{attempts:0,backoffUntil:0,consecutiveErrors:0,coverageWaiting:!1,desired:{active:!1,localWorkers:dr,maxTrailLength:cr},executorLocal:!0,findings:0,lastUnhealthyReportAt:null,loading:!1,lockfile:{kind:"loading"},prevInteractiveActive:0,stopped:!1,trails:new Map}}function Fr(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 Wo(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 Mo(e,r);case"stopped":return{effects:[{ids:[...e.trails.keys()],kind:"abort"}],state:{...e,stopped:!0,trails:new Map}}}}function jr(e,r,n){return Q(_r(e),Gr(e,r,n)).health}function V(e,r,n){let o=Oo(e,r,n),t={...e,...o,prevInteractiveActive:n.active},i=Q(_r(t),Gr(t,r,n)),a=t.lockfile.kind!=="ready"&&!t.loading;return{effects:[...Lo(a),...qo(i.abortIds),...Ho({count:i.launchCount,maxTrailLength:t.desired.maxTrailLength})],state:{...t,loading:t.loading||a}}}function Lo(e){return e?[{kind:"load"}]:[]}function qo(e){return e.length>0?[{ids:e,kind:"abort"}]:[]}function Ho({count:e,maxTrailLength:r}){return e>0?[{count:e,kind:"launch",maxTrailLength:r}]:[]}function Oo(e,r,n){return n.active<e.prevInteractiveActive?{backoffUntil:Math.max(e.backoffUntil,r+H)}:{backoffUntil:e.backoffUntil}}function Wo(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 Mo(e,r){let n=new Map([...e.trails].filter(([i])=>i!==r.id)),o=$o({...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 $o(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 Uo(e,r.error,n);case"done":return jo(e,r.result)}}function Uo(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:Fo(r)})}function Fo(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 jo(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 _o=6,Go=2e4;function X({now:e,state:r,subject:n}){let o=r.consecutiveErrors+1,t=Math.max(r.backoffUntil,e+H);if(o<_o)return{effects:[],state:{...r,backoffUntil:t,consecutiveErrors:o}};let i=r.lastUnhealthyReportAt==null||e-r.lastUnhealthyReportAt>=Go;return{effects:i?[{kind:"report-unhealthy",subject:n}]:[],state:{...r,backoffUntil:t,consecutiveErrors:o,lastUnhealthyReportAt:i?e:r.lastUnhealthyReportAt}}}function _r(e){return{enabled:e.desired.active,executorLocal:e.executorLocal,maxTrailLength:e.desired.maxTrailLength,workers:e.desired.localWorkers}}function Gr(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 zr(e){let r=zo(e),n=Qo(()=>{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:()=>Ko(r.current()),stop:()=>{n(),B(null),r.dispatch({kind:"stopped"})}}}function zo(e){let r={draining:!1,planning:Promise.resolve(),queue:[],runtime:Bo(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=Fr(r.runtime.state,a);n(d=>({...d,state:l.state})),l.effects.forEach(d=>{Jo({commit:n,dispatch:o,effect:d,params:e,queuePlanning:t,runtime:r.runtime,current:()=>r.runtime})}),i()};return{dispatch:o,current:()=>r.runtime}}function Bo(e){return{controllers:new Map,prepared:null,reservations:new Map,state:{...Ur(),executorLocal:e.executorIsLocal()}}}function Ko(e){return{explorer:jr(e.state,Date.now(),F()),exploring:e.state.trails.size,progress:{attempts:e.state.attempts,findings:e.state.findings}}}function F(){let e=Ye();return{active:e.active,headedActive:e.headedActive,poolSize:e.poolSize,queued:e.queued}}function P(){return{kind:"tick",now:Date.now(),queue:F()}}function Qo(e){let r={timer:setTimeout(function n(){e(),r.timer=setTimeout(n,K)},K)};return()=>{clearTimeout(r.timer)}}function Jo({commit:e,current:r,dispatch:n,effect:o,params:t,queuePlanning:i,runtime:a}){switch(o.kind){case"load":case"reload":{Xo(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=Vo({commit:e,dispatch:n});i(()=>Zo({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 Vo({commit:e,dispatch:r}){let n=`explore:${No()}`,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 Xo(e,r){try{return await Yo(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 Yo(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 Zo({commit:e,controller:r,dispatch:n,id:o,maxTrailLength:t,params:i,prepared:a,reservedSignatures:l}){if(Nr(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 et({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(Nr(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:()=>rt({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 Nr(e){return e.aborted}async function et({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 rt({assign:e,params:r,signal:n}){let o=await r.executeTrail(e,n);return o.kind==="aborted"?{kind:"aborted"}:o.kind==="error"?nt(r,o.error):{kind:"done",result:o}}async function nt(e,r){let n=await Oe(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 ht}from"gql.tada";import{connect as tt}from"net";import it from"ssh2";import{WebSocket as Kr,createWebSocketStream as at}from"ws";var ot="ripplo-";function Y(e){return Object.entries(e).map(([r,n])=>`${ot}${r}.${n}`)}var{Server:st,utils:Br}=it;function Qr(){let e=Br.generateKeyPairSync("ed25519"),r=Br.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function Jr(e){return new Promise((r,n)=>{let o={closers:new Set,stopped:!1},t=new Kr(e.relayUrl,Y({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:lt(t,o)})}),t.on("message",i=>{dt(e,o,i)}),t.on("close",(i,a)=>{o.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),St(e,o)}),t.on("error",i=>{n(i instanceof Error?i:new Error(String(i)))})})}function lt(e,r){return()=>(r.stopped=!0,r.closers.forEach(n=>{n()}),e.close(),Promise.resolve())}function dt(e,r,n){let o=ct(n);o!=null&&pt(e,r,o.pipeId)}function ct(e){try{let r=JSON.parse(ut(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 ut(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function pt(e,r,n){if(r.stopped)return;let o=new Kr(e.relayUrl,Y({pipeId:n,role:"daemon-data"}));o.on("open",()=>{ft(e,r,o)}),o.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function ft(e,r,n){let o=at(n);o.on("error",()=>{});let t=new st({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{yt(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{gt({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{n.close()};r.closers.add(i),n.on("close",()=>r.closers.delete(i)),mt(t,o)}function mt(e,r){e.injectSocket(r)}function yt(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function gt({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=tt({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 St(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(n=>{n()}),e.onFatal())}var kt=ht(`
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 Xr({config:e,devSessionId:r,onFatal:n}){let o=Qr(),i=(await p({config:e,document:kt,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 Jr({allowedPorts:[...new Set([Vr(e.appUrl),Vr(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 Vr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var Yr=[1e3,3e3,8e3,15e3];function Zr(){return{attempt:0,desired:"local",devSessionId:null,stopped:!1,tunnel:"down"}}function en(e,r){if(e.stopped)return{effects:[],state:e};switch(r.kind){case"requested":return wt(e,r.mode);case"connected":return Z({...e,devSessionId:r.devSessionId},[]);case"tunnel-started":return xt(e);case"tunnel-failed":case"tunnel-fatal":return bt(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 vt(e){let r=Math.min(e,Yr.length-1),n=Yr[r];if(n==null)throw new Error("executor retry ladder is empty");return n}function wt(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 xt(e){return _(e)?{effects:[],state:{...e,attempt:0,tunnel:"up"}}:{effects:[{kind:"stop-tunnel"}],state:{...e,tunnel:"down"}}}function bt(e){let r={...e,tunnel:"down"};return _(r)?{effects:[{delayMs:vt(r.attempt),kind:"schedule-retry"}],state:{...r,attempt:r.attempt+1}}:{effects:[],state:r}}function on(e){let r={draining:!1,io:Promise.resolve(),queue:[],retryTimer:null,state:Zr(),tunnel:null},n=o=>{r.queue.push(o),!r.draining&&(r.draining=!0,tn(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 tn(e,r,n){let o=e.queue.shift();if(o==null)return;let t=en(e.state,o);e.state=t.state,t.effects.forEach(i=>{Rt({cell:e,dispatch:r,effect:i,params:n})}),tn(e,r,n)}function Rt({cell:e,dispatch:r,effect:n,params:o}){switch(n.kind){case"start-tunnel":{rn(e,()=>Pt({cell:e,devSessionId:n.devSessionId,dispatch:r,params:o}));return}case"stop-tunnel":{let t=e.tunnel;e.tunnel=null,nn(e),t!=null&&rn(e,async()=>{await t.stop(),s.info("executor switched to local")});return}case"schedule-retry":{nn(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 Pt({cell:e,devSessionId:r,dispatch:n,params:o}){try{let t=await Xr({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 rn(e,r){e.io=e.io.then(r).catch(n=>{s.warn({err:n},"executor io failed")})}function nn(e){e.retryTimer!=null&&(clearTimeout(e.retryTimer),e.retryTimer=null)}import{graphql as Et}from"gql.tada";var It=Et(`
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 an(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:It,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 Tt}from"fs/promises";import{existsSync as sn}from"fs";import ee from"path";async function ln({config:e,cwd:r}){let n=ee.join(r,".ripplo","debug");await(await Tt(n,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!sn(ee.join(n,i,ce))&&sn(ee.join(n,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>nr({config:e,debugDir:n,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as Ct}from"child_process";import dn from"os";import{CancellationTokenSource as cn,ResponseError as un}from"vscode-jsonrpc/node";function pn(e,r){return()=>{let n=Ct(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:Xe(n),kill:()=>{Dt(n)},onExit:o=>{n.once("exit",o)}}}}function fn(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 Sn(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(n=>re(n,r)))},execute:(n,o)=>qt(n,o,r),exploreTrail:(n,o)=>Ot(n,o,r),routeSpan:(n,o)=>{let t=r.workers.find(i=>i.runId===n);t?.worker.connection.sendNotification(Qe,{runId:n,span:o})},setSize:n=>{Mt(n,r)},updateSession:n=>{r.devSessionId=n.devSessionId,r.targetGeneration=n.targetGeneration}}}function Dt(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var At=1e4,Lt=1e4,mn=-32800;async function qt(e,r,n){let o=await yn(n);if(o.runId=e.runId,!o.alive)return G(o,n),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let t=new cn,i=()=>{t.cancel()};r.aborted&&t.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await o.worker.connection.sendRequest(ze,e,t.token),l=Ge.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return Ht(a,o)}finally{r.removeEventListener("abort",i),t.dispose(),G(o,n)}}async function yn(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=gn(e);return n.runId="pending",await n.ready,n}return new Promise(n=>{e.waiters.push(o=>{o.runId="pending",n(o)})})}function gn(e){let r=e.spawn(),n={resolve:()=>{}},o={alive:!0,id:e.nextId,ready:new Promise(t=>{n.resolve=t,r.connection.onNotification(Ne,t)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest(Be,()=>e.lockfileProvider()),r.connection.onNotification(Je,t=>{let i=_e.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(Ve).catch(()=>{});let o=setTimeout(()=>{e.worker.kill()},At);await n,clearTimeout(o)}function Ht(e,r){return e instanceof un&&e.code===mn?{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 Ot(e,r,n){let o=await yn(n);if(o.runId="explore",!o.alive)return G(o,n),{error:{detail:"worker-dead",source:"transport"},kind:"error"};let t=new cn,i={cancel:()=>{}},a=()=>{t.cancel();let l=setTimeout(()=>{o.worker.kill()},Lt);i.cancel=()=>{clearTimeout(l)}};r.aborted&&a(),r.addEventListener("abort",a,{once:!0});try{let l=await o.worker.connection.sendRequest(Ke,{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 Wt(l)}finally{i.cancel(),r.removeEventListener("abort",a),t.dispose(),G(o,n)}}function Wt(e){return e instanceof un&&e.code===mn?{kind:"aborted",ranCount:0}:{error:{detail:e instanceof Error?e.message.slice(0,120):"unknown",source:"transport"},kind:"error"}}function Mt(e,r){r.size=e,e>dn.availableParallelism()&&s.warn({cores:dn.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)}),Sn(r)}function Sn(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{gn(e)})}var Nt=6e4,hn=500,zt=15e3,Bt=vn(`
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
- `),Kt=vn(`
161
- query WatchLocalConcurrency {
162
- currentUser {
163
- id
164
- maxLocalConcurrentRuns
165
- }
166
- }
167
- `);async function Xs({exploreDebug:e}){ci();let r=li(process.cwd()),n=r.cwd,o=Ut(),t=ti(n),i={current:null},a={handler:()=>{}},l=on({config:r,onChanged:()=>{a.handler()}}),d={handler:()=>{}},c=ai(),u=Ar(),f=rr({config:r,cwd:n,executor:l.current,ready:c.promise,explorationStatus:()=>i.current?.status()??Qt(),onShutdownRequest:()=>{d.handler()},sseHealth:()=>u.snapshot()}),y=await si({cwd:n,ipc:f,releasePid:t}),N=await I(n);N.isErr()&&(process.stderr.write(`ripplo: ${D(N.error)}
168
- `),process.exit(1));let wn=N.value,w=await ei({config:r,synchronize:()=>Le({config:r,cwd:n,lockfile:wn})}),ne=await h(n);ne!=null&&Ze(ne);let g={devSessionId:w.devSessionId,targetGeneration:kn({devSessionId:w.devSessionId,nonce:o})},xn=Cr({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 bn=jt({fetchFn:Dr(),headers:{Authorization:`Bearer ${r.token}`},retry:pr,retryAttempts:1/0,url:`${r.ripploServerUrl}/graphql`});ln({config:r,cwd:n}).catch(()=>{});let x=await ni({config:r,devSessionId:g.devSessionId,ipc:f,targetGeneration:g.targetGeneration}),E=Jt({config:r,exploreDebug:e,pool:x,currentSession:()=>g,executorIsLocal:()=>l.current()==="local"});i.current=E,a.handler=E.notifyQueueChange;let Rn=await Xt({cwd:n,pool:x}),te=Rr({claim:f.claim,config:r,devSessionId:w.devSessionId,executorSwitch:l,exploration:E,pool:x,sseClient:bn,sseHealth:u,onSynchronized:ie=>{g.devSessionId=ie.devSessionId,g.targetGeneration=kn({devSessionId:ie.devSessionId,nonce:o}),x.updateSession(g)}}),Pn=Zt({config:r,session:te}),En=di();c.resolve(),Yt(w.devSessionId),an({config:r,executorSwitch:l,exploration:E,pool:x,releasePid:t,session:te,shutdownRef:d,socketHandle:y,spanReceiver:Rn,stops:[Pn,En,xn]}),await new Promise(()=>{})}function Qt(){return{explorer:{kind:"off"},exploring:0,progress:{attempts:0,findings:0}}}function Jt({config:e,currentSession:r,executorIsLocal:n,exploreDebug:o,pool:t}){return zr({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:n,onPlannerTrace:o?Vt:void 0,executeTrail:(i,a)=>t.exploreTrail(i,a),leaseOrdinal:()=>ir({config:e,count:1,devSessionId:r().devSessionId}),report:i=>{tr({attempts:i.attempts,config:e,devSessionId:r().devSessionId,findings:i.findings,trail:or(i.result)}).catch(a=>{s.warn({error:a},"exploration progress report failed")})},reportUnhealthy:()=>{ar(e,r().devSessionId).catch(i=>{s.warn({error:i},"exploration unhealthy report failed")})},targetGeneration:()=>r().targetGeneration})}function kn({devSessionId:e,nonce:r}){return{kind:"dev-session",value:`${e}:${r}`}}function Vt(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 Xt({cwd:e,pool:r}){return Ie({localDir:Ft.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:n=>{let o=n.attributes["ripplo.run"];o!=null&&r.routeSpan(o,n)}})}function Yt(e){process.stdout.write(`${Ue({devSessionId:e,version:se()})}
169
- `)}function Zt({config:e,session:r}){let n=async()=>{try{let t=await p({config:e,document:Bt,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()},zt);return()=>{clearInterval(o)}}function ei({config:e,synchronize:r}){let n=e.ripploServerUrl.includes("localhost")||e.ripploServerUrl.includes("127.0.0.1");return _t(async()=>{try{return await r()}catch(o){if(ri({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 Gt(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 ri({config:e,error:r}){let n=de(r);n==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${$e()}
170
- `),process.exit(1)),n==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${Me({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
171
- `),process.exit(1))}async function ni({config:e,devSessionId:r,ipc:n,targetGeneration:o}){let t=await pi(e);return oi({cwd:e.cwd,devSessionId:r,initialConcurrency:t,onProgress:n.progress,targetGeneration:o})}function oi({cwd:e,devSessionId:r,initialConcurrency:n,onProgress:o,targetGeneration:t}){return fn({devSessionId:r,initialSize:n,onProgress:o,spawn:pn(fi(),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 ti(e){try{return fe({cwd:e,onCompromised:ii})}catch(r){throw r instanceof pe&&(process.stderr.write(`${Fe({cwd:r.cwd,pid:r.pid})}
172
- `),process.exit(1)),r}}function ii(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${je()}
173
- `),process.exit(1)}function ai(){let e={handler:()=>{}};return{promise:new Promise(n=>{e.handler=n}),resolve:()=>{e.handler()}}}async function si({cwd:e,ipc:r,releasePid:n}){return(await Mr({cwd:e,onConnection:r.handleConnection})).match(t=>t,t=>{process.stderr.write(`${We(t)}
174
- `),n(),process.exit(1)})}function li(e){return m(e).match(r=>r,r=>{process.stderr.write(`${He(r)}
175
- `),process.exit(1)})}function di(){z({maxRuns:hn});let e=setInterval(()=>{z({maxRuns:hn})},Nt);return()=>{clearInterval(e)}}function ci(){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 ui=4;async function pi(e){try{let n=(await p({config:e,document:Kt,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 ui}function fi(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{Xs 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-O4A5UISQ.js";import"./chunk-F4UCCW7Q.js";import"./chunk-KOZTQJBB.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-5JXP37ET.js";import"./chunk-KOZTQJBB.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-JPXTGKSB.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-7LCAN3Z5.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-QQ6VKZ6A.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-QSKOYBDO.js";import{a as e}from"./chunk-EVEITUJH.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-IRT6UHD3.js";import"./chunk-NUBMOTH6.js";import"./chunk-OQ6KNYPG.js";import"./chunk-RXLDAR2J.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-BTIQ5H3K.js";import"./chunk-F4UCCW7Q.js";import"./chunk-5JXP37ET.js";import"./chunk-KOZTQJBB.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-QSKOYBDO.js";import"./chunk-IRT6UHD3.js";import"./chunk-NUBMOTH6.js";import"./chunk-OQ6KNYPG.js";import"./chunk-RXLDAR2J.js";import"./chunk-JS3DLVVI.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-BTIQ5H3K.js";import"./chunk-F4UCCW7Q.js";import"./chunk-5JXP37ET.js";import"./chunk-KOZTQJBB.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-EVEITUJH.js";import"./chunk-SXVWB7TZ.js";import"./chunk-JJ4QQPAV.js";import"./chunk-BTIQ5H3K.js";import"./chunk-F4UCCW7Q.js";import"./chunk-5JXP37ET.js";import"./chunk-KOZTQJBB.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};