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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as d,b as f,c as g}from"./chunk-
|
|
4
|
+
import{a as d,b as f,c as g}from"./chunk-T5VLZ43M.js";import{a as w}from"./chunk-I5BHCICM.js";import{c as u}from"./chunk-LEFXRK53.js";import{a as c}from"./chunk-7WZ3VIUU.js";import{f as m}from"./chunk-4W6WIT7T.js";import{a as i}from"./chunk-MHNGR6M7.js";import{e as a}from"./chunk-PE5WVWI5.js";import{graphql as h}from"gql.tada";var S=h(`
|
|
5
5
|
query ScopeReminder($projectId: String!, $cwd: String!) {
|
|
6
6
|
project(id: $projectId) {
|
|
7
7
|
id
|
|
@@ -18,6 +18,6 @@ import{a as d,b as f,c as g}from"./chunk-XGMM2RKR.js";import{a as w}from"./chunk
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`),x=async t=>{let{cwd:e}=t;if(!c(e)||!m(e))return;let
|
|
21
|
+
`),x=async t=>{let{cwd:e}=t;if(!c(e)||!m(e))return;let p=d(e);if(f(e,"scope-reminder")===p)return;let r=u(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);g(e,"scope-reminder",p);let n=s?.project?.devSession?.scopeItems??[];return w({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
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
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,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as p}from"./chunk-JJ4QQPAV.js";import{b as l}from"./chunk-
|
|
4
|
+
import{a as p}from"./chunk-JJ4QQPAV.js";import{b as l}from"./chunk-4W6WIT7T.js";import{i as c}from"./chunk-PE5WVWI5.js";import{createHash as S}from"crypto";import{mkdirSync as b,readFileSync as v,writeFileSync as A}from"fs";import x from"path";import*as e from"zod/mini";import{createHash as P}from"crypto";import a from"picomatch";function m(t){return l(["diff","--name-only","HEAD"],t).split(`
|
|
5
5
|
`).filter(r=>r.length>0)}function g({cwd:t,ignoreGlobs:r,watchGlobs:n}){let o=a([...n]),i=a([...r]);return m(t).filter(s=>o(s)&&!i(s))}function z(t){return l(["ls-files","--others","--exclude-standard"],t).split(`
|
|
6
6
|
`).filter(r=>r.length>0)}function d({cwd:t,ignoreGlobs:r,watchGlobs:n}){let o=a([...n]),i=a([...r]);return z(t).filter(s=>o(s)&&!i(s))}var F=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()}),R=e.object({changedAppFiles:e.readonly(e.array(e.string())),scope:e.object({available:e.boolean(),items:e.readonly(e.array(F))}),tests:e._default(e.readonly(e.array(C)),[]),untrackedAppFiles:e.readonly(e.array(e.string()))});function O({cwd:t,scope:r}){let n=h(t);u(t,{...f(t),scope:r,tests:n?.tests??[]})}function T({cwd:t,tests:r}){let n=h(t);u(t,{...f(t),scope:n?.scope??{available:!1,items:[]},tests:r??n?.tests??[]})}function h(t){let r=R.safeParse(k(y(t)));return r.success?r.data:null}function k(t){try{return JSON.parse(v(t,"utf8"))}catch{return null}}function y(t){return c(t,"coverage-context.json")}function u(t,r){let n=y(t);b(x.dirname(n),{recursive:!0});let o=S("sha256").update(JSON.stringify(r)).digest("hex");A(n,JSON.stringify({...r,inputHash:o},null,2))}function f(t){let{ignorePaths:r,watchPaths:n}=p(),o={cwd:t,ignoreGlobs:r,watchGlobs:n};return{changedAppFiles:g(o),untrackedAppFiles:d(o)}}export{O as a,T as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
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 y(o,n){try{let t=n.trim()===""?{}:JSON.parse(n),u=await o.run(t);return{kind:"output",stdout:u==null?void 0:JSON.stringify(u)}}catch(t){return{error:t,kind:"crash"}}}function O({event:o,handlers:n,note:t}){return l(o,async u=>{let r=n.map(async e=>e(u)),s=Promise.all(r),k=r.map(async e=>{let i=await e;return i!=null&&H(i)?i:f()}),a=await Promise.race([s.then(()=>null),...k]);if(a!=null)return a;let c=(await s).filter(e=>e!=null).flatMap(e=>{let i=e.hookSpecificOutput,p=i!=null&&"additionalContext"in i?i.additionalContext:null;return p==null?[]:[p]});if(c.length!==0)return t(c.join(`
|
|
5
|
+
|
|
6
|
+
`))})}function l(o,n){return{event:o,run:async t=>{if(!d(o,t))throw new Error(`hook input is not a ${o} payload`);return await n(t)??void 0}}}function d(o,n){return typeof n=="object"&&n!==null&&"hook_event_name"in n&&n.hook_event_name===o}function H(o){if(o.decision==="block")return!0;let n=o.hookSpecificOutput;return n!=null&&"permissionDecision"in n&&n.permissionDecision==="deny"}function f(){return new Promise(()=>{})}export{y as a,O as b,l as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{b as a}from"./chunk-OWN4P2K7.js";import{a as s}from"./chunk-7WZ3VIUU.js";import{f as l}from"./chunk-
|
|
4
|
+
import{b as a}from"./chunk-OWN4P2K7.js";import{a as s}from"./chunk-7WZ3VIUU.js";import{f as l}from"./chunk-4W6WIT7T.js";import p from"path";import*as t from"zod/mini";var n=new Set(["Edit","Write","NotebookEdit"]),d=t.looseObject({file_path:t.string()}),c="create",k=e=>{if(!n.has(e.tool_name))return;let i=d.safeParse(e.tool_input);if(!i.success)return;let{cwd:o}=e;if(!s(o)||!l(o))return;let r=p.relative(o,i.data.file_path);if(!(r.startsWith("..")||r!==".ripplo"&&!r.startsWith(".ripplo/"))&&!a(o,e.session_id,c))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Editing \`.ripplo/\` files (${r}) requires the \`/ripplo:create\` skill loaded first. Load \`/ripplo:create\` then retry \u2014 it carries the DSL builder shape, model rules, and the parallelization guidance you'll need.`}}};export{k as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as c,d as s}from"./chunk-FEHVIHVA.js";import{
|
|
4
|
+
import{a as c,d as s}from"./chunk-FEHVIHVA.js";import{j as l}from"./chunk-PE5WVWI5.js";import{err as h,ok as P}from"neverthrow";import{z as n}from"zod";var g="https://ripplo.ai";function a(){return u().RIPPLO_SERVER_URL}function m(){return u().RIPPLO_PROJECT_ID}var v=n.object({RIPPLO_PROJECT_ID:n.string().min(1).optional(),RIPPLO_SERVER_URL:n.string().min(1).default(g)}),f;function u(){return f??=v.parse(process.env),f}import d from"fs";import i from"path";function R(o){let t=d.realpathSync(o),r=t,e=i.dirname(r);for(;e!==r;){if(d.existsSync(i.join(r,".git")))return r;r=e,e=i.dirname(r)}return t}function x(o){return c(o).andThen(t=>s().andThen(r=>{let e=a(),p=l(e);return p==null?h({kind:"not-authenticated"}):P({appUrl:r.appUrl,cwd:R(o),engineUrl:r.engineUrl,projectId:m()??t.projectId,ripploServerUrl:e,token:p,webhookSecret:r.webhookSecret})}))}export{a,u as b,x as c};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as c}from"./chunk-OQ6KNYPG.js";import{c as p}from"./chunk-
|
|
4
|
+
import{a as c}from"./chunk-OQ6KNYPG.js";import{c as p}from"./chunk-LEFXRK53.js";import{c as l}from"./chunk-FEHVIHVA.js";import{a}from"./chunk-MHNGR6M7.js";import{I as u,w as t}from"./chunk-ESOXRGIY.js";import{N as d}from"./chunk-5SM4TCSW.js";var f=3e3;async function S(e){l(e);let n=p(e).unwrapOr(void 0);if(n==null)return null;try{return await fetch(`${n.ripploServerUrl}/health`,{signal:AbortSignal.timeout(f)}),null}catch(r){return{detail:r instanceof Error?r.message:String(r),serverUrl:n.ripploServerUrl}}}function m(e){return e.includes("localhost")||e.includes("127.0.0.1")}import g from"fuse.js";function s(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return`No tests selected \u2014 scope empty, no dirty .ripplo/workflows files. Pass test ids, add to scope (${a("run")}), or use --all.`;case"unknown-ids":{let n=e.known,r=e.unknown.flatMap(i=>y(i,n)),o=r.length>0?[`Did you mean: ${[...new Set(r)].join(", ")}`]:[];return[`Unknown ${e.unknown.length===1?"id":"ids"}: ${e.unknown.join(", ")}`,...o,"Pass a workflow slug for all its tests, or workflow/test for one. Known workflows:",...n.map(i=>` ${i}`)].join(`
|
|
5
5
|
`)}}}function L({failed:e,notRun:n,passed:r}){let o=n>0?`, ${String(n)} not run`:"";return`${String(r)} passed, ${String(e)} failed${o} (${String(r+e+n)} total)`}function A({debugDir:e,event:n}){let r=`${n.workflowName} \u2192 ${n.testName}`;if(n.kind==="test-started")return`${t.dim("run ")} ${r}`;switch(n.outcome.kind){case"pass":return`${t.good("pass")} ${r} ${t.dim(n.runId)}`;case"findings":return[`${t.bad("fail")} ${r} \u2014 ${c(n.outcome.findingLines.length,"finding")}`,...n.outcome.findingLines,u({debugDir:e,runId:n.runId}),`${t.dim("why")} npx ripplo explain ${n.runId}`].join(`
|
|
6
6
|
`);case"error":return`${t.bad("error")} ${r} \u2014 ${n.outcome.detail} ${t.dim(n.runId)}`;case"dispatch-error":return`${t.bad("error")} ${r} \u2014 ${w(n.outcome.reason)}`;case"dispatch-timeout":return`${t.bad("error")} ${r} \u2014 not run: dispatch timed out (transient): ${n.outcome.detail}`;case"infra-error":return`${t.bad("error")} ${r} \u2014 not run: Ripplo server unreachable: ${n.outcome.detail}`}}var h={MAX_AGENTS:"agent limit reached for your plan \u2014 upgrade to add more",MAX_CONCURRENT_RUNS:"concurrent run limit reached for your plan \u2014 upgrade or wait for runs to finish",MAX_PROJECTS:"project limit reached for your plan \u2014 upgrade to add more",MAX_RUNS:"run limit reached for your plan \u2014 enable overage or upgrade",OVERAGE_CAP:"overage cap reached \u2014 raise the cap or upgrade"};function j({detail:e,serverUrl:n}){return m(n)?`Ripplo server at ${n} not running (${e}). Start the dev server with \`pnpm dev\`.`:`Ripplo server at ${n} unreachable (${e}) \u2014 server-side, not your local environment.`}function N(e){switch(e.code){case"compile-failed":{let n=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for full output.`,...n].join(`
|
|
7
7
|
`)}case"selection-conflicting-flags":return s({kind:"conflicting-flags"});case"selection-nothing-selected":return s({kind:"nothing-selected"});case"selection-unknown-ids":return s({kind:"unknown-ids",known:e.known,unknown:e.unknown});case"app-unreachable":return`Your dev server not responding at ${e.url} (${e.detail}) \u2014 your local environment, not the Ripplo server.`;case"engine-unreachable":return`Ripplo engine not responding at ${e.url} (${e.detail}) \u2014 adapter unmounted, behind a build error, or RIPPLO_ENGINE_URL points at the wrong path.`;case"scope-failed":return`Could not resolve the dev-session scope: ${e.detail}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{A as i,C as s,F as d,i as o}from"./chunk-
|
|
4
|
+
import{A as i,C as s,F as d,i as o}from"./chunk-ESOXRGIY.js";function y(n){switch(n.kind){case"empty-response":return"ripplo daemon: cloud tunnel provisioning returned no result. Check server logs and retry.";case"server-error":return`ripplo daemon: cloud tunnel provisioning failed (${n.typename}). Run \`npx ripplo doctor\` to check your setup.`}}function x(n){switch(n.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${n.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${n.message}`}}function $({projectId:n,serverUrl:e}){return[`Project "${n}" (from .ripplo/project.json) was not found on ${e}, 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
5
|
`)}function b(){return"Not signed in. Run `npx ripplo auth login`, then start the daemon again."}function v({devSessionId:n,version:e}){return`ripplo daemon: v${e} ready as local executor for session ${n} (switch with \`npx ripplo executor cloud\` \u2014 Ctrl-C to stop)`}function S({cwd:n,pid:e}){return`ripplo daemon: another daemon is already running for this project${e==null?"":` (pid ${String(e)})`} (cwd ${n}) \u2014 this one is exiting. Run \`npx ripplo daemon status\` to inspect it, or \`npx ripplo daemon stop\` to stop it.`}function w(n){switch(n.kind){case"not-running":return"ripplo daemon: not running.";case"stopped":return`ripplo daemon: stopped (pid ${String(n.pid)}).`;case"timeout":return`ripplo daemon: pid ${String(n.pid)} did not exit within 10s \u2014 it may be finishing a run. Check again with \`npx ripplo daemon status\`.`}}function j(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function R(n){if(n.kind==="not-running")return"daemon: not running";if(n.kind==="unresponsive")return`daemon: running but no reply within ${String(n.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:e}=n,r=e.version==null?"version unknown (pre-0.7.8)":`v${e.version}`,p=`${String(e.active)} active, ${String(e.queued)} queued`,u=m(e.explorer,e.exploring),t=`daemon: running (${r} | ${p} | ${u} | ${c(e.progress)})`;if(e.sseHealth!=null&&!e.sseHealth.ok){let l=e.sseHealth.detail==null?"":`: ${e.sseHealth.detail}`;return`${t}
|
|
6
6
|
daemon: cannot subscribe to run dispatch${l} \u2014 server-side, restarting the daemon will not help`}return t}function c(n){return n.attempts===0?"explore: idle":`explore: ${String(n.attempts)} attempts, ${String(n.findings)} findings`}function P(n){let e=n.daemonVersion==null?"an older build":`v${n.daemonVersion}`;return n.kind==="restarted"?`ripplo: daemon was on ${e} \u2014 restarted on the current build`:`ripplo: daemon is on a stale build (${e}) with runs in flight \u2014 rerun once it drains, or npx ripplo daemon restart`}function D(n){switch(n.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:g(n.findings).map(e=>d({evidencePath:`.ripplo/debug/${n.runId}/behavior.jsonl`,finding:e})),kind:"findings"};case"error":return{detail:o(n.error),kind:"error"};case"dispatch-failed":return{kind:"dispatch-error",reason:{detail:n.reason,type:"generic"}}}}function m(n,e){return n==="stalled"?"explorer: stalled \u2014 a wedged trail is restarting on its own, no action needed":`explorer: ${n}, ${String(e)} exploring`}function g(n){let e=new Set(n.flatMap(r=>h(r)?[a(r)]:[]));return n.filter(r=>!(f(r)&&e.has(a(r))))}function h(n){return n.kind==="pending-check"&&n.source.kind==="step"}function a(n){return n.kind!=="pending-check"||n.source.kind==="data-rule"?"":`${i(n.source.check)}|${s(n.step)}`}function f(n){return n.kind==="pending-check"&&n.source.kind==="fact"}export{y as a,x as b,$ as c,b as d,v as e,S as f,w as g,j as h,R as i,c as j,P as k,D as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as s}from"./chunk-7WZ3VIUU.js";import{e as p}from"./chunk-
|
|
4
|
+
import{a as s}from"./chunk-7WZ3VIUU.js";import{e as p}from"./chunk-4W6WIT7T.js";import{a as i}from"./chunk-MHNGR6M7.js";import{h as n}from"./chunk-AQ3DMGAY.js";import{c as a}from"./chunk-DBIXYJRB.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(p(o))||a(o)?void 0:(await n(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||!s(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 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{
|
|
4
|
+
import{i as c}from"./chunk-PE5WVWI5.js";import{spawnSync as y}from"child_process";import{existsSync as s,readdirSync as d,readFileSync as g,realpathSync as u,statSync as m}from"fs";import i from"path";var h=2e3;function L(t){if(t!=null)try{return m(u(t)).mtimeMs}catch{return}}function _(t){return y("pnpm",["turbo","run","build","--filter=ripplo..."],{cwd:t,stdio:"inherit"}).status===0}function D(){let t=process.argv[1];if(t==null)return{kind:"fresh"};let n=u(t),r=n.includes(`${i.sep}src${i.sep}`),o=p(i.dirname(n));if(o!=null)return r?{kind:"fresh"}:j(o);let a=p(process.cwd());return a!=null&&k(a)?{kind:"foreign-binary",workspaceRoot:a}:{kind:"fresh"}}function p(t){let n=i.dirname(t);return s(i.join(t,"pnpm-workspace.yaml"))?t:n===t?void 0:p(n)}function j(t){let n=i.join(t,"packages");if(!s(n))return{kind:"fresh"};let r=d(n).map(o=>({dist:i.join(n,o,"dist"),name:o,src:i.join(n,o,"src")})).filter(o=>s(o.src)&&s(o.dist)).filter(o=>l(o.src)>l(o.dist)+h).map(o=>o.name);return r.length===0?{kind:"fresh"}:{kind:"stale",packages:r,workspaceRoot:t}}function l(t){let n=m(t);if(!n.isDirectory())return n.mtimeMs;let r=d(t).map(o=>l(i.join(t,o)));return Math.max(n.mtimeMs,...r)}function k(t){let n=i.join(t,"packages","cli","package.json");if(!s(n))return!1;let r=JSON.parse(g(n,"utf8"));return typeof r=="object"&&r!=null&&"name"in r&&r.name==="ripplo"}import{createMessageConnection as S,NotificationType as f,RequestType as x,RequestType0 as b,SocketMessageReader as R,SocketMessageWriter as w}from"vscode-jsonrpc/node";import{z as e}from"zod";var E="daemon.sock",P="daemon.log";function J(t){return c(t,E)}function X(t){return c(t,P)}function G(t){return S(new R(t),new w(t))}var K=e.object({all:e.boolean(),headed:e.boolean(),tests:e.array(e.string())}),$=e.object({jobId:e.string(),total:e.number()}),M=e.enum(["on","off","stalled"]),q=e.object({attempts:e.number(),findings:e.number()}),B=e.object({active:e.number(),bundleMtimeMs:e.number().optional(),explorer:M,exploring:e.number(),progress:q,queued:e.number(),sseHealth:e.object({detail:e.string().optional(),ok:e.boolean()}).optional(),version:e.string().optional()}),v=e.enum(["MAX_RUNS","OVERAGE_CAP","MAX_AGENTS","MAX_CONCURRENT_RUNS","MAX_PROJECTS"]),I=e.discriminatedUnion("type",[e.object({code:v,type:e.literal("limit")}),e.object({detail:e.string(),type:e.literal("generic")})]),z=e.discriminatedUnion("kind",[e.object({kind:e.literal("pass")}),e.object({findingLines:e.array(e.string()),kind:e.literal("findings")}),e.object({detail:e.string(),kind:e.literal("error")}),e.object({kind:e.literal("dispatch-error"),reason:I}),e.object({detail:e.string(),kind:e.literal("dispatch-timeout")}),e.object({detail:e.string(),kind:e.literal("infra-error")})]),A=e.discriminatedUnion("kind",[e.object({kind:e.literal("test-started"),runId:e.string(),testName:e.string(),workflowName:e.string()}),e.object({kind:e.literal("test-outcome"),outcome:z,runId:e.string(),testName:e.string(),workflowName:e.string()})]),H=e.object({event:A,jobId:e.string()}),V=e.object({failed:e.number(),jobId:e.string(),notRun:e.number(),passed:e.number()}),Q=e.discriminatedUnion("code",[e.object({code:e.literal("compile-failed"),detail:e.string(),diagnostics:e.array(e.string()).default([])}),e.object({code:e.literal("selection-conflicting-flags")}),e.object({code:e.literal("selection-nothing-selected")}),e.object({code:e.literal("selection-unknown-ids"),known:e.array(e.string()),unknown:e.array(e.string())}),e.object({code:e.literal("scope-failed"),detail:e.string()}),e.object({code:e.literal("app-unreachable"),detail:e.string(),url:e.string()}),e.object({code:e.literal("engine-unreachable"),detail:e.string(),url:e.string()}),e.object({code:e.literal("sync-failed"),detail:e.string()}),e.object({code:e.literal("bad-message")})]),Y=new x("ripplo/enqueue"),Z=new b("ripplo/status"),ee=new b("ripplo/shutdownIfIdle"),te=new f("ripplo/jobEvent"),ne=new f("ripplo/jobDone");export{L as a,_ as b,D as c,J as d,X as e,G as f,K as g,$ as h,B as i,z as j,H as k,V as l,Q as m,Y as n,Z as o,ee as p,te as q,ne as r};
|
|
@@ -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{b as T}from"./chunk-CJUKILIO.js";import{a as F}from"./chunk-NNH3YVVO.js";import{b as $}from"./chunk-KMZ3L5YA.js";var G=15e3,O=3,U=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 N(e){if(e instanceof c)return e.errors[0]?.extensions?.code}var L={attempts:O,timeoutMs:G},V={attempts:1,timeoutMs:3e3};async function A(e){return E(e,L)}async function j(e){return E(e,V)}async function E(e,r){let{print:t}=await import("graphql"),n=t(e.document),o=JSON.stringify({query:n,variables:e.variables}),i=`${e.config.ripploServerUrl}/graphql`,g=await W({init:{body:o,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json",...T()},method:"POST"},policy:r,serverUrl:e.config.ripploServerUrl,url:i}),s=await J({res:g,url:i});if(!Q(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,policy:r,serverUrl:t,url:n}){let o=1,i=await b({init:e,timeoutMs:r.timeoutMs,url:n});for(;i.retryable&&o<r.attempts;)await H(B(o)),o+=1,i=await b({init:e,timeoutMs:r.timeoutMs,url:n});if(i.response!=null)return i.response;throw new f({detail:i.detail,serverUrl:t})}async function b({init:e,timeoutMs:r,url:t}){try{let n=await fetch(t,{...e,signal:AbortSignal.timeout(r)});return{detail:"",response:n,retryable:n.status>=500}}catch(n){return{detail:n instanceof Error?n.message:String(n),response:void 0,retryable:!0}}}function B(e){return U*3**(e-1)*(.5+Math.random())}function H(e){return new Promise(r=>{setTimeout(r,e)})}async function J({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 Q(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 Y from"pino-pretty";var y=X({level:process.env.LOG_LEVEL??"info"},Y({ignore:"pid,hostname"}));import{readdir as z,rm as Z,stat as ee}from"fs/promises";import C from"path";var x=C.join(process.cwd(),".ripplo","debug"),k=360*60*1e3;async function re({maxRuns:e}){try{let t=(await z(x,{withFileTypes:!0})).filter(a=>a.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async a=>{let p=C.join(x,a.name),M=await ee(p);return{dirPath:p,mtime:M.mtimeMs}})),i=o.filter(a=>n-a.mtime>k),s=o.filter(a=>n-a.mtime<=k).toSorted((a,p)=>p.mtime-a.mtime).slice(e),v=[...i,...s];if(v.length===0)return;await Promise.allSettled(v.map(a=>Z(a.dirPath,{force:!0,recursive:!0}))),y.debug("Pruned %d old debug run(s)",v.length)}catch{y.warn("Debug run pruning failed, ignoring")}}import l from"fs";import te from"os";import m from"path";var ne=".local",oe=".ripplo";function R(e){return m.join(e,".ripplo",ne)}function ie(e){let r=R(e);l.existsSync(r)||l.mkdirSync(r,{recursive:!0});let t=m.join(r,".gitignore");return l.existsSync(t)||l.writeFileSync(t,`*
|
|
5
|
+
`),r}function ae(e,r){return m.join(R(e),r)}function h(){return m.join(te.homedir(),oe)}function P(){let e=h();return l.existsSync(e)?l.chmodSync(e,448):l.mkdirSync(e,{mode:448,recursive:!0}),e}function S(e){return m.join(h(),e)}import{Agent as se,RetryAgent as le,setGlobalDispatcher as de}from"undici";var ce=1500,me=4e3,ue=3,ge=50,pe=100,I=!1;function fe(){if(I)return;I=!0;let e=new se({connections:pe,keepAliveMaxTimeout:me,keepAliveTimeout:ce}),r=new le(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:ue,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:ge});de(r)}import{graphql as u}from"gql.tada";var Ue=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 Ne=u(`
|
|
20
|
+
mutation StartAgentReviewWorker($reviewId: String!) {
|
|
21
|
+
startAgentReview(reviewId: $reviewId)
|
|
22
|
+
}
|
|
23
|
+
`);var Le=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 Ve=u(`
|
|
40
|
+
mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
|
|
41
|
+
updateAgentReviewProgress(reviewId: $reviewId, text: $text)
|
|
42
|
+
}
|
|
43
|
+
`);var je=u(`
|
|
44
|
+
mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
|
|
45
|
+
failAgentReview(reviewId: $reviewId, reason: $reason)
|
|
46
|
+
}
|
|
47
|
+
`);import d from"fs";import D 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(!d.existsSync(t))return null;let n=d.readFileSync(t,"utf8").trim();return n.length===0?null:n}function we({serverUrl:e,token:r}){P();let t=w(e);d.mkdirSync(D.dirname(t),{mode:448,recursive:!0}),d.writeFileSync(t,r+`
|
|
48
|
+
`,{mode:384})}function ve(e){let r=w(e);return d.existsSync(r)?(d.unlinkSync(r),!0):!1}function w(e){return S(D.join("tokens",Re(e)))}function Re(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var q=$(F(),1);import _ from"crypto";function he({body:e,secret:r}){let t=new q.Webhook(r),n=`msg_${_.randomUUID()}`,o=new Date,i=t.sign(n,o,e),g=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":i,"webhook-timestamp":String(g)}}function Pe(){return`whsec_${_.randomBytes(24).toString("base64")}`}export{f as a,c as b,N as c,A as d,j as e,y as f,re as g,ie as h,ae as i,ye as j,we as k,ve as l,w as m,fe as n,he as o,Pe as p};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as r}from"./chunk-OQ6KNYPG.js";import{a as s}from"./chunk-MHNGR6M7.js";import{a as k,b as C,c as F,d as b}from"./chunk-
|
|
4
|
+
import{a as r}from"./chunk-OQ6KNYPG.js";import{a as s}from"./chunk-MHNGR6M7.js";import{a as k,b as C,c as F,d as b}from"./chunk-EK6TENV6.js";import{L as $,f as u,k as c,n as f,p as m,q as p,r as g,s as y,t as h,u as S,v,w as o}from"./chunk-ESOXRGIY.js";import{A as d,H as l}from"./chunk-5SM4TCSW.js";async function P({cwd:e,lockfile:n}){let i=c(n),a=b(d(l,n));if(C({context:i,cwd:e})===a)return[];k({context:i,cwd:e});let t=await x(n);return F({cleanLockfileHash:t.length===0?a:null,context:i,cwd:e}),t}async function x(e){let n=u(e),i=await f(e),a=await m({context:c(e),facts:i.facts});return[...g(e).map(t=>({kind:"missing-precondition",missing:t})),...p(n,i.dataRules).map(t=>({gap:t,kind:"cascade-gap"})),...a.map(t=>({conflict:t,kind:"fact-conflict"})),...y(e).map(t=>({kind:"unreachable-interaction",violation:t})),...h(e).map(t=>({kind:"redundant-assertion",redundancy:t})),...S(e).map(t=>({kind:"unmodeled-surface",surface:t})),...v(e).map(t=>({content:t,kind:"unpinned-surface-content"}))]}function U(e){return`${o.good("ok")} \u2014 no static model violations (${r(e,"test")})`}function O(e){let i=e.some(a=>a.kind==="unmodeled-surface")?[`Elements that hide together are one surface. ${s("create","surfaces")}`]:[];return[`${o.bad("fail")} \u2014 ${r(e.length,"static model violation")}:`,...e.map(a=>$(a)),...i].join(`
|
|
5
5
|
|
|
6
6
|
`)}function E(e){return[`${o.warn("warn")} \u2014 ${r(e.length,"model coverage gap")} (not blocking):`,...e.map(n=>` ${A(n)}`),`Stub the missing flows. ${s("discover")}`].join(`
|
|
7
7
|
`)}function A(e){switch(e.kind){case"entity-never-given":return`${e.entity} \u2014 declared but no test seeds it`;case"entity-never-mutated":return`${e.entity} \u2014 seeded but never asserted created/updated/deleted`;case"unmatchable-delete-key":return`test ${e.workflow}/${e.testSlug} asserts ${e.entity} deleted with literal ${e.field} but no seeded ${e.entity} sets ${e.field} \u2014 solver treats it as no-match`}}export{P as a,U as b,O as c,E as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{b as u}from"./chunk-
|
|
4
|
+
import{b as u}from"./chunk-I5BHCICM.js";import{a as f}from"./chunk-JJ4QQPAV.js";import{a as m}from"./chunk-7WZ3VIUU.js";import{f as c}from"./chunk-4W6WIT7T.js";import{i as p}from"./chunk-EK6TENV6.js";import{h as l}from"./chunk-AQ3DMGAY.js";import v from"path";import h from"picomatch";import*as s from"zod/mini";var w=s.looseObject({file_path:s.string()}),R=async n=>{let i=w.safeParse(n.tool_input);if(!i.success)return;let d=i.data.file_path,{cwd:t}=n;if(!m(t)||!c(t))return;let r=v.relative(t,d);if(r.startsWith(".."))return;let{ignorePaths:b,watchPaths:k}=f(),P=h([...k]),g=h([...b]);if(!P(r)||g(r))return;let o=await l(t);if(u({cwd:t,tests:o.isOk()?o.value.workflows.map(e=>({intent:e.intent,name:e.name,sourcePath:e.sourcePath??null,stub:e.stub})):void 0}),o.isErr())return;let a=p(o.value);if(a.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: stub workflows still unimplemented \u2014 ${a.join(", ")}. Implement with \`workflow("Intent", () => ({ given, steps }))\`.`,hookEventName:"PostToolUse"}}};export{R as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{b as s,c as u}from"./chunk-
|
|
4
|
+
import{b as s,c as u}from"./chunk-4W6WIT7T.js";import{createHash as d}from"crypto";import{mkdirSync as h,readdirSync as g,readFileSync as p,writeFileSync as m}from"fs";import i from"path";var l=[".ts",".tsx",".js",".jsx"],y=new Set([".local","debug"]);function v(r){let t=d("sha256");return u(r)?(t.update(s(["rev-parse","HEAD"],r)),t.update("\0"),t.update(s(["diff","HEAD"],r)),t.update("\0"),s(["ls-files","--others","--exclude-standard"],r).split(`
|
|
5
5
|
`).filter(e=>e.length>0).filter(e=>l.some(n=>e.endsWith(n))).toSorted((e,n)=>e.localeCompare(n)).forEach(e=>{t.update(e),t.update("\0"),t.update(c(i.join(r,e))),t.update("\0")}),t.digest("hex")):S(r,t)}function A(r,t){try{return p(f(r,t),"utf8").trim()}catch{return null}}function D(r,t,o){let e=f(r,t);h(i.dirname(e),{recursive:!0}),m(e,o)}function S(r,t){let o=i.join(r,".ripplo");return x(o).filter(n=>l.some(a=>n.endsWith(a))).filter(n=>!y.has(n.split(i.sep)[0]??"")).toSorted((n,a)=>n.localeCompare(a)).forEach(n=>{t.update(n),t.update("\0"),t.update(c(i.join(o,n))),t.update("\0")}),t.digest("hex")}function x(r){try{return g(r,{recursive:!0}).filter(t=>typeof t=="string")}catch{return[]}}function c(r){try{return p(r)}catch{return Buffer.alloc(0)}}function f(r,t){return i.join(r,".ripplo",".local",`${t}.hash`)}export{v as a,A as b,D as c};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{c as k}from"./chunk-
|
|
4
|
+
import{c as k}from"./chunk-LEFXRK53.js";import{a as P,f as I}from"./chunk-4W6WIT7T.js";import{b as m,e as h,h as w}from"./chunk-AQ3DMGAY.js";import{d as c,f as d}from"./chunk-PE5WVWI5.js";import{L as g,N as S}from"./chunk-5SM4TCSW.js";import u from"fs";import f from"path";function v(e){try{let n=A(e);if(n==null)return;let t=f.join(n,"HEAD"),o=u.readFileSync(t,"utf8").trim(),i="ref: refs/heads/";return o.startsWith(i)?o.slice(i.length):o.length===0?void 0:o.slice(0,7)}catch{return}}function A(e){let n=f.join(e,".git");if(u.statSync(n).isDirectory())return n;let o=u.readFileSync(n,"utf8").trim(),i="gitdir:";if(!o.startsWith(i))return;let s=o.slice(i.length).trim();if(s.length!==0)return f.resolve(e,s)}import b from"crypto";import{readFile as D}from"fs/promises";import x from"path";import{graphql as y}from"gql.tada";import{err as E,ok as L}from"neverthrow";var T=y(`
|
|
5
5
|
mutation SyncDevSession(
|
|
6
6
|
$projectId: String!
|
|
7
7
|
$cwd: String!
|
|
@@ -0,0 +1,7 @@
|
|
|
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,c as t}from"./chunk-KOKEEAEF.js";import{c as s}from"./chunk-CJUKILIO.js";function l(){let o=process.cwd(),e=s(o);e!=null&&e!==o&&(process.chdir(e),process.stderr.write(`ripplo: resolved .ripplo/ at ${e}
|
|
5
|
+
`))}var d={"exit-plan-gate":()=>import("./exit-plan-gate-BNAUL4FC.js").then(o=>o.exitPlanGateHook),"plan-reminder":()=>import("./plan-reminder-VMBDQTAP.js").then(o=>t("UserPromptSubmit",o.planReminder)),"post-edit":()=>import("./post-edit-2VFE6QND.js").then(o=>o.postEditHook),"post-edit-analyze":()=>import("./post-edit-analyze-VETPP5Z4.js").then(o=>t("PostToolUse",o.postEditAnalyze)),"post-edit-flag-stubs":()=>import("./post-edit-flag-stubs-J3MCGLXI.js").then(o=>t("PostToolUse",o.postEditFlagStubs)),"pre-bash-run-gate":()=>import("./pre-bash-run-gate-PWLARIYK.js").then(o=>o.preBashRunGateHook),"pre-edit":()=>import("./pre-edit-Q4U5LSWG.js").then(o=>o.preEditHook),"pre-edit-ripplo-skill-gate":()=>import("./pre-edit-ripplo-skill-gate-JD4BDCA3.js").then(o=>t("PreToolUse",o.preEditRipploSkillGate)),"pre-edit-scope-gate":()=>import("./pre-edit-scope-gate-NZO4HVGT.js").then(o=>t("PreToolUse",o.preEditScopeGate)),"pre-edit-watch-gate":()=>import("./pre-edit-watch-gate-EUZGEH2J.js").then(o=>t("PreToolUse",o.preEditWatchGate)),"prompt-submit":()=>import("./prompt-submit-MPRVCWOI.js").then(o=>o.promptSubmitHook),"scope-reminder":()=>import("./scope-reminder-CBY4I5SG.js").then(o=>t("UserPromptSubmit",o.scopeReminder)),"session-preamble":()=>import("./session-preamble-RJ4WNGJN.js").then(o=>o.sessionPreambleHook),"stop-enforce":()=>import("./stop-enforce-UXBQRTFP.js").then(o=>o.stopEnforceHook),"tasks-reminder":()=>import("./tasks-reminder-LKSUZUFD.js").then(o=>t("UserPromptSubmit",o.tasksReminder)),"tasks-reminder-tool":()=>Promise.resolve(t("PostToolUse",()=>{})),"track-skill-load":()=>import("./track-skill-load-CJ74GD3Q.js").then(o=>o.trackSkillLoadHook),"track-skill-prompt":()=>import("./track-skill-prompt-YSB6OOQN.js").then(o=>t("UserPromptSubmit",o.trackSkillPrompt))},n=d;async function P(o){let e=n[o];e==null&&(process.stderr.write(`Unknown hook: ${o}
|
|
6
|
+
`),process.exit(1));let i=await m(),r=await p(await e(),i);if(r.kind==="crash"){let{renderHookCrash:a}=await import("./cli-error-SLG6JHK2.js");process.stderr.write(`${a(o,r.error)}
|
|
7
|
+
`),process.exit(0)}r.stdout!=null&&process.stdout.write(r.stdout),process.exit(0)}function m(){return new Promise((o,e)=>{if(process.stdin.isTTY){o("");return}let i=[];process.stdin.on("data",r=>i.push(r)),process.stdin.on("end",()=>{o(Buffer.concat(i).toString("utf8"))}),process.stdin.on("error",e)})}export{l as a,n as b,P as c};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{f as a}from"./chunk-
|
|
4
|
+
import{f as a}from"./chunk-EGETJKAQ.js";import{a as n}from"./chunk-AVBP7Q2M.js";import{i}from"./chunk-EK6TENV6.js";import{h as e}from"./chunk-AQ3DMGAY.js";import{i as u}from"./chunk-M7VQD4VO.js";async function x(m){let o=process.cwd(),r=await e(o);r.isErr()&&(process.stderr.write(`${n(r.error)}
|
|
5
5
|
`),process.exit(1));let s=i(r.value),t=await a(o);if(m.format==="summary"){s.length>0&&process.stdout.write(`stub workflows: ${s.join(", ")}
|
|
6
6
|
`),process.stdout.write(`${u(t)}
|
|
7
7
|
`);return}let p={daemon:t.kind==="running"?{active:t.status.active,explorer:t.status.explorer,exploring:t.status.exploring,progress:t.status.progress,queued:t.status.queued,running:!0}:{running:t.kind==="unresponsive",state:t.kind},tests:s.map(d=>({id:d,implemented:!1}))};process.stdout.write(`${JSON.stringify(p,null,2)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as l}from"./chunk-JJ4QQPAV.js";import{c}from"./chunk-
|
|
4
|
+
import{a as l}from"./chunk-JJ4QQPAV.js";import{c}from"./chunk-LEFXRK53.js";import{a as p}from"./chunk-7WZ3VIUU.js";import{f as d}from"./chunk-4W6WIT7T.js";import{b as a}from"./chunk-MHNGR6M7.js";import{e as s}from"./chunk-PE5WVWI5.js";import f from"path";import u from"picomatch";import{graphql as m}from"gql.tada";import*as n from"zod/mini";var h=new Set(["Edit","Write","NotebookEdit"]),g=n.looseObject({file_path:n.string()}),S=m(`
|
|
5
5
|
query PreEditScopeGate($projectId: String!, $cwd: String!) {
|
|
6
6
|
project(id: $projectId) {
|
|
7
7
|
id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a,b,c}from"./chunk-
|
|
4
|
+
import{a,b,c}from"./chunk-2MT2MZJW.js";import"./chunk-AVBP7Q2M.js";import"./chunk-MHNGR6M7.js";import"./chunk-AQ3DMGAY.js";import"./chunk-5SM4TCSW.js";import"./chunk-KMZ3L5YA.js";export{b as renderCliFailure,c as renderHookCrash,a as renderTopLevelError};
|
|
@@ -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{e as a,f as b,g as c,h as d,i as e}from"./chunk-EK6TENV6.js";import"./chunk-AQ3DMGAY.js";import"./chunk-ESOXRGIY.js";import"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as compileAndWrite,c as stampedLockfile,d as stampedLockfileFromDisk,e as stubbedWorkflows,b as writeStampedLockfile};
|
|
@@ -0,0 +1,139 @@
|
|
|
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 je,B as Be,C,E as Ke,F as Ge,G as ze,I as Je,J as Qe,K as $,e as Se,g as he,j as Ie,k as Ce,l as Te,m as Le,n as We,o as Ae,p as De,q as He,s as qe,t as E,u as b,v as Ue,w as _,x as Fe,y as Oe,z as Ne}from"./chunk-CRELTIU2.js";import{d as ve}from"./chunk-OY6HNCAZ.js";import{a as Me,c as _e,d as $e,e as I}from"./chunk-UVYCSHOJ.js";import{c as h}from"./chunk-LEFXRK53.js";import{e as we}from"./chunk-4W6WIT7T.js";import{a as oe}from"./chunk-R4ZTRVDQ.js";import{c as X}from"./chunk-FEHVIHVA.js";import{b as te}from"./chunk-2MT2MZJW.js";import{a as M}from"./chunk-AVBP7Q2M.js";import"./chunk-MHNGR6M7.js";import{g as fe,h as me}from"./chunk-EK6TENV6.js";import{f as R,g as ne,h as U}from"./chunk-AQ3DMGAY.js";import{e as ye,f as ge}from"./chunk-DBIXYJRB.js";import{c as V,d as y,f as s,g as q,h as Y}from"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import{b as ke,c as xe,d as Pe,e as Re,f as Ee,h as be}from"./chunk-M7VQD4VO.js";import{M as se,O as le,P as de,Q as ce,R as ue,S as pe,d as ie,h as ae}from"./chunk-ESOXRGIY.js";import{A as Z,H as ee,N as re}from"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import Rn from"path";import{createClient as En}from"graphql-sse";import bn,{AbortError as In}from"p-retry";import{graphql as Q}from"gql.tada";import{graphql as zr}from"gql.tada";import{print as Jr}from"graphql";async function Ve({config:e,cwd:r,headed:o,pool:n,runId:t,signal:i,testSlug:a,workClass:l,workflowSlug:d}){let u=await R(r);if(u.isErr())return await C(e,t,`lockfile:${u.error.kind}`),{kind:"dispatch-error",reason:{detail:`lockfile:${u.error.kind}`,type:"generic"}};let p=Gr(u.value,{testSlug:a,workflowSlug:d});if(p==null)return await C(e,t,`no-test:${d}/${a}`),{kind:"dispatch-error",reason:{detail:`no-test:${d}/${a}`,type:"generic"}};let c=await E({headed:o,workClass:l,task:()=>n.execute({headed:o,runId:t,testRef:p},i)});return!c.serverNotified&&c.outcome.kind==="error"&&await C(e,t,c.outcome.detail),c.outcome}function Gr(e,{testSlug:r,workflowSlug:o}){let t=e.workflows.find(i=>re(i.name)===o)?.tests.find(i=>i.slug===r);return t==null?void 0:ie(t)}var Qr=6e4,Vr=zr(`
|
|
5
|
+
subscription RunRequestedWatch($devSessionId: String!) {
|
|
6
|
+
runRequested(devSessionId: $devSessionId) {
|
|
7
|
+
runId
|
|
8
|
+
testSlug
|
|
9
|
+
workflowId
|
|
10
|
+
workflowSlug
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`);async function Ye(e){let r=Math.min(1e3*2**e,Qr)+Zr();await new Promise(o=>setTimeout(o,r))}function Xe({claim:e,cwd:r,devSessionId:o,onSubscriptionDead:n,pool:t,sseClient:i,sseHealth:a}){let l=new Set;return i.subscribe({query:Jr(Vr),variables:{devSessionId:o}},{complete:()=>{},error:d=>{let u=d instanceof Error?d.message:String(d);s.warn("runRequested SSE failed: %s; re-registering session",u),n(u)},next:d=>{Yr({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 Yr({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
|
+
`),X(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=Xr(e(o.runId),o);a.started(),Ve({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 Xr(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:Oe(e.token),workClass:"p1-cli",finished:o=>{e.finished(r.runId,o)},started:()=>{e.started(r.runId)}}}function Zr(){return Math.floor(Math.random()*2700)+300}import{graphql as F}from"gql.tada";import{print as eo}from"graphql";var ro=F(`
|
|
15
|
+
subscription TeleportRequestedWatch($devSessionId: String!) {
|
|
16
|
+
teleportRequested(devSessionId: $devSessionId) {
|
|
17
|
+
runId
|
|
18
|
+
stepIndex
|
|
19
|
+
kind
|
|
20
|
+
testSlug
|
|
21
|
+
workflowSlug
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`),oo=F(`
|
|
25
|
+
query TeleportRunRepro($id: String!) {
|
|
26
|
+
run(id: $id) {
|
|
27
|
+
id
|
|
28
|
+
reproJson
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`),no=F(`
|
|
32
|
+
mutation ReportTeleportResult($devSessionId: String!, $runId: String!, $status: String!) {
|
|
33
|
+
reportTeleportResult(devSessionId: $devSessionId, runId: $runId, status: $status)
|
|
34
|
+
}
|
|
35
|
+
`);function Ze({cwd:e,devSessionId:r,onSubscriptionDead:o,sseClient:n}){let t=new Set,i=n.subscribe({query:eo(ro),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=>{to({cwd:e,devSessionId:r,event:a.data?.teleportRequested,running:t})}});return()=>{t.forEach(a=>{a.abort()}),t.clear(),i()}}function to({cwd:e,devSessionId:r,event:o,running:n}){if(o==null)return;let t=new AbortController;n.add(t),io({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 io({cwd:e,devSessionId:r,event:o,signal:n}){let t=d=>ao({cwd:e,devSessionId:r,runId:o.runId,status:d}),i=await so(e,o);if(i==null){s.warn({runId:o.runId},"teleport could not resolve target"),await t("unplannable");return}process.stdout.write(`ripplo: teleport ${co(o)} step ${String(o.stepIndex+1)}
|
|
36
|
+
`);let l=await Je({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 ao({cwd:e,devSessionId:r,runId:o,status:n}){let t=h(e).match(i=>i,()=>null);t!=null&&await y({config:t,document:no,variables:{devSessionId:r,runId:o,status:n}}).catch(()=>null)}async function so(e,r){if(r.kind==="explore"){let o=await lo(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 lo(e,r){let o=h(e).match(t=>t,()=>null);if(o==null)return null;let n=await y({config:o,document:oo,variables:{id:r}}).catch(()=>null);return n?.run?.reproJson==null?null:le.parse(JSON.parse(n.run.reproJson))}function co(e){return e.kind==="explore"?"explore finding":`${String(e.workflowSlug)}/${String(e.testSlug)}`}function er(){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 uo from"fs";import tr from"net";import{err as ir,ok as po}from"neverthrow";async function ar({cwd:e,onConnection:r}){Y(e);let o=ve(e),n=await rr({onConnection:r,socketPath:o});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(or(o)).mapErr(nr(o)):await fo(o)?ir({kind:"already-running",socketPath:o}):(sr(o),(await rr({onConnection:r,socketPath:o})).map(or(o)).mapErr(nr(o)))}function fo(e){return new Promise(r=>{let o=tr.connect(e);o.once("connect",()=>{o.destroy(),r(!0)}),o.once("error",()=>{r(!1)})})}async function rr(e){let r=await mo(e);return r.kind==="listening"?po(r.server):ir(r.error)}function mo({onConnection:e,socketPath:r}){return new Promise(o=>{let n=tr.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 or(e){return r=>({socketPath:e,close:()=>{r.close(),sr(e)}})}function sr(e){uo.rmSync(e,{force:!0})}function nr(e){return r=>r.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:r.message}}import{randomInt as yo,randomUUID as go}from"crypto";function dr(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=O(e,r);return{priority:"p3",next:()=>Po(e,r),onResult:()=>{},ready:()=>o,status:()=>({attempts:r.attempts,findings:r.findings}),stop:()=>Promise.resolve()}}var So=10;async function O(e,r){if(!r.preparing){r.preparing=!0;try{let o=await e.loadLockfile(),n=o==null?null:await wo(o);if(n==null||o==null)return;r.lockfile=o.lockfile,r.prepared=n,N(r),e.notifyWork()}finally{r.preparing=!1}}}async function wo({lockfile:e,rawHash:r}){let o=await ce(e);return o==null?null:{exploration:o,lockfileHashValue:r,strategy:se("even")}}var vo=6,ho=3e4,ko=2e4;function N(e){e.consecutiveErrors=0,e.driverBackoffUntil=0,e.lastUnhealthyReportMs=0}async function xo(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 O(e,r)}finally{r.refreshing=!1}}}function Po(e,r){xo(e,r);let o=r.prepared;if(o==null||Date.now()<r.driverBackoffUntil)return null;let n=ue({lockfileHash:o.lockfileHashValue,prepared:o.exploration,random:Ro,strategy:{...o.strategy,maxAttemptLength:e.maxTrailLength()}});if(n==null)return null;let t=n.baseStateTest.name;return{id:`explore:${go()}`,label:t,run:i=>Eo({assign:n,params:e,signal:i,state:r})}}var lr=2**31;function Ro(){return yo(lr)/lr}async function Eo({assign:e,params:r,signal:o,state:n}){if(!await r.probeApp()){cr({params:r,reason:"app-unreachable",state:n});return}let t=await r.executeTrail(e,o);if(t.kind==="aborted")return;if(t.kind==="error"){Io({params:r,reason:t.reason,state:n});return}N(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>=So&&bo(n)}function bo(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 Io({params:e,reason:r,state:o}){if(r?.startsWith("lockfile:daemon-load-failed")===!0){Co(e,o);return}cr({params:e,reason:r,state:o})}function Co(e,r){r.preparing||(r.prepared=null,O(e,r))}function cr({params:e,reason:r,state:o}){let n=Lo(r);if(n==="trail"){N(o);return}o.consecutiveErrors+=1,s.debug("exploration infra error: %s",r),!(o.consecutiveErrors<vo)&&(n==="driver"&&(o.driverBackoffUntil=Date.now()+ho),To({params:e,reason:r,state:o}))}function To({params:e,reason:r,state:o}){let n=Date.now();n-o.lastUnhealthyReportMs<ko||(o.lastUnhealthyReportMs=n,s.warn("exploration unhealthy after %d consecutive infra errors (last: %s)",o.consecutiveErrors,r),e.reportUnhealthy())}function Lo(e){return e==="app-unreachable"?"driver":e==null||e==="error"||e.startsWith("transport:")?"infra":e.startsWith("runtime:")?Wo(e.slice(8)):"trail"}function Wo(e){return e==="driver-launch"?"driver":ae(e)?"infra":"trail"}function j(e){return{priority:e,next:()=>null,onResult:()=>{}}}function ur({config:e,executorIsLocal:r,pool:o}){return Ho({appUrl:e.appUrl,cwd:e.cwd,executorIsLocal:r,executeTrail:async(n,t)=>(await o).exploreTrail(n,t)})}function Ho({appUrl:e,cwd:r,executeTrail:o,executorIsLocal:n}){let t={concurrency:2,enabled:!1,maxTrailLength:12},i={notify:()=>{}},a={report:p=>{}},l={report:()=>{}},d=qo({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:()=>t.maxTrailLength,notifyWork:()=>{i.notify()},reportProgress:p=>{a.report(p)},reportUnhealthy:()=>{l.report()}}),u=he({now:Date.now,probe:Mo,setTimer:_o,sources:[j("p0"),j("p1"),d],execute:({job:p,priority:c,signal:f})=>E({headed:!1,workClass:$o(c),task:()=>p.run(f)}),exploreConcurrency:()=>t.concurrency,exploreEnabled:()=>t.enabled&&n()});return _(()=>{u.notifyQueueChange()}),i.notify=()=>{u.notifyQueueChange()},{notifyExecutorChanged:()=>{u.notifyQueueChange()},progress:()=>d.status(),setConcurrency:p=>{n()&&p!==t.concurrency&&s.info({workers:p},"explore local worker count changed"),t.concurrency=p,u.notifyQueueChange()},setEnabled:p=>{t.enabled=p,u.notifyQueueChange()},setMaxTrailLength:p=>{t.maxTrailLength=p},setReportProgress:p=>{a.report=p},setReportUnhealthy:p=>{l.report=p},status:()=>({explorer:Uo(t.enabled,u.stalled()),exploring:u.explorationActive(),progress:d.status()}),stop:()=>{u.stop(),_(null),d.stop()}}}function qo({appUrl:e,cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a}){return dr({cwd:r,executeTrail:o,maxTrailLength:n,notifyWork:t,reportProgress:i,reportUnhealthy:a,loadLockfile:async()=>{let{fingerprint:l,result:d}=await ne(r),u=await I(r);return u==null?null:d.match(async p=>{let c=await me(r,p);return c==null?null:{fingerprint:l,lockfile:c,rawHash:u}},()=>Promise.resolve(null))},probeApp:async()=>await Se(e)==null})}function Uo(e,r){return e?r>0?"stalled":"on":"off"}function Mo(){let e=Ue();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function _o(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 rn}from"gql.tada";import{connect as Oo}from"net";import No from"ssh2";import{WebSocket as fr,createWebSocketStream as jo}from"ws";var Fo="ripplo-";function B(e){return Object.entries(e).map(([r,o])=>`${Fo}${r}.${o}`)}var{Server:Bo,utils:pr}=No;function mr(){let e=pr.generateKeyPairSync("ed25519"),r=pr.parseKey(e.private);if(r instanceof Error)throw r;return{fingerprint:r.getPublicSSH().toString("base64"),privateKey:e.private}}function yr(e){return new Promise((r,o)=>{let n={closers:new Set,stopped:!1},t=new fr(e.relayUrl,B({grant:e.grant,role:"daemon-control"}));t.on("open",()=>{s.info("cloud-executor relay control up"),r({stop:Ko(t,n)})}),t.on("message",i=>{Go(e,n,i)}),t.on("close",(i,a)=>{n.stopped||s.warn({code:i,reason:a.toString()},"relay control closed"),en(e,n)}),t.on("error",i=>{o(i instanceof Error?i:new Error(String(i)))})})}function Ko(e,r){return()=>(r.stopped=!0,r.closers.forEach(o=>{o()}),e.close(),Promise.resolve())}function Go(e,r,o){let n=zo(o);n!=null&&Qo(e,r,n.pipeId)}function zo(e){try{let r=JSON.parse(Jo(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 Jo(e){return Buffer.isBuffer(e)?e.toString("utf8"):Array.isArray(e)?Buffer.concat(e).toString("utf8"):Buffer.from(e).toString("utf8")}function Qo(e,r,o){if(r.stopped)return;let n=new fr(e.relayUrl,B({pipeId:o,role:"daemon-data"}));n.on("open",()=>{Vo(e,r,n)}),n.on("error",t=>{s.warn({err:t},"cloud-executor relay data pipe error")})}function Vo(e,r,o){let n=jo(o);n.on("error",()=>{});let t=new Bo({hostKeys:[e.hostKey.privateKey]},a=>{a.on("error",l=>{s.warn({err:l},"cloud-executor ssh connection error")}),a.on("authentication",l=>{Xo(l,e.secret)}),a.on("ready",()=>{a.on("tcpip",(l,d,u)=>{Zo({accept:l,allowedPorts:e.allowedPorts,deny:d,destPort:u.destPort})})})}),i=()=>{o.close()};r.closers.add(i),o.on("close",()=>r.closers.delete(i)),Yo(t,n)}function Yo(e,r){e.injectSocket(r)}function Xo(e,r){if(e.method==="password"&&e.password===r){e.accept();return}if(e.method==="none"){e.reject(["password"]);return}e.reject()}function Zo({accept:e,allowedPorts:r,deny:o,destPort:n}){if(!r.includes(n)){o();return}let t=!1,i=Oo({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 en(e,r){r.stopped||(r.stopped=!0,r.closers.forEach(o=>{o()}),e.onFatal())}var on=rn(`
|
|
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
|
+
`),T=class extends Error{failure;constructor(r){super(r.kind),this.failure=r}};async function K({config:e,devSessionId:r,onFatal:o}){let n=mr(),i=(await y({config:e,document:on,variables:{devSessionId:r,engineUrl:e.engineUrl,hostKeyFingerprint:n.fingerprint,localUrl:e.appUrl}})).enterCloudMode;if(i==null)throw new T({kind:"empty-response"});if(i.__typename!=="RelaySession")throw new T({kind:"server-error",typename:i.__typename});let a=await yr({allowedPorts:[...new Set([gr(e.appUrl),gr(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 gr(e){let r=new URL(e);return r.port.length>0?Number(r.port):r.protocol==="https:"?443:80}var nn=[1e3,3e3,8e3,15e3];function Sr({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 c=>{let f=o.devSessionId;if(!t()||f==null)return;let m=nn[c];if(m==null){s.warn("tunnel connector gave up; reverting executor to local"),p("local"),$(e,"local");return}if(s.warn({attempt:c+1},"relay tunnel dropped; reconnecting"),await new Promise(w=>setTimeout(w,m)),!(!t()||o.tunnel!=null))try{let w=await K({config:e,devSessionId:f,onFatal:n});if(!t()){await w.stop();return}o.tunnel=w,s.info("relay tunnel reconnected")}catch{i(c+1)}},a=async c=>{let f=await K({config:e,devSessionId:c,onFatal:n});o.tunnel=f,o.mode="cloud",s.info("executor switched to cloud"),r()},l=async()=>{let c=o.tunnel;o.tunnel=void 0,o.mode="local",c!=null&&await c.stop(),s.info("executor switched to local"),r()},d=async c=>{let f=o.devSessionId;if(!(f==null||c===o.mode)){if(c==="cloud"){await a(f);return}await l()}},u=async c=>{s.warn({err:c},"executor switch failed; staying local"),await $(e,"local").catch(()=>{})},p=c=>{o.queue=o.queue.then(()=>d(c).catch(u))};return{request:p,connect:c=>{o.devSessionId=c},current:()=>o.mode,stop:async()=>{await o.queue.catch(()=>{}),await d("local")}}}import{readdir as tn}from"fs/promises";import{existsSync as wr}from"fs";import G from"path";async function vr({config:e,cwd:r}){let o=G.join(r,".ripplo","debug");await(await tn(o,{withFileTypes:!0}).catch(()=>[])).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>!i.startsWith("replay-")&&!i.startsWith("explore-")&&!wr(G.join(o,i,je))&&wr(G.join(o,i,"behavior.jsonl"))).reduce((i,a)=>i.then(()=>Be({config:e,debugDir:o,runId:a}).catch(()=>{})),Promise.resolve(void 0))}import{fork as an}from"child_process";import hr from"os";import{CancellationTokenSource as kr,ResponseError as xr}from"vscode-jsonrpc/node";function Pr(e,r){return()=>{let o=an(e,["run-worker"],{cwd:r,detached:!0,stdio:["ignore","inherit","inherit","ipc"]});return{connection:He(o),kill:()=>{sn(o)},onExit:n=>{o.once("exit",n)}}}}function Rr(e){let r={closed:!1,devSessionId:e.devSessionId,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return Cr(r),{close:async()=>{r.closed=!0,await Promise.all([...r.workers].map(o=>z(o,r)))},execute:(o,n)=>cn(o,n,r),exploreTrail:(o,n)=>pn(o,n,r),routeSpan:(o,n)=>{let t=r.workers.find(i=>i.runId===o);t?.worker.connection.sendNotification(Ae,{runId:o,span:n})},setSize:o=>{mn(o,r)}}}function sn(e){let r=e.pid;if(r!=null)try{process.kill(-r,"SIGKILL")}catch{e.kill("SIGKILL")}}var ln=1e4,dn=1e4,Er=-32800;async function cn(e,r,o){let n=await br(o);if(n.runId=e.runId,!n.alive)return L(n,o),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let t=new kr,i=()=>{t.cancel()};r.aborted&&t.cancel(),r.addEventListener("abort",i,{once:!0});try{let a=await n.worker.connection.sendRequest(Te,e,t.token),l=Ie.safeParse(a);return l.success?l.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(a){return un(a,n)}finally{r.removeEventListener("abort",i),t.dispose(),L(n,o)}}async function br(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=Ir(e);return o.runId="pending",await o.ready,o}return new Promise(o=>{e.waiters.push(n=>{n.runId="pending",o(n)})})}function Ir(e){let r=e.spawn(),o={resolve:()=>{}},n={alive:!0,id:e.nextId,ready:new Promise(t=>{o.resolve=t,r.connection.onNotification(Ce,t)}),runId:void 0,worker:r};return e.nextId+=1,r.connection.onRequest(Le,()=>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 L(e,r){if(e.runId=void 0,!e.alive||r.closed)return;if(r.workers.length>r.size){z(e,r);return}let o=r.waiters.shift();o?.(e)}async function z(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(De).catch(()=>{});let n=setTimeout(()=>{e.worker.kill()},ln);await o,clearTimeout(n)}function un(e,r){return e instanceof xr&&e.code===Er?{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 pn(e,r,o){let n=await br(o);if(n.runId="explore",!n.alive)return L(n,o),{kind:"error"};let t=new kr,i={cancel:()=>{}},a=()=>{t.cancel();let l=setTimeout(()=>{n.worker.kill()},dn);i.cancel=()=>{clearTimeout(l)}};r.aborted&&a(),r.addEventListener("abort",a,{once:!0});try{let l=await n.worker.connection.sendRequest(We,{assign:e,devSessionId:o.devSessionId},t.token),d=de.safeParse(l);return d.success?d.data:{kind:"error"}}catch(l){return fn(l)}finally{i.cancel(),r.removeEventListener("abort",a),t.dispose(),L(n,o)}}function fn(e){return e instanceof xr&&e.code===Er?{kind:"aborted"}:{kind:"error",reason:`transport:${e instanceof Error?e.message.slice(0,120):"unknown"}`}}function mn(e,r){r.size=e,e>hr.availableParallelism()&&s.warn({cores:hr.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=>{z(t,r)}),Cr(r)}function Cr(e){e.closed||Array.from({length:Math.max(0,e.size-e.workers.length)}).forEach(()=>{Ir(e)})}import W from"fs";import yn from"p-retry";import{graphql as x}from"gql.tada";import{print as A}from"graphql";var gn=x(`
|
|
66
|
+
query DaemonExploration($devSessionId: String!) {
|
|
67
|
+
exploration(devSessionId: $devSessionId) {
|
|
68
|
+
active
|
|
69
|
+
localWorkers
|
|
70
|
+
maxTrailLength
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`),Sn=x(`
|
|
74
|
+
subscription WatchExplorationChanged($devSessionId: String!) {
|
|
75
|
+
explorationChanged(devSessionId: $devSessionId) {
|
|
76
|
+
exploration {
|
|
77
|
+
active
|
|
78
|
+
localWorkers
|
|
79
|
+
maxTrailLength
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`);function Tr({config:e,devSessionId:r,machinery:o,sseClient:n}){return yn(()=>wn({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:A(Sn),variables:{devSessionId:r}},{complete:()=>{},error:t=>{s.error(t,"exploration subscription error")},next:t=>{Lr(o,t.data?.explorationChanged.exploration)}})}async function wn({config:e,devSessionId:r,machinery:o}){let n=await y({config:e,document:gn,variables:{devSessionId:r}});Lr(o,n.exploration)}function Lr(e,r){r!=null&&(e.setMaxTrailLength(r.maxTrailLength),e.setConcurrency(r.localWorkers),e.setEnabled(r.active))}function Wr({config:e,devSessionId:r,machinery:o}){o.setReportProgress(n=>{Ge({attempts:n.attempts,config:e,devSessionId:r,findings:n.findings,trail:Ke(n.result)}).catch(t=>{s.warn({error:t},"exploration progress report failed")})}),o.setReportUnhealthy(()=>{ze(e,r).catch(n=>{s.warn({error:n},"exploration unhealthy report failed")})})}var vn=x(`
|
|
84
|
+
subscription HooksPausedWatch($projectId: String!) {
|
|
85
|
+
hooksPausedRequested(projectId: $projectId) {
|
|
86
|
+
paused
|
|
87
|
+
projectId
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`),hn=x(`
|
|
91
|
+
subscription WatchLocalConcurrencyChanged {
|
|
92
|
+
myMaxLocalConcurrentRunsChanged
|
|
93
|
+
}
|
|
94
|
+
`);function Ar({pool:e,sseClient:r}){return r.subscribe({query:A(hn)},{complete:()=>{},error:o=>{s.error(o,"localConcurrency subscription error")},next:o=>{let n=o.data?.myMaxLocalConcurrentRunsChanged;n!=null&&(b(n),e.setSize(n))}})}var kn=x(`
|
|
95
|
+
subscription WatchExecutorChangeRequested($devSessionId: String!) {
|
|
96
|
+
executorChangeRequested(devSessionId: $devSessionId) {
|
|
97
|
+
executor
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`);function Dr({config:e,devSessionId:r,sseClient:o,switcher:n}){return n.connect(r),xn({config:e,switcher:n}),Pn({devSessionId:r,sseClient:o,switcher:n})}async function xn({config:e,switcher:r}){let o=await Qe(e);if(o.isErr()){s.warn({error:o.error},"initial executor fetch failed, staying local");return}r.request(o.value)}function Pn({devSessionId:e,sseClient:r,switcher:o}){return r.subscribe({query:A(kn),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 Hr({cwd:e,projectId:r,sseClient:o}){return o.subscribe({query:A(vn),variables:{projectId:r}},{complete:()=>{},error:n=>{s.error(n,"hooksPaused subscription error")},next:n=>{let t=n.data?.hooksPausedRequested?.paused;t!=null&&J({cwd:e,paused:t})}})}function J({cwd:e,paused:r}){let o=we(e);if(r&&!W.existsSync(o)){W.writeFileSync(o,"");return}!r&&W.existsSync(o)&&W.unlinkSync(o)}var Cn=6e4,qr=500,Tn=15e3,Ur=6e4,Ln=3,Wn=Q(`
|
|
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
|
+
`),An=Q(`
|
|
113
|
+
query WatchLocalConcurrency {
|
|
114
|
+
currentUser {
|
|
115
|
+
id
|
|
116
|
+
maxLocalConcurrentRuns
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`),Dn=Q(`
|
|
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 ra(){Vn();let e=Gn(process.cwd()),r=e.cwd,o=On(r),{executorSwitch:n,exploration:t,poolGate:i}=Hn(e),a={handler:()=>{}},l=jn(),d=er(),u=Ne({config:e,cwd:r,executor:n.current,explorationStatus:t.status,ready:l.promise,onShutdownRequest:()=>{a.handler()},sseHealth:()=>d.snapshot()}),p=await Bn({cwd:r,ipc:u,releasePid:o}),c=await U(r);c.isErr()&&(process.stderr.write(`ripplo: ${M(c.error)}
|
|
132
|
+
`),process.exit(1));let f=c.value,m=await Mr(()=>$e({config:e,cwd:r,lockfile:f}),{config:e,label:"initial sync"}),w=await I(r);w!=null&&Fe(w),qe({config:e,cwd:r,lockfile:f});let P=await Xn(e);J({cwd:r,paused:m.hooksPaused});let g=Me(r);g!=null&&s.info("watching branch %s in %s",g,r);let S=En({headers:{Authorization:`Bearer ${e.token}`},retry:Ye,retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`});vr({config:e,cwd:r}).catch(()=>{});let v=Fn({cwd:r,devSessionId:m.devSessionId,initialConcurrency:P});i.provide(v);let D=await qn({cwd:r,pool:v}),H=_n({claim:u.claim,config:e,cwd:r,initialId:m.devSessionId,pool:v,sseClient:S,sseHealth:d}),_r=Dr({config:e,devSessionId:m.devSessionId,sseClient:S,switcher:n}),$r=Hr({cwd:r,projectId:e.projectId,sseClient:S}),Fr=Ar({pool:v,sseClient:S}),Or=Tr({config:e,devSessionId:m.devSessionId,machinery:t,sseClient:S});Wr({config:e,devSessionId:m.devSessionId,machinery:t});let Nr=Mn({config:e,session:H}),jr=Qn();l.resolve(),Un(m.devSessionId);let Br=async()=>{Nr(),jr(),t.stop(),p.close(),H.stop(),_r(),$r(),Fr(),Or(),await v.close(),await n.stop(),await D.stop().catch(()=>{}),await Promise.race([y({config:e,document:Dn,variables:{cwd:e.cwd,devSessionId:H.getId(),projectId:e.projectId}}).catch(()=>{}),new Promise(Kr=>setTimeout(Kr,3e3))]),o()},k=()=>{Br().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 Hn(e){let r={handler:()=>{}},o=Sr({config:e,onChanged:()=>{r.handler()}}),n=Kn(),t=ur({config:e,pool:n.pool,executorIsLocal:()=>o.current()==="local"});return r.handler=t.notifyExecutorChanged,{executorSwitch:o,exploration:t,poolGate:n}}function qn({cwd:e,pool:r}){return pe({localDir:Rn.join(e,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:o=>{let n=o.attributes["ripplo.run"];n!=null&&r.routeSpan(n,o)}})}function Un(e){process.stdout.write(`${Re({devSessionId:e,version:oe()})}
|
|
133
|
+
`)}function Mn({config:e,session:r}){let o=async()=>{try{let t=await y({config:e,document:Wn,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()},Tn);return()=>{clearInterval(n)}}function _n({claim:e,config:r,cwd:o,initialId:n,pool:t,sseClient:i,sseHealth:a}){let l=n,d=null,u=0,p=0,c=g=>{P(g)},f=()=>{let g=Xe({claim:e,cwd:o,devSessionId:l,onSubscriptionDead:c,pool:t,sseClient:i,sseHealth:a}),S=Ze({cwd:o,devSessionId:l,onSubscriptionDead:c,sseClient:i});return()=>{g(),S()}},m=f(),w=async g=>{let S=Date.now();u=S-p>Ur*2?1:u+1,p=S,u>=Ln&&a.markUnhealthy(g),await $n(Math.min(1e3*2**(u-1),Ur));let v=await U(o);if(v.isErr()){s.error("re-register: compile failed: %s",M(v.error));return}let D=await Mr(()=>_e({config:r,cwd:o,lockfile:v.value}),{config:r,label:"re-register sync"});m(),l=D.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 Fn({cwd:e,devSessionId:r,initialConcurrency:o}){return Rr({devSessionId:r,initialSize:o,spawn:Pr(Zn(),e),lockfileProvider:async()=>{let n=await R(e);if(n.isErr())return{unavailable:`daemon-load-failed:${n.error.kind}`};let t=await fe(e,n.value);return{lockfileJson:Z(ee,t)}}})}function On(e){try{return ge({cwd:e,onCompromised:Nn})}catch(r){throw r instanceof ye&&(process.stderr.write(`${Ee({cwd:r.cwd,pid:r.pid})}
|
|
134
|
+
`),process.exit(1)),r}}function Nn(){s.error("daemon lock compromised; shutting down"),process.stderr.write(`${be()}
|
|
135
|
+
`),process.exit(1)}function jn(){let e={handler:()=>{}};return{promise:new Promise(o=>{e.handler=o}),resolve:()=>{e.handler()}}}async function Bn({cwd:e,ipc:r,releasePid:o}){return(await ar({cwd:e,onConnection:r.handleConnection})).match(t=>t,t=>{process.stderr.write(`${ke(t)}
|
|
136
|
+
`),o(),process.exit(1)})}function Kn(){let e={provide:()=>{}};return{pool:new Promise(o=>{e.provide=o}),provide:o=>{e.provide(o)}}}function Gn(e){return h(e).match(r=>r,r=>{process.stderr.write(`${te(r)}
|
|
137
|
+
`),process.exit(1)})}function Mr(e,{config:r,label:o}){let n=r.ripploServerUrl.includes("localhost")||r.ripploServerUrl.includes("127.0.0.1");return bn(async()=>{try{return await e()}catch(t){zn({config:r,error:t});let i=t instanceof Error?t.message:String(t);throw Jn(i)?t:(s.error("%s failed: %s",o,i),new In(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 zn({config:e,error:r}){let o=V(r);o==="UNAUTHENTICATED"&&(process.stderr.write(`ripplo: ${Pe()}
|
|
138
|
+
`),process.exit(1)),o==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${xe({projectId:e.projectId,serverUrl:e.ripploServerUrl})}
|
|
139
|
+
`),process.exit(1))}function Jn(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function Qn(){q({maxRuns:qr});let e=setInterval(()=>{q({maxRuns:qr})},Cn);return()=>{clearInterval(e)}}function Vn(){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 Yn=4;async function Xn(e){try{let o=(await y({config:e,document:An,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(o!=null)return b(o),o}catch(r){s.warn({err:r},"failed to fetch local concurrency setting; using default")}return Yn}function Zn(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}export{ra as runDaemon};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-
|
|
4
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-M7VQD4VO.js";import"./chunk-ESOXRGIY.js";import"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{b as renderDaemonBindError,h as renderDaemonLockCompromised,f as renderDaemonLockHeld,e as renderDaemonReady,i as renderDaemonStatus,g as renderDaemonStopResult,k as renderDaemonVersionNote,j as renderExplorationProgress,d as renderNotSignedIn,c as renderProjectAccessDenied,a as renderTunnelProvisionFailed,l as wireOutcome};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
4
|
+
import{a,b,c,d,e,f}from"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.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 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
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-
|
|
4
|
+
import{e as a,f as b,g as c,h as d}from"./chunk-AQ3DMGAY.js";import"./chunk-5SM4TCSW.js";import"./chunk-KMZ3L5YA.js";export{a as LOCKFILE_RELATIVE_PATH,d as loadRipplo,b as loadRipploCached,c as loadRipploCachedWithFingerprint};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{f as r}from"./chunk-
|
|
4
|
+
import{f as r}from"./chunk-4W6WIT7T.js";import{c as s}from"./chunk-KOKEEAEF.js";import{a as n}from"./chunk-MHNGR6M7.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import t from"fs";import a from"os";import l from"path";var w=s("PreToolUse",o=>{if(o.tool_name!=="ExitPlanMode"||!r(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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
3
|
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{a as o,c as s}from"./chunk-
|
|
4
|
+
import{a as o,c as s}from"./chunk-WHSQBXWO.js";import{a as i}from"./chunk-R4ZTRVDQ.js";import{c as e}from"./chunk-FEHVIHVA.js";import"./chunk-KOKEEAEF.js";import{a as r}from"./chunk-CJUKILIO.js";import"./chunk-KMZ3L5YA.js";o();e(process.cwd());r(i());s(process.argv[2]??"").catch(async t=>{let{renderTopLevelError:p}=await import("./cli-error-SLG6JHK2.js");process.stderr.write(`${p(t)}
|
|
5
5
|
`),process.exit(1)});
|