ripplo 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +18 -142
  2. package/dist/index.js +56 -643
  3. package/package.json +7 -43
  4. package/dist/assets/browser-trace.js +0 -1
  5. package/dist/assets/rrweb.js +0 -54
  6. package/dist/capture-worker.js +0 -13892
  7. package/dist/chunk-47LLHHJH.js +0 -9
  8. package/dist/chunk-5HFJIZLI.js +0 -4
  9. package/dist/chunk-5JXP37ET.js +0 -4
  10. package/dist/chunk-5PICILBD.js +0 -9
  11. package/dist/chunk-7WZ3VIUU.js +0 -4
  12. package/dist/chunk-ANAQCK5G.js +0 -4
  13. package/dist/chunk-AUXGLJ3J.js +0 -8
  14. package/dist/chunk-AXROBTLA.js +0 -4
  15. package/dist/chunk-BGY5F3IU.js +0 -5
  16. package/dist/chunk-BTIQ5H3K.js +0 -4
  17. package/dist/chunk-C7SV6AR2.js +0 -48
  18. package/dist/chunk-CI6273ZU.js +0 -107
  19. package/dist/chunk-EVEITUJH.js +0 -4
  20. package/dist/chunk-EYILCSW6.js +0 -11
  21. package/dist/chunk-F4UCCW7Q.js +0 -83
  22. package/dist/chunk-FEHVIHVA.js +0 -5
  23. package/dist/chunk-G6J2WIHJ.js +0 -4
  24. package/dist/chunk-HEOMRXZE.js +0 -4
  25. package/dist/chunk-IRT6UHD3.js +0 -61
  26. package/dist/chunk-IVW5DUE4.js +0 -360
  27. package/dist/chunk-JJ4QQPAV.js +0 -4
  28. package/dist/chunk-JPXTGKSB.js +0 -7
  29. package/dist/chunk-JS3DLVVI.js +0 -4
  30. package/dist/chunk-KH4QH23U.js +0 -4
  31. package/dist/chunk-KL6TIUNF.js +0 -4
  32. package/dist/chunk-KMZ3L5YA.js +0 -4
  33. package/dist/chunk-KOKEEAEF.js +0 -6
  34. package/dist/chunk-KOZTQJBB.js +0 -56
  35. package/dist/chunk-MHNGR6M7.js +0 -4
  36. package/dist/chunk-NNH3YVVO.js +0 -4
  37. package/dist/chunk-NUBMOTH6.js +0 -6
  38. package/dist/chunk-O4A5UISQ.js +0 -6
  39. package/dist/chunk-OQ6KNYPG.js +0 -4
  40. package/dist/chunk-PYDYI3AA.js +0 -23
  41. package/dist/chunk-QQ6VKZ6A.js +0 -5
  42. package/dist/chunk-QSKOYBDO.js +0 -8
  43. package/dist/chunk-R4ZTRVDQ.js +0 -4
  44. package/dist/chunk-RIASQHPG.js +0 -4
  45. package/dist/chunk-RXLDAR2J.js +0 -13
  46. package/dist/chunk-SXVWB7TZ.js +0 -6
  47. package/dist/chunk-T6WA2F3S.js +0 -16
  48. package/dist/chunk-XAMVRZJH.js +0 -23
  49. package/dist/chunk-XPOOWIRL.js +0 -4
  50. package/dist/cli-error-7LCAN3Z5.js +0 -4
  51. package/dist/compile-write-Y5III4OM.js +0 -4
  52. package/dist/daemon-6UYMYGPI.js +0 -175
  53. package/dist/daemon-EITBDEP7.js +0 -4
  54. package/dist/daemon-lock-RPKO5SNE.js +0 -4
  55. package/dist/dsl-loader-ASNZDV7E.js +0 -4
  56. package/dist/dsl-typecheck-worker.js +0 -6
  57. package/dist/exit-plan-gate-44YWEKYS.js +0 -4
  58. package/dist/hook.js +0 -5
  59. package/dist/plan-reminder-6VWOS6HD.js +0 -4
  60. package/dist/post-edit-A5Y26UH5.js +0 -4
  61. package/dist/post-edit-analyze-2SBNWX6Y.js +0 -4
  62. package/dist/post-edit-flag-stubs-I43B5QPO.js +0 -4
  63. package/dist/pre-bash-run-gate-CDFNAIK3.js +0 -4
  64. package/dist/pre-edit-HJVNM7U5.js +0 -4
  65. package/dist/pre-edit-ripplo-skill-gate-A6ETC3QN.js +0 -4
  66. package/dist/pre-edit-scope-gate-HNIQ7KOQ.js +0 -4
  67. package/dist/pre-edit-watch-gate-G6BVWIDL.js +0 -4
  68. package/dist/prompt-submit-OXYVNXHK.js +0 -4
  69. package/dist/scope-reminder-A6GVTTVE.js +0 -4
  70. package/dist/session-preamble-IZQPIWST.js +0 -4
  71. package/dist/status-XUIBJXNP.js +0 -4
  72. package/dist/stop-enforce-BP6IIW3D.js +0 -64
  73. package/dist/tasks-reminder-TDWPD3KV.js +0 -4
  74. package/dist/track-skill-load-SXSDMHFO.js +0 -4
  75. package/dist/track-skill-prompt-7N4TQAD2.js +0 -4
@@ -1,9 +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 o}from"./chunk-OQ6KNYPG.js";import{a as i}from"./chunk-MHNGR6M7.js";function y(n){if(n.length===0)return"No open tasks.";let e=n.map(r=>` [${a(r.status)}] [${r.kind}] (${r.id}) ${l(r)}`);return[`${o(n.length,"open task")}:`,...e].join(`
5
- `)}function m(n){let e=`[${a(n.status)}] [${n.kind}] (${n.id}) ${n.title??""}`.trim(),r=n.messages.flatMap(t=>u(t));return[e,...r,"",$()].join(`
6
- `)}function x(n){let e=n.map(r=>` [${a(r.status)}] [${r.kind}] (${r.id}) ${l(r)}`);return[`New or updated Ripplo tasks (${o(n.length,"open task")}):`,...e,i("tasks","picking each up")].join(`
7
- `)}function T(n){let{task:e}=n,r=e.title??e.latestMessage??"(no description)",t=i("tasks");return n.type==="new"?`New task [${e.kind}] (${e.id}) ${r} \u2014 ${t}`:n.type==="reopened"?`Reopened task (${e.id}) ${r} \u2014 earlier resolution didn't hold. ${t}`:`User replied on task (${e.id}): ${e.latestMessage??r} \u2014 ${t}`}function b(n){return`No task with id ${n}. List them with \`npx ripplo tasks list\`.`}function w(n){return`Commented on task ${n}.`}function S(){return"Clarification needs a message \u2014 say what's ambiguous and what you need."}function N(n,e){let r=e==null?"an element node's id":`its parent element id ${String(e)}`;return`rrweb id ${String(n)} is a text node \u2014 no box to highlight. Anchor to ${r}.`}function M(n,e){return`rrweb id ${String(n)} is not in run ${e}. Pick an element id from .ripplo/debug/${e}/behavior.jsonl.`}function A(n){return`rrweb id ${String(n)} is not an element node. Anchor to an element so it can be highlighted.`}function R(n){return`Resolved task ${n}.`}function C(n){return`Started task ${n} \u2014 in progress until resolved, dismissed, or sent back for clarification.`}function I(n){return`Marked task ${n} as needing clarification \u2014 the user will follow up.`}function v(n){return`Dismissed task ${n}.`}function a(n){return n==="needsClarification"?"needs clarification":n}function l(n){return n.title??n.lastMessage??"(no description)"}function u(n){let e=n.authorName??n.author;return n.runId==null?[` ${e}: ${n.body}`]:[` ${e} @ ${n.runId}${c(n.frameMs)}: ${n.body}`,...p(n,n.runId)]}function c(n){return n==null?"":` (${String(n)}ms)`}function p(n,e){let r=f(n),t=n.frameMs==null?null:` see it: npx ripplo snapshot ${e} --offset ${String(n.frameMs)}`;return[r,t].filter(s=>s!=null)}function f(n){return n.element!=null?` element: ${g(n.element)}`:n.rrwebId==null?null:` element: rrweb id ${String(n.rrwebId)}`}function g(n){let e=n.role==null?"":`[role=${n.role}]`,r=n.testId==null?"":` testid=${n.testId}`,t=n.ariaName==null?"":` aria="${n.ariaName}"`,s=n.text==null?"":` "${n.text}"`,d=n.selector==null?"":`
8
- selector: ${n.selector}`;return`${n.tagName??"element"}${e}${r}${t}${s}${d}`}function $(){return["Snapshot the frame above and Read the PNG \u2014 the rendered frame is the evidence, not the thread text.","Read the whole run with `npx ripplo explain <runId>` \u2014 auto-pulls a cloud run's stream if not on disk.","Add `--full` for the synthesized starting state and a step-by-step timeline.",i("tasks","picking this up")].join(`
9
- `)}export{y as a,m as b,x as c,T as d,b as e,w as f,S as g,N as h,M as i,A as j,R as k,C as l,I as m,v as n};
@@ -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{b as n}from"./chunk-G6J2WIHJ.js";import{a}from"./chunk-7WZ3VIUU.js";import{f as s}from"./chunk-KH4QH23U.js";import l from"path";import*as r from"zod/mini";var p=new Set(["Edit","Write","NotebookEdit"]),c=r.looseObject({file_path:r.string()}),d="create",k=o=>{if(!p.has(o.tool_name))return;let i=c.safeParse(o.tool_input);if(!i.success)return;let{cwd:e}=o;if(!a(e)||!s(e))return;let t=l.relative(e,i.data.file_path);if(!(t.startsWith("..")||t!==".ripplo"&&!t.startsWith(".ripplo/"))&&!n(e,o.session_id,d))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Editing \`.ripplo/\` files (${t}) requires the \`/ripplo:create\` skill loaded first. Load \`/ripplo:create\` and retry. It contains the current state model, workflow authoring model, and DSL rules.`}}};export{k as a};
@@ -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{Na as $,U as M,V as _,qa as z,ra as I,sa as g}from"./chunk-KOZTQJBB.js";import w from"fs";import s from"path";import{createHash as ve}from"crypto";import{pathToFileURL as Me}from"url";import{build as _e}from"esbuild";import{err as l,ok as F,ResultAsync as ze}from"neverthrow";import b from"fs";import{execFile as se}from"child_process";import{promisify as ae}from"util";import{fileURLToPath as C}from"url";import{z as L}from"zod";var ce=ae(se),le=L.object({diagnostics:L.array(L.string()),ok:L.boolean()});async function H(e){let r=de(),{stdout:n}=await ce(process.execPath,[...r.args,e],{maxBuffer:10*1024*1024}),t=JSON.parse(n);return le.parse(t)}function de(){let e=C(new URL("dsl-typecheck-worker.js",import.meta.url));if(b.existsSync(e))return{args:[e]};let r=C(new URL("../../dist/dsl-typecheck-worker.js",import.meta.url));if(b.existsSync(r))return{args:[r]};let n=C(new URL("../dsl-typecheck-worker.ts",import.meta.url));if(b.existsSync(n))return{args:["--experimental-strip-types",n]};throw new Error("DSL typecheck worker missing")}import ge from"safe-stable-stringify";import{err as he,ok as K,Result as ke}from"neverthrow";import{z as xe}from"zod";import k from"fs";import U from"path";import{z as u}from"zod";import{createHash as ue}from"crypto";function c(e){return ue("sha256").update(e).digest("base64")}var fe="fd5",pe="fold5";function T(){return`${String(g.currentVersion)}:${fe}:${pe}`}function x(e){return c([T(),...e].join("\0"))}function R({cwd:e,key:r,kind:n}){return D(e,n)?.entries.find(([o])=>o===r)?.[1]}function P({cwd:e,keep:r,key:n,kind:t,value:o}){let p=(D(e,t)?.entries??[]).filter(([a])=>a!==n),S=[n,o],v=[...p,S].slice(-r),y=N(e,t),d={entries:v,epoch:T()};k.mkdirSync(U.dirname(y),{recursive:!0}),k.writeFileSync(y,JSON.stringify(d)),h=new Map([...h,[y,{signature:B(y),store:d}]])}var ye=u.object({entries:u.array(u.tuple([u.string(),u.unknown()])),epoch:u.string()}),h=new Map;function D(e,r){let n=N(e,r),t=B(n),o=h.get(n);if(o!=null&&o.signature===t)return o.store;let i=me({signature:t,storePath:n});return h=new Map([...h,[n,{signature:t,store:i}]]),i}function me({signature:e,storePath:r}){if(e!=null)try{let n=ye.safeParse(JSON.parse(k.readFileSync(r,"utf8")));return!n.success||n.data.epoch!==T()?void 0:n.data}catch{return}}function B(e){if(!k.existsSync(e))return;let r=k.statSync(e);return`${String(r.mtimeMs)}:${String(r.size)}`}function N(e,r){return U.join(e,".ripplo",".local","cache",`${r}.json`)}async function J(e,r){let n=await V({cwd:r,workflows:e.workflows});return ke.combine(n).map(t=>({...e,workflows:[...t]}))}var Ee=xe.array(z),X=4;async function V({cwd:e,workflows:r}){if(r.length===0)return[];let n=r.slice(0,X),t=await Promise.all(n.map(i=>we({cwd:e,workflow:i}))),o=await V({cwd:e,workflows:r.slice(X)});return[...t,...o]}async function we({cwd:e,workflow:r}){let n=x(["expand",Se(r)]),t=Ee.safeParse(R({cwd:e,key:n,kind:"expand"}));if(t.success)return K({...r,tests:t.data});try{let o=await $({workflow:r});return P({cwd:e,keep:2e3,key:n,kind:"expand",value:o.tests}),K(o)}catch(o){let i=o instanceof Error?o.message:String(o);return he({kind:"expand-failed",message:i,workflow:r.name})}}function Se(e){let r=ge({...e,tests:[]});if(r==null)throw new Error("solver: workflow is not serializable");return r}import{createHash as Le}from"crypto";import G from"fs/promises";import j from"path";import{err as f,ok as A,Result as Re}from"neverthrow";var Pe=".ripplo/fixtures",Fe=10*1024*1024,be=50*1024*1024;async function Y(e,r){let n=Ce(r);if(n.length===0)return A({});let t=j.join(e,Pe),o=await Promise.all(n.map(i=>Te({fixturesRoot:t,name:i})));return Re.combine(o).andThen(je)}function Ce(e){let n=e.workflows.flatMap(t=>[...t.steps,...t.tests.flatMap(o=>o.steps)]).flatMap(t=>t.action.kind==="upload"?t.action.files:[]);return[...new Set(n)].toSorted((t,o)=>t.localeCompare(o))}async function Te({fixturesRoot:e,name:r}){if(r.includes("..")||j.isAbsolute(r))return f({kind:"fixture-invalid-name",name:r});let n=j.join(e,r),t=await G.lstat(n).catch(()=>null);if(t==null)return f({kind:"fixture-missing",name:r,path:n});if(t.isSymbolicLink())return f({kind:"fixture-symlink",name:r});if(!t.isFile())return f({kind:"fixture-not-file",name:r});let o=await G.readFile(n);if(o.byteLength>Fe)return f({kind:"fixture-too-large",name:r,size:o.byteLength});let i=Le("sha256").update(o).digest("hex");return A([r,{sha256:i,size:o.byteLength}])}function je(e){let r=e.reduce((n,[,t])=>n+t.size,0);return r>be?f({kind:"fixtures-total-too-large",total:r}):A(Object.fromEntries(e))}import Z from"fs";import Ae from"path";import{z as O}from"zod";function q({cwd:e,fingerprint:r}){let n=ee(e);if(n==null||n.fingerprint!==c(r))return;let t=Ae.join(e,".ripplo","ripplo.lock");if(!Z.existsSync(t))return;let o=Z.readFileSync(t,"utf8");if(c(o)===n.lockfileHash)try{let i=_(g,o);return Oe(i)?void 0:i}catch{return}}function Oe(e){return e.workflows.some(({sourcePath:r})=>r?.startsWith(".local/")===!0)}function Q({cwd:e,fingerprint:r,lockfile:n}){re(e,{fingerprint:c(r),lockfileHash:c(M(g,n))})}function jr(e,r){let n=ee(e);n!=null&&re(e,{...n,lockfileHash:c(r)})}var We=O.object({fingerprint:O.string(),lockfileHash:O.string()});function ee(e){let r=We.safeParse(R({cwd:e,key:x(["load"]),kind:"load"}));return r.success?r.data:void 0}function re(e,r){P({cwd:e,keep:1,key:x(["load"]),kind:"load",value:r})}var Br=".ripplo/ripplo.lock",E;async function Nr(e){let{result:r}=await Ie(e);return r}async function Ie(e){let r=te(s.join(e,".ripplo"));if(E!=null&&E.fingerprint===r&&E.result.isOk())return{fingerprint:r,result:E.result};let n=await $e(e);return E={fingerprint:r,result:n},{fingerprint:r,result:n}}async function $e(e){let r=s.join(e,".ripplo"),n=s.join(r,"index.ts"),t=te(r),o=q({cwd:e,fingerprint:t});if(o!=null)return F(o);let i=Xe(n);i.catch(()=>{});let p=await He(r);if(p.isErr())return l(p.error);let S=p.value;if(!S.ok)return l({diagnostics:S.diagnostics,kind:"typecheck-failed"});let d=await(await Je(n,i)).andThen(a=>Ye({entryPath:n,exported:a})).match(async a=>(await Y(e,a)).map(m=>({...a,fixtures:m})).mapErr(m=>({error:m,kind:"fixture-failed"})).asyncAndThen(m=>new ze(J(m,e)).mapErr(ie=>ie)),a=>Promise.resolve(l(a)));return d.isOk()&&Q({cwd:e,fingerprint:t,lockfile:d.value}),d}async function He(e){try{return F(await H(e))}catch(r){return l(ne(r))}}function ne(e){return Ue(e)?{kind:"authoring-error",message:e.message}:{kind:"load-threw",message:Ge(e)}}function Ue(e){return e instanceof Error&&e.name==="RipploAuthoringError"}var De=new Set([".local",".turbo","debug","node_modules","ripplo.lock"]);function te(e){let r=s.join(e,"..","node_modules","@ripplo","testing");return[...W(e),...Ne(s.join(r,"package.json")),...Ke(r)].toSorted((n,t)=>n.localeCompare(t)).join("|")}function W(e){return Be(e).flatMap(r=>{if(De.has(r.name))return[];let n=s.join(e,r.name);if(r.isDirectory())return W(n);let t=oe(n);return t==null?[]:[`${n}:${String(t.mtimeMs)}:${String(t.size)}`]})}function Be(e){try{return w.readdirSync(e,{withFileTypes:!0})}catch{return[]}}function oe(e){try{return w.statSync(e)}catch{return}}function Ne(e){let r=oe(e);return r==null?[]:[`${e}:${String(r.mtimeMs)}:${String(r.size)}`]}function Ke(e){let r=s.join(e,"src");return w.existsSync(r)?W(r):[]}async function Xe(e){let n=(await _e({bundle:!0,entryPoints:[e],format:"esm",logLevel:"silent",platform:"node",sourcemap:"inline",target:"node22",write:!1})).outputFiles[0];if(n==null)throw new Error("dsl bundle produced no output");return n.text}async function Je(e,r){try{let n=await r;process.setSourceMapsEnabled(!0);let t=await import(Ve(e,n)),o=t!=null&&typeof t=="object"&&"default"in t?Reflect.get(t,"default"):t;return F(o)}catch(n){return l(ne(n))}}function Ve(e,r){let n=s.join(s.dirname(e),".local");w.mkdirSync(n,{recursive:!0});let t=ve("sha256").update(r).digest("hex").slice(0,16),o=s.join(n,`dsl-bundle-${t}.mjs`);return w.writeFileSync(o,r),Me(o).href}function Ge(e){return e instanceof Error?e.message:String(e)}function Ye({entryPath:e,exported:r}){if(r==null||typeof r!="object"||!("lockfile"in r))return l({entryPath:e,kind:"not-ripplo"});let n=I.safeParse(Reflect.get(r,"lockfile"));return n.success?F(n.data):l({issues:n.error.issues.map(t=>`${t.path.join(".")}: ${t.message}`),kind:"invalid-lockfile"})}export{c as a,T as b,x as c,R as d,P as e,Pe as f,Fe as g,be as h,jr as i,Br as j,Nr as k,Ie as l,$e as m,te as n};
@@ -1,9 +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 g}from"./chunk-OQ6KNYPG.js";import{c as d}from"./chunk-JS3DLVVI.js";import{c as u}from"./chunk-FEHVIHVA.js";import{a}from"./chunk-MHNGR6M7.js";import{f as t,k as c}from"./chunk-F4UCCW7Q.js";import{Ma as l}from"./chunk-KOZTQJBB.js";var f=3e3;async function U(e){u(e);let r=d(e).unwrapOr(void 0);if(r==null)return null;try{return await fetch(`${r.ripploServerUrl}/health`,{signal:AbortSignal.timeout(f)}),null}catch(n){return{detail:n instanceof Error?n.message:String(n),serverUrl:r.ripploServerUrl}}}function p(e){return e.includes("localhost")||e.includes("127.0.0.1")}import C from"fuse.js";function m(e){let r=h(e.activity),n=E(e);return n.length===0?r:`${r} \u2014 ${n}`}function h(e){switch(e.kind){case"waitingForRunner":return $(e);case"settingUpState":{let r=e.activeSources.length===0?"":` from ${e.activeSources.join(", ")}`;return`${S(e.stage)}${r}`}case"signingIn":return"Signing in the test user";case"startingBrowser":return"Starting the test browser";case"executingStep":return`${`Step ${String(e.stepIndex+1)} of ${String(e.stepCount)}`}: ${y(e.stage)}`;case"finishing":return e.stage==="cleaningUp"?"Cleaning up the test state":"Saving the run result";case"uploadingReplay":return"Uploading the replay"}}function $(e){let r=e.capacity==null?"":` (${String(e.capacity.active)} of ${String(e.capacity.limit)} runners active)`;switch(e.reason){case"cloudCapacity":return`Waiting for cloud capacity${r}`;case"runnerStarting":return"Starting a test runner";case"localRunnerBusy":return"Waiting for an available local runner"}}function S(e){switch(e){case"clearing":return"Clearing existing test state";case"materializing":return"Creating the starting state";case"verifying":return"Verifying the starting state"}}function y(e){switch(e.kind){case"performingAction":return k(e.action);case"waitingForApp":return`Waiting for the app at ${e.path}`;case"readingState":return"Reading application state";case"verifyingEffects":return"Verifying the declared state changes";case"checkingExpectations":return w(e.remaining)}}function k(e){switch(e.kind){case"goto":return`Opening ${e.path}`;case"fill":return`Filling ${e.target}`;case"clear":return`Clearing ${e.target}`;case"click":return`Clicking ${e.target}`;case"dblclick":return`Double-clicking ${e.target}`;case"select":return`Selecting an option in ${e.target}`;case"check":return`Checking ${e.target}`;case"uncheck":return`Unchecking ${e.target}`;case"hover":return`Hovering over ${e.target}`;case"upload":return`Uploading a file through ${e.target}`;case"press":return e.target==null?`Pressing ${e.key}`:`Pressing ${e.key} in ${e.target}`;case"drag":return`Dragging ${e.source} to ${e.target}`;case"actor":return"Switching the signed-in user"}}function w(e){if(e.length===0)return"All expectations passed";let r=e.map(n=>R(n)).join("; ");return`Checking ${String(e.length)} ${e.length===1?"expectation":"expectations"}: ${r}`}function R(e){let r=e.negated?"not ":"";return e.kind==="browser"?`${r}${e.subject}`:`${r}${e.check} ${e.target}`}function E(e){let r=b(e.retry);return[e.deadlineAt==null?null:`${String(Math.max(0,Math.ceil((Date.parse(e.deadlineAt)-Date.now())/1e3)))}s until timeout`,r].filter(i=>i!=null).join(", ")}function b(e){return e==null?null:e.limit==null?`attempt ${String(e.attempt)}`:`attempt ${String(e.attempt)} of ${String(e.limit)}`}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 r=e.known,n=e.unknown.flatMap(o=>I(o,r)),i=n.length>0?[`Did you mean: ${[...new Set(n)].join(", ")}`]:[];return[`Unknown ${e.unknown.length===1?"id":"ids"}: ${e.unknown.join(", ")}`,...i,"Pass a workflow slug for all its tests, or workflow/test for one. Known workflows:",...r.map(o=>` ${o}`)].join(`
5
- `)}}}function W({failed:e,notRun:r,passed:n}){let i=r>0?`, ${String(r)} not run`:"";return`${String(n)} passed, ${String(e)} failed${i} (${String(n+e+r)} total)`}function X({debugDir:e,event:r}){let n=`${r.workflowName} \u2192 ${r.testName}`;if(r.kind==="run-progress")return`${t.dim("progress")} ${n} \u2014 ${m(r.signal)}`;if(r.kind==="test-started")return`${t.dim("run ")} ${n}`;switch(r.outcome.kind){case"pass":return`${t.good("pass")} ${n} ${t.dim(r.runId)}`;case"findings":return[`${t.bad("fail")} ${n} \u2014 ${g(r.outcome.findingLines.length,"finding")}`,...r.outcome.findingLines,c({debugDir:e,runId:r.runId}),`${t.dim("why")} npx ripplo explain ${r.runId}`].join(`
6
- `);case"error":return`${t.bad("error")} ${n} \u2014 ${P(r.outcome.detail)} ${t.dim(r.runId)}`;case"dispatch-error":return`${t.bad("error")} ${n} \u2014 ${v(r.outcome.reason)}`;case"dispatch-timeout":return`${t.bad("error")} ${n} \u2014 not run: dispatch timed out (transient): ${r.outcome.detail}`;case"infra-error":return`${t.bad("error")} ${n} \u2014 not run: Ripplo server unreachable: ${r.outcome.detail}`}}var x={CLOUD_EXECUTOR:"cloud runs are not included on your plan \u2014 upgrade to run in the cloud",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",MEMBER_CEILING:"member ceiling reached for the target plan \u2014 remove members or pick a bigger plan",OVERAGE_CAP:"overage cap reached \u2014 raise the cap or upgrade",REVIEW_QUOTA:"review quota reached for your plan \u2014 set an overage cap or upgrade"};function J({detail:e,serverUrl:r}){return p(r)?`Ripplo server at ${r} not running (${e}). Start the dev server with \`pnpm dev\`.`:`Ripplo server at ${r} unreachable (${e}) \u2014 server-side, not your local environment.`}function V(e){switch(e.code){case"compile-failed":{let r=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for full output.`,...r].join(`
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}
8
- Check the dev session is live (\`npx ripplo doctor\`, ${a("start")}), or pass test ids / --all.`;case"sync-failed":{let r=/401|unauthor/i.test(e.detail)?"\nAuth failure \u2014 run `npx ripplo auth login`.":"";return`Sync to the Ripplo server failed: ${e.detail}${r}`}case"bad-message":return"Daemon rejected the request \u2014 protocol mismatch, rebuild the CLI and restart the daemon."}}function B(e){switch(e.kind){case"spawn-failed":return`Failed to start \`npx ripplo daemon\`: ${A(e.message)}`;case"connect-timeout":return[`Daemon did not come up within ${String(Math.round(e.deadlineMs/1e3))}s.`,`Check ${e.logPath} for startup errors.`,"Common causes: a stale daemon (`npx ripplo daemon stop`, then start it again), another daemon holding the dev lock, or the Ripplo server unreachable."].join(`
9
- `);case"connection-lost":return"Lost the daemon connection mid-run \u2014 it crashed or was killed. Check .ripplo/.local/daemon.log, restart `npx ripplo daemon`.";case"not-running":return"No ripplo daemon running for this directory. Start it with `npx ripplo daemon` as a background process, separate from your app's dev server.";case"bad-frame":return"Malformed frame from the daemon \u2014 version mismatch, rebuild the CLI and restart the daemon."}}function A(e){return e.includes("ENOENT")?`${e} \u2014 node or the CLI entry not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}function P(e){return e==="worker-exit"?"run worker exited before reporting \u2014 usually a stale build. Run `pnpm build`, then `npx ripplo daemon stop` and start it again, then rerun.":e}function v(e){return e.type==="limit"?x[e.code]:`failed to dispatch (${e.detail})`}function I(e,r){return new C(r,{includeScore:!0,threshold:.5}).search(l(e)).slice(0,3).map(i=>i.item)}export{U as a,p as b,m as c,W as d,X as e,J as f,V as g,B as h};
@@ -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 r from"fs";import i from"path";function n(o){return r.existsSync(i.join(o,".ripplo"))}export{n as a};
@@ -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{W as d}from"./chunk-KOZTQJBB.js";import{j as p}from"./chunk-C7SV6AR2.js";import{spawnSync as k}from"child_process";import{existsSync as c,readdirSync as m,readFileSync as j,realpathSync as f,statSync as g}from"fs";import i from"path";var S=2e3;function x(t){if(t!=null)try{return g(f(t)).mtimeMs}catch{return}}function B(t){return k("pnpm",["turbo","run","build","--filter=ripplo..."],{cwd:t,stdio:"inherit"}).status===0}function X(){let t=process.argv[1];return t==null?{kind:"fresh"}:R({cwd:process.cwd(),scriptPath:f(t)})}function R({cwd:t,scriptPath:n}){let o=l(i.dirname(n));if(o!=null&&u(o))return n.includes(`${i.sep}src${i.sep}`)?{kind:"fresh"}:E({bundlePath:n,root:o});let r=l(t);return r!=null&&u(r)?{kind:"foreign-binary",workspaceRoot:r}:{kind:"fresh"}}function l(t){let n=i.dirname(t);return c(i.join(t,"pnpm-workspace.yaml"))?t:n===t?void 0:l(n)}function u(t){let n=i.join(t,"packages","cli","package.json"),o=w(n);return typeof o=="object"&&o!=null&&"name"in o&&o.name==="ripplo"}function w(t){try{return JSON.parse(j(t,"utf8"))}catch{return}}function E({bundlePath:t,root:n}){let o=x(t),r=i.join(n,"packages");if(o==null||!c(r))return{kind:"fresh"};let a=m(r).map(s=>({name:s,src:i.join(r,s,"src")})).filter(s=>c(s.src)).filter(s=>b(s.src)>o+S).map(s=>s.name);return a.length===0?{kind:"fresh"}:{kind:"stale",packages:a,workspaceRoot:n}}function b(t){let n=g(t);if(!n.isDirectory())return n.mtimeMs;let o=m(t).map(r=>b(i.join(t,r)));return Math.max(n.mtimeMs,...o)}import{createHash as P}from"crypto";import M from"os";import I from"path";import{createMessageConnection as q,NotificationType as y,RequestType as v,RequestType0 as h,SocketMessageReader as A,SocketMessageWriter as N}from"vscode-jsonrpc/node";import{z as e}from"zod";var C="daemon.log";function ee(t){let n=P("sha256").update(t).digest("hex").slice(0,16);return I.join(M.tmpdir(),`ripplo-${n}.sock`)}function te(t){return p(t,C)}function ne(t){return q(new A(t),new N(t))}var oe=e.object({all:e.boolean(),headed:e.boolean(),tests:e.array(e.string())}),re=e.object({jobId:e.string(),total:e.number()}),z=e.enum(["no-lockfile","unstamped","dsl-drift","load-failed","model-empty"]),F=e.discriminatedUnion("kind",[e.object({kind:e.literal("off")}),e.object({kind:e.literal("on")}),e.object({kind:e.literal("paused"),reason:e.enum(["interactive-runs","cooldown","loading"]).optional()}),e.object({kind:e.literal("waiting")}),e.object({kind:e.literal("blocked"),reason:z})]),O=e.object({attempts:e.number(),findings:e.number()}),ie=e.object({active:e.number(),bundleMtimeMs:e.number().optional(),explorer:F,exploring:e.number(),progress:O,queued:e.number(),sseHealth:e.object({detail:e.string().optional(),ok:e.boolean()}).optional(),version:e.string().optional()}),L=e.enum(["MAX_RUNS","OVERAGE_CAP","MAX_AGENTS","MAX_CONCURRENT_RUNS","MAX_PROJECTS","CLOUD_EXECUTOR","REVIEW_QUOTA","MEMBER_CEILING"]),U=e.discriminatedUnion("type",[e.object({code:L,type:e.literal("limit")}),e.object({detail:e.string(),type:e.literal("generic")})]),_=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:U}),e.object({detail:e.string(),kind:e.literal("dispatch-timeout")}),e.object({detail:e.string(),kind:e.literal("infra-error")})]),W=e.discriminatedUnion("kind",[e.object({kind:e.literal("run-progress"),runId:e.string(),signal:d,testName:e.string(),workflowName:e.string()}),e.object({kind:e.literal("test-started"),runId:e.string(),testName:e.string(),workflowName:e.string()}),e.object({kind:e.literal("test-outcome"),outcome:_,runId:e.string(),testName:e.string(),workflowName:e.string()})]),se=e.object({event:W,jobId:e.string()}),ae=e.object({failed:e.number(),jobId:e.string(),notRun:e.number(),passed:e.number()}),ce=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")})]),le=new v("ripplo/enqueue"),pe=new h("ripplo/status"),de=new h("ripplo/shutdownIfIdle"),ue=new y("ripplo/jobEvent"),me=new y("ripplo/jobDone");export{x as a,B as b,X as c,ee as d,te as e,ne as f,oe as g,re as h,ie as i,_ as j,se as k,ae as l,ce as m,le as n,pe as o,de as p,ue as q,me as r};
@@ -1,8 +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{h as u}from"./chunk-O4A5UISQ.js";import{f as a}from"./chunk-KL6TIUNF.js";import{a as i}from"./chunk-RXLDAR2J.js";import{l as n}from"./chunk-BTIQ5H3K.js";import{m as e}from"./chunk-5JXP37ET.js";async function x(m){let o=process.cwd(),r=await e(o);r.isErr()&&(process.stderr.write(`${i(r.error)}
5
- `),process.exit(1));let s=n(r.value),t=await a(o);if(m.format==="summary"){s.length>0&&process.stdout.write(`stub workflows: ${s.join(", ")}
6
- `),process.stdout.write(`${u(t)}
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)}
8
- `)}export{x as a};
@@ -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 l}from"./chunk-CI6273ZU.js";import{a as i}from"./chunk-G6J2WIHJ.js";import{a as m}from"./chunk-7WZ3VIUU.js";var s=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,c=o=>{if(!m(o.cwd))return;let t=[...o.prompt.matchAll(s)].map(r=>r[1]).filter(r=>r!=null);if(t.forEach(r=>{i(o.cwd,o.session_id,r)}),t.length===0)return;let e=l(o.cwd,o.session_id);if(e!=null)return{hookSpecificOutput:{additionalContext:e,hookEventName:"UserPromptSubmit"}}};export{c as a};
@@ -1,5 +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 s,c as u}from"./chunk-KH4QH23U.js";import{createHash as d}from"crypto";import{mkdirSync as g,readdirSync as h,readFileSync as p,writeFileSync as m}from"fs";import n from"path";var f=[".ts",".tsx",".js",".jsx"],y=new Set([".local","debug"]);function A(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
- `).filter(e=>e.length>0).filter(e=>f.some(i=>e.endsWith(i))).toSorted((e,i)=>e.localeCompare(i)).forEach(e=>{t.update(e),t.update("\0"),t.update(l(n.join(r,e))),t.update("\0")}),t.digest("hex")):S(r,t)}function D(r,t){try{return p(c(r,t),"utf8").trim()}catch{return null}}function F(r,t,o){let e=c(r,t);g(n.dirname(e),{recursive:!0}),m(e,o)}function S(r,t){let o=n.join(r,".ripplo");return x(o).filter(i=>f.some(a=>i.endsWith(a))).filter(i=>!y.has(i.split(n.sep)[0]??"")).toSorted((i,a)=>i.localeCompare(a)).forEach(i=>{t.update(i),t.update("\0"),t.update(l(n.join(o,i))),t.update("\0")}),t.digest("hex")}function x(r){try{return h(r,{recursive:!0}).filter(t=>typeof t=="string")}catch{return[]}}function l(r){try{return p(r)}catch{return Buffer.alloc(0)}}function c(r,t){return n.join(r,".ripplo",".local",`${t}.hash`)}export{A as a,D as b,F 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{u as O}from"./chunk-F4UCCW7Q.js";import{a as x,b as h,c as f,d as c,e as s,i as w,j as L,m as E}from"./chunk-5JXP37ET.js";import{Pa as v,Qa as S,Sa as P,Ta as b,U as d,V as u,la as g,sa as n,ta as k}from"./chunk-KOZTQJBB.js";import{readFile as D,writeFile as W}from"fs/promises";import H from"path";import{err as C,ok as q}from"neverthrow";import j from"safe-stable-stringify";function m(e){return{...e,checks:void 0}}function y(e,t){return j(m(e))===j(m(t))}import{z as i}from"zod";function R({cwd:e}){let t=K.safeParse(c({cwd:e,key:p(),kind:"verdicts"}));t.success&&(P(new Map(Object.entries(t.data.cosat))),v(new Map(Object.entries(t.data.subsume))))}function F({cwd:e}){let t=b(),o=S();s({cwd:e,keep:8,key:p(),kind:"verdicts",value:{cosat:Object.fromEntries(t),subsume:Object.fromEntries(o)}})}function Z({cwd:e}){let t=M.safeParse(c({cwd:e,key:p(),kind:"lint-clean"}));return t.success?t.data.cleanLockfile:void 0}function $({cleanLockfileHash:e,cwd:t}){e!=null&&s({cwd:t,keep:8,key:p(),kind:"lint-clean",value:{cleanLockfile:e}})}function ee(e){return x(e)}var K=i.object({cosat:i.record(i.string(),i.boolean()),subsume:i.record(i.string(),i.boolean())}),M=i.object({cleanLockfile:i.string()});function p(){return f(["patterns"])}import I from"safe-stable-stringify";async function de(e){let t=await E(e);return t.isOk()&&await J(e,t.value),t}async function J(e,t){let o=await T(e,t),r=d(n,o);return await W(H.join(e,L),r),w(e,r),o}var A=new WeakMap;function T(e,t){let o=A.get(t);if(o!=null)return o;let r=V(e,t).then(a=>a.match(l=>Promise.resolve(l),()=>_(e,t)));return A.set(t,r),r}function ue(e,t){return V(e,t)}function ke(e){return e.workflows.filter(t=>t.stub).map(t=>t.name)}async function he(e,t){let o=await B(e);return o==null?"missing":o.checks==null?"stale":y(o,t)?"match":"stale"}async function V(e,t){let o=await B(e);return o==null?C({kind:"no-lockfile"}):o.checks==null||o.checks.epoch!==h()?C({kind:"unstamped"}):y(o,t)?q(k(o)):C({kind:"dsl-drift"})}async function B(e){try{let t=await D(H.join(e,L),"utf8");return u(n,t)}catch{return null}}function _(e,t){R({cwd:e});let o={...z(e,t),epoch:h()};F({cwd:e});let r={...t,checks:o};return k(u(n,d(n,r)))}function z(e,t){let o=I(m(t)),r=f(["checks",o]),a=g.safeParse(c({cwd:e,key:r,kind:"checks"}));if(a.success)return a.data;let l=O(t);return s({cwd:e,keep:4,key:r,kind:"checks",value:l}),l}export{m as a,y as b,R as c,F as d,Z as e,$ as f,ee as g,de as h,J as i,T as j,ue as k,ke as l,he as m};
@@ -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{c as b}from"./chunk-HEOMRXZE.js";import{a as F}from"./chunk-NNH3YVVO.js";import{b as O}from"./chunk-KMZ3L5YA.js";var U=15e3,G=3,L=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}},u=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 u)return e.errors[0]?.extensions?.code}var j={attempts:G,timeoutMs:U},V={attempts:1,timeoutMs:3e3};async function E(e){return T(e,j)}async function W(e){return T(e,V)}async function T(e,r){let{print:t}=await import("graphql"),n=t(e.document),o=JSON.stringify({query:n,variables:e.variables}),a=`${e.config.ripploServerUrl}/graphql`,s=await B({init:{body:o,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json",...b()},method:"POST"},policy:r,serverUrl:e.config.ripploServerUrl,url:a}),l=await J({res:s,url:a});if(!Q(l))throw new Error("Invalid GraphQL response");if(X(l))throw new u(l.errors);if(l.data==null)throw new Error("No data returned from server");return l.data}async function B({init:e,policy:r,serverUrl:t,url:n}){let o=1,a=await x({init:e,timeoutMs:r.timeoutMs,url:n});for(;a.retryable&&o<r.attempts;)await K(H(o)),o+=1,a=await x({init:e,timeoutMs:r.timeoutMs,url:n});let{response:s}=a;if(s!=null&&s.status<500)return s;throw new f({detail:s==null?a.detail:`server returned status ${String(s.status)}`,serverUrl:t})}async function x({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 H(e){return L*3**(e-1)*(.5+Math.random())}function K(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 X(e){return Array.isArray(e.errors)&&e.errors.length>0}import Y from"pino";import z from"pino-pretty";var y=Y({level:process.env.LOG_LEVEL??"info"},z({ignore:"pid,hostname"}));import{readdir as Z,rm as ee,stat as re}from"fs/promises";import{existsSync as k}from"fs";import w from"path";var v=".uploaded";var C=w.join(process.cwd(),".ripplo","debug"),D=360*60*1e3;async function te({maxRuns:e}){try{let t=(await Z(C,{withFileTypes:!0})).filter(i=>i.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async i=>{let m=w.join(C,i.name),$=await re(m);return{dirPath:m,mtime:$.mtimeMs,pendingUpload:ne(m)}})),a=o.filter(i=>n-i.mtime>D),s=o.filter(i=>n-i.mtime<=D&&!i.pendingUpload).toSorted((i,m)=>m.mtime-i.mtime).slice(e),l=[...a,...s];if(l.length===0)return;await Promise.allSettled(l.map(i=>ee(i.dirPath,{force:!0,recursive:!0}))),y.debug("Pruned %d old debug run(s)",l.length)}catch{y.warn("Debug run pruning failed, ignoring")}}function ne(e){return k(w.join(e,"behavior.jsonl"))&&!k(w.join(e,v))}import d from"fs";import oe from"os";import g from"path";var ie=".local",ae=".ripplo";function h(e){return g.join(e,".ripplo",ie)}function se(e){let r=h(e);d.existsSync(r)||d.mkdirSync(r,{recursive:!0});let t=g.join(r,".gitignore");return d.existsSync(t)||d.writeFileSync(t,`*
5
- `),r}function le(e,r){return g.join(h(e),r)}function P(){return g.join(oe.homedir(),ae)}function S(){let e=P();return d.existsSync(e)?d.chmodSync(e,448):d.mkdirSync(e,{mode:448,recursive:!0}),e}function A(e){return g.join(P(),e)}import{Agent as de,RetryAgent as ce,setGlobalDispatcher as me}from"undici";var ue=1500,ge=4e3,pe=3,fe=50,ye=100,I=!1;function we(){if(I)return;I=!0;let e=new de({connections:ye,keepAliveMaxTimeout:ge,keepAliveTimeout:ue}),r=new ce(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_SOCKET"],maxRetries:pe,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:fe,statusCodes:[]});me(r)}import{graphql as p}from"gql.tada";var We=p(`
6
- query AgentReviewContextWorker($reviewId: String!) {
7
- agentReview(id: $reviewId) {
8
- id
9
- runId
10
- agentProfile {
11
- id
12
- name
13
- description
14
- output
15
- successCriteria
16
- }
17
- }
18
- }
19
- `);var Be=p(`
20
- mutation StartAgentReviewWorker($reviewId: String!) {
21
- startAgentReview(reviewId: $reviewId)
22
- }
23
- `);var He=p(`
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 Ke=p(`
40
- mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
41
- updateAgentReviewProgress(reviewId: $reviewId, text: $text)
42
- }
43
- `);var Je=p(`
44
- mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
45
- failAgentReview(reviewId: $reviewId, reason: $reason)
46
- }
47
- `);import c from"fs";import q from"path";function Re(e){let r=process.env.RIPPLO_TOKEN;if(r!=null&&r.trim().length>0)return r.trim();let t=R(e);if(!c.existsSync(t))return null;let n=c.readFileSync(t,"utf8").trim();return n.length===0?null:n}function ve({serverUrl:e,token:r}){S();let t=R(e);c.mkdirSync(q.dirname(t),{mode:448,recursive:!0}),c.writeFileSync(t,r+`
48
- `,{mode:384})}function he(e){let r=R(e);return c.existsSync(r)?(c.unlinkSync(r),!0):!1}function R(e){return A(q.join("tokens",Pe(e)))}function Pe(e){return new URL(e).host.replaceAll(/[^a-zA-Z0-9.]/g,"_")}var M=O(F(),1);import _ from"crypto";function Se({body:e,secret:r}){let t=new M.Webhook(r),n=`msg_${_.randomUUID()}`,o=new Date,a=t.sign(n,o,e),s=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":a,"webhook-timestamp":String(s)}}function Ae(){return`whsec_${_.randomBytes(24).toString("base64")}`}export{f as a,u as b,N as c,E as d,W as e,y as f,v as g,te as h,se as i,le as j,Re as k,ve as l,he as m,R as n,we as o,Se as p,Ae as q};
@@ -1,107 +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{c as o,d as r}from"./chunk-G6J2WIHJ.js";import{a}from"./chunk-7WZ3VIUU.js";var n=`# How Ripplo thinks
5
-
6
- This model drives compile errors, run failures, and explorer findings.
7
-
8
- **Done has two halves.** The app delivers the behavior, and a passing workflow proves the complete
9
- user journey. Neither half is optional.
10
-
11
- ## Workflow, test, and run
12
-
13
- A **workflow** is the authored model of one critical user intent. It follows the real multi-step
14
- click path from a natural entry point and declares what each action makes true.
15
-
16
- A **test** is one concrete state synthesized from that workflow for a reachable named \`when\`
17
- branch. A workflow without branches has one \`main\` test. A **run** executes one test. Authors edit
18
- workflows, not concrete test state.
19
-
20
- ## One typed application-state model
21
-
22
- One root Zod schema defines application state. Each top-level key is a source that returns one
23
- validated state blob. Sources can be served over HTTP or from the browser without changing workflow
24
- selectors. Authentication is separate because signing in creates a browser session.
25
-
26
- Use \`setup.value\`, \`setup.generated\`, and \`setup.record\` only where workflows may create
27
- starting state. Plain Zod fields remain observable. TypeScript derives each source's setup and read
28
- contract from the schema.
29
-
30
- ## Start wide and stay connected
31
-
32
- \`given\` is not a fixture. It describes the widest set of starting states compatible with the
33
- entire journey. Add only structural presence, absence, relations, permissions, actor, viewport, and
34
- other preconditions every step truly needs.
35
-
36
- Omit irrelevant record fields. Setup generates them from the schema, and returned record handles
37
- expose their values. Use \`arbitrary(field)\` for a workflow input that can be any schema-valid
38
- value. Reuse that binding in actions and effects. Use \`exact(value)\` only when the concrete string
39
- or number drives behavior.
40
-
41
- State-rendered names, ids, slugs, counts, amounts, inputs, and URLs come from handles or expressions.
42
- Repeating a setup literal in a locator or action creates drift and narrows the journey.
43
-
44
- When starting state changes an outcome but the intent and click path stay the same, use
45
- \`optional()\` and named \`when\` branches. Branch conditions constrain synthesis directly. Use
46
- another workflow only when the intent or path differs.
47
-
48
- ## Steps declare complete transitions
49
-
50
- A step declares the user action, its page result, and every application-state effect. A toast or
51
- closed dialog does not prove a write persisted. Declare \`created\`, \`updated\`, \`deleted\`,
52
- \`set\`, or \`transform\` alongside visible evidence.
53
-
54
- Every effect must definitely change state from what \`given\`, its branch, and earlier steps
55
- establish. A possible no-op is invalid. Use a before/after relation that excludes equality or model
56
- the real precondition. Do not hardcode a convenient previous value solely to satisfy the proof.
57
-
58
- Ripplo applies a frame rule: state persists until a declared effect changes it. Any observed change
59
- outside the declared effects is a frame violation. Cascades must be declared completely.
60
-
61
- ## Reachability and page state
62
-
63
- An action can touch only an element an earlier durable \`visible(...)\` established. Assert the
64
- surface or control when it first appears. Use semantic roles such as \`button\`, \`textbox\`,
65
- \`heading\`, and \`link\`. Add an accessible name to the app when one is missing.
66
-
67
- \`text(locator, "x")\` and \`value(locator, "x")\` are exact. Use \`contains("x")\` or
68
- \`startsWith("x")\` only when that broader relationship is intended.
69
-
70
- ## Facts keep their conditions
71
-
72
- Workflow assertions become facts under the complete application and page state declared at that
73
- step. They are not generalized beyond those conditions. The explorer reuses those exact facts on
74
- compatible composed paths.
75
-
76
- Two facts that disagree on overlapping state are a compile error. Add the missing distinguishing
77
- state or split the outcome with \`when\`.
78
-
79
- Use \`fact()\` only for a true app-wide invariant or permission boundary that no journey owns. Do
80
- not replace a journey, branch, or missing effect with a broad fact.
81
-
82
- ## What each gate proves
83
-
84
- - \`npx ripplo compile\` validates authoring, branch reachability, definite effects, fact
85
- consistency, interaction reachability, and the lockfile.
86
- - \`npx ripplo run\` compares every declared page and application-state expectation with the live
87
- app after each step.
88
- - The explorer composes declared steps and reports contradictions on paths no workflow wrote.
89
-
90
- On failure, run \`npx ripplo explain <runId>\` and inspect \`behavior.jsonl\` before re-running.
91
- Form one evidence-backed hypothesis, make one change, then run once.
92
-
93
- \`.wait("slow")\` gives a page predicate more time. \`consistency.eventual(schema)\` marks a state
94
- field whose source may legitimately expose intermediate values before converging. A longer wait
95
- must not hide a wrong value.
96
-
97
- ## Scope and the prime directive
98
-
99
- Testing Scope is the set of workflows this session must leave green. Add every affected journey.
100
- A stub \`workflow("Intent")\` is a promise that must be implemented before finishing.
101
-
102
- Fix broken behavior in the app. Strengthen an incomplete model in the workflow. Never weaken a
103
- declaration, replace state-derived values with literals, or narrow starting state merely to turn a
104
- failure green.
105
-
106
- \`.ripplo/ripplo.lock\` is committed, regenerated by \`npx ripplo compile\`, and never hand-edited.
107
- `;function l(e,t){return!a(e)||r(e,t)?null:(o(e,t),n)}export{l as a};
@@ -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{b as u}from"./chunk-SXVWB7TZ.js";import{a as f}from"./chunk-JJ4QQPAV.js";import{l as c}from"./chunk-BTIQ5H3K.js";import{m as p}from"./chunk-5JXP37ET.js";import{a as m}from"./chunk-7WZ3VIUU.js";import{f as l}from"./chunk-KH4QH23U.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)||!l(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 p(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=c(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,11 +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 o}from"./chunk-RXLDAR2J.js";import{a as t}from"./chunk-MHNGR6M7.js";var r=class extends Error{failure;constructor(i){super(i.kind),this.name="CliError",this.failure=i}};function u(e){return e instanceof r?a(e.failure):e instanceof Error?e.message:String(e)}function a(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",t("setup")].join(`
5
- `);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(i=>` ${i}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
6
- `);case"not-authenticated":return["Not signed in. Run `npx ripplo auth login`.","(Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)"].join(`
7
- `);case"env-invalid":return s(e);case"playwright-install-failed":return["Playwright browser install failed \u2014 Chromium is still missing.","Run `npx playwright install chromium` and check its output for network, proxy, or disk-space errors."].join(`
8
- `);case"gitdir-unrecognized":return`Unrecognized .git file at ${e.marker} \u2014 expected a directory or a "gitdir:" pointer (worktree). Is the repo corrupted?`;case"gitdir-empty":return`Empty gitdir pointer at ${e.marker} \u2014 the worktree's .git file points nowhere. Re-create the worktree.`;case"oauth-device-code-failed":return[`Could not start sign-in (device-code request failed): ${e.description}`,"Is the Ripplo server reachable? Check RIPPLO_SERVER_URL and retry."].join(`
9
- `);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `npx ripplo auth login` again.":"Run `npx ripplo auth login` to retry."].join(`
10
- `);case"compilation-failed":return o(e.error)}}function g(e,i){let n=i instanceof Error?i.message:String(i);return`ripplo hook "${e}" crashed and was skipped \u2014 ${n}`}function s(e){let i=e.missingEnvFiles.length===0?[]:["Declared env files not found:",...e.missingEnvFiles.map(n=>` ${n}`),"In a git worktree? Env files aren't copied from the main checkout \u2014 recreate them, or symlink to a shared file outside the working tree."];return["Env config invalid:",...e.issues.map(n=>` ${n}`),"Add the missing values to the env files declared in .ripplo/project.json.",...i].join(`
11
- `)}export{u as a,a as b,g as c};