@muggleai/works 5.27.0-staging.226 → 5.27.0-staging.228

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.
@@ -9,7 +9,7 @@
9
9
  "name": "muggleai",
10
10
  "source": "./plugin",
11
11
  "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.",
12
- "version": "5.27.0-staging.226"
12
+ "version": "5.27.0-staging.228"
13
13
  }
14
14
  ]
15
15
  }
@@ -78,6 +78,7 @@ __export(src_exports, {
78
78
  SCREENSHOT_FILE_EXTENSION: () => SCREENSHOT_FILE_EXTENSION,
79
79
  StackCheckVerdict: () => StackCheckVerdict,
80
80
  StackClaimVerdict: () => StackClaimVerdict,
81
+ StackMismatchKind: () => StackMismatchKind,
81
82
  StackPortAction: () => StackPortAction,
82
83
  WATCHER_LIFETIME_SECONDS: () => WATCHER_LIFETIME_SECONDS,
83
84
  WATCHER_LIFETIME_UNBOUNDED_SECONDS: () => WATCHER_LIFETIME_UNBOUNDED_SECONDS,
@@ -103,6 +104,7 @@ __export(src_exports, {
103
104
  deleteApiKeyData: () => deleteApiKeyData,
104
105
  deleteCredentials: () => deleteCredentials,
105
106
  describeLlmSourceStatus: () => describeLlmSourceStatus,
107
+ describeStackMismatch: () => describeStackMismatch,
106
108
  e2e: () => e2e_exports2,
107
109
  evaluateCheckoutFreshness: () => evaluateCheckoutFreshness,
108
110
  formatPreferencesOneLiner: () => formatPreferencesOneLiner,
@@ -763,9 +765,9 @@ function resetLogger() {
763
765
  // packages/mcps/src/shared/checksum.ts
764
766
  var logger = getLogger();
765
767
  function getPlatformKey() {
766
- const os7 = platform();
768
+ const os8 = platform();
767
769
  const arch2 = process.arch;
768
- switch (os7) {
770
+ switch (os8) {
769
771
  case "darwin":
770
772
  return arch2 === "arm64" ? "darwin-arm64" : "darwin-x64";
771
773
  case "win32":
@@ -773,7 +775,7 @@ function getPlatformKey() {
773
775
  case "linux":
774
776
  return "linux-x64";
775
777
  default:
776
- throw new Error(`Unsupported platform: ${os7}`);
778
+ throw new Error(`Unsupported platform: ${os8}`);
777
779
  }
778
780
  }
779
781
  async function calculateFileChecksum(filePath) {
@@ -3453,8 +3455,8 @@ async function readLocalExecutionLockState() {
3453
3455
  // packages/mcps/src/mcp/local/services/spawn-failure-message.ts
3454
3456
  function describeElectronSpawnFailure(params) {
3455
3457
  const base = `Failed to start electron-app: ${params.error.message}`;
3456
- const platform7 = params.platform ?? process.platform;
3457
- const blockedByAppControl = platform7 === "win32" && (params.error.code === "UNKNOWN" || params.error.code === "EPERM");
3458
+ const platform8 = params.platform ?? process.platform;
3459
+ const blockedByAppControl = platform8 === "win32" && (params.error.code === "UNKNOWN" || params.error.code === "EPERM");
3458
3460
  if (!blockedByAppControl) {
3459
3461
  return base;
3460
3462
  }
@@ -5160,6 +5162,12 @@ var StackCheckVerdict = /* @__PURE__ */ ((StackCheckVerdict2) => {
5160
5162
  StackCheckVerdict2["PeerLease"] = "PEER_LEASE";
5161
5163
  return StackCheckVerdict2;
5162
5164
  })(StackCheckVerdict || {});
5165
+ var StackMismatchKind = /* @__PURE__ */ ((StackMismatchKind2) => {
5166
+ StackMismatchKind2["OtherCode"] = "OTHER_CODE";
5167
+ StackMismatchKind2["UntrackedListener"] = "UNTRACKED_LISTENER";
5168
+ StackMismatchKind2["NothingListening"] = "NOTHING_LISTENING";
5169
+ return StackMismatchKind2;
5170
+ })(StackMismatchKind || {});
5163
5171
 
5164
5172
  // packages/mcps/src/shared/service-stack/service-stack-constants.ts
5165
5173
  var STACK_LEDGER_DIR_NAME = "service-stack";
@@ -5172,6 +5180,7 @@ var SUGGESTED_RETRY_AFTER_MS = 3e4;
5172
5180
  var OWED_RETRY_AFTER_MS = 5e3;
5173
5181
  var CLAIM_POLL_INTERVAL_MS = 1e3;
5174
5182
  var BUSY_EXIT_CODE = 75;
5183
+ var LISTENER_COMMAND_MAX_CHARS = 120;
5175
5184
  var DEFAULT_PORT_BY_PROTOCOL = { "http:": 80, "https:": 443 };
5176
5185
 
5177
5186
  // packages/mcps/src/shared/service-stack/generation-store-constants.ts
@@ -5282,6 +5291,103 @@ async function sleep2(ms) {
5282
5291
  await new Promise((resolve7) => setTimeout(resolve7, ms));
5283
5292
  }
5284
5293
 
5294
+ // packages/mcps/src/shared/service-stack/port-listener-constants.ts
5295
+ var UNREADABLE_PORT = { isReadable: false, listener: null };
5296
+ var NOTHING_LISTENING = { isReadable: true, listener: null };
5297
+ var PORT_LISTENER_COMMAND_TIMEOUT_MS = 15e3;
5298
+ var PORT_LISTENER_MAX_ANCESTORS = 32;
5299
+
5300
+ // packages/mcps/src/shared/service-stack/port-listener.ts
5301
+ async function readPortListener(port) {
5302
+ return os4.platform() === "win32" ? await readWindowsPortListener(port) : await readPosixPortListener(port);
5303
+ }
5304
+ async function readWindowsPortListener(port) {
5305
+ const netstatOutcome = await runListenerTool("netstat", ["-ano"]);
5306
+ if (netstatOutcome === null || netstatOutcome.exitCode !== 0) return UNREADABLE_PORT;
5307
+ const listenerPid = findWindowsListenerPid({ netstatOutput: netstatOutcome.stdout, port });
5308
+ if (listenerPid === null) return NOTHING_LISTENING;
5309
+ const encodedScript = Buffer.from(buildWindowsAncestryScript(listenerPid), "utf16le").toString("base64");
5310
+ const outcome = await runListenerTool("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", encodedScript]);
5311
+ if (outcome === null || outcome.exitCode !== 0) {
5312
+ return { isReadable: true, listener: { pid: listenerPid, commandLine: "", ancestorPids: [] } };
5313
+ }
5314
+ try {
5315
+ const parsed = JSON.parse(outcome.stdout);
5316
+ const ancestorPids = Array.isArray(parsed.ancestorPids) ? parsed.ancestorPids : [parsed.ancestorPids];
5317
+ return {
5318
+ isReadable: true,
5319
+ listener: {
5320
+ pid: listenerPid,
5321
+ commandLine: typeof parsed.commandLine === "string" ? parsed.commandLine : "",
5322
+ ancestorPids: ancestorPids.filter((ancestorPid) => typeof ancestorPid === "number")
5323
+ }
5324
+ };
5325
+ } catch {
5326
+ return { isReadable: true, listener: { pid: listenerPid, commandLine: "", ancestorPids: [] } };
5327
+ }
5328
+ }
5329
+ function findWindowsListenerPid(params) {
5330
+ for (const line of params.netstatOutput.split(/\r?\n/)) {
5331
+ const columns = line.trim().split(/\s+/);
5332
+ if (columns.length < 5 || columns[0] !== "TCP" || columns[3] !== "LISTENING") continue;
5333
+ if (columns[1].endsWith(`:${params.port}`)) return Number(columns[4]);
5334
+ }
5335
+ return null;
5336
+ }
5337
+ function buildWindowsAncestryScript(listenerPid) {
5338
+ return [
5339
+ "$ErrorActionPreference = 'Stop'",
5340
+ "[Console]::OutputEncoding = [Text.Encoding]::UTF8",
5341
+ "$parentByPid = @{}",
5342
+ "Get-CimInstance -Query 'SELECT ProcessId, ParentProcessId FROM Win32_Process' | ForEach-Object { $parentByPid[[int]$_.ProcessId] = [int]$_.ParentProcessId }",
5343
+ `$commandLine = [string](Get-CimInstance -Query 'SELECT CommandLine FROM Win32_Process WHERE ProcessId = ${listenerPid}').CommandLine`,
5344
+ "$ancestors = @()",
5345
+ `$current = ${listenerPid}`,
5346
+ `for ($level = 0; $level -lt ${PORT_LISTENER_MAX_ANCESTORS} -and $parentByPid.ContainsKey($current); $level++) {`,
5347
+ " $current = $parentByPid[$current]",
5348
+ " if ($current -le 0) { break }",
5349
+ " $ancestors += $current",
5350
+ "}",
5351
+ "ConvertTo-Json -Compress -InputObject @{ commandLine = $commandLine; ancestorPids = @($ancestors) }"
5352
+ ].join("\n");
5353
+ }
5354
+ async function readPosixPortListener(port) {
5355
+ const lsofOutcome = await runListenerTool("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"]);
5356
+ if (lsofOutcome === null) return UNREADABLE_PORT;
5357
+ const listenerPidLine = lsofOutcome.stdout.split("\n").find((line) => /^\d+$/.test(line.trim()));
5358
+ if (listenerPidLine === void 0) return lsofOutcome.exitCode <= 1 ? NOTHING_LISTENING : UNREADABLE_PORT;
5359
+ const listenerPid = Number(listenerPidLine.trim());
5360
+ const listener = { pid: listenerPid, commandLine: "", ancestorPids: [] };
5361
+ let currentPid = listenerPid;
5362
+ for (let level = 0; level <= PORT_LISTENER_MAX_ANCESTORS && currentPid > 1; level += 1) {
5363
+ const psOutcome = await runListenerTool("ps", ["-o", "ppid=,command=", "-p", String(currentPid)]);
5364
+ const columns = psOutcome?.stdout.match(/^\s*(\d+)\s+(.*)$/m);
5365
+ if (!columns) break;
5366
+ if (level === 0) listener.commandLine = columns[2].trim();
5367
+ currentPid = Number(columns[1]);
5368
+ if (currentPid > 0) listener.ancestorPids.push(currentPid);
5369
+ }
5370
+ return { isReadable: true, listener };
5371
+ }
5372
+ function runListenerTool(command, args) {
5373
+ return new Promise((resolve7) => {
5374
+ execFile(
5375
+ command,
5376
+ args,
5377
+ { timeout: PORT_LISTENER_COMMAND_TIMEOUT_MS, windowsHide: true, encoding: "utf-8" },
5378
+ (error, stdout) => {
5379
+ if (error === null) {
5380
+ resolve7({ exitCode: 0, stdout });
5381
+ } else if (typeof error.code === "number" && !error.killed) {
5382
+ resolve7({ exitCode: error.code, stdout });
5383
+ } else {
5384
+ resolve7(null);
5385
+ }
5386
+ }
5387
+ );
5388
+ });
5389
+ }
5390
+
5285
5391
  // packages/mcps/src/shared/service-stack/service-stack-decisions.ts
5286
5392
  var EMPTY_STACK_RECORD = { leases: [], queue: [], portFreedAt: {} };
5287
5393
  function needsConflict(left, right) {
@@ -5479,13 +5585,16 @@ async function checkServiceStack(params) {
5479
5585
  return { ...base, verdict: "NO_LEASE" /* NoLease */, reason: "this checkout holds no stack lease" };
5480
5586
  }
5481
5587
  const services = await readTrackedServices();
5482
- const mismatches = ownLease.needs.map((need) => ({ need, actual: trackedServiceOnPort({ services, port: need.port }) })).filter((pair) => pair.actual !== null && !servesNeed({ service: pair.actual, need: pair.need }));
5588
+ const readListener = params.readListener ?? readPortListener;
5589
+ const mismatches = (await Promise.all(
5590
+ ownLease.needs.map((need) => findPortMismatch({ need, services, readListener }))
5591
+ )).filter((mismatch) => mismatch !== null);
5483
5592
  if (mismatches.length > 0) {
5484
5593
  const ports = mismatches.map((mismatch) => mismatch.need.port).join(", ");
5485
5594
  return {
5486
5595
  ...base,
5487
5596
  verdict: "STALE" /* Stale */,
5488
- reason: `port ${ports} no longer serves the code this checkout claimed`,
5597
+ reason: `port ${ports} does not serve the code this checkout claimed`,
5489
5598
  mismatches
5490
5599
  };
5491
5600
  }
@@ -5574,6 +5683,20 @@ function planPort(params) {
5574
5683
  const action = current === null ? "start" /* Start */ : servesNeed({ service: current, need: params.need }) ? "keep" /* Keep */ : "restart" /* Restart */;
5575
5684
  return { ...params.need, action, current };
5576
5685
  }
5686
+ async function findPortMismatch(params) {
5687
+ const tracked = trackedServiceOnPort({ services: params.services, port: params.need.port });
5688
+ if (tracked !== null && !servesNeed({ service: tracked, need: params.need })) {
5689
+ return { need: params.need, kind: "OTHER_CODE" /* OtherCode */, actual: tracked, listener: null };
5690
+ }
5691
+ const reading = await params.readListener(params.need.port);
5692
+ if (!reading.isReadable) return null;
5693
+ if (reading.listener === null) {
5694
+ return { need: params.need, kind: "NOTHING_LISTENING" /* NothingListening */, actual: tracked, listener: null };
5695
+ }
5696
+ const isTrackedListener = tracked !== null && (reading.listener.pid === tracked.pid || reading.listener.ancestorPids.includes(tracked.pid));
5697
+ if (isTrackedListener) return null;
5698
+ return { need: params.need, kind: "UNTRACKED_LISTENER" /* UntrackedListener */, actual: tracked, listener: reading.listener };
5699
+ }
5577
5700
  function servesNeed(params) {
5578
5701
  return params.service.dir === params.need.runDir && params.service.headSha === params.need.headSha;
5579
5702
  }
@@ -5631,6 +5754,29 @@ function shortSha2(sha) {
5631
5754
  async function sleep3(ms) {
5632
5755
  await new Promise((resolve7) => setTimeout(resolve7, ms));
5633
5756
  }
5757
+
5758
+ // packages/mcps/src/shared/service-stack/stack-mismatch-description.ts
5759
+ function describeStackMismatch(mismatch) {
5760
+ const claimed = `port ${mismatch.need.port}: claimed ${mismatch.need.runDir} @ ${mismatch.need.headSha.slice(0, 7)}`;
5761
+ return `${claimed}, now ${describeCurrentHolder(mismatch)}`;
5762
+ }
5763
+ function describeCurrentHolder(mismatch) {
5764
+ switch (mismatch.kind) {
5765
+ case "OTHER_CODE" /* OtherCode */: {
5766
+ const tracked = mismatch.actual;
5767
+ return tracked === null ? "serving other code" : `serving ${tracked.dir} @ ${(tracked.headSha ?? "unknown").slice(0, 7)} (PID ${tracked.pid})`;
5768
+ }
5769
+ case "NOTHING_LISTENING" /* NothingListening */:
5770
+ return mismatch.actual === null ? "nothing listening" : `nothing listening, though tracked PID ${mismatch.actual.pid} is alive`;
5771
+ case "UNTRACKED_LISTENER" /* UntrackedListener */: {
5772
+ const listener = mismatch.listener;
5773
+ if (listener === null) return "held by an untracked process";
5774
+ const command = listener.commandLine.trim();
5775
+ const shortCommand = command.length > LISTENER_COMMAND_MAX_CHARS ? `${command.slice(0, LISTENER_COMMAND_MAX_CHARS)}\u2026` : command;
5776
+ return `held by untracked PID ${listener.pid}${shortCommand ? ` (${shortCommand})` : ""}`;
5777
+ }
5778
+ }
5779
+ }
5634
5780
  var ZOD_PATTERN_BY_STRING_FORMAT = /* @__PURE__ */ new Map([
5635
5781
  ["uuid", z.toJSONSchema(z.uuid()).pattern],
5636
5782
  ["email", z.toJSONSchema(z.email()).pattern]
@@ -9275,7 +9421,8 @@ async function findRunStackRefusal(params) {
9275
9421
  port,
9276
9422
  shouldRenew: true,
9277
9423
  holderPid: process.pid,
9278
- runGit: params.runGit
9424
+ runGit: params.runGit,
9425
+ readListener: params.readListener
9279
9426
  });
9280
9427
  return REFUSING_VERDICTS.has(report.verdict) ? report : null;
9281
9428
  }
@@ -9285,7 +9432,8 @@ async function findStackChangedDuringRun(params) {
9285
9432
  cwd: params.cwd,
9286
9433
  shouldRenew: true,
9287
9434
  holderPid: process.pid,
9288
- runGit: params.runGit
9435
+ runGit: params.runGit,
9436
+ readListener: params.readListener
9289
9437
  });
9290
9438
  return report.verdict === "STALE" /* Stale */ ? report : null;
9291
9439
  }
@@ -9351,11 +9499,7 @@ function formatRunCheckoutRefusal(report, cwd) {
9351
9499
 
9352
9500
  // packages/mcps/src/mcp/tools/local/run-stack-refusal.ts
9353
9501
  function formatRunStackRefusal(report, cwd) {
9354
- const mismatchLines = report.mismatches.map((mismatch) => {
9355
- const actual = mismatch.actual;
9356
- const serving = actual ? `${actual.dir} @ ${(actual.headSha ?? "unknown").slice(0, 7)} (PID ${actual.pid})` : "nothing tracked";
9357
- return `- port ${mismatch.need.port}: claimed ${mismatch.need.runDir} @ ${mismatch.need.headSha.slice(0, 7)}, now ${serving}`;
9358
- });
9502
+ const mismatchLines = report.mismatches.map((mismatch) => `- ${describeStackMismatch(mismatch)}`);
9359
9503
  const remedy = report.verdict === "PEER_LEASE" /* PeerLease */ ? `Claim the stack for this checkout \u2014 \`muggle stack claim --cwd "${cwd}" --need <port>=<run-dir>\` \u2014 then wait your turn or re-run prepare once it is granted.` : `Re-run muggle-test-prepare from this checkout: it re-claims the stack and restarts what moved.`;
9360
9504
  return [
9361
9505
  report.verdict === "PEER_LEASE" /* PeerLease */ ? "## Run refused \u2014 the target port is leased to another checkout" : "## Run refused \u2014 the service stack changed since this checkout claimed it",
@@ -9373,7 +9517,7 @@ function formatStackChangedDuringRun(report) {
9373
9517
  const ports = report.mismatches.map((mismatch) => mismatch.need.port).join(", ");
9374
9518
  return [
9375
9519
  "",
9376
- `**Warning:** the service stack changed during this run (port ${ports} now serves other code). This result may describe code that is not this checkout's \u2014 re-run prepare and run it again before trusting it.`
9520
+ `**Warning:** the service stack changed during this run (port ${ports} no longer serves the claimed code). This result may describe code that is not this checkout's \u2014 re-run prepare and run it again before trusting it.`
9377
9521
  ].join("\n");
9378
9522
  }
9379
9523
 
@@ -10639,4 +10783,4 @@ function applyLlmSourceSelection(selection, dataDirOverride2) {
10639
10783
  return resolveLlmSourceStatus(dataDirOverride2);
10640
10784
  }
10641
10785
 
10642
- export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CheckoutFreshnessVerdict, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, EventName, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, 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, ServiceName, StackCheckVerdict, StackClaimVerdict, StackPortAction, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackRelease, decideStackRenewal, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, e2e_exports2 as e2e_exports, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDataDir2, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, maskLlmApiKey, mcp_exports, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, readPreferencesMetadata, readRunView, readServiceStackStatus, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toDisplayRef, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml };
10786
+ export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CheckoutFreshnessVerdict, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, EventName, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, 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, ServiceName, StackCheckVerdict, StackClaimVerdict, StackMismatchKind, StackPortAction, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackRelease, decideStackRenewal, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports2 as e2e_exports, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDataDir2, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, maskLlmApiKey, mcp_exports, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, readPreferencesMetadata, readRunView, readServiceStackStatus, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toDisplayRef, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml };
@@ -1,4 +1,4 @@
1
- import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, applyLlmSourceSelection, LlmSource, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-ORX3TIFC.js';
1
+ import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, applyLlmSourceSelection, LlmSource, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-A3YLVNL7.js';
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { v4 } from 'uuid';
@@ -1054,7 +1054,7 @@ async function resolveGsScreenshotUrls(report, opts) {
1054
1054
  if (gsUrls.length === 0) {
1055
1055
  return report;
1056
1056
  }
1057
- const mcps = await import('./src-V72RTJZL.js');
1057
+ const mcps = await import('./src-H4OOQVIK.js');
1058
1058
  const credentials = await mcps.getCallerCredentialsAsync();
1059
1059
  if (!credentials.bearerToken && !credentials.apiKey) {
1060
1060
  stderrWrite(
@@ -3890,12 +3890,7 @@ function renderStackClaimSummary(report) {
3890
3890
  return lines.join("\n");
3891
3891
  }
3892
3892
  function renderStackCheckSummary(report) {
3893
- const lines = [`${report.verdict}: ${report.reason}`];
3894
- for (const mismatch of report.mismatches) {
3895
- const actual = mismatch.actual ? `${mismatch.actual.dir} @ ${shortSha(mismatch.actual.headSha)}` : "nothing tracked";
3896
- lines.push(`port ${mismatch.need.port}: claimed ${mismatch.need.runDir} @ ${shortSha(mismatch.need.headSha)}, serving ${actual}`);
3897
- }
3898
- return lines.join("\n");
3893
+ return [`${report.verdict}: ${report.reason}`, ...report.mismatches.map(describeStackMismatch)].join("\n");
3899
3894
  }
3900
3895
  function renderStackStatusSummary(report) {
3901
3896
  const now = Date.now();
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-U43SO3SZ.js';
3
- import './chunk-ORX3TIFC.js';
2
+ import { runCli } from './chunk-N7DYL5J4.js';
3
+ import './chunk-A3YLVNL7.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-U43SO3SZ.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-ORX3TIFC.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-N7DYL5J4.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-A3YLVNL7.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.27.0-staging.226",
4
+ "version": "5.27.0-staging.228",
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.27.0-staging.226",
7
+ "@muggleai/works@5.27.0-staging.228",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.27.0-staging.226",
3
+ "version": "5.27.0-staging.228",
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.27.0-staging.226",
5
+ "version": "5.27.0-staging.228",
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.27.0-staging.226",
7
+ "@muggleai/works@5.27.0-staging.228",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -41,7 +41,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
41
41
  | `PostToolUse` (Bash) | `guardrail-pr-terminal.sh` | advise | a PR just went terminal — a `gh pr merge`/`gh pr close` success line or the `TERMINAL pr=N` line the watch scripts print in a shell result (never bare `"state":"MERGED"` metadata). Not registered on `Monitor`: a Monitor call returns before its script prints anything, so its result never carries that line | — | record `terminalPending`, direct the post-merge handoff: finalize the watcher slot, tear down per `autoCleanup`, offer next options via AskUserQuestion — or as text in the closing message while the session still owns an open PR's watch slot, since a pending AskUserQuestion holds the turn and that watcher with it |
42
42
  | `PostToolUse` (AskUserQuestion) | `guardrail-offer-ran.sh` | record | a next-options offer ran while a terminal PR was pending | — | clear `terminalPending` — the only exit for the post-merge Stop gate |
43
43
  | `PostToolUse` (Agent, Task) | `guardrail-record-delegation.sh` | record | a `muggle:acceptance-tester` was launched into the background — its response carries no finished report yet | — | append to `e2eDelegations` with the PR URLs its brief names; for a bounded window the E2E and debug-path gates hold off, and the walkthrough gate sets those PRs aside, so the session is never steered into a second browser run alongside the agent's. Shares the AskUserQuestion group's dispatch |
44
- | `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone: the state store drops a write that cannot take the session's lock in time, so a second writer for one emit could lose either record | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
44
+ | `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone, so the skill, its stages and the run land in one commit; a write that cannot take the session's lock in time is saved beside the state file and committed by a detached job once the lock frees | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
45
45
  | `PostToolUse` (Read) | `guardrail-record-stage-read.sh` | record | a markdown file under a `skills/` directory was opened | — | append to `stagesRead` — how the stage gate tells a stage that was read from one that was skipped |
46
46
  | `PostToolUse` (Bash + muggle telemetry-event-emit / user-feedback-create) | `guardrail-record-stage-signals.sh` | record | a Step 6f `pre-execution-classification` emit, debug-path evidence for a failed run (a `*-failure-classified\|resolved` emit or feedback naming it), or a `MUGGLE_STAGE_SKIP` / `MUGGLE_CLASSIFY_SKIP` / `MUGGLE_DEBUG_SKIP` marker | — | set `classifiedTestCaseIds` / `debuggedRuns` / the matching skip flag |
47
47
  | `PostToolUse` (Bash) | `guardrail-record-comment-replies.sh` | record | an unresolved-thread fetch named review threads still awaiting an answer (classified by the `<!-- muggle-do:bot -->` marker, never the author login), a threaded reply the provider **confirmed** answered comments in one, or a `MUGGLE_REPLY_SKIP` marker deferred them | — | claim each thread and cover the comments answered, in the per-PR ledger beside the muggle-do slot |