ripplo 0.7.61 → 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.
- package/dist/{chunk-ZPCVY23H.js → chunk-D6FZ55DP.js} +1 -1
- package/dist/chunk-E4AOUQQ7.js +10 -0
- package/dist/{chunk-5YQYVDNN.js → chunk-GOFUUPKD.js} +1 -1
- package/dist/chunk-KMZ3L5YA.js +4 -0
- package/dist/chunk-NIKFQP6W.js +301 -0
- package/dist/chunk-NNH3YVVO.js +4 -0
- package/dist/chunk-SAYJ5AQK.js +55 -0
- package/dist/chunk-THHZNLXN.js +48 -0
- package/dist/chunk-VGYX2VAS.js +85 -0
- package/dist/daemon-MBF7JVEN.js +139 -0
- package/dist/daemon-VIHSG5KP.js +4 -0
- package/dist/daemon-lock-HIZ6UWXO.js +4 -0
- package/dist/index.js +228 -237
- package/dist/solve-worker.js +4 -0
- package/dist/status-G5OG62JI.js +4 -0
- package/package.json +5 -5
- package/dist/chunk-63TU4VJ7.js +0 -4
- package/dist/chunk-6SKODQ54.js +0 -136
- package/dist/chunk-7C6PFZJF.js +0 -287
- package/dist/chunk-LHXEVZIV.js +0 -10
- package/dist/chunk-PXYDLKAG.js +0 -48
- package/dist/daemon-47WHU7QZ.js +0 -139
- package/dist/daemon-MTPTV22N.js +0 -4
- package/dist/daemon-lock-6NG7JHQO.js +0 -4
- package/dist/status-UG3NHVXY.js +0 -4
|
@@ -0,0 +1,48 @@
|
|
|
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-NNH3YVVO.js";import{b as O}from"./chunk-KMZ3L5YA.js";import{execFileSync as N}from"child_process";import F from"fs";import p from"path";function L(e){let r=j(e);return r??b(e)}function b(e){let r=p.dirname(e);return V(p.join(e,".ripplo"))?e:r===e?null:b(r)}function V(e){try{return F.statSync(e).isDirectory()}catch{return!1}}function j(e){let r=W(["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 W(e,r){try{return N("git",e,{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}var v=null;function B(e){v=e}function A(){return v==null?{}:{"x-ripplo-client-version":v}}var H=15e3,J=3,Q=300,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 K(e){if(e instanceof c)return e.errors[0]?.extensions?.code}async function T(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 X({init:{body:n,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json",...A()},method:"POST"},serverUrl:e.config.ripploServerUrl,url:o}),s=await Z({res:d,url:o});if(!ee(s))throw new Error("Invalid GraphQL response");if(re(s))throw new c(s.errors);if(s.data==null)throw new Error("No data returned from server");return s.data}async function X({init:e,serverUrl:r,url:t}){let n=1,o=await E({init:e,url:t});for(;o.retryable&&n<J;)await Y(z(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(H)});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 z(e){return Q*3**(e-1)*(.5+Math.random())}function Y(e){return new Promise(r=>{setTimeout(r,e)})}async function Z({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 ee(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function re(e){return Array.isArray(e.errors)&&e.errors.length>0}import te from"pino";import ne from"pino-pretty";var y=te({level:process.env.LOG_LEVEL??"info"},ne({ignore:"pid,hostname"}));import{readdir as oe,rm as ie,stat as se}from"fs/promises";import I from"path";var k=I.join(process.cwd(),".ripplo","debug"),C=360*60*1e3;async function ae({maxRuns:e}){try{let t=(await oe(k,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let m=I.join(k,i.name),M=await se(m);return{dirPath:m,mtime:M.mtimeMs}})),d=o.filter(i=>n-i.mtime>C),G=o.filter(i=>n-i.mtime<=C).toSorted((i,m)=>m.mtime-i.mtime).slice(e),R=[...d,...G];if(R.length===0)return;await Promise.allSettled(R.map(i=>ie(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 le from"os";import u from"path";var de=".local",ce=".ripplo";function h(e){return u.join(e,".ripplo",de)}function ue(e){let r=h(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 ge(e,r){return u.join(h(e),r)}function S(){return u.join(le.homedir(),ce)}function P(){let e=S();return a.existsSync(e)?a.chmodSync(e,448):a.mkdirSync(e,{mode:448,recursive:!0}),e}function x(e){return u.join(S(),e)}import{Agent as me,RetryAgent as pe,setGlobalDispatcher as fe}from"undici";var ye=1500,we=4e3,Re=3,ve=50,he=100,D=!1;function Se(){if(D)return;D=!0;let e=new me({connections:he,keepAliveMaxTimeout:we,keepAliveTimeout:ye}),r=new pe(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:Re,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:ve});fe(r)}import{graphql as g}from"gql.tada";var Xe=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 ze=g(`
|
|
20
|
+
mutation StartAgentReviewWorker($reviewId: String!) {
|
|
21
|
+
startAgentReview(reviewId: $reviewId)
|
|
22
|
+
}
|
|
23
|
+
`);var Ye=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 Ze=g(`
|
|
40
|
+
mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
|
|
41
|
+
updateAgentReviewProgress(reviewId: $reviewId, text: $text)
|
|
42
|
+
}
|
|
43
|
+
`);var er=g(`
|
|
44
|
+
mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
|
|
45
|
+
failAgentReview(reviewId: $reviewId, reason: $reason)
|
|
46
|
+
}
|
|
47
|
+
`);import l from"fs";import _ from"path";function Pe(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 xe({serverUrl:e,token:r}){P();let t=w(e);l.mkdirSync(_.dirname(t),{mode:448,recursive:!0}),l.writeFileSync(t,r+`
|
|
48
|
+
`,{mode:384})}function be(e){let r=w(e);return l.existsSync(r)?(l.unlinkSync(r),!0):!1}function w(e){return x(_.join("tokens",Ae(e)))}function Ae(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var q=O(U(),1);import $ from"crypto";function Ee({body:e,secret:r}){let t=new q.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 Te(){return`whsec_${$.randomBytes(24).toString("base64")}`}export{L as a,B as b,f as c,c as d,K as e,T as f,y as g,ae as h,ue as i,ge as j,Pe as k,xe as l,be as m,w as n,Se as o,Ee as p,Te as q};
|