ripplo 0.7.38 → 0.7.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripplo",
3
- "version": "0.7.38",
3
+ "version": "0.7.39",
4
4
  "description": "CLI for Ripplo — AI-powered end-to-end testing",
5
5
  "type": "module",
6
6
  "homepage": "https://ripplo.ai",
@@ -61,10 +61,10 @@
61
61
  "vitest": "^4.1.4",
62
62
  "@ripplo/core": "^0.0.0",
63
63
  "@ripplo/run-report": "0.0.0",
64
- "@ripplo/runtime": "^0.0.0",
65
64
  "@ripplo/eslint-config": "0.0.0",
66
- "@ripplo/graphql": "^0.0.0",
65
+ "@ripplo/runtime": "^0.0.0",
67
66
  "@ripplo/rrweb-bundle": "0.0.0",
67
+ "@ripplo/graphql": "^0.0.0",
68
68
  "@ripplo/spec": "^0.0.0"
69
69
  },
70
70
  "scripts": {
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as q}from"./chunk-IHSHBPJY.js";import{b as G}from"./chunk-7UWDMECF.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??P(e)}function P(e){let r=p.dirname(e);return N(p.join(e,".ripplo"))?e:r===e?null:P(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 x(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 b=k.join(process.cwd(),".ripplo","debug"),T=360*60*1e3;async function re({maxRuns:e}){try{let t=(await Y(b,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let m=k.join(b,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{Agent as te,RetryAgent as ne,setGlobalDispatcher as oe}from"undici";var ie=1500,se=4e3,ae=3,le=50,de=100,C=!1;function ce(){if(C)return;C=!0;let e=new te({connections:de,keepAliveMaxTimeout:se,keepAliveTimeout:ie}),r=new ne(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:ae,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:le});oe(r)}import{graphql as u}from"gql.tada";var Ue=u(`
3
- query AgentReviewContextWorker($reviewId: String!) {
4
- agentReview(id: $reviewId) {
5
- id
6
- runId
7
- agentProfile {
8
- id
9
- name
10
- description
11
- output
12
- successCriteria
13
- }
14
- }
15
- }
16
- `);var Fe=u(`
17
- mutation StartAgentReviewWorker($reviewId: String!) {
18
- startAgentReview(reviewId: $reviewId)
19
- }
20
- `);var Ne=u(`
21
- mutation CompleteAgentReviewWorker(
22
- $reviewId: String!
23
- $markdown: String!
24
- $shortSummary: String!
25
- $verdict: AgentReviewVerdict!
26
- $comments: [AgentReviewCommentInput!]!
27
- ) {
28
- completeAgentReview(
29
- reviewId: $reviewId
30
- markdown: $markdown
31
- shortSummary: $shortSummary
32
- verdict: $verdict
33
- comments: $comments
34
- )
35
- }
36
- `);var Le=u(`
37
- mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
38
- updateAgentReviewProgress(reviewId: $reviewId, text: $text)
39
- }
40
- `);var je=u(`
41
- mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
42
- failAgentReview(reviewId: $reviewId, reason: $reason)
43
- }
44
- `);import l from"fs";import I from"path";import a from"fs";import ue from"os";import g from"path";var ge=".local",me=".ripplo";function v(e){return g.join(e,".ripplo",ge)}function pe(e){let r=v(e);a.existsSync(r)||a.mkdirSync(r,{recursive:!0});let t=g.join(r,".gitignore");return a.existsSync(t)||a.writeFileSync(t,`*
45
- `),r}function fe(e,r){return g.join(v(e),r)}function h(){return g.join(ue.homedir(),me)}function S(){let e=h();return a.existsSync(e)?a.chmodSync(e,448):a.mkdirSync(e,{mode:448,recursive:!0}),e}function A(e){return g.join(h(),e)}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+`
46
- `,{mode:384})}function Re(e){let r=w(e);return l.existsSync(r)?(l.unlinkSync(r),!0):!1}function w(e){return A(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,B as c,x as d,y as e,re as f,pe as g,fe as h,ye as i,we as j,Re as k,w as l,ce as m,he as n,Se as o};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};