@muggleai/works 5.8.1 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +8 -0
  2. package/dist/{chunk-5PYK7DWB.js → chunk-7NC2DJTK.js} +10 -4
  3. package/dist/{chunk-LVUJ4E62.js → chunk-OCLMXAVJ.js} +245 -167
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  8. package/dist/plugin/README.md +19 -13
  9. package/dist/plugin/agents/test-prepare-runner.md +1 -0
  10. package/dist/plugin/hooks/hooks.json +6 -0
  11. package/dist/plugin/scripts/ensure-electron-app.sh +62 -47
  12. package/dist/plugin/scripts/guardrail-watch-gate.sh +40 -0
  13. package/dist/plugin/scripts/guardrails.mjs +88 -5
  14. package/dist/plugin/scripts/pr-watch-guards.sh +17 -0
  15. package/dist/plugin/skills/_shared/resolve-e2e-validation-context.md +1 -0
  16. package/dist/plugin/skills/muggle/SKILL.md +1 -1
  17. package/dist/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -3
  18. package/dist/plugin/skills/muggle-pr-followup/blocked-tick.md +2 -2
  19. package/dist/plugin/skills/muggle-pr-followup/cancel-cron.md +5 -3
  20. package/dist/plugin/skills/muggle-pr-followup/contract.md +8 -2
  21. package/dist/plugin/skills/muggle-pr-followup/evals/evals.json +30 -3
  22. package/dist/plugin/skills/muggle-pr-followup/finalize.md +1 -1
  23. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +3 -1
  24. package/dist/plugin/skills/muggle-preferences/SKILL.md +1 -1
  25. package/dist/plugin/skills/muggle-preferences/evals/evals.json +45 -0
  26. package/dist/plugin/skills/muggle-preferences/ops/change-one.md +1 -1
  27. package/dist/plugin/skills/muggle-preferences/ops/configure.md +4 -5
  28. package/dist/plugin/skills/muggle-preferences/ops/list.md +1 -1
  29. package/dist/plugin/skills/muggle-preferences/ops/set.md +3 -4
  30. package/dist/plugin/skills/muggle-preferences/preference-gates/README.md +3 -3
  31. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +2 -2
  32. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +1 -1
  33. package/dist/plugin/skills/muggle-test/SKILL.md +1 -1
  34. package/dist/plugin/skills/muggle-test/execute-local.md +2 -0
  35. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +3 -1
  36. package/dist/plugin/skills/muggle-test-import/SKILL.md +1 -1
  37. package/dist/plugin/skills/muggle-test-prepare/SKILL.md +10 -4
  38. package/dist/plugin/skills/muggle-test-prepare/steps/check-running.md +1 -1
  39. package/dist/plugin/skills/muggle-test-prepare/steps/e2e-instructions.md +100 -0
  40. package/dist/plugin/skills/muggle-test-prepare/steps/readiness-report.md +9 -4
  41. package/dist/plugin/skills/muggle-test-prepare/steps/reuse-plan.md +5 -4
  42. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
  43. package/dist/release-manifest.json +4 -4
  44. package/dist/src-AWUORQZZ.js +1 -0
  45. package/package.json +6 -6
  46. package/plugin/.claude-plugin/plugin.json +1 -1
  47. package/plugin/.cursor-plugin/plugin.json +1 -1
  48. package/plugin/README.md +19 -13
  49. package/plugin/agents/test-prepare-runner.md +1 -0
  50. package/plugin/hooks/hooks.json +6 -0
  51. package/plugin/scripts/ensure-electron-app.sh +62 -47
  52. package/plugin/scripts/guardrail-watch-gate.sh +40 -0
  53. package/plugin/scripts/guardrails.mjs +88 -5
  54. package/plugin/scripts/pr-watch-guards.sh +17 -0
  55. package/plugin/skills/_shared/resolve-e2e-validation-context.md +1 -0
  56. package/plugin/skills/muggle/SKILL.md +1 -1
  57. package/plugin/skills/muggle-pr-followup/arm-watcher.md +5 -3
  58. package/plugin/skills/muggle-pr-followup/blocked-tick.md +2 -2
  59. package/plugin/skills/muggle-pr-followup/cancel-cron.md +5 -3
  60. package/plugin/skills/muggle-pr-followup/contract.md +8 -2
  61. package/plugin/skills/muggle-pr-followup/evals/evals.json +30 -3
  62. package/plugin/skills/muggle-pr-followup/finalize.md +1 -1
  63. package/plugin/skills/muggle-pr-followup/state-schemas.md +3 -1
  64. package/plugin/skills/muggle-preferences/SKILL.md +1 -1
  65. package/plugin/skills/muggle-preferences/evals/evals.json +45 -0
  66. package/plugin/skills/muggle-preferences/ops/change-one.md +1 -1
  67. package/plugin/skills/muggle-preferences/ops/configure.md +4 -5
  68. package/plugin/skills/muggle-preferences/ops/list.md +1 -1
  69. package/plugin/skills/muggle-preferences/ops/set.md +3 -4
  70. package/plugin/skills/muggle-preferences/preference-gates/README.md +3 -3
  71. package/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +2 -2
  72. package/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +1 -1
  73. package/plugin/skills/muggle-test/SKILL.md +1 -1
  74. package/plugin/skills/muggle-test/execute-local.md +2 -0
  75. package/plugin/skills/muggle-test-feature-local/SKILL.md +3 -1
  76. package/plugin/skills/muggle-test-import/SKILL.md +1 -1
  77. package/plugin/skills/muggle-test-prepare/SKILL.md +10 -4
  78. package/plugin/skills/muggle-test-prepare/steps/check-running.md +1 -1
  79. package/plugin/skills/muggle-test-prepare/steps/e2e-instructions.md +100 -0
  80. package/plugin/skills/muggle-test-prepare/steps/readiness-report.md +9 -4
  81. package/plugin/skills/muggle-test-prepare/steps/reuse-plan.md +5 -4
  82. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
  83. package/dist/src-FDK2KQSZ.js +0 -1
@@ -37,6 +37,7 @@ __export(src_exports, {
37
37
  PREFERENCE_ALLOWED_VALUES: () => PREFERENCE_ALLOWED_VALUES,
38
38
  PreferenceKey: () => PreferenceKey,
39
39
  PreferenceValue: () => PreferenceValue,
40
+ ProjectPreferencesReconcileOutcome: () => ProjectPreferencesReconcileOutcome,
40
41
  buildElectronAppChecksumsUrl: () => buildElectronAppChecksumsUrl,
41
42
  buildElectronAppReleaseAssetUrl: () => buildElectronAppReleaseAssetUrl,
42
43
  buildElectronAppReleaseTag: () => buildElectronAppReleaseTag,
@@ -80,8 +81,7 @@ __export(src_exports, {
80
81
  performLogout: () => performLogout,
81
82
  pollDeviceCode: () => pollDeviceCode,
82
83
  qa: () => e2e_exports2,
83
- readGlobalPreferences: () => readGlobalPreferences,
84
- readProjectPreferences: () => readProjectPreferences,
84
+ reconcileProjectPreferences: () => reconcileProjectPreferences,
85
85
  resetConfig: () => resetConfig,
86
86
  resetLogger: () => resetLogger,
87
87
  resetPreference: () => resetPreference,
@@ -542,14 +542,14 @@ function getPlatformKey() {
542
542
  }
543
543
  }
544
544
  async function calculateFileChecksum(filePath) {
545
- return new Promise((resolve4, reject) => {
545
+ return new Promise((resolve5, reject) => {
546
546
  const hash = crypto.createHash("sha256");
547
547
  const stream = fs5.createReadStream(filePath);
548
548
  stream.on("data", (data) => {
549
549
  hash.update(data);
550
550
  });
551
551
  stream.on("end", () => {
552
- resolve4(hash.digest("hex"));
552
+ resolve5(hash.digest("hex"));
553
553
  });
554
554
  stream.on("error", (error) => {
555
555
  reject(error);
@@ -627,7 +627,7 @@ function getOpenCommand(url) {
627
627
  }
628
628
  }
629
629
  async function openBrowserUrl(options) {
630
- return new Promise((resolve4) => {
630
+ return new Promise((resolve5) => {
631
631
  try {
632
632
  const command = getOpenCommand(options.url);
633
633
  logger2.debug("[Browser] Opening URL", { url: options.url, command });
@@ -637,13 +637,13 @@ async function openBrowserUrl(options) {
637
637
  url: options.url,
638
638
  error: error.message
639
639
  });
640
- resolve4({
640
+ resolve5({
641
641
  opened: false,
642
642
  error: error.message
643
643
  });
644
644
  } else {
645
645
  logger2.info("[Browser] URL opened successfully", { url: options.url });
646
- resolve4({ opened: true });
646
+ resolve5({ opened: true });
647
647
  }
648
648
  });
649
649
  } catch (error) {
@@ -652,7 +652,7 @@ async function openBrowserUrl(options) {
652
652
  url: options.url,
653
653
  error: errorMessage
654
654
  });
655
- resolve4({
655
+ resolve5({
656
656
  opened: false,
657
657
  error: errorMessage
658
658
  });
@@ -1357,9 +1357,9 @@ function resetAuthService() {
1357
1357
  serviceInstance = null;
1358
1358
  }
1359
1359
  function sleep(params) {
1360
- return new Promise((resolve4) => {
1360
+ return new Promise((resolve5) => {
1361
1361
  setTimeout(() => {
1362
- resolve4();
1362
+ resolve5();
1363
1363
  }, params.durationMs);
1364
1364
  });
1365
1365
  }
@@ -2620,7 +2620,7 @@ async function executeElectronAppAsync(params) {
2620
2620
  capturedStderr: ""
2621
2621
  };
2622
2622
  activeProcesses.set(params.runId, processInfo);
2623
- return await new Promise((resolve4, reject) => {
2623
+ return await new Promise((resolve5, reject) => {
2624
2624
  let settled = false;
2625
2625
  const finalize = (result) => {
2626
2626
  if (settled) {
@@ -2632,7 +2632,7 @@ async function executeElectronAppAsync(params) {
2632
2632
  }
2633
2633
  activeProcesses.delete(params.runId);
2634
2634
  if (result.ok) {
2635
- resolve4(result.payload);
2635
+ resolve5(result.payload);
2636
2636
  } else {
2637
2637
  reject(result.payload);
2638
2638
  }
@@ -3493,9 +3493,9 @@ function isValid2(value) {
3493
3493
  function readReleaseManifest2() {
3494
3494
  if (cachedManifest2 !== void 0)
3495
3495
  return cachedManifest2;
3496
- const path16 = MANIFEST_PATH2;
3496
+ const path15 = MANIFEST_PATH2;
3497
3497
  try {
3498
- const raw = readFileSync(path16, "utf8");
3498
+ const raw = readFileSync(path15, "utf8");
3499
3499
  const parsed = JSON.parse(raw);
3500
3500
  cachedManifest2 = isValid2(parsed) ? parsed : DEV_MANIFEST2;
3501
3501
  return cachedManifest2;
@@ -4274,17 +4274,17 @@ var PromptServiceClient = class {
4274
4274
  * @param path - Path to validate.
4275
4275
  * @throws GatewayError if path is not allowed.
4276
4276
  */
4277
- validatePath(path16) {
4278
- const isAllowed = ALLOWED_UPSTREAM_PREFIXES.some((prefix) => path16.startsWith(prefix));
4277
+ validatePath(path15) {
4278
+ const isAllowed = ALLOWED_UPSTREAM_PREFIXES.some((prefix) => path15.startsWith(prefix));
4279
4279
  if (!isAllowed) {
4280
4280
  const logger6 = getLogger();
4281
4281
  logger6.error("Path not in allowlist", {
4282
- path: path16,
4282
+ path: path15,
4283
4283
  allowedPrefixes: ALLOWED_UPSTREAM_PREFIXES
4284
4284
  });
4285
4285
  throw new GatewayError({
4286
4286
  code: "FORBIDDEN" /* FORBIDDEN */,
4287
- message: `Path '${path16}' is not allowed`
4287
+ message: `Path '${path15}' is not allowed`
4288
4288
  });
4289
4289
  }
4290
4290
  }
@@ -6431,12 +6431,15 @@ var PREFERENCES_SCHEMA = {
6431
6431
  // packages/mcps/src/mcp/local/contracts/preferences-schemas.ts
6432
6432
  var preferenceKeyValues = Object.values(PreferenceKey);
6433
6433
  var preferenceValueValues = Object.values(PreferenceValue);
6434
- var PreferencesSetInputSchema = z.object({
6435
- key: z.enum(preferenceKeyValues).describe("The preference key to set."),
6436
- value: z.enum(preferenceValueValues).describe("The value. Most keys accept always/ask/never; defaultExecutionMode accepts local/remote/ask."),
6437
- scope: z.enum(["global", "project"]).default("global").describe("Write to global (~/.muggle-ai/) or project (.muggle-ai/) preferences."),
6438
- cwd: z.string().optional().describe("Project root directory. Required when scope is 'project'.")
6439
- }).superRefine((data, ctx) => {
6434
+ var PreferencesSetInputSchema = z.object(
6435
+ {
6436
+ key: z.enum(preferenceKeyValues).describe("The preference key to set."),
6437
+ value: z.enum(preferenceValueValues).describe("The value. Most keys accept always/ask/never; defaultExecutionMode accepts local/remote/ask.")
6438
+ },
6439
+ {
6440
+ error: "Expected only { key, value }: per-project preferences were removed, so scope and cwd are no longer accepted."
6441
+ }
6442
+ ).strict().superRefine((data, ctx) => {
6440
6443
  const allowed = PREFERENCE_ALLOWED_VALUES[data.key];
6441
6444
  if (!allowed.includes(data.value)) {
6442
6445
  ctx.addIssue({
@@ -6518,9 +6521,21 @@ function appendFailureEvent(record) {
6518
6521
  });
6519
6522
  }
6520
6523
  }
6524
+
6525
+ // packages/mcps/src/shared/project-preferences-reconcile-types.ts
6526
+ var ProjectPreferencesReconcileOutcome = /* @__PURE__ */ ((ProjectPreferencesReconcileOutcome2) => {
6527
+ ProjectPreferencesReconcileOutcome2["NoAction"] = "noAction";
6528
+ ProjectPreferencesReconcileOutcome2["CopiedToGlobal"] = "copiedToGlobal";
6529
+ ProjectPreferencesReconcileOutcome2["KeysShadowed"] = "keysShadowed";
6530
+ return ProjectPreferencesReconcileOutcome2;
6531
+ })(ProjectPreferencesReconcileOutcome || {});
6532
+
6533
+ // packages/mcps/src/shared/preferences-service.ts
6534
+ function getGlobalPreferencesFilePath(dataDirOverride2) {
6535
+ return path9.join(dataDirOverride2 ?? getDataDir(), PREFERENCES_FILE_NAME);
6536
+ }
6521
6537
  function isFirstRun(dataDirOverride2) {
6522
- const filePath = path9.join(dataDirOverride2 ?? getDataDir(), PREFERENCES_FILE_NAME);
6523
- return !fs5.existsSync(filePath);
6538
+ return !fs5.existsSync(getGlobalPreferencesFilePath(dataDirOverride2));
6524
6539
  }
6525
6540
  function readPreferencesFile(filePath) {
6526
6541
  try {
@@ -6537,53 +6552,64 @@ function readPreferencesFile(filePath) {
6537
6552
  return {};
6538
6553
  }
6539
6554
  }
6540
- function readGlobalPreferences(dataDirOverride2) {
6541
- const filePath = path9.join(dataDirOverride2 ?? getDataDir(), PREFERENCES_FILE_NAME);
6542
- const partial = readPreferencesFile(filePath);
6543
- return { ...DEFAULT_PREFERENCES, ...partial };
6544
- }
6545
- function readProjectPreferences(cwd) {
6546
- const filePath = path9.join(cwd, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_FILE_NAME);
6547
- return readPreferencesFile(filePath);
6548
- }
6549
- function resolvePreferences(dataDirOverride2, cwd) {
6550
- const global = readGlobalPreferences(dataDirOverride2);
6551
- if (!cwd) {
6552
- return global;
6553
- }
6554
- const project = readProjectPreferences(cwd);
6555
- return { ...global, ...project };
6556
- }
6557
- function writePreferences2(prefs, scope, dataDirOverride2, cwd) {
6558
- const dir = scope === "project" && cwd ? path9.join(cwd, PREFERENCES_PROJECT_DIR_NAME) : dataDirOverride2 ?? getDataDir();
6559
- fs5.mkdirSync(dir, { recursive: true });
6560
- const filePath = path9.join(dir, PREFERENCES_FILE_NAME);
6561
- const existing = readPreferencesFile(filePath);
6562
- const merged = { ...existing, ...prefs };
6555
+ function writePreferencesFile(filePath, prefs) {
6563
6556
  const file = {
6564
6557
  version: PREFERENCES_VERSION,
6565
- preferences: merged
6558
+ preferences: prefs
6566
6559
  };
6567
6560
  fs5.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}
6568
6561
  `, "utf-8");
6569
6562
  }
6570
- function resetPreference(key, scope, dataDirOverride2, cwd) {
6571
- const dir = scope === "project" && cwd ? path9.join(cwd, PREFERENCES_PROJECT_DIR_NAME) : dataDirOverride2 ?? getDataDir();
6563
+ function resolvePreferences(dataDirOverride2) {
6564
+ const saved = readPreferencesFile(getGlobalPreferencesFilePath(dataDirOverride2));
6565
+ return { ...DEFAULT_PREFERENCES, ...saved };
6566
+ }
6567
+ function writePreferences2(prefs, dataDirOverride2) {
6568
+ const dir = dataDirOverride2 ?? getDataDir();
6569
+ fs5.mkdirSync(dir, { recursive: true });
6572
6570
  const filePath = path9.join(dir, PREFERENCES_FILE_NAME);
6571
+ const existing = readPreferencesFile(filePath);
6572
+ writePreferencesFile(filePath, { ...existing, ...prefs });
6573
+ }
6574
+ function resetPreference(key, dataDirOverride2) {
6575
+ const filePath = getGlobalPreferencesFilePath(dataDirOverride2);
6573
6576
  if (!fs5.existsSync(filePath)) {
6574
6577
  return;
6575
6578
  }
6576
6579
  if (!key) {
6577
- const file2 = { version: PREFERENCES_VERSION, preferences: {} };
6578
- fs5.writeFileSync(filePath, `${JSON.stringify(file2, null, 2)}
6579
- `, "utf-8");
6580
+ writePreferencesFile(filePath, {});
6580
6581
  return;
6581
6582
  }
6582
6583
  const existing = readPreferencesFile(filePath);
6583
6584
  delete existing[key];
6584
- const file = { version: PREFERENCES_VERSION, preferences: existing };
6585
- fs5.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}
6586
- `, "utf-8");
6585
+ writePreferencesFile(filePath, existing);
6586
+ }
6587
+ function reconcileProjectPreferences(cwd, dataDirOverride2) {
6588
+ const projectFilePath = path9.join(cwd, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_FILE_NAME);
6589
+ const projectPreferences = readPreferencesFile(projectFilePath);
6590
+ const projectKeys = Object.keys(projectPreferences);
6591
+ if (projectKeys.length === 0) {
6592
+ return {
6593
+ outcome: "noAction" /* NoAction */,
6594
+ projectFilePath,
6595
+ shadowedKeys: []
6596
+ };
6597
+ }
6598
+ if (isFirstRun(dataDirOverride2)) {
6599
+ writePreferences2(projectPreferences, dataDirOverride2);
6600
+ return {
6601
+ outcome: "copiedToGlobal" /* CopiedToGlobal */,
6602
+ projectFilePath,
6603
+ shadowedKeys: []
6604
+ };
6605
+ }
6606
+ const resolved = resolvePreferences(dataDirOverride2);
6607
+ const shadowedKeys = projectKeys.filter((key) => projectPreferences[key] !== resolved[key]);
6608
+ return {
6609
+ outcome: shadowedKeys.length > 0 ? "keysShadowed" /* KeysShadowed */ : "noAction" /* NoAction */,
6610
+ projectFilePath,
6611
+ shadowedKeys
6612
+ };
6587
6613
  }
6588
6614
  function validatePreference(key, value) {
6589
6615
  const validKeys = Object.values(PreferenceKey);
@@ -6596,77 +6622,134 @@ function validatePreference(key, value) {
6596
6622
  function formatPreferencesOneLiner(prefs) {
6597
6623
  return Object.entries(prefs).map(([key, value]) => `${key}=${value}`).join(" ");
6598
6624
  }
6599
- var LAST_PROJECT_FILE_NAME = "last-project.json";
6600
- var LAST_PROJECT_DIR_NAME = ".muggle-ai";
6601
- var LAST_PROJECT_VERSION = 1;
6602
- function readLastProject(cwd) {
6603
- const filePath = path9.join(cwd, LAST_PROJECT_DIR_NAME, LAST_PROJECT_FILE_NAME);
6625
+
6626
+ // packages/mcps/src/shared/cwd-keyed-cache-constants.ts
6627
+ var CWD_KEYED_CACHE_VERSION = 1;
6628
+ var LEGACY_CACHE_DIR_NAME = ".muggle-ai";
6629
+ var MUGGLE_HOME_DISPLAY_DIR = "~/.muggle-ai";
6630
+
6631
+ // packages/mcps/src/shared/cwd-keyed-cache.ts
6632
+ function resolveHomeFilePath(cache) {
6633
+ return path9.join(getDataDir(), cache.fileName);
6634
+ }
6635
+ function resolveLegacyFilePath(cache, cwd) {
6636
+ return path9.join(cwd, LEGACY_CACHE_DIR_NAME, cache.fileName);
6637
+ }
6638
+ function parseJsonFile(filePath) {
6604
6639
  try {
6605
6640
  if (!fs5.existsSync(filePath)) {
6606
6641
  return null;
6607
6642
  }
6608
- const raw = JSON.parse(fs5.readFileSync(filePath, "utf-8"));
6609
- return raw.lastProject ?? null;
6643
+ return JSON.parse(fs5.readFileSync(filePath, "utf-8"));
6610
6644
  } catch (error) {
6611
- getLogger().warn("Failed to read last-project file", {
6645
+ getLogger().warn("Failed to read cache file", {
6612
6646
  path: filePath,
6613
6647
  error: error instanceof Error ? error.message : String(error)
6614
6648
  });
6615
6649
  return null;
6616
6650
  }
6617
6651
  }
6618
- function writeLastProject(cwd, lastProject) {
6619
- const dir = path9.join(cwd, LAST_PROJECT_DIR_NAME);
6620
- fs5.mkdirSync(dir, { recursive: true });
6621
- const filePath = path9.join(dir, LAST_PROJECT_FILE_NAME);
6652
+ function readHomeEntries(cache) {
6653
+ const parsed = parseJsonFile(resolveHomeFilePath(cache));
6654
+ return parsed?.entries ?? {};
6655
+ }
6656
+ function writeHomeEntries(cache, entries) {
6657
+ fs5.mkdirSync(getDataDir(), { recursive: true });
6622
6658
  const file = {
6623
- version: LAST_PROJECT_VERSION,
6624
- lastProject: { ...lastProject, savedAt: (/* @__PURE__ */ new Date()).toISOString() }
6659
+ version: CWD_KEYED_CACHE_VERSION,
6660
+ entries
6625
6661
  };
6626
- fs5.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}
6627
- `, "utf-8");
6662
+ fs5.writeFileSync(
6663
+ resolveHomeFilePath(cache),
6664
+ `${JSON.stringify(file, null, 2)}
6665
+ `,
6666
+ "utf-8"
6667
+ );
6628
6668
  }
6629
- function clearLastProject(cwd) {
6630
- const filePath = path9.join(cwd, LAST_PROJECT_DIR_NAME, LAST_PROJECT_FILE_NAME);
6631
- if (fs5.existsSync(filePath)) {
6632
- fs5.unlinkSync(filePath);
6633
- }
6669
+ function readLegacyEntry(cache, cwd) {
6670
+ const parsed = parseJsonFile(
6671
+ resolveLegacyFilePath(cache, cwd)
6672
+ );
6673
+ return parsed?.[cache.legacyEntryKey] ?? null;
6634
6674
  }
6635
- var LAST_HOST_FILE_NAME = "last-host.json";
6636
- var LAST_HOST_DIR_NAME = ".muggle-ai";
6637
- var LAST_HOST_VERSION = 1;
6638
- function readLastHost(cwd) {
6639
- const filePath = path9.join(cwd, LAST_HOST_DIR_NAME, LAST_HOST_FILE_NAME);
6675
+ function readCwdEntry(cache, cwd) {
6676
+ const cwdKey = path9.resolve(cwd);
6677
+ const entries = readHomeEntries(cache);
6678
+ const homeEntry = entries[cwdKey];
6679
+ if (homeEntry) {
6680
+ return homeEntry;
6681
+ }
6682
+ const legacyEntry = readLegacyEntry(cache, cwd);
6683
+ if (!legacyEntry) {
6684
+ return null;
6685
+ }
6640
6686
  try {
6641
- if (!fs5.existsSync(filePath)) {
6642
- return null;
6643
- }
6644
- const raw = JSON.parse(fs5.readFileSync(filePath, "utf-8"));
6645
- return raw.lastHost ?? null;
6687
+ writeHomeEntries(cache, { ...entries, [cwdKey]: legacyEntry });
6646
6688
  } catch (error) {
6647
- getLogger().warn("Failed to read last-host file", {
6648
- path: filePath,
6689
+ getLogger().warn("Failed to migrate cache entry to the home directory", {
6690
+ path: resolveHomeFilePath(cache),
6649
6691
  error: error instanceof Error ? error.message : String(error)
6650
6692
  });
6651
- return null;
6652
6693
  }
6694
+ return legacyEntry;
6695
+ }
6696
+ function writeCwdEntry(cache, cwd, entry) {
6697
+ const entries = readHomeEntries(cache);
6698
+ writeHomeEntries(cache, { ...entries, [path9.resolve(cwd)]: entry });
6699
+ }
6700
+ function clearCwdEntry(cache, cwd) {
6701
+ const entries = readHomeEntries(cache);
6702
+ const cwdKey = path9.resolve(cwd);
6703
+ if (cwdKey in entries) {
6704
+ delete entries[cwdKey];
6705
+ writeHomeEntries(cache, entries);
6706
+ }
6707
+ const legacyFilePath = resolveLegacyFilePath(cache, cwd);
6708
+ if (fs5.existsSync(legacyFilePath)) {
6709
+ fs5.unlinkSync(legacyFilePath);
6710
+ }
6711
+ }
6712
+
6713
+ // packages/mcps/src/shared/last-project-constants.ts
6714
+ var LAST_PROJECT_FILE_NAME = "last-project.json";
6715
+ var LAST_PROJECT_CACHE = {
6716
+ fileName: LAST_PROJECT_FILE_NAME,
6717
+ legacyEntryKey: "lastProject"
6718
+ };
6719
+
6720
+ // packages/mcps/src/shared/last-project.ts
6721
+ function readLastProject(cwd) {
6722
+ return readCwdEntry(LAST_PROJECT_CACHE, cwd);
6723
+ }
6724
+ function writeLastProject(cwd, lastProject) {
6725
+ writeCwdEntry(LAST_PROJECT_CACHE, cwd, {
6726
+ ...lastProject,
6727
+ savedAt: (/* @__PURE__ */ new Date()).toISOString()
6728
+ });
6729
+ }
6730
+ function clearLastProject(cwd) {
6731
+ clearCwdEntry(LAST_PROJECT_CACHE, cwd);
6732
+ }
6733
+
6734
+ // packages/mcps/src/shared/last-host-constants.ts
6735
+ var LAST_HOST_FILE_NAME = "last-host.json";
6736
+ var LAST_HOST_CACHE = {
6737
+ fileName: LAST_HOST_FILE_NAME,
6738
+ legacyEntryKey: "lastHost"
6739
+ };
6740
+
6741
+ // packages/mcps/src/shared/last-host.ts
6742
+ function readLastHost(cwd) {
6743
+ return readCwdEntry(LAST_HOST_CACHE, cwd);
6653
6744
  }
6654
6745
  function writeLastHost(cwd, host) {
6655
- const dir = path9.join(cwd, LAST_HOST_DIR_NAME);
6656
- fs5.mkdirSync(dir, { recursive: true });
6657
- const filePath = path9.join(dir, LAST_HOST_FILE_NAME);
6658
- const file = {
6659
- version: LAST_HOST_VERSION,
6660
- lastHost: { host, savedAt: (/* @__PURE__ */ new Date()).toISOString() }
6661
- };
6662
- fs5.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}
6663
- `, "utf-8");
6746
+ writeCwdEntry(LAST_HOST_CACHE, cwd, {
6747
+ host,
6748
+ savedAt: (/* @__PURE__ */ new Date()).toISOString()
6749
+ });
6664
6750
  }
6665
6751
  function clearLastHost(cwd) {
6666
- const filePath = path9.join(cwd, LAST_HOST_DIR_NAME, LAST_HOST_FILE_NAME);
6667
- if (fs5.existsSync(filePath)) {
6668
- fs5.unlinkSync(filePath);
6669
- }
6752
+ clearCwdEntry(LAST_HOST_CACHE, cwd);
6670
6753
  }
6671
6754
 
6672
6755
  // packages/mcps/src/mcp/tools/local/tool-registry.ts
@@ -6765,42 +6848,42 @@ var runResultGetTool = {
6765
6848
  logger6.info("Executing muggle-local-run-result-get");
6766
6849
  const input = RunResultGetInputSchema.parse(ctx.input);
6767
6850
  const storage = getRunResultStorageService();
6768
- const result = storage.getRunResult(input.runId);
6769
- if (!result) {
6851
+ const storedRunResult = storage.getRunResult(input.runId);
6852
+ if (!storedRunResult) {
6770
6853
  return { content: `Run result not found: ${input.runId}`, isError: true };
6771
6854
  }
6772
6855
  const contentParts = [
6773
6856
  "## Run Result Details",
6774
6857
  "",
6775
- `**ID:** ${result.id}`,
6776
- `**Type:** ${result.runType}`,
6777
- `**Status:** ${result.status}`,
6778
- `**Cloud Test Case:** ${result.cloudTestCaseId}`,
6779
- `**Duration:** ${result.executionTimeMs ?? 0}ms`,
6780
- result.errorMessage ? `**Error:** ${result.errorMessage}` : "",
6858
+ `**ID:** ${storedRunResult.id}`,
6859
+ `**Type:** ${storedRunResult.runType}`,
6860
+ `**Status:** ${storedRunResult.status}`,
6861
+ `**Cloud Test Case:** ${storedRunResult.cloudTestCaseId}`,
6862
+ `**Duration:** ${storedRunResult.executionTimeMs ?? 0}ms`,
6863
+ storedRunResult.errorMessage ? `**Error:** ${storedRunResult.errorMessage}` : "",
6781
6864
  // The studio publishes the run during execution; these are its returned cloud refs.
6782
- result.viewUrl ? `**View URL:** ${result.viewUrl}` : "",
6783
- result.cloudTestScriptId ? `**Cloud Test Script ID:** ${result.cloudTestScriptId}` : "",
6784
- result.cloudActionScriptId ? `**Cloud Action Script ID:** ${result.cloudActionScriptId}` : ""
6865
+ storedRunResult.viewUrl ? `**View URL:** ${storedRunResult.viewUrl}` : "",
6866
+ storedRunResult.cloudTestScriptId ? `**Cloud Test Script ID:** ${storedRunResult.cloudTestScriptId}` : "",
6867
+ storedRunResult.cloudActionScriptId ? `**Cloud Action Script ID:** ${storedRunResult.cloudActionScriptId}` : ""
6785
6868
  ];
6786
6869
  let testScriptSteps;
6787
- if (result.testScriptId) {
6788
- const testScript = storage.getTestScript(result.testScriptId);
6870
+ if (storedRunResult.testScriptId) {
6871
+ const testScript = storage.getTestScript(storedRunResult.testScriptId);
6789
6872
  testScriptSteps = testScript?.actionScript?.length;
6790
6873
  }
6791
- if (result.artifactsDir && fs5.existsSync(result.artifactsDir)) {
6874
+ if (storedRunResult.artifactsDir && fs5.existsSync(storedRunResult.artifactsDir)) {
6792
6875
  contentParts.push(
6793
6876
  "",
6794
6877
  "### Artifacts (view action script + screenshots)",
6795
6878
  "",
6796
- `**Location:** \`${result.artifactsDir}\``,
6879
+ `**Location:** \`${storedRunResult.artifactsDir}\``,
6797
6880
  ""
6798
6881
  );
6799
- const actionScriptPath = path9.join(result.artifactsDir, "action-script.json");
6800
- const resultsMdPath = path9.join(result.artifactsDir, "results.md");
6801
- const screenshotsDir = path9.join(result.artifactsDir, "screenshots");
6802
- const stdoutLogPath = path9.join(result.artifactsDir, "stdout.log");
6803
- const stderrLogPath = path9.join(result.artifactsDir, "stderr.log");
6882
+ const actionScriptPath = path9.join(storedRunResult.artifactsDir, "action-script.json");
6883
+ const resultsMdPath = path9.join(storedRunResult.artifactsDir, "results.md");
6884
+ const screenshotsDir = path9.join(storedRunResult.artifactsDir, "screenshots");
6885
+ const stdoutLogPath = path9.join(storedRunResult.artifactsDir, "stdout.log");
6886
+ const stderrLogPath = path9.join(storedRunResult.artifactsDir, "stderr.log");
6804
6887
  const artifactItems = [];
6805
6888
  if (fs5.existsSync(actionScriptPath)) {
6806
6889
  artifactItems.push("- `action-script.json` \u2014 generated test steps");
@@ -6826,13 +6909,13 @@ var runResultGetTool = {
6826
6909
  "",
6827
6910
  "### Ending state",
6828
6911
  "",
6829
- `- **Status:** ${result.status}`,
6830
- `- **Duration:** ${result.executionTimeMs ?? 0}ms`,
6912
+ `- **Status:** ${storedRunResult.status}`,
6913
+ `- **Duration:** ${storedRunResult.executionTimeMs ?? 0}ms`,
6831
6914
  testScriptSteps !== void 0 ? `- **Steps generated:** ${testScriptSteps}` : "",
6832
- result.artifactsDir ? `- **Artifacts path:** \`${result.artifactsDir}\`` : ""
6915
+ storedRunResult.artifactsDir ? `- **Artifacts path:** \`${storedRunResult.artifactsDir}\`` : ""
6833
6916
  );
6834
6917
  const content = contentParts.filter(Boolean).join("\n");
6835
- return { content, isError: false, data: result };
6918
+ return { content, isError: false, data: storedRunResult };
6836
6919
  }
6837
6920
  };
6838
6921
  var testScriptListTool = {
@@ -6892,7 +6975,7 @@ var executeTestGenerationTool = {
6892
6975
  const input = ExecuteTestGenerationInputSchema.parse(ctx.input);
6893
6976
  const showUi = input.showUi !== false;
6894
6977
  try {
6895
- const result = await executeTestGeneration({
6978
+ const generationRun = await executeTestGeneration({
6896
6979
  testCase: input.testCase,
6897
6980
  localUrl: input.localUrl,
6898
6981
  cwd: input.cwd,
@@ -6902,19 +6985,19 @@ var executeTestGenerationTool = {
6902
6985
  freshSession: input.freshSession
6903
6986
  });
6904
6987
  const content = [
6905
- "## Test Generation " + (result.status === "passed" ? "Successful" : "Failed"),
6988
+ "## Test Generation " + (generationRun.status === "passed" ? "Successful" : "Failed"),
6906
6989
  "",
6907
- `**Run ID:** ${result.id}`,
6908
- `**Test Script ID:** ${result.testScriptId}`,
6909
- `**Status:** ${result.status}`,
6910
- `**Duration:** ${result.executionTimeMs}ms`,
6990
+ `**Run ID:** ${generationRun.id}`,
6991
+ `**Test Script ID:** ${generationRun.testScriptId}`,
6992
+ `**Status:** ${generationRun.status}`,
6993
+ `**Duration:** ${generationRun.executionTimeMs}ms`,
6911
6994
  `**UI:** ${showUi ? "visible GUI" : "headless"}`,
6912
- result.errorMessage ? `**Error:** ${result.errorMessage}` : ""
6995
+ generationRun.errorMessage ? `**Error:** ${generationRun.errorMessage}` : ""
6913
6996
  ].filter(Boolean).join("\n");
6914
6997
  return {
6915
6998
  content,
6916
- isError: result.status !== "passed",
6917
- data: result
6999
+ isError: generationRun.status !== "passed",
7000
+ data: generationRun
6918
7001
  };
6919
7002
  } catch (error) {
6920
7003
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -6933,7 +7016,7 @@ var executeReplayTool = {
6933
7016
  const input = ExecuteReplayInputSchema.parse(ctx.input);
6934
7017
  const showUi = input.showUi !== false;
6935
7018
  try {
6936
- const result = await executeReplay({
7019
+ const replayRun = await executeReplay({
6937
7020
  testScript: input.testScript,
6938
7021
  actionScript: input.actionScript,
6939
7022
  localUrl: input.localUrl,
@@ -6944,19 +7027,19 @@ var executeReplayTool = {
6944
7027
  freshSession: input.freshSession
6945
7028
  });
6946
7029
  const content = [
6947
- "## Test Replay " + (result.status === "passed" ? "Successful" : "Failed"),
7030
+ "## Test Replay " + (replayRun.status === "passed" ? "Successful" : "Failed"),
6948
7031
  "",
6949
- `**Run ID:** ${result.id}`,
6950
- `**Test Script ID:** ${result.testScriptId}`,
6951
- `**Status:** ${result.status}`,
6952
- `**Duration:** ${result.executionTimeMs}ms`,
7032
+ `**Run ID:** ${replayRun.id}`,
7033
+ `**Test Script ID:** ${replayRun.testScriptId}`,
7034
+ `**Status:** ${replayRun.status}`,
7035
+ `**Duration:** ${replayRun.executionTimeMs}ms`,
6953
7036
  `**UI:** ${showUi ? "visible GUI" : "headless"}`,
6954
- result.errorMessage ? `**Error:** ${result.errorMessage}` : ""
7037
+ replayRun.errorMessage ? `**Error:** ${replayRun.errorMessage}` : ""
6955
7038
  ].filter(Boolean).join("\n");
6956
7039
  return {
6957
7040
  content,
6958
- isError: result.status !== "passed",
6959
- data: result
7041
+ isError: replayRun.status !== "passed",
7042
+ data: replayRun
6960
7043
  };
6961
7044
  } catch (error) {
6962
7045
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -6982,27 +7065,22 @@ var cancelExecutionTool = {
6982
7065
  };
6983
7066
  var preferencesSetTool = {
6984
7067
  name: "muggle-local-preferences-set",
6985
- description: "Set a Muggle AI user preference. Preferences control automation behavior (auto-login, show browser, suggest test cases, etc.). Values: 'always' (proceed without asking), 'ask' (prompt each time), 'never' (skip without asking). Scope: 'global' writes to ~/.muggle-ai/preferences.json, 'project' writes to .muggle-ai/preferences.json in the repo root.",
7068
+ description: "Set a Muggle AI user preference. Preferences control automation behavior (auto-login, show browser, suggest test cases, etc.). Values: 'always' (proceed without asking), 'ask' (prompt each time), 'never' (skip without asking). Preferences are user-level: they always write to ~/.muggle-ai/preferences.json and apply to every repo.",
6986
7069
  inputSchema: PreferencesSetInputSchema,
6987
7070
  execute: async (ctx) => {
6988
7071
  const logger6 = createChildLogger2(ctx.correlationId);
6989
7072
  logger6.info("Executing muggle-local-preferences-set");
6990
7073
  const input = PreferencesSetInputSchema.parse(ctx.input);
6991
- writePreferences2(
6992
- { [input.key]: input.value },
6993
- input.scope,
6994
- void 0,
6995
- input.cwd
6996
- );
7074
+ writePreferences2({ [input.key]: input.value });
6997
7075
  return {
6998
- content: `**${input.key}** set to **${input.value}** (${input.scope}).`,
7076
+ content: `**${input.key}** set to **${input.value}**.`,
6999
7077
  isError: false
7000
7078
  };
7001
7079
  }
7002
7080
  };
7003
7081
  var lastProjectGetTool = {
7004
7082
  name: "muggle-local-last-project-get",
7005
- description: "Get the cached last-used Muggle Test project for a repo (read from <cwd>/.muggle-ai/last-project.json). Returns the project ID, URL, name, and saved-at timestamp, or null if no cache exists. Skills consult this when 'autoSelectProject = always' to silently reuse the project the user picked previously, instead of presenting the project picker every time.",
7083
+ description: `Get the cached last-used Muggle Test project for a repo (read from the entry keyed on <cwd> in ${MUGGLE_HOME_DISPLAY_DIR}/${LAST_PROJECT_FILE_NAME}). Returns the project ID, URL, name, and saved-at timestamp, or null if no cache exists. Skills consult this when 'autoSelectProject = always' to silently reuse the project the user picked previously, instead of presenting the project picker every time.`,
7006
7084
  inputSchema: LastProjectGetInputSchema,
7007
7085
  execute: async (ctx) => {
7008
7086
  const logger6 = createChildLogger2(ctx.correlationId);
@@ -7013,7 +7091,7 @@ var lastProjectGetTool = {
7013
7091
  const content2 = [
7014
7092
  "No cached last-used project for this repo.",
7015
7093
  "",
7016
- `Looked at: \`${input.cwd}/.muggle-ai/${LAST_PROJECT_FILE_NAME}\``,
7094
+ `Looked at: \`${MUGGLE_HOME_DISPLAY_DIR}/${LAST_PROJECT_FILE_NAME}\` (entry for \`${input.cwd}\`)`,
7017
7095
  "",
7018
7096
  "The cache is populated when a user picks an existing project AND chooses 'Yes, save it' on the memory picker (the autoSelectProject preference)."
7019
7097
  ].join("\n");
@@ -7032,7 +7110,7 @@ var lastProjectGetTool = {
7032
7110
  };
7033
7111
  var lastProjectSetTool = {
7034
7112
  name: "muggle-local-last-project-set",
7035
- description: "Save the user's selected Muggle Test project as the cached last-used project for this repo. Writes to <cwd>/.muggle-ai/last-project.json. Subsequent skill invocations honor 'autoSelectProject = always' by silently reusing this entry \u2014 no project picker shown. Always pair this call with 'muggle-local-preferences-set autoSelectProject=always' when the user chose 'Yes, save it'.",
7113
+ description: `Save the user's selected Muggle Test project as the cached last-used project for this repo. Writes the entry keyed on <cwd> in ${MUGGLE_HOME_DISPLAY_DIR}/${LAST_PROJECT_FILE_NAME}. Subsequent skill invocations honor 'autoSelectProject = always' by silently reusing this entry \u2014 no project picker shown. Always pair this call with 'muggle-local-preferences-set autoSelectProject=always' when the user chose 'Yes, save it'.`,
7036
7114
  inputSchema: LastProjectSetInputSchema,
7037
7115
  execute: async (ctx) => {
7038
7116
  const logger6 = createChildLogger2(ctx.correlationId);
@@ -7046,7 +7124,7 @@ var lastProjectSetTool = {
7046
7124
  const content = [
7047
7125
  `Cached **${input.projectName}** as the last-used project for this repo.`,
7048
7126
  "",
7049
- `Written to: \`${input.cwd}/.muggle-ai/${LAST_PROJECT_FILE_NAME}\``,
7127
+ `Written to: \`${MUGGLE_HOME_DISPLAY_DIR}/${LAST_PROJECT_FILE_NAME}\` (entry for \`${input.cwd}\`)`,
7050
7128
  "",
7051
7129
  "Skills will silently reuse this project on future runs when `autoSelectProject = always`."
7052
7130
  ].join("\n");
@@ -7065,14 +7143,14 @@ var lastProjectClearTool = {
7065
7143
  const content = [
7066
7144
  "Cleared the cached last-used project for this repo.",
7067
7145
  "",
7068
- `Path: \`${input.cwd}/.muggle-ai/${LAST_PROJECT_FILE_NAME}\``
7146
+ `Path: \`${MUGGLE_HOME_DISPLAY_DIR}/${LAST_PROJECT_FILE_NAME}\` (entry for \`${input.cwd}\`)`
7069
7147
  ].join("\n");
7070
7148
  return { content, isError: false };
7071
7149
  }
7072
7150
  };
7073
7151
  var lastHostGetTool = {
7074
7152
  name: "muggle-local-last-host-get",
7075
- description: "Get the cached last-used local dev server URL for a repo (read from <cwd>/.muggle-ai/last-host.json). Returns the URL and saved-at timestamp, or null if no cache exists. Skills consult this when 'autoSelectLocalHost = always' to silently reuse the URL the user used previously.",
7153
+ description: `Get the cached last-used local dev server URL for a repo (read from the entry keyed on <cwd> in ${MUGGLE_HOME_DISPLAY_DIR}/${LAST_HOST_FILE_NAME}). Returns the URL and saved-at timestamp, or null if no cache exists. Skills consult this when 'autoSelectLocalHost = always' to silently reuse the URL the user used previously.`,
7076
7154
  inputSchema: LastHostGetInputSchema,
7077
7155
  execute: async (ctx) => {
7078
7156
  const logger6 = createChildLogger2(ctx.correlationId);
@@ -7083,7 +7161,7 @@ var lastHostGetTool = {
7083
7161
  const content2 = [
7084
7162
  "No cached last-used host for this repo.",
7085
7163
  "",
7086
- `Looked at: \`${input.cwd}/.muggle-ai/${LAST_HOST_FILE_NAME}\``
7164
+ `Looked at: \`${MUGGLE_HOME_DISPLAY_DIR}/${LAST_HOST_FILE_NAME}\` (entry for \`${input.cwd}\`)`
7087
7165
  ].join("\n");
7088
7166
  return { content: content2, isError: false };
7089
7167
  }
@@ -7098,7 +7176,7 @@ var lastHostGetTool = {
7098
7176
  };
7099
7177
  var lastHostSetTool = {
7100
7178
  name: "muggle-local-last-host-set",
7101
- description: "Save the user's chosen local dev server URL as the cached last-used host for this repo. Writes to <cwd>/.muggle-ai/last-host.json. Call this on every host pick (independent of 'Remember this URL?' Picker 2) so future runs can offer 'Use {lastHost}' regardless of whether the user opted to set autoSelectLocalHost=always.",
7179
+ description: `Save the user's chosen local dev server URL as the cached last-used host for this repo. Writes the entry keyed on <cwd> in ${MUGGLE_HOME_DISPLAY_DIR}/${LAST_HOST_FILE_NAME}. Call this on every host pick (independent of 'Remember this URL?' Picker 2) so future runs can offer 'Use {lastHost}' regardless of whether the user opted to set autoSelectLocalHost=always.`,
7102
7180
  inputSchema: LastHostSetInputSchema,
7103
7181
  execute: async (ctx) => {
7104
7182
  const logger6 = createChildLogger2(ctx.correlationId);
@@ -7208,7 +7286,7 @@ async function executeTool(name, input, correlationId) {
7208
7286
  props: { toolName: name, toolSurface: ToolSurface.Local, correlationId }
7209
7287
  });
7210
7288
  try {
7211
- const result = await tool.execute({ input, correlationId });
7289
+ const toolResult = await tool.execute({ input, correlationId });
7212
7290
  safeTrack2({
7213
7291
  name: EventName.McpToolCompleted,
7214
7292
  props: {
@@ -7216,10 +7294,10 @@ async function executeTool(name, input, correlationId) {
7216
7294
  toolSurface: ToolSurface.Local,
7217
7295
  correlationId,
7218
7296
  durationMs: Date.now() - startTime,
7219
- outcome: result.isError ? Outcome.Error : Outcome.Success
7297
+ outcome: toolResult.isError ? Outcome.Error : Outcome.Success
7220
7298
  }
7221
7299
  });
7222
- return result;
7300
+ return toolResult;
7223
7301
  } catch (err) {
7224
7302
  safeTrack2({
7225
7303
  name: EventName.McpToolCompleted,
@@ -7463,4 +7541,4 @@ var plugins_exports = {};
7463
7541
  // packages/mcps/src/mcp/agents/index.ts
7464
7542
  var agents_exports = {};
7465
7543
 
7466
- export { DEFAULT_PREFERENCES, EventName, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ServiceName, Surface, __export, __require, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, calculateFileChecksum, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports2 as e2e_exports, formatPreferencesOneLiner, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir2 as getDataDir, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getPlatformKey, getQaTools, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, mcp_exports, openBrowserUrl, performLogin, performLogout, pollDeviceCode, readGlobalPreferences, readProjectPreferences, resetConfig, resetLogger, resetPreference, resolveElectronAppPathOrNull, resolvePreferences, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writePreferences2 as writePreferences };
7544
+ export { DEFAULT_PREFERENCES, EventName, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, ServiceName, Surface, __export, __require, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, calculateFileChecksum, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports2 as e2e_exports, formatPreferencesOneLiner, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir2 as getDataDir, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getPlatformKey, getQaTools, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, mcp_exports, openBrowserUrl, performLogin, performLogout, pollDeviceCode, reconcileProjectPreferences, resetConfig, resetLogger, resetPreference, resolveElectronAppPathOrNull, resolvePreferences, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writePreferences2 as writePreferences };