ripplo 0.7.62 → 0.8.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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{Y as r}from"./chunk-SAYJ5AQK.js";import"./chunk-KMZ3L5YA.js";r();
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{g as a}from"./chunk-GOFUUPKD.js";import"./chunk-E4AOUQQ7.js";import"./chunk-THHZNLXN.js";import"./chunk-VGYX2VAS.js";import"./chunk-SAYJ5AQK.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripplo",
3
- "version": "0.7.62",
3
+ "version": "0.8.0",
4
4
  "description": "CLI for Ripplo — AI-powered end-to-end testing",
5
5
  "type": "module",
6
6
  "homepage": "https://ripplo.ai",
@@ -29,7 +29,7 @@
29
29
  "gql.tada": "^1.9.0",
30
30
  "graphql": "^16.11.0",
31
31
  "graphql-sse": "^2.6.0",
32
- "jiti": "^2.6.1",
32
+ "esbuild": "^0.25.12",
33
33
  "latest-version": "^9.0.0",
34
34
  "neverthrow": "^8.2.0",
35
35
  "p-queue": "^9.3.0",
@@ -68,13 +68,13 @@
68
68
  "tsup": "^8.5.1",
69
69
  "vitest": "^4.1.4",
70
70
  "@ripplo/core": "^0.0.0",
71
- "@ripplo/runtime": "^0.0.0",
71
+ "@ripplo/eslint-config": "0.0.0",
72
+ "@ripplo/graphql": "^0.0.0",
73
+ "@ripplo/rrweb-bundle": "0.0.0",
72
74
  "@ripplo/run-report": "0.0.0",
73
- "@ripplo/spec": "^0.0.0",
75
+ "@ripplo/runtime": "^0.0.0",
74
76
  "@ripplo/solver": "^0.0.0",
75
- "@ripplo/rrweb-bundle": "0.0.0",
76
- "@ripplo/eslint-config": "0.0.0",
77
- "@ripplo/graphql": "^0.0.0"
77
+ "@ripplo/spec": "^0.0.0"
78
78
  },
79
79
  "scripts": {
80
80
  "dev": "tsx watch src/index.ts",
@@ -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
- var G=Object.create;var N=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var P=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var te=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of X(e))!ee.call(i,s)&&s!==t&&N(i,s,{get:()=>e[s],enumerable:!(n=Q(e,s))||n.enumerable});return i};var ue=(i,e,t)=>(t=i!=null?G(Z(i)):{},te(e||!i||!i.__esModule?N(t,"default",{value:i,enumerable:!0}):t,i));var I=P(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.timingSafeEqual=void 0;function T(i,e=""){if(!i)throw new Error(e)}function re(i,e){if(i.byteLength!==e.byteLength)return!1;i instanceof DataView||(i=new DataView(ArrayBuffer.isView(i)?i.buffer:i)),e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),T(i instanceof DataView),T(e instanceof DataView);let t=i.byteLength,n=0,s=-1;for(;++s<t;)n|=i.getUint8(s)^e.getUint8(s);return n===0}V.timingSafeEqual=re});var $=P(S=>{"use strict";var ie=S&&S.__extends||(function(){var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var g in s)s.hasOwnProperty(g)&&(n[g]=s[g])},i(e,t)};return function(e,t){i(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(S,"__esModule",{value:!0});var l=256,z=(function(){function i(e){e===void 0&&(e="="),this._paddingCharacter=e}return i.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},i.prototype.encode=function(e){for(var t="",n=0;n<e.length-2;n+=3){var s=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(s>>>18&63),t+=this._encodeByte(s>>>12&63),t+=this._encodeByte(s>>>6&63),t+=this._encodeByte(s>>>0&63)}var g=e.length-n;if(g>0){var s=e[n]<<16|(g===2?e[n+1]<<8:0);t+=this._encodeByte(s>>>18&63),t+=this._encodeByte(s>>>12&63),g===2?t+=this._encodeByte(s>>>6&63):t+=this._paddingCharacter||"",t+=this._paddingCharacter||""}return t},i.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},i.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},i.prototype.decode=function(e){if(e.length===0)return new Uint8Array(0);for(var t=this._getPaddingLength(e),n=e.length-t,s=new Uint8Array(this.maxDecodedLength(n)),g=0,p=0,m=0,E=0,C=0,A=0,a=0;p<n-4;p+=4)E=this._decodeChar(e.charCodeAt(p+0)),C=this._decodeChar(e.charCodeAt(p+1)),A=this._decodeChar(e.charCodeAt(p+2)),a=this._decodeChar(e.charCodeAt(p+3)),s[g++]=E<<2|C>>>4,s[g++]=C<<4|A>>>2,s[g++]=A<<6|a,m|=E&l,m|=C&l,m|=A&l,m|=a&l;if(p<n-1&&(E=this._decodeChar(e.charCodeAt(p)),C=this._decodeChar(e.charCodeAt(p+1)),s[g++]=E<<2|C>>>4,m|=E&l,m|=C&l),p<n-2&&(A=this._decodeChar(e.charCodeAt(p+2)),s[g++]=C<<4|A>>>2,m|=A&l),p<n-3&&(a=this._decodeChar(e.charCodeAt(p+3)),s[g++]=A<<6|a,m|=a&l),m!==0)throw new Error("Base64Coder: incorrect characters for decoding");return s},i.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)},i.prototype._decodeChar=function(e){var t=l;return t+=(42-e&e-44)>>>8&-l+e-43+62,t+=(46-e&e-48)>>>8&-l+e-47+63,t+=(47-e&e-58)>>>8&-l+e-48+52,t+=(64-e&e-91)>>>8&-l+e-65+0,t+=(96-e&e-123)>>>8&-l+e-97+26,t},i.prototype._getPaddingLength=function(e){var t=0;if(this._paddingCharacter){for(var n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw new Error("Base64Coder: incorrect padding")}return t},i})();S.Coder=z;var D=new z;function ne(i){return D.encode(i)}S.encode=ne;function oe(i){return D.decode(i)}S.decode=oe;var R=(function(i){ie(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-13,n+=62-t>>>8&49,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=l;return n+=(44-t&t-46)>>>8&-l+t-45+62,n+=(94-t&t-96)>>>8&-l+t-95+63,n+=(47-t&t-58)>>>8&-l+t-48+52,n+=(64-t&t-91)>>>8&-l+t-65+0,n+=(96-t&t-123)>>>8&-l+t-97+26,n},e})(z);S.URLSafeCoder=R;var W=new R;function fe(i){return W.encode(i)}S.encodeURLSafe=fe;function se(i){return W.decode(i)}S.decodeURLSafe=se;S.encodedLength=function(i){return D.encodedLength(i)};S.maxDecodedLength=function(i){return D.maxDecodedLength(i)};S.decodedLength=function(i){return D.decodedLength(i)}});var J=P((K,j)=>{"use strict";(function(i,e){var t={};e(t);var n=t.default;for(var s in t)n[s]=t[s];typeof j=="object"&&typeof j.exports=="object"?j.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):i.sha256=n})(K,function(i){"use strict";i.__esModule=!0,i.digestLength=32,i.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 t(a,r,o,f,x){for(var c,u,h,_,v,d,U,b,w,y,B,O,M;x>=64;){for(c=r[0],u=r[1],h=r[2],_=r[3],v=r[4],d=r[5],U=r[6],b=r[7],y=0;y<16;y++)B=f+y*4,a[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=a[y-2],O=(w>>>17|w<<15)^(w>>>19|w<<13)^w>>>10,w=a[y-15],M=(w>>>7|w<<25)^(w>>>18|w<<14)^w>>>3,a[y]=(O+a[y-7]|0)+(M+a[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]+a[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;r[0]+=c,r[1]+=u,r[2]+=h,r[3]+=_,r[4]+=v,r[5]+=d,r[6]+=U,r[7]+=b,f+=64,x-=64}return f}var n=(function(){function a(){this.digestLength=i.digestLength,this.blockSize=i.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 a.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},a.prototype.clean=function(){for(var r=0;r<this.buffer.length;r++)this.buffer[r]=0;for(var r=0;r<this.temp.length;r++)this.temp[r]=0;this.reset()},a.prototype.update=function(r,o){if(o===void 0&&(o=r.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++]=r[f++],o--;this.bufferLength===64&&(t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(o>=64&&(f=t(this.temp,this.state,r,f,o),o%=64);o>0;)this.buffer[this.bufferLength++]=r[f++],o--;return this},a.prototype.finish=function(r){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,t(this.temp,this.state,this.buffer,0,u),this.finished=!0}for(var h=0;h<8;h++)r[h*4+0]=this.state[h]>>>24&255,r[h*4+1]=this.state[h]>>>16&255,r[h*4+2]=this.state[h]>>>8&255,r[h*4+3]=this.state[h]>>>0&255;return this},a.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},a.prototype._saveState=function(r){for(var o=0;o<this.state.length;o++)r[o]=this.state[o]},a.prototype._restoreState=function(r,o){for(var f=0;f<this.state.length;f++)this.state[f]=r[f];this.bytesHashed=o,this.finished=!1,this.bufferLength=0},a})();i.Hash=n;var s=(function(){function a(r){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var o=new Uint8Array(this.blockSize);if(r.length>this.blockSize)new n().update(r).finish(o).clean();else for(var f=0;f<r.length;f++)o[f]=r[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 a.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},a.prototype.clean=function(){for(var r=0;r<this.istate.length;r++)this.ostate[r]=this.istate[r]=0;this.inner.clean(),this.outer.clean()},a.prototype.update=function(r){return this.inner.update(r),this},a.prototype.finish=function(r){return this.outer.finished?this.outer.finish(r):(this.inner.finish(r),this.outer.update(r,this.digestLength).finish(r)),this},a.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},a})();i.HMAC=s;function g(a){var r=new n().update(a),o=r.digest();return r.clean(),o}i.hash=g,i.default=g;function p(a,r){var o=new s(a).update(r),f=o.digest();return o.clean(),f}i.hmac=p;function m(a,r,o,f){var x=f[0];if(x===0)throw new Error("hkdf: cannot expand more");r.reset(),x>1&&r.update(a),o&&r.update(o),r.update(f),r.finish(a),f[0]++}var E=new Uint8Array(i.digestLength);function C(a,r,o,f){r===void 0&&(r=E),f===void 0&&(f=32);for(var x=new Uint8Array([1]),c=p(r,a),u=new s(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}i.hkdf=C;function A(a,r,o,f){for(var x=new s(a),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(r),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}i.pbkdf2=A})});var ce=P(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.Webhook=L.WebhookVerificationError=void 0;var ae=I(),Y=$(),he=J(),F=300,H=class i extends Error{constructor(e){super(e),Object.setPrototypeOf(this,i.prototype),this.name="ExtendableError",this.stack=new Error(e).stack}},k=class i extends H{constructor(e){super(e),Object.setPrototypeOf(this,i.prototype),this.name="WebhookVerificationError"}};L.WebhookVerificationError=k;var q=class i{constructor(e,t){if(!e)throw new Error("Secret can't be empty.");if(t?.format==="raw")e instanceof Uint8Array?this.key=e:this.key=Uint8Array.from(e,n=>n.charCodeAt(0));else{if(typeof e!="string")throw new Error("Expected secret to be of type string");e.startsWith(i.prefix)&&(e=e.substring(i.prefix.length)),this.key=Y.decode(e)}}verify(e,t){let n={};for(let r of Object.keys(t))n[r.toLowerCase()]=t[r];let s=n["webhook-id"],g=n["webhook-signature"],p=n["webhook-timestamp"];if(!g||!s||!p)throw new k("Missing required headers");let m=this.verifyTimestamp(p),C=this.sign(s,m,e).split(",")[1],A=g.split(" "),a=new globalThis.TextEncoder;for(let r of A){let[o,f]=r.split(",");if(o==="v1"&&(0,ae.timingSafeEqual)(a.encode(f),a.encode(C)))return JSON.parse(e.toString())}throw new k("No matching signature found")}sign(e,t,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let s=new TextEncoder,g=Math.floor(t.getTime()/1e3),p=s.encode(`${e}.${g}.${n}`);return`v1,${Y.encode(he.hmac(this.key,p))}`}verifyTimestamp(e){let t=Math.floor(Date.now()/1e3),n=parseInt(e,10);if(isNaN(n))throw new k("Invalid Signature Headers");if(t-n>F)throw new k("Message timestamp too old");if(n>t+F)throw new k("Message timestamp too new");return new Date(n*1e3)}};L.Webhook=q;q.prefix="whsec_"});export{P as a,ue as b,ce as c};
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __ripploCreateRequire } from "node:module";
3
- const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{b as G,c as q}from"./chunk-63TU4VJ7.js";import{execFileSync as O}from"child_process";import U from"fs";import p from"path";function F(e){let r=L(e);return r??A(e)}function A(e){let r=p.dirname(e);return N(p.join(e,".ripplo"))?e:r===e?null:A(r)}function N(e){try{return U.statSync(e).isDirectory()}catch{return!1}}function L(e){let r=j(["rev-parse","--show-toplevel"],e);if(r==null)return null;let t=r.trim();return t.length===0?null:p.isAbsolute(t)?t:p.resolve(e,t)}function j(e,r){try{return O("git",e,{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}var f=class extends Error{detail;serverUrl;constructor({detail:r,serverUrl:t}){super(`Failed to connect to Ripplo server at ${t}. Check the server is running and reachable. Details: ${r}`),this.name="GqlConnectionError",this.detail=r,this.serverUrl=t}},c=class extends Error{errors;constructor(r){super(r.map(t=>t.message).join(", ")),this.name="GqlRequestError",this.errors=r}};function B(e){if(e instanceof c)return e.errors[0]?.extensions?.code}async function b(e){let{print:r}=await import("graphql"),t=r(e.document),n=JSON.stringify({query:t,variables:e.variables}),o=`${e.config.ripploServerUrl}/graphql`,d=await W({init:{body:n,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST"},serverUrl:e.config.ripploServerUrl,url:o}),s=await Q({res:d,url:o});if(!J(s))throw new Error("Invalid GraphQL response");if(K(s))throw new c(s.errors);if(s.data==null)throw new Error("No data returned from server");return s.data}async function W({init:e,serverUrl:r,url:t}){let n=1,o=await E({init:e,url:t});for(;o.retryable&&n<3;)await H(V(n)),n+=1,o=await E({init:e,url:t});if(o.response!=null)return o.response;throw new f({detail:o.detail,serverUrl:r})}async function E({init:e,url:r}){try{let t=await fetch(r,{...e,signal:AbortSignal.timeout(15e3)});return{detail:"",response:t,retryable:t.status>=500}}catch(t){return{detail:t instanceof Error?t.message:String(t),response:void 0,retryable:!0}}}function V(e){return 300*3**(e-1)*(.5+Math.random())}function H(e){return new Promise(r=>{setTimeout(r,e)})}async function Q({res:e,url:r}){let t=await e.text();if(t.length===0)throw new Error(`Empty response from Ripplo server at ${r} (status ${String(e.status)}). The server may have restarted or the request was rejected before a body was sent.`);try{return JSON.parse(t)}catch{throw new Error(`Non-JSON response from Ripplo server at ${r} (status ${String(e.status)}): ${t.slice(0,200)}`)}}function J(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function K(e){return Array.isArray(e.errors)&&e.errors.length>0}import X from"pino";import z from"pino-pretty";var y=X({level:process.env.LOG_LEVEL??"info"},z({ignore:"pid,hostname"}));import{readdir as Y,rm as Z,stat as ee}from"fs/promises";import k from"path";var x=k.join(process.cwd(),".ripplo","debug"),T=360*60*1e3;async function re({maxRuns:e}){try{let t=(await Y(x,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let m=k.join(x,i.name),$=await ee(m);return{dirPath:m,mtime:$.mtimeMs}})),d=o.filter(i=>n-i.mtime>T),M=o.filter(i=>n-i.mtime<=T).toSorted((i,m)=>m.mtime-i.mtime).slice(e),R=[...d,...M];if(R.length===0)return;await Promise.allSettled(R.map(i=>Z(i.dirPath,{force:!0,recursive:!0}))),y.debug("Pruned %d old debug run(s)",R.length)}catch{y.warn("Debug run pruning failed, ignoring")}}import a from"fs";import te from"os";import u from"path";var ne=".local",oe=".ripplo";function v(e){return u.join(e,".ripplo",ne)}function ie(e){let r=v(e);a.existsSync(r)||a.mkdirSync(r,{recursive:!0});let t=u.join(r,".gitignore");return a.existsSync(t)||a.writeFileSync(t,`*
5
- `),r}function se(e,r){return u.join(v(e),r)}function h(){return u.join(te.homedir(),oe)}function S(){let e=h();return a.existsSync(e)?a.chmodSync(e,448):a.mkdirSync(e,{mode:448,recursive:!0}),e}function P(e){return u.join(h(),e)}import{Agent as ae,RetryAgent as le,setGlobalDispatcher as de}from"undici";var ce=1500,ue=4e3,ge=3,me=50,pe=100,C=!1;function fe(){if(C)return;C=!0;let e=new ae({connections:pe,keepAliveMaxTimeout:ue,keepAliveTimeout:ce}),r=new le(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:ge,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:me});de(r)}import{graphql as g}from"gql.tada";var je=g(`
6
- query AgentReviewContextWorker($reviewId: String!) {
7
- agentReview(id: $reviewId) {
8
- id
9
- runId
10
- agentProfile {
11
- id
12
- name
13
- description
14
- output
15
- successCriteria
16
- }
17
- }
18
- }
19
- `);var Be=g(`
20
- mutation StartAgentReviewWorker($reviewId: String!) {
21
- startAgentReview(reviewId: $reviewId)
22
- }
23
- `);var We=g(`
24
- mutation CompleteAgentReviewWorker(
25
- $reviewId: String!
26
- $markdown: String!
27
- $shortSummary: String!
28
- $verdict: AgentReviewVerdict!
29
- $comments: [AgentReviewCommentInput!]!
30
- ) {
31
- completeAgentReview(
32
- reviewId: $reviewId
33
- markdown: $markdown
34
- shortSummary: $shortSummary
35
- verdict: $verdict
36
- comments: $comments
37
- )
38
- }
39
- `);var Ve=g(`
40
- mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
41
- updateAgentReviewProgress(reviewId: $reviewId, text: $text)
42
- }
43
- `);var He=g(`
44
- mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
45
- failAgentReview(reviewId: $reviewId, reason: $reason)
46
- }
47
- `);import l from"fs";import I from"path";function ye(e){let r=process.env.RIPPLO_TOKEN;if(r!=null&&r.trim().length>0)return r.trim();let t=w(e);if(!l.existsSync(t))return null;let n=l.readFileSync(t,"utf8").trim();return n.length===0?null:n}function we({serverUrl:e,token:r}){S();let t=w(e);l.mkdirSync(I.dirname(t),{mode:448,recursive:!0}),l.writeFileSync(t,r+`
48
- `,{mode:384})}function Re(e){let r=w(e);return l.existsSync(r)?(l.unlinkSync(r),!0):!1}function w(e){return P(I.join("tokens",ve(e)))}function ve(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var D=G(q(),1);import _ from"crypto";function he({body:e,secret:r}){let t=new D.Webhook(r),n=`msg_${_.randomUUID()}`,o=new Date,d=t.sign(n,o,e),s=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":d,"webhook-timestamp":String(s)}}function Se(){return`whsec_${_.randomBytes(24).toString("base64")}`}export{F as a,f as b,c,B as d,b as e,y as f,re as g,ie as h,se as i,ye as j,we as k,Re as l,w as m,fe as n,he as o,Se as p};