@muggleai/works 5.37.0-staging.341 → 5.37.0-staging.342
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-UWKBSNUQ.js → chunk-A3V2UKAB.js} +204 -73
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- 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/skills/_shared/dev-loop/run.md +1 -1
- package/dist/plugin/skills/_shared/host-tool-equivalents.md +1 -1
- package/dist/plugin/skills/do/resolve-conflicts.md +1 -1
- package/dist/plugin/skills/muggle-test-prepare/steps/claim-stack.md +6 -2
- package/dist/release-manifest.json +3 -3
- package/package.json +10 -10
- 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/skills/_shared/dev-loop/run.md +1 -1
- package/plugin/skills/_shared/host-tool-equivalents.md +1 -1
- package/plugin/skills/do/resolve-conflicts.md +1 -1
- package/plugin/skills/muggle-test-prepare/steps/claim-stack.md +6 -2
- package/scripts/muggle-watch/README.md +3 -1
- package/scripts/muggle-watch/install-muggle-watch.ps1 +5 -2
|
@@ -3146,6 +3146,13 @@ var REMOTE_CONTROL_MAX_RESTARTS = 2;
|
|
|
3146
3146
|
var REMOTE_CONTROL_RESTART_WINDOW_MS = 24 * 60 * 6e4;
|
|
3147
3147
|
var REMOTE_CONTROL_RESTART_COOLDOWN_MS = 30 * 6e4;
|
|
3148
3148
|
var REMOTE_CONTROL_NAME_COLUMN_WIDTH = 32;
|
|
3149
|
+
var MUGGLE_MCP_SERVER_NAME = "plugin:muggle:muggle";
|
|
3150
|
+
var MUGGLE_MCP_GAP = "no Muggle MCP server";
|
|
3151
|
+
var MCP_CONNECT_GRACE_MS = 2 * 6e4;
|
|
3152
|
+
var MCP_MISSING_CONFIRM_MS = 6e4;
|
|
3153
|
+
var MCP_RECOVER_MAX_RESTARTS = 2;
|
|
3154
|
+
var MCP_RECOVER_RESTART_WINDOW_MS = 24 * 60 * 6e4;
|
|
3155
|
+
var MCP_SERVER_LISTING_SCAN_BYTES = 512 * 1024;
|
|
3149
3156
|
var USAGE_LIMIT_API_ERROR = "usage_limit_reached";
|
|
3150
3157
|
var TRANSCRIPT_TAIL_BYTES = 256 * 1024;
|
|
3151
3158
|
var LIMIT_RESUME_PROMPT = "The usage limit that stopped your last turn has reset. Continue where you left off.";
|
|
@@ -4861,6 +4868,9 @@ The archive may be corrupted or in an unexpected format.`
|
|
|
4861
4868
|
}
|
|
4862
4869
|
}
|
|
4863
4870
|
|
|
4871
|
+
// src/cli/service-stack-constants.ts
|
|
4872
|
+
var STACK_WAIT_SECONDS = 1800;
|
|
4873
|
+
|
|
4864
4874
|
// src/cli/service-stack.ts
|
|
4865
4875
|
var NEED_PATTERN = /^(\d+)=(.+?)(?:@([0-9a-f]{7,40}))?$/i;
|
|
4866
4876
|
var FAILING_CHECK_VERDICTS = /* @__PURE__ */ new Set([
|
|
@@ -4873,7 +4883,14 @@ function parseStackNeed(value) {
|
|
|
4873
4883
|
if (!match) throw new Error(`--need "${value}" is not <port>=<run-dir>[@<sha>]`);
|
|
4874
4884
|
return { port: Number(match[1]), runDir: match[2], headSha: match[3] };
|
|
4875
4885
|
}
|
|
4876
|
-
function
|
|
4886
|
+
function buildStackWaitCommand(params) {
|
|
4887
|
+
const parts = ["muggle stack claim", `--cwd ${quoteArgument(params.cwd)}`];
|
|
4888
|
+
if (params.label) parts.push(`--label ${quoteArgument(params.label)}`);
|
|
4889
|
+
for (const need of params.needs) parts.push(`--need ${quoteArgument(need)}`);
|
|
4890
|
+
parts.push(`--wait ${STACK_WAIT_SECONDS}`, "--json");
|
|
4891
|
+
return parts.join(" ");
|
|
4892
|
+
}
|
|
4893
|
+
function renderStackClaimSummary(report, waitCommand) {
|
|
4877
4894
|
if (report.verdict === "GRANTED" /* Granted */) {
|
|
4878
4895
|
const lines2 = [`${report.verdict}: the stack is this checkout's to use (${report.cwd})`];
|
|
4879
4896
|
for (const port of report.plan) {
|
|
@@ -4893,6 +4910,7 @@ function renderStackClaimSummary(report) {
|
|
|
4893
4910
|
}
|
|
4894
4911
|
lines.push(...report.stoppedServices.map(describeStoppedService));
|
|
4895
4912
|
lines.push(`retry in ~${seconds(report.retryAfterMs ?? 0)}; your place is kept while you keep asking`);
|
|
4913
|
+
if (waitCommand) lines.push(`or wait in the background; it exits once the stack is yours: ${waitCommand}`);
|
|
4896
4914
|
return lines.join("\n");
|
|
4897
4915
|
}
|
|
4898
4916
|
function renderStackReleaseSummary(report) {
|
|
@@ -4927,7 +4945,9 @@ async function stackClaimCommand(flags) {
|
|
|
4927
4945
|
needs,
|
|
4928
4946
|
waitMs: flags.wait === void 0 ? void 0 : Number(flags.wait) * 1e3
|
|
4929
4947
|
});
|
|
4930
|
-
|
|
4948
|
+
const waitCommand = report.verdict === "BUSY" /* Busy */ ? buildStackWaitCommand({ cwd: report.cwd, label: flags.label, needs: flags.need }) : void 0;
|
|
4949
|
+
const output = { ...report, waitCommand };
|
|
4950
|
+
writeReport({ json: flags.json, report: output, summary: renderStackClaimSummary(report, waitCommand) });
|
|
4931
4951
|
if (report.verdict === "BUSY" /* Busy */) process.exitCode = BUSY_EXIT_CODE;
|
|
4932
4952
|
}
|
|
4933
4953
|
async function stackCheckCommand(flags) {
|
|
@@ -4955,6 +4975,9 @@ function describeStoppedService(service) {
|
|
|
4955
4975
|
const what = service.name ?? (service.commandLine || "untracked listener");
|
|
4956
4976
|
return `stopped ${service.port}: ${what} (PID ${service.pid}) \u2014 no lease needs it any more`;
|
|
4957
4977
|
}
|
|
4978
|
+
function quoteArgument(value) {
|
|
4979
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
4980
|
+
}
|
|
4958
4981
|
function shortSha2(sha) {
|
|
4959
4982
|
return sha ? sha.slice(0, 7) : "unknown";
|
|
4960
4983
|
}
|
|
@@ -5424,6 +5447,13 @@ function processSummary(snapshot) {
|
|
|
5424
5447
|
function countDecisions(report, action) {
|
|
5425
5448
|
return report.decisions.filter((decision) => decision.action === action).length;
|
|
5426
5449
|
}
|
|
5450
|
+
function reconnectRows(report, manualCommand) {
|
|
5451
|
+
return report.decisions.map((decision) => {
|
|
5452
|
+
const outcome = report.untrustedSessionIds.includes(decision.sessionId) ? ` \u2014 refused: its workspace takes no background restart, run ${manualCommand} in it` : report.failedSessionIds.includes(decision.sessionId) ? " \u2014 restart failed" : "";
|
|
5453
|
+
const label = (decision.name ?? "").slice(0, REMOTE_CONTROL_NAME_COLUMN_WIDTH).padEnd(REMOTE_CONTROL_NAME_COLUMN_WIDTH);
|
|
5454
|
+
return ` ${decision.action.padEnd(14)} ${shortSessionId(decision.sessionId)} ${label} ${decision.reason}${outcome}`;
|
|
5455
|
+
});
|
|
5456
|
+
}
|
|
5427
5457
|
function renderWatchStatus(snapshot, nowMs) {
|
|
5428
5458
|
const lines = [];
|
|
5429
5459
|
const snapshotAgeMs = nowMs - Date.parse(snapshot.takenAt);
|
|
@@ -5472,17 +5502,22 @@ function renderWatchStatus(snapshot, nowMs) {
|
|
|
5472
5502
|
`Plugin reload: ${reload.respawnedSessionIds.length} restarted, ${reload.failedSessionIds.length} failed, ${countDecisions(reload, "defer" /* Defer */)} deferred, ${countDecisions(reload, "notify-manual" /* NotifyManual */) + (reload.untrustedSessionIds?.length ?? 0)} need /reload-plugins by hand`
|
|
5473
5503
|
);
|
|
5474
5504
|
}
|
|
5505
|
+
if (snapshot.mcpRecover) {
|
|
5506
|
+
const mcpRecover = snapshot.mcpRecover;
|
|
5507
|
+
const manualCount = countDecisions(mcpRecover, "skip" /* Skip */) + countDecisions(mcpRecover, "notify-manual" /* NotifyManual */) + mcpRecover.untrustedSessionIds.length;
|
|
5508
|
+
lines.push(
|
|
5509
|
+
"",
|
|
5510
|
+
`Muggle MCP: ${mcpRecover.connectedSessionIds.length} connected, ${mcpRecover.respawnedSessionIds.length} restarted, ${mcpRecover.failedSessionIds.length} failed, ${countDecisions(mcpRecover, "defer" /* Defer */)} waiting, ${manualCount} need /mcp by hand`,
|
|
5511
|
+
...reconnectRows(mcpRecover, "/mcp")
|
|
5512
|
+
);
|
|
5513
|
+
}
|
|
5475
5514
|
if (snapshot.remoteControl) {
|
|
5476
5515
|
const remoteControl = snapshot.remoteControl;
|
|
5477
5516
|
lines.push(
|
|
5478
5517
|
"",
|
|
5479
|
-
`Remote Control: ${remoteControl.connectedSessionIds.length} connected, ${remoteControl.respawnedSessionIds.length} restarted, ${remoteControl.failedSessionIds.length} failed, ${remoteControl.untrustedSessionIds.length} refused, ${countDecisions(remoteControl, "defer" /* Defer */)} waiting, ${countDecisions(remoteControl, "skip" /* Skip */) + countDecisions(remoteControl, "notify-manual" /* NotifyManual */)} skipped
|
|
5518
|
+
`Remote Control: ${remoteControl.connectedSessionIds.length} connected, ${remoteControl.respawnedSessionIds.length} restarted, ${remoteControl.failedSessionIds.length} failed, ${remoteControl.untrustedSessionIds.length} refused, ${countDecisions(remoteControl, "defer" /* Defer */)} waiting, ${countDecisions(remoteControl, "skip" /* Skip */) + countDecisions(remoteControl, "notify-manual" /* NotifyManual */)} skipped`,
|
|
5519
|
+
...reconnectRows(remoteControl, "/remote-control")
|
|
5480
5520
|
);
|
|
5481
|
-
for (const decision of remoteControl.decisions) {
|
|
5482
|
-
const outcome = remoteControl.untrustedSessionIds.includes(decision.sessionId) ? " \u2014 refused: its workspace takes no background restart, run /remote-control in it" : remoteControl.failedSessionIds.includes(decision.sessionId) ? " \u2014 restart failed" : "";
|
|
5483
|
-
const label = (decision.name ?? "").slice(0, REMOTE_CONTROL_NAME_COLUMN_WIDTH).padEnd(REMOTE_CONTROL_NAME_COLUMN_WIDTH);
|
|
5484
|
-
lines.push(` ${decision.action.padEnd(14)} ${shortSessionId(decision.sessionId)} ${label} ${decision.reason}${outcome}`);
|
|
5485
|
-
}
|
|
5486
5521
|
}
|
|
5487
5522
|
const limitDecisions = snapshot.limitResumes?.decisions ?? [];
|
|
5488
5523
|
if (limitDecisions.length > 0) {
|
|
@@ -5509,12 +5544,12 @@ function enumValueOf(values, candidate) {
|
|
|
5509
5544
|
function optionalString(candidate) {
|
|
5510
5545
|
return typeof candidate === "string" && candidate.length > 0 ? candidate : void 0;
|
|
5511
5546
|
}
|
|
5512
|
-
function readFileHead(filePath) {
|
|
5547
|
+
function readFileHead(filePath, byteCount = SESSION_FILE_HEAD_BYTES) {
|
|
5513
5548
|
let fileDescriptor;
|
|
5514
5549
|
try {
|
|
5515
5550
|
fileDescriptor = openSync(filePath, "r");
|
|
5516
|
-
const buffer = Buffer.alloc(
|
|
5517
|
-
const bytesRead = readSync(fileDescriptor, buffer, 0,
|
|
5551
|
+
const buffer = Buffer.alloc(byteCount);
|
|
5552
|
+
const bytesRead = readSync(fileDescriptor, buffer, 0, byteCount, 0);
|
|
5518
5553
|
return buffer.subarray(0, bytesRead).toString("utf-8");
|
|
5519
5554
|
} catch {
|
|
5520
5555
|
return void 0;
|
|
@@ -5579,6 +5614,12 @@ function hasLiveProcess(session) {
|
|
|
5579
5614
|
if (session.agent !== "claude" /* Claude */) return true;
|
|
5580
5615
|
return session.pid !== void 0 || session.turnStatus !== void 0;
|
|
5581
5616
|
}
|
|
5617
|
+
function isTurnOver(session) {
|
|
5618
|
+
if (session.processStatus !== void 0) {
|
|
5619
|
+
return session.processStatus === "idle" /* Idle */ || session.processStatus === "shell" /* Shell */;
|
|
5620
|
+
}
|
|
5621
|
+
return session.turnStatus === "idle" /* Idle */;
|
|
5622
|
+
}
|
|
5582
5623
|
function isIdleBackgroundSession(session) {
|
|
5583
5624
|
return session.agent === "claude" /* Claude */ && hasLiveProcess(session) && session.kind === "background" /* Background */ && session.shortId !== void 0 && session.turnStatus === "idle" /* Idle */;
|
|
5584
5625
|
}
|
|
@@ -5817,6 +5858,12 @@ function readCustomTitle(projectsDir, sessionId) {
|
|
|
5817
5858
|
}
|
|
5818
5859
|
return customTitle;
|
|
5819
5860
|
}
|
|
5861
|
+
function isMuggleMcpServerListed(projectsDir, sessionId) {
|
|
5862
|
+
const transcriptPath = findTranscriptPath(projectsDir, sessionId);
|
|
5863
|
+
if (transcriptPath === void 0) return false;
|
|
5864
|
+
if (readFileHead(transcriptPath, MCP_SERVER_LISTING_SCAN_BYTES)?.includes(MUGGLE_MCP_SERVER_NAME)) return true;
|
|
5865
|
+
return (readFileTailLines(transcriptPath, MCP_SERVER_LISTING_SCAN_BYTES) ?? []).some((line) => line.includes(MUGGLE_MCP_SERVER_NAME));
|
|
5866
|
+
}
|
|
5820
5867
|
function findClaudeSessionCwd(projectsDir, sessionId) {
|
|
5821
5868
|
const transcriptPath = findTranscriptPath(projectsDir, sessionId);
|
|
5822
5869
|
if (transcriptPath === void 0) return void 0;
|
|
@@ -6630,6 +6677,71 @@ function withWatchLock(watchDir, run, waitMs = WATCH_LOCK_WAIT_MS) {
|
|
|
6630
6677
|
return withFileLock(join(watchDir, WATCH_LOCK_FILE), waitMs, run);
|
|
6631
6678
|
}
|
|
6632
6679
|
|
|
6680
|
+
// src/watch/restart-plan.ts
|
|
6681
|
+
function restartDecisionOf(session, action, reason) {
|
|
6682
|
+
return {
|
|
6683
|
+
sessionId: session.sessionId,
|
|
6684
|
+
shortId: session.shortId,
|
|
6685
|
+
name: session.name,
|
|
6686
|
+
cwd: session.cwd,
|
|
6687
|
+
action,
|
|
6688
|
+
reason
|
|
6689
|
+
};
|
|
6690
|
+
}
|
|
6691
|
+
function restartsWithinWindow(restartsBySession, sessionId, nowMs, windowMs) {
|
|
6692
|
+
return (restartsBySession[sessionId] ?? []).map((restartedAt) => Date.parse(restartedAt)).filter((restartedAtMs) => !Number.isNaN(restartedAtMs) && nowMs - restartedAtMs < windowMs);
|
|
6693
|
+
}
|
|
6694
|
+
function recordRestartAttempts(restartsBySession, report, nowMs, windowMs) {
|
|
6695
|
+
const nowIso = new Date(nowMs).toISOString();
|
|
6696
|
+
const nextRestartsBySession = {};
|
|
6697
|
+
for (const sessionId of Object.keys(restartsBySession)) {
|
|
6698
|
+
const recent = restartsWithinWindow(restartsBySession, sessionId, nowMs, windowMs).map((restartedAtMs) => new Date(restartedAtMs).toISOString());
|
|
6699
|
+
if (recent.length > 0) nextRestartsBySession[sessionId] = recent;
|
|
6700
|
+
}
|
|
6701
|
+
for (const sessionId of [...report.respawnedSessionIds, ...report.failedSessionIds, ...report.untrustedSessionIds]) {
|
|
6702
|
+
nextRestartsBySession[sessionId] = [...nextRestartsBySession[sessionId] ?? [], nowIso];
|
|
6703
|
+
}
|
|
6704
|
+
return nextRestartsBySession;
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6707
|
+
// src/watch/mcp-recover.ts
|
|
6708
|
+
function planMcpRecoverRestarts(sessions, isMuggleMcpServerListed2, missingSinceBySession, restartsBySession, nowMs, maxRestarts) {
|
|
6709
|
+
let restartsPlanned = 0;
|
|
6710
|
+
const connectedSessionIds = [];
|
|
6711
|
+
const decisions = [];
|
|
6712
|
+
const nextMissingSinceBySession = {};
|
|
6713
|
+
for (const session of sessions) {
|
|
6714
|
+
if (session.agent !== "claude" /* Claude */ || !hasLiveProcess(session) || session.hasMuggleMcpServer === void 0) continue;
|
|
6715
|
+
if (session.hasMuggleMcpServer) {
|
|
6716
|
+
connectedSessionIds.push(session.sessionId);
|
|
6717
|
+
continue;
|
|
6718
|
+
}
|
|
6719
|
+
const isStarting = session.loadedAtMs === void 0 || nowMs - session.loadedAtMs < MCP_CONNECT_GRACE_MS;
|
|
6720
|
+
if (isStarting || !isMuggleMcpServerListed2(session.sessionId)) continue;
|
|
6721
|
+
const recordedMissingSinceMs = Date.parse(missingSinceBySession[session.sessionId] ?? "");
|
|
6722
|
+
const missingSinceMs = Number.isNaN(recordedMissingSinceMs) ? nowMs : recordedMissingSinceMs;
|
|
6723
|
+
nextMissingSinceBySession[session.sessionId] = new Date(missingSinceMs).toISOString();
|
|
6724
|
+
const restartsMs = restartsWithinWindow(restartsBySession, session.sessionId, nowMs, MCP_RECOVER_RESTART_WINDOW_MS);
|
|
6725
|
+
if (nowMs - missingSinceMs < MCP_MISSING_CONFIRM_MS) {
|
|
6726
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `${MUGGLE_MCP_GAP} \u2014 confirming on the next tick`));
|
|
6727
|
+
} else if (session.kind === "interactive" /* Interactive */) {
|
|
6728
|
+
decisions.push(restartDecisionOf(session, "notify-manual" /* NotifyManual */, `${MUGGLE_MCP_GAP} \u2014 terminal session, run /mcp in it`));
|
|
6729
|
+
} else if (session.kind !== "background" /* Background */ || !session.shortId) {
|
|
6730
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, `${MUGGLE_MCP_GAP} \u2014 not a background session the watch can restart`));
|
|
6731
|
+
} else if (restartsMs.length >= MCP_RECOVER_MAX_RESTARTS) {
|
|
6732
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, `${MUGGLE_MCP_GAP} after ${restartsMs.length} restarts today \u2014 run /mcp in it`));
|
|
6733
|
+
} else if (!isTurnOver(session)) {
|
|
6734
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `${MUGGLE_MCP_GAP} \u2014 turn in flight (${session.processStatus ?? session.turnStatus ?? "unknown"})`));
|
|
6735
|
+
} else if (restartsPlanned >= maxRestarts) {
|
|
6736
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `${MUGGLE_MCP_GAP} \u2014 restart cap reached this pass`));
|
|
6737
|
+
} else {
|
|
6738
|
+
restartsPlanned++;
|
|
6739
|
+
decisions.push(restartDecisionOf(session, "respawn" /* Respawn */, MUGGLE_MCP_GAP));
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
return { connectedSessionIds, decisions, missingSinceBySession: nextMissingSinceBySession };
|
|
6743
|
+
}
|
|
6744
|
+
|
|
6633
6745
|
// src/watch/notify.ts
|
|
6634
6746
|
function composeTickNotification(raised, recoveries, reload) {
|
|
6635
6747
|
const lines = [];
|
|
@@ -6789,16 +6901,6 @@ function readProcessTable(platform4, runCommand, nowMs) {
|
|
|
6789
6901
|
}
|
|
6790
6902
|
|
|
6791
6903
|
// src/watch/reload-plugins.ts
|
|
6792
|
-
function decide2(session, action, reason) {
|
|
6793
|
-
return {
|
|
6794
|
-
sessionId: session.sessionId,
|
|
6795
|
-
shortId: session.shortId,
|
|
6796
|
-
name: session.name,
|
|
6797
|
-
cwd: session.cwd,
|
|
6798
|
-
action,
|
|
6799
|
-
reason
|
|
6800
|
-
};
|
|
6801
|
-
}
|
|
6802
6904
|
function hasCurrentPlugins(session, pending) {
|
|
6803
6905
|
const loadedAtMs = session.loadedAtMs ?? session.startedAtMs;
|
|
6804
6906
|
return loadedAtMs !== void 0 && loadedAtMs >= pending.changedAtMs;
|
|
@@ -6809,24 +6911,24 @@ function planReloadFanOut(sessions, pending, watchOwnerSessionIds, maxRestarts =
|
|
|
6809
6911
|
for (const session of sessions) {
|
|
6810
6912
|
if (session.agent !== "claude" /* Claude */) continue;
|
|
6811
6913
|
if (!hasLiveProcess(session)) {
|
|
6812
|
-
decisions.push(
|
|
6914
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, "no live process"));
|
|
6813
6915
|
} else if (hasCurrentPlugins(session, pending)) {
|
|
6814
|
-
decisions.push(
|
|
6916
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, "already on the installed build"));
|
|
6815
6917
|
} else if (pending.respawnedSessionIds.includes(session.sessionId) || pending.skippedSessionIds.includes(session.sessionId)) {
|
|
6816
|
-
decisions.push(
|
|
6918
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, "already handled for this install"));
|
|
6817
6919
|
} else if (session.kind === "interactive" /* Interactive */) {
|
|
6818
|
-
decisions.push(pending.notifiedSessionIds.includes(session.sessionId) ?
|
|
6920
|
+
decisions.push(pending.notifiedSessionIds.includes(session.sessionId) ? restartDecisionOf(session, "skip" /* Skip */, "already asked to run /reload-plugins") : restartDecisionOf(session, "notify-manual" /* NotifyManual */, "terminal session \u2014 run /reload-plugins in it"));
|
|
6819
6921
|
} else if (session.kind !== "background" /* Background */ || !session.shortId) {
|
|
6820
|
-
decisions.push(
|
|
6922
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, "not a background session the watch can restart"));
|
|
6821
6923
|
} else if (session.turnStatus !== "idle" /* Idle */) {
|
|
6822
|
-
decisions.push(
|
|
6924
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `turn in flight (${session.turnStatus ?? "unknown"})`));
|
|
6823
6925
|
} else if (watchOwnerSessionIds.has(session.sessionId)) {
|
|
6824
|
-
decisions.push(
|
|
6926
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, "owns open PR watches \u2014 left running; run /reload-plugins in it"));
|
|
6825
6927
|
} else if (restartsPlanned >= maxRestarts) {
|
|
6826
|
-
decisions.push(
|
|
6928
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, "restart cap reached this pass"));
|
|
6827
6929
|
} else {
|
|
6828
6930
|
restartsPlanned++;
|
|
6829
|
-
decisions.push(
|
|
6931
|
+
decisions.push(restartDecisionOf(session, "respawn" /* Respawn */, "idle background session"));
|
|
6830
6932
|
}
|
|
6831
6933
|
}
|
|
6832
6934
|
return decisions;
|
|
@@ -6873,18 +6975,6 @@ function remoteControlGapOf(session, login) {
|
|
|
6873
6975
|
const isStartedBeforeLogin = login.effectiveAtMs !== void 0 && session.startedAtMs !== void 0 && session.startedAtMs < login.effectiveAtMs;
|
|
6874
6976
|
return isStartedBeforeLogin ? "linked under an earlier login" : void 0;
|
|
6875
6977
|
}
|
|
6876
|
-
function isTurnOver(session) {
|
|
6877
|
-
if (session.processStatus !== void 0) {
|
|
6878
|
-
return session.processStatus === "idle" /* Idle */ || session.processStatus === "shell" /* Shell */;
|
|
6879
|
-
}
|
|
6880
|
-
return session.turnStatus === "idle" /* Idle */;
|
|
6881
|
-
}
|
|
6882
|
-
function recentRestartsMs(restartsBySession, sessionId, nowMs) {
|
|
6883
|
-
return (restartsBySession[sessionId] ?? []).map((restartedAt) => Date.parse(restartedAt)).filter((restartedAtMs) => !Number.isNaN(restartedAtMs) && nowMs - restartedAtMs < REMOTE_CONTROL_RESTART_WINDOW_MS);
|
|
6884
|
-
}
|
|
6885
|
-
function decide3(session, action, reason) {
|
|
6886
|
-
return { sessionId: session.sessionId, shortId: session.shortId, name: session.name, cwd: session.cwd, action, reason };
|
|
6887
|
-
}
|
|
6888
6978
|
function planRemoteControlRestarts(sessions, login, restartsBySession, nowMs, maxRestarts) {
|
|
6889
6979
|
let restartsPlanned = 0;
|
|
6890
6980
|
const connectedSessionIds = [];
|
|
@@ -6896,38 +6986,26 @@ function planRemoteControlRestarts(sessions, login, restartsBySession, nowMs, ma
|
|
|
6896
6986
|
connectedSessionIds.push(session.sessionId);
|
|
6897
6987
|
continue;
|
|
6898
6988
|
}
|
|
6899
|
-
const restartsMs =
|
|
6989
|
+
const restartsMs = restartsWithinWindow(restartsBySession, session.sessionId, nowMs, REMOTE_CONTROL_RESTART_WINDOW_MS);
|
|
6900
6990
|
if (session.kind === "interactive" /* Interactive */) {
|
|
6901
|
-
decisions.push(
|
|
6991
|
+
decisions.push(restartDecisionOf(session, "notify-manual" /* NotifyManual */, `${gap} \u2014 terminal session, run /remote-control in it`));
|
|
6902
6992
|
} else if (session.kind !== "background" /* Background */ || !session.shortId) {
|
|
6903
|
-
decisions.push(
|
|
6993
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, `${gap} \u2014 not a background session the watch can restart`));
|
|
6904
6994
|
} else if (restartsMs.length >= REMOTE_CONTROL_MAX_RESTARTS) {
|
|
6905
|
-
decisions.push(
|
|
6995
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, `${gap} after ${restartsMs.length} restarts today`));
|
|
6906
6996
|
} else if (nowMs - Math.max(-Infinity, ...restartsMs) < REMOTE_CONTROL_RESTART_COOLDOWN_MS) {
|
|
6907
|
-
decisions.push(
|
|
6997
|
+
decisions.push(restartDecisionOf(session, "skip" /* Skip */, `${gap} \u2014 restarted recently, waiting for it to link`));
|
|
6908
6998
|
} else if (!isTurnOver(session)) {
|
|
6909
|
-
decisions.push(
|
|
6999
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `${gap} \u2014 turn in flight (${session.processStatus ?? session.turnStatus ?? "unknown"})`));
|
|
6910
7000
|
} else if (restartsPlanned >= maxRestarts) {
|
|
6911
|
-
decisions.push(
|
|
7001
|
+
decisions.push(restartDecisionOf(session, "defer" /* Defer */, `${gap} \u2014 restart cap reached this pass`));
|
|
6912
7002
|
} else {
|
|
6913
7003
|
restartsPlanned++;
|
|
6914
|
-
decisions.push(
|
|
7004
|
+
decisions.push(restartDecisionOf(session, "respawn" /* Respawn */, gap));
|
|
6915
7005
|
}
|
|
6916
7006
|
}
|
|
6917
7007
|
return { connectedSessionIds, decisions };
|
|
6918
7008
|
}
|
|
6919
|
-
function recordRemoteControlRestarts(restartsBySession, report, nowMs) {
|
|
6920
|
-
const nowIso = new Date(nowMs).toISOString();
|
|
6921
|
-
const nextRestartsBySession = {};
|
|
6922
|
-
for (const sessionId of Object.keys(restartsBySession)) {
|
|
6923
|
-
const recent = recentRestartsMs(restartsBySession, sessionId, nowMs).map((restartedAtMs) => new Date(restartedAtMs).toISOString());
|
|
6924
|
-
if (recent.length > 0) nextRestartsBySession[sessionId] = recent;
|
|
6925
|
-
}
|
|
6926
|
-
for (const sessionId of [...report.respawnedSessionIds, ...report.failedSessionIds, ...report.untrustedSessionIds]) {
|
|
6927
|
-
nextRestartsBySession[sessionId] = [...nextRestartsBySession[sessionId] ?? [], nowIso];
|
|
6928
|
-
}
|
|
6929
|
-
return nextRestartsBySession;
|
|
6930
|
-
}
|
|
6931
7009
|
function resolvePluginRoot(env = process.env) {
|
|
6932
7010
|
return env.CLAUDE_PLUGIN_ROOT || env.CURSOR_PLUGIN_ROOT || dirname(dirname(fileURLToPath(import.meta.url)));
|
|
6933
7011
|
}
|
|
@@ -7042,18 +7120,23 @@ function owningSessionPid(server, entriesByPid, sessionPids) {
|
|
|
7042
7120
|
function stampSessionLoads(sessions, table, tracked, installs, nowMs) {
|
|
7043
7121
|
const entriesByPid = new Map(table.map((entry) => [entry.pid, entry]));
|
|
7044
7122
|
const sessionPids = new Set(sessions.flatMap((session) => session.pid === void 0 ? [] : [session.pid]));
|
|
7123
|
+
const serverSessionPids = /* @__PURE__ */ new Set();
|
|
7045
7124
|
const newestServerStartByPid = /* @__PURE__ */ new Map();
|
|
7046
7125
|
for (const server of tracked) {
|
|
7047
|
-
if (server.kind !== "muggle-mcp-server" /* MuggleMcpServer */
|
|
7126
|
+
if (server.kind !== "muggle-mcp-server" /* MuggleMcpServer */) continue;
|
|
7048
7127
|
const sessionPid = owningSessionPid(server, entriesByPid, sessionPids);
|
|
7049
7128
|
if (sessionPid === void 0) continue;
|
|
7129
|
+
serverSessionPids.add(sessionPid);
|
|
7130
|
+
if (server.ageMs === void 0) continue;
|
|
7050
7131
|
newestServerStartByPid.set(sessionPid, Math.max(newestServerStartByPid.get(sessionPid) ?? 0, nowMs - server.ageMs));
|
|
7051
7132
|
}
|
|
7052
7133
|
return sessions.map((session) => {
|
|
7053
|
-
|
|
7054
|
-
|
|
7134
|
+
if (session.agent !== "claude" /* Claude */ || session.pid === void 0 || !entriesByPid.has(session.pid)) return session;
|
|
7135
|
+
const stamped = { ...session, hasMuggleMcpServer: serverSessionPids.has(session.pid) };
|
|
7136
|
+
const processAgeMs = entriesByPid.get(session.pid)?.ageMs;
|
|
7137
|
+
if (processAgeMs === void 0) return stamped;
|
|
7055
7138
|
const loadedAtMs = Math.max(nowMs - processAgeMs, newestServerStartByPid.get(session.pid) ?? 0);
|
|
7056
|
-
return { ...
|
|
7139
|
+
return { ...stamped, loadedAtMs, loadedVersion: versionInstalledAt(installs, loadedAtMs) };
|
|
7057
7140
|
});
|
|
7058
7141
|
}
|
|
7059
7142
|
|
|
@@ -7320,6 +7403,7 @@ function createDefaultWatchTickDeps(options) {
|
|
|
7320
7403
|
isRecoveryEnabled: options.isRecoveryEnabled,
|
|
7321
7404
|
isRemoteControlKeptOn: options.isRemoteControlKeptOn,
|
|
7322
7405
|
isLimitResumeEnabled: options.isLimitResumeEnabled,
|
|
7406
|
+
isMcpRecoverEnabled: options.isMcpRecoverEnabled,
|
|
7323
7407
|
launchServiceLoop: createServiceLoopLauncher(process.platform, defaultCommandRunner)
|
|
7324
7408
|
};
|
|
7325
7409
|
}
|
|
@@ -7381,10 +7465,27 @@ function runRemoteControlPass(login, claudeSessions, restartsBySession, maxResta
|
|
|
7381
7465
|
const executed = executeReloadFanOut(plan.decisions, deps.runCommand, canRestartVia(deps), pinSessionNameVia(deps, claudeSessions));
|
|
7382
7466
|
return {
|
|
7383
7467
|
report: { ...executed, connectedSessionIds: plan.connectedSessionIds },
|
|
7384
|
-
restartsBySession:
|
|
7468
|
+
restartsBySession: recordRestartAttempts(restartsBySession, executed, deps.nowMs, REMOTE_CONTROL_RESTART_WINDOW_MS),
|
|
7385
7469
|
events: reloadEvents(executed, at, "restarted to reconnect Remote Control")
|
|
7386
7470
|
};
|
|
7387
7471
|
}
|
|
7472
|
+
function runMcpRecoverPass(claudeSessions, missingSinceBySession, restartsBySession, maxRestarts, deps, at) {
|
|
7473
|
+
const plan = planMcpRecoverRestarts(
|
|
7474
|
+
claudeSessions,
|
|
7475
|
+
(sessionId) => isMuggleMcpServerListed(deps.paths.claudeProjectsDir, sessionId),
|
|
7476
|
+
missingSinceBySession,
|
|
7477
|
+
restartsBySession,
|
|
7478
|
+
deps.nowMs,
|
|
7479
|
+
maxRestarts
|
|
7480
|
+
);
|
|
7481
|
+
const executed = executeReloadFanOut(plan.decisions, deps.runCommand, canRestartVia(deps), pinSessionNameVia(deps, claudeSessions));
|
|
7482
|
+
return {
|
|
7483
|
+
report: { ...executed, connectedSessionIds: plan.connectedSessionIds },
|
|
7484
|
+
missingSinceBySession: plan.missingSinceBySession,
|
|
7485
|
+
restartsBySession: recordRestartAttempts(restartsBySession, executed, deps.nowMs, MCP_RECOVER_RESTART_WINDOW_MS),
|
|
7486
|
+
events: reloadEvents(executed, at, "restarted to reconnect the Muggle MCP server")
|
|
7487
|
+
};
|
|
7488
|
+
}
|
|
7388
7489
|
function canRestartVia(deps) {
|
|
7389
7490
|
return (cwd) => canRestartSessionIn(cwd, deps.runCommand);
|
|
7390
7491
|
}
|
|
@@ -7552,6 +7653,26 @@ function runTickUnlocked(deps) {
|
|
|
7552
7653
|
events.push(...pass.events);
|
|
7553
7654
|
for (const sessionId of [...reload.respawnedSessionIds, ...reload.failedSessionIds]) restartedSessionIds.add(sessionId);
|
|
7554
7655
|
}
|
|
7656
|
+
let respawnsThisTick = reload ? reload.respawnedSessionIds.length + reload.failedSessionIds.length : 0;
|
|
7657
|
+
let mcpMissingSinceBySession = state.mcpMissingSinceBySession ?? {};
|
|
7658
|
+
let mcpRecoverRestartsBySession = state.mcpRecoverRestartsBySession ?? {};
|
|
7659
|
+
let mcpRecover;
|
|
7660
|
+
if (deps.isMcpRecoverEnabled && claudeSessions !== null) {
|
|
7661
|
+
const pass = runMcpRecoverPass(
|
|
7662
|
+
claudeSessions.filter((session) => !restartedSessionIds.has(session.sessionId)),
|
|
7663
|
+
mcpMissingSinceBySession,
|
|
7664
|
+
mcpRecoverRestartsBySession,
|
|
7665
|
+
Math.max(0, MAX_RESPAWNS_PER_TICK - respawnsThisTick),
|
|
7666
|
+
deps,
|
|
7667
|
+
at
|
|
7668
|
+
);
|
|
7669
|
+
mcpRecover = pass.report;
|
|
7670
|
+
mcpMissingSinceBySession = pass.missingSinceBySession;
|
|
7671
|
+
mcpRecoverRestartsBySession = pass.restartsBySession;
|
|
7672
|
+
events.push(...pass.events);
|
|
7673
|
+
for (const sessionId of [...mcpRecover.respawnedSessionIds, ...mcpRecover.failedSessionIds]) restartedSessionIds.add(sessionId);
|
|
7674
|
+
respawnsThisTick += mcpRecover.respawnedSessionIds.length + mcpRecover.failedSessionIds.length;
|
|
7675
|
+
}
|
|
7555
7676
|
const observedLogin = readClaudeLogin(deps.paths.claudeGlobalConfigFile, deps.paths.claudeCredentialsFile);
|
|
7556
7677
|
const claudeLogin = advanceClaudeLogin(state.claudeLogin, observedLogin, deps.nowMs);
|
|
7557
7678
|
let remoteControlRestartsBySession = state.remoteControlRestartsBySession ?? {};
|
|
@@ -7561,7 +7682,7 @@ function runTickUnlocked(deps) {
|
|
|
7561
7682
|
claudeLogin,
|
|
7562
7683
|
claudeSessions.filter((session) => !restartedSessionIds.has(session.sessionId)),
|
|
7563
7684
|
remoteControlRestartsBySession,
|
|
7564
|
-
Math.max(0, MAX_RESPAWNS_PER_TICK -
|
|
7685
|
+
Math.max(0, MAX_RESPAWNS_PER_TICK - respawnsThisTick),
|
|
7565
7686
|
deps,
|
|
7566
7687
|
at
|
|
7567
7688
|
);
|
|
@@ -7578,7 +7699,9 @@ function runTickUnlocked(deps) {
|
|
|
7578
7699
|
pendingReload,
|
|
7579
7700
|
claudeLogin,
|
|
7580
7701
|
remoteControlRestartsBySession,
|
|
7581
|
-
limitResumeAttemptsBySession
|
|
7702
|
+
limitResumeAttemptsBySession,
|
|
7703
|
+
mcpRecoverRestartsBySession,
|
|
7704
|
+
mcpMissingSinceBySession
|
|
7582
7705
|
});
|
|
7583
7706
|
const snapshot = {
|
|
7584
7707
|
takenAt: at,
|
|
@@ -7593,7 +7716,8 @@ function runTickUnlocked(deps) {
|
|
|
7593
7716
|
serviceArms,
|
|
7594
7717
|
reload,
|
|
7595
7718
|
remoteControl,
|
|
7596
|
-
limitResumes
|
|
7719
|
+
limitResumes,
|
|
7720
|
+
mcpRecover
|
|
7597
7721
|
};
|
|
7598
7722
|
writeWatchSnapshot(deps.paths.watchDir, snapshot);
|
|
7599
7723
|
return snapshot;
|
|
@@ -7651,7 +7775,8 @@ function watchTickCommand(flags) {
|
|
|
7651
7775
|
isAutoReloadEnabled: flags.autoReload,
|
|
7652
7776
|
isRecoveryEnabled: flags.recovery,
|
|
7653
7777
|
isRemoteControlKeptOn: flags.remoteControl,
|
|
7654
|
-
isLimitResumeEnabled: flags.limitResume
|
|
7778
|
+
isLimitResumeEnabled: flags.limitResume,
|
|
7779
|
+
isMcpRecoverEnabled: flags.mcpRecover
|
|
7655
7780
|
})
|
|
7656
7781
|
);
|
|
7657
7782
|
if (flags.json) {
|
|
@@ -7693,7 +7818,13 @@ function watchReloadPluginsCommand(flags) {
|
|
|
7693
7818
|
try {
|
|
7694
7819
|
const isDryRun = flags.dryRun === true;
|
|
7695
7820
|
const report = runReloadPluginsPass(
|
|
7696
|
-
createDefaultWatchTickDeps({
|
|
7821
|
+
createDefaultWatchTickDeps({
|
|
7822
|
+
isAutoReloadEnabled: true,
|
|
7823
|
+
isRecoveryEnabled: false,
|
|
7824
|
+
isRemoteControlKeptOn: false,
|
|
7825
|
+
isLimitResumeEnabled: false,
|
|
7826
|
+
isMcpRecoverEnabled: false
|
|
7827
|
+
}),
|
|
7697
7828
|
isDryRun
|
|
7698
7829
|
);
|
|
7699
7830
|
if (!report) {
|
|
@@ -7781,7 +7912,7 @@ function createProgram() {
|
|
|
7781
7912
|
stack.command("status").description("Show every lease, the line, and the services prepare tracks").option("--json", "Print the full report as JSON").action(stackStatusCommand);
|
|
7782
7913
|
program.command("ci-install").description("Add the Muggle walkthrough check to this repository's GitHub Actions").option("--force", "Replace an existing workflow file").action(ciInstallCommand);
|
|
7783
7914
|
const watch = program.command("watch").description("Standing watch over Claude/Codex sessions, their processes, and PR watchers");
|
|
7784
|
-
watch.command("tick").description("Run one watch pass (the scheduled task runs this)").option("--no-auto-reload", "Do not start a plugin reload fan-out when installed plugins change").option("--no-recovery", "Report dead watchers without resuming their owner sessions").option("--no-remote-control", "Report sessions off Remote Control without restarting them").option("--no-limit-resume", "Report sessions a usage limit cut off without continuing them").option("--json", "Print the full snapshot as JSON").action(watchTickCommand);
|
|
7915
|
+
watch.command("tick").description("Run one watch pass (the scheduled task runs this)").option("--no-auto-reload", "Do not start a plugin reload fan-out when installed plugins change").option("--no-recovery", "Report dead watchers without resuming their owner sessions").option("--no-remote-control", "Report sessions off Remote Control without restarting them").option("--no-limit-resume", "Report sessions a usage limit cut off without continuing them").option("--no-mcp-recover", "Report sessions whose Muggle MCP server is gone without restarting them").option("--json", "Print the full snapshot as JSON").action(watchTickCommand);
|
|
7785
7916
|
watch.command("status").description("Show the last watch pass: sessions, processes, PR watches, findings").option("--json", "Print the snapshot as JSON").action(watchStatusCommand);
|
|
7786
7917
|
watch.command("reload-plugins").description("Reload plugins across active Claude sessions (respawns idle background ones)").option("--dry-run", "Show what each session would get without respawning anything").option("--json", "Print the report as JSON").action(watchReloadPluginsCommand);
|
|
7787
7918
|
watch.command("install").description("Schedule the watch with this OS's scheduler, or refresh the entry in place").option("--uninstall", "Remove the task; the ledger is kept").option("--no-wait", "Return once the task is registered, without waiting for its first pass").option("--from-preference", "Act on the autoInstallWatchService preference, as an install or upgrade does").action(watchInstallCommand);
|
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-
|
|
1
|
+
export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-A3V2UKAB.js';
|
|
2
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-OIFLV2QN.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
4
|
-
"version": "5.37.0-staging.
|
|
4
|
+
"version": "5.37.0-staging.342",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
5
|
-
"version": "5.37.0-staging.
|
|
5
|
+
"version": "5.37.0-staging.342",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -60,4 +60,4 @@ Store the returned `runId`, tagged with its `mode` and record. If a run fails, l
|
|
|
60
60
|
|
|
61
61
|
**A refused run is not a failure.** A result headed `Run refused — checkout is not on the latest …` launched nothing and has no `runId`: the `cwd` checkout lacks its base's latest commit (`BEHIND_BASE`) or carries another branch's commits (`FOREIGN_BASE`). Sync it per [`../sync-branch-with-base.md`](../sync-branch-with-base.md), re-invoke [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) so the dev server serves the synced code, and run the case again. Never route it through failure handling or count it as a result.
|
|
62
62
|
|
|
63
|
-
**A stack refusal is not a failure either.** One local service stack serves every session on the machine, and [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) claims the ports this checkout needs before it starts anything. A result headed `Run refused — the target port is leased to another checkout`, `Run refused — the service stack changed since this checkout claimed it` or `Run refused — this checkout's stack lease ended and its services were stopped` launched nothing: re-invoke prepare, which re-claims the stack and restarts what moved, or reports it busy with this checkout's place in line. A run result carrying the `service stack changed during this run` warning describes code that may not be this checkout's — re-run it before counting it. Never kill a peer's service to get a port, and never count any of these as a result.
|
|
63
|
+
**A stack refusal is not a failure either.** One local service stack serves every session on the machine, and [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) claims the ports this checkout needs before it starts anything. A result headed `Run refused — the target port is leased to another checkout`, `Run refused — the service stack changed since this checkout claimed it` or `Run refused — this checkout's stack lease ended and its services were stopped` launched nothing: re-invoke prepare, which re-claims the stack and restarts what moved, or reports it busy with this checkout's place in line and arms the background wait whose grant wakes the session. A run result carrying the `service stack changed during this run` warning describes code that may not be this checkout's — re-run it before counting it. Never kill a peer's service to get a port, and never count any of these as a result.
|
|
@@ -11,7 +11,7 @@ These skills are written against Claude Code's tools. In another agent host —
|
|
|
11
11
|
| `$CLAUDE_CODE_SESSION_ID` | This session's id | `$CODEX_SESSION_ID` — the same id the hooks receive as `session_id`. |
|
|
12
12
|
| Dispatch a plugin agent (`agents/*.md`, subagent type `muggle:<agent>`) | The Agent tool | `spawn_agent` with that agent file's instructions as the task, when multi-agent is enabled; otherwise run the agent file inline, as each skill already allows for a host with no subagents. |
|
|
13
13
|
| `TodoWrite` | The session task list | `update_plan` |
|
|
14
|
-
| A background `Bash` command (`run_in_background`), `/loop`, `CronCreate`/`CronDelete` (the PR watcher's background watch) | Wake the session when the watch reports an event | No equivalent: nothing in Codex wakes a session from a background process. Run the drain tick, seed the slot without a loop (`pr-watch-arm.sh … --no-exec`), and tell the user that following the PR up means invoking `$muggle:muggle-pr-followup` again — or scheduling it with `codex exec`. Never leave a loop polling that no session will hear. |
|
|
14
|
+
| A background `Bash` command (`run_in_background`), `/loop`, `CronCreate`/`CronDelete` (the PR watcher's background watch) | Wake the session when the watch reports an event | No equivalent: nothing in Codex wakes a session from a background process. Run the drain tick, seed the slot without a loop (`pr-watch-arm.sh … --no-exec`), and tell the user that following the PR up means invoking `$muggle:muggle-pr-followup` again — or scheduling it with `codex exec`. Never leave a loop polling that no session will hear. A busy stack claim's `waitCommand` runs in the call instead, in the foreground. |
|
|
15
15
|
| `model:` in a skill's frontmatter | Runs the skill on that model | Ignored — the session's model runs every skill. |
|
|
16
16
|
|
|
17
17
|
## Codex's sandbox
|
|
@@ -58,7 +58,7 @@ Size the rebase per [`cycle-size.md`](cycle-size.md) with `pre_cycle_sha = rebas
|
|
|
58
58
|
- **Accepted** — minor: the walkthrough settles on the last full run. The cycle is done.
|
|
59
59
|
- **Rejected** — full: the resolution changed the PR's own lines on an app-logic path. Run E2E per [`e2e-acceptance.md`](e2e-acceptance.md) on the pushed head, then repost the walkthrough — fire [`postPRVisualWalkthrough`](../muggle-preferences/preference-gates/postPRVisualWalkthrough.md), then [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A.
|
|
60
60
|
|
|
61
|
-
When that E2E cannot start — a peer holds the shared stack's lease, a readiness halt — the push stands and the run is owed: append `E2E owed: <head> (<reason>)` to `state.md`,
|
|
61
|
+
When that E2E cannot start — a peer holds the shared stack's lease, a readiness halt — the push stands and the run is owed: append `E2E owed: <head> (<reason>)` to `state.md`, arm the claim's background wait ([claim-stack](../muggle-test-prepare/steps/claim-stack.md)), and run it when that wait's grant wakes the session. A later cycle that runs E2E on this PR clears the line. A run that fails after the push goes to fix-ci like any red walkthrough on a pushed head.
|
|
62
62
|
|
|
63
63
|
### Step 5 — Escalate (can't resolve / budget spent)
|
|
64
64
|
|
|
@@ -19,7 +19,11 @@ The claim answers at once. It never waits on a peer unless asked to.
|
|
|
19
19
|
- `keep` — a tracked service already serves this directory and commit. [check-running](./check-running.md) still proves it.
|
|
20
20
|
- `start` — nothing tracked serves the port.
|
|
21
21
|
- `restart` — a tracked service serves other code that no session's lease needs any more, even when it was started from another checkout. [check-running](./check-running.md) replaces it.
|
|
22
|
-
- **`BUSY`** (exit 75) → another session's lease needs different code on a port this run needs, or a session ahead in line is still owed its turn there. Nothing was started or stopped. Don't ask the user to kill anything or pick another port — the line exists so they never have to.
|
|
22
|
+
- **`BUSY`** (exit 75) → another session's lease needs different code on a port this run needs, or a session ahead in line is still owed its turn there. Nothing was started or stopped. Don't ask the user to kill anything or pick another port — the line exists so they never have to. Report the blockers (port, who holds it, for how long) and this checkout's `position`, then arm the wait before the turn can end: run the report's `waitCommand` as a background shell command (`run_in_background: true`). It keeps this checkout's place by re-asking every second and exits the moment the stack is granted, and that exit wakes the session even after its turn ended. Meanwhile the caller does other work (unit tests, the next PR, cloud-side fetches) or ends its turn.
|
|
23
|
+
- The wait exits 0 → its JSON is this claim's `GRANTED` answer. Carry its `plan` straight into the execute phase: the lease's windows run from the grant.
|
|
24
|
+
- The wait exits 75 → it ran out with the stack still held. Run the `waitCommand` it printed the same way.
|
|
25
|
+
- Never end a turn on `BUSY` with no wait armed. Nothing else calls the session back, so its E2E stays owed until someone nudges it.
|
|
26
|
+
- A host with no background wake ([host-tool-equivalents](../../_shared/host-tool-equivalents.md)) runs the `waitCommand` in the call instead.
|
|
23
27
|
|
|
24
28
|
`muggle stack status` shows every lease, the line, and the services prepare tracks, without taking a place.
|
|
25
29
|
|
|
@@ -42,7 +46,7 @@ The lease belongs to the checkout, not to one run. Every test case of the same c
|
|
|
42
46
|
|
|
43
47
|
The line is ordered per port by the checkout's open pull request: the oldest-opened PR first, so the work nearest to merging drains the backlog, and a re-run after a rebase or a review fix goes back ahead of newer PRs rather than to the end. Checkouts with no open PR yet follow, in the order they first asked. The claim finds the PR itself with `gh pr view`; without `gh` or a PR, the checkout ranks as one with none. `muggle stack status` shows each waiter's PR. The machine-wide execution lock every local run takes orders its waiters the same way.
|
|
44
48
|
|
|
45
|
-
The line is pulled, not pushed:
|
|
49
|
+
The line is pulled, not pushed: the ledger calls no session back. The background wait asks on the session's behalf, and its exit is the wake. A session keeps its place by asking again within the suggested delay, and is served before anyone behind it who wants the same port. A session that stops asking keeps its turn for 30 seconds after the port frees, and its place for 10 minutes.
|
|
46
50
|
|
|
47
51
|
Holding a lease is optimistic, not exclusive. Nothing stops another process from binding a port. Instead, the local execute tools check the lease before every run and again when it ends:
|
|
48
52
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release": "5.37.0-staging.
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
2
|
+
"release": "5.37.0-staging.342",
|
|
3
|
+
"buildId": "run-342-1",
|
|
4
|
+
"commitSha": "d8c547cee375a5179539b39dc5a509ef5e4f1b73",
|
|
5
5
|
"buildTime": "2026-11-12T07:45:22Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muggleai/works",
|
|
3
3
|
"mcpName": "io.github.multiplex-ai/muggleai",
|
|
4
|
-
"version": "5.37.0-staging.
|
|
4
|
+
"version": "5.37.0-staging.342",
|
|
5
5
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -66,21 +66,21 @@
|
|
|
66
66
|
"typecheck:browser-bench": "tsc --noEmit -p internal/browser-bench/tsconfig.json"
|
|
67
67
|
},
|
|
68
68
|
"muggleConfig": {
|
|
69
|
-
"electronAppVersion": "1.25.
|
|
69
|
+
"electronAppVersion": "1.25.4",
|
|
70
70
|
"downloadBaseUrl": "https://github.com/multiplex-ai/muggle-ai-works/releases/download",
|
|
71
71
|
"runtimeTargetDefault": "staging",
|
|
72
72
|
"checksumsByStream": {
|
|
73
73
|
"production": {
|
|
74
|
-
"win32-x64": "
|
|
75
|
-
"linux-x64": "
|
|
76
|
-
"darwin-arm64": "
|
|
77
|
-
"darwin-x64": "
|
|
74
|
+
"win32-x64": "50923984de674ca39b7daff42f99c2290913fe9658343f4645cfb84b654cc9ac",
|
|
75
|
+
"linux-x64": "ede9cd3977e95b1558e676e9b05f2bfe63ebdb37ab77e887810229126355125e",
|
|
76
|
+
"darwin-arm64": "67babe01ee9b68824cafd7e548553dea421e90f37af7ae6d5e023584259a844a",
|
|
77
|
+
"darwin-x64": "5c5feae1191c26c0f149e7b1f1354c3ae19c9507110fc2cd3380e8a18b537679"
|
|
78
78
|
},
|
|
79
79
|
"staging": {
|
|
80
|
-
"darwin-arm64": "
|
|
81
|
-
"linux-x64": "
|
|
82
|
-
"win32-x64": "
|
|
83
|
-
"darwin-x64": "
|
|
80
|
+
"darwin-arm64": "df6fef9bc0b50033bd63f35164a72b14e593c61442c8baed3f2ad738fab17138",
|
|
81
|
+
"linux-x64": "0ae3066a3fdd7ed0980ea414cb73dbcf40f3e307f02e1390f1db293e9c7fa123",
|
|
82
|
+
"win32-x64": "859334fa373cb466df5698308530da203e1057619319fe24e4b49658a35224ce",
|
|
83
|
+
"darwin-x64": "89e37a900d02d434620a91df21d1be605e0d80862bd429603fea50457d2ece2f"
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"electronAppSignedFromVersion": "1.10.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
4
|
-
"version": "5.37.0-staging.
|
|
4
|
+
"version": "5.37.0-staging.342",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
package/plugin/.codex-mcp.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
5
|
-
"version": "5.37.0-staging.
|
|
5
|
+
"version": "5.37.0-staging.342",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
|
@@ -60,4 +60,4 @@ Store the returned `runId`, tagged with its `mode` and record. If a run fails, l
|
|
|
60
60
|
|
|
61
61
|
**A refused run is not a failure.** A result headed `Run refused — checkout is not on the latest …` launched nothing and has no `runId`: the `cwd` checkout lacks its base's latest commit (`BEHIND_BASE`) or carries another branch's commits (`FOREIGN_BASE`). Sync it per [`../sync-branch-with-base.md`](../sync-branch-with-base.md), re-invoke [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) so the dev server serves the synced code, and run the case again. Never route it through failure handling or count it as a result.
|
|
62
62
|
|
|
63
|
-
**A stack refusal is not a failure either.** One local service stack serves every session on the machine, and [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) claims the ports this checkout needs before it starts anything. A result headed `Run refused — the target port is leased to another checkout`, `Run refused — the service stack changed since this checkout claimed it` or `Run refused — this checkout's stack lease ended and its services were stopped` launched nothing: re-invoke prepare, which re-claims the stack and restarts what moved, or reports it busy with this checkout's place in line. A run result carrying the `service stack changed during this run` warning describes code that may not be this checkout's — re-run it before counting it. Never kill a peer's service to get a port, and never count any of these as a result.
|
|
63
|
+
**A stack refusal is not a failure either.** One local service stack serves every session on the machine, and [`muggle-test-prepare`](../../muggle-test-prepare/SKILL.md) claims the ports this checkout needs before it starts anything. A result headed `Run refused — the target port is leased to another checkout`, `Run refused — the service stack changed since this checkout claimed it` or `Run refused — this checkout's stack lease ended and its services were stopped` launched nothing: re-invoke prepare, which re-claims the stack and restarts what moved, or reports it busy with this checkout's place in line and arms the background wait whose grant wakes the session. A run result carrying the `service stack changed during this run` warning describes code that may not be this checkout's — re-run it before counting it. Never kill a peer's service to get a port, and never count any of these as a result.
|
|
@@ -11,7 +11,7 @@ These skills are written against Claude Code's tools. In another agent host —
|
|
|
11
11
|
| `$CLAUDE_CODE_SESSION_ID` | This session's id | `$CODEX_SESSION_ID` — the same id the hooks receive as `session_id`. |
|
|
12
12
|
| Dispatch a plugin agent (`agents/*.md`, subagent type `muggle:<agent>`) | The Agent tool | `spawn_agent` with that agent file's instructions as the task, when multi-agent is enabled; otherwise run the agent file inline, as each skill already allows for a host with no subagents. |
|
|
13
13
|
| `TodoWrite` | The session task list | `update_plan` |
|
|
14
|
-
| A background `Bash` command (`run_in_background`), `/loop`, `CronCreate`/`CronDelete` (the PR watcher's background watch) | Wake the session when the watch reports an event | No equivalent: nothing in Codex wakes a session from a background process. Run the drain tick, seed the slot without a loop (`pr-watch-arm.sh … --no-exec`), and tell the user that following the PR up means invoking `$muggle:muggle-pr-followup` again — or scheduling it with `codex exec`. Never leave a loop polling that no session will hear. |
|
|
14
|
+
| A background `Bash` command (`run_in_background`), `/loop`, `CronCreate`/`CronDelete` (the PR watcher's background watch) | Wake the session when the watch reports an event | No equivalent: nothing in Codex wakes a session from a background process. Run the drain tick, seed the slot without a loop (`pr-watch-arm.sh … --no-exec`), and tell the user that following the PR up means invoking `$muggle:muggle-pr-followup` again — or scheduling it with `codex exec`. Never leave a loop polling that no session will hear. A busy stack claim's `waitCommand` runs in the call instead, in the foreground. |
|
|
15
15
|
| `model:` in a skill's frontmatter | Runs the skill on that model | Ignored — the session's model runs every skill. |
|
|
16
16
|
|
|
17
17
|
## Codex's sandbox
|
|
@@ -58,7 +58,7 @@ Size the rebase per [`cycle-size.md`](cycle-size.md) with `pre_cycle_sha = rebas
|
|
|
58
58
|
- **Accepted** — minor: the walkthrough settles on the last full run. The cycle is done.
|
|
59
59
|
- **Rejected** — full: the resolution changed the PR's own lines on an app-logic path. Run E2E per [`e2e-acceptance.md`](e2e-acceptance.md) on the pushed head, then repost the walkthrough — fire [`postPRVisualWalkthrough`](../muggle-preferences/preference-gates/postPRVisualWalkthrough.md), then [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A.
|
|
60
60
|
|
|
61
|
-
When that E2E cannot start — a peer holds the shared stack's lease, a readiness halt — the push stands and the run is owed: append `E2E owed: <head> (<reason>)` to `state.md`,
|
|
61
|
+
When that E2E cannot start — a peer holds the shared stack's lease, a readiness halt — the push stands and the run is owed: append `E2E owed: <head> (<reason>)` to `state.md`, arm the claim's background wait ([claim-stack](../muggle-test-prepare/steps/claim-stack.md)), and run it when that wait's grant wakes the session. A later cycle that runs E2E on this PR clears the line. A run that fails after the push goes to fix-ci like any red walkthrough on a pushed head.
|
|
62
62
|
|
|
63
63
|
### Step 5 — Escalate (can't resolve / budget spent)
|
|
64
64
|
|
|
@@ -19,7 +19,11 @@ The claim answers at once. It never waits on a peer unless asked to.
|
|
|
19
19
|
- `keep` — a tracked service already serves this directory and commit. [check-running](./check-running.md) still proves it.
|
|
20
20
|
- `start` — nothing tracked serves the port.
|
|
21
21
|
- `restart` — a tracked service serves other code that no session's lease needs any more, even when it was started from another checkout. [check-running](./check-running.md) replaces it.
|
|
22
|
-
- **`BUSY`** (exit 75) → another session's lease needs different code on a port this run needs, or a session ahead in line is still owed its turn there. Nothing was started or stopped. Don't ask the user to kill anything or pick another port — the line exists so they never have to.
|
|
22
|
+
- **`BUSY`** (exit 75) → another session's lease needs different code on a port this run needs, or a session ahead in line is still owed its turn there. Nothing was started or stopped. Don't ask the user to kill anything or pick another port — the line exists so they never have to. Report the blockers (port, who holds it, for how long) and this checkout's `position`, then arm the wait before the turn can end: run the report's `waitCommand` as a background shell command (`run_in_background: true`). It keeps this checkout's place by re-asking every second and exits the moment the stack is granted, and that exit wakes the session even after its turn ended. Meanwhile the caller does other work (unit tests, the next PR, cloud-side fetches) or ends its turn.
|
|
23
|
+
- The wait exits 0 → its JSON is this claim's `GRANTED` answer. Carry its `plan` straight into the execute phase: the lease's windows run from the grant.
|
|
24
|
+
- The wait exits 75 → it ran out with the stack still held. Run the `waitCommand` it printed the same way.
|
|
25
|
+
- Never end a turn on `BUSY` with no wait armed. Nothing else calls the session back, so its E2E stays owed until someone nudges it.
|
|
26
|
+
- A host with no background wake ([host-tool-equivalents](../../_shared/host-tool-equivalents.md)) runs the `waitCommand` in the call instead.
|
|
23
27
|
|
|
24
28
|
`muggle stack status` shows every lease, the line, and the services prepare tracks, without taking a place.
|
|
25
29
|
|
|
@@ -42,7 +46,7 @@ The lease belongs to the checkout, not to one run. Every test case of the same c
|
|
|
42
46
|
|
|
43
47
|
The line is ordered per port by the checkout's open pull request: the oldest-opened PR first, so the work nearest to merging drains the backlog, and a re-run after a rebase or a review fix goes back ahead of newer PRs rather than to the end. Checkouts with no open PR yet follow, in the order they first asked. The claim finds the PR itself with `gh pr view`; without `gh` or a PR, the checkout ranks as one with none. `muggle stack status` shows each waiter's PR. The machine-wide execution lock every local run takes orders its waiters the same way.
|
|
44
48
|
|
|
45
|
-
The line is pulled, not pushed:
|
|
49
|
+
The line is pulled, not pushed: the ledger calls no session back. The background wait asks on the session's behalf, and its exit is the wake. A session keeps its place by asking again within the suggested delay, and is served before anyone behind it who wants the same port. A session that stops asking keeps its turn for 30 seconds after the port frees, and its place for 10 minutes.
|
|
46
50
|
|
|
47
51
|
Holding a lease is optimistic, not exclusive. Nothing stops another process from binding a port. Instead, the local execute tools check the lease before every run and again when it ends:
|
|
48
52
|
|
|
@@ -8,8 +8,9 @@ A standing per-user scheduled job that runs `muggle watch tick` every few minute
|
|
|
8
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
9
|
- **Keeps sessions on the installed build.** A session loaded before the newest global install (or a later user-scope update of the muggle plugin) is behind; other plugins updating restart nothing. Idle background sessions are respawned onto the new build, up to 3 per tick, keeping their own id and name. A session that owns open PR watches is left running. Before a restart, 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
10
|
- **Keeps sessions on Remote Control.** With `remoteControlAtStartup` on in Claude's settings, a live background session is off when its `~/.claude/sessions/<pid>.json` entry has no Remote Control link, or its process started before the current claude.ai login took effect, so its link serves another account. Such a session is respawned once its turn is over (registry status `idle` or `shell`), sharing the 3-per-tick cap with the reload. That keeps the same session id, so there is no duplicate in the agent view, and nothing is typed into it. Background commands carry over to the restarted process, PR watch loops included, so they keep reporting to that session. Each restart opens a new Remote Control session, so a session already on is never restarted. A restarted session gets 30 minutes to link, and one still off after 2 restarts in a day is left alone. Terminal sessions that are off are listed for `/remote-control`.
|
|
11
|
+
- **Keeps each session's Muggle MCP server connected.** Claude never reconnects a stdio MCP server whose process died, and a session only finds its Muggle tools gone when its next turn starts. A live Claude session whose transcript lists `plugin:muggle:muggle`, whose process has run past a 2-minute connect grace, and that has had no muggle MCP server process under it on two ticks in a row is respawned once its turn is over. That reuses the reload's restart path, workspace check and name pin, and shares its 3-per-tick cap, so the session comes back with its servers started afresh and nothing typed into it. A session still without one after 2 restarts in a day, and every terminal session, is listed for `/mcp`.
|
|
11
12
|
- **Continues sessions a usage limit cut off.** Claude never retries a turn a usage limit ended: the session stays stopped on the limit notice. A background session whose last turn is that notice is resumed in place with one continue prompt once the notice's own reset time has passed and Claude's usage cache shows no window still exhausted. A running session is stopped first, between turns only, and a copy Claude starts instead is removed. Each notice is continued once, a session at most twice a day, sharing the per-tick cap with owner wakes; a notice older than 8 days is left alone, and terminal sessions are listed to continue by hand.
|
|
12
|
-
- **Records and alerts.** Results go to `status.json` (last snapshot, with open-PR and Remote Control coverage), `state.json` (active findings, recovery attempts, reload progress, the login last seen, Remote Control restarts) and `events.jsonl` (raise/clear/resume/respawn/close-out history) under `~/.muggle-ai/watch/`. New alerts raise one desktop notification per tick.
|
|
13
|
+
- **Records and alerts.** Results go to `status.json` (last snapshot, with open-PR and Remote Control coverage), `state.json` (active findings, recovery attempts, reload progress, the login last seen, Remote Control and Muggle MCP restarts) and `events.jsonl` (raise/clear/resume/respawn/close-out history) under `~/.muggle-ai/watch/`. New alerts raise one desktop notification per tick.
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
@@ -47,6 +48,7 @@ On Windows the PowerShell installer also takes flags directly:
|
|
|
47
48
|
| `-NoAutoReload` | Never restart sessions onto a new build |
|
|
48
49
|
| `-NoRemoteControl` | Report sessions off Remote Control without restarting them |
|
|
49
50
|
| `-NoLimitResume` | Report sessions a usage limit cut off without continuing them |
|
|
51
|
+
| `-NoMcpRecover` | Report sessions whose Muggle MCP server is gone without restarting them |
|
|
50
52
|
| `-NoWait` | Return once the task is registered, before its first tick |
|
|
51
53
|
| `-MuggleEntry <path>` | Run a specific `bin\muggle.js` instead of the global install |
|
|
52
54
|
| `-Uninstall` | Remove the task; the ledger is kept |
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
# Codex sessions, their processes and every PR-watch slot, alerts on dead or deaf
|
|
4
4
|
# watchers, red CI and stale branches, restarts the loop of a registered slot
|
|
5
5
|
# whose watcher died, fans plugin reloads out across sessions, and restarts
|
|
6
|
-
# sessions that are off Remote Control under the current login
|
|
7
|
-
# background sessions a usage limit cut off
|
|
6
|
+
# sessions that are off Remote Control under the current login or whose Muggle
|
|
7
|
+
# MCP server is gone, and continues background sessions a usage limit cut off
|
|
8
|
+
# once that limit resets.
|
|
8
9
|
#
|
|
9
10
|
# The task runs the global @muggleai/works install, whose path survives
|
|
10
11
|
# `muggle upgrade`, so the service always runs the current release. Only the
|
|
@@ -24,6 +25,7 @@ param(
|
|
|
24
25
|
[switch]$NoRecovery,
|
|
25
26
|
[switch]$NoRemoteControl,
|
|
26
27
|
[switch]$NoLimitResume,
|
|
28
|
+
[switch]$NoMcpRecover,
|
|
27
29
|
# Return once the task is registered; its trigger runs the first tick a minute later.
|
|
28
30
|
[switch]$NoWait,
|
|
29
31
|
[switch]$Uninstall
|
|
@@ -67,6 +69,7 @@ if ($NoAutoReload) { $tickFlags += "--no-auto-reload" }
|
|
|
67
69
|
if ($NoRecovery) { $tickFlags += "--no-recovery" }
|
|
68
70
|
if ($NoRemoteControl) { $tickFlags += "--no-remote-control" }
|
|
69
71
|
if ($NoLimitResume) { $tickFlags += "--no-limit-resume" }
|
|
72
|
+
if ($NoMcpRecover) { $tickFlags += "--no-mcp-recover" }
|
|
70
73
|
$launcherArguments = @("`"$installedLauncher`"", "`"$($nodeCommand.Source)`"", "`"$MuggleEntry`"") + $tickFlags
|
|
71
74
|
|
|
72
75
|
# wscript.exe rather than node.exe is what keeps every run off the desktop; see
|