@muggleai/works 5.26.0-staging.201 → 5.26.0-staging.203

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 (34) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-3SOMBMOZ.js → chunk-3XUP6R6P.js} +16 -0
  4. package/dist/{chunk-ZICCOF6H.js → chunk-7NGYZIG7.js} +2659 -2358
  5. package/dist/cli.js +2 -2
  6. package/dist/index.js +2 -2
  7. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  8. package/dist/plugin/.codex-mcp.json +1 -1
  9. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  10. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  11. package/dist/plugin/.mcp.json +1 -1
  12. package/dist/plugin/config/preference-defaults.json +1 -0
  13. package/dist/plugin/skills/muggle-pr-followup/reconcile.md +1 -1
  14. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +1 -1
  15. package/dist/plugin/skills/muggle-preferences/ops/configure.md +1 -0
  16. package/dist/plugin/skills/muggle-preferences/preference-gates/autoInstallWatchService.md +13 -0
  17. package/dist/plugin/skills/muggle-upgrade/SKILL.md +10 -2
  18. package/dist/release-manifest.json +3 -3
  19. package/dist/{src-62CIBCSG.js → src-MCPYIWZE.js} +1 -1
  20. package/package.json +1 -1
  21. package/plugin/.claude-plugin/plugin.json +1 -1
  22. package/plugin/.codex-mcp.json +1 -1
  23. package/plugin/.codex-plugin/plugin.json +1 -1
  24. package/plugin/.cursor-plugin/plugin.json +1 -1
  25. package/plugin/.mcp.json +1 -1
  26. package/plugin/config/preference-defaults.json +1 -0
  27. package/plugin/skills/muggle-pr-followup/reconcile.md +1 -1
  28. package/plugin/skills/muggle-pr-followup/state-schemas.md +1 -1
  29. package/plugin/skills/muggle-preferences/ops/configure.md +1 -0
  30. package/plugin/skills/muggle-preferences/preference-gates/autoInstallWatchService.md +13 -0
  31. package/plugin/skills/muggle-upgrade/SKILL.md +10 -2
  32. package/scripts/muggle-watch/README.md +18 -7
  33. package/scripts/muggle-watch/install-muggle-watch.ps1 +14 -3
  34. package/scripts/postinstall.mjs +25 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-ZICCOF6H.js';
3
- import './chunk-3SOMBMOZ.js';
2
+ import { runCli } from './chunk-7NGYZIG7.js';
3
+ import './chunk-3XUP6R6P.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-ZICCOF6H.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-3SOMBMOZ.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-7NGYZIG7.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-3XUP6R6P.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.201",
4
+ "version": "5.26.0-staging.203",
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.201",
7
+ "@muggleai/works@5.26.0-staging.203",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.201",
3
+ "version": "5.26.0-staging.203",
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.201",
5
+ "version": "5.26.0-staging.203",
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.201",
7
+ "@muggleai/works@5.26.0-staging.203",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -21,6 +21,7 @@
21
21
  "autoRouteBuildToMuggleDo": "always",
22
22
  "autoWatchPR": "always",
23
23
  "autoInstallCiWorkflow": "ask",
24
+ "autoInstallWatchService": "ask",
24
25
  "reusePreparePlan": "always",
25
26
  "watcherLifetime": "7d",
26
27
  "maxCatchUpRebases": "20"
@@ -18,7 +18,7 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
18
18
 
19
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
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.
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. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
22
22
 
23
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.
24
24
 
@@ -178,7 +178,7 @@ Used for forensics only — never read back by skills.
178
178
 
179
179
  ## `result.md`
180
180
 
181
- Written exactly once when the PR's watcher exits terminally (PR merged or closed). Free-form markdown summarizing the PR's life under this loop:
181
+ Written exactly once when the PR's watcher exits terminally (PR merged or closed). The muggle watch service writes it too, registered slot or not, when the PR went terminal while neither its loop nor its owner session was running: the cycle fields come from `last_seen.json`, the timeline holds one `closed out by muggle-watch` line, and `followup.log` gains `tick pr=<n> terminal=<state> closed-out-by=muggle-watch`. Free-form markdown summarizing the PR's life under this loop:
182
182
 
183
183
  ```markdown
184
184
  # Result — <slug>
@@ -32,6 +32,7 @@ For each option: label = key name, description = first paragraph of `preference-
32
32
  - `multiSelect: true`, `header: "PR"` — `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `autoRouteBuildToMuggleDo`
33
33
  - `multiSelect: true`, `header: "Branch hygiene"` — `autoUseWorktree`, `autoRebase`, `autoCleanup`, `autoResolveConflicts`
34
34
  - `multiSelect: false`, `header: "CI check"` — `autoInstallCiWorkflow`. Options: `Always — add it to every repo Muggle works in` (`always`), `Ask in each repo` (`ask` — default), `Never` (`never`).
35
+ - `multiSelect: false`, `header: "Muggle Watch"` — `autoInstallWatchService`. Options: `Always — install it now and refresh it on every upgrade` (`always`), `Ask me later` (`ask` — default), `Never` (`never`).
35
36
  - `multiSelect: false`, `header: "E2E acceptance"` — `autoE2ETest`. Options: `Always run Stage 6 at the end` (`always` — default), `Ask each cycle` (`ask`). No `never` option.
36
37
  - `multiSelect: false`, `header: "Default mode"` — `defaultExecutionMode`. Options: `Local — run on my computer` (`local`), `Remote — run in the Muggle Test cloud` (`remote`), `Ask each time` (don't change).
37
38
  - `multiSelect: false`, `header: "PR watcher"` — `watcherLifetime`. Options: `Retire after 1 day` (`1d`), `Retire after 7 days` (`7d` — default), `Never retire` (`never`).
@@ -0,0 +1,13 @@
1
+ # `autoInstallWatchService`
2
+
3
+ Controls whether Muggle runs Muggle Watch, a per-user scheduled task that every two minutes resumes the owner session of a dead PR watcher, moves idle sessions onto the newest install, and alerts on red CI and stale branches. Acted on without a prompt by every global install or upgrade (postinstall) and by `muggle init`; the picker fires only from `/muggle-upgrade`. Where the task already exists only `never` counts: any other value lets an upgrade refresh it in place. Windows only for now; elsewhere `always` prints the crontab line to add instead.
4
+
5
+ **Picker 1** — header `Muggle Watch`, question `"Run Muggle Watch in the background? It brings back dead PR watchers and moves idle sessions onto the newest install."`
6
+ - `Install it` — `Run muggle watch install now, and refresh it on every upgrade.` → `always`
7
+ - `Ask me next time` — `Leave it off and ask after the next upgrade.` → `ask`
8
+ - `Never` — `Don't install it; muggle watch install adds it later.` → `never`
9
+
10
+ **Silent action**
11
+ - `always` → `Muggle Watch is installed and refreshed with this upgrade`
12
+ - `ask` → `Asking whether to run Muggle Watch`
13
+ - `never` → `Leaving Muggle Watch off`
@@ -48,13 +48,15 @@ Two lanes ship on npm, each with its own dist-tag:
48
48
  - Note: `muggle upgrade` only manages the Electron runner — it does NOT upgrade the CLI npm package. That is why step 3 must run first.
49
49
  - The runner tracks published Studio releases only. When it reports "already on the latest version", that is the newest *released* runner — code merged to the Studio repo since that release is not in it, and no upgrade command can reach it until a new runner is published. Say so rather than implying the merge shipped.
50
50
 
51
- 5. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
51
+ 5. **Muggle Watch** — gate: [`autoInstallWatchService`](../muggle-preferences/preference-gates/autoInstallWatchService.md). Step 3's postinstall already acted on `always` and `never`, so print their silent footer. On `ask`, run Picker 1; on `Install it`, run `muggle watch install` and report its last line.
52
+
53
+ 6. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. With Muggle Watch installed, idle background sessions are restarted onto the new build within a few minutes; this session and other terminal sessions still need a reload by hand. Tell the user:
52
54
 
53
55
  > Run **`/reload-plugins`** to load the updated skills, agents, and hooks.
54
56
 
55
57
  Wait for the user to confirm they've reloaded before proceeding.
56
58
 
57
- 6. Run `/muggle:muggle-status` again to confirm everything is healthy after upgrade.
59
+ 7. Run `/muggle:muggle-status` again to confirm everything is healthy after upgrade.
58
60
 
59
61
  ## Output
60
62
 
@@ -63,3 +65,9 @@ Show a before/after table for **CLI**, **Electron runner**, **MCP server**, and
63
65
  If any component upgraded, always end with the `/reload-plugins` reminder — even if the user doesn't need new features right away, stale cached skills can cause confusing behavior.
64
66
 
65
67
  If the upgrade fails at any step, report the error and suggest running `/muggle:muggle-repair`.
68
+
69
+ ## Preferences
70
+
71
+ | Preference | Gate |
72
+ | :--------- | :--- |
73
+ | `autoInstallWatchService` | Step 5 — run Muggle Watch as a scheduled task; postinstall acts on `always`/`never`, `ask` asks here, default `ask` |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-201-1",
4
- "commitSha": "8397bb8ee8a25621c92f53ba07d7ee321c46b304",
5
- "buildTime": "2026-10-25T21:11:50Z",
3
+ "buildId": "run-203-1",
4
+ "commitSha": "9a6d967a9926a036eb0d0bdf7ab007a3c584b2ae",
5
+ "buildTime": "2026-10-26T05:14:44Z",
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, 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-3SOMBMOZ.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-3XUP6R6P.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.201",
4
+ "version": "5.26.0-staging.203",
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.201",
4
+ "version": "5.26.0-staging.203",
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.201",
7
+ "@muggleai/works@5.26.0-staging.203",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.201",
3
+ "version": "5.26.0-staging.203",
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.201",
5
+ "version": "5.26.0-staging.203",
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.201",
7
+ "@muggleai/works@5.26.0-staging.203",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -21,6 +21,7 @@
21
21
  "autoRouteBuildToMuggleDo": "always",
22
22
  "autoWatchPR": "always",
23
23
  "autoInstallCiWorkflow": "ask",
24
+ "autoInstallWatchService": "ask",
24
25
  "reusePreparePlan": "always",
25
26
  "watcherLifetime": "7d",
26
27
  "maxCatchUpRebases": "20"
@@ -18,7 +18,7 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
18
18
 
19
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
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.
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. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
22
22
 
23
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.
24
24
 
@@ -178,7 +178,7 @@ Used for forensics only — never read back by skills.
178
178
 
179
179
  ## `result.md`
180
180
 
181
- Written exactly once when the PR's watcher exits terminally (PR merged or closed). Free-form markdown summarizing the PR's life under this loop:
181
+ Written exactly once when the PR's watcher exits terminally (PR merged or closed). The muggle watch service writes it too, registered slot or not, when the PR went terminal while neither its loop nor its owner session was running: the cycle fields come from `last_seen.json`, the timeline holds one `closed out by muggle-watch` line, and `followup.log` gains `tick pr=<n> terminal=<state> closed-out-by=muggle-watch`. Free-form markdown summarizing the PR's life under this loop:
182
182
 
183
183
  ```markdown
184
184
  # Result — <slug>
@@ -32,6 +32,7 @@ For each option: label = key name, description = first paragraph of `preference-
32
32
  - `multiSelect: true`, `header: "PR"` — `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `autoRouteBuildToMuggleDo`
33
33
  - `multiSelect: true`, `header: "Branch hygiene"` — `autoUseWorktree`, `autoRebase`, `autoCleanup`, `autoResolveConflicts`
34
34
  - `multiSelect: false`, `header: "CI check"` — `autoInstallCiWorkflow`. Options: `Always — add it to every repo Muggle works in` (`always`), `Ask in each repo` (`ask` — default), `Never` (`never`).
35
+ - `multiSelect: false`, `header: "Muggle Watch"` — `autoInstallWatchService`. Options: `Always — install it now and refresh it on every upgrade` (`always`), `Ask me later` (`ask` — default), `Never` (`never`).
35
36
  - `multiSelect: false`, `header: "E2E acceptance"` — `autoE2ETest`. Options: `Always run Stage 6 at the end` (`always` — default), `Ask each cycle` (`ask`). No `never` option.
36
37
  - `multiSelect: false`, `header: "Default mode"` — `defaultExecutionMode`. Options: `Local — run on my computer` (`local`), `Remote — run in the Muggle Test cloud` (`remote`), `Ask each time` (don't change).
37
38
  - `multiSelect: false`, `header: "PR watcher"` — `watcherLifetime`. Options: `Retire after 1 day` (`1d`), `Retire after 7 days` (`7d` — default), `Never retire` (`never`).
@@ -0,0 +1,13 @@
1
+ # `autoInstallWatchService`
2
+
3
+ Controls whether Muggle runs Muggle Watch, a per-user scheduled task that every two minutes resumes the owner session of a dead PR watcher, moves idle sessions onto the newest install, and alerts on red CI and stale branches. Acted on without a prompt by every global install or upgrade (postinstall) and by `muggle init`; the picker fires only from `/muggle-upgrade`. Where the task already exists only `never` counts: any other value lets an upgrade refresh it in place. Windows only for now; elsewhere `always` prints the crontab line to add instead.
4
+
5
+ **Picker 1** — header `Muggle Watch`, question `"Run Muggle Watch in the background? It brings back dead PR watchers and moves idle sessions onto the newest install."`
6
+ - `Install it` — `Run muggle watch install now, and refresh it on every upgrade.` → `always`
7
+ - `Ask me next time` — `Leave it off and ask after the next upgrade.` → `ask`
8
+ - `Never` — `Don't install it; muggle watch install adds it later.` → `never`
9
+
10
+ **Silent action**
11
+ - `always` → `Muggle Watch is installed and refreshed with this upgrade`
12
+ - `ask` → `Asking whether to run Muggle Watch`
13
+ - `never` → `Leaving Muggle Watch off`
@@ -48,13 +48,15 @@ Two lanes ship on npm, each with its own dist-tag:
48
48
  - Note: `muggle upgrade` only manages the Electron runner — it does NOT upgrade the CLI npm package. That is why step 3 must run first.
49
49
  - The runner tracks published Studio releases only. When it reports "already on the latest version", that is the newest *released* runner — code merged to the Studio repo since that release is not in it, and no upgrade command can reach it until a new runner is published. Say so rather than implying the merge shipped.
50
50
 
51
- 5. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
51
+ 5. **Muggle Watch** — gate: [`autoInstallWatchService`](../muggle-preferences/preference-gates/autoInstallWatchService.md). Step 3's postinstall already acted on `always` and `never`, so print their silent footer. On `ask`, run Picker 1; on `Install it`, run `muggle watch install` and report its last line.
52
+
53
+ 6. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. With Muggle Watch installed, idle background sessions are restarted onto the new build within a few minutes; this session and other terminal sessions still need a reload by hand. Tell the user:
52
54
 
53
55
  > Run **`/reload-plugins`** to load the updated skills, agents, and hooks.
54
56
 
55
57
  Wait for the user to confirm they've reloaded before proceeding.
56
58
 
57
- 6. Run `/muggle:muggle-status` again to confirm everything is healthy after upgrade.
59
+ 7. Run `/muggle:muggle-status` again to confirm everything is healthy after upgrade.
58
60
 
59
61
  ## Output
60
62
 
@@ -63,3 +65,9 @@ Show a before/after table for **CLI**, **Electron runner**, **MCP server**, and
63
65
  If any component upgraded, always end with the `/reload-plugins` reminder — even if the user doesn't need new features right away, stale cached skills can cause confusing behavior.
64
66
 
65
67
  If the upgrade fails at any step, report the error and suggest running `/muggle:muggle-repair`.
68
+
69
+ ## Preferences
70
+
71
+ | Preference | Gate |
72
+ | :--------- | :--- |
73
+ | `autoInstallWatchService` | Step 5 — run Muggle Watch as a scheduled task; postinstall acts on `always`/`never`, `ask` asks here, default `ask` |
@@ -2,25 +2,35 @@
2
2
 
3
3
  A standing per-user scheduled task that runs `muggle watch tick` every few minutes, outside any agent session. Each tick:
4
4
 
5
- - **Tracks** active Claude Code sessions (`claude agents --json`) and Codex sessions (recent `~/.codex/sessions` rollouts). It also tracks their processes: claude, codex, muggle MCP servers, and PR watch loops.
5
+ - **Tracks** active Claude Code sessions (`claude agents --json`) and Codex sessions (recent `~/.codex/sessions` rollouts). It also tracks their processes: claude, codex, muggle MCP servers, and PR watch loops. Each live Claude session is stamped with when it last loaded its plugins (its process start, or its newest muggle MCP server start after a `/reload-plugins`) and the muggle works build installed then, read off `~/.muggle-ai/postinstall.log`.
6
6
  - **Checks every open PR-watch slot** under `~/.muggle-ai/muggle-do/sessions/`. Is its loop running, and heard by a live session? Is CI red? Is the branch behind or conflicting? Are review threads unresolved?
7
7
  - **Keeps registered watchers running.** A slot carrying `watch-registration.json` (written by `pr-watch-arm.sh` on every arm) has its owner session resumed in the background when its loop is gone and the owner is down. The resumed session's `/muggle:muggle-pr-followup reconcile` re-arms it with that session's own context. The service never addresses a review, pushes, or kills a process.
8
- - **Fans plugin reloads out.** When the user-scope plugins in `~/.claude/plugins/installed_plugins.json` change, idle background sessions are respawned (`claude respawn`), up to 3 per tick. Busy ones wait for a later tick, and terminal sessions get one notification to run `/reload-plugins`. No interface runs a slash command inside another session.
9
- - **Records and alerts.** Results go to `status.json` (last snapshot), `state.json` (active findings, recovery attempts, plugin fingerprint) and `events.jsonl` (raise/clear/resume/respawn history) under `~/.muggle-ai/watch/`. New alerts raise one desktop notification per tick.
8
+ - **Closes out finished slots.** A slot whose PR GitHub reports merged or closed, with no loop and no running owner, is finalized the way a watcher's terminal tick would: `prs.json` takes the state, `followup.log` the terminal line, and `result.md` is written. Only local files change; post-merge cleanup is left to a session and recorded as not run.
9
+ - **Keeps sessions on the installed build.** A session loaded before the newest global install (or a later user-scope plugin update) is behind. Idle background sessions are restarted onto the new build, up to 3 per tick: a session that owns open PR watches is stopped and resumed on `/muggle:muggle-pr-followup reconcile`, so its watchers come back with it; any other is respawned. Before either, a throwaway background launch in the session's workspace confirms Claude will bring it back; a workspace that refuses is left running and named once. Busy or waiting sessions wait for a later tick, and terminal sessions get one notification to run `/reload-plugins`. No interface runs a slash command inside another session.
10
+ - **Records and alerts.** Results go to `status.json` (last snapshot, with open-PR coverage per repo), `state.json` (active findings, recovery attempts, reload progress) and `events.jsonl` (raise/clear/resume/respawn/close-out history) under `~/.muggle-ai/watch/`. New alerts raise one desktop notification per tick.
10
11
 
11
12
  ## Install (Windows)
12
13
 
13
14
  Requires the global package (`npm install -g @muggleai/works`), plus `claude` and `gh` on PATH.
14
15
 
16
+ ```sh
17
+ muggle watch install
18
+ ```
19
+
20
+ The `autoInstallWatchService` preference (asked by `muggle init` and `/muggle-upgrade`) makes this automatic: on `always` every global install or upgrade registers the task, and an already-registered task is refreshed on any value but `never`.
21
+
22
+ The installer itself takes flags:
23
+
15
24
  ```powershell
16
- & "$(npm root -g)\@muggleai\works\scripts\muggle-watch\install-muggle-watch.ps1"
25
+ & "$(npm root -g)\@muggleai\works\scripts\muggle-watch\install-muggle-watch.ps1" -IntervalMinutes 5
17
26
  ```
18
27
 
19
28
  | Flag | Effect |
20
29
  | :--- | :----- |
21
30
  | `-IntervalMinutes <n>` | Tick interval, default 2 |
22
31
  | `-NoRecovery` | Report dead watchers without resuming their owners |
23
- | `-NoAutoReload` | Never start a reload fan-out on a plugin change |
32
+ | `-NoAutoReload` | Never restart sessions onto a new build |
33
+ | `-NoWait` | Return once the task is registered, before its first tick |
24
34
  | `-MuggleEntry <path>` | Run a specific `bin\muggle.js` instead of the global install |
25
35
  | `-Uninstall` | Remove the task; the ledger is kept |
26
36
 
@@ -37,9 +47,10 @@ There is no installer yet. Add a crontab line:
37
47
  ## Commands
38
48
 
39
49
  ```sh
40
- muggle watch status # last snapshot: sessions, processes, PR watches, findings
50
+ muggle watch status # last snapshot: sessions and their builds, processes, PR watches, coverage, findings
41
51
  muggle watch tick # one pass now
42
- muggle watch reload-plugins # reload plugins across sessions now (--dry-run to preview)
52
+ muggle watch reload-plugins # restart every idle session onto the plugins on disk now (--dry-run to preview)
53
+ muggle watch install # register or refresh the scheduled task (--uninstall, --no-wait)
43
54
  muggle watch register --slot <dir> # opt a slot into recovery
44
55
  muggle watch unregister --slot <dir> # keep a slot session-scoped
45
56
  ```
@@ -8,6 +8,10 @@
8
8
  # `muggle upgrade`, so the service always runs the current release. Only the
9
9
  # launcher shim is copied, to ~\.muggle-ai\watch\bin, so the task never points
10
10
  # into a checkout or worktree that may be deleted.
11
+ #
12
+ # Keep this file ASCII. Windows PowerShell 5.1 reads a script without a BOM in the
13
+ # ANSI code page, where the bytes of a UTF-8 dash decode to a curly quote that
14
+ # ends the string around it, and the whole script fails to parse.
11
15
  [CmdletBinding()]
12
16
  param(
13
17
  [ValidateRange(1, 60)]
@@ -16,6 +20,8 @@ param(
16
20
  [string]$MuggleEntry,
17
21
  [switch]$NoAutoReload,
18
22
  [switch]$NoRecovery,
23
+ # Return once the task is registered; its trigger runs the first tick a minute later.
24
+ [switch]$NoWait,
19
25
  [switch]$Uninstall
20
26
  )
21
27
 
@@ -42,7 +48,7 @@ $nodeCommand = Get-Command node -ErrorAction SilentlyContinue
42
48
  if (-not $nodeCommand) { throw "node is not on PATH; the task needs it to run muggle." }
43
49
  foreach ($requiredTool in @("claude", "gh")) {
44
50
  if (-not (Get-Command $requiredTool -ErrorAction SilentlyContinue)) {
45
- Write-Warning "$requiredTool is not on PATH — the watch will report without the data it provides."
51
+ Write-Warning "$requiredTool is not on PATH; the watch will report without the data it provides."
46
52
  }
47
53
  }
48
54
 
@@ -57,7 +63,7 @@ if ($NoAutoReload) { $tickFlags += "--no-auto-reload" }
57
63
  if ($NoRecovery) { $tickFlags += "--no-recovery" }
58
64
  $launcherArguments = @("`"$installedLauncher`"", "`"$($nodeCommand.Source)`"", "`"$MuggleEntry`"") + $tickFlags
59
65
 
60
- # wscript.exe rather than node.exe is what keeps every run off the desktop — see
66
+ # wscript.exe rather than node.exe is what keeps every run off the desktop; see
61
67
  # the header of muggle-watch-hidden.vbs.
62
68
  $taskAction = New-ScheduledTaskAction -Execute (Join-Path $env:SystemRoot "System32\wscript.exe") `
63
69
  -Argument ($launcherArguments -join " ")
@@ -75,6 +81,11 @@ Register-ScheduledTask -TaskName $TaskName -Action $taskAction -Trigger $taskTri
75
81
  -Settings $taskSettings -Force `
76
82
  -Description "Muggle watch service: tracks agent sessions, processes and PR watchers (@muggleai/works)" | Out-Null
77
83
 
84
+ if ($NoWait) {
85
+ "task $TaskName registered every $IntervalMinutes min; first tick within a minute"
86
+ return
87
+ }
88
+
78
89
  $statusFile = Join-Path $watchDir "status.json"
79
90
  $previousSnapshotTime = if (Test-Path $statusFile) { (Get-Item $statusFile).LastWriteTime } else { [DateTime]::MinValue }
80
91
  Start-ScheduledTask -TaskName $TaskName
@@ -86,7 +97,7 @@ while ((Get-Date) -lt $deadline) {
86
97
  $taskInfo = Get-ScheduledTaskInfo -TaskName $TaskName
87
98
  "task $TaskName registered every $IntervalMinutes min; state=$((Get-ScheduledTask -TaskName $TaskName).State) lastResult=$($taskInfo.LastTaskResult)"
88
99
  if ((Test-Path $statusFile) -and (Get-Item $statusFile).LastWriteTime -gt $previousSnapshotTime) {
89
- "first tick written: $statusFile — run 'muggle watch status' to read it"
100
+ "first tick written: $statusFile; run 'muggle watch status' to read it"
90
101
  } else {
91
102
  Write-Warning "no tick finished within 120s; check $(Join-Path $watchDir 'tick.log')"
92
103
  }
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { createHash } from "crypto";
10
- import { exec } from "child_process";
10
+ import { exec, spawnSync } from "child_process";
11
11
  import {
12
12
  cpSync,
13
13
  readFileSync,
@@ -38,6 +38,8 @@ const require = createRequire(import.meta.url);
38
38
  const INSTALL_METADATA_FILE_NAME = ".install-metadata.json";
39
39
  const INSTALL_MANIFEST_FILE_NAME = "install-manifest.json";
40
40
  const LOG_FILE_NAME = "postinstall.log";
41
+ /** Registering the task takes seconds; this only bounds a hung PowerShell. */
42
+ const WATCH_INSTALL_TIMEOUT_MS = 60_000;
41
43
  const FETCH_TIMEOUT_MS = 90_000;
42
44
  const STREAM_TIMEOUT_MS = 5 * 60_000;
43
45
  const VERSION_OVERRIDE_FILE_NAME = "electron-app-version-override.json";
@@ -952,6 +954,27 @@ function syncClaudeMarketplace() {
952
954
  log(`Claude plugin sync ${marketplaceSync.changed ? "updated" : "skipped"}: ${marketplaceSync.reason}.`);
953
955
  }
954
956
 
957
+ /**
958
+ * Register or refresh the Muggle Watch scheduled task per `autoInstallWatchService`,
959
+ * by running this package's own `muggle watch install --from-preference`, which
960
+ * owns the decision. Global installs only, for the reason `syncClaudeMarketplace`
961
+ * gives: the task runs the global install, so only that one should touch it.
962
+ */
963
+ function applyWatchServicePreference() {
964
+ if (process.env.npm_config_global !== "true") {
965
+ log("Muggle Watch skipped: not a global install.");
966
+ return;
967
+ }
968
+
969
+ const installed = spawnSync(
970
+ process.execPath,
971
+ [join(getPackageRootDir(), "bin", "muggle.js"), "watch", "install", "--from-preference", "--no-wait"],
972
+ { encoding: "utf-8", timeout: WATCH_INSTALL_TIMEOUT_MS, windowsHide: true },
973
+ );
974
+ const output = `${installed.stdout ?? ""}${installed.stderr ?? ""}`.trim();
975
+ log(`Muggle Watch: ${output || installed.error?.message || `exited ${installed.status}`}`);
976
+ }
977
+
955
978
  /**
956
979
  * Run the onboarding backfill and log only when it actually stamps.
957
980
  */
@@ -970,6 +993,7 @@ logOnboardingBackfill();
970
993
  removeVersionOverrideFile();
971
994
  syncCursorSkills();
972
995
  syncClaudeMarketplace();
996
+ applyWatchServicePreference();
973
997
  upsertCursorMcpConfig();
974
998
  downloadElectronApp()
975
999
  .catch(logError)