@muggleai/works 5.26.0 → 5.27.0-staging.227
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/{chunk-ORX3TIFC.js → chunk-A3YLVNL7.js} +160 -16
- package/dist/{chunk-U43SO3SZ.js → chunk-N7DYL5J4.js} +3 -8
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/hooks/README.md +4 -4
- package/dist/plugin/scripts/guardrail-pr-terminal.sh +1 -1
- package/dist/plugin/scripts/guardrail-terminal-gate.sh +1 -1
- package/dist/plugin/scripts/guardrails.mjs +1096 -975
- package/dist/plugin/skills/do/next-step.md +3 -1
- package/dist/release-manifest.json +3 -3
- package/dist/src-H4OOQVIK.js +1 -0
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/hooks/README.md +4 -4
- package/plugin/scripts/guardrail-pr-terminal.sh +1 -1
- package/plugin/scripts/guardrail-terminal-gate.sh +1 -1
- package/plugin/scripts/guardrails.mjs +1096 -975
- package/plugin/skills/do/next-step.md +3 -1
- package/dist/src-V72RTJZL.js +0 -1
|
@@ -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.
|
|
12
|
+
"version": "5.27.0-staging.227"
|
|
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
|
|
768
|
+
const os8 = platform();
|
|
767
769
|
const arch2 = process.arch;
|
|
768
|
-
switch (
|
|
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: ${
|
|
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
|
|
3457
|
-
const blockedByAppControl =
|
|
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
|
|
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}
|
|
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}
|
|
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-
|
|
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-
|
|
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
|
-
|
|
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
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-
|
|
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-
|
|
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.
|
|
4
|
+
"version": "5.27.0-staging.227",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.27.0-staging.227",
|
|
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.
|
|
5
|
+
"version": "5.27.0-staging.227",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -20,7 +20,7 @@ A guardrail emits one of two strengths:
|
|
|
20
20
|
- **Advise** — `additionalContext` (PostToolUse/UserPromptSubmit) or a plain Stop message. A soft nudge the model can ignore.
|
|
21
21
|
- **Enforce** — a `Stop` `decision: "block"` that refuses to end the turn, or a `PreToolUse` `permissionDecision: "deny"` that refuses a tool call. The model cannot proceed until the condition is met.
|
|
22
22
|
|
|
23
|
-
Enforcement is reserved for the handoffs that were being skipped: the E2E acceptance run, posting a deterministically-rendered report, and the post-merge handoff. Each enforcing gate carries an escape so it can't trap a turn — the E2E gate accepts an explicit skip declaration (`echo "MUGGLE_E2E_SKIP: <reason>"`, session-durable) and hard-releases after `MAX_E2E_BLOCKS` (3) blocks; the report gate only denies a body it can positively see is a hand-written report and fails open otherwise; the post-merge gate hard-releases after `MAX_PR_TERMINAL_BLOCKS` (3) blocks, and only the
|
|
23
|
+
Enforcement is reserved for the handoffs that were being skipped: the E2E acceptance run, posting a deterministically-rendered report, and the post-merge handoff. Each enforcing gate carries an escape so it can't trap a turn — the E2E gate accepts an explicit skip declaration (`echo "MUGGLE_E2E_SKIP: <reason>"`, session-durable) and hard-releases after `MAX_E2E_BLOCKS` (3) blocks; the report gate only denies a body it can positively see is a hand-written report and fails open otherwise; the post-merge gate hard-releases after `MAX_PR_TERMINAL_BLOCKS` (3) blocks, and only the next-options offer clears it — an AskUserQuestion, or a closing message that asks the question while the session still watches an open PR (always on Codex) — nothing else resets its counter. The watcher follow-through gate is the one with no block budget, because a budget the session can wait out is the very hold it must not take: its escape is doing the work, or the user's own `HOLD WATCH #<pr-number>`.
|
|
24
24
|
|
|
25
25
|
## Mechanism
|
|
26
26
|
|
|
@@ -38,17 +38,17 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
|
|
|
38
38
|
| :--------- | :------ | :------- | :-------- | :--------- | :----- |
|
|
39
39
|
| `PostToolUse` (Bash) | `guardrail-pr-opened.sh` | advise | a `gh pr create`/`gh pr ready` just succeeded | `autoWatchPR` | start a `muggle-pr-followup` watcher on the new PR |
|
|
40
40
|
| `PostToolUse` (Bash + muggle execute/replay MCP tools) | `guardrail-record-tests.sh` | record | a unit-test command passed, an E2E run happened (execute/replay call), or an `echo "MUGGLE_E2E_SKIP: <reason>"` marker declared E2E un-runnable, or a walkthrough carrying the `build-pr-section` sentinel was posted / declared un-postable via `echo "MUGGLE_WALKTHROUGH_SKIP: <reason>"` | — | set `unitTestsGreen` / `e2eRun` / `e2eSkipped` / `walkthroughPostedPrUrls` / `walkthroughSkipped` session state. A post settles only the PR its output names (`gh pr comment`/`create` print it; a `gh api` comment edit returns `html_url`); a post whose output names none is timestamped (`walkthroughPostedAt`), and a scan begun after it decides. An accepted skip records the change it was verified for — the working tree's origin repo and checked-out branch (`e2eSkipVerifiedChange`) — and settles only that change: the PRs opened for it (`prChanges`, tracked in `e2eSkipCoveredPrs`) and its checked-out branch's PR. A PR's change is its URL's repo plus the command's `--head`/`--source-branch`, or else the hook tree's branch when the command never changed directory and that tree is in the PR's repo; a PR whose change is unknown is never covered, so `Push-Location`/`cd`/`--repo` cannot hand it another change's skip |
|
|
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 |
|
|
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
|
|
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 |
|
|
48
48
|
| `PreToolUse` (Bash, `if` a command names `gh`/`glab`) | `guardrail-report-format.sh` | **enforce** | a `gh pr comment\|create\|edit` body — or a `gh api … issues/comments/<id>` PATCH editing one — reads like an E2E report but lacks the `build-pr-section` sentinel | — | **deny** — render via `muggle build-pr-section` instead |
|
|
49
49
|
| `PreToolUse` (muggle local execute/replay) | `guardrail-classify-gate.sh` | **enforce** | `muggle-test` is the skill in play and the target test case has no `pre-execution-classification` this session | — | **deny** — run Step 6f first (it calls `muggle-remote-test-script-list`, which is where the run learns the case has never passed) or record a legitimate skip via `MUGGLE_CLASSIFY_SKIP`. Scoped to `muggle-test`, so the single-target skills that legitimately skip classification are untouched; fails open when the test case can't be resolved |
|
|
50
50
|
| `Stop` | `guardrail-e2e-gate.sh` | **enforce** | unit tests passed this session, no E2E ran yet, and no skip was recorded | `autoE2ETest` | **block** the turn until E2E runs via `muggle-test` or a `MUGGLE_E2E_SKIP` marker records a legitimate skip (full message once, one-line reminders after; releases after 3 blocks). Quiet while a background acceptance-tester is in flight |
|
|
51
|
-
| `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the
|
|
51
|
+
| `Stop` | `guardrail-terminal-gate.sh` | **enforce** | a PR went terminal this session and the next-options offer hasn't run since — an AskUserQuestion, or, while the session owns an open PR's watch slot, a closing message that asks the user | — | **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) |
|
|
52
52
|
| `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 |
|
|
53
53
|
| `Stop` | `guardrail-watch-follow-through-gate.sh` | **enforce** | a `muggle-pr-followup` watch this session owns (the slot's `owner.json`) recorded due work in `watch-due.env` — a branch behind or conflicting with its base, or a head whose checks settled red — and `last_seen.json` records no attempt for it: no `conflict_resolve_attempts` entry for the rebase key (enforced under `autoRebase=always` while catch-up budget is left), no `ci_fix_attempts` entry for the red head. An escalation entry with no attempt behind it counts for nothing, and re-arming the watch changes nothing | `autoRebase` | **block** the turn, naming each PR and its `/muggle-do rebase` or `fix ci` dispatch. No release after N blocks: only a recorded attempt, a newer head in the slot's `prs.json`, or the user's literal `HOLD WATCH #<pr-number>` clears it. The hold must come from a turn the user typed — never a tool result, a loaded skill, a hook's message, a task notification, a compaction summary, or the agent's own text — and is kept for the session once read. Reads local files only, never a provider: the pre-filter is a builtins glob for a non-empty `watch-due.env` whose `owner.json` names the session, so Node starts only when a slot has due work |
|
|
54
54
|
| `Stop` | `guardrail-walkthrough-gate.sh` | **enforce** | an E2E acceptance run happened this session and a PR in play — opened this session or on the working branch — carries no walkthrough in its body or comments; or an E2E skip was accepted and a PR it covers still shows the empty placeholder instead of the skip's record | `postPRVisualWalkthrough` | **block** the turn until the walkthrough is posted via `muggle-pr-visual-walkthrough` or a `MUGGLE_WALKTHROUGH_SKIP` marker records a legitimate skip. For a PR an accepted E2E skip covers, the block hands over the foreground `settle-walkthrough-skipped <pr> <session>` command, which prints `{"settled":true}` once the PR reads back the skip, and re-queues the detached write; a PR the skip does not cover is a different change and is told to run its own E2E or declare its own skip from its tree (releases after 3 blocks; an unreachable PR fails open to not-owed). A skip accepted before its PR existed is written straight into the PR's slot when it opens for the same repo and branch. The provider lookups run in a detached scan, queued when the gate arms, when a PR opens, and at each turn end; the gate decides on the last scan for the session's current PRs, begun after the last observed post, and stays open until one lands. Each PR is checked for its own walkthrough: a post to one PR settles only that one, and opening another re-arms the check. A PR whose own background run is in flight is set aside |
|
|
@@ -6,7 +6,7 @@ set -uo pipefail
|
|
|
6
6
|
# pr-followup watch scripts print in a shell result — arm the post-merge handoff:
|
|
7
7
|
# record the PR as pending, nudge the model to finalize/tear down and offer
|
|
8
8
|
# next options, and hold the Stop gate (guardrail-terminal-gate.sh) until the
|
|
9
|
-
#
|
|
9
|
+
# offer runs. Decision logic lives in the bundled guardrails.mjs.
|
|
10
10
|
#
|
|
11
11
|
# Fires after every Bash call, so a keyword pre-filter for the terminal output
|
|
12
12
|
# shapes keeps Node off the hot path. The reopen line belongs here too: it is
|
|
@@ -3,7 +3,7 @@ set -uo pipefail
|
|
|
3
3
|
|
|
4
4
|
# PR-terminal → post-merge handoff gate (Stop). When a PR went terminal this
|
|
5
5
|
# session (merged/closed) and the next-options offer hasn't run, block the
|
|
6
|
-
# turn end until the handoff — finalize, teardown,
|
|
6
|
+
# turn end until the handoff — finalize, teardown, next-options offer —
|
|
7
7
|
# happens. Releases unconditionally after 3 blocks.
|
|
8
8
|
#
|
|
9
9
|
# This must stay synchronous (only a sync Stop hook can block the turn end),
|