@muggleai/works 5.26.0-staging.198 → 5.26.0-staging.200

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 (39) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-SLU7LHVJ.js → chunk-IL5E5YGY.js} +1 -1
  3. package/dist/{chunk-U5ZA3VTZ.js → chunk-MKQYUSIW.js} +1430 -23
  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/hooks/README.md +1 -1
  12. package/dist/plugin/scripts/guardrail-walkthrough-gate.sh +15 -12
  13. package/dist/plugin/scripts/guardrails.mjs +134 -91
  14. package/dist/plugin/scripts/pr-watch-arm.sh +8 -1
  15. package/dist/plugin/skills/do/open-prs/forward.md +1 -1
  16. package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -0
  17. package/dist/plugin/skills/muggle-pr-followup/reconcile.md +4 -2
  18. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +15 -0
  19. package/dist/plugin/skills/muggle-pr-followup/stop.md +1 -1
  20. package/dist/release-manifest.json +3 -3
  21. package/dist/{src-3HZTU2TJ.js → src-UVZTYRQY.js} +1 -1
  22. package/package.json +2 -1
  23. package/plugin/.claude-plugin/plugin.json +1 -1
  24. package/plugin/.codex-mcp.json +1 -1
  25. package/plugin/.codex-plugin/plugin.json +1 -1
  26. package/plugin/.cursor-plugin/plugin.json +1 -1
  27. package/plugin/.mcp.json +1 -1
  28. package/plugin/hooks/README.md +1 -1
  29. package/plugin/scripts/guardrail-walkthrough-gate.sh +15 -12
  30. package/plugin/scripts/guardrails.mjs +134 -91
  31. package/plugin/scripts/pr-watch-arm.sh +8 -1
  32. package/plugin/skills/do/open-prs/forward.md +1 -1
  33. package/plugin/skills/muggle-pr-followup/arm-watcher.md +2 -0
  34. package/plugin/skills/muggle-pr-followup/reconcile.md +4 -2
  35. package/plugin/skills/muggle-pr-followup/state-schemas.md +15 -0
  36. package/plugin/skills/muggle-pr-followup/stop.md +1 -1
  37. package/scripts/muggle-watch/README.md +45 -0
  38. package/scripts/muggle-watch/install-muggle-watch.ps1 +92 -0
  39. package/scripts/muggle-watch/muggle-watch-hidden.vbs +39 -0
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-U5ZA3VTZ.js';
3
- import './chunk-SLU7LHVJ.js';
2
+ import { runCli } from './chunk-MKQYUSIW.js';
3
+ import './chunk-IL5E5YGY.js';
4
4
 
5
5
  // src/cli/main.ts
6
6
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-U5ZA3VTZ.js';
2
- export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-SLU7LHVJ.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-MKQYUSIW.js';
2
+ export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-IL5E5YGY.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.198",
4
+ "version": "5.26.0-staging.200",
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.198",
7
+ "@muggleai/works@5.26.0-staging.200",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.198",
3
+ "version": "5.26.0-staging.200",
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.198",
5
+ "version": "5.26.0-staging.200",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "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.198",
7
+ "@muggleai/works@5.26.0-staging.200",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -47,7 +47,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
47
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
48
  | `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
49
  | `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
- | `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 | `postPRVisualWalkthrough` | **block** the turn until the walkthrough is posted via `muggle-pr-visual-walkthrough` or a `MUGGLE_WALKTHROUGH_SKIP` marker records a legitimate skip (releases after 3 blocks; an unreachable PR fails open to not-owed). 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 |
50
+ | `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 |
51
51
  | `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) |
52
52
  | `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) |
53
53
  | `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 |
@@ -3,17 +3,19 @@ set -uo pipefail
3
3
 
4
4
  # acceptance-run → walkthrough gate (Stop). When an E2E acceptance run happened
5
5
  # this session and no visual walkthrough has reached the PR, block the turn end
6
- # until it does or a skip is declared. Fires once per session per PR.
6
+ # until it does or a skip is declared. An accepted E2E skip arms it the same
7
+ # way: the PR must show the skip's record, because recording it in session
8
+ # state alone leaves reviewers an empty placeholder if the write never lands.
7
9
  #
8
10
  # This must stay synchronous (only a sync Stop hook can block the turn end), and
9
11
  # it fires on EVERY turn end. There is no command payload to key off, so the
10
12
  # pre-filter reads the same per-session state file guardrails.mjs uses and only
11
- # spawns Node when the gate could actually fire — i.e. an acceptance run is
12
- # recorded and the walkthrough is neither posted nor skipped. On the
13
- # overwhelming majority of turns (no E2E this session) the state file is absent
14
- # or e2eRun is unset, so we return {} in-shell and never pay Node cold-start —
15
- # which also means the gate's `gh` lookups only ever run on turns that could
16
- # genuinely owe a walkthrough. Degrades to {}.
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 {}.
17
19
 
18
20
  guardrail_script_dir="${BASH_SOURCE[0]%/*}"
19
21
  [[ $guardrail_script_dir == "${BASH_SOURCE[0]}" ]] && guardrail_script_dir=.
@@ -22,11 +24,12 @@ guardrail_script_dir="${BASH_SOURCE[0]%/*}"
22
24
  GUARDRAIL_SUBCOMMAND="walkthrough-gate"
23
25
 
24
26
  guardrail_wants() {
25
- guardrail_load_state \
26
- && guardrail_state_has '"e2eRun": true' \
27
- && ! guardrail_state_has '"walkthroughPosted": true' \
28
- && ! guardrail_state_has '"walkthroughReleased": true' \
29
- && ! guardrail_state_has '"walkthroughSkipped": true'
27
+ guardrail_load_state || return 1
28
+ guardrail_state_has '"walkthroughPosted": true' && return 1
29
+ guardrail_state_has '"walkthroughReleased": true' && return 1
30
+ guardrail_state_has '"walkthroughSkipped": true' && return 1
31
+ guardrail_state_has '"e2eRun": true' && return 0
32
+ guardrail_state_has '"e2eSkipDeclaration": {' && ! guardrail_state_has '"e2eSkipSettledOnPrs": true'
30
33
  }
31
34
 
32
35
  if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
@@ -717,8 +717,87 @@ function isE2ERun(input2) {
717
717
  return MUGGLE_SKILL_EMIT_TOOL.test(input2.tool_name ?? "") && input2.tool_input?.skillName === MUGGLE_TEST_SKILL_NAME;
718
718
  }
719
719
 
720
+ // src/e2e-skip/types.ts
721
+ var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
722
+ E2eSkipCode3["NoWebSurface"] = "NO_WEB_SURFACE";
723
+ E2eSkipCode3["DevServerUnreachable"] = "DEV_SERVER_UNREACHABLE";
724
+ E2eSkipCode3["EmptyDiff"] = "EMPTY_DIFF";
725
+ E2eSkipCode3["MuggleAuthDown"] = "MUGGLE_AUTH_DOWN";
726
+ E2eSkipCode3["NoPr"] = "NO_PR";
727
+ E2eSkipCode3["UserWaived"] = "USER_WAIVED";
728
+ E2eSkipCode3["NoAppLogicChange"] = "NO_APP_LOGIC_CHANGE";
729
+ E2eSkipCode3["NotApplicable"] = "NOT_APPLICABLE";
730
+ return E2eSkipCode3;
731
+ })(E2eSkipCode || {});
732
+
733
+ // src/e2e-skip/constants.ts
734
+ var E2E_SKIP_DECLARATION = /^\s*echo\s+["']?MUGGLE_E2E_SKIP:(.*)$/;
735
+ var SKIP_CODE_TOKEN = /^[\s:]*([A-Za-z_]+)/;
736
+ var E2E_SKIP_CODES = Object.values(E2eSkipCode);
737
+ var NON_APP_PATH_SUMMARY = "docs, tests, lint/format config, or CI config";
738
+ var E2E_SKIP_CODE_CLAIMS = {
739
+ ["NO_WEB_SURFACE" /* NoWebSurface */]: "the repo ships no web surface to drive",
740
+ ["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: "the named dev server does not answer",
741
+ ["EMPTY_DIFF" /* EmptyDiff */]: "the branch carries no diff against its base",
742
+ ["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: "the stored Muggle session is missing or expired",
743
+ ["NO_PR" /* NoPr */]: "no pull request was handled this session",
744
+ ["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words",
745
+ ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: `every path changed since the named commit is ${NON_APP_PATH_SUMMARY}`,
746
+ ["NOT_APPLICABLE" /* NotApplicable */]: "a browser run cannot exercise this change, for the reason stated"
747
+ };
748
+ var CYCLE_SCOPED_SKIP_CODES = ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */];
749
+ var PRE_CYCLE_SHA_TOKEN = /^([0-9a-f]{7,40})(?![0-9a-z_])/i;
750
+ var NON_APP_PATH_PATTERNS = [
751
+ /\.(md|markdown|rst)$/i,
752
+ /(^|\/)[^/]+\.(test|spec)\.[^/]+$/,
753
+ /(^|\/)(__tests__|__snapshots__|__mocks__)\//,
754
+ /(^|\/)test_[^/]+\.py$/,
755
+ /(^|\/)[^/]+_test\.(py|go)$/,
756
+ /^tests?\//,
757
+ /(^|\/)\.(eslintrc|prettierrc|stylelintrc)(\.[a-z]+)?$/,
758
+ /(^|\/)(eslint|prettier|stylelint)\.config\.[cm]?[jt]s$/,
759
+ /(^|\/)\.(eslint|prettier|stylelint)ignore$/,
760
+ /(^|\/)\.markdownlint[^/]*$/,
761
+ /(^|\/)(biome\.jsonc?|\.editorconfig)$/,
762
+ /^\.github\/workflows\//,
763
+ /^\.gitlab-ci\.yml$/
764
+ ];
765
+ var MAX_NAMED_APP_LOGIC_PATHS = 5;
766
+ var USER_WAIVE_PHRASE = "SKIP E2E";
767
+ var MIN_NOT_APPLICABLE_REASON_WORDS = 4;
768
+ var DEV_SERVER_PROBE_TIMEOUT_MS = 2e3;
769
+ var GIT_PROBE_TIMEOUT_MS = 5e3;
770
+ var WEB_SERVER_COMMAND = /\b(vite|next\s+(dev|start)|react-scripts|ng\s+serve|nuxt|astro\s+dev|remix\s+dev|webpack(-dev)?-server|http-server|serve\s+-s|gatsby\s+develop|vue-cli-service\s+serve)\b/;
771
+ var BROWSER_FRAMEWORK_PACKAGES = [
772
+ "react-dom",
773
+ "next",
774
+ "vue",
775
+ "svelte",
776
+ "@angular/core",
777
+ "nuxt",
778
+ "astro",
779
+ "@remix-run/react",
780
+ "preact",
781
+ "solid-js"
782
+ ];
783
+ var WEB_SURFACE_CONFIG_FILES = [
784
+ "next.config.js",
785
+ "next.config.mjs",
786
+ "next.config.ts",
787
+ "vite.config.js",
788
+ "vite.config.ts",
789
+ "index.html",
790
+ "public/index.html"
791
+ ];
792
+ var OAUTH_SESSION_FILE = /^oauth-session[\w.-]*\.json$/;
793
+ var MUGGLE_HOME_DIR_NAME = ".muggle-ai";
794
+
720
795
  // src/guardrails/shouldRunE2E.ts
721
796
  var MAX_E2E_BLOCKS = 3;
797
+ function applyE2eSkipDeclaration(state, skip) {
798
+ if (!skip || CYCLE_SCOPED_SKIP_CODES.includes(skip.code)) return state;
799
+ return { ...state, e2eSkipDeclaration: { code: skip.code, detail: skip.detail } };
800
+ }
722
801
  function shouldRunE2E(state) {
723
802
  const owed = state.unitTestsGreen === true || state.prsHandled.length > 0;
724
803
  return owed && state.e2eRun !== true && state.e2eSkipped !== true;
@@ -1046,26 +1125,29 @@ var defaultPrWalkthroughLookup = {
1046
1125
  // Scans the description as well as the comments: muggle-do embeds the
1047
1126
  // walkthrough in the body at PR-creation time, and a comments-only check
1048
1127
  // would report that PR as owing one it already carries.
1049
- prCarriesWalkthrough: (prUrl) => {
1128
+ prCarriesWalkthrough: (prUrl, acceptsSkip) => {
1050
1129
  const rendered = runGh(["pr", "view", prUrl, "--json", "body,comments"]);
1051
1130
  if (rendered === null) return true;
1052
- return rendered.includes(REPORT_SENTINEL);
1131
+ return rendered.includes(REPORT_SENTINEL) || acceptsSkip && rendered.includes(WALKTHROUGH_SKIPPED_MARKER);
1053
1132
  }
1054
1133
  };
1055
1134
  function scanForOwedWalkthroughs(state, lookup = defaultPrWalkthroughLookup) {
1056
1135
  const candidates = new Set(state.prsHandled);
1057
1136
  const branchPrUrl = lookup.branchPrUrl();
1058
1137
  if (branchPrUrl) candidates.add(branchPrUrl);
1138
+ const acceptsSkip = state.e2eRun !== true;
1059
1139
  const owed = [];
1060
1140
  const verified2 = [];
1061
1141
  for (const prUrl of candidates) {
1062
- if (lookup.prCarriesWalkthrough(prUrl)) verified2.push(prUrl);
1142
+ if (lookup.prCarriesWalkthrough(prUrl, acceptsSkip)) verified2.push(prUrl);
1063
1143
  else owed.push(prUrl);
1064
1144
  }
1065
1145
  return { owed, verified: verified2 };
1066
1146
  }
1067
1147
  function isWalkthroughGateArmed(state) {
1068
- return state.e2eRun === true && state.walkthroughPosted !== true && state.walkthroughSkipped !== true;
1148
+ const isSkipUnsettled = state.e2eSkipDeclaration !== void 0 && state.e2eSkipSettledOnPrs !== true;
1149
+ const isOwed = state.e2eRun === true || isSkipUnsettled;
1150
+ return isOwed && state.walkthroughPosted !== true && state.walkthroughSkipped !== true;
1069
1151
  }
1070
1152
  function isWalkthroughScanCurrent(scan, state) {
1071
1153
  const scanned = new Set(scan.prsHandled);
@@ -1073,8 +1155,7 @@ function isWalkthroughScanCurrent(scan, state) {
1073
1155
  }
1074
1156
  function walkthroughGateDecision(state, owedPrUrls, maxBlocks = MAX_WALKTHROUGH_BLOCKS) {
1075
1157
  const blockCount = state.walkthroughBlockCount ?? 0;
1076
- const alreadySettled = state.walkthroughPosted === true || state.walkthroughSkipped === true || state.e2eRun !== true;
1077
- if (alreadySettled || owedPrUrls.length === 0) {
1158
+ if (!isWalkthroughGateArmed(state) || owedPrUrls.length === 0) {
1078
1159
  return { action: "none" /* None */, blockCount, owed: owedPrUrls };
1079
1160
  }
1080
1161
  if (blockCount >= maxBlocks) {
@@ -1083,81 +1164,6 @@ function walkthroughGateDecision(state, owedPrUrls, maxBlocks = MAX_WALKTHROUGH_
1083
1164
  return { action: "block" /* Block */, blockCount: blockCount + 1, owed: owedPrUrls };
1084
1165
  }
1085
1166
 
1086
- // src/e2e-skip/types.ts
1087
- var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
1088
- E2eSkipCode3["NoWebSurface"] = "NO_WEB_SURFACE";
1089
- E2eSkipCode3["DevServerUnreachable"] = "DEV_SERVER_UNREACHABLE";
1090
- E2eSkipCode3["EmptyDiff"] = "EMPTY_DIFF";
1091
- E2eSkipCode3["MuggleAuthDown"] = "MUGGLE_AUTH_DOWN";
1092
- E2eSkipCode3["NoPr"] = "NO_PR";
1093
- E2eSkipCode3["UserWaived"] = "USER_WAIVED";
1094
- E2eSkipCode3["NoAppLogicChange"] = "NO_APP_LOGIC_CHANGE";
1095
- E2eSkipCode3["NotApplicable"] = "NOT_APPLICABLE";
1096
- return E2eSkipCode3;
1097
- })(E2eSkipCode || {});
1098
-
1099
- // src/e2e-skip/constants.ts
1100
- var E2E_SKIP_DECLARATION = /^\s*echo\s+["']?MUGGLE_E2E_SKIP:(.*)$/;
1101
- var SKIP_CODE_TOKEN = /^[\s:]*([A-Za-z_]+)/;
1102
- var E2E_SKIP_CODES = Object.values(E2eSkipCode);
1103
- var NON_APP_PATH_SUMMARY = "docs, tests, lint/format config, or CI config";
1104
- var E2E_SKIP_CODE_CLAIMS = {
1105
- ["NO_WEB_SURFACE" /* NoWebSurface */]: "the repo ships no web surface to drive",
1106
- ["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: "the named dev server does not answer",
1107
- ["EMPTY_DIFF" /* EmptyDiff */]: "the branch carries no diff against its base",
1108
- ["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: "the stored Muggle session is missing or expired",
1109
- ["NO_PR" /* NoPr */]: "no pull request was handled this session",
1110
- ["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words",
1111
- ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: `every path changed since the named commit is ${NON_APP_PATH_SUMMARY}`,
1112
- ["NOT_APPLICABLE" /* NotApplicable */]: "a browser run cannot exercise this change, for the reason stated"
1113
- };
1114
- var CYCLE_SCOPED_SKIP_CODES = ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */];
1115
- var PRE_CYCLE_SHA_TOKEN = /^([0-9a-f]{7,40})(?![0-9a-z_])/i;
1116
- var NON_APP_PATH_PATTERNS = [
1117
- /\.(md|markdown|rst)$/i,
1118
- /(^|\/)[^/]+\.(test|spec)\.[^/]+$/,
1119
- /(^|\/)(__tests__|__snapshots__|__mocks__)\//,
1120
- /(^|\/)test_[^/]+\.py$/,
1121
- /(^|\/)[^/]+_test\.(py|go)$/,
1122
- /^tests?\//,
1123
- /(^|\/)\.(eslintrc|prettierrc|stylelintrc)(\.[a-z]+)?$/,
1124
- /(^|\/)(eslint|prettier|stylelint)\.config\.[cm]?[jt]s$/,
1125
- /(^|\/)\.(eslint|prettier|stylelint)ignore$/,
1126
- /(^|\/)\.markdownlint[^/]*$/,
1127
- /(^|\/)(biome\.jsonc?|\.editorconfig)$/,
1128
- /^\.github\/workflows\//,
1129
- /^\.gitlab-ci\.yml$/
1130
- ];
1131
- var MAX_NAMED_APP_LOGIC_PATHS = 5;
1132
- var USER_WAIVE_PHRASE = "SKIP E2E";
1133
- var MIN_NOT_APPLICABLE_REASON_WORDS = 4;
1134
- var DEV_SERVER_PROBE_TIMEOUT_MS = 2e3;
1135
- var GIT_PROBE_TIMEOUT_MS = 5e3;
1136
- var WEB_SERVER_COMMAND = /\b(vite|next\s+(dev|start)|react-scripts|ng\s+serve|nuxt|astro\s+dev|remix\s+dev|webpack(-dev)?-server|http-server|serve\s+-s|gatsby\s+develop|vue-cli-service\s+serve)\b/;
1137
- var BROWSER_FRAMEWORK_PACKAGES = [
1138
- "react-dom",
1139
- "next",
1140
- "vue",
1141
- "svelte",
1142
- "@angular/core",
1143
- "nuxt",
1144
- "astro",
1145
- "@remix-run/react",
1146
- "preact",
1147
- "solid-js"
1148
- ];
1149
- var WEB_SURFACE_CONFIG_FILES = [
1150
- "next.config.js",
1151
- "next.config.mjs",
1152
- "next.config.ts",
1153
- "vite.config.js",
1154
- "vite.config.ts",
1155
- "index.html",
1156
- "public/index.html"
1157
- ];
1158
- var OAUTH_SESSION_FILE = /^oauth-session[\w.-]*\.json$/;
1159
- var MUGGLE_HOME_DIR_NAME = ".muggle-ai";
1160
-
1161
1167
  // src/e2e-skip/noAppLogicChange.ts
1162
1168
  function parseNoAppLogicChangeDetail(detail) {
1163
1169
  const stated = detail.trim();
@@ -1237,6 +1243,14 @@ function classifyComment(body) {
1237
1243
  if (body.includes(WALKTHROUGH_SKIPPED_MARKER)) return "skipped" /* Skipped */;
1238
1244
  return "pending" /* Pending */;
1239
1245
  }
1246
+ function walkthroughVerdict(bodies) {
1247
+ const statuses = bodies.map(classifyComment);
1248
+ if (statuses.includes("reported" /* Reported */) || statuses.includes("skipped" /* Skipped */)) {
1249
+ return "satisfied" /* Satisfied */;
1250
+ }
1251
+ if (statuses.includes("pending" /* Pending */)) return "pending" /* Pending */;
1252
+ return "missing" /* Missing */;
1253
+ }
1240
1254
 
1241
1255
  // src/pr-walkthrough/reserve.ts
1242
1256
  function commentWithStatus(comments, status) {
@@ -1256,6 +1270,13 @@ function reserveWalkthroughComment(prUrl, run = defaultGhRunner) {
1256
1270
  if (comments === null) return false;
1257
1271
  return reserveComment(pr, comments, run);
1258
1272
  }
1273
+ function isWalkthroughSettledOnPr(prUrl, run = defaultGhRunner) {
1274
+ const pr = parsePrUrl(prUrl);
1275
+ if (!pr) return false;
1276
+ const comments = listPrComments(pr, run);
1277
+ if (comments === null) return false;
1278
+ return walkthroughVerdict(comments.map((comment) => comment.body)) === "satisfied" /* Satisfied */;
1279
+ }
1259
1280
  function settleWith(prUrl, body, run) {
1260
1281
  const pr = parsePrUrl(prUrl);
1261
1282
  if (!pr) return false;
@@ -1930,13 +1951,21 @@ function prOpened() {
1930
1951
  if (!url) return "{}";
1931
1952
  if (readState(sessionId).prsHandled.includes(url)) return "{}";
1932
1953
  markPrHandled(sessionId, url);
1933
- startBackgroundJob("reserve-walkthrough-comment" /* ReserveWalkthroughComment */, [url]);
1934
- if (isWalkthroughGateArmed(readState(sessionId))) {
1954
+ const stateAfterOpen = commitState(sessionId, (state) => ({ ...state, e2eSkipSettledOnPrs: false })) ?? readState(sessionId);
1955
+ const declaredSkip = stateAfterOpen.e2eSkipDeclaration;
1956
+ if (declaredSkip) {
1957
+ startBackgroundJob("settle-walkthrough-skipped" /* SettleWalkthroughSkipped */, [url, declaredSkip.code, declaredSkip.detail]);
1958
+ } else {
1959
+ startBackgroundJob("reserve-walkthrough-comment" /* ReserveWalkthroughComment */, [url]);
1960
+ }
1961
+ if (isWalkthroughGateArmed(stateAfterOpen)) {
1935
1962
  startBackgroundJob("scan-walkthroughs" /* ScanWalkthroughs */, [sessionId], input.cwd);
1936
1963
  }
1964
+ const slotNote = declaredSkip ? `Its Muggle AI visual-walkthrough comment is being settled with the E2E skip already recorded this session (${declaredSkip.code}); the turn cannot end until the PR shows it.
1965
+ ` : `Its Muggle AI visual-walkthrough comment is reserved and empty \u2014 settle it by posting the walkthrough there once E2E runs, or by recording why E2E does not apply.
1966
+ `;
1937
1967
  const ctx = `A pull request was just opened: ${url}
1938
- Its Muggle AI visual-walkthrough comment is reserved and empty \u2014 settle it by posting the walkthrough there once E2E runs, or by recording why E2E does not apply.
1939
- Per the autoWatchPR preference, a muggle-pr-followup watcher should handle its incoming reviews. If autoWatchPR=always, start it now by invoking ${muggleSkill("/muggle:muggle-pr-followup")} with the PR URL; if =ask, offer it to the user; if =never, do nothing.`;
1968
+ ` + slotNote + `Per the autoWatchPR preference, a muggle-pr-followup watcher should handle its incoming reviews. If autoWatchPR=always, start it now by invoking ${muggleSkill("/muggle:muggle-pr-followup")} with the PR URL; if =ask, offer it to the user; if =never, do nothing.`;
1940
1969
  return envelope("PostToolUse", ctx, host);
1941
1970
  }
1942
1971
  function prTerminal() {
@@ -1995,7 +2024,7 @@ function recordTests() {
1995
2024
  const walkthroughPosted = detectWalkthroughPost(input);
1996
2025
  const failedRunId = detectFailedRunId(input);
1997
2026
  const record = (state) => {
1998
- const recorded = applyRecordedRun(state, run);
2027
+ const recorded = applyE2eSkipDeclaration(applyRecordedRun(state, run), acceptedSkip);
1999
2028
  const withWatchSkip = applyWatchSkip(recorded, isWatchSkipMarker(cmd));
2000
2029
  const withBuildSkip = applyBuildSkip(withWatchSkip, isBuildSkipMarker(cmd));
2001
2030
  const withWalkthroughPost = applyWalkthroughPosted(withBuildSkip, walkthroughPosted);
@@ -2143,8 +2172,11 @@ function walkthroughGate() {
2143
2172
  const scan = readWalkthroughScan(sessionId);
2144
2173
  startBackgroundJob("scan-walkthroughs" /* ScanWalkthroughs */, [sessionId], input.cwd);
2145
2174
  if (!scan || !isWalkthroughScanCurrent(scan, state)) return "{}";
2175
+ const owedSkip = state.e2eRun === true ? void 0 : state.e2eSkipDeclaration;
2146
2176
  if (scan.owed.length === 0) {
2147
- if (scan.verified.length > 0) writeState({ ...state, walkthroughPosted: true });
2177
+ if (scan.verified.length > 0) {
2178
+ writeState(owedSkip ? { ...state, e2eSkipSettledOnPrs: true } : { ...state, walkthroughPosted: true });
2179
+ }
2148
2180
  return "{}";
2149
2181
  }
2150
2182
  const decision = walkthroughGateDecision(state, scan.owed);
@@ -2153,9 +2185,18 @@ function walkthroughGate() {
2153
2185
  state.walkthroughBlockCount = decision.blockCount;
2154
2186
  writeState(state);
2155
2187
  const prList = decision.owed.join(", ");
2188
+ if (owedSkip) return blockOnUnsettledSkip(owedSkip, decision.owed, decision.blockCount);
2156
2189
  const reason = decision.blockCount === 1 ? `Do not end the turn yet. An E2E acceptance run happened this session but no visual walkthrough has reached ${prList}. Per the postPRVisualWalkthrough preference (default: always), post it now via ${muggleSkill("/muggle:muggle-pr-visual-walkthrough")} \u2014 include the failed runs, which are the ones reviewers most need to see. If this result genuinely should not be posted (postPRVisualWalkthrough=never, someone else's PR, nothing renderable), tell the user why and run \`echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"\` \u2014 that records the skip and keeps this gate quiet for the rest of the session.` : `Walkthrough still owed for ${prList} (reminder ${decision.blockCount}/${MAX_WALKTHROUGH_BLOCKS}): post via ${muggleSkill("/muggle:muggle-pr-visual-walkthrough")}, or record a legitimate skip via \`echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"\`.`;
2157
2190
  return blockStop(reason, host);
2158
2191
  }
2192
+ function blockOnUnsettledSkip(owedSkip, owedPrUrls, blockCount) {
2193
+ for (const prUrl of owedPrUrls) {
2194
+ startBackgroundJob("settle-walkthrough-skipped" /* SettleWalkthroughSkipped */, [prUrl, owedSkip.code, owedSkip.detail]);
2195
+ }
2196
+ const settleCommands = owedPrUrls.map((prUrl) => `\`echo '{}' | node "${process.argv[1]}" ${"settle-walkthrough-skipped" /* SettleWalkthroughSkipped */} ${prUrl} ${sessionId}\``).join(" and ");
2197
+ const reason = blockCount === 1 ? `Do not end the turn yet. E2E was skipped (${owedSkip.code}) and the skip was recorded, but it has not reached ${owedPrUrls.join(", ")}: the PR's walkthrough comment still shows no result and no reason, so reviewers cannot tell a deliberate skip from a cycle that forgot, and its walkthrough check stays red. Write it now by running ${settleCommands} \u2014 it prints {"settled":true} once the PR shows the skip. Then end the turn.` : `Skip record still missing on ${owedPrUrls.join(", ")} (reminder ${blockCount}/${MAX_WALKTHROUGH_BLOCKS}): run ${settleCommands}.`;
2198
+ return blockStop(reason, host);
2199
+ }
2159
2200
  function slotForSession(state) {
2160
2201
  for (const prUrl of state.prsHandled) {
2161
2202
  const slotPath = resolveSlotForPr(prUrl);
@@ -2307,10 +2348,12 @@ function reserveWalkthroughCommentJob() {
2307
2348
  return "{}";
2308
2349
  }
2309
2350
  function settleWalkthroughSkippedJob() {
2310
- const [prUrl, codeArg, detail] = jobArgs;
2311
- const code = E2E_SKIP_CODES.find((skipCode) => skipCode === codeArg);
2312
- if (prUrl && code) settleWalkthroughCommentAsSkipped(prUrl, code, detail ?? "");
2313
- return "{}";
2351
+ const [prUrl, codeOrSessionId, detail] = jobArgs;
2352
+ const code = E2E_SKIP_CODES.find((skipCode) => skipCode === codeOrSessionId);
2353
+ const skip = code ? { code, detail: detail ?? "" } : codeOrSessionId ? readState(codeOrSessionId).e2eSkipDeclaration : void 0;
2354
+ if (!prUrl || !skip) return JSON.stringify({ settled: false, reason: "no accepted E2E skip to settle" });
2355
+ settleWalkthroughCommentAsSkipped(prUrl, skip.code, skip.detail);
2356
+ return JSON.stringify({ settled: isWalkthroughSettledOnPr(prUrl) });
2314
2357
  }
2315
2358
  function settleWalkthroughUnreasonedJob() {
2316
2359
  const [prUrl] = jobArgs;
@@ -137,8 +137,15 @@ echo "DRAIN checks pending=${pending_checks:-0} failed=${failed_checks:-0} behin
137
137
  # — reconcile reads any id it does not recognise as another session's claim, and
138
138
  # a bogus one would strand the slot exactly as an absent file does.
139
139
  if [ -n "${CLAUDE_CODE_SESSION_ID:-}" ]; then
140
+ claimed_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
140
141
  printf '{\n "session_id": "%s",\n "claimed_at": "%s"\n}\n' \
141
- "$CLAUDE_CODE_SESSION_ID" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "${slot}/owner.json"
142
+ "$CLAUDE_CODE_SESSION_ID" "$claimed_at" > "${slot}/owner.json"
143
+ # Register the slot with the muggle watch service, which resumes this owner
144
+ # in the background if the loop dies while the session is down, so its own
145
+ # reconcile re-arms the watch. It lives in the slot, so a stop rename or a
146
+ # finalize retires it with no extra call; an unowned slot has nobody to resume.
147
+ printf '{\n "registered_at": "%s",\n "registered_by": "pr-watch-arm"\n}\n' \
148
+ "$claimed_at" > "${slot}/watch-registration.json"
142
149
  else
143
150
  echo "pr-watch-arm: CLAUDE_CODE_SESSION_ID unset — slot left unowned, reconcile cannot re-arm it" >&2
144
151
  fi
@@ -49,7 +49,7 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
49
49
 
50
50
  6. **Settle the designated walkthrough comment.** Creating the PR reserves one comment for the walkthrough, marked `muggle-pr-walkthrough` and empty until settled — the PR's walkthrough check fails while it stays that way.
51
51
  - E2E report exists → fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md); on skip, leave the comment to the gate's own skip record. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A with the PR number — it fills the reserved comment in place.
52
- - No E2E report (validation was `unit-only` or `skip`) → now that the PR exists, re-declare the skip Stage 6 recorded with the same code: `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"`, codes per [`../e2e-acceptance.md`](../e2e-acceptance.md). An accepted code settles the comment as a declared skip; a free-text reason is rejected and leaves it unsettled. A PR whose title says `[UNIT-ONLY]` still owes reviewers the why.
52
+ - No E2E report (validation was `unit-only` or `skip`) → now that the PR exists, re-declare the skip Stage 6 recorded with the same code: `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"`, codes per [`../e2e-acceptance.md`](../e2e-acceptance.md). An accepted code settles the comment as a declared skip; a free-text reason is rejected and leaves it unsettled. A PR whose title says `[UNIT-ONLY]` still owes reviewers the why. The write runs detached, so confirm it landed: the walkthrough Stop gate holds the turn while the PR still shows the placeholder, and its block names a foreground command that prints `{"settled":true}` once the PR reads back the skip — run it, never a hand-written PATCH.
53
53
 
54
54
  7. **Overflow comment:** if the walkthrough skill returned a non-null `comment`, post it once using the provider resolved in Step 5 — `github` per [`../../_shared/vcs/github/top-level-comment.md`](../../_shared/vcs/github/top-level-comment.md), `gitlab` per [`../../_shared/vcs/gitlab/mr-note.md`](../../_shared/vcs/gitlab/mr-note.md). End the posted body with the signature line (command `/muggle-do`) per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md). Never post when `comment` is `null`.
55
55
 
@@ -22,6 +22,8 @@ Read the `DRAIN` lines it prints: they are the outstanding work the monitor will
22
22
 
23
23
  Otherwise **claim the slot for this session** before starting anything: write `owner.json` ([`state-schemas.md`](state-schemas.md#ownerjson)) with `session_id` from `$CLAUDE_CODE_SESSION_ID` and `claimed_at` now. Arming is what establishes ownership, so every arming point records it here rather than each caller remembering to. If `$CLAUDE_CODE_SESSION_ID` is unset, write no `owner.json` — an unidentifiable owner is worse than none, since [`reconcile.md`](reconcile.md) would read a bogus id as some other session's claim and could never recover the slot.
24
24
 
25
+ The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled task that runs outside every session. When a registered slot's loop is gone while its owner session is down, it resumes that owner in the background (`claude --resume <owner> --bg`), and the owner's own reconcile re-arms the watch. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never resumes its owner.
26
+
25
27
  Then start the watch as a **persistent background monitor** in the orchestrating session, with the script path resolved to an absolute path at arm time (from `${CLAUDE_PLUGIN_ROOT}/scripts/`) so it still resolves after the arming session is gone. `pr-watch-arm.sh` performs Steps 1-2 and then execs the loop, so the monitor's command is the arm script:
26
28
 
27
29
  ```sh
@@ -16,11 +16,13 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
16
16
 
17
17
  ## Watching is session-scoped
18
18
 
19
- A watcher lives and dies with its session: monitors and `/loop` crons are both session-bound, so a session that ends or hits its usage limit takes every watch down with it. Nothing polls out of session — there is no detached daemon. This is deliberate: a review is addressed only inside a session that carries the context to address it, never by a headless process that would reply without that context.
19
+ A watcher lives and dies with its session: monitors and `/loop` crons are both session-bound, so a session that ends or hits its usage limit takes every watch down with it. No poller outlives its session to act on a PR. This is deliberate: a review is addressed only inside a session that carries the context to address it, never by a headless process that would reply without that context.
20
+
21
+ What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled task). It addresses nothing on any PR. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone while its owner is down, it resumes the **owning** session in the background. That session's reconcile, this procedure, re-arms the watch with its own context. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
20
22
 
21
23
  **Ownership is session-scoped too, and that is what bounds recovery.** Each slot records the session that armed it in [`owner.json`](state-schemas.md#ownerjson). Step 3.6 re-arms only slots the running session owns — watchers it armed itself, whose poller died under it. A slot owned by another session, or by none, is **never** re-armed here however dead its poller looks. The same argument that forbids a headless daemon forbids a fresh session inheriting a stranger's PR: it would be picking up review work it has no context for, on a branch it never built, and every push it made would be as context-blind as the daemon the design already rejected. Adoption exists precisely so that step is a deliberate act by the owner ([`adopt.md`](adopt.md)) rather than a side effect of starting a session.
22
24
 
23
- The cost is real and accepted: a PR whose owning session is gone stops being watched and stays unwatched until someone adopts it. Reconcile makes that visible instead of silent — Step 4 lists every orphan it declined to touch — and it still finalizes an orphan whose PR went terminal, which needs no context at all.
25
+ The cost is real and accepted: a PR whose owning session is gone stops being watched until that owner is resumed (by the user, or by the muggle watch service for a registered slot) or someone adopts it. Reconcile makes that visible instead of silent — Step 4 lists every orphan it declined to touch — and it still finalizes an orphan whose PR went terminal, which needs no context at all.
24
26
 
25
27
  ## Input
26
28
 
@@ -48,6 +48,21 @@ The Claude Code session that owns this slot's watch. Written when a session arms
48
48
 
49
49
  Distinct from [`watch.pid`](#watchpid), and the two are not interchangeable. `watch.pid` leases the slot to one OS **process** so two loops never poll it at once; `owner.json` leases it to one **session** so a foreign session never revives a watch it has no context for. A dead PID marks a watcher to recover; a foreign `session_id` marks one to leave alone. Reconcile consults both, in that order.
50
50
 
51
+ ## `watch-registration.json`
52
+
53
+ The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per-user scheduled task). `pr-watch-arm.sh` writes it beside `owner.json` on every arm that writes an owner. `muggle watch register --slot <slot>` writes it for a slot armed another way, and `muggle watch unregister --slot <slot>` removes it.
54
+
55
+ ```json
56
+ {
57
+ "registered_at": "<ISO-8601>",
58
+ "registered_by": "pr-watch-arm | muggle-watch-cli"
59
+ }
60
+ ```
61
+
62
+ Recovery requires all of: the slot is registered, the PR is open on GitHub, no loop process carries the slot's `--slot` path, the heartbeat is older than the rollover hand-off, `polling.disabled` is absent, and the `owner.json` session is not running. The service then resumes that session in the background from the project dir its transcript records, starting it on `/muggle:muggle-pr-followup reconcile`. Reconcile re-arms only the slots the session owns, so recovery never moves a PR to another session. One resume per owner covers every slot it owns. The service caps resumes per pass and per owner, then falls back to a desktop alert.
63
+
64
+ **Absent ⇒ observed only.** The service still reports on the slot's watcher, CI and branch standing, but never resumes its owner. Slots armed before this file existed stay that way until their next arm. The file lives in the slot, so a `.stopped` rename or a `result.md` retires it with the slot.
65
+
51
66
  ## `cron.json`
52
67
 
53
68
  A durable, on-disk handle to this slot's watcher cron. Its whole reason to exist: `CronList` goes **blind to crons that outlive a session continue / compaction** (the watcher's `/loop` cron survives, but the tool can no longer enumerate it), so a teardown that can only find crons through `CronList` can never delete the orphan — it re-fires until the 7-day `/loop` expiry. A cron id recorded to disk **while the cron was still visible** stays a valid `CronDelete` target afterward. See [`record-cron-id.md`](record-cron-id.md) (who writes it) and [`cancel-cron.md`](cancel-cron.md) (who deletes by it).
@@ -14,7 +14,7 @@ Run per slot in scope (every dir under `~/.muggle-ai/muggle-do/sessions/` with a
14
14
 
15
15
  1. **Stop the monitor.** `TaskStop` any running monitor whose command references this slot's `watch.sh`. On Windows also kill surviving grandchildren: `TaskStop` reaps the wrapper but the inner `bash <slot>/watch.sh` process can outlive it and keep touching `watch-heartbeat` — enumerate processes whose command line contains `<slug>/watch.sh` and kill them. A survivor here also blocks the Step 3 rename (open handles inside the dir).
16
16
  2. **Cancel the cron.** Per [`cancel-cron.md`](cancel-cron.md) — recorded-id first, `CronList` match as fallback. A cron neither can reach is orphaned; it stays inert via the absorb and dies with its session.
17
- 3. **Mark the slot stopped.** Rename `~/.muggle-ai/muggle-do/sessions/<slug>/` → `<slug>.stopped/`. This single rename is the load-bearing act: the tick absorb keys on it and [`reconcile.md`](reconcile.md) skips `*.stopped` dirs — so no recovery path of any kind re-arms the slot.
17
+ 3. **Mark the slot stopped.** Rename `~/.muggle-ai/muggle-do/sessions/<slug>/` → `<slug>.stopped/`. This single rename is the load-bearing act: the tick absorb keys on it, [`reconcile.md`](reconcile.md) skips `*.stopped` dirs, and the muggle watch service ignores a stopped slot's [`watch-registration.json`](state-schemas.md#watch-registrationjson), so no recovery path of any kind re-arms the slot. To keep a watch running but stop the service from resuming its owner, use `muggle watch unregister --slot <slot>` instead.
18
18
 
19
19
  Then, for a no-slug (stop-everything) invocation only:
20
20
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-198-1",
4
- "commitSha": "887a8e6d00ec12e27ae8414332766a3239930222",
5
- "buildTime": "2026-10-25T04:03:06Z",
3
+ "buildId": "run-200-1",
4
+ "commitSha": "5720be9c0ed917f2f89e338138c4f6462bf59729",
5
+ "buildTime": "2026-10-25T20:25:22Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
@@ -1 +1 @@
1
- export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, 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, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, 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, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, 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-SLU7LHVJ.js';
1
+ export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, 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, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, 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, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, 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-IL5E5YGY.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.198",
4
+ "version": "5.26.0-staging.200",
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",
@@ -18,6 +18,7 @@
18
18
  "scripts/electron-app-install-dir.mjs",
19
19
  "scripts/onboarding-backfill.mjs",
20
20
  "scripts/release-integrity",
21
+ "scripts/muggle-watch",
21
22
  "config/runtime-targets.json"
22
23
  ],
23
24
  "scripts": {
@@ -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.198",
4
+ "version": "5.26.0-staging.200",
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.198",
7
+ "@muggleai/works@5.26.0-staging.200",
8
8
  "serve"
9
9
  ],
10
10
  "env": {