@muggleai/works 5.36.0-staging.335 → 5.36.0-staging.336
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/AGENTS.md +1 -0
- package/README.md +2 -1
- package/dist/{chunk-5E46QHM6.js → chunk-OIFLV2QN.js} +499 -157
- package/dist/{chunk-KGTP3CED.js → chunk-X3GQII63.js} +2 -2
- 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/README.md +1 -0
- package/dist/plugin/commands/mbugreport.md +7 -0
- package/dist/plugin/skills/CLAUDE.md +1 -1
- package/dist/plugin/skills/_aliases.json +2 -1
- package/dist/plugin/skills/mbugreport/SKILL.md +9 -0
- package/dist/plugin/skills/mbugreport/agents/openai.yaml +7 -0
- package/dist/plugin/skills/muggle/SKILL.md +1 -0
- package/dist/plugin/skills/muggle-bug-report/SKILL.md +37 -0
- package/dist/plugin/skills/muggle-bug-report/ops/file.md +68 -0
- package/dist/plugin/skills/muggle-bug-report/ops/list.md +30 -0
- package/dist/plugin/skills/muggle-bug-report/ops/reply.md +38 -0
- package/dist/plugin/skills/muggle-bug-report/ops/status.md +45 -0
- package/dist/release-manifest.json +4 -4
- package/dist/{src-2OO6JDTQ.js → src-5Z6EIGHT.js} +1 -1
- package/package.json +1 -1
- 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/README.md +1 -0
- package/plugin/commands/mbugreport.md +7 -0
- package/plugin/skills/CLAUDE.md +1 -1
- package/plugin/skills/_aliases.json +2 -1
- package/plugin/skills/mbugreport/SKILL.md +9 -0
- package/plugin/skills/mbugreport/agents/openai.yaml +7 -0
- package/plugin/skills/muggle/SKILL.md +1 -0
- package/plugin/skills/muggle-bug-report/SKILL.md +37 -0
- package/plugin/skills/muggle-bug-report/ops/file.md +68 -0
- package/plugin/skills/muggle-bug-report/ops/list.md +30 -0
- package/plugin/skills/muggle-bug-report/ops/reply.md +38 -0
- package/plugin/skills/muggle-bug-report/ops/status.md +45 -0
|
@@ -797,28 +797,28 @@ function resetLogger() {
|
|
|
797
797
|
// packages/mcps/src/shared/checksum.ts
|
|
798
798
|
var logger = getLogger();
|
|
799
799
|
function getPlatformKey() {
|
|
800
|
-
const
|
|
801
|
-
const
|
|
802
|
-
switch (
|
|
800
|
+
const os10 = platform();
|
|
801
|
+
const arch3 = process.arch;
|
|
802
|
+
switch (os10) {
|
|
803
803
|
case "darwin":
|
|
804
|
-
return
|
|
804
|
+
return arch3 === "arm64" ? "darwin-arm64" : "darwin-x64";
|
|
805
805
|
case "win32":
|
|
806
806
|
return "win32-x64";
|
|
807
807
|
case "linux":
|
|
808
808
|
return "linux-x64";
|
|
809
809
|
default:
|
|
810
|
-
throw new Error(`Unsupported platform: ${
|
|
810
|
+
throw new Error(`Unsupported platform: ${os10}`);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
async function calculateFileChecksum(filePath) {
|
|
814
|
-
return new Promise((
|
|
814
|
+
return new Promise((resolve8, reject) => {
|
|
815
815
|
const hash = crypto.createHash("sha256");
|
|
816
816
|
const stream = fs4.createReadStream(filePath);
|
|
817
817
|
stream.on("data", (data) => {
|
|
818
818
|
hash.update(data);
|
|
819
819
|
});
|
|
820
820
|
stream.on("end", () => {
|
|
821
|
-
|
|
821
|
+
resolve8(hash.digest("hex"));
|
|
822
822
|
});
|
|
823
823
|
stream.on("error", (error) => {
|
|
824
824
|
reject(error);
|
|
@@ -896,7 +896,7 @@ function getOpenCommand(url) {
|
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
async function openBrowserUrl(options) {
|
|
899
|
-
return new Promise((
|
|
899
|
+
return new Promise((resolve8) => {
|
|
900
900
|
try {
|
|
901
901
|
const command = getOpenCommand(options.url);
|
|
902
902
|
logger2.debug("[Browser] Opening URL", { url: options.url, command });
|
|
@@ -906,13 +906,13 @@ async function openBrowserUrl(options) {
|
|
|
906
906
|
url: options.url,
|
|
907
907
|
error: error.message
|
|
908
908
|
});
|
|
909
|
-
|
|
909
|
+
resolve8({
|
|
910
910
|
opened: false,
|
|
911
911
|
error: error.message
|
|
912
912
|
});
|
|
913
913
|
} else {
|
|
914
914
|
logger2.info("[Browser] URL opened successfully", { url: options.url });
|
|
915
|
-
|
|
915
|
+
resolve8({ opened: true });
|
|
916
916
|
}
|
|
917
917
|
});
|
|
918
918
|
} catch (error) {
|
|
@@ -921,7 +921,7 @@ async function openBrowserUrl(options) {
|
|
|
921
921
|
url: options.url,
|
|
922
922
|
error: errorMessage
|
|
923
923
|
});
|
|
924
|
-
|
|
924
|
+
resolve8({
|
|
925
925
|
opened: false,
|
|
926
926
|
error: errorMessage
|
|
927
927
|
});
|
|
@@ -2558,9 +2558,9 @@ function resetAuthService() {
|
|
|
2558
2558
|
serviceInstance2 = null;
|
|
2559
2559
|
}
|
|
2560
2560
|
function sleep(params) {
|
|
2561
|
-
return new Promise((
|
|
2561
|
+
return new Promise((resolve8) => {
|
|
2562
2562
|
setTimeout(() => {
|
|
2563
|
-
|
|
2563
|
+
resolve8();
|
|
2564
2564
|
}, params.durationMs);
|
|
2565
2565
|
});
|
|
2566
2566
|
}
|
|
@@ -3410,13 +3410,13 @@ var lookUpCheckoutPullRequest = async (cwd) => {
|
|
|
3410
3410
|
return pullRequest;
|
|
3411
3411
|
};
|
|
3412
3412
|
function runGhPrView(cwd) {
|
|
3413
|
-
return new Promise((
|
|
3413
|
+
return new Promise((resolve8) => {
|
|
3414
3414
|
execFile(
|
|
3415
3415
|
"gh",
|
|
3416
3416
|
["pr", "view", "--json", "number,url,createdAt,state"],
|
|
3417
3417
|
{ cwd, timeout: PR_LOOKUP_TIMEOUT_MS, windowsHide: true, encoding: "utf-8" },
|
|
3418
3418
|
(error, stdout) => {
|
|
3419
|
-
|
|
3419
|
+
resolve8(error ? null : stdout);
|
|
3420
3420
|
}
|
|
3421
3421
|
);
|
|
3422
3422
|
});
|
|
@@ -3639,8 +3639,8 @@ async function readLocalExecutionLockState() {
|
|
|
3639
3639
|
// packages/mcps/src/mcp/local/services/spawn-failure-message.ts
|
|
3640
3640
|
function describeElectronSpawnFailure(params) {
|
|
3641
3641
|
const base = `Failed to start electron-app: ${params.error.message}`;
|
|
3642
|
-
const
|
|
3643
|
-
const blockedByAppControl =
|
|
3642
|
+
const platform10 = params.platform ?? process.platform;
|
|
3643
|
+
const blockedByAppControl = platform10 === "win32" && (params.error.code === "UNKNOWN" || params.error.code === "EPERM");
|
|
3644
3644
|
if (!blockedByAppControl) {
|
|
3645
3645
|
return base;
|
|
3646
3646
|
}
|
|
@@ -4014,7 +4014,7 @@ async function executeElectronAppAsync(params) {
|
|
|
4014
4014
|
capturedStderr: ""
|
|
4015
4015
|
};
|
|
4016
4016
|
activeProcesses.set(params.runId, processInfo);
|
|
4017
|
-
return await new Promise((
|
|
4017
|
+
return await new Promise((resolve8, reject) => {
|
|
4018
4018
|
const finalize = (result) => {
|
|
4019
4019
|
if (processInfo.hasSettled) {
|
|
4020
4020
|
return;
|
|
@@ -4031,7 +4031,7 @@ async function executeElectronAppAsync(params) {
|
|
|
4031
4031
|
void ensureTempDir().then((tempDir) => removeStopRequestFileAsync({ tempDir, runId: params.runId }));
|
|
4032
4032
|
}
|
|
4033
4033
|
if (result.ok) {
|
|
4034
|
-
|
|
4034
|
+
resolve8(result.payload);
|
|
4035
4035
|
} else {
|
|
4036
4036
|
reject(result.payload);
|
|
4037
4037
|
}
|
|
@@ -4502,13 +4502,13 @@ var BRANCH_CREATION_REFLOG_PREFIX = "branch: Created from ";
|
|
|
4502
4502
|
var SHORT_SHA_LENGTH = 7;
|
|
4503
4503
|
var MAX_LISTED_INHERITED_COMMITS = 20;
|
|
4504
4504
|
var GIT_COMMAND_TIMEOUT_MS = 3e4;
|
|
4505
|
-
var runGitCommand = (args, cwd) => new Promise((
|
|
4505
|
+
var runGitCommand = (args, cwd) => new Promise((resolve8) => {
|
|
4506
4506
|
execFile(
|
|
4507
4507
|
"git",
|
|
4508
4508
|
args,
|
|
4509
4509
|
{ cwd, timeout: GIT_COMMAND_TIMEOUT_MS, windowsHide: true, encoding: "utf-8" },
|
|
4510
4510
|
(error, stdout) => {
|
|
4511
|
-
|
|
4511
|
+
resolve8(error ? null : stdout.trim());
|
|
4512
4512
|
}
|
|
4513
4513
|
);
|
|
4514
4514
|
});
|
|
@@ -4768,9 +4768,9 @@ function isValid2(value) {
|
|
|
4768
4768
|
function readReleaseManifest2() {
|
|
4769
4769
|
if (cachedManifest2 !== void 0)
|
|
4770
4770
|
return cachedManifest2;
|
|
4771
|
-
const
|
|
4771
|
+
const path25 = MANIFEST_PATH2;
|
|
4772
4772
|
try {
|
|
4773
|
-
const raw = readFileSync(
|
|
4773
|
+
const raw = readFileSync(path25, "utf8");
|
|
4774
4774
|
const parsed = JSON.parse(raw);
|
|
4775
4775
|
cachedManifest2 = isValid2(parsed) ? parsed : DEV_MANIFEST2;
|
|
4776
4776
|
return cachedManifest2;
|
|
@@ -5060,6 +5060,225 @@ function isWorkflowEventType(eventType) {
|
|
|
5060
5060
|
return Object.values(WorkflowEventType).includes(eventType);
|
|
5061
5061
|
}
|
|
5062
5062
|
|
|
5063
|
+
// packages/mcps/src/shared/bug-report/bug-report-constants.ts
|
|
5064
|
+
var BUG_REPORTS_PATH = "/v1/protected/bug-reports";
|
|
5065
|
+
var BUG_REPORT_PAYLOAD_FIELD = "payload";
|
|
5066
|
+
var BUG_REPORT_REPLY_MESSAGE_FIELD = "message";
|
|
5067
|
+
var BUG_REPORT_SCREENSHOTS_FIELD = "screenshots";
|
|
5068
|
+
var BUG_REPORT_MAX_SCREENSHOTS = 5;
|
|
5069
|
+
var BUG_REPORT_MAX_SCREENSHOT_BYTES = 5 * 1024 * 1024;
|
|
5070
|
+
var BUG_REPORT_SCREENSHOT_CONTENT_TYPES = {
|
|
5071
|
+
".png": "image/png",
|
|
5072
|
+
".jpg": "image/jpeg",
|
|
5073
|
+
".jpeg": "image/jpeg",
|
|
5074
|
+
".gif": "image/gif",
|
|
5075
|
+
".webp": "image/webp"
|
|
5076
|
+
};
|
|
5077
|
+
var BUG_REPORT_LIST_MAX_PAGE_SIZE = 50;
|
|
5078
|
+
var BUG_REPORT_TITLE_MAX_LENGTH = 200;
|
|
5079
|
+
var BUG_REPORT_TEXT_MAX_LENGTH = 1e4;
|
|
5080
|
+
var BUG_REPORT_MESSAGE_MAX_LENGTH = 5e3;
|
|
5081
|
+
var BUG_REPORT_CONTEXT_VALUE_MAX_LENGTH = 500;
|
|
5082
|
+
var BUG_REPORT_SHORT_ID_PATTERN = /^BUG-\d+$/i;
|
|
5083
|
+
var BUG_REPORT_CLIENT_CONTEXT_FIELDS = [
|
|
5084
|
+
"pagePath",
|
|
5085
|
+
"userAgent",
|
|
5086
|
+
"workspaceId",
|
|
5087
|
+
"projectId",
|
|
5088
|
+
"uiRelease",
|
|
5089
|
+
"cliVersion",
|
|
5090
|
+
"studioVersion",
|
|
5091
|
+
"os",
|
|
5092
|
+
"lastProjectId",
|
|
5093
|
+
"lastLocalRunId",
|
|
5094
|
+
"lastLocalRunStatus"
|
|
5095
|
+
];
|
|
5096
|
+
var BUG_REPORT_SECRET_VALUE_PATTERNS = [
|
|
5097
|
+
/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]*/,
|
|
5098
|
+
/\bbearer\s+\S+/i,
|
|
5099
|
+
/\b(password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|auth|credential|session)s?\s*[=:]/i,
|
|
5100
|
+
/[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/i,
|
|
5101
|
+
/\b(sk|pk|rk)_(live|test)_[A-Za-z0-9]{8,}/,
|
|
5102
|
+
/\bgh[pousr]_[A-Za-z0-9]{20,}/,
|
|
5103
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}/,
|
|
5104
|
+
/\bxox[abprs]-[A-Za-z0-9-]{10,}/,
|
|
5105
|
+
/\bAKIA[0-9A-Z]{16}\b/,
|
|
5106
|
+
/\bAIza[0-9A-Za-z_-]{35}\b/,
|
|
5107
|
+
/-----BEGIN [A-Z ]*PRIVATE KEY-----/,
|
|
5108
|
+
/\b(?=[A-Za-z0-9_]*\d)(?=[A-Za-z0-9_]*[A-Za-z])[A-Za-z0-9_]{32,}\b/
|
|
5109
|
+
];
|
|
5110
|
+
|
|
5111
|
+
// packages/mcps/src/shared/bug-report/bug-report-client-context.ts
|
|
5112
|
+
function isSecretLikeValue(candidateValue) {
|
|
5113
|
+
return BUG_REPORT_SECRET_VALUE_PATTERNS.some((secretPattern) => secretPattern.test(candidateValue));
|
|
5114
|
+
}
|
|
5115
|
+
function sanitizeBugReportClientContext(rawClientContext) {
|
|
5116
|
+
const clientContext = {};
|
|
5117
|
+
const strippedFieldNames = [];
|
|
5118
|
+
if (rawClientContext === null || typeof rawClientContext !== "object") {
|
|
5119
|
+
return { clientContext, strippedFieldNames };
|
|
5120
|
+
}
|
|
5121
|
+
const rawFields = rawClientContext;
|
|
5122
|
+
for (const fieldName of BUG_REPORT_CLIENT_CONTEXT_FIELDS) {
|
|
5123
|
+
const fieldValue = rawFields[fieldName];
|
|
5124
|
+
if (typeof fieldValue !== "string" || fieldValue.trim() === "") {
|
|
5125
|
+
continue;
|
|
5126
|
+
}
|
|
5127
|
+
if (isSecretLikeValue(fieldValue)) {
|
|
5128
|
+
strippedFieldNames.push(fieldName);
|
|
5129
|
+
continue;
|
|
5130
|
+
}
|
|
5131
|
+
clientContext[fieldName] = fieldValue.trim().slice(0, BUG_REPORT_CONTEXT_VALUE_MAX_LENGTH);
|
|
5132
|
+
}
|
|
5133
|
+
return { clientContext, strippedFieldNames };
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
// packages/mcps/src/shared/bug-report/bug-report-types.ts
|
|
5137
|
+
var BugReportSeverityEnum = /* @__PURE__ */ ((BugReportSeverityEnum2) => {
|
|
5138
|
+
BugReportSeverityEnum2["Blocker"] = "blocker";
|
|
5139
|
+
BugReportSeverityEnum2["Major"] = "major";
|
|
5140
|
+
BugReportSeverityEnum2["Minor"] = "minor";
|
|
5141
|
+
return BugReportSeverityEnum2;
|
|
5142
|
+
})(BugReportSeverityEnum || {});
|
|
5143
|
+
|
|
5144
|
+
// packages/mcps/src/shared/cwd-keyed-cache-constants.ts
|
|
5145
|
+
var CWD_KEYED_CACHE_VERSION = 1;
|
|
5146
|
+
var LEGACY_CACHE_DIR_NAME = ".muggle-ai";
|
|
5147
|
+
var MUGGLE_HOME_DISPLAY_DIR = "~/.muggle-ai";
|
|
5148
|
+
|
|
5149
|
+
// packages/mcps/src/shared/cwd-keyed-cache.ts
|
|
5150
|
+
function resolveHomeFilePath(cache) {
|
|
5151
|
+
return path17.join(getDataDir(), cache.fileName);
|
|
5152
|
+
}
|
|
5153
|
+
function resolveLegacyFilePath(cache, cwd) {
|
|
5154
|
+
return path17.join(cwd, LEGACY_CACHE_DIR_NAME, cache.fileName);
|
|
5155
|
+
}
|
|
5156
|
+
function parseJsonFile(filePath) {
|
|
5157
|
+
try {
|
|
5158
|
+
if (!fs4.existsSync(filePath)) {
|
|
5159
|
+
return null;
|
|
5160
|
+
}
|
|
5161
|
+
return JSON.parse(fs4.readFileSync(filePath, "utf-8"));
|
|
5162
|
+
} catch (error) {
|
|
5163
|
+
getLogger().warn("Failed to read cache file", {
|
|
5164
|
+
path: filePath,
|
|
5165
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5166
|
+
});
|
|
5167
|
+
return null;
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
function readHomeEntries(cache) {
|
|
5171
|
+
const parsed = parseJsonFile(resolveHomeFilePath(cache));
|
|
5172
|
+
return parsed?.entries ?? {};
|
|
5173
|
+
}
|
|
5174
|
+
function writeHomeEntries(cache, entries) {
|
|
5175
|
+
fs4.mkdirSync(getDataDir(), { recursive: true });
|
|
5176
|
+
const file = {
|
|
5177
|
+
version: CWD_KEYED_CACHE_VERSION,
|
|
5178
|
+
entries
|
|
5179
|
+
};
|
|
5180
|
+
fs4.writeFileSync(
|
|
5181
|
+
resolveHomeFilePath(cache),
|
|
5182
|
+
`${JSON.stringify(file, null, 2)}
|
|
5183
|
+
`,
|
|
5184
|
+
"utf-8"
|
|
5185
|
+
);
|
|
5186
|
+
}
|
|
5187
|
+
function readLegacyEntry(cache, cwd) {
|
|
5188
|
+
const parsed = parseJsonFile(
|
|
5189
|
+
resolveLegacyFilePath(cache, cwd)
|
|
5190
|
+
);
|
|
5191
|
+
return parsed?.[cache.legacyEntryKey] ?? null;
|
|
5192
|
+
}
|
|
5193
|
+
function readCwdEntry(cache, cwd) {
|
|
5194
|
+
const cwdKey = path17.resolve(cwd);
|
|
5195
|
+
const entries = readHomeEntries(cache);
|
|
5196
|
+
const homeEntry = entries[cwdKey];
|
|
5197
|
+
if (homeEntry) {
|
|
5198
|
+
return homeEntry;
|
|
5199
|
+
}
|
|
5200
|
+
const legacyEntry = readLegacyEntry(cache, cwd);
|
|
5201
|
+
if (!legacyEntry) {
|
|
5202
|
+
return null;
|
|
5203
|
+
}
|
|
5204
|
+
try {
|
|
5205
|
+
writeHomeEntries(cache, { ...entries, [cwdKey]: legacyEntry });
|
|
5206
|
+
} catch (error) {
|
|
5207
|
+
getLogger().warn("Failed to migrate cache entry to the home directory", {
|
|
5208
|
+
path: resolveHomeFilePath(cache),
|
|
5209
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5210
|
+
});
|
|
5211
|
+
}
|
|
5212
|
+
return legacyEntry;
|
|
5213
|
+
}
|
|
5214
|
+
function writeCwdEntry(cache, cwd, entry) {
|
|
5215
|
+
const entries = readHomeEntries(cache);
|
|
5216
|
+
writeHomeEntries(cache, { ...entries, [path17.resolve(cwd)]: entry });
|
|
5217
|
+
}
|
|
5218
|
+
function clearCwdEntry(cache, cwd) {
|
|
5219
|
+
const entries = readHomeEntries(cache);
|
|
5220
|
+
const cwdKey = path17.resolve(cwd);
|
|
5221
|
+
if (cwdKey in entries) {
|
|
5222
|
+
delete entries[cwdKey];
|
|
5223
|
+
writeHomeEntries(cache, entries);
|
|
5224
|
+
}
|
|
5225
|
+
const legacyFilePath = resolveLegacyFilePath(cache, cwd);
|
|
5226
|
+
if (fs4.existsSync(legacyFilePath)) {
|
|
5227
|
+
fs4.unlinkSync(legacyFilePath);
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
// packages/mcps/src/shared/last-project-constants.ts
|
|
5232
|
+
var LAST_PROJECT_FILE_NAME = "last-project.json";
|
|
5233
|
+
var LAST_PROJECT_CACHE = {
|
|
5234
|
+
fileName: LAST_PROJECT_FILE_NAME,
|
|
5235
|
+
legacyEntryKey: "lastProject"
|
|
5236
|
+
};
|
|
5237
|
+
|
|
5238
|
+
// packages/mcps/src/shared/last-project.ts
|
|
5239
|
+
function readLastProject(cwd) {
|
|
5240
|
+
return readCwdEntry(LAST_PROJECT_CACHE, cwd);
|
|
5241
|
+
}
|
|
5242
|
+
function writeLastProject(cwd, lastProject) {
|
|
5243
|
+
writeCwdEntry(LAST_PROJECT_CACHE, cwd, {
|
|
5244
|
+
...lastProject,
|
|
5245
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5246
|
+
});
|
|
5247
|
+
}
|
|
5248
|
+
function clearLastProject(cwd) {
|
|
5249
|
+
clearCwdEntry(LAST_PROJECT_CACHE, cwd);
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
// packages/mcps/src/mcp/local/services/bug-report-context.ts
|
|
5253
|
+
function readOptionalSource(sourceName, readSource) {
|
|
5254
|
+
try {
|
|
5255
|
+
return readSource();
|
|
5256
|
+
} catch (error) {
|
|
5257
|
+
getLogger().warn("Bug report context source unavailable", {
|
|
5258
|
+
sourceName,
|
|
5259
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5260
|
+
});
|
|
5261
|
+
return void 0;
|
|
5262
|
+
}
|
|
5263
|
+
}
|
|
5264
|
+
function collectBugReportClientContext(params) {
|
|
5265
|
+
const newestLocalRun = readOptionalSource("runResults", () => getRunResultStorageService().listRunResults()[0]);
|
|
5266
|
+
return sanitizeBugReportClientContext({
|
|
5267
|
+
cliVersion: readOptionalSource("cliVersion", () => getConfig().serverVersion),
|
|
5268
|
+
studioVersion: readOptionalSource(
|
|
5269
|
+
"studioVersion",
|
|
5270
|
+
() => buildElectronAppDirName({
|
|
5271
|
+
version: getElectronAppVersion(),
|
|
5272
|
+
releaseStream: getActiveElectronAppReleaseStream()
|
|
5273
|
+
})
|
|
5274
|
+
),
|
|
5275
|
+
os: readOptionalSource("os", () => `${os4.platform()} ${os4.release()} ${os4.arch()}`),
|
|
5276
|
+
lastProjectId: readOptionalSource("lastProject", () => readLastProject(params.cwd)?.projectId),
|
|
5277
|
+
lastLocalRunId: newestLocalRun?.id,
|
|
5278
|
+
lastLocalRunStatus: newestLocalRun?.status
|
|
5279
|
+
});
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5063
5282
|
// packages/mcps/src/shared/auth.ts
|
|
5064
5283
|
var logger6 = getLogger();
|
|
5065
5284
|
async function startDeviceCodeFlow(config, options) {
|
|
@@ -5565,7 +5784,7 @@ function isProcessAlive(pid) {
|
|
|
5565
5784
|
}
|
|
5566
5785
|
}
|
|
5567
5786
|
async function sleep2(ms) {
|
|
5568
|
-
await new Promise((
|
|
5787
|
+
await new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
5569
5788
|
}
|
|
5570
5789
|
|
|
5571
5790
|
// packages/mcps/src/shared/service-stack/port-listener-constants.ts
|
|
@@ -5647,18 +5866,18 @@ async function readPosixPortListener(port) {
|
|
|
5647
5866
|
return { isReadable: true, listener };
|
|
5648
5867
|
}
|
|
5649
5868
|
function runListenerTool(command, args) {
|
|
5650
|
-
return new Promise((
|
|
5869
|
+
return new Promise((resolve8) => {
|
|
5651
5870
|
execFile(
|
|
5652
5871
|
command,
|
|
5653
5872
|
args,
|
|
5654
5873
|
{ timeout: PORT_LISTENER_COMMAND_TIMEOUT_MS, windowsHide: true, encoding: "utf-8" },
|
|
5655
5874
|
(error, stdout) => {
|
|
5656
5875
|
if (error === null) {
|
|
5657
|
-
|
|
5876
|
+
resolve8({ exitCode: 0, stdout });
|
|
5658
5877
|
} else if (typeof error.code === "number" && !error.killed) {
|
|
5659
|
-
|
|
5878
|
+
resolve8({ exitCode: error.code, stdout });
|
|
5660
5879
|
} else {
|
|
5661
|
-
|
|
5880
|
+
resolve8(null);
|
|
5662
5881
|
}
|
|
5663
5882
|
}
|
|
5664
5883
|
);
|
|
@@ -5677,8 +5896,8 @@ async function stopProcessTree(pid) {
|
|
|
5677
5896
|
}
|
|
5678
5897
|
}
|
|
5679
5898
|
function runStopCommand(command, args) {
|
|
5680
|
-
return new Promise((
|
|
5681
|
-
execFile(command, args, { timeout: SERVICE_STOP_COMMAND_TIMEOUT_MS, windowsHide: true }, () =>
|
|
5899
|
+
return new Promise((resolve8) => {
|
|
5900
|
+
execFile(command, args, { timeout: SERVICE_STOP_COMMAND_TIMEOUT_MS, windowsHide: true }, () => resolve8());
|
|
5682
5901
|
});
|
|
5683
5902
|
}
|
|
5684
5903
|
|
|
@@ -6272,7 +6491,7 @@ function shortSha2(sha) {
|
|
|
6272
6491
|
return sha.slice(0, 7);
|
|
6273
6492
|
}
|
|
6274
6493
|
async function sleep3(ms) {
|
|
6275
|
-
await new Promise((
|
|
6494
|
+
await new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
6276
6495
|
}
|
|
6277
6496
|
|
|
6278
6497
|
// packages/mcps/src/shared/service-stack/stack-mismatch-description.ts
|
|
@@ -6379,12 +6598,22 @@ var SCRIPT_DETAILS_MODAL_VALUE = "script-details";
|
|
|
6379
6598
|
var SCRIPTS_MODAL_TEST_CASE_ID_KEY = "testCaseId";
|
|
6380
6599
|
var SCRIPTS_MODAL_ACTION_SCRIPT_ID_KEY = "actionScriptId";
|
|
6381
6600
|
var DASHBOARD_URL_FIELD = "dashboardUrl";
|
|
6601
|
+
var DASHBOARD_PROJECTS_SEGMENT = "/projects";
|
|
6602
|
+
var DASHBOARD_BUG_REPORTS_SEGMENT = "/bug-reports";
|
|
6382
6603
|
|
|
6383
6604
|
// packages/mcps/src/shared/dashboard-link/dashboard-link.ts
|
|
6605
|
+
function buildBugReportsUrl(dashboardBaseUrl) {
|
|
6606
|
+
const dashboardRootUrl = dashboardBaseUrl.endsWith(DASHBOARD_PROJECTS_SEGMENT) ? dashboardBaseUrl.slice(0, -DASHBOARD_PROJECTS_SEGMENT.length) : dashboardBaseUrl;
|
|
6607
|
+
return `${dashboardRootUrl}${DASHBOARD_BUG_REPORTS_SEGMENT}`;
|
|
6608
|
+
}
|
|
6384
6609
|
function buildDashboardUrl(target, dashboardBaseUrl = getDashboardBaseUrl()) {
|
|
6385
6610
|
if (target.page === "projects" /* Projects */) {
|
|
6386
6611
|
return dashboardBaseUrl;
|
|
6387
6612
|
}
|
|
6613
|
+
if (target.page === "bug-reports" /* BugReports */ || target.page === "bug-report" /* BugReport */) {
|
|
6614
|
+
const bugReportsUrl = buildBugReportsUrl(dashboardBaseUrl);
|
|
6615
|
+
return target.page === "bug-report" /* BugReport */ ? `${bugReportsUrl}/${encodeURIComponent(target.bugReportId)}` : bugReportsUrl;
|
|
6616
|
+
}
|
|
6388
6617
|
const projectUrl = `${dashboardBaseUrl}/${encodeURIComponent(target.projectId)}`;
|
|
6389
6618
|
if (target.page === "script-details" /* ScriptDetails */) {
|
|
6390
6619
|
const query = new URLSearchParams({
|
|
@@ -6778,6 +7007,48 @@ var TestCaseDisplayResolutionsUpdateInputSchema = TestCaseDisplayResolutionsGetI
|
|
|
6778
7007
|
"Run strategy across the test case's resolutions: primaryOnly, primaryFirst or allAtOnce. null returns the test case to the project lane's strategy; omit to keep the current one."
|
|
6779
7008
|
)
|
|
6780
7009
|
});
|
|
7010
|
+
var BugReportIdSchema = z.string().trim().min(1).refine((bugReportId) => !BUG_REPORT_SHORT_ID_PATTERN.test(bugReportId), {
|
|
7011
|
+
message: "Pass the bugReportId, not a short id like BUG-4821; find it by shortId with muggle-remote-bug-report-list."
|
|
7012
|
+
}).describe("Bug report ID (bugReportId from create or list), not the short id shown to people");
|
|
7013
|
+
var BugReportTextSchema = z.string().trim().min(1).max(BUG_REPORT_TEXT_MAX_LENGTH);
|
|
7014
|
+
var BugReportScreenshotPathsSchema = z.array(z.string().min(1)).max(BUG_REPORT_MAX_SCREENSHOTS).optional().describe(
|
|
7015
|
+
`Absolute paths of up to ${BUG_REPORT_MAX_SCREENSHOTS} screenshots on this machine (png, jpg, gif or webp, at most 5 MB each). They are read from disk and uploaded with the report.`
|
|
7016
|
+
);
|
|
7017
|
+
var BugReportClientContextInputSchema = z.object({
|
|
7018
|
+
pagePath: z.string().optional(),
|
|
7019
|
+
userAgent: z.string().optional(),
|
|
7020
|
+
workspaceId: z.string().optional(),
|
|
7021
|
+
projectId: z.string().optional(),
|
|
7022
|
+
uiRelease: z.string().optional(),
|
|
7023
|
+
cliVersion: z.string().optional(),
|
|
7024
|
+
studioVersion: z.string().optional(),
|
|
7025
|
+
os: z.string().optional(),
|
|
7026
|
+
lastProjectId: z.string().optional(),
|
|
7027
|
+
lastLocalRunId: z.string().optional(),
|
|
7028
|
+
lastLocalRunStatus: z.string().optional()
|
|
7029
|
+
}).describe("Context captured where the bug was hit; pass data.clientContext from muggle-local-bug-report-context-get");
|
|
7030
|
+
var BugReportCreateInputSchema = z.object({
|
|
7031
|
+
title: z.string().trim().min(1).max(BUG_REPORT_TITLE_MAX_LENGTH).describe("One-line summary of the bug"),
|
|
7032
|
+
description: BugReportTextSchema.describe("What happened, in the user's words"),
|
|
7033
|
+
severity: z.nativeEnum(BugReportSeverityEnum).describe("The user's call: blocker (cannot continue), major (works around it with effort), minor (cosmetic or small)"),
|
|
7034
|
+
stepsToReproduce: BugReportTextSchema.optional().describe("Steps that make the bug happen"),
|
|
7035
|
+
expectedBehavior: BugReportTextSchema.optional().describe("What the user expected"),
|
|
7036
|
+
actualBehavior: BugReportTextSchema.optional().describe("What happened instead"),
|
|
7037
|
+
screenshotPaths: BugReportScreenshotPathsSchema,
|
|
7038
|
+
clientContext: BugReportClientContextInputSchema.optional()
|
|
7039
|
+
});
|
|
7040
|
+
var BugReportListInputSchema = z.object({
|
|
7041
|
+
pageSize: z.number().int().min(1).max(BUG_REPORT_LIST_MAX_PAGE_SIZE).optional().describe(`Reports per page, at most ${BUG_REPORT_LIST_MAX_PAGE_SIZE}`),
|
|
7042
|
+
cursor: z.string().min(1).optional().describe("nextCursor from the previous page")
|
|
7043
|
+
});
|
|
7044
|
+
var BugReportGetInputSchema = z.object({
|
|
7045
|
+
bugReportId: BugReportIdSchema
|
|
7046
|
+
});
|
|
7047
|
+
var BugReportReplyInputSchema = z.object({
|
|
7048
|
+
bugReportId: BugReportIdSchema,
|
|
7049
|
+
message: z.string().trim().min(1).max(BUG_REPORT_MESSAGE_MAX_LENGTH).describe("The user's reply on the ticket"),
|
|
7050
|
+
screenshotPaths: BugReportScreenshotPathsSchema
|
|
7051
|
+
});
|
|
6781
7052
|
|
|
6782
7053
|
// packages/mcps/src/mcp/e2e/contracts/index.ts
|
|
6783
7054
|
var PaginationInputSchema = z.object({
|
|
@@ -7360,6 +7631,7 @@ var ALLOWED_UPSTREAM_PREFIXES = [
|
|
|
7360
7631
|
"/v1/protected/wallet/",
|
|
7361
7632
|
"/v1/protected/api-keys",
|
|
7362
7633
|
"/v1/protected/actionScript/",
|
|
7634
|
+
BUG_REPORTS_PATH,
|
|
7363
7635
|
// Only the caller's own membership read: the organization admin routes stay out of an agent's reach.
|
|
7364
7636
|
"/v1/protected/organizations/my-organizations"
|
|
7365
7637
|
];
|
|
@@ -7382,17 +7654,17 @@ var PromptServiceClient = class {
|
|
|
7382
7654
|
* @param path - Path to validate.
|
|
7383
7655
|
* @throws GatewayError if path is not allowed.
|
|
7384
7656
|
*/
|
|
7385
|
-
validatePath(
|
|
7386
|
-
const isAllowed = PUBLIC_UPSTREAM_PATHS.includes(
|
|
7657
|
+
validatePath(path25) {
|
|
7658
|
+
const isAllowed = PUBLIC_UPSTREAM_PATHS.includes(path25) || ALLOWED_UPSTREAM_PREFIXES.some((prefix) => path25.startsWith(prefix));
|
|
7387
7659
|
if (!isAllowed) {
|
|
7388
7660
|
const logger7 = getLogger();
|
|
7389
7661
|
logger7.error("Path not in allowlist", {
|
|
7390
|
-
path:
|
|
7662
|
+
path: path25,
|
|
7391
7663
|
allowedPrefixes: ALLOWED_UPSTREAM_PREFIXES
|
|
7392
7664
|
});
|
|
7393
7665
|
throw new GatewayError({
|
|
7394
7666
|
code: "FORBIDDEN" /* FORBIDDEN */,
|
|
7395
|
-
message: `Path '${
|
|
7667
|
+
message: `Path '${path25}' is not allowed`
|
|
7396
7668
|
});
|
|
7397
7669
|
}
|
|
7398
7670
|
}
|
|
@@ -7436,18 +7708,22 @@ var PromptServiceClient = class {
|
|
|
7436
7708
|
return entries.length > 0 ? `?${entries.join("&")}` : "";
|
|
7437
7709
|
}
|
|
7438
7710
|
/**
|
|
7439
|
-
* Build the multipart body for
|
|
7440
|
-
* @param multipartFormData -
|
|
7441
|
-
* @returns Form data holding
|
|
7711
|
+
* Build the multipart body for an upload.
|
|
7712
|
+
* @param multipartFormData - Text fields and file parts to send, file bytes base64-encoded.
|
|
7713
|
+
* @returns Form data holding each text field, then each decoded file under its field name.
|
|
7442
7714
|
*/
|
|
7443
7715
|
buildMultipartBody(multipartFormData) {
|
|
7444
7716
|
const uploadForm = new FormData();
|
|
7445
|
-
const
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7717
|
+
for (const [fieldName, fieldValue] of Object.entries(multipartFormData.textFields ?? {})) {
|
|
7718
|
+
uploadForm.append(fieldName, fieldValue);
|
|
7719
|
+
}
|
|
7720
|
+
for (const multipartFile of multipartFormData.files) {
|
|
7721
|
+
uploadForm.append(
|
|
7722
|
+
multipartFile.fieldName,
|
|
7723
|
+
new Blob([Buffer.from(multipartFile.fileBase64, "base64")], { type: multipartFile.contentType }),
|
|
7724
|
+
multipartFile.fileName
|
|
7725
|
+
);
|
|
7726
|
+
}
|
|
7451
7727
|
return uploadForm;
|
|
7452
7728
|
}
|
|
7453
7729
|
/**
|
|
@@ -7723,6 +7999,78 @@ async function resolveFieldAsync(params) {
|
|
|
7723
7999
|
}
|
|
7724
8000
|
return resolvedId;
|
|
7725
8001
|
}
|
|
8002
|
+
function rejectScreenshot(screenshotPath, reason) {
|
|
8003
|
+
throw new GatewayError({
|
|
8004
|
+
code: "INVALID_ARGUMENT" /* INVALID_ARGUMENT */,
|
|
8005
|
+
message: `Screenshot ${screenshotPath} ${reason}`
|
|
8006
|
+
});
|
|
8007
|
+
}
|
|
8008
|
+
function readBugReportScreenshotFiles(screenshotPaths) {
|
|
8009
|
+
if (screenshotPaths.length > BUG_REPORT_MAX_SCREENSHOTS) {
|
|
8010
|
+
throw new GatewayError({
|
|
8011
|
+
code: "INVALID_ARGUMENT" /* INVALID_ARGUMENT */,
|
|
8012
|
+
message: `At most ${BUG_REPORT_MAX_SCREENSHOTS} screenshots may be attached; got ${screenshotPaths.length}.`
|
|
8013
|
+
});
|
|
8014
|
+
}
|
|
8015
|
+
return screenshotPaths.map((screenshotPath) => {
|
|
8016
|
+
const resolvedPath = path17.resolve(screenshotPath);
|
|
8017
|
+
const contentType = BUG_REPORT_SCREENSHOT_CONTENT_TYPES[path17.extname(resolvedPath).toLowerCase()];
|
|
8018
|
+
if (!contentType) {
|
|
8019
|
+
rejectScreenshot(screenshotPath, `is not an image; attach ${Object.keys(BUG_REPORT_SCREENSHOT_CONTENT_TYPES).join(", ")} files only.`);
|
|
8020
|
+
}
|
|
8021
|
+
let screenshotStats;
|
|
8022
|
+
try {
|
|
8023
|
+
screenshotStats = fs4.statSync(resolvedPath);
|
|
8024
|
+
} catch {
|
|
8025
|
+
rejectScreenshot(screenshotPath, "was not found.");
|
|
8026
|
+
}
|
|
8027
|
+
if (!screenshotStats.isFile()) {
|
|
8028
|
+
rejectScreenshot(screenshotPath, "is not a file.");
|
|
8029
|
+
}
|
|
8030
|
+
if (screenshotStats.size === 0) {
|
|
8031
|
+
rejectScreenshot(screenshotPath, "is empty.");
|
|
8032
|
+
}
|
|
8033
|
+
if (screenshotStats.size > BUG_REPORT_MAX_SCREENSHOT_BYTES) {
|
|
8034
|
+
rejectScreenshot(screenshotPath, `is larger than ${BUG_REPORT_MAX_SCREENSHOT_BYTES / (1024 * 1024)} MB.`);
|
|
8035
|
+
}
|
|
8036
|
+
return {
|
|
8037
|
+
fieldName: BUG_REPORT_SCREENSHOTS_FIELD,
|
|
8038
|
+
fileName: path17.basename(resolvedPath),
|
|
8039
|
+
contentType,
|
|
8040
|
+
fileBase64: fs4.readFileSync(resolvedPath).toString("base64")
|
|
8041
|
+
};
|
|
8042
|
+
});
|
|
8043
|
+
}
|
|
8044
|
+
function buildBugReportCreateCall(toolInput) {
|
|
8045
|
+
const reportPayload = {
|
|
8046
|
+
title: toolInput.title,
|
|
8047
|
+
description: toolInput.description,
|
|
8048
|
+
severity: toolInput.severity,
|
|
8049
|
+
stepsToReproduce: toolInput.stepsToReproduce,
|
|
8050
|
+
expectedBehavior: toolInput.expectedBehavior,
|
|
8051
|
+
actualBehavior: toolInput.actualBehavior,
|
|
8052
|
+
source: "harness" /* Harness */,
|
|
8053
|
+
clientContext: sanitizeBugReportClientContext(toolInput.clientContext).clientContext
|
|
8054
|
+
};
|
|
8055
|
+
return {
|
|
8056
|
+
method: "POST",
|
|
8057
|
+
path: BUG_REPORTS_PATH,
|
|
8058
|
+
multipartFormData: {
|
|
8059
|
+
textFields: { [BUG_REPORT_PAYLOAD_FIELD]: JSON.stringify(reportPayload) },
|
|
8060
|
+
files: readBugReportScreenshotFiles(toolInput.screenshotPaths ?? [])
|
|
8061
|
+
}
|
|
8062
|
+
};
|
|
8063
|
+
}
|
|
8064
|
+
function buildBugReportReplyCall(toolInput) {
|
|
8065
|
+
return {
|
|
8066
|
+
method: "POST",
|
|
8067
|
+
path: `${BUG_REPORTS_PATH}/${encodeURIComponent(toolInput.bugReportId)}/replies`,
|
|
8068
|
+
multipartFormData: {
|
|
8069
|
+
textFields: { [BUG_REPORT_REPLY_MESSAGE_FIELD]: toolInput.message },
|
|
8070
|
+
files: readBugReportScreenshotFiles(toolInput.screenshotPaths ?? [])
|
|
8071
|
+
}
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
7726
8074
|
|
|
7727
8075
|
// packages/mcps/src/mcp/tools/e2e/dashboard-link-targets.ts
|
|
7728
8076
|
function readStringField(source, key) {
|
|
@@ -7769,6 +8117,17 @@ function linkToFetchedTestScript(_input, response) {
|
|
|
7769
8117
|
...actionScriptId ? { actionScriptId } : {}
|
|
7770
8118
|
};
|
|
7771
8119
|
}
|
|
8120
|
+
function linkToBugReports() {
|
|
8121
|
+
return { page: "bug-reports" /* BugReports */ };
|
|
8122
|
+
}
|
|
8123
|
+
function linkToInputBugReport(input) {
|
|
8124
|
+
const bugReportId = readStringField(input, "bugReportId");
|
|
8125
|
+
return bugReportId ? { page: "bug-report" /* BugReport */, bugReportId } : null;
|
|
8126
|
+
}
|
|
8127
|
+
function linkToCreatedBugReport(_input, response) {
|
|
8128
|
+
const bugReportId = readStringField(response.data, "bugReportId");
|
|
8129
|
+
return bugReportId ? { page: "bug-report" /* BugReport */, bugReportId } : null;
|
|
8130
|
+
}
|
|
7772
8131
|
|
|
7773
8132
|
// packages/mcps/src/mcp/tools/e2e/organization-list-transform.ts
|
|
7774
8133
|
function mapOrganizationList(response) {
|
|
@@ -9567,10 +9926,14 @@ var prdFileTools = [
|
|
|
9567
9926
|
method: "POST",
|
|
9568
9927
|
path: `${MUGGLE_TEST_PREFIX}/workflow/use-case/prd-file-upload`,
|
|
9569
9928
|
multipartFormData: {
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9929
|
+
files: [
|
|
9930
|
+
{
|
|
9931
|
+
fieldName: "file",
|
|
9932
|
+
fileName: toolInput.fileName,
|
|
9933
|
+
contentType: toolInput.contentType || "application/octet-stream",
|
|
9934
|
+
fileBase64: toolInput.contentBase64
|
|
9935
|
+
}
|
|
9936
|
+
]
|
|
9574
9937
|
}
|
|
9575
9938
|
};
|
|
9576
9939
|
}
|
|
@@ -9993,6 +10356,52 @@ var userFeedbackTools = [
|
|
|
9993
10356
|
}
|
|
9994
10357
|
}
|
|
9995
10358
|
];
|
|
10359
|
+
var bugReportTools = [
|
|
10360
|
+
{
|
|
10361
|
+
name: "muggle-remote-bug-report-create",
|
|
10362
|
+
description: "File a bug report about Muggle AI itself (the harness, a run, the dashboard, billing) for the Muggle team. Takes title, description, severity and optional steps / expected / actual, screenshotPaths read from this machine (images only, at most 5, 5 MB each) and clientContext from muggle-local-bug-report-context-get; secret-looking context values are dropped before sending. Not for a generated test script that did the wrong thing: that is muggle-remote-user-feedback-create. Returns the report with its bugReportId and shortId (e.g. BUG-4821) plus dashboardUrl to the ticket. Ten reports per hour per user.",
|
|
10363
|
+
inputSchema: BugReportCreateInputSchema,
|
|
10364
|
+
dashboardLink: linkToCreatedBugReport,
|
|
10365
|
+
mapToUpstream: (input) => buildBugReportCreateCall(input)
|
|
10366
|
+
},
|
|
10367
|
+
{
|
|
10368
|
+
name: "muggle-remote-bug-report-list",
|
|
10369
|
+
description: "List the signed-in user's own bug reports, newest activity first. Response: { items: [{ bugReportId, shortId, title, status, severity, priority, source, createdAtMs, updatedAtMs, lastActivityAtMs, hasFilerReplySinceTriage }], nextCursor }. Pass nextCursor back as cursor for the next page. Use it to find a bugReportId from a shortId like BUG-4821.",
|
|
10370
|
+
inputSchema: BugReportListInputSchema,
|
|
10371
|
+
dashboardLink: linkToBugReports,
|
|
10372
|
+
mapToUpstream: (input) => {
|
|
10373
|
+
const toolInput = input;
|
|
10374
|
+
return {
|
|
10375
|
+
method: "GET",
|
|
10376
|
+
path: BUG_REPORTS_PATH,
|
|
10377
|
+
queryParams: {
|
|
10378
|
+
pageSize: toolInput.pageSize,
|
|
10379
|
+
cursor: toolInput.cursor
|
|
10380
|
+
}
|
|
10381
|
+
};
|
|
10382
|
+
}
|
|
10383
|
+
},
|
|
10384
|
+
{
|
|
10385
|
+
name: "muggle-remote-bug-report-get",
|
|
10386
|
+
description: "Get one of the user's bug reports with its public timeline. Response: { report, activities: [{ kind, actorKind, actorDisplayName, message, fromStatus, toStatus, screenshots, createdAtMs }] } plus dashboardUrl. Takes the bugReportId, not the shortId.",
|
|
10387
|
+
inputSchema: BugReportGetInputSchema,
|
|
10388
|
+
dashboardLink: linkToInputBugReport,
|
|
10389
|
+
mapToUpstream: (input) => {
|
|
10390
|
+
const toolInput = input;
|
|
10391
|
+
return {
|
|
10392
|
+
method: "GET",
|
|
10393
|
+
path: `${BUG_REPORTS_PATH}/${encodeURIComponent(toolInput.bugReportId)}`
|
|
10394
|
+
};
|
|
10395
|
+
}
|
|
10396
|
+
},
|
|
10397
|
+
{
|
|
10398
|
+
name: "muggle-remote-bug-report-reply",
|
|
10399
|
+
description: "Post the user's reply on one of their bug reports, with optional screenshotPaths read from this machine (images only, at most 5, 5 MB each). A reply on a needs_info ticket returns it to triaged; on a fixed or closed ticket it reopens it within 14 days, and after that the backend refuses with bug_report_reopen_window_elapsed: file a new report naming the old shortId instead. Returns the new timeline activity.",
|
|
10400
|
+
inputSchema: BugReportReplyInputSchema,
|
|
10401
|
+
dashboardLink: linkToInputBugReport,
|
|
10402
|
+
mapToUpstream: (input) => buildBugReportReplyCall(input)
|
|
10403
|
+
}
|
|
10404
|
+
];
|
|
9996
10405
|
var authTools = [
|
|
9997
10406
|
{
|
|
9998
10407
|
name: "muggle-remote-auth-register",
|
|
@@ -10145,6 +10554,7 @@ var allQaToolDefinitions = [
|
|
|
10145
10554
|
...recommendationTools,
|
|
10146
10555
|
...apiKeyTools,
|
|
10147
10556
|
...userFeedbackTools,
|
|
10557
|
+
...bugReportTools,
|
|
10148
10558
|
...authTools
|
|
10149
10559
|
];
|
|
10150
10560
|
function getQaToolByName(name) {
|
|
@@ -10441,114 +10851,9 @@ var LastHostSetInputSchema = z.object({
|
|
|
10441
10851
|
var LastHostClearInputSchema = z.object({
|
|
10442
10852
|
cwd: z.string().describe("Project root directory whose last-used host cache to remove.")
|
|
10443
10853
|
});
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
var LEGACY_CACHE_DIR_NAME = ".muggle-ai";
|
|
10448
|
-
var MUGGLE_HOME_DISPLAY_DIR = "~/.muggle-ai";
|
|
10449
|
-
|
|
10450
|
-
// packages/mcps/src/shared/cwd-keyed-cache.ts
|
|
10451
|
-
function resolveHomeFilePath(cache) {
|
|
10452
|
-
return path17.join(getDataDir(), cache.fileName);
|
|
10453
|
-
}
|
|
10454
|
-
function resolveLegacyFilePath(cache, cwd) {
|
|
10455
|
-
return path17.join(cwd, LEGACY_CACHE_DIR_NAME, cache.fileName);
|
|
10456
|
-
}
|
|
10457
|
-
function parseJsonFile(filePath) {
|
|
10458
|
-
try {
|
|
10459
|
-
if (!fs4.existsSync(filePath)) {
|
|
10460
|
-
return null;
|
|
10461
|
-
}
|
|
10462
|
-
return JSON.parse(fs4.readFileSync(filePath, "utf-8"));
|
|
10463
|
-
} catch (error) {
|
|
10464
|
-
getLogger().warn("Failed to read cache file", {
|
|
10465
|
-
path: filePath,
|
|
10466
|
-
error: error instanceof Error ? error.message : String(error)
|
|
10467
|
-
});
|
|
10468
|
-
return null;
|
|
10469
|
-
}
|
|
10470
|
-
}
|
|
10471
|
-
function readHomeEntries(cache) {
|
|
10472
|
-
const parsed = parseJsonFile(resolveHomeFilePath(cache));
|
|
10473
|
-
return parsed?.entries ?? {};
|
|
10474
|
-
}
|
|
10475
|
-
function writeHomeEntries(cache, entries) {
|
|
10476
|
-
fs4.mkdirSync(getDataDir(), { recursive: true });
|
|
10477
|
-
const file = {
|
|
10478
|
-
version: CWD_KEYED_CACHE_VERSION,
|
|
10479
|
-
entries
|
|
10480
|
-
};
|
|
10481
|
-
fs4.writeFileSync(
|
|
10482
|
-
resolveHomeFilePath(cache),
|
|
10483
|
-
`${JSON.stringify(file, null, 2)}
|
|
10484
|
-
`,
|
|
10485
|
-
"utf-8"
|
|
10486
|
-
);
|
|
10487
|
-
}
|
|
10488
|
-
function readLegacyEntry(cache, cwd) {
|
|
10489
|
-
const parsed = parseJsonFile(
|
|
10490
|
-
resolveLegacyFilePath(cache, cwd)
|
|
10491
|
-
);
|
|
10492
|
-
return parsed?.[cache.legacyEntryKey] ?? null;
|
|
10493
|
-
}
|
|
10494
|
-
function readCwdEntry(cache, cwd) {
|
|
10495
|
-
const cwdKey = path17.resolve(cwd);
|
|
10496
|
-
const entries = readHomeEntries(cache);
|
|
10497
|
-
const homeEntry = entries[cwdKey];
|
|
10498
|
-
if (homeEntry) {
|
|
10499
|
-
return homeEntry;
|
|
10500
|
-
}
|
|
10501
|
-
const legacyEntry = readLegacyEntry(cache, cwd);
|
|
10502
|
-
if (!legacyEntry) {
|
|
10503
|
-
return null;
|
|
10504
|
-
}
|
|
10505
|
-
try {
|
|
10506
|
-
writeHomeEntries(cache, { ...entries, [cwdKey]: legacyEntry });
|
|
10507
|
-
} catch (error) {
|
|
10508
|
-
getLogger().warn("Failed to migrate cache entry to the home directory", {
|
|
10509
|
-
path: resolveHomeFilePath(cache),
|
|
10510
|
-
error: error instanceof Error ? error.message : String(error)
|
|
10511
|
-
});
|
|
10512
|
-
}
|
|
10513
|
-
return legacyEntry;
|
|
10514
|
-
}
|
|
10515
|
-
function writeCwdEntry(cache, cwd, entry) {
|
|
10516
|
-
const entries = readHomeEntries(cache);
|
|
10517
|
-
writeHomeEntries(cache, { ...entries, [path17.resolve(cwd)]: entry });
|
|
10518
|
-
}
|
|
10519
|
-
function clearCwdEntry(cache, cwd) {
|
|
10520
|
-
const entries = readHomeEntries(cache);
|
|
10521
|
-
const cwdKey = path17.resolve(cwd);
|
|
10522
|
-
if (cwdKey in entries) {
|
|
10523
|
-
delete entries[cwdKey];
|
|
10524
|
-
writeHomeEntries(cache, entries);
|
|
10525
|
-
}
|
|
10526
|
-
const legacyFilePath = resolveLegacyFilePath(cache, cwd);
|
|
10527
|
-
if (fs4.existsSync(legacyFilePath)) {
|
|
10528
|
-
fs4.unlinkSync(legacyFilePath);
|
|
10529
|
-
}
|
|
10530
|
-
}
|
|
10531
|
-
|
|
10532
|
-
// packages/mcps/src/shared/last-project-constants.ts
|
|
10533
|
-
var LAST_PROJECT_FILE_NAME = "last-project.json";
|
|
10534
|
-
var LAST_PROJECT_CACHE = {
|
|
10535
|
-
fileName: LAST_PROJECT_FILE_NAME,
|
|
10536
|
-
legacyEntryKey: "lastProject"
|
|
10537
|
-
};
|
|
10538
|
-
|
|
10539
|
-
// packages/mcps/src/shared/last-project.ts
|
|
10540
|
-
function readLastProject(cwd) {
|
|
10541
|
-
return readCwdEntry(LAST_PROJECT_CACHE, cwd);
|
|
10542
|
-
}
|
|
10543
|
-
function writeLastProject(cwd, lastProject) {
|
|
10544
|
-
writeCwdEntry(LAST_PROJECT_CACHE, cwd, {
|
|
10545
|
-
...lastProject,
|
|
10546
|
-
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10547
|
-
});
|
|
10548
|
-
}
|
|
10549
|
-
function clearLastProject(cwd) {
|
|
10550
|
-
clearCwdEntry(LAST_PROJECT_CACHE, cwd);
|
|
10551
|
-
}
|
|
10854
|
+
var BugReportContextGetInputSchema = z.object({
|
|
10855
|
+
cwd: z.string().min(1).describe("Project root directory whose last-used Muggle Test project the context names.")
|
|
10856
|
+
});
|
|
10552
10857
|
|
|
10553
10858
|
// packages/mcps/src/shared/last-host-constants.ts
|
|
10554
10859
|
var LAST_HOST_FILE_NAME = "last-host.json";
|
|
@@ -11337,6 +11642,32 @@ var lastHostClearTool = {
|
|
|
11337
11642
|
};
|
|
11338
11643
|
}
|
|
11339
11644
|
};
|
|
11645
|
+
var bugReportContextGetTool = {
|
|
11646
|
+
name: "muggle-local-bug-report-context-get",
|
|
11647
|
+
description: "Gather the harness context a Muggle bug report carries: Muggle CLI and Studio versions, operating system, the last Muggle Test project selected for this directory, and the newest local run with its status. Values that look like secrets are dropped and named in strippedFieldNames. Read-only. Show the result to the user before filing, then pass the clientContext JSON block unchanged as clientContext to muggle-remote-bug-report-create.",
|
|
11648
|
+
inputSchema: BugReportContextGetInputSchema,
|
|
11649
|
+
execute: async (ctx) => {
|
|
11650
|
+
const logger7 = createChildLogger2(ctx.correlationId);
|
|
11651
|
+
logger7.info("Executing muggle-local-bug-report-context-get");
|
|
11652
|
+
const input = BugReportContextGetInputSchema.parse(ctx.input);
|
|
11653
|
+
const sanitizedContext = collectBugReportClientContext({ cwd: input.cwd });
|
|
11654
|
+
const contextLines = Object.entries(sanitizedContext.clientContext).map(
|
|
11655
|
+
([fieldName, fieldValue]) => `- ${fieldName}: ${fieldValue}`
|
|
11656
|
+
);
|
|
11657
|
+
const content = [
|
|
11658
|
+
"## Included with your bug report",
|
|
11659
|
+
"",
|
|
11660
|
+
...contextLines.length > 0 ? contextLines : ["- (no harness context found)"],
|
|
11661
|
+
...sanitizedContext.strippedFieldNames.length > 0 ? [`- Left out because they looked like secrets: ${sanitizedContext.strippedFieldNames.join(", ")}`] : [],
|
|
11662
|
+
"",
|
|
11663
|
+
"clientContext:",
|
|
11664
|
+
"```json",
|
|
11665
|
+
JSON.stringify(sanitizedContext.clientContext, null, 2),
|
|
11666
|
+
"```"
|
|
11667
|
+
].join("\n");
|
|
11668
|
+
return { content, isError: false, data: sanitizedContext };
|
|
11669
|
+
}
|
|
11670
|
+
};
|
|
11340
11671
|
var telemetrySkillEmitTool = {
|
|
11341
11672
|
name: "muggle-local-telemetry-skill-emit",
|
|
11342
11673
|
description: "Emit a client telemetry event recording that a Muggle Test skill was invoked. Each muggle-* skill calls this in its first step so we can measure skill usage. Never fails the skill on telemetry errors.",
|
|
@@ -11388,6 +11719,8 @@ var allLocalQaTools = [
|
|
|
11388
11719
|
lastHostGetTool,
|
|
11389
11720
|
lastHostSetTool,
|
|
11390
11721
|
lastHostClearTool,
|
|
11722
|
+
// Harness context a bug report carries, shown to the user before filing
|
|
11723
|
+
bugReportContextGetTool,
|
|
11391
11724
|
// Client telemetry: skills emit invocation events through this tool
|
|
11392
11725
|
telemetrySkillEmitTool,
|
|
11393
11726
|
telemetryEventEmitTool
|
|
@@ -11459,6 +11792,11 @@ __export(e2e_exports2, {
|
|
|
11459
11792
|
AuthLoginInputSchema: () => AuthLoginInputSchema,
|
|
11460
11793
|
AuthPollInputSchema: () => AuthPollInputSchema,
|
|
11461
11794
|
AuthRegisterInputSchema: () => AuthRegisterInputSchema,
|
|
11795
|
+
BugReportClientContextInputSchema: () => BugReportClientContextInputSchema,
|
|
11796
|
+
BugReportCreateInputSchema: () => BugReportCreateInputSchema,
|
|
11797
|
+
BugReportGetInputSchema: () => BugReportGetInputSchema,
|
|
11798
|
+
BugReportListInputSchema: () => BugReportListInputSchema,
|
|
11799
|
+
BugReportReplyInputSchema: () => BugReportReplyInputSchema,
|
|
11462
11800
|
BulkPreviewJobCancelInputSchema: () => BulkPreviewJobCancelInputSchema,
|
|
11463
11801
|
BulkPreviewJobGetInputSchema: () => BulkPreviewJobGetInputSchema,
|
|
11464
11802
|
BulkPreviewJobKindSchema: () => BulkPreviewJobKindSchema,
|
|
@@ -11612,6 +11950,7 @@ function getQaTools() {
|
|
|
11612
11950
|
var local_exports2 = {};
|
|
11613
11951
|
__export(local_exports2, {
|
|
11614
11952
|
AuthService: () => AuthService,
|
|
11953
|
+
BugReportContextGetInputSchema: () => BugReportContextGetInputSchema,
|
|
11615
11954
|
CancelExecutionInputSchema: () => CancelExecutionInputSchema,
|
|
11616
11955
|
CleanupSessionsInputSchema: () => CleanupSessionsInputSchema,
|
|
11617
11956
|
CloudMappingEntityType: () => CloudMappingEntityType,
|
|
@@ -11656,6 +11995,7 @@ __export(local_exports2, {
|
|
|
11656
11995
|
acquireLocalExecutionLock: () => acquireLocalExecutionLock,
|
|
11657
11996
|
allLocalQaTools: () => allLocalQaTools,
|
|
11658
11997
|
cancelExecution: () => cancelExecution,
|
|
11998
|
+
collectBugReportClientContext: () => collectBugReportClientContext,
|
|
11659
11999
|
executeReplay: () => executeReplay,
|
|
11660
12000
|
executeTestGeneration: () => executeTestGeneration,
|
|
11661
12001
|
executeTool: () => executeTool,
|
|
@@ -11704,7 +12044,9 @@ function isLocalOnlyTool(toolName) {
|
|
|
11704
12044
|
"muggle_test_script_get",
|
|
11705
12045
|
// Client telemetry — purely local, no backend call
|
|
11706
12046
|
"muggle-local-telemetry-skill-emit",
|
|
11707
|
-
"muggle-local-telemetry-event-emit"
|
|
12047
|
+
"muggle-local-telemetry-event-emit",
|
|
12048
|
+
// Reads only local install and run state, so context shows before sign-in
|
|
12049
|
+
"muggle-local-bug-report-context-get"
|
|
11708
12050
|
];
|
|
11709
12051
|
return localOnlyTools.includes(toolName);
|
|
11710
12052
|
}
|