@muggleai/works 5.26.0-staging.208 → 5.26.0-staging.210

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 (61) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-HOKMW4AL.js → chunk-DLNSKLZD.js} +109 -6
  3. package/dist/{chunk-ZR7KLGHQ.js → chunk-H62MFQKC.js} +597 -26
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/agents/acceptance-tester.md +18 -2
  12. package/dist/plugin/agents/test-prepare-runner.md +1 -1
  13. package/dist/plugin/hooks/README.md +5 -4
  14. package/dist/plugin/hooks/codex-hooks.json +2 -2
  15. package/dist/plugin/hooks/hooks.json +2 -2
  16. package/dist/plugin/scripts/guardrail-record-delegation.sh +25 -0
  17. package/dist/plugin/scripts/guardrail-walkthrough-gate.sh +6 -6
  18. package/dist/plugin/scripts/guardrails.mjs +161 -32
  19. package/dist/plugin/skills/_shared/dev-loop/run.md +2 -0
  20. package/dist/plugin/skills/do/background-e2e.md +89 -0
  21. package/dist/plugin/skills/do/e2e-acceptance.md +4 -0
  22. package/dist/plugin/skills/do/e2e-repair.md +1 -1
  23. package/dist/plugin/skills/do/open-prs/forward.md +3 -3
  24. package/dist/plugin/skills/do/pre-flight.md +4 -3
  25. package/dist/plugin/skills/do/wave-e2e.md +3 -3
  26. package/dist/plugin/skills/do/wave-or-stream.md +51 -0
  27. package/dist/plugin/skills/muggle-do/SKILL.md +6 -2
  28. package/dist/plugin/skills/muggle-test-prepare/SKILL.md +6 -3
  29. package/dist/plugin/skills/muggle-test-prepare/steps/check-running.md +1 -0
  30. package/dist/plugin/skills/muggle-test-prepare/steps/claim-stack.md +43 -0
  31. package/dist/plugin/skills/muggle-test-prepare/steps/replay-or-learn.md +1 -1
  32. package/dist/release-manifest.json +3 -3
  33. package/dist/src-A45WRSIF.js +1 -0
  34. package/package.json +1 -1
  35. package/plugin/.claude-plugin/plugin.json +1 -1
  36. package/plugin/.codex-mcp.json +1 -1
  37. package/plugin/.codex-plugin/plugin.json +1 -1
  38. package/plugin/.cursor-plugin/plugin.json +1 -1
  39. package/plugin/.mcp.json +1 -1
  40. package/plugin/agents/acceptance-tester.md +18 -2
  41. package/plugin/agents/test-prepare-runner.md +1 -1
  42. package/plugin/hooks/README.md +5 -4
  43. package/plugin/hooks/codex-hooks.json +2 -2
  44. package/plugin/hooks/hooks.json +2 -2
  45. package/plugin/scripts/guardrail-record-delegation.sh +25 -0
  46. package/plugin/scripts/guardrail-walkthrough-gate.sh +6 -6
  47. package/plugin/scripts/guardrails.mjs +161 -32
  48. package/plugin/skills/_shared/dev-loop/run.md +2 -0
  49. package/plugin/skills/do/background-e2e.md +89 -0
  50. package/plugin/skills/do/e2e-acceptance.md +4 -0
  51. package/plugin/skills/do/e2e-repair.md +1 -1
  52. package/plugin/skills/do/open-prs/forward.md +3 -3
  53. package/plugin/skills/do/pre-flight.md +4 -3
  54. package/plugin/skills/do/wave-e2e.md +3 -3
  55. package/plugin/skills/do/wave-or-stream.md +51 -0
  56. package/plugin/skills/muggle-do/SKILL.md +6 -2
  57. package/plugin/skills/muggle-test-prepare/SKILL.md +6 -3
  58. package/plugin/skills/muggle-test-prepare/steps/check-running.md +1 -0
  59. package/plugin/skills/muggle-test-prepare/steps/claim-stack.md +43 -0
  60. package/plugin/skills/muggle-test-prepare/steps/replay-or-learn.md +1 -1
  61. package/dist/src-J2TJ76XG.js +0 -1
@@ -0,0 +1,51 @@
1
+ # Wave or stream — how a session's PRs group into changes
2
+
3
+ A session that opens more than one PR has opened a **wave**, a **stream**, or both, and each is tested differently. The grouping decides how many E2E runs the session owes and which report each PR carries, so it is settled once, at pre-flight, and every later stage reads it from `state.md`.
4
+
5
+ ## Wave
6
+
7
+ One change split across repos. The PRs only work together: the frontend PR calls an endpoint the backend PR adds; a library PR ships a type its consumers adopt in theirs.
8
+
9
+ - One PR per repo, all carrying parts of the same change.
10
+ - **One** E2E run against the combined stack, every service started from its member's branch. The same report goes on every PR in the wave, and they merge together.
11
+ - Procedure: [`wave-e2e.md`](wave-e2e.md).
12
+
13
+ ## Stream
14
+
15
+ Unrelated changes that ship in the same session: separate bugs, separate tasks. Each PR stands alone — it would pass review and work in production if none of the others ever merged.
16
+
17
+ - Each PR is its own change, with its own session directory, branch, worktree, E2E run and report.
18
+ - Each run goes to a background acceptance-tester while the session moves on, one local run at a time.
19
+ - Procedure: [`background-e2e.md`](background-e2e.md).
20
+
21
+ A session can hold both. A wave for one feature, opened alongside unrelated fixes, is one change in the stream: it gets one wave run, and each fix gets its own.
22
+
23
+ ## Deciding
24
+
25
+ For each pair of PRs, ask whether either needs the other to work.
26
+
27
+ | Answer | Grouping |
28
+ | :----- | :------- |
29
+ | Yes, and they are in different repos | Same wave |
30
+ | Yes, and they are in the same repo | A stack, not a wave: each PR is tested on its own branch, which already carries the PRs beneath it |
31
+ | No | Separate changes in the stream |
32
+
33
+ A wave also needs every serving repo to run locally ([`wave-e2e.md`](wave-e2e.md#when-a-cycle-is-a-wave)). Interdependent PRs whose stack cannot start together are tested per PR; record why as `Wave: off — <reason>`.
34
+
35
+ **When unsure, treat them as a stream.** A stream PR that needed a sibling fails visibly, and its repair loop names the missing piece. A wave that should have been a stream puts one change's report on another change's PR — the evidence reviewers trust most, vouching for code it never ran.
36
+
37
+ ## Recording
38
+
39
+ Pre-flight writes the grouping into `state.md`; no later stage re-derives it from branch names or diffs.
40
+
41
+ - **Wave** — one session directory for the wave, with `Wave: on` and its `Wave members` block ([`wave-e2e.md`](wave-e2e.md#what-pre-flight-records)).
42
+ - **Stream** — one session directory per change, each listing the others under `Sibling changes`.
43
+
44
+ A change that grows a second repo mid-cycle has become a wave: record the new member before Stage 6, never after a run has already been posted per PR.
45
+
46
+ ## The acceptance-tester's brief
47
+
48
+ A background run tests exactly one change, so its brief names exactly that change's PRs ([`background-e2e.md`](background-e2e.md#brief)):
49
+
50
+ - **A stream change** — its one repo, worktree, branch, head SHA and PR.
51
+ - **A wave** — every member's repo, worktree, branch, head SHA and PR. The agent starts the combined stack per [`wave-e2e.md`](wave-e2e.md) Stage 6, reports `Tested:` once per member, and names each failure's `implicatedRepo`.
@@ -25,7 +25,11 @@ Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user
25
25
  | 7.5 | E2E repair loop | [`../do/e2e-repair.md`](../do/e2e-repair.md) |
26
26
  | 8 | Hand off to watcher | [`../muggle-pr-followup/SKILL.md`](../muggle-pr-followup/SKILL.md) |
27
27
 
28
- **Multi-repo waves.** When a task spans several repos with one PR each, the PRs form a wave: every repo's service starts from its branch, Stage 6 runs **one** E2E pass against the combined stack, and that same result is posted to every PR in the wave. See [`../do/wave-e2e.md`](../do/wave-e2e.md); pre-flight decides whether a cycle is a wave.
28
+ **Waves and streams.** A session's PRs are either a **wave** — one change split across repos — or a **stream** of independent changes, or both; [`../do/wave-or-stream.md`](../do/wave-or-stream.md) defines which is which, and pre-flight decides it once.
29
+
30
+ **Multi-repo waves.** When a task's PRs need each other to work — one PR per repo — they form a wave: every repo's service starts from its branch, Stage 6 runs **one** E2E pass against the combined stack, and that same result is posted to every PR in the wave. See [`../do/wave-e2e.md`](../do/wave-e2e.md); pre-flight decides whether a cycle is a wave.
31
+
32
+ **Streams — several changes in one session.** Unrelated fixes — several bugs in one request, or a second task while the first is still in flight — are separate changes, each with its own session directory, worktree, PR, and E2E run; a wave is one change among them. When a change reaches Stage 6 while other work is in front of the session, its run goes to a background `acceptance-tester` and the session moves on; the report comes back to the main session, which carries that change through Stages 7–8. One local run at a time, and a PR's walkthrough only ever carries its own change's run. See [`../do/background-e2e.md`](../do/background-e2e.md).
29
33
 
30
34
  Stage 7 dispatches one watcher per opened PR as its last action, gated on Stage 7.5's clearance — a cycle with unrepaired E2E failures never reaches a watcher.
31
35
 
@@ -36,7 +40,7 @@ The pipeline table lists **pointers, not summaries**. Open each stage's file and
36
40
  **Bootstrap before any code, in order:**
37
41
  1. Emit telemetry — [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md), `skillName: "muggle-do"`.
38
42
  2. Create `~/.muggle-ai/muggle-do/sessions/<slug>/` with `state.md` + `iterations/001.md` (pre-flight owns this; do it even when running unattended).
39
- 3. `TodoWrite` one item per stage 1–8, Stage 7.5 included — these stages are the checklist; never swap in your own decomposition.
43
+ 3. `TodoWrite` one item per stage 1–8, Stage 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
40
44
 
41
45
  **Per stage:** read the file → execute it → append a marker to `iterations/<NNN>.md` citing the evidence that file requires (jest exit code, E2E verdict + `runId`, screenshot path). A stage is done only when its evidence is written, never on recollection.
42
46
 
@@ -91,14 +91,15 @@ Decide stages, in order; read each detail file when you reach it:
91
91
  | [derive-service-graph](./steps/derive-service-graph.md) | Derive services from workspace manifests |
92
92
  | [rebase-check](./steps/rebase-check.md) | Sync every checkout under test onto the latest base — replays too |
93
93
  | [resolve-sources](./steps/resolve-sources.md) | Pick the checkout each service runs from — replays too |
94
+ | [claim-stack](./steps/claim-stack.md) | Claim the shared ports this run needs — replays too; busy returns to the caller |
94
95
  | [scope](./steps/scope.md) | Frontend / backend / full stack |
95
96
  | [viability-check](./steps/viability-check.md) | Exclude services that can't run locally |
96
97
  | [identify-services](./steps/identify-services.md) | Confirm the derived graph; fill the gaps |
97
98
  | [e2e-instructions](./steps/e2e-instructions.md) | Startup order, manual steps, local gotchas |
98
99
 
99
- The Decide phase's output is the **resolved prepare plan**: `services[]` (name, run directory from [resolve-sources](./steps/resolve-sources.md), start command, expected port, `external` flag, approval granted), `testingScope`, `excludedServices[]`, the recorded dev-server URL, the E2E run instructions, and resolved gate outcomes.
100
+ The Decide phase's output is the **resolved prepare plan**: `services[]` (name, run directory from [resolve-sources](./steps/resolve-sources.md), start command, expected port, `external` flag, approval granted, and the port's `keep` / `start` / `restart` from [claim-stack](./steps/claim-stack.md)), `testingScope`, `excludedServices[]`, the recorded dev-server URL, the E2E run instructions, and resolved gate outcomes.
100
101
 
101
- A replay runs [rebase-check](./steps/rebase-check.md) and [resolve-sources](./steps/resolve-sources.md) before dispatching — they ask nothing unless a checkout cannot be brought up to date.
102
+ A replay runs [rebase-check](./steps/rebase-check.md), [resolve-sources](./steps/resolve-sources.md) and [claim-stack](./steps/claim-stack.md) before dispatching. They ask nothing unless a checkout cannot be brought up to date. A busy stack is not a question either: it returns to the caller.
102
103
 
103
104
  **Execute (agent).** Dispatch the `test-prepare-runner` agent (subagent type `muggle:test-prepare-runner`; bare `test-prepare-runner` where the plugin namespace is absent), synchronously, passing the resolved plan; it returns `READY` / `DEGRADED` plus the readiness table. The agent's own definition lists its stage files; in a harness with no agent/subagent facility, run the execute-phase stages ([check-running](./steps/check-running.md) through [readiness-report](./steps/readiness-report.md)) inline instead.
104
105
 
@@ -118,6 +119,7 @@ Cleanup stops only what runs from the caller's own checkout. Another checkout's
118
119
  4. Wait ~2 s, verify with `kill -0`
119
120
  5. If still alive: `kill -9 <pid>`
120
121
  6. Delete that checkout's log directory and tracking file
122
+ 7. `muggle stack release --cwd "<caller's checkout>"` — gives up the lease, so the next session in line can have the ports. Run it even when nothing was stopped (a stack shared with peers, or "leave services running"): the services may stay up, but a lease nobody uses only makes peers wait for it to expire
121
123
 
122
124
  Report:
123
125
 
@@ -155,7 +157,8 @@ The readiness table names the directory and commit each service runs from, so th
155
157
  - **Never write a credential into the E2E run instructions** — plaintext notes are not a secret store, and this is the file a user pastes when asking why their stack won't start. Record the env-var or secret name, never its value.
156
158
  - **Never leave orphan processes untracked** — every background PID goes into its checkout's tracking file.
157
159
  - **Never kill a process the user started independently** — `external: true` survives cleanup.
158
- - **Never kill or test against another checkout's service** — a listener tracked under a different checkout belongs to a peer session; see [check-running](./steps/check-running.md).
160
+ - **Never kill or test against another checkout's service** — a listener tracked under a different checkout belongs to a peer session; see [check-running](./steps/check-running.md). The one exception is a port the stack claim planned as `restart`: no session's lease needs that service any more.
161
+ - **Never start, restart or kill a service on a port this run has not claimed** — [claim-stack](./steps/claim-stack.md) runs first, and a busy stack goes back to the caller instead of being worked around.
159
162
  - **Never start code that is not on the latest base** — no replay, preference, or approval skips [rebase-check](./steps/rebase-check.md) or [resolve-sources](./steps/resolve-sources.md).
160
163
  - **Never assume start commands** — verify via indicator file; confirm with user.
161
164
  - **Bail early on non-viable services** — don't start what can't run locally.
@@ -24,6 +24,7 @@ A port that answers proves nothing about which code answers it — a peer sessio
24
24
  | A tracking entry with this port, a live PID, `dir` = the run directory and `headSha` = the commit it must serve | **Proven** — keep it. A base-checkout service a peer started is proven the same way, and shared |
25
25
  | The plan marks the service `external: true` | **Vouched** — the user confirmed in Decide that they run it from this checkout; keep it, never kill it |
26
26
  | Tracked under the run directory's checkout at an older `headSha` | **Stale** — restart it per [start-services](./start-services.md) |
27
+ | Tracked under a different checkout, PID alive, and the plan marks the port `restart` from [claim-stack](./claim-stack.md) | **Released** — no session's lease needs it any more; restart it from the run directory per [start-services](./start-services.md) |
27
28
  | Tracked under a different checkout, PID alive | **A peer's** — never test against it, never kill it; [Port already held](#port-already-held) |
28
29
  | Untracked | **Unknown code** — when the plan approves a restart for this service, treat it as stale: Clean Restart it through [smoke-test](./smoke-test.md)'s loop (kill → [fresh-install](./fresh-install.md) → [start-services](./start-services.md) → re-test). Otherwise [Port already held](#port-already-held) |
29
30
 
@@ -0,0 +1,43 @@
1
+ # Claim the stack
2
+
3
+ The machine runs **one** set of local services: one process per port, shared by every session on it. Before anything is checked, started or restarted, claim the ports this run needs, so two sessions never restart each other's services mid-run, or test against code that isn't theirs. Runs on every invocation, learning runs and replays alike, right after [resolve-sources](./resolve-sources.md) — in-session, never in the agent, because a busy stack has to reach the caller.
4
+
5
+ ## Claim
6
+
7
+ One `--need` per service with an expected port, naming its run directory from [resolve-sources](./resolve-sources.md). The commit defaults to what that directory has checked out, which is the commit it must serve:
8
+
9
+ ```bash
10
+ muggle stack claim --cwd "<caller's checkout>" --label "<branch or task>" \
11
+ --need 3000=<run-dir-of-frontend> --need 8080=<run-dir-of-backend> --json
12
+ ```
13
+
14
+ A service whose port is not known yet goes unclaimed this run; [start-services](./start-services.md) records the port it finds, and the next invocation claims it.
15
+
16
+ The claim answers at once. It never waits on a peer unless asked to.
17
+
18
+ - **`GRANTED`** (exit 0) → the ports are this checkout's to use, alongside any session that needs the same code there (`sharedWith`). Each `plan` entry says what to do with its port, and travels in the resolved plan to the execute phase:
19
+ - `keep` — a tracked service already serves this directory and commit. [check-running](./check-running.md) still proves it.
20
+ - `start` — nothing tracked serves the port.
21
+ - `restart` — a tracked service serves other code that no session's lease needs any more, even when it was started from another checkout. [check-running](./check-running.md) replaces it.
22
+ - **`BUSY`** (exit 75) → another session's lease needs different code on a port this run needs, or a session ahead in line is still owed its turn there. Nothing was started or stopped. Don't ask the user to kill anything or pick another port — the line exists so they never have to. Return to the caller with the blockers (port, who holds it, for how long) and this checkout's `position`. The place is kept for as long as the checkout keeps asking. The caller does other work (unit tests, the next PR, cloud-side fetches) and invokes prepare again after `retryAfterMs`. With nothing else left to do, re-claim with `--wait <seconds>` to wait in the call.
23
+
24
+ `muggle stack status` shows every lease, the line, and the services prepare tracks, without taking a place.
25
+
26
+ ## The lease
27
+
28
+ A granted claim is a lease. Every claim, `muggle stack check`, and every local execute run renews it. The lease lasts across the whole batch: prepare once, run every test case, then release it in [Cleanup](../SKILL.md#cleanup). A lease that is never released still ends, and its ports pass to whoever is next in line:
29
+
30
+ - **The session died.** Each run records the session's MCP server as a holder of the lease. Once every holder has exited and a minute has passed with no renewal, the lease ends. The minute rides out an MCP server restart.
31
+ - **Nobody renewed it for 20 minutes.** This covers a lease that never ran a test, so it has no holder to watch.
32
+
33
+ The lease belongs to the checkout, not to one run. Every test case of the same change, including cases run in parallel, runs under it and renews it, and none of them waits on the others.
34
+
35
+ The line is first come, first served per port, and it is pulled, not pushed: nothing calls a waiting session back. A session keeps its place by asking again within the suggested delay, and is served before anyone behind it who wants the same port. A session that stops asking keeps its turn for 30 seconds after the port frees, and its place for 10 minutes.
36
+
37
+ Holding a lease is optimistic, not exclusive. Nothing stops another process from binding a port. Instead, the local execute tools check the lease before every run and again when it ends:
38
+
39
+ - A run whose port another session's lease holds, from a checkout that never claimed it, is refused: `Run refused — the target port is leased to another checkout`.
40
+ - A run whose claimed port no longer serves the claimed code is refused: `Run refused — the service stack changed since this checkout claimed it`. Re-invoke prepare: it re-claims and restarts what moved.
41
+ - A run during which the stack changed returns its result with a warning, and that result is not trusted until it has been re-run.
42
+
43
+ None of these is a test result. Never route them through failure handling.
@@ -4,7 +4,7 @@ One decision, made before anything else: does a prepare recipe already exist for
4
4
 
5
5
  Resolve the recipe location per [confirm-recipe](./confirm-recipe.md).
6
6
 
7
- - **Recipe exists** → **replay run**. Run [rebase-check](./rebase-check.md) and [resolve-sources](./resolve-sources.md), then go straight to the execute phase. No scan, no interview, no questions. The whole point of having learned is not to ask again.
7
+ - **Recipe exists** → **replay run**. Run [rebase-check](./rebase-check.md), [resolve-sources](./resolve-sources.md) and [claim-stack](./claim-stack.md), then go straight to the execute phase. No scan, no interview, no questions. The whole point of having learned is not to ask again.
8
8
  - **No recipe** → **learning run**. Run the Decide stages in order, then the single gate at the end.
9
9
 
10
10
  A recipe the user declined to save is the same as no recipe: the next run learns again. Declining is not a permanent no, it just means nothing was written.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-208-1",
4
- "commitSha": "530c3412beead8d560b431f8061964af09ac010a",
5
- "buildTime": "2026-10-26T07:30:58Z",
3
+ "buildId": "run-210-1",
4
+ "commitSha": "6ff9e102fd856da52beaf3081430c147a3587ceb",
5
+ "buildTime": "2026-10-26T17:21:07Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
@@ -0,0 +1 @@
1
+ export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CheckoutFreshnessVerdict, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackRelease, decideStackRenewal, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-H62MFQKC.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@muggleai/works",
3
3
  "mcpName": "io.github.multiplex-ai/muggle",
4
- "version": "5.26.0-staging.208",
4
+ "version": "5.26.0-staging.210",
5
5
  "description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.26.0-staging.208",
4
+ "version": "5.26.0-staging.210",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.208",
7
+ "@muggleai/works@5.26.0-staging.210",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.208",
3
+ "version": "5.26.0-staging.210",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.26.0-staging.208",
5
+ "version": "5.26.0-staging.210",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
package/plugin/.mcp.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.208",
7
+ "@muggleai/works@5.26.0-staging.210",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -30,6 +30,8 @@ The orchestrator provides a dispatch prompt with:
30
30
 
31
31
  - **What to do:** Run tests, import tests, manage preferences, check status, or repair.
32
32
  - **For testing:** Target URL and what to test — a feature description, acceptance criteria, or "run regression on recent changes."
33
+ - **For a background change run:** one change's brief — its session directory, repo, worktree, branch, head SHA, validation target, project, scope, and the absolute path of the stage file to execute. Read that file and execute its steps yourself, starting the app from the brief's worktree; its tool calls are the run. Every value you need is in the brief — the conversation that wrote it is not available to you.
34
+ - **For a background wave run:** the same brief, carrying every member of the wave — a change split across repos whose PRs only work together — each with its own repo, worktree, branch, head SHA and PR, plus the wave stage file. Start every member's services from that member's worktree, run each test case once against the combined stack, and name the member each failure implicates. A brief whose PRs are unrelated changes is a stream, not a wave: test only the one change it names, and leave its siblings to their own runs.
33
35
  - **For import:** Path to test files or documents to import.
34
36
  - **For preferences:** Which preference to view or change, or "show all."
35
37
  - **For status/repair:** No additional input needed.
@@ -81,6 +83,16 @@ For each **passed** test, list the name only:
81
83
  ### {Test Name} — PASS
82
84
  ```
83
85
 
86
+ ### When Running a Background Change Run
87
+
88
+ Return the report in the Output format of the stage file the brief named, followed by one line naming what the run tested — one line per member for a wave run, and each failed test naming its `implicatedRepo` (the member whose change the failing step points at, or `unknown`):
89
+
90
+ ```
91
+ Tested: {owner/repo}@{head sha}
92
+ ```
93
+
94
+ The orchestrator posts the report only while every listed SHA is still its branch head, and only to that change's PRs — for a wave, the same report to every member's PR. A run that could not start reports its verdict and reason in the same format — never return without a report.
95
+
84
96
  ### When Importing Tests
85
97
 
86
98
  Report:
@@ -108,5 +120,9 @@ Report:
108
120
  3. **Describe problems from the user's perspective.** "The checkout button is not clickable after adding an item to the cart" — not "onClick handler missing on Button component in CartPage.tsx."
109
121
  4. **Do not modify application code.** Report findings; coding agents act on them.
110
122
  5. **Do not decide when to run.** The orchestrator dispatches; you execute and report.
111
- 6. **Do not choose local vs remote.** The `muggle-test` skill handles routing based on the target URL and user preferences.
112
- 7. **Use skills, not raw MCP tools.** The orchestrator pastes the full skill text into your dispatch prompt. Follow the skill's instructions exactly.
123
+ 6. **Do not choose local vs remote.** The `muggle-test` skill handles routing based on the target URL and user preferences; in a background change run, the brief's validation target decides.
124
+ 7. **Use skills, not raw MCP tools.** The orchestrator pastes the full skill text into your dispatch prompt. Follow the skill's instructions exactly. A background change run is the one exception: the stage file its brief names is the procedure, and its MCP calls are its steps.
125
+ 8. **Never dispatch another agent or fork.** Run every step in your own context. A run handed further down escapes the orchestrator's one-local-run-at-a-time queue and lands on the browser alongside the next run; two studio runs at once corrupt each other.
126
+ 9. **Never run alongside another local run.** Before your first local execution, list the local run results; if a run is still executing, return `BLOCKED — another local run in flight` instead of starting one.
127
+ 10. **Never write to a PR or the repo.** No commits, pushes, PR edits, comments, walkthrough posts, or watcher arms — the orchestrator owns every PR write, because only it knows which change a PR belongs to.
128
+ 11. **Never declare a skip marker in a background change run.** Return the skip code in the report; the orchestrator declares it from the PR's own worktree, where it settles that PR alone.
@@ -22,7 +22,7 @@ The dispatch prompt carries the resolved prepare plan:
22
22
 
23
23
  Run these stage files from the skill, in order, exactly as written — they are the single source of truth for each stage's procedure:
24
24
 
25
- 1. [`../skills/muggle-test-prepare/steps/check-running.md`](../skills/muggle-test-prepare/steps/check-running.md)
25
+ 1. [`../skills/muggle-test-prepare/steps/check-running.md`](../skills/muggle-test-prepare/steps/check-running.md) — when a service's port carries `keep` / `start` / `restart` from the stack claim, act only on what that allows. A port the plan gives no claim action is judged by check-running's table alone, exactly as before: a missing claim action is never a reason for `needs-input:`
26
26
  2. [`../skills/muggle-test-prepare/steps/env-file.md`](../skills/muggle-test-prepare/steps/env-file.md)
27
27
  3. [`../skills/muggle-test-prepare/steps/start-commands.md`](../skills/muggle-test-prepare/steps/start-commands.md)
28
28
  4. [`../skills/muggle-test-prepare/steps/fresh-install.md`](../skills/muggle-test-prepare/steps/fresh-install.md)
@@ -35,22 +35,23 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
35
35
  | Hook event | Wrapper | Strength | Condition | Preference | Effect |
36
36
  | :--------- | :------ | :------- | :-------- | :--------- | :----- |
37
37
  | `PostToolUse` (Bash) | `guardrail-pr-opened.sh` | advise | a `gh pr create`/`gh pr ready` just succeeded | `autoWatchPR` | start a `muggle-pr-followup` watcher on the new PR |
38
- | `PostToolUse` (Bash + muggle execute/replay MCP tools) | `guardrail-record-tests.sh` | record | a unit-test command passed, an E2E run happened (execute/replay call), or an `echo "MUGGLE_E2E_SKIP: <reason>"` marker declared E2E un-runnable, or a walkthrough carrying the `build-pr-section` sentinel was posted / declared un-postable via `echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"` | — | set `unitTestsGreen` / `e2eRun` / `e2eSkipped` / `walkthroughPosted` / `walkthroughSkipped` session state |
38
+ | `PostToolUse` (Bash + muggle execute/replay MCP tools) | `guardrail-record-tests.sh` | record | a unit-test command passed, an E2E run happened (execute/replay call), or an `echo "MUGGLE_E2E_SKIP: <reason>"` marker declared E2E un-runnable, or a walkthrough carrying the `build-pr-section` sentinel was posted / declared un-postable via `echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"` | — | set `unitTestsGreen` / `e2eRun` / `e2eSkipped` / `walkthroughPostedPrUrls` / `walkthroughSkipped` session state. A post settles only the PR its output names (`gh pr comment`/`create` print it; a `gh api` comment edit returns `html_url`); a post whose output names none is timestamped (`walkthroughPostedAt`), and a scan begun after it decides. An accepted skip records the working tree it was verified in and settles only that tree's change: the PRs opened from it (`prWorkingTrees`, tracked in `e2eSkipCoveredPrs`) and its checked-out branch's PR |
39
39
  | `PostToolUse` (Bash) | `guardrail-pr-terminal.sh` | advise | a PR just went terminal — a `gh pr merge`/`gh pr close` success line or the `TERMINAL pr=N` line the watch scripts print in a shell result (never bare `"state":"MERGED"` metadata). Not registered on `Monitor`: a Monitor call returns before its script prints anything, so its result never carries that line | — | record `terminalPending`, direct the post-merge handoff: finalize the watcher slot, tear down per `autoCleanup`, offer next options via AskUserQuestion |
40
40
  | `PostToolUse` (AskUserQuestion) | `guardrail-offer-ran.sh` | record | a next-options offer ran while a terminal PR was pending | — | clear `terminalPending` — the only exit for the post-merge Stop gate |
41
+ | `PostToolUse` (Agent, Task) | `guardrail-record-delegation.sh` | record | a `muggle:acceptance-tester` was launched into the background — its response carries no finished report yet | — | append to `e2eDelegations` with the PR URLs its brief names; for a bounded window the E2E and debug-path gates hold off, and the walkthrough gate sets those PRs aside, so the session is never steered into a second browser run alongside the agent's. Shares the AskUserQuestion group's dispatch |
41
42
  | `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone: the state store drops a write that cannot take the session's lock in time, so a second writer for one emit could lose either record | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
42
43
  | `PostToolUse` (Read) | `guardrail-record-stage-read.sh` | record | a markdown file under a `skills/` directory was opened | — | append to `stagesRead` — how the stage gate tells a stage that was read from one that was skipped |
43
44
  | `PostToolUse` (Bash + muggle telemetry-event-emit / user-feedback-create) | `guardrail-record-stage-signals.sh` | record | a Step 6f `pre-execution-classification` emit, debug-path evidence for a failed run (a `*-failure-classified\|resolved` emit or feedback naming it), or a `MUGGLE_STAGE_SKIP` / `MUGGLE_CLASSIFY_SKIP` / `MUGGLE_DEBUG_SKIP` marker | — | set `classifiedTestCaseIds` / `debuggedRuns` / the matching skip flag |
44
45
  | `PostToolUse` (Bash) | `guardrail-record-comment-replies.sh` | record | an unresolved-thread fetch named review threads still awaiting an answer (classified by the `<!-- muggle-do:bot -->` marker, never the author login), a threaded reply the provider **confirmed** answered comments in one, or a `MUGGLE_REPLY_SKIP` marker deferred them | — | claim each thread and cover the comments answered, in the per-PR ledger beside the muggle-do slot |
45
46
  | `PreToolUse` (Bash, `if` a command names `gh`/`glab`) | `guardrail-report-format.sh` | **enforce** | a `gh pr comment\|create\|edit` body — or a `gh api … issues/comments/<id>` PATCH editing one — reads like an E2E report but lacks the `build-pr-section` sentinel | — | **deny** — render via `muggle build-pr-section` instead |
46
47
  | `PreToolUse` (muggle local execute/replay) | `guardrail-classify-gate.sh` | **enforce** | `muggle-test` is the skill in play and the target test case has no `pre-execution-classification` this session | — | **deny** — run Step 6f first (it calls `muggle-remote-test-script-list`, which is where the run learns the case has never passed) or record a legitimate skip via `MUGGLE_CLASSIFY_SKIP`. Scoped to `muggle-test`, so the single-target skills that legitimately skip classification are untouched; fails open when the test case can't be resolved |
47
- | `Stop` | `guardrail-e2e-gate.sh` | **enforce** | unit tests passed this session, no E2E ran yet, and no skip was recorded | `autoE2ETest` | **block** the turn until E2E runs via `muggle-test` or a `MUGGLE_E2E_SKIP` marker records a legitimate skip (full message once, one-line reminders after; releases after 3 blocks) |
48
+ | `Stop` | `guardrail-e2e-gate.sh` | **enforce** | unit tests passed this session, no E2E ran yet, and no skip was recorded | `autoE2ETest` | **block** the turn until E2E runs via `muggle-test` or a `MUGGLE_E2E_SKIP` marker records a legitimate skip (full message once, one-line reminders after; releases after 3 blocks). Quiet while a background acceptance-tester is in flight |
48
49
  | `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the AskUserQuestion next-options offer hasn't run since | — | **block** the turn until the post-merge handoff runs (full message once, one-line reminders after; releases after 3 blocks; nothing but the offer resets the counter) |
49
50
  | `Stop` | `guardrail-watch-gate.sh` | **enforce** | a PR opened this session that is still open and has no live watch — no session slot for it is terminal, stopped by its owner, or carries a `watch-heartbeat` touched within 15 minutes; a slot that is only seeded does not count | `autoWatchPR` | **block** the turn until the watch is armed per `muggle-pr-followup`'s `arm-watcher.md` or a `MUGGLE_WATCH_SKIP` marker records a legitimate skip (releases after 3 blocks). A PR clears once the session sees it go terminal or a provider lookup reports it merged or closed — what lets a PR whose slot post-merge cleanup deleted through. The lookup runs in a detached scan queued at turn end; a PR it has not reached yet still blocks, and one it could not reach fails open |
50
51
  | `Stop` | `guardrail-watch-follow-through-gate.sh` | **enforce** | a `muggle-pr-followup` watch this session owns (the slot's `owner.json`) recorded due work in `watch-due.env` — a branch behind or conflicting with its base, or a head whose checks settled red — and `last_seen.json` records no attempt for it: no `conflict_resolve_attempts` entry for the rebase key (enforced under `autoRebase=always` while catch-up budget is left), no `ci_fix_attempts` entry for the red head. An escalation entry with no attempt behind it counts for nothing, and re-arming the watch changes nothing | `autoRebase` | **block** the turn, naming each PR and its `/muggle-do rebase` or `fix ci` dispatch. No release after N blocks: only a recorded attempt, a newer head in the slot's `prs.json`, or the user's literal `HOLD WATCH #<pr-number>` clears it. The hold must come from a turn the user typed — never a tool result, a loaded skill, a hook's message, a task notification, a compaction summary, or the agent's own text — and is kept for the session once read. Reads local files only, never a provider: the pre-filter is a builtins glob for a non-empty `watch-due.env` whose `owner.json` names the session, so Node starts only when a slot has due work |
51
- | `Stop` | `guardrail-walkthrough-gate.sh` | **enforce** | an E2E acceptance run happened this session and a PR in play — opened this session or on the working branch — carries no walkthrough in its body or comments; or an E2E skip was accepted and a PR in play still shows the empty placeholder instead of the skip's record | `postPRVisualWalkthrough` | **block** the turn until the walkthrough is posted via `muggle-pr-visual-walkthrough` or a `MUGGLE_WALKTHROUGH_SKIP` marker records a legitimate skip. For an accepted E2E skip, the block hands over the foreground `settle-walkthrough-skipped <pr> <session>` command, which prints `{"settled":true}` once the PR reads back the skip, and re-queues the detached write (releases after 3 blocks; an unreachable PR fails open to not-owed). A skip accepted before its PR existed is written straight into the PR's slot when it opens. The provider lookups run in a detached scan, queued when the gate arms, when a PR opens, and at each turn end; the gate decides on the last scan for the session's current PRs and stays open until one lands |
52
+ | `Stop` | `guardrail-walkthrough-gate.sh` | **enforce** | an E2E acceptance run happened this session and a PR in play — opened this session or on the working branch — carries no walkthrough in its body or comments; or an E2E skip was accepted and a PR it covers still shows the empty placeholder instead of the skip's record | `postPRVisualWalkthrough` | **block** the turn until the walkthrough is posted via `muggle-pr-visual-walkthrough` or a `MUGGLE_WALKTHROUGH_SKIP` marker records a legitimate skip. For a PR an accepted E2E skip covers, the block hands over the foreground `settle-walkthrough-skipped <pr> <session>` command, which prints `{"settled":true}` once the PR reads back the skip, and re-queues the detached write; a PR the skip does not cover is a different change and is told to run its own E2E or declare its own skip from its tree (releases after 3 blocks; an unreachable PR fails open to not-owed). A skip accepted before its PR existed is written straight into the PR's slot when it opens from the same tree. The provider lookups run in a detached scan, queued when the gate arms, when a PR opens, and at each turn end; the gate decides on the last scan for the session's current PRs, begun after the last observed post, and stays open until one lands. Each PR is checked for its own walkthrough: a post to one PR settles only that one, and opening another re-arms the check. A PR whose own background run is in flight is set aside |
52
53
  | `Stop` | `guardrail-stage-gate.sh` | **enforce** | a skill invoked this session declared `mandatoryStages` and one of those files was never opened | — | **block** the turn until the stages are read or a `MUGGLE_STAGE_SKIP` marker records a legitimate skip (releases after 3 blocks) |
53
- | `Stop` | `guardrail-debug-path-gate.sh` | **enforce** | a local execution returned a non-passing run this session and nothing routed it through `_shared/debug-failed-run.md` | — | **block** the turn until the run is diagnosed (its `*-failure-classified` emit or feedback naming it) or a `MUGGLE_DEBUG_SKIP: <runId> <reason>` marker clears that run (releases after 3 blocks) |
54
+ | `Stop` | `guardrail-debug-path-gate.sh` | **enforce** | a local execution returned a non-passing run this session and nothing routed it through `_shared/debug-failed-run.md` | — | **block** the turn until the run is diagnosed (its `*-failure-classified` emit or feedback naming it) or a `MUGGLE_DEBUG_SKIP: <runId> <reason>` marker clears that run (releases after 3 blocks). Quiet while a background acceptance-tester is in flight — its failed runs land in this session's state and it debugs them itself |
54
55
  | `Stop` | `guardrail-comment-reply-gate.sh` | **enforce** | this session claimed a review thread and left one of its comments uncovered | — | **block** the turn until each comment gets its threaded reply per `do/per-comment-replies.md` or a `MUGGLE_REPLY_SKIP: <comment-id> <reason>` marker defers it (releases after 3 blocks). The claim is the signal, not a push, so a round that answers a question with no code change is caught too; a thread another session claimed never blocks this one |
55
56
  | `Stop` | `guardrail-capability-claim.sh` | **enforce** | the closing turn tells the user a login- or code-gated flow can't be tested, reached, or verified | — | **block** once, citing `_shared/identity-and-inbox.md`: the managed profile's live inbox, provisioned number, stored TOTP secret, credentials, and CAPTCHA solver clear exactly that blocker. Reads the claim out of the transcript, since a Stop payload carries no message text. Per-sentence matching, and a sentence naming a voice call, an OAuth-only provider, or a deployment with no number provisioned never fires — those limits are real. Nudges once per session, then stays quiet, so a misread costs one turn |
56
57
  | `UserPromptSubmit` | `guardrail-build-router.sh` | advise | a build/implement/fix request (first one this session) | `autoRouteBuildToMuggleDo` | route the work through `muggle-do` (build delegated to superpowers) |
@@ -102,10 +102,10 @@
102
102
  "hooks": [
103
103
  {
104
104
  "type": "command",
105
- "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh\"",
105
+ "command": "env MUGGLE_HOOK_HOST=codex bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh",
106
106
  "async": false,
107
107
  "timeout": 10,
108
- "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh\""
108
+ "commandWindows": "node \"${CLAUDE_PLUGIN_ROOT}\\scripts\\codex-hook-windows.mjs\" \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh"
109
109
  }
110
110
  ]
111
111
  }
@@ -133,11 +133,11 @@
133
133
  ]
134
134
  },
135
135
  {
136
- "matcher": "AskUserQuestion",
136
+ "matcher": "AskUserQuestion|Agent|Task",
137
137
  "hooks": [
138
138
  {
139
139
  "type": "command",
140
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-offer-ran.sh\"",
140
+ "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh",
141
141
  "async": false,
142
142
  "timeout": 1
143
143
  }
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+
4
+ # Background acceptance-tester observer (PostToolUse/Agent|Task). Records that
5
+ # a change's E2E was handed to a muggle:acceptance-tester running in the
6
+ # background, so the E2E, walkthrough and debug-path Stop gates hold off rather
7
+ # than steer the main session into a second browser run alongside the agent's.
8
+ # Emits no directive.
9
+ #
10
+ # Pre-filter: most dispatches are other agents, so only a payload naming the
11
+ # acceptance-tester spawns Node. Degrades to {}.
12
+
13
+ guardrail_script_dir="${BASH_SOURCE[0]%/*}"
14
+ [[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
15
+ . "$guardrail_script_dir/guardrail-lib.sh"
16
+
17
+ GUARDRAIL_SUBCOMMAND="record-delegation"
18
+
19
+ guardrail_wants() {
20
+ guardrail_payload_matches 'acceptance-tester'
21
+ }
22
+
23
+ if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
24
+ guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
25
+ fi
@@ -11,11 +11,11 @@ set -uo pipefail
11
11
  # it fires on EVERY turn end. There is no command payload to key off, so the
12
12
  # pre-filter reads the same per-session state file guardrails.mjs uses and only
13
13
  # spawns Node when the gate could actually fire — i.e. an acceptance run or an
14
- # unsettled skip is recorded and the walkthrough is neither posted nor skipped.
15
- # On the overwhelming majority of turns (no E2E this session) the state file is
16
- # absent or carries neither, so we return {} in-shell and never pay Node
17
- # cold-start — which also means the gate's `gh` lookups only ever run on turns
18
- # that could genuinely owe a walkthrough. Degrades to {}.
14
+ # unsettled skip is recorded and the walkthrough is neither verified on every
15
+ # PR nor skipped. On the overwhelming majority of turns (no E2E this session)
16
+ # the state file is absent or carries neither, so we return {} in-shell and
17
+ # never pay Node cold-start — which also means the gate's `gh` lookups only
18
+ # ever run on turns that could genuinely owe a walkthrough. Degrades to {}.
19
19
 
20
20
  guardrail_script_dir="${BASH_SOURCE[0]%/*}"
21
21
  [[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
@@ -25,7 +25,7 @@ GUARDRAIL_SUBCOMMAND="walkthrough-gate"
25
25
 
26
26
  guardrail_wants() {
27
27
  guardrail_load_state || return 1
28
- guardrail_state_has '"walkthroughPosted": true' && return 1
28
+ guardrail_state_has '"walkthroughsVerified": true' && return 1
29
29
  guardrail_state_has '"walkthroughReleased": true' && return 1
30
30
  guardrail_state_has '"walkthroughSkipped": true' && return 1
31
31
  guardrail_state_has '"e2eRun": true' && return 0