ripplo 0.8.2 → 0.9.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 (49) hide show
  1. package/dist/{chunk-5SM4TCSW.js → chunk-4F67XQYS.js} +19 -19
  2. package/dist/{chunk-EGETJKAQ.js → chunk-4H7EIC6W.js} +1 -1
  3. package/dist/{chunk-4FKGHWCC.js → chunk-AYDIXOW2.js} +1 -1
  4. package/dist/chunk-BR7W4UBJ.js +83 -0
  5. package/dist/{chunk-WHSQBXWO.js → chunk-EA62LNKT.js} +2 -2
  6. package/dist/chunk-EVVF662P.js +6 -0
  7. package/dist/{chunk-XBD3OTIW.js → chunk-FR4ENKCT.js} +1 -1
  8. package/dist/{chunk-N2B5GZPU.js → chunk-IRTBARRY.js} +1 -1
  9. package/dist/{chunk-PXZV5X3C.js → chunk-JXGIARTE.js} +1 -1
  10. package/dist/chunk-PRD7P6EF.js +6 -0
  11. package/dist/{chunk-2MT2MZJW.js → chunk-Q6IYTHMP.js} +1 -1
  12. package/dist/{chunk-7TYUZIUO.js → chunk-QQ7NFPJQ.js} +1 -1
  13. package/dist/chunk-U27IDW6O.js +229 -0
  14. package/dist/{chunk-SWOTFHBR.js → chunk-V4IQQT44.js} +1 -1
  15. package/dist/chunk-WZBLSDNV.js +4 -0
  16. package/dist/chunk-XVMIPWJQ.js +4 -0
  17. package/dist/{chunk-AVBP7Q2M.js → chunk-XZ2TPZLD.js} +1 -1
  18. package/dist/{chunk-LKYTQXPR.js → chunk-ZDA3E2AS.js} +1 -1
  19. package/dist/{chunk-UVYCSHOJ.js → chunk-ZUPS6XVH.js} +1 -1
  20. package/dist/{cli-error-SLG6JHK2.js → cli-error-J33JDZET.js} +1 -1
  21. package/dist/{compile-write-7AV66JUA.js → compile-write-H2GLCECO.js} +1 -1
  22. package/dist/{daemon-LFFCR3TB.js → daemon-3J3K4BOD.js} +1 -1
  23. package/dist/daemon-AS6IHTHD.js +152 -0
  24. package/dist/{dsl-loader-H25XGSHJ.js → dsl-loader-5Z2JRKY3.js} +1 -1
  25. package/dist/hook.js +1 -1
  26. package/dist/index.js +171 -172
  27. package/dist/{plan-reminder-VMBDQTAP.js → plan-reminder-E6AXT6OB.js} +1 -1
  28. package/dist/post-edit-LUPA46ZO.js +4 -0
  29. package/dist/post-edit-analyze-XY6C7ZFP.js +4 -0
  30. package/dist/post-edit-flag-stubs-ZMKN4DJZ.js +4 -0
  31. package/dist/{pre-edit-Q4U5LSWG.js → pre-edit-EJO3TUNQ.js} +1 -1
  32. package/dist/{pre-edit-watch-gate-EUZGEH2J.js → pre-edit-watch-gate-DZHQCMEI.js} +1 -1
  33. package/dist/{prompt-submit-MPRVCWOI.js → prompt-submit-U3QOU47D.js} +1 -1
  34. package/dist/{session-preamble-RJ4WNGJN.js → session-preamble-IHBGHKCW.js} +1 -1
  35. package/dist/solve-worker.js +1 -1
  36. package/dist/status-247DEYFK.js +4 -0
  37. package/dist/{stop-enforce-UXBQRTFP.js → stop-enforce-ZLQKGMSF.js} +1 -1
  38. package/package.json +6 -5
  39. package/dist/chunk-AQ3DMGAY.js +0 -6
  40. package/dist/chunk-CRELTIU2.js +0 -242
  41. package/dist/chunk-EK6TENV6.js +0 -4
  42. package/dist/chunk-ESOXRGIY.js +0 -83
  43. package/dist/chunk-M7VQD4VO.js +0 -6
  44. package/dist/chunk-OY6HNCAZ.js +0 -4
  45. package/dist/daemon-BN42ZNCJ.js +0 -139
  46. package/dist/post-edit-2VFE6QND.js +0 -4
  47. package/dist/post-edit-analyze-VETPP5Z4.js +0 -4
  48. package/dist/post-edit-flag-stubs-J3MCGLXI.js +0 -4
  49. package/dist/status-UBUNHH5O.js +0 -4
@@ -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}from"./chunk-4FKGHWCC.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
4
+ import{a}from"./chunk-AYDIXOW2.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as planReminder};
@@ -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{a as t}from"./chunk-QQ7NFPJQ.js";import"./chunk-T5VLZ43M.js";import{a as e}from"./chunk-V4IQQT44.js";import"./chunk-I5BHCICM.js";import"./chunk-JJ4QQPAV.js";import"./chunk-MOI4L3EX.js";import"./chunk-JXGIARTE.js";import"./chunk-OQ6KNYPG.js";import"./chunk-ZUPS6XVH.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-XZ2TPZLD.js";import"./chunk-MHNGR6M7.js";import"./chunk-XVMIPWJQ.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-BR7W4UBJ.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var r=o({event:"PostToolUse",handlers:[t,e],note:i=>({hookSpecificOutput:{additionalContext:i,hookEventName:"PostToolUse"}})});export{r as postEditHook};
@@ -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{a}from"./chunk-QQ7NFPJQ.js";import"./chunk-T5VLZ43M.js";import"./chunk-MOI4L3EX.js";import"./chunk-JXGIARTE.js";import"./chunk-OQ6KNYPG.js";import"./chunk-ZUPS6XVH.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import"./chunk-XZ2TPZLD.js";import"./chunk-MHNGR6M7.js";import"./chunk-XVMIPWJQ.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-BR7W4UBJ.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditAnalyze};
@@ -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{a}from"./chunk-V4IQQT44.js";import"./chunk-I5BHCICM.js";import"./chunk-JJ4QQPAV.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-XVMIPWJQ.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-BR7W4UBJ.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as postEditFlagStubs};
@@ -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 e}from"./chunk-N2B5GZPU.js";import{a as t}from"./chunk-L7GWKDGD.js";import{a as i}from"./chunk-XWUIRXMS.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-AQ3DMGAY.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
4
+ import{a as e}from"./chunk-IRTBARRY.js";import{a as t}from"./chunk-L7GWKDGD.js";import{a as i}from"./chunk-XWUIRXMS.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var d=o({event:"PreToolUse",handlers:[e,t,i],note:r=>({hookSpecificOutput:{additionalContext:r,hookEventName:"PreToolUse"}})});export{d as preEditHook};
@@ -1,4 +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}from"./chunk-N2B5GZPU.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-MHNGR6M7.js";import"./chunk-AQ3DMGAY.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
4
+ import{a}from"./chunk-IRTBARRY.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-MHNGR6M7.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as preEditWatchGate};
@@ -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 e}from"./chunk-I2M24U3N.js";import{a as r}from"./chunk-WNAVYV4P.js";import"./chunk-LB65USNP.js";import{a as i}from"./chunk-A7SHHSB3.js";import{a as t}from"./chunk-4FKGHWCC.js";import"./chunk-T5VLZ43M.js";import"./chunk-I5BHCICM.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-CDPYJKK7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
4
+ import{a as e}from"./chunk-I2M24U3N.js";import{a as r}from"./chunk-WNAVYV4P.js";import"./chunk-LB65USNP.js";import{a as i}from"./chunk-A7SHHSB3.js";import{a as t}from"./chunk-AYDIXOW2.js";import"./chunk-T5VLZ43M.js";import"./chunk-I5BHCICM.js";import"./chunk-JJ4QQPAV.js";import"./chunk-OWN4P2K7.js";import"./chunk-CDPYJKK7.js";import"./chunk-OQ6KNYPG.js";import"./chunk-LEFXRK53.js";import"./chunk-7WZ3VIUU.js";import"./chunk-4W6WIT7T.js";import"./chunk-FEHVIHVA.js";import{b as o}from"./chunk-KOKEEAEF.js";import"./chunk-MHNGR6M7.js";import"./chunk-DBIXYJRB.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";var a=o({event:"UserPromptSubmit",handlers:[t,e,r,i],note:m=>({hookSpecificOutput:{additionalContext:m,hookEventName:"UserPromptSubmit"}})});export{a as promptSubmitHook};
@@ -1,4 +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 e}from"./chunk-7WZ3VIUU.js";import{c as t}from"./chunk-KOKEEAEF.js";import"./chunk-KMZ3L5YA.js";var s="# Ripplo \u2014 always-on session context\n\nEvery user-facing change in this repo ships with a deterministic, backend-aware test that proves it works end-to-end.\n\n## Load the right skill before acting \u2014 this is critical\n\nThe skills below carry the procedural detail you need to do Ripplo work correctly: entity/given modeling, parallel-isolation in engine impls, backend state assertions, scope discipline, artifact-read order on failures, parallelization patterns. **None of that is reproduced in this preamble** \u2014 only the always-on guardrails are. If you act on a Ripplo task without loading the matching skill, you will skip rules that exist to prevent specific past failure modes (cross-run data leakage, \"passing\" tests that never asserted backend state, etc.).\n\nMatch the task to a skill from the triage table \u2014 if unsure between two, load both. If completely unsure, load `/ripplo:discover` or `/ripplo:create`. Loading is cheap. Acting under-informed is not.\n\n**This is a hard requirement, not a suggestion.** Do NOT run `npx ripplo` commands, edit `.ripplo/` files, or reason about how Ripplo behaves before loading the matching skill. Agents that skip this consistently misuse the CLI, invent flags that don't exist, and hold wrong expectations about compile, run, facts, scope, and the explorer \u2014 every one of those failure modes traces back to acting without the skill loaded. The skill is the source of truth for its area. When in doubt, load it first.\n\nThe skills share one mental model \u2014 how Ripplo thinks (workflows declare state, facts carry across workflows, what compile/run/explorer each enforce), and the rules below are consequences of it. It loads automatically the first time you load a Ripplo skill this session, so load a skill before acting.\n\n## Skill triage\n\n- Load `/ripplo:setup` skill for instructions on initializing Ripplo in a project; `npx ripplo doctor` reports the engine endpoint missing.\n- Load `/ripplo:discover` skill for instructions on planning/stubbing test coverage for a new project or new feature area.\n- Load `/ripplo:create` skill for instructions on authoring a single workflow for a user flow.\n- Load `/ripplo:run` skill for instructions on executing tests, managing the testing scope this session is responsible for, diagnosing a failed run (read artifacts in `.ripplo/debug/<runId>/` before re-running), and filing caught app bugs.\n- Load `/ripplo:tasks` skill for instructions on picking up tasks \u2014 open-ended requests users anchor to a replay frame and element (fix a bug, change behavior, extend or write a workflow, ask a question) and background-explorer findings, which arrive as tasks of their own. It routes the request, lets you ask the user back with `clarify`, and for app changes enforces proof with an exact run, frame, and element. Load it whenever a tasks reminder fires, the user points you at a task or finding, or before any `npx ripplo tasks` command.\n\n## Universal rules\n\n- **Two background processes must be running before feature work.** (1) The app's dev server, so the app is reachable; (2) `npx ripplo daemon` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without the daemon, dev-mode hooks don't arm (`ripplo run` will auto-start one if absent). Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both. Manage the daemon with `npx ripplo daemon status` and `npx ripplo daemon stop` (stale holder, CLI update). Switch executor live with `npx ripplo executor <local|cloud>` \u2014 no restart. Don't use `daemon restart` as an agent \u2014 the start half never returns; stop, then respawn in the background.\n- **Two funnels.** Definitions \u2192 `createRipplo({ entities, singletons, workflows })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { entities: impls, singletons })` in your app server's `test/engine.ts` \u2014 one `seed`/`read` impl per entity. Never call either elsewhere. TS enforces exhaustiveness across both.\n- **\"Done\" = app code delivers the behavior AND a passing test proves it.** Both halves. Shipping without a test isn't done; writing a test against broken UI/API isn't done.\n- **Scope is your job.** For any non-trivial change, enumerate every flow it could affect and either `scope add` existing workflows or stub new ones with `workflow(\"Intent\")` (no body). Don't wait to be told.\n- **`scope remove` is never for size/effort.** Valid only when an item is genuinely out of scope (wrong flow, duplicate, user said \"not this session,\" feature cut). \"Too many stubs\" \u2192 parallelize with subagents. Don't present \"implement vs. remove\" as a neutral A/B.\n- **Stub gates are not a question.** When `stop-enforce` blocks on unimplemented stubs, implement them \u2014 don't ask the user \"implement or defer?\", don't pause hooks to skip them. The fix isn't done until the test is. New scaffolding (entity, given, engine impl) is in-scope work, not follow-up.\n- **You control the hooks \u2014 use it for rapid iteration, never to dodge work.** `npx ripplo hooks pause` silences pre-edit gates and stop-enforce, `npx ripplo hooks resume` re-arms them. Pause when a user asks you to iterate fast on a feature and the checks are noise mid-loop. When you pause, say so, and before you call the work done, resume and run the full check clean. Pausing to escape a failing test or an unimplemented stub is the one thing it's not for.\n- **Keep the explorer running all session.** The background explorer walks composed paths no workflow author wrote \u2014 it fills coverage gaps and catches bugs that only surface when actions combine. It is the third gate, not an extra. A green `npx ripplo run` auto-enables it; check or toggle by hand with `npx ripplo explore [on|off]` (`--trail` sets path depth, `--workers` sets concurrency). Findings arrive as tasks \u2014 triage with `/ripplo:tasks`, and an open finding blocks the session end like any task. Leave it on \u2014 the only real off switch is `npx ripplo hooks pause`.\n- **A workflow is a user journey, not a single-mutation snippet.** One user intent, the real click path from a natural entry point, as many mutations as the intent takes \u2014 with `when` branches wherever seeded state changes an outcome along the path. Authoring method lives in `/ripplo:create`.\n- **Backend assertions are mandatory on mutations.** Every mutation step carries an `Entity.created/updated/deleted` in its `.expect(...)` \u2014 Ripplo checks your app's state against what the test expected. A UI-only check on a mutation ships the bug as green.\n- **Never weaken a test to make it pass.** No `contains`/regex for exact text, no removed assertions, no fabricated locators. App lacks an accessible name \u2192 add one to the app, don't fall back to `testId()`. App bug \u2192 report with evidence.\n- **Artifacts first, re-run last.** Failed runs write `.ripplo/debug/<runId>/behavior.jsonl` \u2014 a causal stream of actions, assertions, rrweb DOM, console, network, and server spans \u2014 and the run output renders the findings. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an event, make one change, re-run once.\n- **`.ripplo/ripplo.lock` is committed, never hand-edited.** `ripplo compile` regenerates it. Pre-commit runs `ripplo compile --check`.\n- **Scratch files live in `.ripplo/.local/`.** Never loose in `.ripplo/`.\n- **Worktrees are self-contained.** Each worktree has its own `.ripplo/` checkout, DevSession, scope, and debug artifacts. Auth and projectId are shared globally. Env files (typically gitignored) won't carry over to a fresh worktree \u2014 copy from main or point at a shared file. **If sibling worktrees run dev servers on different ports, the worktree's env file must update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match the port that worktree's dev server is bound to** (e.g. main on `:3000`, this worktree on `:3001` \u2192 set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo` in the worktree's env file). Mismatched ports = `npx ripplo daemon` talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** Use `role`/`button`/`textbox`/`heading`/`link`; `testId` only when no ARIA role exists.\n- **New backend state?** Add an `entity(...)` in `.ripplo/entities/` and a `seed`/`read` impl in your app's engine funnel (TS flags the missing impl).\n- **Tasks demand exact proof, never hand-waving.** Resolving a task (`npx ripplo tasks resolve`) requires a run that exercises the broken condition plus a frame and element that show the fix \u2014 a red\u2192green assertion or before/after snapshots you Read, anchored on the resolving comment. Never conclude \"fixed\" from the diff, a toast, or a log string. If a run can't yet reach the broken condition, extend or write the workflow that does \u2014 don't resolve without proof. Load `/ripplo:tasks` for the loop.\n- **Know the task lifecycle.** A task is **open** (needs you), **needs clarification** (waiting on the user after your `clarify` \u2014 not your move), **resolved**, or **dismissed**. The task watcher (armed by `/ripplo:start`) wakes you live on a new task, a reopen, or a user reply, even while idle. A **reopen** means your earlier fix didn't hold \u2014 revisit it, don't treat it as a fresh request. If the user resolves or dismisses a task you were working, it's no longer relevant \u2014 stop working it (you find out at your next stop, not via a wake). While hooks are on, you cannot end the session with a task open \u2014 clear each with resolve, clarify, or dismiss. Load `/ripplo:tasks` for the loop.\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{entities,singletons,workflows}/index.ts` \u2014 registry aggregators. `.ripplo/givens.ts` + feature `givens.ts` \u2014 given builders.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 single impl funnel via `createEngine`.\n- `/ripplo:create` skill \u2014 DSL reference (entities, givens, workflows, backend assertions). Full primitive catalog at `node_modules/@ripplo/testing/DSL.md`.\n",i=t("SessionStart",o=>{if(e(o.cwd))return{hookSpecificOutput:{additionalContext:s,hookEventName:"SessionStart"}}});export{i as sessionPreambleHook};
4
+ import{a as e}from"./chunk-7WZ3VIUU.js";import{c as t}from"./chunk-KOKEEAEF.js";import"./chunk-KMZ3L5YA.js";var s="# Ripplo \u2014 always-on session context\n\nEvery user-facing change in this repo ships with a deterministic, backend-aware test that proves it works end-to-end.\n\n## Load the right skill before acting \u2014 this is critical\n\nThe skills below carry the procedural detail you need to do Ripplo work correctly: entity/given modeling, parallel-isolation in engine impls, backend state assertions, scope discipline, artifact-read order on failures, parallelization patterns. **None of that is reproduced in this preamble** \u2014 only the always-on guardrails are. If you act on a Ripplo task without loading the matching skill, you will skip rules that exist to prevent specific past failure modes (cross-run data leakage, \"passing\" tests that never asserted backend state, etc.).\n\nMatch the task to a skill from the triage table \u2014 if unsure between two, load both. If completely unsure, load `/ripplo:discover` or `/ripplo:create`. Loading is cheap. Acting under-informed is not.\n\n**This is a hard requirement, not a suggestion.** Do NOT run `npx ripplo` commands, edit `.ripplo/` files, or reason about how Ripplo behaves before loading the matching skill. Agents that skip this consistently misuse the CLI, invent flags that don't exist, and hold wrong expectations about compile, run, facts, scope, and the explorer \u2014 every one of those failure modes traces back to acting without the skill loaded. The skill is the source of truth for its area. When in doubt, load it first.\n\nThe skills share one mental model \u2014 how Ripplo thinks (workflows declare state, facts carry across workflows, what compile/run/explorer each enforce), and the rules below are consequences of it. It loads automatically the first time you load a Ripplo skill this session, so load a skill before acting.\n\n## Skill triage\n\n- Load `/ripplo:setup` skill for instructions on initializing Ripplo in a project; `npx ripplo doctor` reports the engine endpoint missing.\n- Load `/ripplo:discover` skill for instructions on planning/stubbing test coverage for a new project or new feature area.\n- Load `/ripplo:create` skill for instructions on authoring a single workflow for a user flow.\n- Load `/ripplo:run` skill for instructions on executing tests, managing the testing scope this session is responsible for, diagnosing a failed run (read artifacts in `.ripplo/debug/<runId>/` before re-running), and filing caught app bugs.\n- Load `/ripplo:tasks` skill for instructions on picking up tasks \u2014 open-ended requests users anchor to a replay frame and element (fix a bug, change behavior, extend or write a workflow, ask a question) and background-explorer findings, which arrive as tasks of their own. It routes the request, lets you ask the user back with `clarify`, and for app changes enforces proof with an exact run, frame, and element. Load it whenever a tasks reminder fires, the user points you at a task or finding, or before any `npx ripplo tasks` command.\n\n## Universal rules\n\n- **Two background processes must be running before feature work.** (1) The app's dev server, so the app is reachable; (2) `npx ripplo daemon` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without the daemon, dev-mode hooks don't arm (`ripplo run` will auto-start one if absent). Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both. Manage the daemon with `npx ripplo daemon status` and `npx ripplo daemon stop` (stale holder, CLI update). Switch executor live with `npx ripplo executor <local|cloud>` \u2014 no restart. Don't use `daemon restart` as an agent \u2014 the start half never returns; stop, then respawn in the background.\n- **Two funnels.** Definitions \u2192 `createRipplo({ entities, singletons, workflows })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { entities: impls, singletons })` in your app server's `test/engine.ts` \u2014 one `seed`/`read` impl per entity. Never call either elsewhere. TS enforces exhaustiveness across both.\n- **\"Done\" = app code delivers the behavior AND a passing test proves it.** Both halves. Shipping without a test isn't done; writing a test against broken UI/API isn't done.\n- **Scope is your job.** For any non-trivial change, enumerate every flow it could affect and either `scope add` existing workflows or stub new ones with `workflow(\"Intent\")` (no body). Don't wait to be told.\n- **`scope remove` is never for size/effort.** Valid only when an item is genuinely out of scope (wrong flow, duplicate, user said \"not this session,\" feature cut). \"Too many stubs\" \u2192 parallelize with subagents. Don't present \"implement vs. remove\" as a neutral A/B.\n- **Stub gates are not a question.** When `stop-enforce` blocks on unimplemented stubs, implement them \u2014 don't ask the user \"implement or defer?\", don't pause hooks to skip them. The fix isn't done until the test is. New scaffolding (entity, given, engine impl) is in-scope work, not follow-up.\n- **You control the hooks \u2014 use it for rapid iteration, never to dodge work.** `npx ripplo hooks pause` silences pre-edit gates and stop-enforce, `npx ripplo hooks resume` re-arms them. Pause when a user asks you to iterate fast on a feature and the checks are noise mid-loop. When you pause, say so, and before you call the work done, resume and run the full check clean. Pausing to escape a failing test or an unimplemented stub is the one thing it's not for.\n- **Keep the explorer running all session.** The background explorer walks composed paths no workflow author wrote \u2014 it fills coverage gaps and catches bugs that only surface when actions combine. It is the third gate, not an extra. Check or toggle it with `npx ripplo explore [on|off]` (`--trail` sets path depth, `--workers` sets concurrency). Findings arrive as tasks \u2014 triage with `/ripplo:tasks`, and an open finding blocks the session end like any task. Leave it on.\n- **A workflow is a user journey, not a single-mutation snippet.** One user intent, the real click path from a natural entry point, as many mutations as the intent takes \u2014 with `when` branches wherever seeded state changes an outcome along the path. Authoring method lives in `/ripplo:create`.\n- **Backend assertions are mandatory on mutations.** Every mutation step carries an `Entity.created/updated/deleted` in its `.expect(...)` \u2014 Ripplo checks your app's state against what the test expected. A UI-only check on a mutation ships the bug as green.\n- **Never weaken a test to make it pass.** No `contains`/regex for exact text, no removed assertions, no fabricated locators. App lacks an accessible name \u2192 add one to the app, don't fall back to `testId()`. App bug \u2192 report with evidence.\n- **Artifacts first, re-run last.** Failed runs write `.ripplo/debug/<runId>/behavior.jsonl` \u2014 a causal stream of actions, assertions, rrweb DOM, console, network, and server spans \u2014 and the run output renders the findings. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an event, make one change, re-run once.\n- **`.ripplo/ripplo.lock` is committed, never hand-edited.** `ripplo compile` regenerates it. Pre-commit runs `ripplo compile --check`.\n- **Scratch files live in `.ripplo/.local/`.** Never loose in `.ripplo/`.\n- **Worktrees are self-contained.** Each worktree has its own `.ripplo/` checkout, DevSession, scope, and debug artifacts. Auth and projectId are shared globally. Env files (typically gitignored) won't carry over to a fresh worktree \u2014 copy from main or point at a shared file. **If sibling worktrees run dev servers on different ports, the worktree's env file must update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match the port that worktree's dev server is bound to** (e.g. main on `:3000`, this worktree on `:3001` \u2192 set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo` in the worktree's env file). Mismatched ports = `npx ripplo daemon` talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** Use `role`/`button`/`textbox`/`heading`/`link`; `testId` only when no ARIA role exists.\n- **New backend state?** Add an `entity(...)` in `.ripplo/entities/` and a `seed`/`read` impl in your app's engine funnel (TS flags the missing impl).\n- **Tasks demand exact proof, never hand-waving.** Resolving a task (`npx ripplo tasks resolve`) requires a run that exercises the broken condition plus a frame and element that show the fix \u2014 a red\u2192green assertion or before/after snapshots you Read, anchored on the resolving comment. Never conclude \"fixed\" from the diff, a toast, or a log string. If a run can't yet reach the broken condition, extend or write the workflow that does \u2014 don't resolve without proof. Load `/ripplo:tasks` for the loop.\n- **Know the task lifecycle.** A task is **open** (needs you), **needs clarification** (waiting on the user after your `clarify` \u2014 not your move), **resolved**, or **dismissed**. The task watcher (armed by `/ripplo:start`) wakes you live on a new task, a reopen, or a user reply, even while idle. A **reopen** means your earlier fix didn't hold \u2014 revisit it, don't treat it as a fresh request. If the user resolves or dismisses a task you were working, it's no longer relevant \u2014 stop working it (you find out at your next stop, not via a wake). While hooks are on, you cannot end the session with a task open \u2014 clear each with resolve, clarify, or dismiss. Load `/ripplo:tasks` for the loop.\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{entities,singletons,workflows}/index.ts` \u2014 registry aggregators. `.ripplo/givens.ts` + feature `givens.ts` \u2014 given builders.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 single impl funnel via `createEngine`.\n- `/ripplo:create` skill \u2014 DSL reference (entities, givens, workflows, backend assertions). Full primitive catalog at `node_modules/@ripplo/testing/DSL.md`.\n",r=t("SessionStart",o=>{if(e(o.cwd))return{hookSpecificOutput:{additionalContext:s,hookEventName:"SessionStart"}}});export{r as sessionPreambleHook};
@@ -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{Y as r}from"./chunk-5SM4TCSW.js";import"./chunk-KMZ3L5YA.js";r();
4
+ import{aa as r}from"./chunk-4F67XQYS.js";import"./chunk-KMZ3L5YA.js";r();
@@ -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{a}from"./chunk-FR4ENKCT.js";import"./chunk-4H7EIC6W.js";import"./chunk-WZBLSDNV.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-XZ2TPZLD.js";import"./chunk-MHNGR6M7.js";import"./chunk-XVMIPWJQ.js";import"./chunk-EVVF662P.js";import"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-PRD7P6EF.js";import"./chunk-BR7W4UBJ.js";import"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";export{a as statusCommand};
@@ -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 O,b as H,c as q}from"./chunk-T5VLZ43M.js";import{a as L,b as A,d as N,e as x,f as T,g as h}from"./chunk-LKYTQXPR.js";import{a as $,c as P,e as I}from"./chunk-EGETJKAQ.js";import"./chunk-OY6HNCAZ.js";import{a as S,c as v}from"./chunk-PXZV5X3C.js";import"./chunk-OQ6KNYPG.js";import{c as k}from"./chunk-LEFXRK53.js";import{a as b}from"./chunk-7WZ3VIUU.js";import{f as C}from"./chunk-4W6WIT7T.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{c as D}from"./chunk-KOKEEAEF.js";import{a as w}from"./chunk-AVBP7Q2M.js";import{a as c}from"./chunk-MHNGR6M7.js";import{e as E,f as j,i as y}from"./chunk-EK6TENV6.js";import"./chunk-AQ3DMGAY.js";import"./chunk-DBIXYJRB.js";import{d as m}from"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-ESOXRGIY.js";import{N as g}from"./chunk-5SM4TCSW.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import J from"path";import U from"process";import{CancellationTokenSource as _}from"vscode-jsonrpc/node";import{graphql as W}from"gql.tada";function F(n){return`--- Ripplo Run Failures (scope) ---
4
+ import{a as O,b as H,c as q}from"./chunk-T5VLZ43M.js";import{a as L,b as A,d as N,e as x,f as T,g as h}from"./chunk-ZDA3E2AS.js";import{a as $,c as P,e as I}from"./chunk-4H7EIC6W.js";import"./chunk-WZBLSDNV.js";import{a as S,c as v}from"./chunk-JXGIARTE.js";import"./chunk-OQ6KNYPG.js";import{c as k}from"./chunk-LEFXRK53.js";import{a as b}from"./chunk-7WZ3VIUU.js";import{f as C}from"./chunk-4W6WIT7T.js";import"./chunk-R4ZTRVDQ.js";import"./chunk-FEHVIHVA.js";import{c as D}from"./chunk-KOKEEAEF.js";import{a as w}from"./chunk-XZ2TPZLD.js";import{a as c}from"./chunk-MHNGR6M7.js";import{e as E,f as j,i as y}from"./chunk-XVMIPWJQ.js";import"./chunk-EVVF662P.js";import"./chunk-DBIXYJRB.js";import{d as m}from"./chunk-PE5WVWI5.js";import"./chunk-CJUKILIO.js";import"./chunk-BR7W4UBJ.js";import{R as g}from"./chunk-4F67XQYS.js";import"./chunk-NNH3YVVO.js";import"./chunk-KMZ3L5YA.js";import J from"path";import U from"process";import{CancellationTokenSource as _}from"vscode-jsonrpc/node";import{graphql as W}from"gql.tada";function F(n){return`--- Ripplo Run Failures (scope) ---
5
5
  ${n.join(`
6
6
  `)}
7
7
  Artifacts: .ripplo/debug/<runId>/. ${c("run")}`}function R({lines:n,retried:e}){let r=e?"Already retried once, still unreachable.":"";return["--- Ripplo Run Not Verified (server unreachable) ---",...n,"Server-side transient \u2014 not the daemon, dev server, or auth (`npx ripplo doctor` is green).",r,"Wait a moment, then stop again to re-verify."].filter(t=>t.length>0).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripplo",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "CLI for Ripplo — AI-powered end-to-end testing",
5
5
  "type": "module",
6
6
  "homepage": "https://ripplo.ai",
@@ -25,11 +25,11 @@
25
25
  "better-auth": "^1.5.6",
26
26
  "better-sqlite3": "^12.11.1",
27
27
  "dotenv": "^17.3.1",
28
+ "esbuild": "^0.25.12",
28
29
  "fuse.js": "^7.4.2",
29
30
  "gql.tada": "^1.9.0",
30
31
  "graphql": "^16.11.0",
31
32
  "graphql-sse": "^2.6.0",
32
- "esbuild": "^0.25.12",
33
33
  "latest-version": "^9.0.0",
34
34
  "neverthrow": "^8.2.0",
35
35
  "p-queue": "^9.3.0",
@@ -65,16 +65,17 @@
65
65
  "@types/yargs": "^17.0.35",
66
66
  "eslint": "catalog:",
67
67
  "eslint-plugin-neverthrow": "^1.1.4",
68
+ "fast-check": "^4.3.0",
68
69
  "tsup": "^8.5.1",
69
70
  "vitest": "^4.1.4",
70
71
  "@ripplo/core": "^0.0.0",
71
72
  "@ripplo/eslint-config": "0.0.0",
72
- "@ripplo/rrweb-bundle": "0.0.0",
73
73
  "@ripplo/graphql": "^0.0.0",
74
+ "@ripplo/rrweb-bundle": "0.0.0",
74
75
  "@ripplo/run-report": "0.0.0",
75
- "@ripplo/runtime": "^0.0.0",
76
76
  "@ripplo/solver": "^0.0.0",
77
- "@ripplo/spec": "^0.0.0"
77
+ "@ripplo/spec": "^0.0.0",
78
+ "@ripplo/runtime": "^0.0.0"
78
79
  },
79
80
  "scripts": {
80
81
  "dev": "tsx watch src/index.ts",
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __ripploCreateRequire } from "node:module";
3
- const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{A as j,B as L,G as v,H as g,U as M}from"./chunk-5SM4TCSW.js";import c from"fs";import l from"path";import{createHash as pe}from"crypto";import{pathToFileURL as me}from"url";import{build as ge}from"esbuild";import{err as x,ok as C,ResultAsync as ye}from"neverthrow";import X from"fs";import y from"path";import u from"typescript";function A(e){let t=y.join(e,"index.ts"),n=G(e);X.mkdirSync(y.dirname(n.tsBuildInfoFile??""),{recursive:!0});let r=u.createIncrementalCompilerHost(n),o=u.createIncrementalProgram({host:r,options:n,rootNames:[t]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(a=>V(a,e));if(s.length===0)return{diagnostics:[],ok:!0};let T={getCanonicalFileName:a=>a,getCurrentDirectory:()=>y.dirname(e),getNewLine:()=>`
5
- `};return{diagnostics:u.formatDiagnosticsWithColorAndContext(s,T).split(`
6
- `).filter(a=>a.length>0),ok:!1}}function V(e,t){let n=e.file?.fileName;return n==null?!0:n.startsWith(t)}var Y=y.join(".local","tsbuildinfo");function G(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:u.ModuleKind.Preserve,moduleResolution:u.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:u.ScriptTarget.ES2022,tsBuildInfoFile:y.join(e,Y)}}import h from"fs";import w from"safe-stable-stringify";import{err as q,ok as I,Result as Q}from"neverthrow";async function _(e,t){let n={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces},r=S(t)?void 0:te(t),o=ee(e,r),i=await Promise.all(e.workflows.map(s=>Z({context:n,reusable:o,workflow:s})));return Q.combine(i).map(s=>({...e,workflows:[...s]}))}function S(e){let t=process.argv[1];if(t==null||!h.existsSync(e))return!1;try{return h.statSync(t).mtimeMs>h.statSync(e).mtimeMs}catch{return!1}}async function Z({context:e,reusable:t,workflow:n}){let r=t.get(H(n));if(r!=null)return I({...n,tests:r.tests});try{return I(await M({context:e,workflow:n}))}catch(o){let i=o instanceof Error?o.message:String(o);return q({kind:"expand-failed",message:i,workflow:n.name})}}function H(e){let t=w({...e,tests:[]});if(t==null)throw new Error("solver: workflow is not serializable");return t}function ee(e,t){return t==null||w(O(t))!==w(O(e))?new Map:new Map(t.workflows.map(n=>[H(n),n]))}function O(e){return{entities:e.entities,singletons:e.singletons,valueSpaces:e.valueSpaces}}function te(e){if(h.existsSync(e))try{return L(g,h.readFileSync(e,"utf8"))}catch{return}}import{createHash as ne}from"crypto";import N from"fs/promises";import R from"path";import{err as f,ok as F,Result as re}from"neverthrow";var oe=".ripplo/fixtures",ie=10*1024*1024,se=50*1024*1024;async function W(e,t){let n=ae(t);if(n.length===0)return F({});let r=R.join(e,oe),o=await Promise.all(n.map(i=>le({fixturesRoot:r,name:i})));return re.combine(o).andThen(ce)}function ae(e){let n=e.workflows.flatMap(r=>[...r.steps,...r.tests.flatMap(o=>o.steps)]).flatMap(r=>r.action.kind==="upload"?r.action.files:[]);return[...new Set(n)].toSorted((r,o)=>r.localeCompare(o))}async function le({fixturesRoot:e,name:t}){if(t.includes("..")||R.isAbsolute(t))return f({kind:"fixture-invalid-name",name:t});let n=R.join(e,t),r=await N.lstat(n).catch(()=>null);if(r==null)return f({kind:"fixture-missing",name:t,path:n});if(r.isSymbolicLink())return f({kind:"fixture-symlink",name:t});if(!r.isFile())return f({kind:"fixture-not-file",name:t});let o=await N.readFile(n);if(o.byteLength>ie)return f({kind:"fixture-too-large",name:t,size:o.byteLength});let i=ne("sha256").update(o).digest("hex");return F([t,{sha256:i,size:o.byteLength}])}function ce(e){let t=e.reduce((n,[,r])=>n+r.size,0);return t>se?f({kind:"fixtures-total-too-large",total:t}):F(Object.fromEntries(e))}import{createHash as de}from"crypto";import p from"fs";import P from"path";import{z as b}from"zod";function U({cwd:e,fingerprint:t}){let n=fe(e);if(n==null||n.fingerprint!==E(t))return;let r=P.join(e,".ripplo","ripplo.lock");if(!p.existsSync(r))return;let o=p.readFileSync(r,"utf8");if(E(o)===n.lockfileHash)try{return L(g,o)}catch{return}}function z({cwd:e,fingerprint:t,lockfile:n}){let r={fingerprint:E(t),lockfileHash:E(j(g,n))},o=D(e);p.mkdirSync(P.dirname(o),{recursive:!0}),p.writeFileSync(o,JSON.stringify(r))}var ue=b.object({fingerprint:b.string(),lockfileHash:b.string()});function fe(e){let t=D(e);if(!(!p.existsSync(t)||S(t)))try{let n=ue.safeParse(JSON.parse(p.readFileSync(t,"utf8")));return n.success?n.data:void 0}catch{return}}function D(e){return P.join(e,".ripplo",".local","load-cache.json")}function E(e){return de("sha256").update(e).digest("base64")}var he=".ripplo/ripplo.lock",k;async function at(e){let{result:t}=await ke(e);return t}async function ke(e){let t=$(l.join(e,".ripplo"));if(k!=null&&k.fingerprint===t&&k.result.isOk())return{fingerprint:t,result:k.result};let n=await xe(e);return k={fingerprint:t,result:n},{fingerprint:t,result:n}}async function xe(e){let t=l.join(e,".ripplo"),n=l.join(t,"index.ts"),r=$(t),o=U({cwd:e,fingerprint:r});if(o!=null)return C(o);let i=we(n);i.catch(()=>{});let s=A(t);if(!s.ok)return x({diagnostics:s.diagnostics,kind:"typecheck-failed"});let a=await(await Se(n,i)).andThen(d=>be({entryPath:n,exported:d})).match(async d=>(await W(e,d)).map(m=>({...d,fixtures:m})).mapErr(m=>({error:m,kind:"fixture-failed"})).asyncAndThen(m=>new ye(_(m,l.join(e,he))).mapErr(K=>K)),d=>Promise.resolve(x(d)));return a.isOk()&&z({cwd:e,fingerprint:r,lockfile:a.value}),a}var Le=new Set([".local","debug","node_modules","ripplo.lock"]);function $(e){let t=l.join(e,"..","node_modules","@ripplo","testing","package.json");return[...J(e),...Ee(t)].toSorted((n,r)=>n.localeCompare(r)).join("|")}function J(e){return(c.existsSync(e)?c.readdirSync(e,{withFileTypes:!0}):[]).flatMap(n=>{if(Le.has(n.name))return[];let r=l.join(e,n.name);if(n.isDirectory())return J(r);let o=c.statSync(r);return[`${r}:${String(o.mtimeMs)}:${String(o.size)}`]})}function Ee(e){if(!c.existsSync(e))return[];let t=c.statSync(e);return[`${e}:${String(t.mtimeMs)}:${String(t.size)}`]}async function we(e){let n=(await ge({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 Se(e,t){try{let n=await t;process.setSourceMapsEnabled(!0);let r=await import(Re(e,n)),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;return C(o)}catch(n){return x({kind:"load-threw",message:Fe(n)})}}function Re(e,t){let n=l.join(l.dirname(e),".local");c.mkdirSync(n,{recursive:!0});let r=pe("sha256").update(t).digest("hex").slice(0,16),o=l.join(n,`dsl-bundle-${r}.mjs`);return c.writeFileSync(o,t),me(o).href}function Fe(e){return e instanceof Error?e.message:String(e)}function be({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return x({entryPath:e,kind:"not-ripplo"});let n=v.safeParse(Reflect.get(t,"lockfile"));return n.success?C(n.data):x({issues:n.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"invalid-lockfile"})}export{S as a,oe as b,ie as c,se as d,he as e,at as f,ke as g,xe as h};
@@ -1,242 +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 We,f as Le,g as _e,j as He,n as Be,o as Ve,p as Ke,q as Je,r as Qe}from"./chunk-OY6HNCAZ.js";import{c as ze,e as Ge,g as Ye}from"./chunk-UVYCSHOJ.js";import{c as F}from"./chunk-LEFXRK53.js";import{d as qe}from"./chunk-4W6WIT7T.js";import{a as T}from"./chunk-R4ZTRVDQ.js";import{d as me}from"./chunk-FEHVIHVA.js";import{b as we}from"./chunk-2MT2MZJW.js";import{a as ve}from"./chunk-AVBP7Q2M.js";import{g as Ue,h as Ne}from"./chunk-EK6TENV6.js";import{b as Re,f as ke,g as he,h as Se}from"./chunk-AQ3DMGAY.js";import{c as j}from"./chunk-DBIXYJRB.js";import{a as ye,d as c,f as p}from"./chunk-PE5WVWI5.js";import{B as Ce,D as v,E as Ae,G as Te,H as Me,J as $e,O as Fe,U as je,V as Oe,Y as De,Z as $,a as be,b as xe,c as Y,d as k,e as I,f as Ee,g as Ie,i as M,z as Pe}from"./chunk-ESOXRGIY.js";import{M as A,N as g,i as C,l as E,m as ge}from"./chunk-5SM4TCSW.js";import zn from"p-retry";import{graphql as Xe}from"gql.tada";var Gn=Xe(`
5
- query OpenFindingsForRetire($projectId: String!) {
6
- exploreFindings(projectId: $projectId, status: open) {
7
- signature
8
- reproRun {
9
- reproJson
10
- }
11
- }
12
- }
13
- `),Yn=Xe(`
14
- mutation RetireStaleFinding($projectId: String!, $signature: String!) {
15
- retireStaleFinding(projectId: $projectId, signature: $signature)
16
- }
17
- `);function Ze(e){zn(()=>Xn(e),{factor:2,minTimeout:200,retries:10}).catch(n=>{p.warn({err:n},"retire stale findings failed")})}async function Xn({config:e,cwd:n,lockfile:r}){let o=(await c({config:e,document:Gn,variables:{projectId:e.projectId}})).exploreFindings,i=await Ne(n,r);if(i==null){p.info("skipping finding retire \u2014 lockfile stamps stale, next compile writes them");return}let a=await Zn(o,i);a.length!==0&&(await Promise.all(a.map(s=>nr(e,s))),p.info({count:a.length},"retired findings whose trail no longer replays"))}async function Zn(e,n){return(await Promise.all(e.map(async t=>await er(t,n)?t.signature:null))).filter(t=>t!=null)}async function er(e,n){let r=e.reproRun?.reproJson;if(r==null)return!1;let t=Fe.safeParse(JSON.parse(r));return t.success?(await $(n,t.data)).kind==="unplannable":!1}function nr(e,n){return c({config:e,document:Yn,variables:{projectId:e.projectId,signature:n}})}import rr from"p-queue";var tr=4,or={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},O=new rr({concurrency:tr}),h={headedActive:0,interactiveActive:0,interactiveQueued:0},en={current:null};function Oo({headed:e,task:n,workClass:r}){let t=or[r];return r==="p3-explore"?O.add(n,{priority:t}):(h.interactiveQueued+=1,D(),O.add(()=>ir({headed:e,task:n}),{priority:t}))}function Do(e){!Number.isFinite(e)||e<1||(O.concurrency=Math.floor(e),D())}function X(){return{active:h.interactiveActive,headedActive:h.headedActive,poolSize:O.concurrency,queued:h.interactiveQueued}}function Uo(e){en.current=e}async function ir({headed:e,task:n}){h.interactiveQueued-=1,h.interactiveActive+=1,h.headedActive+=e?1:0,D();try{return await n()}finally{h.interactiveActive-=1,h.headedActive-=e?1:0,D()}}function D(){en.current?.()}import{randomUUID as xr}from"crypto";import{createId as Er}from"@paralleldrive/cuid2";import{CancellationTokenSource as Ir,ResponseError as Pr}from"vscode-jsonrpc/node";async function nn(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(2e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function rn(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(25e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}import{graphql as ar}from"gql.tada";var sr=ar(`
18
- mutation DaemonCreateRun(
19
- $id: String
20
- $workflowId: String!
21
- $testId: String
22
- $clientVersion: String
23
- $executor: RunExecutor
24
- $target: RunTarget
25
- $lockfileHash: String
26
- ) {
27
- createRun(
28
- id: $id
29
- workflowId: $workflowId
30
- testId: $testId
31
- executor: $executor
32
- target: $target
33
- clientVersion: $clientVersion
34
- lockfileHash: $lockfileHash
35
- ) {
36
- __typename
37
- ... on MutationCreateRunSuccess {
38
- data {
39
- id
40
- }
41
- }
42
- ... on LimitExceededError {
43
- code
44
- }
45
- }
46
- }
47
- `);async function tn(e){try{let r=(await c({config:e.config,document:sr,variables:lr(e)})).createRun;return r==null?U({detail:"create-run-null",type:"generic"}):r.__typename==="MutationCreateRunSuccess"?null:r.__typename==="LimitExceededError"?U({code:r.code,type:"limit"}):U({detail:r.__typename,type:"generic"})}catch(n){return dr(n)}}function lr({executor:e,lockfileHash:n,runId:r,target:t}){return{clientVersion:T(),executor:e,id:r,lockfileHash:n,target:e==="cloud"?"tunnel":void 0,testId:t.testId,workflowId:t.workflowId}}function U(e){return{kind:"dispatch-error",reason:e}}function dr(e){return e instanceof ye?{detail:e.message,kind:"infra-error"}:U({detail:e instanceof Error?e.message:String(e),type:"generic"})}import{graphql as ur}from"gql.tada";async function on(e,n){let t=(await c({config:e,document:cr,variables:{cwd:n,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(t.flatMap(o=>o.tests.map(i=>[`${o.slug}/${i.slug}`,{testId:i.id,workflowId:o.id}])))}var cr=ur(`
48
- query DaemonWorkflows($projectId: String!, $cwd: String!) {
49
- project(id: $projectId) {
50
- id
51
- devSession(cwd: $cwd) {
52
- id
53
- workflows {
54
- id
55
- slug
56
- tests {
57
- id
58
- slug
59
- }
60
- }
61
- }
62
- }
63
- }
64
- `);import{CancellationTokenSource as pr}from"vscode-jsonrpc/node";function Z(e){return`${e.workflowSlug}/${e.testSlug}`}function an(e){let{headed:n,inflight:r,jobId:t,lockfileHashValue:o,onExpire:i,runId:a,selection:s,timeoutMs:d}=e,u=Z(s),l=`${u}@${o}@${String(n)}`,f=r.get(l);if(f!=null)return f.jobIds.add(t),null;let y={cancellation:new pr,claimed:!1,claimKey:u,headed:n,inflightKey:l,jobIds:new Set([t]),runId:a,testName:s.testName,timer:null,workflowName:s.workflowName};return y.timer=setTimeout(()=>{N(r,y),i(y)},d),r.set(l,y),y}function N(e,n){n.timer!=null&&(clearTimeout(n.timer),n.timer=null),e.delete(n.inflightKey)}function ee(e,n){let r=[...e.values()].find(t=>t.runId===n&&!t.claimed);return r==null?null:(r.claimed=!0,r.timer!=null&&(clearTimeout(r.timer),r.timer=null),r)}function sn(e,n){[...e.values()].filter(r=>r.jobIds.has(n)).forEach(r=>{r.jobIds.delete(n),r.jobIds.size===0&&(N(e,r),r.cancellation.cancel())})}import{err as ne,ok as ln}from"neverthrow";function un({all:e,ids:n,lockfile:r}){if(e&&n.length>0)return ne({kind:"conflicting-flags"});if(e)return ln(r.workflows.filter(i=>!i.stub).flatMap(i=>i.tests.map(a=>k(a))));if(n.length===0)return ne({kind:"nothing-selected"});let t=n.map(i=>({id:i,refs:yr(r,i)})),o=t.filter(i=>i.refs.length===0).map(i=>i.id);return o.length>0?ne({kind:"unknown-ids",known:fr(r),unknown:o}):ln([...new Set(t.flatMap(i=>i.refs))])}function cn(e,n){let r=new Map(I(e).map(t=>[t.ref,{testName:t.test.name,testSlug:t.test.slug,workflowName:t.workflow.name,workflowSlug:g(t.workflow.name)}]));return n.map(t=>{let o=r.get(t);if(o==null)throw new Error(`selectionsFor: ref not in lockfile: ${t}`);return o})}function fr(e){return e.workflows.map(n=>g(n.name))}function yr(e,n){let r=e.workflows.find(t=>t.name===n||g(t.name)===g(n));return r!=null?r.tests.map(t=>k(t)):I(e).filter(t=>t.ref===n||dn(t.ref)===dn(n)).map(t=>t.ref)}function dn(e){let n=e.lastIndexOf("/");return n===-1?g(e):`${g(e.slice(0,n))}/${g(e.slice(n+1))}`}import{err as re,ok as pn}from"neverthrow";import{graphql as fn}from"gql.tada";async function yn({config:e,cwd:n,lockfile:r}){await gr({config:e,cwd:n,lockfile:r});let t=await kr(e);if(t.isErr())return re(t.error);let o=new Map(r.workflows.filter(a=>!a.stub).map(a=>[g(a.name),a])),i=[...new Set(t.value)].flatMap(a=>{let s=o.get(a);return s==null?[]:s.tests.map(d=>k(d))});return i.length===0?re({kind:"scope-empty"}):pn(i)}var mr=fn(`
65
- mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
66
- addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
67
- __typename
68
- }
69
- }
70
- `);async function gr({config:e,cwd:n,lockfile:r}){let t=new Set(Ye(n)),o=r.workflows.filter(i=>i.sourcePath!=null&&t.has(i.sourcePath)).map(i=>g(i.name));o.length!==0&&await c({config:e,document:mr,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:o}}).catch(i=>{p.warn({err:i},"auto-scope of dirty tests failed")})}var Rr=fn(`
71
- query ScopeSelection($projectId: String!, $cwd: String!) {
72
- project(id: $projectId) {
73
- id
74
- devSession(cwd: $cwd) {
75
- id
76
- scopeItems {
77
- id
78
- workflow {
79
- id
80
- slug
81
- }
82
- }
83
- }
84
- }
85
- }
86
- `);async function kr(e){try{let r=(await c({config:e,document:Rr,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return pn(r.flatMap(t=>t.workflow==null?[]:[t.workflow.slug]))}catch(n){return re({detail:n instanceof Error?n.message:String(n),kind:"scope-fetch-failed"})}}import{graphql as hr}from"gql.tada";var Sr=2e3,vr=hr(`
87
- query DaemonCloudRunStatus($runId: String!) {
88
- run(id: $runId) {
89
- status
90
- failureReason
91
- }
92
- }
93
- `);function gn({config:e,onComplete:n,onStarted:r,runId:t,signal:o}){let i=!1,a,s=!1,d=async()=>{if(i||o.aborted)return;let u=await wr(e,t).catch(()=>"unknown");if(!(i||o.aborted)){if(!s&&(u==="running"||mn(u))&&(s=!0,r()),mn(u)){i=!0,n(br(u));return}a=setTimeout(()=>{d()},Sr)}};return d(),{stop:()=>{i=!0,a!=null&&clearTimeout(a)}}}async function wr(e,n){let t=(await c({config:e,document:vr,variables:{runId:n}})).run?.status;return t??"unknown"}function mn(e){return e==="passed"||e==="failed"||e==="cancelled"||e==="unready"}function br(e){return e==="passed"?{kind:"pass"}:e==="failed"?{detail:"failed",kind:"error"}:e==="cancelled"?{detail:"cancelled",kind:"error"}:e==="unready"?{detail:"unready",kind:"error"}:{detail:"unknown",kind:"error"}}var Cr=We(process.argv[1]),Ar=12e4,Tr=-32099,te=new Set,Rn=new Map;function Pi(e){te.add(e)}function Mr(e){let n=new AbortController;return e.isCancellationRequested?(n.abort(),n.signal):(e.onCancellationRequested(()=>{n.abort()}),n.signal)}function Ci(e){let n={...e,inflight:new Map,jobs:new Map};return{claim:r=>Dr(n,r),handleConnection:r=>{$r(n,r)},idle:()=>Sn(n)}}function $r(e,n){let r=Le(n);r.onRequest(Be,(t,o)=>Fr({connection:r,ctx:e,params:t,token:o})),r.onRequest(Ve,()=>{let t=X();return{active:t.active,bundleMtimeMs:Cr,queued:t.queued,sseHealth:e.sseHealth(),version:T(),...e.explorationStatus()}}),r.onRequest(Ke,()=>{let t=Sn(e);return t&&e.onShutdownRequest(),t}),r.onClose(()=>{jr(e,r)}),r.onError(t=>{p.warn({err:t},"ipc connection error")}),n.on("error",t=>{p.warn({err:t},"ipc socket error")}),r.listen()}function Sn(e){let n=X();return e.jobs.size===0&&n.active===0&&n.queued===0}async function Fr({connection:e,ctx:n,params:r,token:t}){let o=_e.safeParse(r);if(!o.success)throw kn({code:"bad-message"});await n.ready;let i=await Nr({config:n.config,cwd:n.cwd,message:o.data});if(i.kind==="error")throw kn(i.error);let a=xr(),s=new Ir;return t.onCancellationRequested(()=>{vn(n,a)}),n.jobs.set(a,{cancellation:s,connection:e,failed:0,notRun:0,passed:0,total:i.selections.length}),Vr({ctx:n,headed:o.data.headed,jobId:a,lockfileHashValue:i.lockfileHashValue,selections:i.selections,targetsByClaimKey:i.targetsByClaimKey,token:s.token}).catch(d=>{p.error({err:d},"ipc dispatch failed")}),{jobId:a,total:i.selections.length}}function kn(e){return new Pr(Tr,e.code,e)}function vn(e,n){let r=e.jobs.get(n);r!=null&&(r.cancellation.cancel(),e.jobs.delete(n),sn(e.inflight,n))}function jr(e,n){[...e.jobs.entries()].filter(([,r])=>r.connection===n).forEach(([r])=>{vn(e,r)})}function wn(e,n,r){let t=e.jobs.get(n);t!=null&&(hn(()=>t.connection.sendNotification(Je,{event:r,jobId:n})),r.kind==="test-outcome"&&(Or(t,r.outcome.kind),t.passed+t.failed+t.notRun>=t.total&&(hn(()=>t.connection.sendNotification(Qe,{failed:t.failed,jobId:n,notRun:t.notRun,passed:t.passed})),e.jobs.delete(n))))}function hn(e){Promise.resolve().then(e).catch(n=>{p.warn({err:n},"ipc notification failed")})}function Or(e,n){if(n==="pass"){e.passed+=1;return}if(n==="dispatch-error"||n==="dispatch-timeout"||n==="infra-error"){e.notRun+=1;return}e.failed+=1}function w(e,n,r){n.jobIds.forEach(t=>{wn(e,t,r)})}function Dr(e,n){let r=ee(e.inflight,n);return r==null?null:{headed:r.headed,token:r.cancellation.token,finished:(t,o)=>{e.inflight.delete(r.inflightKey),w(e,r,{kind:"test-outcome",outcome:o,runId:r.runId,testName:r.testName,workflowName:r.workflowName})},started:()=>{w(e,r,{kind:"test-started",runId:r.runId,testName:r.testName,workflowName:r.workflowName})}}}function Ur(e){return e.kind==="typecheck-failed"?e.diagnostics.slice(0,5):e.kind==="invalid-lockfile"?e.issues.slice(0,5):e.kind==="load-threw"?[e.message]:[]}async function Nr({config:e,cwd:n,message:r}){return(await ke(n)).match(o=>qr({config:e,cwd:n,lockfile:o,message:r}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...Ur(o)]},kind:"error"}))}async function qr({config:e,cwd:n,lockfile:r,message:t}){let o=await nn(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await rn(e.engineUrl);if(i!=null)return{error:{code:"engine-unreachable",detail:i,url:e.engineUrl},kind:"error"};let a=await Ge(n);if(a==null)return{error:{code:"sync-failed",detail:"lockfile-missing"},kind:"error"};if(!te.has(a)){let d=await Lr({config:e,cwd:n,lockfile:r});if(d!=null)return{error:{code:"sync-failed",detail:d},kind:"error"};te.add(a),Ze({config:e,cwd:n,lockfile:r})}return(await _r({config:e,cwd:n,lockfile:r,message:t})).match(async d=>({kind:"ready",lockfileHashValue:a,selections:cn(r,d),targetsByClaimKey:await Wr({config:e,cwd:n,hash:a})}),d=>Promise.resolve({error:d,kind:"error"}))}async function Wr({config:e,cwd:n,hash:r}){let t=Rn.get(r);if(t!=null)return t;let o=await on(e,n);return Rn.set(r,o),o}async function Lr(e){try{return await ze(e),null}catch(n){return n instanceof Error?n.message:String(n)}}async function _r({config:e,cwd:n,lockfile:r,message:t}){return!t.all&&t.tests.length===0?(await yn({config:e,cwd:n,lockfile:r})).mapErr(Hr):un({all:t.all,ids:t.tests,lockfile:r}).mapErr(Br)}function Hr(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function Br(e){switch(e.kind){case"conflicting-flags":return{code:"selection-conflicting-flags"};case"nothing-selected":return{code:"selection-nothing-selected"};case"unknown-ids":return{code:"selection-unknown-ids",known:[...e.known],unknown:[...e.unknown]}}}async function Vr(e){await e.selections.reduce((n,r)=>n.then(()=>Kr(e,r)),Promise.resolve())}async function Kr(e,n){let{ctx:r,headed:t,jobId:o,lockfileHashValue:i,targetsByClaimKey:a,token:s}=e;if(s.isCancellationRequested)return;let d=Z(n),u=a.get(d);if(u==null){wn(r,o,{kind:"test-outcome",outcome:{kind:"dispatch-error",reason:{detail:"test-not-found",type:"generic"}},runId:"",testName:n.testName,workflowName:n.workflowName});return}let l=an({headed:t,inflight:r.inflight,jobId:o,lockfileHashValue:i,runId:Er(),selection:n,timeoutMs:Ar,onExpire:m=>{w(r,m,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-timeout"},runId:"",testName:m.testName,workflowName:m.workflowName})}});if(l==null)return;let f=r.executor(),y=await Jr({ctx:r,executor:f,lockfileHashValue:i,run:l,target:u});if(y!=null){N(r.inflight,l),w(r,l,{kind:"test-outcome",outcome:y,runId:"",testName:n.testName,workflowName:n.workflowName});return}f==="cloud"&&Qr(r,l)}function Jr({ctx:e,executor:n,lockfileHashValue:r,run:t,target:o}){return tn({config:e.config,executor:n,lockfileHash:r,runId:t.runId,target:o})}function Qr(e,n){let r=ee(e.inflight,n.runId);r!=null&&gn({config:e.config,runId:r.runId,signal:Mr(r.cancellation.token),onComplete:t=>{e.inflight.delete(r.inflightKey),w(e,r,{kind:"test-outcome",outcome:t,runId:r.runId,testName:r.testName,workflowName:r.workflowName})},onStarted:()=>{w(e,r,{kind:"test-started",runId:r.runId,testName:r.testName,workflowName:r.workflowName})}})}import zr from"fs";import Gr from"path";async function Di(e){let n=Gr.join(e,".ripplo","index.ts");if(!zr.existsSync(n))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await Se(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:ve(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:me().match(t=>({appUrl:t.appUrl,engineUrl:t.engineUrl,errors:[],valid:!0,warnings:[]}),t=>({appUrl:void 0,engineUrl:void 0,errors:[{message:we(t),path:""}],valid:!1,warnings:[]}))}async function Ui(e){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return}catch{return`appUrl (${e}) is not responding. Make sure your dev server is running on that port.`}}async function Ni({appUrl:e,engineUrl:n}){let r=n.startsWith("http://")||n.startsWith("https://")?n:`${e}${n}`;try{return(await fetch(`${r}/setup`,{body:JSON.stringify({}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Engine endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}function Yr(e){let{backoffActive:n,exploreEnabled:r,headedActive:t,interactiveActive:o,interactiveQueued:i}=e,{explorationActive:a,exploreConcurrency:s,poolSize:d}=e;if(!r||t||o>0||i>0)return{abortCount:a,refillCount:0};if(n)return{abortCount:0,refillCount:0};let u=Math.min(s,d-1);return{abortCount:0,refillCount:Math.max(0,u-a)}}function Wi(e){let n={active:new Map,backoffUntil:0,cancelBackoffTimer:null,cancelHeartbeat:null,prevInteractiveActive:e.probe().interactiveActive,stopped:!1};return En(n,e),{explorationActive:()=>n.active.size,notifyQueueChange:()=>{Zr(n,e)},stalled:()=>nt(n,e),stop:()=>{n.stopped=!0,n.cancelBackoffTimer?.(),n.cancelBackoffTimer=null,n.cancelHeartbeat?.(),n.cancelHeartbeat=null,Pn(n,n.active.size)}}}function En(e,n){e.stopped||(e.cancelHeartbeat=n.setTimer(()=>{q(e,n),En(e,n)},15e3))}function q(e,n){if(e.stopped)return;Xr(e,n);let r=n.probe(),t=Yr({backoffActive:n.now()<e.backoffUntil,explorationActive:e.active.size,exploreConcurrency:n.exploreConcurrency(),exploreEnabled:n.exploreEnabled(),headedActive:r.headedActive>0,interactiveActive:r.interactiveActive,interactiveQueued:r.interactiveQueued,poolSize:r.poolSize});Pn(e,t.abortCount),Cn({count:t.refillCount,params:n,state:e})}function Xr(e,n){In(e,n).forEach(({controller:r})=>{r.abort()})}function In(e,n){let r=n.now()-9e4;return[...e.active.values()].filter(t=>t.startedAt<=r)}function Pn(e,n){[...e.active.values()].slice(0,n).forEach(({controller:r})=>{r.abort()})}function Zr(e,n){let r=n.probe();r.interactiveActive<e.prevInteractiveActive&&et(e,n),e.prevInteractiveActive=r.interactiveActive,q(e,n)}function et(e,n){e.backoffUntil=n.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=n.setTimer(()=>{e.cancelBackoffTimer=null,q(e,n)},3e4)}function nt(e,n){return In(e,n).length}function Cn({count:e,params:n,state:r}){if(e<=0)return;let t=rt(n.sources);t!=null&&(tt({params:n,pulled:t,state:r}),Cn({count:e-1,params:n,state:r}))}function rt(e){return e.reduce((n,r)=>{if(n!=null)return n;let t=r.next();return t==null?null:{job:t,source:r}},null)}function tt({params:e,pulled:n,state:r}){let{job:t,source:o}=n,i=new AbortController;r.active.set(t.id,{controller:i,job:t,source:o,startedAt:e.now()}),e.execute({job:t,priority:o.priority,signal:i.signal}).then(()=>{xn({job:t,outcome:bn(i.signal,null),params:e,source:o,state:r})}).catch(a=>{xn({job:t,outcome:bn(i.signal,{error:a}),params:e,source:o,state:r})})}function bn(e,n){return e.aborted?{kind:"aborted"}:n==null?{kind:"completed"}:{error:n.error,kind:"error"}}function xn({job:e,outcome:n,params:r,source:t,state:o}){o.active.delete(e.id),t.onResult(e,n),q(o,r)}import{createMessageConnection as An,IPCMessageReader as Tn,IPCMessageWriter as Mn,NotificationType as ot,NotificationType0 as $n,RequestType as Fn,RequestType0 as it}from"vscode-jsonrpc/node";import{z as R}from"zod";var Ki=R.object({headed:R.boolean(),runId:R.string().min(1),testRef:R.string().min(1)}),Ji=R.object({lockfileJson:R.string().optional(),unavailable:R.string().optional()}),Qi=R.object({runId:R.string().min(1),span:ge}),zi=R.object({outcome:He,serverNotified:R.boolean()}),Gi=new $n("worker/ready"),Yi=new Fn("worker/run"),Xi=new it("worker/lockfile"),Zi=new Fn("worker/exploreTrail"),ea=new ot("worker/span"),na=new $n("worker/shutdown");function ra(e){let n=An(new Tn(e),new Mn(e));return n.listen(),n}function ta(){let e=An(new Tn(process),new Mn(process));return e.listen(),e}import{gzipSync as yt}from"zlib";import{appendFileSync as mt,existsSync as L,readFileSync as Nn,writeFileSync as Un}from"fs";import S from"path";import{graphql as ie}from"gql.tada";function W(e){return[e.kind,e.target,e.value].filter(n=>n.length>0).join(" ")}function jn(e,n){return{kind:"finding",payload:dt(e),source:"verifier",step:n.step,stepIndex:n.stepIndex,timeNanos:n.timeNanos}}var at={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"},st={"data-rule":"dataRule",fact:"fact",step:"step"},lt={aborted:"aborted","action-failed":"actionFailed","app-not-ready":"appNotReady","check-failed":"checkFailed","client-mount-missing":"clientMountMissing","conflicting-sessions":"conflictingSessions","driver-launch":"driverLaunch","engine-decode":"engineDecode","engine-http":"engineHttp","engine-network":"engineNetwork","engine-unreachable":"engineUnreachable","setup-missing-row":"setupMissingRow","state-identity":"stateIdentity"};function dt(e){return e.kind==="consistency"?{kind:"mismatch",mismatch:ft(e.mismatch),pending:e.pending,wait:e.budget,waitMs:Y[e.budget]}:e.kind==="pending-check"?{...ut(e.source),kind:"pendingCheck",source:st[e.source.kind],wait:e.budget,waitMs:Y[e.budget]}:e.kind==="unrunnable"?{kind:"unrunnable",reason:at[e.reason],unmet:e.unmet==null?void 0:Me(e.unmet)}:e.kind==="impossible-action"?{action:ct(e.step.action),kind:"impossibleAction",subject:Dn(e.step.action)}:e.kind==="lift-visibility"?{declaredIndex:e.declaredIndex,kind:"liftVisibility",subject:E(e.locator),visibleIndex:e.visibleIndex}:{errorKind:lt[e.error.kind],kind:"driverError",message:pt(e.error)}}function ut(e){return"check"in e?On(e.check,!1):{checkKind:null,expected:null,negated:!1,subject:Ce(e.dataRule)}}function On(e,n){return e.kind==="not"?On(e.inner,!n):e.kind==="browser"?{checkKind:"browser",expected:e.value??null,negated:n,subject:be(e.key)}:e.kind==="value"||e.kind==="text"?{checkKind:e.kind,expected:e.value,negated:n,subject:E(e.locator)}:{checkKind:e.kind,expected:null,negated:n,subject:E(e.locator)}}function ct(e){return`${e.kind} ${Dn(e)}`.trim()}function Dn(e){return e.locator==null?e.url??"":E(e.locator)}function pt(e){return"message"in e?e.message:"detail"in e?e.detail:null}function ft(e){if(e.kind==="wrong-value")return{actual:v(e.sut),entity:e.entity,expected:v(e.snapshot),field:e.field,key:e.key,kind:"wrongValue"};if(e.kind==="expected-change"){let n=e.direction==null?"change":e.direction.replace(/d$/,"");return{actual:v(e.value),entity:e.entity,expected:`${n} from ${v(e.from)}`,field:e.field,key:e.key,kind:"expectedChange"}}return e.kind==="scalar-mismatch"?{actual:v(e.sut),expected:Ae(e.want),kind:"scalarMismatch",subject:Pe(e.subject),subjectKey:xe(e.subject)}:e.kind==="missing-row"?{entity:e.entity,key:e.key,kind:"missingRow"}:{entity:e.entity,key:e.key,kind:"unexpectedRow"}}function H({config:e,fixturesDir:n,headed:r}){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:C,headed:r,secret:e.webhookSecret}}async function ae(e){let n=B(e);await se(e.config,e.runId,n)}function B({debugDir:e,events:n,recordingOptional:r,runId:t,stepSources:o}){let i=le(n),a=bt(e,t);if(a==null&&!r)throw new Error("recording-missing");let s=i.map((u,l)=>jt({aliases:[...It(n),...Pt(i)],generated:Ct(n),generatedSingletons:At(n),origin:a==null?wt(i):a.origin,record:u,rrwebEvents:a==null?[]:a.events,sourceTest:o?.[l]??null})),d=i.flatMap(u=>u.findings.map(l=>jn(l,{step:W(A(u.source,u.index)),stepIndex:u.index,timeNanos:qn(u)})));return gt({debugDir:e,events:[...s,...d],runId:t}),i}function gt({debugDir:e,events:n,runId:r}){if(n.length===0)return;let t=S.join(e,r,"behavior.jsonl");if(!L(t))return;let o=n.map(i=>JSON.stringify(i)).join(`
94
- `);mt(t,`${o}
95
- `)}function qn(e){return String(BigInt(Math.max(0,Math.round(e.endMs)))*1000000n)}async function se(e,n,r){let t=r.filter(a=>a.findings.length>0).length,o=r.length-t,i=r.reduce((a,s)=>a+Math.max(0,s.endMs-s.startMs),0);await c({config:e,document:Ut,variables:{items:[{duration:i,failCount:t,firstFailedStepTitle:Rt(r),passCount:o,runId:n,status:t>0?"failed":"passed"}]}})}function Rt(e){let n=e.filter(r=>r.findings.length>0).toSorted((r,t)=>r.index-t.index).at(0);return n==null?null:W(A(n.source,n.index))}function le(e){return e.flatMap(n=>n.kind==="step"?[{annotations:n.annotations,endMs:n.endMs,findings:n.findings,index:n.index,source:n.source,startMs:n.startMs,state:n.state,url:n.url}]:[])}async function Wn(e,n){await c({config:e,document:Nt,variables:{runIds:[n]}})}var _=".uploaded";async function kt({config:e,debugDir:n,runId:r}){let t=S.join(n,r),o=S.join(t,"behavior.jsonl");if(L(S.join(t,_)))return;if(!L(o)){p.warn({runId:r},"behavior upload skipped: behavior.jsonl missing on disk");return}await[0,1e3,3e3].reduce((a,s)=>a.then(async d=>d?!0:(await new Promise(u=>setTimeout(u,s)),ht({behaviorPath:o,config:e,runDir:t,runId:r}))),Promise.resolve(!1))}async function ht({behaviorPath:e,config:n,runDir:r,runId:t}){try{let o=await c({config:n,document:Dt,variables:{runId:t}}),i=await fetch(o.debugArtifactUploadUrl,{body:yt(Nn(e)),headers:{"content-type":vt},method:"PUT"});return i.ok?(await Wn(n,t),Un(S.join(r,_),""),!0):(p.warn({runId:t,status:i.status},"behavior upload PUT failed"),!1)}catch(o){return St(o)?(p.warn({runId:t},"behavior upload refused by server; run unknown \u2014 not retrying"),Un(S.join(r,_),""),!0):(p.warn({error:o,runId:t},"behavior upload failed"),!1)}}function St(e){if(typeof e!="object"||e==null||!("errors"in e))return!1;let{errors:n}=e;return Array.isArray(n)&&n.some(r=>{if(typeof r!="object"||r==null||!("extensions"in r))return!1;let{extensions:t}=r;return typeof t=="object"&&t!=null&&"code"in t&&t.code==="FORBIDDEN"})}var vt="application/x-ndjson";function wt(e){return e.reduce((n,r)=>Math.min(n,r.startMs),e[0]?.startMs??0)}function bt(e,n){let r=S.join(e,n,"behavior.jsonl");if(!L(r))return null;let t=Nn(r,"utf8").split(`
96
- `).filter(i=>i.length>0).map(i=>xt(i)).flatMap(i=>Et(i)?[i.event]:[]),o=t[0];return o==null?null:{events:t,origin:o.timestamp}}function xt(e){return JSON.parse(e)}function Et(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}function It(e){return e.flatMap(n=>n.kind==="world"?n.aliases:[])}function Pt(e){return e.flatMap(n=>{let r=Tt(n.source);return r.flatMap(t=>{let i=r.filter(s=>s.entity===t.entity).indexOf(t),a=n.state.rows.filter(s=>s.status==="created"&&s.entity===t.entity).at(i);return a==null?[]:[{alias:t.as,entity:t.entity,key:a.key}]})})}function Ct(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generated.map(r=>Ln(r)):[]))}function Ln({entity:e,field:n,key:r}){return`${e} ${r} ${n}`}function At(e){return new Set(e.flatMap(n=>n.kind==="world"?n.generatedSingletons:[]))}function Tt(e){return e==null?[]:e.expect.flatMap(n=>oe(n))}function oe(e){return e.kind==="state"&&e.assertion.kind==="created"?[{as:e.assertion.as,entity:e.entity}]:e.kind==="and"?e.predicates.flatMap(n=>oe(n)):e.kind==="when"?e.branches.flatMap(n=>n.consequence.flatMap(r=>oe(r))):[]}var Mt=3,$t=0;function Ft({endMs:e,rrwebEvents:n,startMs:r}){let t=n.find(o=>o.type===Mt&&o.data?.source===$t&&o.timestamp>=r&&o.timestamp<=e);return t==null?r:t.timestamp}function jt({aliases:e,generated:n,generatedSingletons:r,origin:t,record:o,rrwebEvents:i,sourceTest:a}){let s=A(o.source,o.index),d=Ft({endMs:o.endMs,rrwebEvents:i,startMs:o.startMs});return{annotations:[...o.annotations.map(l=>({ephemeral:l.ephemeral,kind:l.kind,label:l.label,outcome:l.outcome,recordingStartMs:Math.max(0,(l.kind==="action"?d:l.atMs)-t),rrwebIds:[...l.rrwebIds],url:l.url,value:l.value??null}))],duration:Math.max(0,o.endMs-o.startMs),kind:"step",nodeType:s.kind,pageUrl:o.url,recordingEndMs:Math.max(0,o.endMs-t),recordingStartMs:Math.max(0,d-t),source:"verifier",sourceTest:a,stateRows:o.state.rows.map(l=>Ot({aliases:e,generated:n,row:l})),stateSingletons:o.state.singletons.map(l=>({changed:l.changed,generated:r.has(l.name),name:l.name,value:l.value==null?null:String(l.value)})),stepIndex:o.index,timeNanos:qn(o),title:W(s)}}function Ot({aliases:e,generated:n,row:r}){let t=e.find(o=>o.entity===r.entity&&o.key===r.key);return{entity:r.entity,fields:r.fields.map(o=>({changed:o.changed,field:o.field,generated:n.has(Ln({entity:r.entity,field:o.field,key:r.key})),value:o.value==null?null:String(o.value)})),key:r.key,label:t?.alias??r.key,status:r.status}}var Dt=ie(`
97
- mutation DebugArtifactUploadUrl($runId: String!) {
98
- debugArtifactUploadUrl(runId: $runId)
99
- }
100
- `),Ut=ie(`
101
- mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
102
- completeRunsBatch(items: $items) {
103
- id
104
- status
105
- }
106
- }
107
- `),Nt=ie(`
108
- mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
109
- markRunArtifactsUploadedBatch(runIds: $runIds)
110
- }
111
- `);import{graphql as b}from"gql.tada";function qt(e){let n=e.trail;if(!(n==null||!Wt(e.kind)))return{baseLabel:n.baseLabel,baseState:n.baseState,durationMs:n.durationMs,outcome:e.kind,runId:e.runId,signature:n.signature,steps:n.steps}}function Wt(e){return e==="clean"||e==="flaky"||e==="finding"}async function de({baseState:e,category:n,config:r,debugDir:t,devSessionId:o,events:i,lockfileHash:a,reproJson:s,runId:d,signature:u,spec:l,stepSources:f,summary:y,workflowSlug:m}){await c({config:r,document:Vt,variables:{devSessionId:o??null,lockfileHash:a??null,projectId:r.projectId,reproJson:s,runId:d,spec:l??null,workflowSlug:m??null}}),await ae({config:r,debugDir:t,events:i,recordingOptional:!0,runId:d,stepSources:f}),await c({config:r,document:Kt,variables:{baseState:e,category:n,projectId:r.projectId,reproRunId:d,signature:u,summary:y}})}async function V(e,n,r){return(await c({config:e,document:Jt,variables:{lockfileHash:r,projectId:e.projectId,signature:n}})).exploreFindingExists}async function Lt({attempts:e,config:n,devSessionId:r,findings:t,trail:o}){await c({config:n,document:Ht,variables:{attempts:e,devSessionId:r,findings:t,trail:o==null?null:{baseLabel:o.baseLabel,baseState:o.baseState,durationMs:o.durationMs,findingRunId:o.runId??null,findingSignature:o.signature??null,outcome:o.outcome,steps:o.steps.map(i=>({test:i.test,text:i.text}))}}})}async function _t(e,n){return(await c({config:e,document:Bt,variables:{devSessionId:n}}).catch(t=>(p.warn({error:t},"reportExploreUnhealthy failed"),null)))?.reportExploreUnhealthy??!1}var Ht=b(`
112
- mutation RecordExplorationProgress(
113
- $devSessionId: String!
114
- $attempts: Int!
115
- $findings: Int!
116
- $trail: ExploreTrailInput
117
- ) {
118
- recordExplorationProgress(
119
- devSessionId: $devSessionId
120
- attempts: $attempts
121
- findings: $findings
122
- trail: $trail
123
- )
124
- }
125
- `),Bt=b(`
126
- mutation ReportExploreUnhealthy($devSessionId: String!) {
127
- reportExploreUnhealthy(devSessionId: $devSessionId)
128
- }
129
- `),Vt=b(`
130
- mutation CreateExploreRun(
131
- $projectId: String!
132
- $runId: String!
133
- $devSessionId: String
134
- $lockfileHash: String
135
- $spec: String
136
- $reproJson: String
137
- $workflowSlug: String
138
- ) {
139
- createExploreRun(
140
- projectId: $projectId
141
- runId: $runId
142
- devSessionId: $devSessionId
143
- lockfileHash: $lockfileHash
144
- spec: $spec
145
- reproJson: $reproJson
146
- workflowSlug: $workflowSlug
147
- ) {
148
- id
149
- }
150
- }
151
- `),Kt=b(`
152
- mutation SubmitExploreFinding(
153
- $projectId: String!
154
- $signature: String!
155
- $summary: String!
156
- $baseState: String!
157
- $category: ExploreFindingCategory!
158
- $reproRunId: String!
159
- ) {
160
- submitExploreFinding(
161
- projectId: $projectId
162
- signature: $signature
163
- summary: $summary
164
- baseState: $baseState
165
- category: $category
166
- reproRunId: $reproRunId
167
- ) {
168
- id
169
- }
170
- }
171
- `),wa=b(`
172
- mutation SetExploreFindingStatus(
173
- $projectId: String!
174
- $signature: String!
175
- $status: ExploreFindingStatus!
176
- ) {
177
- setExploreFindingStatus(projectId: $projectId, signature: $signature, status: $status)
178
- }
179
- `),Jt=b(`
180
- query ExploreFindingExists($projectId: String!, $signature: String!, $lockfileHash: String!) {
181
- exploreFindingExists(projectId: $projectId, signature: $signature, lockfileHash: $lockfileHash)
182
- }
183
- `);import Gt from"path";import{graphql as Yt}from"gql.tada";import{graphql as K}from"gql.tada";function ue(e){switch(e.kind){case"app-not-ready":return"appNotReady";case"client-mount-missing":return"appNotReady";case"engine-network":case"engine-http":return"backendUnreachable";case"engine-unreachable":return"engineUnreachable";case"engine-decode":case"state-identity":case"setup-missing-row":case"conflicting-sessions":case"driver-launch":case"action-failed":case"check-failed":case"aborted":return null}}async function ce(e,n,r){await c({config:e,document:Qt,variables:{reason:r,runId:n}}).catch(t=>{p.error(t,"failRun submission failed")})}async function pe(e,n,r){await c({config:e,document:zt,variables:{cause:r,runId:n}}).catch(t=>{p.error(t,"markRunUnready submission failed")})}var Ia=K(`
184
- mutation ReleaseRun($runId: String!) {
185
- releaseRun(runId: $runId)
186
- }
187
- `),Pa=K(`
188
- mutation HeartbeatRun($runId: String!) {
189
- heartbeatRun(runId: $runId)
190
- }
191
- `),Qt=K(`
192
- mutation FailRun($runId: String!, $reason: String!) {
193
- failRun(runId: $runId, reason: $reason)
194
- }
195
- `),zt=K(`
196
- mutation MarkRunUnready($runId: String!, $cause: RunUnreadyCause!) {
197
- markRunUnready(runId: $runId, cause: $cause)
198
- }
199
- `);async function Xt({config:e,cwd:n,errorSettle:r,fixturesDir:t,headed:o,lockfile:i,onPhase:a,runId:s,session:d,signal:u,test:l}){if(!await eo(e,s))return{outcome:{kind:"dispatch-failed",reason:"already-claimed",runId:s},persisted:Promise.resolve()};let y=Gt.join(n,".ripplo","debug"),m=[];return(await d.runOnce({capture:!0,lockfile:i,onPhase:a,options:H({config:e,fixturesDir:t,headed:o}),params:void 0,runId:s,sequence:void 0,test:l,onEvent:x=>{m.push(x)}},u)).match(async x=>{let fe=le(m),z=fe.flatMap(Qn=>Qn.findings),G=Zt(z);if(G!=null)return B({config:e,debugDir:y,events:m,recordingOptional:!0,runId:s,stepSources:void 0}),await _n({config:e,error:G,errorSettle:r,runId:s}),{outcome:{error:G,kind:"error",runId:s},persisted:Promise.resolve()};await se(e,s,fe),B({config:e,debugDir:y,events:m,recordingOptional:!0,runId:s,stepSources:void 0});let Jn=Promise.resolve();return{outcome:z.length>0?{findings:z,kind:"findings",runId:s}:{kind:"pass",runId:s},persisted:Jn}},async x=>(await _n({config:e,error:x,errorSettle:r,runId:s}),{outcome:{error:x,kind:"error",runId:s},persisted:Promise.resolve()}))}async function _n({config:e,error:n,errorSettle:r,runId:t}){if(r==="defer")return;let o=ue(n);if(o!=null){await pe(e,t,o);return}await ce(e,t,M(n))}function Zt(e){let n=e.find(r=>r.kind==="driver-error"&&Ie(r.error));return n!=null&&n.kind==="driver-error"?n.error:void 0}async function eo(e,n){return((await c({config:e,document:no,variables:{runIds:[n]}})).startRunsBatch??[]).some(t=>t.id===n)}var no=Yt(`
200
- mutation StartRunsBatch($runIds: [String!]!) {
201
- startRunsBatch(runIds: $runIds) {
202
- id
203
- }
204
- }
205
- `);import{randomUUID as ro}from"crypto";async function to({assign:e,config:n,debugDir:r,devSessionId:t,fixturesDir:o,headed:i,lockfile:a,report:s,session:d,signal:u}){let l=Ee(a);if(e.stepRuns.length===0)return{kind:"error",reason:"empty-trail"};let f=yo(l,e.stepRuns),y=await De({baseState:{name:k(e.baseStateTest),test:e.baseStateTest},corpus:l,lockfile:a,options:H({config:n,fixturesDir:o,headed:i}),seenSignature:s?P=>V(n,P,e.lockfileHash):void 0,session:d,stepRuns:e.stepRuns,runIdFor:P=>`explore-${ro()}-${String(P)}`},u),m=s?await uo({baseStateTest:e.baseStateTest,config:n,debugDir:r,devSessionId:t,lockfileHash:e.lockfileHash,outcome:y,reproJson:so(l,e),stepSources:lo(f)}):!1;return ao(y,f.length),mo(y,m,oo(f,e,y))}function oo(e,n,r){if(r.kind==="error"||r.kind==="aborted")return;let t=r.timing.confirm;return{baseLabel:n.baseStateTest.intent,baseState:k(n.baseStateTest),durationMs:Math.round(J(r.timing.detect)+(t==null?0:J(t))),signature:r.kind==="finding"||r.kind==="seen"?r.signature:void 0,steps:io(e.slice(0,r.ranCount))}}function io(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(t=>({test:r,text:t}))})}function J(e){return e.engineMs+e.worldMs+e.browserMs+e.driveMs+e.teardownMs}function ao(e,n){if(e.kind==="error"){p.info({detail:M(e.error),kind:e.kind,reason:e.error.kind,steps:n},"explore trail");return}if(e.kind==="aborted"||e.kind==="seen"){p.info({kind:e.kind,steps:n},"explore trail");return}let r=e.timing.detect,t=e.timing.confirm;p.info({browserMs:r.browserMs,confirmMs:t==null?void 0:J(t),detectMs:J(r),driveMs:r.driveMs,engineMs:r.engineMs,kind:e.kind,steps:n,teardownMs:r.teardownMs,worldMs:r.worldMs},"explore trail")}function so(e,n){let r=n.stepRuns.flatMap(o=>{let i=e[o.idx];return i==null?[]:[{index:i.index,params:o.params,test:i.test}]}),t={baseStateRef:k(n.baseStateTest),steps:r};return JSON.stringify(t)}function lo(e){return e.flatMap(n=>{let r=n.label.split("#")[0]??n.label;return n.actions.map(()=>r)})}async function uo({baseStateTest:e,config:n,debugDir:r,devSessionId:t,lockfileHash:o,outcome:i,reproJson:a,stepSources:s}){return i.kind!=="finding"||i.captureEvents.length===0?!1:await V(n,i.signature,o)?(p.info({devSessionId:t,signature:i.signature},"explore finding already reported, skipping duplicate"),!1):(await de({baseState:i.baseState,category:co(i.verifierLayer),config:n,debugDir:r,devSessionId:t,events:i.captureEvents,lockfileHash:o,reproJson:a,runId:i.runId,signature:i.signature,spec:fo(e,i.captureEvents),stepSources:s,summary:po(i.captureEvents,i.title),workflowSlug:i.sourceTest?.split("/")[0]}).catch(d=>{p.warn({error:d},"explore finding report failed")}),!0)}function co(e){return e==="data-rule"?"dataRule":e==="model-drift"?"modelDrift":e}function po(e,n){let r=e.flatMap(t=>t.kind==="step"?[...t.findings]:[]).at(0);if(r!=null)return Te(r);if(n!=null)return n;throw new Error("explore finding has no findings to summarize")}function fo(e,n){let r=n.flatMap(o=>o.kind==="step"?[o.source]:[]),t={absent:e.absent,actor:e.actor,exclusive:e.exclusive,intent:e.intent,maybe:[],name:e.name,params:e.params,singletons:e.singletons,steps:r,stub:!1,tests:[],viewports:[e.viewport],world:e.world};return JSON.stringify(t)}function yo(e,n){return n.flatMap(r=>{let t=e[r.idx];return t==null?[]:[{actions:[...t.nav,...t.steps].map(o=>$e(o.action)),label:`${t.test}#${String(t.index)}`}]})}function mo(e,n,r){return e.kind==="error"?{kind:e.kind,reason:`runtime:${e.error.kind}`}:e.kind==="finding"?{kind:e.kind,runId:n?e.runId:void 0,trail:r}:{kind:e.kind,trail:r}}import go from"path";import{randomUUID as Ro}from"crypto";async function os({cwd:e,onReady:n,signal:r,step:t,target:o}){let i=F(e).match(f=>({config:f}),f=>({failure:f}));if("failure"in i)return{failure:i.failure,kind:"config-failed"};let a=i.config,s=await he(e);if(s.result.isErr())return{error:s.result.error,kind:"compile-failed"};let d=await Ue(e,s.result.value),u=await ko(d,o);return u.kind!=="ok"?u:(await je({lockfile:d,onReady:n,options:ho(a),runId:`teleport-${Ro()}`,sequence:u.sequence,stopAfterStep:t,test:u.test},r)).match(f=>({kind:"done",result:f}),f=>({error:f,kind:"run-failed"}))}async function ko(e,n){if(n.kind==="explore"){let t=await $(e,n.repro);return t.kind==="unplannable"?{kind:"unplannable"}:{kind:"ok",sequence:t.sequence,test:t.baseTest}}let r=I(e).find(t=>t.ref===n.ref);return r==null?{kind:"no-test",ref:n.ref}:{kind:"ok",sequence:Oe(e,r.test,void 0),test:r.test}}function ho(e){return{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:go.join(e.cwd,Re),generate:C,headed:!0,secret:e.webhookSecret}}import{graphql as Eo}from"gql.tada";import{err as Q,ok as Vn}from"neverthrow";import So,{AbortError as vo}from"p-retry";import{graphql as Hn}from"gql.tada";var wo=Hn(`
206
- query AwaitDevSession($projectId: String!, $cwd: String!) {
207
- project(id: $projectId) {
208
- devSession(cwd: $cwd) {
209
- id
210
- executor
211
- }
212
- }
213
- }
214
- `);async function Bn(e){return So(async()=>{let t=(await c({config:e,document:wo,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession;if(t!=null)return{executor:t.executor,id:t.id,kind:"active"};throw j(e.cwd)?new Error("starting"):new vo("missing")},{factor:1,maxTimeout:400,minTimeout:400,retries:25}).catch(()=>j(e.cwd)?{kind:"starting"}:{kind:"missing"})}var bo=Hn(`
215
- query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
216
- activeDevSessions(projectId: $projectId) {
217
- id
218
- cwd
219
- branch
220
- }
221
- project(id: $projectId) {
222
- id
223
- devSession(cwd: $cwd) {
224
- id
225
- }
226
- }
227
- }
228
- `);function ps(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo daemon is live (hooks auto-paused while git is mid-merge/rebase/cherry-pick \u2014 they resume when the operation ends)":"\u2713 Dev session: ripplo daemon is live for this directory";case"starting":return"! Dev session: the daemon is running locally but hasn't registered with the server yet. Wait a few seconds and re-run `npx ripplo doctor`. If it persists, check the daemon output for auth or network errors.";case"missing":{let n="\u2717 Dev session: no daemon running for this directory. Start `npx ripplo daemon` as a background process (separate from your app's dev server). Without it, `npx ripplo run` refuses to dispatch and scope/coverage hooks won't arm.";return e.elsewhere.length===0?n:[n," A daemon is running for a different directory:",...xo(e.elsewhere)].join(`
229
- `)}}}async function fs(e){let n=j(e),r=qe(e),t=F(e).unwrapOr(void 0);if(t==null)return{elsewhere:[],gitMidOperation:r,status:n?"starting":"missing",type:"dev-session"};let o=await c({config:t,document:bo,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);return o?.project?.devSession!=null?{elsewhere:[],gitMidOperation:r,status:"active",type:"dev-session"}:{elsewhere:(o?.activeDevSessions??[]).filter(s=>s.cwd!==t.cwd).map(s=>({branch:s.branch,cwd:s.cwd})),gitMidOperation:r,status:n?"starting":"missing",type:"dev-session"}}function xo(e){return e.map(n=>{let r=n.branch==null?"":` (${n.branch})`;return` - ${n.cwd}${r}`})}var Io=Eo(`
230
- mutation SetDevSessionExecutor($devSessionId: String!, $executor: RunExecutor!) {
231
- setDevSessionExecutor(devSessionId: $devSessionId, executor: $executor) {
232
- __typename
233
- ... on DevSession {
234
- id
235
- executor
236
- }
237
- ... on DevSessionEndedError {
238
- message
239
- }
240
- }
241
- }
242
- `);async function hs(e){return(await Kn(e)).map(r=>r.executor)}async function Ss(e,n){let r=await Kn(e);if(r.isErr())return Q(r.error);let o=(await c({config:e,document:Io,variables:{devSessionId:r.value.id,executor:n}})).setDevSessionExecutor;return o==null?Q({kind:"empty-response"}):o.__typename!=="DevSession"?Q({kind:"session-ended"}):Vn(o.executor)}async function Kn(e){let n=await Bn(e);return n.kind==="active"?Vn({executor:n.executor,id:n.id}):Q({kind:n.kind==="starting"?"starting":"no-session"})}export{Bn as a,ps as b,fs as c,Di as d,Ui as e,Ni as f,Wi as g,Ki as h,Qi as i,zi as j,Gi as k,Yi as l,Xi as m,Zi as n,ea as o,na as p,ra as q,ta as r,Ze as s,Oo as t,Do as u,X as v,Uo as w,Pi as x,Mr as y,Ci as z,_ as A,kt as B,ce as C,Xt as D,qt as E,Lt as F,_t as G,to as H,os as I,hs as J,Ss as K};
@@ -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 c,e as i,h as S}from"./chunk-AQ3DMGAY.js";import{k as g,n as y,o as C,p as P}from"./chunk-ESOXRGIY.js";import{A as u,B as l,H as n,I as m,V as h,Z as v,_ as L}from"./chunk-5SM4TCSW.js";import{readFile as I,writeFile as N}from"fs/promises";import k from"path";import b from"safe-stable-stringify";import{createHash as w}from"crypto";import s from"fs";import p from"path";import R from"safe-stable-stringify";import{z as d}from"zod";function x({context:e,cwd:o}){h(e);let t=V(o,f(e));t!=null&&v(e,t)}function $({context:e,cwd:o}){let t=M(o);if(!(t==null||t.model!==f(e)))return t.cleanLockfile??void 0}function ee({cleanLockfileHash:e,context:o,cwd:t}){let r=F(t);s.mkdirSync(p.dirname(r),{recursive:!0}),s.writeFileSync(r,JSON.stringify({cleanLockfile:e,model:f(o)}))}function oe(e){return w("sha256").update(e).digest("base64")}var T=d.object({cleanLockfile:d.string().nullable(),model:d.string()});function V(e,o){let t=p.join(e,i);if(!s.existsSync(t)||c(t))return null;let r=J(t);return r==null?null:f({entities:r.entities,singletonSchemas:r.singletons,valueSpaces:r.valueSpaces})===o?r.solved:null}function J(e){try{return l(n,s.readFileSync(e,"utf8"))}catch{return null}}function f(e){let o=R({entities:e.entities,singletons:e.singletonSchemas,valueSpaces:e.valueSpaces});if(o==null)throw new Error("solve-cache: context is not serializable");return w("sha256").update(o).digest("base64")}function M(e){let o=F(e);if(!(!s.existsSync(o)||c(o)))try{let t=T.safeParse(JSON.parse(s.readFileSync(o,"utf8")));return t.success?t.data:void 0}catch{return}}function F(e){return p.join(e,".ripplo",".local","solve-cache.json")}async function me(e){let o=await S(e);return o.isOk()&&await _(e,o.value),o}async function _(e,o){let t=await z(e,o);return await N(k.join(e,i),u(n,t)),t}var E=new WeakMap;function z(e,o){let t=E.get(o);if(t!=null)return t;let r=j(e,o).then(a=>a??W(e,o));return E.set(o,r),r}function de(e,o){return j(e,o)}function pe(e){return e.workflows.filter(o=>o.stub).map(o=>o.name)}async function j(e,o){if(c(k.join(e,i)))return null;let t=await D(e);return t?.checks==null?null:b(O(t))===b(O(o))?m(t):null}async function D(e){try{let o=await I(k.join(e,i),"utf8");return l(n,o)}catch{return null}}function O(e){return{...e,checks:void 0,solved:{cosat:{},subsume:{}}}}async function W(e,o){let t=g(o);x({context:t,cwd:e});let r=await C(o),a=await y(o);await P({context:t,facts:a.facts});let A=await L(t),H={...o,checks:r,solved:A};return m(l(n,u(n,H)))}export{x as a,$ as b,ee as c,oe as d,me as e,_ as f,z as g,de as h,pe as i};