ripplo 0.8.1 → 0.8.2
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-NWWET7CM.js → chunk-2MT2MZJW.js} +1 -1
- package/dist/{chunk-GD2AESFG.js → chunk-4FKGHWCC.js} +1 -1
- package/dist/{chunk-HGL5SE75.js → chunk-4W6WIT7T.js} +1 -1
- package/dist/{chunk-OAXYJKXD.js → chunk-5SM4TCSW.js} +2 -2
- package/dist/{chunk-TPTG6RR4.js → chunk-7TYUZIUO.js} +1 -1
- package/dist/{chunk-WK7VO5JE.js → chunk-A7SHHSB3.js} +1 -1
- package/dist/{chunk-KSNZWWHX.js → chunk-AQ3DMGAY.js} +1 -1
- package/dist/{chunk-7YPITJA2.js → chunk-AVBP7Q2M.js} +1 -1
- package/dist/chunk-CRELTIU2.js +242 -0
- package/dist/{chunk-WOHPPHUD.js → chunk-DBIXYJRB.js} +1 -1
- package/dist/{chunk-FCEWYZLQ.js → chunk-EGETJKAQ.js} +1 -1
- package/dist/chunk-EK6TENV6.js +4 -0
- package/dist/{chunk-ZH3HY7BS.js → chunk-ESOXRGIY.js} +1 -1
- package/dist/{chunk-4AGLYPJ5.js → chunk-I2M24U3N.js} +2 -2
- package/dist/{chunk-PBL3TBB7.js → chunk-I5BHCICM.js} +1 -1
- package/dist/chunk-KOKEEAEF.js +6 -0
- package/dist/{chunk-CLFA4JSB.js → chunk-L7GWKDGD.js} +1 -1
- package/dist/{chunk-42LZFMNX.js → chunk-LEFXRK53.js} +1 -1
- package/dist/{chunk-VYQ5CDRX.js → chunk-LKYTQXPR.js} +1 -1
- package/dist/{chunk-EXV2RD7Z.js → chunk-M7VQD4VO.js} +1 -1
- package/dist/{chunk-G22LPS47.js → chunk-N2B5GZPU.js} +1 -1
- package/dist/{chunk-FZIMQTFG.js → chunk-OY6HNCAZ.js} +1 -1
- package/dist/chunk-PE5WVWI5.js +48 -0
- package/dist/{chunk-TEP6ETHQ.js → chunk-PXZV5X3C.js} +1 -1
- package/dist/{chunk-U4LC56T3.js → chunk-SWOTFHBR.js} +1 -1
- package/dist/{chunk-XGMM2RKR.js → chunk-T5VLZ43M.js} +1 -1
- package/dist/{chunk-4DXOF4WS.js → chunk-UVYCSHOJ.js} +1 -1
- package/dist/chunk-WHSQBXWO.js +7 -0
- package/dist/{chunk-VETETUHZ.js → chunk-XBD3OTIW.js} +1 -1
- package/dist/{chunk-3SCOYB4C.js → chunk-XWUIRXMS.js} +1 -1
- package/dist/{cli-error-J7LD2VWZ.js → cli-error-SLG6JHK2.js} +1 -1
- package/dist/compile-write-7AV66JUA.js +4 -0
- package/dist/daemon-BN42ZNCJ.js +139 -0
- package/dist/{daemon-JJ6MZPIA.js → daemon-LFFCR3TB.js} +1 -1
- package/dist/{daemon-lock-FLZHWM2F.js → daemon-lock-LTQMLU4Q.js} +1 -1
- package/dist/{dsl-loader-IOQUYVQH.js → dsl-loader-H25XGSHJ.js} +1 -1
- package/dist/{exit-plan-gate-TTJ7U2AP.js → exit-plan-gate-BNAUL4FC.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +150 -150
- package/dist/{plan-reminder-Q4A5WM2G.js → plan-reminder-VMBDQTAP.js} +1 -1
- package/dist/post-edit-2VFE6QND.js +4 -0
- package/dist/post-edit-analyze-VETPP5Z4.js +4 -0
- package/dist/post-edit-flag-stubs-J3MCGLXI.js +4 -0
- package/dist/{pre-bash-run-gate-C73XUNRE.js → pre-bash-run-gate-PWLARIYK.js} +1 -1
- package/dist/pre-edit-Q4U5LSWG.js +4 -0
- package/dist/{pre-edit-ripplo-skill-gate-63HGCUPG.js → pre-edit-ripplo-skill-gate-JD4BDCA3.js} +1 -1
- package/dist/{pre-edit-scope-gate-WIORRC2B.js → pre-edit-scope-gate-NZO4HVGT.js} +1 -1
- package/dist/{pre-edit-watch-gate-3VSMTCE4.js → pre-edit-watch-gate-EUZGEH2J.js} +1 -1
- package/dist/prompt-submit-MPRVCWOI.js +4 -0
- package/dist/scope-reminder-CBY4I5SG.js +4 -0
- package/dist/{session-preamble-HNQKBR27.js → session-preamble-RJ4WNGJN.js} +1 -1
- package/dist/solve-worker.js +1 -1
- package/dist/status-UBUNHH5O.js +4 -0
- package/dist/{stop-enforce-I27VU4IR.js → stop-enforce-UXBQRTFP.js} +1 -1
- package/dist/{tasks-reminder-A4AIFNQJ.js → tasks-reminder-LKSUZUFD.js} +1 -1
- package/dist/{track-skill-load-3IPC45UX.js → track-skill-load-CJ74GD3Q.js} +1 -1
- package/package.json +3 -3
- package/dist/chunk-G7ZQUZ2X.js +0 -242
- package/dist/chunk-HYHAOKYP.js +0 -7
- package/dist/chunk-IW2P4NKR.js +0 -4
- package/dist/chunk-LB2L72ZU.js +0 -48
- package/dist/chunk-S7GMY5LS.js +0 -6
- package/dist/compile-write-OKTXD7JL.js +0 -4
- package/dist/daemon-O2VR45XP.js +0 -139
- package/dist/post-edit-PMSJ6CLE.js +0 -4
- package/dist/post-edit-analyze-2AJVDFTK.js +0 -4
- package/dist/post-edit-flag-stubs-ORFV452V.js +0 -4
- package/dist/pre-edit-H6ZOQSXF.js +0 -4
- package/dist/prompt-submit-PSXSUTY3.js +0 -4
- package/dist/scope-reminder-TGDQCKLN.js +0 -4
- package/dist/status-QBBCVTXV.js +0 -4
package/dist/chunk-LB2L72ZU.js
DELETED
|
@@ -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 P}from"./chunk-CJUKILIO.js";import{a as M}from"./chunk-NNH3YVVO.js";import{b as q}from"./chunk-KMZ3L5YA.js";var O=15e3,G=3,U=300,p=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 N(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 F({init:{body:n,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json",...P()},method:"POST"},serverUrl:e.config.ripploServerUrl,url:o}),a=await V({res:d,url:o});if(!W(a))throw new Error("Invalid GraphQL response");if(B(a))throw new c(a.errors);if(a.data==null)throw new Error("No data returned from server");return a.data}async function F({init:e,serverUrl:r,url:t}){let n=1,o=await E({init:e,url:t});for(;o.retryable&&n<G;)await j(L(n)),n+=1,o=await E({init:e,url:t});if(o.response!=null)return o.response;throw new p({detail:o.detail,serverUrl:r})}async function E({init:e,url:r}){try{let t=await fetch(r,{...e,signal:AbortSignal.timeout(O)});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 L(e){return U*3**(e-1)*(.5+Math.random())}function j(e){return new Promise(r=>{setTimeout(r,e)})}async function V({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 W(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function B(e){return Array.isArray(e.errors)&&e.errors.length>0}import H from"pino";import J from"pino-pretty";var f=H({level:process.env.LOG_LEVEL??"info"},J({ignore:"pid,hostname"}));import{readdir as Q,rm as K,stat as X}from"fs/promises";import T from"path";var x=T.join(process.cwd(),".ripplo","debug"),A=360*60*1e3;async function z({maxRuns:e}){try{let t=(await Q(x,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let g=T.join(x,i.name),$=await X(g);return{dirPath:g,mtime:$.mtimeMs}})),d=o.filter(i=>n-i.mtime>A),D=o.filter(i=>n-i.mtime<=A).toSorted((i,g)=>g.mtime-i.mtime).slice(e),w=[...d,...D];if(w.length===0)return;await Promise.allSettled(w.map(i=>K(i.dirPath,{force:!0,recursive:!0}))),f.debug("Pruned %d old debug run(s)",w.length)}catch{f.warn("Debug run pruning failed, ignoring")}}import s from"fs";import Y from"os";import m from"path";var Z=".local",ee=".ripplo";function v(e){return m.join(e,".ripplo",Z)}function re(e){let r=v(e);s.existsSync(r)||s.mkdirSync(r,{recursive:!0});let t=m.join(r,".gitignore");return s.existsSync(t)||s.writeFileSync(t,`*
|
|
5
|
-
`),r}function te(e,r){return m.join(v(e),r)}function R(){return m.join(Y.homedir(),ee)}function h(){let e=R();return s.existsSync(e)?s.chmodSync(e,448):s.mkdirSync(e,{mode:448,recursive:!0}),e}function S(e){return m.join(R(),e)}import{Agent as ne,RetryAgent as oe,setGlobalDispatcher as ie}from"undici";var ae=1500,se=4e3,le=3,de=50,ce=100,k=!1;function me(){if(k)return;k=!0;let e=new ne({connections:ce,keepAliveMaxTimeout:se,keepAliveTimeout:ae}),r=new oe(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:le,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:de});ie(r)}import{graphql as u}from"gql.tada";var Me=u(`
|
|
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 Oe=u(`
|
|
20
|
-
mutation StartAgentReviewWorker($reviewId: String!) {
|
|
21
|
-
startAgentReview(reviewId: $reviewId)
|
|
22
|
-
}
|
|
23
|
-
`);var Ge=u(`
|
|
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 Ue=u(`
|
|
40
|
-
mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
|
|
41
|
-
updateAgentReviewProgress(reviewId: $reviewId, text: $text)
|
|
42
|
-
}
|
|
43
|
-
`);var Ne=u(`
|
|
44
|
-
mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
|
|
45
|
-
failAgentReview(reviewId: $reviewId, reason: $reason)
|
|
46
|
-
}
|
|
47
|
-
`);import l from"fs";import C from"path";function ue(e){let r=process.env.RIPPLO_TOKEN;if(r!=null&&r.trim().length>0)return r.trim();let t=y(e);if(!l.existsSync(t))return null;let n=l.readFileSync(t,"utf8").trim();return n.length===0?null:n}function ge({serverUrl:e,token:r}){h();let t=y(e);l.mkdirSync(C.dirname(t),{mode:448,recursive:!0}),l.writeFileSync(t,r+`
|
|
48
|
-
`,{mode:384})}function pe(e){let r=y(e);return l.existsSync(r)?(l.unlinkSync(r),!0):!1}function y(e){return S(C.join("tokens",fe(e)))}function fe(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var _=q(M(),1);import I from"crypto";function ye({body:e,secret:r}){let t=new _.Webhook(r),n=`msg_${I.randomUUID()}`,o=new Date,d=t.sign(n,o,e),a=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":d,"webhook-timestamp":String(a)}}function we(){return`whsec_${I.randomBytes(24).toString("base64")}`}export{p as a,c as b,N as c,b as d,f as e,z as f,re as g,te as h,ue as i,ge as j,pe as k,y as l,me as m,ye as n,we as o};
|
package/dist/chunk-S7GMY5LS.js
DELETED
|
@@ -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
|
-
async function H(n,o){try{let t=o.trim()===""?{}:JSON.parse(o),i=await n.run(t);return{kind:"output",stdout:i==null?void 0:JSON.stringify(i)}}catch(t){return{error:t,kind:"crash"}}}function f({event:n,handlers:o,note:t}){return s(n,async i=>{let r=(await Promise.all(o.map(async e=>e(i)))).filter(e=>e!=null),a=r.find(e=>d(e));if(a!=null)return a;let c=r.flatMap(e=>{let u=e.hookSpecificOutput,p=u!=null&&"additionalContext"in u?u.additionalContext:null;return p==null?[]:[p]});if(c.length!==0)return t(c.join(`
|
|
5
|
-
|
|
6
|
-
`))})}function s(n,o){return{event:n,run:async t=>{if(!k(n,t))throw new Error(`hook input is not a ${n} payload`);return await o(t)??void 0}}}function k(n,o){return typeof o=="object"&&o!==null&&"hook_event_name"in o&&o.hook_event_name===n}function d(n){if(n.decision==="block")return!0;let o=n.hookSpecificOutput;return o!=null&&"permissionDecision"in o&&o.permissionDecision==="deny"}export{H as a,f as b,s as c};
|
|
@@ -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{e as a,f as b,g as c,h as d}from"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as compileAndWrite,c as stampedLockfile,d as stubbedWorkflows,b as writeStampedLockfile};
|
package/dist/daemon-O2VR45XP.js
DELETED
|
@@ -1,139 +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 Ne,B as je,C as T,E as Be,F as Ke,G as Ge,I as ze,J as Je,K as F,e as ge,g as ve,j as be,k as Ie,l as Ce,m as Te,n as Le,o as We,p as Ae,q as De,s as He,t as b,u as I,v as qe,w as $,x as $e,y as Fe,z as Oe}from"./chunk-G7ZQUZ2X.js";import{d as we}from"./chunk-FZIMQTFG.js";import{a as Ue,c as Me,d as _e,e as C}from"./chunk-4DXOF4WS.js";import{c as h}from"./chunk-42LZFMNX.js";import{e as Se}from"./chunk-HGL5SE75.js";import{a as ne}from"./chunk-R4ZTRVDQ.js";import{c as Z}from"./chunk-FEHVIHVA.js";import{b as ie}from"./chunk-NWWET7CM.js";import{a as _}from"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import{g as E}from"./chunk-IW2P4NKR.js";import{f as R,g as te,h as M}from"./chunk-KSNZWWHX.js";import{e as me,f as ye}from"./chunk-WOHPPHUD.js";import{c as Y,d as y,e as s,f as U,g as X}from"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import{b as he,c as ke,d as xe,e as Pe,f as Re,h as Ee}from"./chunk-EXV2RD7Z.js";import{M as le,O as de,P as ce,Q as ue,R as pe,S as fe,d as ae,h as se}from"./chunk-ZH3HY7BS.js";import{A as ee,H as re,N as oe}from"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import Pn from"path";import{createClient as Rn}from"graphql-sse";import En,{AbortError as bn}from"p-retry";import{graphql as V}from"gql.tada";import{graphql as Gr}from"gql.tada";import{print as zr}from"graphql";async function Qe({config:e,cwd:r,headed:o,pool:n,runId:t,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let c=await R(r);if(c.isErr())return await T(e,t,`lockfile:${c.error.kind}`),{kind:"dispatch-error",reason:{detail:`lockfile:${c.error.kind}`,type:"generic"}};let p=Kr(c.value,{testSlug:a,workflowSlug:d});if(p==null)return await T(e,t,`no-test:${d}/${a}`),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let u=await b({headed:o,workClass:l,task:()=>n.execute({headed:o,runId:t,testRef:p},i)});return!u.serverNotified&&u.outcome.kind==="error"&&await T(e,t,u.outcome.detail),u.outcome}function Kr(e,{testSlug:r,workflowSlug:o}){let t=e.workflows.find(i=>oe(i.name)===o)?.tests.find(i=>i.slug===r);return t==null?void 0:ae(t)}var Jr=6e4,Qr=Gr(`
|
|
5
|
-
subscription RunRequestedWatch($devSessionId: String!) {
|
|
6
|
-
runRequested(devSessionId: $devSessionId) {
|
|
7
|
-
runId
|
|
8
|
-
testSlug
|
|
9
|
-
workflowId
|
|
10
|
-
workflowSlug
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`);async function Ve(e){let r=Math.min(1e3*2**e,Jr)+Xr();await new Promise(o=>setTimeout(o,r))}function Ye({claim:e,cwd:r,devSessionId:o,onSubscriptionDead:n,pool:t,sseClient:i,sseHealth:a}){let l=new Set;return i.subscribe({query:zr(Qr),variables:{devSessionId:o}},{complete:()=>{},error:d=>{let c=d instanceof Error?d.message:String(d);s.warn("runRequested SSE failed: %s; re-registering session",c),n(c)},next:d=>{Vr({claim:e,cwd:r,event:d.data?.runRequested,inFlightRunIds:l,pool:t})}},{connected:()=>{a.onConnected()},connecting:d=>{a.onConnecting(d),d&&s.debug("runRequested SSE reconnecting")}})}function Vr({claim:e,cwd:r,event:o,inFlightRunIds:n,pool:t}){if(o==null)return;if(n.has(o.runId)){s.warn({runId:o.runId,workflowSlug:o.workflowSlug},"duplicate runRequested event; skipping dispatch");return}n.add(o.runId),process.stdout.write(`ripplo: run ${o.workflowSlug}
|
|
14
|
-
`),Z(r);let i=h(r).match(l=>l,l=>{s.error({failure:l,runId:o.runId},"failed to load env for run dispatch; skipping")});if(i==null){n.delete(o.runId);return}let a=Yr(e(o.runId),o);a.started(),Qe({config:i,cwd:r,headed:a.headed,pool:t,runId:o.runId,signal:a.signal,testSlug:o.testSlug,workClass:a.workClass,workflowSlug:o.workflowSlug}).then(l=>{a.finished(l)}).catch(l=>{s.error({err:l,runId:o.runId,workflowSlug:o.workflowSlug},"run execution failed; daemon continuing"),a.finished({detail:l instanceof Error?l.message:String(l),kind:"error"})}).finally(()=>{n.delete(o.runId)})}function Yr(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:Fe(e.token),workClass:"p1-cli",finished:o=>{e.finished(r.runId,o)},started:()=>{e.started(r.runId)}}}function Xr(){return Math.floor(Math.random()*2700)+300}import{graphql as O}from"gql.tada";import{print as Zr}from"graphql";var eo=O(`
|
|
15
|
-
subscription TeleportRequestedWatch($devSessionId: String!) {
|
|
16
|
-
teleportRequested(devSessionId: $devSessionId) {
|
|
17
|
-
runId
|
|
18
|
-
stepIndex
|
|
19
|
-
kind
|
|
20
|
-
testSlug
|
|
21
|
-
workflowSlug
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`),ro=O(`
|
|
25
|
-
query TeleportRunRepro($id: String!) {
|
|
26
|
-
run(id: $id) {
|
|
27
|
-
id
|
|
28
|
-
reproJson
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`),oo=O(`
|
|
32
|
-
mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
|
|
33
|
-
reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
|
|
34
|
-
}
|
|
35
|
-
`);function Xe({cwd:e,devSessionId:r,onSubscriptionDead:o,sseClient:n}){let t=new Set,i=n.subscribe({query:Zr(eo),variables:{devSessionId:r}},{complete:()=>{},error:a=>{let l=a instanceof Error?a.message:String(a);s.warn("teleportRequested SSE failed: %s; re-registering session",l),o(l)},next:a=>{no({cwd:e,devSessionId:r,event:a.data?.teleportRequested,running:t})}});return()=>{t.forEach(a=>{a.abort()}),t.clear(),i()}}function no({cwd:e,devSessionId:r,event:o,running:n}){if(o==null)return;let t=new AbortController;n.add(t),to({cwd:e,devSessionId:r,event:o,signal:t.signal}).catch(i=>{s.error({err:i},"teleport failed; daemon continuing")}).finally(()=>{n.delete(t)})}async function to({cwd:e,devSessionId:r,event:o,signal:n}){let t=d=>io({cwd:e,devSessionId:r,runId:o.runId,status:d}),i=await ao(e,o);if(i==null){s.warn({runId:o.runId},"teleport could not resolve target"),await t("unplannable");return}process.stdout.write(`ripplo: teleport ${lo(o)} step ${String(o.stepIndex+1)}
|
|
36
|
-
`);let l=await ze({cwd:e,onReady:()=>{t("opened")},signal:n,step:o.stepIndex+1,target:i});l.kind==="done"&&l.result.kind==="handed-over"||(s.warn({kind:l.kind,runId:o.runId},"teleport could not open"),await t(l.kind==="unplannable"?"unplannable":"error"))}async function io({cwd:e,devSessionId:r,runId:o,status:n}){let t=h(e).match(i=>i,()=>null);t!=null&&await y({config:t,document:oo,variables:{devSessionId:r,runId:o,status:n}}).catch(()=>null)}async function ao(e,r){if(r.kind==="explore"){let o=await so(e,r.runId);return o==null?null:{kind:"explore",repro:o}}return r.testSlug==null||r.workflowSlug==null?null:{kind:"test",ref:`${r.workflowSlug}/${r.testSlug}`}}async function so(e,r){let o=h(e).match(t=>t,()=>null);if(o==null)return null;let n=await y({config:o,document:ro,variables:{id:r}}).catch(()=>null);return n?.run?.reproJson==null?null:de.parse(JSON.parse(n.run.reproJson))}function lo(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function Ze(){let e=!0,r,o=null,n=()=>{o!=null&&(clearTimeout(o),o=null)};return{markUnhealthy:t=>{e=!1,r=t,n()},onConnected:()=>{n(),o=setTimeout(()=>{e=!0,r=void 0,o=null},1e4)},onConnecting:()=>{n()},snapshot:()=>({detail:r,ok:e})}}import co from"fs";import nr from"net";import{err as tr,ok as uo}from"neverthrow";async function ir({cwd:e,onConnection:r}){X(e);let o=we(e),n=await er({onConnection:r,socketPath:o});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(rr(o)).mapErr(or(o)):await po(o)?tr({kind:"already-running",socketPath:o}):(ar(o),(await er({onConnection:r,socketPath:o})).map(rr(o)).mapErr(or(o)))}function po(e){return new Promise(r=>{let o=nr.connect(e);o.once("connect",()=>{o.destroy(),r(!0)}),o.once("error",()=>{r(!1)})})}async function er(e){let r=await fo(e);return r.kind==="listening"?uo(r.server):tr(r.error)}function fo({onConnection:e,socketPath:r}){return new Promise(o=>{let n=nr.createServer(e);n.once("error",t=>{o({error:t.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:t.message},kind:"failed"})}),n.listen(r,()=>{o({kind:"listening",server:n})})})}function rr(e){return r=>({socketPath:e,close:()=>{r.close(),ar(e)}})}function ar(e){co.rmSync(e,{force:!0})}function or(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as mo,randomUUID as yo}from"crypto";function lr(e){let r={attempts:0,consecutiveErrors:0,driverBackoffUntil:0,findings:0,lastUnhealthyReportMs:0,lockfile:null,prepared:null,preparing:!1,refreshing:!1,windowAttempts:0,windowFindings:0,windowStartMs:Date.now()},o=N(e,r);return{priority:"p3",next:()=>xo(e,r),onResult:()=>{},ready:()=>o,status:()=>({attempts:r.attempts,findings:r.findings}),stop:()=>Promise.resolve()}}var go=10;async function N(e,r){if(!r.preparing){r.preparing=!0;try{let o=await e.loadLockfile(),n=o==null?null:await So(o);if(n==null||o==null)return;r.lockfile=o.lockfile,r.prepared=n,j(r),e.notifyWork()}finally{r.preparing=!1}}}async function So({lockfile:e,rawHash:r}){let o=await ue(e);return o==null?null:{exploration:o,lockfileHashValue:r,strategy:le("even")}}var wo=6,vo=3e4,ho=2e4;function j(e){e.consecutiveErrors=0,e.driverBackoffUntil=0,e.lastUnhealthyReportMs=0}async function ko(e,r){if(!(r.refreshing||r.preparing||r.prepared==null)){r.refreshing=!0;try{let o=await e.loadLockfile();if(o==null||o.rawHash===r.prepared.lockfileHashValue)return;s.info("workflow definitions changed, re-preparing exploration"),r.prepared=null,await N(e,r)}finally{r.refreshing=!1}}}function xo(e,r){ko(e,r);let o=r.prepared;if(o==null||Date.now()<r.driverBackoffUntil)return null;let n=pe({lockfileHash:o.lockfileHashValue,prepared:o.exploration,random:Po,strategy:{...o.strategy,maxAttemptLength:e.maxTrailLength()}});if(n==null)return null;let t=n.baseStateTest.name;return{id:`explore:${yo()}`,label:t,run:i=>Ro({assign:n,params:e,signal:i,state:r})}}var sr=2**31;function Po(){return mo(sr)/sr}async function Ro({assign:e,params:r,signal:o,state:n}){if(!await r.probeApp()){dr({params:r,reason:"app-unreachable",state:n});return}let t=await r.executeTrail(e,o);if(t.kind==="aborted")return;if(t.kind==="error"){bo({params:r,reason:t.reason,state:n});return}j(n),n.attempts+=1,n.windowAttempts+=1;let i=t.kind==="finding";i&&(n.findings+=1,n.windowFindings+=1,s.info("exploration finding recorded")),r.reportProgress({attempts:1,findings:i?1:0,result:t}),n.windowAttempts>=go&&Eo(n)}function Eo(e){let r=Date.now()-e.windowStartMs;s.info({attempts:e.windowAttempts,avgTrailMs:Math.round(r/e.windowAttempts),findings:e.windowFindings,windowMs:r,yield:Number((e.windowFindings/e.windowAttempts).toFixed(3))},"explore window"),e.windowAttempts=0,e.windowFindings=0,e.windowStartMs=Date.now()}function bo({params:e,reason:r,state:o}){if(r?.startsWith("lockfile:daemon-load-failed")===!0){Io(e,o);return}dr({params:e,reason:r,state:o})}function Io(e,r){r.preparing||(r.prepared=null,N(e,r))}function dr({params:e,reason:r,state:o}){let n=To(r);if(n==="trail"){j(o);return}o.consecutiveErrors+=1,s.debug("exploration infra error: %s",r),!(o.consecutiveErrors<wo)&&(n==="driver"&&(o.driverBackoffUntil=Date.now()+vo),Co({params:e,reason:r,state:o}))}function Co({params:e,reason:r,state:o}){let n=Date.now();n-o.lastUnhealthyReportMs<ho||(o.lastUnhealthyReportMs=n,s.warn("exploration unhealthy after %d consecutive infra errors (last: %s)",o.consecutiveErrors,r),e.reportUnhealthy())}function To(e){return e==="app-unreachable"?"driver":e==null||e==="error"||e.startsWith("transport:")?"infra":e.startsWith("runtime:")?Lo(e.slice(8)):"trail"}function Lo(e){return e==="driver-launch"?"driver":se(e)?"infra":"trail"}function B(e){return{priority:e,next:()=>null,onResult:()=>{}}}function cr({config:e,executorIsLocal:r,pool:o}){return Do({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:r,executeTrail:async(n,t)=>(await o).exploreTrail(n,t)})}function Do({appUrl:e,cwd:r,executeTrail:o,executorIsLocal:n}){let t={concurrency:2,enabled:!1,maxTrailLength:12},i={notify:()=>{}},a={report:p=>{}},l={report:()=>{}},d=Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:()=>t.maxTrailLength,notifyWork:()=>{i.notify()},reportProgress:p=>{a.report(p)},reportUnhealthy:()=>{l.report()}}),c=ve({now:Date.now,probe:Uo,setTimer:Mo,sources:[B("p0"),B("p1"),d],execute:({job:p,priority:u,signal:f})=>b({headed:!1,workClass:_o(u),task:()=>p.run(f)}),exploreConcurrency:()=>t.concurrency,exploreEnabled:()=>t.enabled&&n()});return $(()=>{c.notifyQueueChange()}),i.notify=()=>{c.notifyQueueChange()},{notifyExecutorChanged:()=>{c.notifyQueueChange()},progress:()=>d.status(),setConcurrency:p=>{n()&&p!==t.concurrency&&s.info({workers:p},"explore local worker count changed"),t.concurrency=p,c.notifyQueueChange()},setEnabled:p=>{t.enabled=p,c.notifyQueueChange()},setMaxTrailLength:p=>{t.maxTrailLength=p},setReportProgress:p=>{a.report=p},setReportUnhealthy:p=>{l.report=p},status:()=>({explorer:qo(t.enabled,c.stalled()),exploring:c.explorationActive(),progress:d.status()}),stop:()=>{c.stop(),$(null),d.stop()}}}function Ho({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a}){return lr({cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a,loadLockfile:async()=>{let{fingerprint:l,result:d}=await te(r),c=await C(r);return c==null?null:d.match(async p=>({fingerprint:l,lockfile:await E(r,p),rawHash:c}),()=>Promise.resolve(null))},probeApp:async()=>await ge(e)==null})}function qo(e,r){return e?r>0?"stalled":"on":"off"}function Uo(){let e=qe();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function Mo(e,r){let o=setTimeout(e,r);return()=>{clearTimeout(o)}}function _o(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}import{graphql as en}from"gql.tada";import{connect as Fo}from"net";import Oo from"ssh2";import{WebSocket as pr,createWebSocketStream as No}from"ws";var $o="ripplo-";function K(e){return Object.entries(e).map(([r,o])=>`${$o}${r}.${o}`)}var{Server:jo,utils:ur}=Oo;function fr(){let e=ur.generateKeyPairSync("ed25519"),r=ur.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function mr(e){return new Promise((r,o)=>{let n={closers:new Set,stopped:!1},t=new pr(e.relayUrl,K({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:Bo(t,n)})}),t.on("message",i=>{Ko(e,n,i)}),t.on("close",(i,a)=>{n.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),Zo(e,n)}),t.on("error",i=>{o(i instanceof Error?i:new Error(String(i)))})})}function Bo(e,r){return()=>(r.stopped=!0,r.closers.forEach(o=>{o()}),e.close(),Promise.resolve())}function Ko(e,r,o){let n=Go(o);n!=null&&Jo(e,r,n.pipeId)}function Go(e){try{let r=JSON.parse(zo(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 zo(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function Jo(e,r,o){if(r.stopped)return;let n=new pr(e.relayUrl,K({pipeId:o,role:"daemon-data"}));n.on("open",()=>{Qo(e,r,n)}),n.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function Qo(e,r,o){let n=No(o);n.on("error",()=>{});let t=new jo({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{Yo(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,c)=>{Xo({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:c.destPort})})})}),i=()=>{o.close()};r.closers.add(i),o.on("close",()=>r.closers.delete(i)),Vo(t,n)}function Vo(e,r){e.injectSocket(r)}function Yo(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function Xo({accept:e,allowedPorts:r,deny:o,destPort:n}){if(!r.includes(n)){o();return}let t=!1,i=Fo({autoSelectFamily:!0,host:"localhost",port:n},()=>{t=!0;let a=e();a.on("error",()=>{}),i.pipe(a).pipe(i)});i.on("error",()=>{t||o()})}function Zo(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(o=>{o()}),e.onFatal())}var rn=en(`
|
|
37
|
-
mutation EnterCloudMode(
|
|
38
|
-
$devSessionId: String!
|
|
39
|
-
$localUrl: String!
|
|
40
|
-
$engineUrl: String!
|
|
41
|
-
$hostKeyFingerprint: String!
|
|
42
|
-
) {
|
|
43
|
-
enterCloudMode(
|
|
44
|
-
devSessionId: $devSessionId
|
|
45
|
-
localUrl: $localUrl
|
|
46
|
-
engineUrl: $engineUrl
|
|
47
|
-
hostKeyFingerprint: $hostKeyFingerprint
|
|
48
|
-
) {
|
|
49
|
-
__typename
|
|
50
|
-
... on RelaySession {
|
|
51
|
-
generation
|
|
52
|
-
grant
|
|
53
|
-
relayUrl
|
|
54
|
-
secret
|
|
55
|
-
session
|
|
56
|
-
}
|
|
57
|
-
... on DevSessionEndedError {
|
|
58
|
-
message
|
|
59
|
-
}
|
|
60
|
-
... on TunnelNotConfiguredError {
|
|
61
|
-
message
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`),L=class extends Error{failure;constructor(r){super(r.kind),this.failure=r}};async function G({config:e,devSessionId:r,onFatal:o}){let n=fr(),i=(await y({config:e,document:rn,variables:{devSessionId:r,engineUrl:e.engineUrl,hostKeyFingerprint:n.fingerprint,localUrl:e.appUrl}})).enterCloudMode;if(i==null)throw new L({kind:"empty-response"});if(i.__typename!=="RelaySession")throw new L({kind:"server-error",typename:i.__typename});let a=await mr({allowedPorts:[...new Set([yr(e.appUrl),yr(e.engineUrl)])],grant:i.grant,hostKey:n,onFatal:o,relayUrl:i.relayUrl,secret:i.secret});return s.info({session:i.session},"cloud-executor relay up"),{stop:a.stop}}function yr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var on=[1e3,3e3,8e3,15e3];function gr({config:e,onChanged:r}){let o={devSessionId:null,mode:"local",queue:Promise.resolve(),tunnel:void 0},n=()=>{o.tunnel=void 0,i(0)},t=()=>o.mode==="cloud",i=async u=>{let f=o.devSessionId;if(!t()||f==null)return;let m=on[u];if(m==null){s.warn("tunnel connector gave up; reverting executor to local"),p("local"),F(e,"local");return}if(s.warn({attempt:u+1},"relay tunnel dropped; reconnecting"),await new Promise(w=>setTimeout(w,m)),!(!t()||o.tunnel!=null))try{let w=await G({config:e,devSessionId:f,onFatal:n});if(!t()){await w.stop();return}o.tunnel=w,s.info("relay tunnel reconnected")}catch{i(u+1)}},a=async u=>{let f=await G({config:e,devSessionId:u,onFatal:n});o.tunnel=f,o.mode="cloud",s.info("executor switched to cloud"),r()},l=async()=>{let u=o.tunnel;o.tunnel=void 0,o.mode="local",u!=null&&await u.stop(),s.info("executor switched to local"),r()},d=async u=>{let f=o.devSessionId;if(!(f==null||u===o.mode)){if(u==="cloud"){await a(f);return}await l()}},c=async u=>{s.warn({err:u},"executor switch failed; staying local"),await F(e,"local").catch(()=>{})},p=u=>{o.queue=o.queue.then(()=>d(u).catch(c))};return{request:p,connect:u=>{o.devSessionId=u},current:()=>o.mode,stop:async()=>{await o.queue.catch(()=>{}),await d("local")}}}import{readdir as nn}from"fs/promises";import{existsSync as Sr}from"fs";import z from"path";async function wr({config:e,cwd:r}){let o=z.join(r,".ripplo","debug");await(await nn(o,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!Sr(z.join(o,i,Ne))&&Sr(z.join(o,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>je({config:e,debugDir:o,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as tn}from"child_process";import vr from"os";import{CancellationTokenSource as hr,ResponseError as kr}from"vscode-jsonrpc/node";function xr(e,r){return()=>{let o=tn(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:De(o),kill:()=>{an(o)},onExit:n=>{o.once("exit",n)}}}}function Pr(e){let r={closed:!1,devSessionId:e.devSessionId,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return Ir(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(o=>J(o,r)))},execute:(o,n)=>dn(o,n,r),exploreTrail:(o,n)=>un(o,n,r),routeSpan:(o,n)=>{let t=r.workers.find(i=>i.runId===o);t?.worker.connection.sendNotification(We,{runId:o,span:n})},setSize:o=>{fn(o,r)}}}function an(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var sn=1e4,ln=1e4,Rr=-32800;async function dn(e,r,o){let n=await Er(o);if(n.runId=e.runId,!n.alive)return W(n,o),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let t=new hr,i=()=>{t.cancel()};r.aborted&&t.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await n.worker.connection.sendRequest(Ce,e,t.token),l=be.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return cn(a,n)}finally{r.removeEventListener("abort",i),t.dispose(),W(n,o)}}async function Er(e){let r=e.workers.find(o=>o.alive&&o.runId===void 0);if(r!=null)return r.runId="pending",await r.ready,r;if(e.workers.length<e.size){let o=br(e);return o.runId="pending",await o.ready,o}return new Promise(o=>{e.waiters.push(n=>{n.runId="pending",o(n)})})}function br(e){let r=e.spawn(),o={resolve:()=>{}},n={alive:!0,id:e.nextId,ready:new Promise(t=>{o.resolve=t,r.connection.onNotification(Ie,t)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest(Te,()=>e.lockfileProvider()),r.onExit(()=>{n.alive=!1,e.workers=e.workers.filter(t=>t!==n),r.connection.dispose(),o.resolve()}),e.workers.push(n),n}function W(e,r){if(e.runId=void 0,!e.alive||r.closed)return;if(r.workers.length>r.size){J(e,r);return}let o=r.waiters.shift();o?.(e)}async function J(e,r){if(r.workers=r.workers.filter(t=>t!==e),!e.alive)return;let o=new Promise(t=>{e.worker.onExit(t)});await e.ready,await e.worker.connection.sendNotification(Ae).catch(()=>{});let n=setTimeout(()=>{e.worker.kill()},sn);await o,clearTimeout(n)}function cn(e,r){return e instanceof kr&&e.code===Rr?{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 un(e,r,o){let n=await Er(o);if(n.runId="explore",!n.alive)return W(n,o),{kind:"error"};let t=new hr,i={cancel:()=>{}},a=()=>{t.cancel();let l=setTimeout(()=>{n.worker.kill()},ln);i.cancel=()=>{clearTimeout(l)}};r.aborted&&a(),r.addEventListener("abort",a,{once:!0});try{let l=await n.worker.connection.sendRequest(Le,{assign:e,devSessionId:o.devSessionId},t.token),d=ce.safeParse(l);return d.success?d.data:{kind:"error"}}catch(l){return pn(l)}finally{i.cancel(),r.removeEventListener("abort",a),t.dispose(),W(n,o)}}function pn(e){return e instanceof kr&&e.code===Rr?{kind:"aborted"}:{kind:"error",reason:`transport:${e instanceof Error?e.message.slice(0,120):"unknown"}`}}function fn(e,r){r.size=e,e>vr.availableParallelism()&&s.warn({cores:vr.availableParallelism(),size:e},"worker pool size exceeds available cores");let o=r.workers.filter(t=>t.alive&&t.runId===void 0),n=r.workers.length-e;o.slice(0,Math.max(0,n)).forEach(t=>{J(t,r)}),Ir(r)}function Ir(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{br(e)})}import A from"fs";import mn from"p-retry";import{graphql as x}from"gql.tada";import{print as D}from"graphql";var yn=x(`
|
|
66
|
-
query DaemonExploration($devSessionId: String!) {
|
|
67
|
-
exploration(devSessionId: $devSessionId) {
|
|
68
|
-
active
|
|
69
|
-
localWorkers
|
|
70
|
-
maxTrailLength
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`),gn=x(`
|
|
74
|
-
subscription WatchExplorationChanged($devSessionId: String!) {
|
|
75
|
-
explorationChanged(devSessionId: $devSessionId) {
|
|
76
|
-
exploration {
|
|
77
|
-
active
|
|
78
|
-
localWorkers
|
|
79
|
-
maxTrailLength
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`);function Cr({config:e,devSessionId:r,machinery:o,sseClient:n}){return mn(()=>Sn({config:e,devSessionId:r,machinery:o}),{factor:2,minTimeout:500,retries:6}).catch(t=>{s.warn({err:t},"initial exploration state read failed \u2014 explorer stays off")}),n.subscribe({query:D(gn),variables:{devSessionId:r}},{complete:()=>{},error:t=>{s.error(t,"exploration subscription error")},next:t=>{Tr(o,t.data?.explorationChanged.exploration)}})}async function Sn({config:e,devSessionId:r,machinery:o}){let n=await y({config:e,document:yn,variables:{devSessionId:r}});Tr(o,n.exploration)}function Tr(e,r){r!=null&&(e.setMaxTrailLength(r.maxTrailLength),e.setConcurrency(r.localWorkers),e.setEnabled(r.active))}function Lr({config:e,devSessionId:r,machinery:o}){o.setReportProgress(n=>{Ke({attempts:n.attempts,config:e,devSessionId:r,findings:n.findings,trail:Be(n.result)}).catch(t=>{s.warn({error:t},"exploration progress report failed")})}),o.setReportUnhealthy(()=>{Ge(e,r).catch(n=>{s.warn({error:n},"exploration unhealthy report failed")})})}var wn=x(`
|
|
84
|
-
subscription HooksPausedWatch($projectId: String!) {
|
|
85
|
-
hooksPausedRequested(projectId: $projectId) {
|
|
86
|
-
paused
|
|
87
|
-
projectId
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`),vn=x(`
|
|
91
|
-
subscription WatchLocalConcurrencyChanged {
|
|
92
|
-
myMaxLocalConcurrentRunsChanged
|
|
93
|
-
}
|
|
94
|
-
`);function Wr({pool:e,sseClient:r}){return r.subscribe({query:D(vn)},{complete:()=>{},error:o=>{s.error(o,"localConcurrency subscription error")},next:o=>{let n=o.data?.myMaxLocalConcurrentRunsChanged;n!=null&&(I(n),e.setSize(n))}})}var hn=x(`
|
|
95
|
-
subscription WatchExecutorChangeRequested($devSessionId: String!) {
|
|
96
|
-
executorChangeRequested(devSessionId: $devSessionId) {
|
|
97
|
-
executor
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
`);function Ar({config:e,devSessionId:r,sseClient:o,switcher:n}){return n.connect(r),kn({config:e,switcher:n}),xn({devSessionId:r,sseClient:o,switcher:n})}async function kn({config:e,switcher:r}){let o=await Je(e);if(o.isErr()){s.warn({error:o.error},"initial executor fetch failed, staying local");return}r.request(o.value)}function xn({devSessionId:e,sseClient:r,switcher:o}){return r.subscribe({query:D(hn),variables:{devSessionId:e}},{complete:()=>{},error:n=>{s.error(n,"executor subscription error")},next:n=>{let t=n.data?.executorChangeRequested?.executor;t!=null&&o.request(t)}})}function Dr({cwd:e,projectId:r,sseClient:o}){return o.subscribe({query:D(wn),variables:{projectId:r}},{complete:()=>{},error:n=>{s.error(n,"hooksPaused subscription error")},next:n=>{let t=n.data?.hooksPausedRequested?.paused;t!=null&&Q({cwd:e,paused:t})}})}function Q({cwd:e,paused:r}){let o=Se(e);if(r&&!A.existsSync(o)){A.writeFileSync(o,"");return}!r&&A.existsSync(o)&&A.unlinkSync(o)}var In=6e4,Hr=500,Cn=15e3,qr=6e4,Tn=3,Ln=V(`
|
|
101
|
-
mutation HeartbeatDevSessionWatch($id: String!) {
|
|
102
|
-
heartbeatDevSession(id: $id) {
|
|
103
|
-
__typename
|
|
104
|
-
... on DevSession {
|
|
105
|
-
id
|
|
106
|
-
}
|
|
107
|
-
... on DevSessionEndedError {
|
|
108
|
-
message
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
`),Wn=V(`
|
|
113
|
-
query WatchLocalConcurrency {
|
|
114
|
-
currentUser {
|
|
115
|
-
id
|
|
116
|
-
maxLocalConcurrentRuns
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
`),An=V(`
|
|
120
|
-
mutation EndDevSessionWatch($projectId: String!, $cwd: String!, $devSessionId: String) {
|
|
121
|
-
endDevSession(projectId: $projectId, cwd: $cwd, devSessionId: $devSessionId) {
|
|
122
|
-
__typename
|
|
123
|
-
... on DevSession {
|
|
124
|
-
id
|
|
125
|
-
}
|
|
126
|
-
... on NoActiveDevSessionError {
|
|
127
|
-
message
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`);async function ea(){Qn();let e=Kn(process.cwd()),r=e.cwd,o=Fn(r),{executorSwitch:n,exploration:t,poolGate:i}=Dn(e),a={handler:()=>{}},l=Nn(),d=Ze(),c=Oe({config:e,cwd:r,executor:n.current,explorationStatus:t.status,ready:l.promise,onShutdownRequest:()=>{a.handler()},sseHealth:()=>d.snapshot()}),p=await jn({cwd:r,ipc:c,releasePid:o}),u=await M(r);u.isErr()&&(process.stderr.write(`ripplo: ${_(u.error)}
|
|
132
|
-
`),process.exit(1));let f=u.value,m=await Ur(()=>_e({config:e,cwd:r,lockfile:f}),{config:e,label:"initial sync"}),w=await C(r);w!=null&&$e(w),He({config:e,cwd:r,lockfile:f});let P=await Yn(e);Q({cwd:r,paused:m.hooksPaused});let g=Ue(r);g!=null&&s.info("watching branch %s in %s",g,r);let S=Rn({headers:{Authorization:`Bearer ${e.token}`},retry:Ve,retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});wr({config:e,cwd:r}).catch(()=>{});let v=$n({cwd:r,devSessionId:m.devSessionId,initialConcurrency:P});i.provide(v);let H=await Hn({cwd:r,pool:v}),q=Mn({claim:c.claim,config:e,cwd:r,initialId:m.devSessionId,pool:v,sseClient:S,sseHealth:d}),Mr=Ar({config:e,devSessionId:m.devSessionId,sseClient:S,switcher:n}),_r=Dr({cwd:r,projectId:e.projectId,sseClient:S}),$r=Wr({pool:v,sseClient:S}),Fr=Cr({config:e,devSessionId:m.devSessionId,machinery:t,sseClient:S});Lr({config:e,devSessionId:m.devSessionId,machinery:t});let Or=Un({config:e,session:q}),Nr=Jn();l.resolve(),qn(m.devSessionId);let jr=async()=>{Or(),Nr(),t.stop(),p.close(),q.stop(),Mr(),_r(),$r(),Fr(),await v.close(),await n.stop(),await H.stop().catch(()=>{}),await Promise.race([y({config:e,document:An,variables:{cwd:e.cwd,devSessionId:q.getId(),projectId:e.projectId}}).catch(()=>{}),new Promise(Br=>setTimeout(Br,3e3))]),o()},k=()=>{jr().finally(()=>process.exit(0))};a.handler=k,process.on("SIGINT",k),process.on("SIGTERM",k),process.on("SIGHUP",k),process.on("SIGBREAK",k),await new Promise(()=>{})}function Dn(e){let r={handler:()=>{}},o=gr({config:e,onChanged:()=>{r.handler()}}),n=Bn(),t=cr({config:e,pool:n.pool,executorIsLocal:()=>o.current()==="local"});return r.handler=t.notifyExecutorChanged,{executorSwitch:o,exploration:t,poolGate:n}}function Hn({cwd:e,pool:r}){return fe({localDir:Pn.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:o=>{let n=o.attributes["ripplo.run"];n!=null&&r.routeSpan(n,o)}})}function qn(e){process.stdout.write(`${Pe({devSessionId:e,version:ne()})}
|
|
133
|
-
`)}function Un({config:e,session:r}){let o=async()=>{try{let t=await y({config:e,document:Ln,variables:{id:r.getId()}});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))}},n=setInterval(()=>{o()},Cn);return()=>{clearInterval(n)}}function Mn({claim:e,config:r,cwd:o,initialId:n,pool:t,sseClient:i,sseHealth:a}){let l=n,d=null,c=0,p=0,u=g=>{P(g)},f=()=>{let g=Ye({claim:e,cwd:o,devSessionId:l,onSubscriptionDead:u,pool:t,sseClient:i,sseHealth:a}),S=Xe({cwd:o,devSessionId:l,onSubscriptionDead:u,sseClient:i});return()=>{g(),S()}},m=f(),w=async g=>{let S=Date.now();c=S-p>qr*2?1:c+1,p=S,c>=Tn&&a.markUnhealthy(g),await _n(Math.min(1e3*2**(c-1),qr));let v=await M(o);if(v.isErr()){s.error("re-register: compile failed: %s",_(v.error));return}let H=await Ur(()=>Me({config:r,cwd:o,lockfile:v.value}),{config:r,label:"re-register sync"});m(),l=H.devSessionId,m=f(),s.info("re-registered dev session as %s",l)},P=g=>(d!=null||(d=w(g).finally(()=>{d=null})),d);return{getId:()=>l,reregister:()=>P("dev session ended server-side"),stop:()=>{m()}}}function _n(e){return new Promise(r=>setTimeout(r,e))}function $n({cwd:e,devSessionId:r,initialConcurrency:o}){return Pr({devSessionId:r,initialSize:o,spawn:xr(Xn(),e),lockfileProvider:async()=>{let n=await R(e);if(n.isErr())return{unavailable:`daemon-load-failed:${n.error.kind}`};let t=await E(e,n.value);return{lockfileJson:ee(re,t)}}})}function Fn(e){try{return ye({cwd:e,onCompromised:On})}catch(r){throw r instanceof me&&(process.stderr.write(`${Re({cwd:r.cwd,pid:r.pid})}
|
|
134
|
-
`),process.exit(1)),r}}function On(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${Ee()}
|
|
135
|
-
`),process.exit(1)}function Nn(){let e={handler:()=>{}};return{promise:new Promise(o=>{e.handler=o}),resolve:()=>{e.handler()}}}async function jn({cwd:e,ipc:r,releasePid:o}){return(await ir({cwd:e,onConnection:r.handleConnection})).match(t=>t,t=>{process.stderr.write(`${he(t)}
|
|
136
|
-
`),o(),process.exit(1)})}function Bn(){let e={provide:()=>{}};return{pool:new Promise(o=>{e.provide=o}),provide:o=>{e.provide(o)}}}function Kn(e){return h(e).match(r=>r,r=>{process.stderr.write(`${ie(r)}
|
|
137
|
-
`),process.exit(1)})}function Ur(e,{config:r,label:o}){let n=r.ripploServerUrl.includes("localhost")||r.ripploServerUrl.includes("127.0.0.1");return En(async()=>{try{return await e()}catch(t){Gn({config:r,error:t});let i=t instanceof Error?t.message:String(t);throw zn(i)?t:(s.error("%s failed: %s",o,i),new bn(i))}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:t,error:i})=>{s.warn("%s attempt %d failed \u2014 retrying: %s",o,t,i.message)}})}function Gn({config:e,error:r}){let o=Y(r);o==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${xe()}
|
|
138
|
-
`),process.exit(1)),o==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${ke({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
|
|
139
|
-
`),process.exit(1))}function zn(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function Jn(){U({maxRuns:Hr});let e=setInterval(()=>{U({maxRuns:Hr})},In);return()=>{clearInterval(e)}}function Qn(){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 Vn=4;async function Yn(e){try{let o=(await y({config:e,document:Wn,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(o!=null)return I(o),o}catch(r){s.warn({err:r},"failed to fetch local concurrency setting; using default")}return Vn}function Xn(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{ea 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 as t}from"./chunk-TPTG6RR4.js";import"./chunk-XGMM2RKR.js";import{a as e}from"./chunk-U4LC56T3.js";import"./chunk-PBL3TBB7.js";import"./chunk-JJ4QQPAV.js";import"./chunk-MOI4L3EX.js";import"./chunk-TEP6ETHQ.js";import"./chunk-OQ6KNYPG.js";import"./chunk-4DXOF4WS.js";import"./chunk-42LZFMNX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-S7GMY5LS.js";import"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.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-TPTG6RR4.js";import"./chunk-XGMM2RKR.js";import"./chunk-MOI4L3EX.js";import"./chunk-TEP6ETHQ.js";import"./chunk-OQ6KNYPG.js";import"./chunk-4DXOF4WS.js";import"./chunk-42LZFMNX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-FEHVIHVA.js";import"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.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-U4LC56T3.js";import"./chunk-PBL3TBB7.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.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{a as e}from"./chunk-G22LPS47.js";import{a as t}from"./chunk-CLFA4JSB.js";import{a as i}from"./chunk-3SCOYB4C.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-42LZFMNX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-S7GMY5LS.js";import"./chunk-MHNGR6M7.js";import"./chunk-KSNZWWHX.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as e}from"./chunk-4AGLYPJ5.js";import{a as r}from"./chunk-WNAVYV4P.js";import"./chunk-LB65USNP.js";import{a as i}from"./chunk-WK7VO5JE.js";import{a as t}from"./chunk-GD2AESFG.js";import"./chunk-XGMM2RKR.js";import"./chunk-PBL3TBB7.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-CDPYJKK7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-42LZFMNX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-S7GMY5LS.js";import"./chunk-MHNGR6M7.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-4AGLYPJ5.js";import"./chunk-XGMM2RKR.js";import"./chunk-PBL3TBB7.js";import"./chunk-JJ4QQPAV.js";import"./chunk-42LZFMNX.js";import"./chunk-7WZ3VIUU.js";import"./chunk-HGL5SE75.js";import"./chunk-FEHVIHVA.js";import"./chunk-MHNGR6M7.js";import"./chunk-WOHPPHUD.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as scopeReminder};
|
package/dist/status-QBBCVTXV.js
DELETED
|
@@ -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-VETETUHZ.js";import"./chunk-FCEWYZLQ.js";import"./chunk-FZIMQTFG.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-7YPITJA2.js";import"./chunk-MHNGR6M7.js";import"./chunk-IW2P4NKR.js";import"./chunk-KSNZWWHX.js";import"./chunk-LB2L72ZU.js";import"./chunk-CJUKILIO.js";import"./chunk-EXV2RD7Z.js";import"./chunk-ZH3HY7BS.js";import"./chunk-OAXYJKXD.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
|