@muggleai/works 5.24.0-staging.170 → 5.24.0-staging.172

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 (38) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-Y5AKXYEX.js → chunk-CKBHCCAM.js} +305 -162
  3. package/dist/{chunk-NC43LVME.js → chunk-YQAYCH3I.js} +6 -45
  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/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/scripts/guard-run-job-object.ps1 +83 -0
  12. package/dist/plugin/scripts/guard-run.mjs +35 -15
  13. package/dist/plugin/skills/do/open-prs/forward.md +1 -1
  14. package/dist/plugin/skills/muggle-feedback/ops/submit.md +2 -1
  15. package/dist/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +2 -2
  16. package/dist/plugin/skills/muggle-test/SKILL.md +5 -5
  17. package/dist/plugin/skills/muggle-test/execute-local.md +3 -3
  18. package/dist/plugin/skills/muggle-test-import/SKILL.md +4 -11
  19. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +2 -2
  20. package/dist/release-manifest.json +3 -3
  21. package/dist/src-RGG3V3ZX.js +1 -0
  22. package/package.json +2 -1
  23. package/plugin/.claude-plugin/plugin.json +1 -1
  24. package/plugin/.codex-mcp.json +1 -1
  25. package/plugin/.codex-plugin/plugin.json +1 -1
  26. package/plugin/.cursor-plugin/plugin.json +1 -1
  27. package/plugin/.mcp.json +1 -1
  28. package/plugin/scripts/guard-run-job-object.ps1 +83 -0
  29. package/plugin/scripts/guard-run.mjs +35 -15
  30. package/plugin/skills/do/open-prs/forward.md +1 -1
  31. package/plugin/skills/muggle-feedback/ops/submit.md +2 -1
  32. package/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +2 -2
  33. package/plugin/skills/muggle-test/SKILL.md +5 -5
  34. package/plugin/skills/muggle-test/execute-local.md +3 -3
  35. package/plugin/skills/muggle-test-import/SKILL.md +4 -11
  36. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +2 -2
  37. package/scripts/postinstall.mjs +4 -1
  38. package/dist/src-DUHGV6GP.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as fs4 from 'fs';
2
2
  import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
3
- import * as path14 from 'path';
3
+ import * as path15 from 'path';
4
4
  import { join, dirname } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import * as crypto from 'crypto';
@@ -31,6 +31,8 @@ var src_exports = {};
31
31
  __export(src_exports, {
32
32
  ACTION_SCRIPT_FILE_NAME: () => ACTION_SCRIPT_FILE_NAME,
33
33
  DEFAULT_PREFERENCES: () => DEFAULT_PREFERENCES,
34
+ ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS: () => ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS,
35
+ ElectronAppPlatform: () => ElectronAppPlatform,
34
36
  ElectronAppReleaseStream: () => ElectronAppReleaseStream,
35
37
  HTML_VIEW_OFFER_LINE: () => HTML_VIEW_OFFER_LINE,
36
38
  ONBOARDING_BLANKET_OPTIONS: () => ONBOARDING_BLANKET_OPTIONS,
@@ -52,6 +54,7 @@ __export(src_exports, {
52
54
  PreferenceValue: () => PreferenceValue,
53
55
  ProjectPreferencesReconcileOutcome: () => ProjectPreferencesReconcileOutcome,
54
56
  RUN_SESSIONS_DIR_NAME: () => RUN_SESSIONS_DIR_NAME,
57
+ RUN_VIEW_DASHBOARD_LINK_LABEL: () => RUN_VIEW_DASHBOARD_LINK_LABEL,
55
58
  RunViewError: () => RunViewError,
56
59
  RuntimeTarget: () => RuntimeTarget,
57
60
  SCREENSHOT_DIR_RELATIVE_PATH: () => SCREENSHOT_DIR_RELATIVE_PATH,
@@ -83,6 +86,7 @@ __export(src_exports, {
83
86
  getChecksumForPlatform: () => getChecksumForPlatform,
84
87
  getConfig: () => getConfig,
85
88
  getCredentialsFilePath: () => getCredentialsFilePath,
89
+ getDashboardBaseUrl: () => getDashboardBaseUrl,
86
90
  getDataDir: () => getDataDir2,
87
91
  getDownloadBaseUrl: () => getDownloadBaseUrl,
88
92
  getElectronAppChecksums: () => getElectronAppChecksums,
@@ -102,6 +106,7 @@ __export(src_exports, {
102
106
  getValidCredentials: () => getValidCredentials,
103
107
  hasApiKey: () => hasApiKey,
104
108
  isElectronAppInstalled: () => isElectronAppInstalled,
109
+ isElectronAppPlatform: () => isElectronAppPlatform,
105
110
  isFirstRun: () => isFirstRun,
106
111
  loadApiKeyData: () => loadApiKeyData,
107
112
  loadCredentials: () => loadCredentials,
@@ -127,6 +132,7 @@ __export(src_exports, {
127
132
  resolveActiveReleaseStream: () => resolveActiveReleaseStream,
128
133
  resolveActiveReleaseTagPrefix: () => resolveActiveReleaseTagPrefix,
129
134
  resolveBlanketPreferences: () => resolveBlanketPreferences,
135
+ resolveElectronAppExecutablePath: () => resolveElectronAppExecutablePath,
130
136
  resolveElectronAppPathOrNull: () => resolveElectronAppPathOrNull,
131
137
  resolveOnboardingAnswers: () => resolveOnboardingAnswers,
132
138
  resolvePreferences: () => resolvePreferences,
@@ -160,26 +166,26 @@ var ElectronAppReleaseStream = /* @__PURE__ */ ((ElectronAppReleaseStream3) => {
160
166
  var DEFAULT_AUTH0_SCOPE = "openid profile email offline_access";
161
167
  var DEFAULT_WEB_SERVICE_URL = "http://localhost:3001";
162
168
  var RUNTIME_TARGET_ENV_VAR = "MUGGLE_MCP_PROMPT_SERVICE_TARGET";
163
- var RUNTIME_TARGETS_FILE = path14.join("config", "runtime-targets.json");
169
+ var RUNTIME_TARGETS_FILE = path15.join("config", "runtime-targets.json");
164
170
  function getPackageRoot() {
165
- const currentDir = path14.dirname(fileURLToPath(import.meta.url));
166
- if (currentDir.includes(path14.join("dist", "shared"))) {
167
- return path14.resolve(currentDir, "..", "..");
171
+ const currentDir = path15.dirname(fileURLToPath(import.meta.url));
172
+ if (currentDir.includes(path15.join("dist", "shared"))) {
173
+ return path15.resolve(currentDir, "..", "..");
168
174
  }
169
175
  if (currentDir.endsWith("dist")) {
170
- return path14.resolve(currentDir, "..");
176
+ return path15.resolve(currentDir, "..");
171
177
  }
172
- if (currentDir.includes(path14.join("src", "shared"))) {
173
- return path14.resolve(currentDir, "..", "..", "..", "..");
178
+ if (currentDir.includes(path15.join("src", "shared"))) {
179
+ return path15.resolve(currentDir, "..", "..", "..", "..");
174
180
  }
175
- return path14.dirname(currentDir);
181
+ return path15.dirname(currentDir);
176
182
  }
177
183
  var runtimeTargetDataCache = null;
178
184
  function getRuntimeTargetData() {
179
185
  if (runtimeTargetDataCache) {
180
186
  return runtimeTargetDataCache;
181
187
  }
182
- const profilesPath = path14.join(getPackageRoot(), RUNTIME_TARGETS_FILE);
188
+ const profilesPath = path15.join(getPackageRoot(), RUNTIME_TARGETS_FILE);
183
189
  let parsedData;
184
190
  try {
185
191
  parsedData = JSON.parse(fs4.readFileSync(profilesPath, "utf-8"));
@@ -258,7 +264,33 @@ function assertDeviceCodeClientProvisioned(target) {
258
264
  }
259
265
  var DATA_DIR_NAME = ".muggle-ai";
260
266
  function getDataDir() {
261
- return path14.join(os4.homedir(), DATA_DIR_NAME);
267
+ return path15.join(os4.homedir(), DATA_DIR_NAME);
268
+ }
269
+
270
+ // packages/mcps/src/shared/electron-app-executable-types.ts
271
+ var ElectronAppPlatform = /* @__PURE__ */ ((ElectronAppPlatform2) => {
272
+ ElectronAppPlatform2["Darwin"] = "darwin";
273
+ ElectronAppPlatform2["Win32"] = "win32";
274
+ ElectronAppPlatform2["Linux"] = "linux";
275
+ return ElectronAppPlatform2;
276
+ })(ElectronAppPlatform || {});
277
+
278
+ // packages/mcps/src/shared/electron-app-executable-constants.ts
279
+ var ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS = {
280
+ ["darwin" /* Darwin */]: ["MuggleAI.app", "Contents", "MacOS", "MuggleAI"],
281
+ ["win32" /* Win32 */]: ["MuggleAI.exe"],
282
+ ["linux" /* Linux */]: ["muggle-ai-studio"]
283
+ };
284
+
285
+ // packages/mcps/src/shared/electron-app-executable.ts
286
+ function isElectronAppPlatform(platformName) {
287
+ return Object.values(ElectronAppPlatform).includes(platformName);
288
+ }
289
+ function resolveElectronAppExecutablePath(params) {
290
+ if (!isElectronAppPlatform(params.platformName)) {
291
+ throw new Error(`Unsupported platform: ${params.platformName}`);
292
+ }
293
+ return path15.join(params.installDir, ...ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS[params.platformName]);
262
294
  }
263
295
  var DEV_MANIFEST = {
264
296
  release: "dev",
@@ -312,24 +344,24 @@ var configInstance = null;
312
344
  var muggleConfigCache = null;
313
345
  function getPackageRoot2() {
314
346
  const currentFilePath = fileURLToPath(import.meta.url);
315
- const currentDir = path14.dirname(currentFilePath);
316
- if (currentDir.includes(path14.join("dist", "shared"))) {
317
- return path14.resolve(currentDir, "..", "..");
347
+ const currentDir = path15.dirname(currentFilePath);
348
+ if (currentDir.includes(path15.join("dist", "shared"))) {
349
+ return path15.resolve(currentDir, "..", "..");
318
350
  }
319
351
  if (currentDir.endsWith("dist")) {
320
- return path14.resolve(currentDir, "..");
352
+ return path15.resolve(currentDir, "..");
321
353
  }
322
- if (currentDir.includes(path14.join("src", "shared"))) {
323
- return path14.resolve(currentDir, "..", "..", "..", "..");
354
+ if (currentDir.includes(path15.join("src", "shared"))) {
355
+ return path15.resolve(currentDir, "..", "..", "..", "..");
324
356
  }
325
- return path14.dirname(currentDir);
357
+ return path15.dirname(currentDir);
326
358
  }
327
359
  function getMuggleConfig() {
328
360
  if (muggleConfigCache) {
329
361
  return muggleConfigCache;
330
362
  }
331
363
  const packageRoot = getPackageRoot2();
332
- const packageJsonPath = path14.join(packageRoot, "package.json");
364
+ const packageJsonPath = path15.join(packageRoot, "package.json");
333
365
  let packageJson;
334
366
  try {
335
367
  const content = fs4.readFileSync(packageJsonPath, "utf-8");
@@ -404,29 +436,18 @@ function buildOAuthSessionFileName(params) {
404
436
  }
405
437
  function getDownloadedElectronAppPath() {
406
438
  const platformName = os4.platform();
407
- const version = getElectronAppVersion();
408
- const baseDir = path14.join(
439
+ if (!isElectronAppPlatform(platformName)) {
440
+ return null;
441
+ }
442
+ const baseDir = path15.join(
409
443
  getDataDir2(),
410
444
  ELECTRON_APP_DIR,
411
445
  buildElectronAppDirName({
412
- version,
446
+ version: getElectronAppVersion(),
413
447
  releaseStream: getActiveElectronAppReleaseStream()
414
448
  })
415
449
  );
416
- let binaryPath;
417
- switch (platformName) {
418
- case "darwin":
419
- binaryPath = path14.join(baseDir, "MuggleAI.app", "Contents", "MacOS", "MuggleAI");
420
- break;
421
- case "win32":
422
- binaryPath = path14.join(baseDir, "MuggleAI.exe");
423
- break;
424
- case "linux":
425
- binaryPath = path14.join(baseDir, "MuggleAI");
426
- break;
427
- default:
428
- return null;
429
- }
450
+ const binaryPath = resolveElectronAppExecutablePath({ installDir: baseDir, platformName });
430
451
  if (fs4.existsSync(binaryPath)) {
431
452
  return binaryPath;
432
453
  }
@@ -435,20 +456,21 @@ function getDownloadedElectronAppPath() {
435
456
  function getSystemElectronAppPath() {
436
457
  const platformName = os4.platform();
437
458
  const homeDir = os4.homedir();
438
- let binaryPath;
459
+ let installDir;
439
460
  switch (platformName) {
440
461
  case "darwin":
441
- binaryPath = path14.join(homeDir, "Applications", "MuggleAI.app", "Contents", "MacOS", "MuggleAI");
462
+ installDir = path15.join(homeDir, "Applications");
442
463
  break;
443
464
  case "win32":
444
- binaryPath = path14.join(homeDir, "AppData", "Local", "Programs", "MuggleAI", "MuggleAI.exe");
465
+ installDir = path15.join(homeDir, "AppData", "Local", "Programs", "MuggleAI");
445
466
  break;
446
467
  case "linux":
447
- binaryPath = path14.join(homeDir, ".local", "share", "muggle-ai", "MuggleAI");
468
+ installDir = path15.join(homeDir, ".local", "share", "muggle-ai");
448
469
  break;
449
470
  default:
450
471
  return null;
451
472
  }
473
+ const binaryPath = resolveElectronAppExecutablePath({ installDir, platformName });
452
474
  if (fs4.existsSync(binaryPath)) {
453
475
  return binaryPath;
454
476
  }
@@ -475,7 +497,7 @@ function resolveWebServicePath() {
475
497
  return customPath;
476
498
  }
477
499
  const packageRoot = getPackageRoot2();
478
- const siblingPath = path14.resolve(packageRoot, "..", "web-service", "dist", "src", "index.js");
500
+ const siblingPath = path15.resolve(packageRoot, "..", "web-service", "dist", "src", "index.js");
479
501
  if (fs4.existsSync(siblingPath)) {
480
502
  return siblingPath;
481
503
  }
@@ -494,6 +516,9 @@ function getActiveRuntimeTarget() {
494
516
  function getActiveProfile() {
495
517
  return resolveActiveProfile(getMuggleConfig().runtimeTargetDefault);
496
518
  }
519
+ function getDashboardBaseUrl() {
520
+ return getActiveProfile().dashboardBaseUrl;
521
+ }
497
522
  function buildAuth0Config() {
498
523
  const activeProfile = getActiveProfile();
499
524
  return {
@@ -518,16 +543,16 @@ function buildLocalQaConfig() {
518
543
  webServiceUrl: process.env.WEB_SERVICE_URL ?? DEFAULT_WEB_SERVICE_URL,
519
544
  promptServiceUrl: process.env.PROMPT_SERVICE_BASE_URL ?? activeProfile.promptServiceBaseUrl,
520
545
  dataDir,
521
- sessionsDir: path14.join(dataDir, "sessions"),
522
- projectsDir: path14.join(dataDir, "projects"),
523
- tempDir: path14.join(dataDir, "temp"),
524
- apiKeyFilePath: path14.join(dataDir, API_KEY_FILE),
525
- oauthSessionFilePath: path14.join(
546
+ sessionsDir: path15.join(dataDir, "sessions"),
547
+ projectsDir: path15.join(dataDir, "projects"),
548
+ tempDir: path15.join(dataDir, "temp"),
549
+ apiKeyFilePath: path15.join(dataDir, API_KEY_FILE),
550
+ oauthSessionFilePath: path15.join(
526
551
  dataDir,
527
552
  buildOAuthSessionFileName({ runtimeTarget: getActiveRuntimeTarget() })
528
553
  ),
529
554
  webServicePath: resolveWebServicePath(),
530
- webServicePidFile: path14.join(dataDir, "web-service.pid"),
555
+ webServicePidFile: path15.join(dataDir, "web-service.pid"),
531
556
  auth0: {
532
557
  domain: process.env.AUTH0_DOMAIN ?? activeProfile.auth0Domain,
533
558
  clientId: process.env.AUTH0_CLIENT_ID ?? activeProfile.auth0ClientId,
@@ -562,7 +587,7 @@ function getElectronAppVersion() {
562
587
  if (envVersion && /^\d+\.\d+\.\d+$/.test(envVersion)) {
563
588
  return envVersion;
564
589
  }
565
- const overridePath = path14.join(getDataDir2(), VERSION_OVERRIDE_FILE);
590
+ const overridePath = path15.join(getDataDir2(), VERSION_OVERRIDE_FILE);
566
591
  if (fs4.existsSync(overridePath)) {
567
592
  try {
568
593
  const content = JSON.parse(fs4.readFileSync(overridePath, "utf-8"));
@@ -579,7 +604,7 @@ function getElectronAppVersionSource() {
579
604
  if (envVersion && /^\d+\.\d+\.\d+$/.test(envVersion)) {
580
605
  return "env";
581
606
  }
582
- const overridePath = path14.join(getDataDir2(), VERSION_OVERRIDE_FILE);
607
+ const overridePath = path15.join(getDataDir2(), VERSION_OVERRIDE_FILE);
583
608
  if (fs4.existsSync(overridePath)) {
584
609
  try {
585
610
  const content = JSON.parse(fs4.readFileSync(overridePath, "utf-8"));
@@ -626,7 +651,7 @@ function isElectronAppInstalled() {
626
651
  }
627
652
  function getElectronAppDir(version) {
628
653
  const resolvedVersion = version ?? getElectronAppVersion();
629
- return path14.join(
654
+ return path15.join(
630
655
  getDataDir2(),
631
656
  ELECTRON_APP_DIR,
632
657
  buildElectronAppDirName({
@@ -707,7 +732,7 @@ async function calculateFileChecksum(filePath) {
707
732
  async function verifyFileChecksum(filePath, expectedChecksum) {
708
733
  if (!expectedChecksum || expectedChecksum.trim() === "") {
709
734
  logger.warn("Checksum verification skipped - no checksum provided", {
710
- file: path14.basename(filePath)
735
+ file: path15.basename(filePath)
711
736
  });
712
737
  return {
713
738
  valid: true,
@@ -723,13 +748,13 @@ async function verifyFileChecksum(filePath, expectedChecksum) {
723
748
  const valid = normalizedExpected === normalizedActual;
724
749
  if (!valid) {
725
750
  logger.error("Checksum verification failed", {
726
- file: path14.basename(filePath),
751
+ file: path15.basename(filePath),
727
752
  expected: normalizedExpected,
728
753
  actual: normalizedActual
729
754
  });
730
755
  } else {
731
756
  logger.info("Checksum verified successfully", {
732
- file: path14.basename(filePath),
757
+ file: path15.basename(filePath),
733
758
  checksum: normalizedActual
734
759
  });
735
760
  }
@@ -742,7 +767,7 @@ async function verifyFileChecksum(filePath, expectedChecksum) {
742
767
  } catch (error) {
743
768
  const errorMessage = error instanceof Error ? error.message : String(error);
744
769
  logger.error("Checksum calculation failed", {
745
- file: path14.basename(filePath),
770
+ file: path15.basename(filePath),
746
771
  error: errorMessage
747
772
  });
748
773
  return {
@@ -814,6 +839,7 @@ var ACTION_SCRIPT_FILE_NAME = "action-script.json";
814
839
  var SCREENSHOT_DIR_RELATIVE_PATH = "electron-runtime/screenshot";
815
840
  var SCREENSHOT_FILE_EXTENSION = ".jpg";
816
841
  var HTML_VIEW_OFFER_LINE = "See the frames: re-run with --html (add --open to open it).";
842
+ var RUN_VIEW_DASHBOARD_LINK_LABEL = "Open on Muggle AI";
817
843
 
818
844
  // packages/mcps/src/mcp/local/types/enums.ts
819
845
  var DeviceCodePollStatus = /* @__PURE__ */ ((DeviceCodePollStatus2) => {
@@ -935,11 +961,11 @@ var StorageService = class {
935
961
  createSessionDirectory(sessionId) {
936
962
  const logger7 = getLogger();
937
963
  this.ensureDirectories();
938
- const sessionDir = path14.join(this.sessionsDir, sessionId);
964
+ const sessionDir = path15.join(this.sessionsDir, sessionId);
939
965
  if (!fs4.existsSync(sessionDir)) {
940
966
  fs4.mkdirSync(sessionDir, { recursive: true });
941
- fs4.mkdirSync(path14.join(sessionDir, "screenshots"), { recursive: true });
942
- fs4.mkdirSync(path14.join(sessionDir, "logs"), { recursive: true });
967
+ fs4.mkdirSync(path15.join(sessionDir, "screenshots"), { recursive: true });
968
+ fs4.mkdirSync(path15.join(sessionDir, "logs"), { recursive: true });
943
969
  logger7.info("Created session directory", { sessionId, path: sessionDir });
944
970
  }
945
971
  return sessionDir;
@@ -951,7 +977,7 @@ var StorageService = class {
951
977
  saveSessionMetadata(metadata) {
952
978
  const logger7 = getLogger();
953
979
  const sessionDir = this.createSessionDirectory(metadata.sessionId);
954
- const metadataPath = path14.join(sessionDir, "metadata.json");
980
+ const metadataPath = path15.join(sessionDir, "metadata.json");
955
981
  fs4.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2), "utf-8");
956
982
  logger7.debug("Saved session metadata", { sessionId: metadata.sessionId });
957
983
  }
@@ -962,7 +988,7 @@ var StorageService = class {
962
988
  */
963
989
  loadSessionMetadata(sessionId) {
964
990
  const logger7 = getLogger();
965
- const metadataPath = path14.join(this.sessionsDir, sessionId, "metadata.json");
991
+ const metadataPath = path15.join(this.sessionsDir, sessionId, "metadata.json");
966
992
  if (!fs4.existsSync(metadataPath)) {
967
993
  return null;
968
994
  }
@@ -986,7 +1012,7 @@ var StorageService = class {
986
1012
  return [];
987
1013
  }
988
1014
  return fs4.readdirSync(this.sessionsDir).filter((entry) => {
989
- const entryPath = path14.join(this.sessionsDir, entry);
1015
+ const entryPath = path15.join(this.sessionsDir, entry);
990
1016
  return fs4.statSync(entryPath).isDirectory();
991
1017
  });
992
1018
  }
@@ -995,13 +1021,13 @@ var StorageService = class {
995
1021
  * @returns Current session ID, or null.
996
1022
  */
997
1023
  getCurrentSessionId() {
998
- const currentPath = path14.join(this.sessionsDir, "current");
1024
+ const currentPath = path15.join(this.sessionsDir, "current");
999
1025
  if (!fs4.existsSync(currentPath)) {
1000
1026
  return null;
1001
1027
  }
1002
1028
  try {
1003
1029
  const target = fs4.readlinkSync(currentPath);
1004
- return path14.basename(target);
1030
+ return path15.basename(target);
1005
1031
  } catch {
1006
1032
  return null;
1007
1033
  }
@@ -1012,8 +1038,8 @@ var StorageService = class {
1012
1038
  */
1013
1039
  setCurrentSession(sessionId) {
1014
1040
  const logger7 = getLogger();
1015
- const currentPath = path14.join(this.sessionsDir, "current");
1016
- const targetPath = path14.join(this.sessionsDir, sessionId);
1041
+ const currentPath = path15.join(this.sessionsDir, "current");
1042
+ const targetPath = path15.join(this.sessionsDir, sessionId);
1017
1043
  if (fs4.existsSync(currentPath)) {
1018
1044
  fs4.unlinkSync(currentPath);
1019
1045
  }
@@ -1028,7 +1054,7 @@ var StorageService = class {
1028
1054
  const { sessionId, filename, data } = params;
1029
1055
  const logger7 = getLogger();
1030
1056
  const sessionDir = this.createSessionDirectory(sessionId);
1031
- const screenshotPath = path14.join(sessionDir, "screenshots", filename);
1057
+ const screenshotPath = path15.join(sessionDir, "screenshots", filename);
1032
1058
  fs4.writeFileSync(screenshotPath, data);
1033
1059
  logger7.debug("Saved screenshot", { sessionId, filename });
1034
1060
  return screenshotPath;
@@ -1041,7 +1067,7 @@ var StorageService = class {
1041
1067
  const { sessionId, content } = params;
1042
1068
  const logger7 = getLogger();
1043
1069
  const sessionDir = this.createSessionDirectory(sessionId);
1044
- const resultsPath = path14.join(sessionDir, "results.md");
1070
+ const resultsPath = path15.join(sessionDir, "results.md");
1045
1071
  fs4.appendFileSync(resultsPath, content + "\n", "utf-8");
1046
1072
  logger7.debug("Appended to results", { sessionId });
1047
1073
  }
@@ -1051,7 +1077,7 @@ var StorageService = class {
1051
1077
  * @returns Results content, or null if not found.
1052
1078
  */
1053
1079
  getResults(sessionId) {
1054
- const resultsPath = path14.join(this.sessionsDir, sessionId, "results.md");
1080
+ const resultsPath = path15.join(this.sessionsDir, sessionId, "results.md");
1055
1081
  if (!fs4.existsSync(resultsPath)) {
1056
1082
  return null;
1057
1083
  }
@@ -1120,7 +1146,7 @@ var StorageService = class {
1120
1146
  const { sessionId, targetUrl, testInstructions } = params;
1121
1147
  const logger7 = getLogger();
1122
1148
  const sessionDir = this.createSessionDirectory(sessionId);
1123
- const resultsPath = path14.join(sessionDir, "results.md");
1149
+ const resultsPath = path15.join(sessionDir, "results.md");
1124
1150
  const header = [
1125
1151
  `# Test Results: ${sessionId}`,
1126
1152
  "",
@@ -1144,7 +1170,7 @@ var StorageService = class {
1144
1170
  const { sessionId, step } = params;
1145
1171
  const logger7 = getLogger();
1146
1172
  const sessionDir = this.createSessionDirectory(sessionId);
1147
- const resultsPath = path14.join(sessionDir, "results.md");
1173
+ const resultsPath = path15.join(sessionDir, "results.md");
1148
1174
  const statusIcon = step.success ? "\u2713" : "\u2717";
1149
1175
  const stepContent = [
1150
1176
  `### Step ${step.stepNumber}: ${step.action}`,
@@ -1169,8 +1195,8 @@ var StorageService = class {
1169
1195
  finalizeResults(params) {
1170
1196
  const { sessionId, status, summary } = params;
1171
1197
  const logger7 = getLogger();
1172
- const sessionDir = path14.join(this.sessionsDir, sessionId);
1173
- const resultsPath = path14.join(sessionDir, "results.md");
1198
+ const sessionDir = path15.join(this.sessionsDir, sessionId);
1199
+ const resultsPath = path15.join(sessionDir, "results.md");
1174
1200
  if (!fs4.existsSync(resultsPath)) {
1175
1201
  logger7.warn("Results file not found for finalization", { sessionId });
1176
1202
  return;
@@ -1252,7 +1278,7 @@ var StorageService = class {
1252
1278
  }
1253
1279
  const sessionDate = new Date(metadata.startTime);
1254
1280
  if (sessionDate < cutoffDate) {
1255
- const sessionDir = path14.join(this.sessionsDir, sessionId);
1281
+ const sessionDir = path15.join(this.sessionsDir, sessionId);
1256
1282
  try {
1257
1283
  fs4.rmSync(sessionDir, { recursive: true, force: true });
1258
1284
  deletedCount++;
@@ -1282,7 +1308,7 @@ var StorageService = class {
1282
1308
  * @returns Session directory path.
1283
1309
  */
1284
1310
  getSessionPath(sessionId) {
1285
- return path14.join(this.sessionsDir, sessionId);
1311
+ return path15.join(this.sessionsDir, sessionId);
1286
1312
  }
1287
1313
  /**
1288
1314
  * Delete a specific session.
@@ -1291,7 +1317,7 @@ var StorageService = class {
1291
1317
  */
1292
1318
  deleteSession(sessionId) {
1293
1319
  const logger7 = getLogger();
1294
- const sessionDir = path14.join(this.sessionsDir, sessionId);
1320
+ const sessionDir = path15.join(this.sessionsDir, sessionId);
1295
1321
  if (!fs4.existsSync(sessionDir)) {
1296
1322
  logger7.warn("Session not found for deletion", { sessionId });
1297
1323
  return false;
@@ -1299,7 +1325,7 @@ var StorageService = class {
1299
1325
  try {
1300
1326
  const currentId = this.getCurrentSessionId();
1301
1327
  if (currentId === sessionId) {
1302
- const currentPath = path14.join(this.sessionsDir, "current");
1328
+ const currentPath = path15.join(this.sessionsDir, "current");
1303
1329
  if (fs4.existsSync(currentPath)) {
1304
1330
  fs4.unlinkSync(currentPath);
1305
1331
  }
@@ -1335,8 +1361,8 @@ var RunResultStorageService = class {
1335
1361
  constructor() {
1336
1362
  const storageService = getStorageService();
1337
1363
  const dataDir = storageService.getDataDir();
1338
- this.runResultsDir = path14.join(dataDir, "run-results");
1339
- this.testScriptsDir = path14.join(dataDir, "test-scripts");
1364
+ this.runResultsDir = path15.join(dataDir, "run-results");
1365
+ this.testScriptsDir = path15.join(dataDir, "test-scripts");
1340
1366
  this.ensureDirectories();
1341
1367
  }
1342
1368
  /**
@@ -1362,7 +1388,7 @@ var RunResultStorageService = class {
1362
1388
  const results = [];
1363
1389
  for (const file of files) {
1364
1390
  try {
1365
- const content = fs4.readFileSync(path14.join(this.runResultsDir, file), "utf-8");
1391
+ const content = fs4.readFileSync(path15.join(this.runResultsDir, file), "utf-8");
1366
1392
  results.push(JSON.parse(content));
1367
1393
  } catch {
1368
1394
  logger3.warn("Failed to read run result file", { file });
@@ -1377,7 +1403,7 @@ var RunResultStorageService = class {
1377
1403
  * Get a run result by ID.
1378
1404
  */
1379
1405
  getRunResult(runId) {
1380
- const filePath = path14.join(this.runResultsDir, `${runId}.json`);
1406
+ const filePath = path15.join(this.runResultsDir, `${runId}.json`);
1381
1407
  if (!fs4.existsSync(filePath)) {
1382
1408
  return void 0;
1383
1409
  }
@@ -1392,7 +1418,7 @@ var RunResultStorageService = class {
1392
1418
  * Save a run result.
1393
1419
  */
1394
1420
  saveRunResult(result) {
1395
- const filePath = path14.join(this.runResultsDir, `${result.id}.json`);
1421
+ const filePath = path15.join(this.runResultsDir, `${result.id}.json`);
1396
1422
  fs4.writeFileSync(filePath, JSON.stringify(result, null, 2));
1397
1423
  }
1398
1424
  /**
@@ -1445,7 +1471,7 @@ var RunResultStorageService = class {
1445
1471
  const scripts = [];
1446
1472
  for (const file of files) {
1447
1473
  try {
1448
- const content = fs4.readFileSync(path14.join(this.testScriptsDir, file), "utf-8");
1474
+ const content = fs4.readFileSync(path15.join(this.testScriptsDir, file), "utf-8");
1449
1475
  scripts.push(JSON.parse(content));
1450
1476
  } catch {
1451
1477
  logger3.warn("Failed to read test script file", { file });
@@ -1460,7 +1486,7 @@ var RunResultStorageService = class {
1460
1486
  * Get a test script by ID.
1461
1487
  */
1462
1488
  getTestScript(testScriptId) {
1463
- const filePath = path14.join(this.testScriptsDir, `${testScriptId}.json`);
1489
+ const filePath = path15.join(this.testScriptsDir, `${testScriptId}.json`);
1464
1490
  if (!fs4.existsSync(filePath)) {
1465
1491
  return void 0;
1466
1492
  }
@@ -1475,7 +1501,7 @@ var RunResultStorageService = class {
1475
1501
  * Save a test script.
1476
1502
  */
1477
1503
  saveTestScript(script) {
1478
- const filePath = path14.join(this.testScriptsDir, `${script.id}.json`);
1504
+ const filePath = path15.join(this.testScriptsDir, `${script.id}.json`);
1479
1505
  fs4.writeFileSync(filePath, JSON.stringify(script, null, 2));
1480
1506
  }
1481
1507
  /**
@@ -1527,7 +1553,7 @@ function resetRunResultStorageService() {
1527
1553
 
1528
1554
  // packages/mcps/src/mcp/local/services/run-view/read-run-view.ts
1529
1555
  function getRunSessionsDir() {
1530
- return path14.join(getDataDir(), RUN_SESSIONS_DIR_NAME);
1556
+ return path15.join(getDataDir(), RUN_SESSIONS_DIR_NAME);
1531
1557
  }
1532
1558
  var RunViewError = class extends Error {
1533
1559
  };
@@ -1544,16 +1570,16 @@ function resolveRunSessionPath(runId) {
1544
1570
  throw new RunViewError(`No runs found under ${sessionsDir}`);
1545
1571
  }
1546
1572
  if (!runId) {
1547
- const newest = names.map((name) => ({ name, modifiedAtMs: fs4.statSync(path14.join(sessionsDir, name)).mtimeMs })).sort((left, right) => right.modifiedAtMs - left.modifiedAtMs)[0];
1548
- return path14.join(sessionsDir, newest.name);
1573
+ const newest = names.map((name) => ({ name, modifiedAtMs: fs4.statSync(path15.join(sessionsDir, name)).mtimeMs })).sort((left, right) => right.modifiedAtMs - left.modifiedAtMs)[0];
1574
+ return path15.join(sessionsDir, newest.name);
1549
1575
  }
1550
1576
  const exact = names.find((name) => name === runId);
1551
1577
  if (exact) {
1552
- return path14.join(sessionsDir, exact);
1578
+ return path15.join(sessionsDir, exact);
1553
1579
  }
1554
1580
  const prefixed = names.filter((name) => name.startsWith(runId));
1555
1581
  if (prefixed.length === 1) {
1556
- return path14.join(sessionsDir, prefixed[0]);
1582
+ return path15.join(sessionsDir, prefixed[0]);
1557
1583
  }
1558
1584
  if (prefixed.length > 1) {
1559
1585
  throw new RunViewError(
@@ -1563,7 +1589,7 @@ function resolveRunSessionPath(runId) {
1563
1589
  throw new RunViewError(`No run matching "${runId}" under ${sessionsDir}`);
1564
1590
  }
1565
1591
  var listScreenshotFileNames = (sessionPath) => {
1566
- const screenshotDir = path14.join(sessionPath, ...SCREENSHOT_DIR_RELATIVE_PATH.split("/"));
1592
+ const screenshotDir = path15.join(sessionPath, ...SCREENSHOT_DIR_RELATIVE_PATH.split("/"));
1567
1593
  if (!fs4.existsSync(screenshotDir)) {
1568
1594
  return [];
1569
1595
  }
@@ -1578,14 +1604,14 @@ var resolveScreenshotPath = (sessionPath, screenshotFileNames, recordedPath) =>
1578
1604
  return null;
1579
1605
  }
1580
1606
  const match = screenshotFileNames.find((name) => name === recordedName) ?? screenshotFileNames.find((name) => name.endsWith(recordedName));
1581
- return match ? path14.join(sessionPath, ...SCREENSHOT_DIR_RELATIVE_PATH.split("/"), match) : null;
1607
+ return match ? path15.join(sessionPath, ...SCREENSHOT_DIR_RELATIVE_PATH.split("/"), match) : null;
1582
1608
  };
1583
1609
  function readRunView(runId) {
1584
1610
  const sessionPath = resolveRunSessionPath(runId);
1585
- const actionScriptPath = path14.join(sessionPath, ACTION_SCRIPT_FILE_NAME);
1611
+ const actionScriptPath = path15.join(sessionPath, ACTION_SCRIPT_FILE_NAME);
1586
1612
  if (!fs4.existsSync(actionScriptPath)) {
1587
1613
  throw new RunViewError(
1588
- `Run ${path14.basename(sessionPath)} has no ${ACTION_SCRIPT_FILE_NAME} \u2014 it died before writing one. Looked in ${sessionPath}`
1614
+ `Run ${path15.basename(sessionPath)} has no ${ACTION_SCRIPT_FILE_NAME} \u2014 it died before writing one. Looked in ${sessionPath}`
1589
1615
  );
1590
1616
  }
1591
1617
  let actionScript;
@@ -1596,8 +1622,9 @@ function readRunView(runId) {
1596
1622
  `Could not read ${actionScriptPath}: ${parseError instanceof Error ? parseError.message : String(parseError)}`
1597
1623
  );
1598
1624
  }
1599
- const resolvedRunId = path14.basename(sessionPath);
1600
- const recordedOutcome = getRunResultStorageService().getRunResult(resolvedRunId)?.status ?? null;
1625
+ const resolvedRunId = path15.basename(sessionPath);
1626
+ const storedRunResult = getRunResultStorageService().getRunResult(resolvedRunId);
1627
+ const recordedOutcome = storedRunResult?.status ?? null;
1601
1628
  const screenshotFileNames = listScreenshotFileNames(sessionPath);
1602
1629
  const steps = (actionScript.steps ?? []).map((step, index) => ({
1603
1630
  index,
@@ -1612,6 +1639,7 @@ function readRunView(runId) {
1612
1639
  title: actionScript.actionScriptName ?? null,
1613
1640
  status: recordedOutcome,
1614
1641
  verdict: actionScript.summaryStep?.briefExplanation ?? null,
1642
+ viewUrl: storedRunResult?.viewUrl ?? null,
1615
1643
  steps,
1616
1644
  screenshotCount: screenshotFileNames.length
1617
1645
  };
@@ -1623,6 +1651,7 @@ function renderRunViewText(runView, options) {
1623
1651
  `Run ${runView.runId}${runView.title ? ` \u2014 ${runView.title}` : ""}`,
1624
1652
  `${runView.status ?? "status unrecorded"} \xB7 ${runView.steps.length} steps \xB7 ${runView.screenshotCount} frames`,
1625
1653
  runView.sessionPath,
1654
+ ...runView.viewUrl ? [`${RUN_VIEW_DASHBOARD_LINK_LABEL}: ${runView.viewUrl}`] : [],
1626
1655
  ""
1627
1656
  ];
1628
1657
  const stepLines = runView.steps.length === 0 ? ["(no steps recorded \u2014 the run ended before writing any)"] : runView.steps.flatMap((step) => {
@@ -1702,6 +1731,7 @@ function renderRunViewHtml(runView) {
1702
1731
  <h1>${escapeHtml(title)}</h1>
1703
1732
  <p class="sub">${escapeHtml(runView.status ?? "status unrecorded")} \xB7 ${runView.steps.length} steps \xB7 ${runView.screenshotCount} frames</p>
1704
1733
  <p class="path">${escapeHtml(runView.sessionPath)}</p>
1734
+ ${runView.viewUrl ? `<p class="sub"><a href="${escapeHtml(runView.viewUrl)}" target="_blank" rel="noopener noreferrer">${RUN_VIEW_DASHBOARD_LINK_LABEL} \u2192</a></p>` : ""}
1705
1735
  ${runView.verdict ? `<div class="verdict"><h2>Verdict the run recorded</h2><p>${escapeHtml(runView.verdict)}</p></div>` : ""}
1706
1736
  <ol>
1707
1737
  ${runView.steps.map(renderStep).join("\n")}
@@ -1714,13 +1744,13 @@ ${runView.steps.map(renderStep).join("\n")}
1714
1744
  function writeRunViewHtml(runView, outputDir) {
1715
1745
  const targetDir = outputDir ?? process.cwd();
1716
1746
  fs4.mkdirSync(targetDir, { recursive: true });
1717
- const targetPath = path14.join(targetDir, `run-${runView.runId}.html`);
1747
+ const targetPath = path15.join(targetDir, `run-${runView.runId}.html`);
1718
1748
  fs4.writeFileSync(targetPath, renderRunViewHtml(runView), "utf8");
1719
1749
  return targetPath;
1720
1750
  }
1721
1751
  var API_KEY_FILE2 = "api-key.json";
1722
1752
  function getApiKeyFilePath() {
1723
- return path14.join(getDataDir(), API_KEY_FILE2);
1753
+ return path15.join(getDataDir(), API_KEY_FILE2);
1724
1754
  }
1725
1755
  function ensureDataDir() {
1726
1756
  const dataDir = getDataDir();
@@ -1871,8 +1901,8 @@ var AuthService = class {
1871
1901
  constructor() {
1872
1902
  const config = getConfig();
1873
1903
  this.oauthSessionFilePath = config.localQa.oauthSessionFilePath;
1874
- this.pendingDeviceCodePath = path14.join(
1875
- path14.dirname(config.localQa.oauthSessionFilePath),
1904
+ this.pendingDeviceCodePath = path15.join(
1905
+ path15.dirname(config.localQa.oauthSessionFilePath),
1876
1906
  "pending-device-code.json"
1877
1907
  );
1878
1908
  }
@@ -1981,7 +2011,7 @@ var AuthService = class {
1981
2011
  */
1982
2012
  storePendingDeviceCode(params) {
1983
2013
  const logger7 = getLogger();
1984
- const dir = path14.dirname(this.pendingDeviceCodePath);
2014
+ const dir = path15.dirname(this.pendingDeviceCodePath);
1985
2015
  if (!fs4.existsSync(dir)) {
1986
2016
  fs4.mkdirSync(dir, { recursive: true });
1987
2017
  }
@@ -2195,7 +2225,7 @@ var AuthService = class {
2195
2225
  userId,
2196
2226
  runtimeTarget: getActiveRuntimeTarget()
2197
2227
  };
2198
- const dir = path14.dirname(this.oauthSessionFilePath);
2228
+ const dir = path15.dirname(this.oauthSessionFilePath);
2199
2229
  if (!fs4.existsSync(dir)) {
2200
2230
  fs4.mkdirSync(dir, { recursive: true });
2201
2231
  }
@@ -2319,7 +2349,7 @@ var AuthService = class {
2319
2349
  userId: storedAuth.userId,
2320
2350
  runtimeTarget: storedAuth.runtimeTarget ?? getActiveRuntimeTarget()
2321
2351
  };
2322
- const dir = path14.dirname(this.oauthSessionFilePath);
2352
+ const dir = path15.dirname(this.oauthSessionFilePath);
2323
2353
  if (!fs4.existsSync(dir)) {
2324
2354
  fs4.mkdirSync(dir, { recursive: true });
2325
2355
  }
@@ -2629,7 +2659,7 @@ var PREFERENCES_SCHEMA = {
2629
2659
 
2630
2660
  // packages/mcps/src/shared/llm-env-service.ts
2631
2661
  function resolveLlmEnvOverrides(dataDirOverride2) {
2632
- const filePath = path14.join(getDataDir(), PREFERENCES_FILE_NAME);
2662
+ const filePath = path15.join(getDataDir(), PREFERENCES_FILE_NAME);
2633
2663
  let block;
2634
2664
  try {
2635
2665
  if (!fs4.existsSync(filePath)) {
@@ -2873,7 +2903,7 @@ var STOP_REQUEST_FILE_SUFFIX = "_stop_requested";
2873
2903
  // packages/mcps/src/mcp/local/services/execution-stop.ts
2874
2904
  var logger4 = getLogger();
2875
2905
  function buildStopRequestFilePath(params) {
2876
- return path14.join(params.tempDir, `${params.runId}${STOP_REQUEST_FILE_SUFFIX}`);
2906
+ return path15.join(params.tempDir, `${params.runId}${STOP_REQUEST_FILE_SUFFIX}`);
2877
2907
  }
2878
2908
  async function requestGracefulStopAsync(params) {
2879
2909
  try {
@@ -2917,13 +2947,13 @@ var MODIFY_LOCK_STALE_MS = 5e3;
2917
2947
 
2918
2948
  // packages/mcps/src/mcp/local/services/local-execution-lock.ts
2919
2949
  function lockFilePath() {
2920
- return path14.join(getDataDir(), LOCK_FILE_NAME);
2950
+ return path15.join(getDataDir(), LOCK_FILE_NAME);
2921
2951
  }
2922
2952
  function modifyLockPath() {
2923
2953
  return lockFilePath() + MODIFY_LOCK_SUFFIX;
2924
2954
  }
2925
2955
  function normalizeCwd(cwd) {
2926
- const resolved = path14.resolve(cwd);
2956
+ const resolved = path15.resolve(cwd);
2927
2957
  return os4.platform() === "win32" ? resolved.toLowerCase() : resolved;
2928
2958
  }
2929
2959
  function pidIsAlive(pid) {
@@ -2957,7 +2987,7 @@ async function deleteStateFile() {
2957
2987
  }
2958
2988
  }
2959
2989
  async function withModifyLock(fn) {
2960
- await fs13.mkdir(path14.dirname(modifyLockPath()), { recursive: true });
2990
+ await fs13.mkdir(path15.dirname(modifyLockPath()), { recursive: true });
2961
2991
  const modifyPath = modifyLockPath();
2962
2992
  let fileHandle = null;
2963
2993
  while (fileHandle === null) {
@@ -3125,9 +3155,9 @@ function extractStudioCloudRefs(studioReturnedResult) {
3125
3155
  return refs;
3126
3156
  }
3127
3157
  async function readCloudRefsFile(inputFilePath) {
3128
- const cloudRefsPath = path14.join(
3129
- path14.dirname(inputFilePath),
3130
- `cloudrefs_${path14.basename(inputFilePath)}`
3158
+ const cloudRefsPath = path15.join(
3159
+ path15.dirname(inputFilePath),
3160
+ `cloudrefs_${path15.basename(inputFilePath)}`
3131
3161
  );
3132
3162
  try {
3133
3163
  return JSON.parse(await fs13.readFile(cloudRefsPath, "utf-8"));
@@ -3149,11 +3179,11 @@ function getAuthenticatedUserId() {
3149
3179
  }
3150
3180
  async function findPackageJsonAsync() {
3151
3181
  const currentFileUrl = import.meta.url;
3152
- const currentDir = path14.dirname(fileURLToPath(currentFileUrl));
3182
+ const currentDir = path15.dirname(fileURLToPath(currentFileUrl));
3153
3183
  const candidatePaths = [
3154
- path14.resolve(currentDir, "../../../package.json"),
3155
- path14.resolve(currentDir, "../package.json"),
3156
- path14.resolve(currentDir, "../../package.json")
3184
+ path15.resolve(currentDir, "../../../package.json"),
3185
+ path15.resolve(currentDir, "../package.json"),
3186
+ path15.resolve(currentDir, "../../package.json")
3157
3187
  ];
3158
3188
  for (const candidatePath of candidatePaths) {
3159
3189
  try {
@@ -3203,13 +3233,13 @@ function buildStudioAuthContent() {
3203
3233
  }
3204
3234
  async function ensureTempDir() {
3205
3235
  const config = getConfig();
3206
- const tempDir = path14.join(config.localQa.dataDir, "temp");
3236
+ const tempDir = path15.join(config.localQa.dataDir, "temp");
3207
3237
  await fs13.mkdir(tempDir, { recursive: true });
3208
3238
  return tempDir;
3209
3239
  }
3210
3240
  async function writeTempFile(params) {
3211
3241
  const tempDir = await ensureTempDir();
3212
- const filePath = path14.join(tempDir, params.filename);
3242
+ const filePath = path15.join(tempDir, params.filename);
3213
3243
  await fs13.writeFile(filePath, JSON.stringify(params.data, null, 2));
3214
3244
  return filePath;
3215
3245
  }
@@ -3224,8 +3254,8 @@ async function cleanupTempFiles(params) {
3224
3254
  async function moveResultsToArtifacts(params) {
3225
3255
  const storageService = getStorageService();
3226
3256
  const sessionsDir = storageService.getSessionsDir();
3227
- const artifactsDir = path14.join(sessionsDir, params.runId);
3228
- const actionScriptPath = path14.join(artifactsDir, "action-script.json");
3257
+ const artifactsDir = path15.join(sessionsDir, params.runId);
3258
+ const actionScriptPath = path15.join(artifactsDir, "action-script.json");
3229
3259
  await fs13.mkdir(artifactsDir, { recursive: true });
3230
3260
  await fs13.copyFile(params.generatedScriptPath, actionScriptPath);
3231
3261
  try {
@@ -3237,10 +3267,10 @@ async function moveResultsToArtifacts(params) {
3237
3267
  async function writeExecutionLogs(params) {
3238
3268
  const storageService = getStorageService();
3239
3269
  const sessionsDir = storageService.getSessionsDir();
3240
- const artifactsDir = path14.join(sessionsDir, params.runId);
3270
+ const artifactsDir = path15.join(sessionsDir, params.runId);
3241
3271
  await fs13.mkdir(artifactsDir, { recursive: true });
3242
- const stdoutPath = path14.join(artifactsDir, "stdout.log");
3243
- const stderrPath = path14.join(artifactsDir, "stderr.log");
3272
+ const stdoutPath = path15.join(artifactsDir, "stdout.log");
3273
+ const stderrPath = path15.join(artifactsDir, "stderr.log");
3244
3274
  await Promise.all([
3245
3275
  fs13.writeFile(stdoutPath, params.stdout, "utf-8"),
3246
3276
  fs13.writeFile(stderrPath, params.stderr, "utf-8")
@@ -3253,7 +3283,7 @@ async function writeExecutionLogs(params) {
3253
3283
  async function preserveElectronRuntimeArtifacts(params) {
3254
3284
  try {
3255
3285
  const tempDir = await ensureTempDir();
3256
- const markerPath = path14.join(tempDir, `${params.runId}_runtime_dir.txt`);
3286
+ const markerPath = path15.join(tempDir, `${params.runId}_runtime_dir.txt`);
3257
3287
  let runtimeDir = null;
3258
3288
  try {
3259
3289
  const marker = await fs13.readFile(markerPath, "utf-8");
@@ -3288,7 +3318,7 @@ async function preserveElectronRuntimeArtifacts(params) {
3288
3318
  return;
3289
3319
  }
3290
3320
  const storage = getStorageService();
3291
- const destDir = path14.join(storage.getSessionsDir(), params.runId, "electron-runtime");
3321
+ const destDir = path15.join(storage.getSessionsDir(), params.runId, "electron-runtime");
3292
3322
  await fs13.mkdir(destDir, { recursive: true });
3293
3323
  await fs13.cp(runtimeDir, destDir, { recursive: true });
3294
3324
  logger5.info("Preserved Electron runtime artifacts", {
@@ -3305,13 +3335,13 @@ async function preserveElectronRuntimeArtifacts(params) {
3305
3335
  }
3306
3336
  }
3307
3337
  async function scanForRuntimeDirByMtime(params) {
3308
- const runtimeRoot = path14.join(params.electronCwd, "user_data", "runtime");
3338
+ const runtimeRoot = path15.join(params.electronCwd, "user_data", "runtime");
3309
3339
  try {
3310
3340
  const entries = await fs13.readdir(runtimeRoot, { withFileTypes: true });
3311
3341
  let bestCandidate = null;
3312
3342
  for (const entry of entries) {
3313
3343
  if (!entry.isDirectory()) continue;
3314
- const fullPath = path14.join(runtimeRoot, entry.name);
3344
+ const fullPath = path15.join(runtimeRoot, entry.name);
3315
3345
  const stat3 = await fs13.stat(fullPath);
3316
3346
  if (stat3.mtimeMs < params.spawnAtMs) continue;
3317
3347
  if (bestCandidate === null || stat3.mtimeMs > bestCandidate.mtimeMs) {
@@ -3399,7 +3429,7 @@ async function executeElectronAppAsync(params) {
3399
3429
  spawnArgs,
3400
3430
  llmEnvOverrideNames
3401
3431
  });
3402
- const electronCwd = path14.dirname(electronAppPath);
3432
+ const electronCwd = path15.dirname(electronAppPath);
3403
3433
  const child = spawn(electronAppPath, spawnArgs, {
3404
3434
  stdio: ["ignore", "pipe", "pipe"],
3405
3435
  env: electronEnv,
@@ -3592,16 +3622,16 @@ async function runTestGenerationLocked(params) {
3592
3622
  if (executionResult.exitCode !== 0 || executionResult.stopReason !== void 0) {
3593
3623
  const failureMessage = describeElectronFailure({ executionResult, timeoutMs });
3594
3624
  const sessionsDir = getStorageService().getSessionsDir();
3595
- const artifactsDir2 = path14.join(sessionsDir, runId);
3596
- const generatedScriptPath2 = path14.join(
3597
- path14.dirname(inputFilePath),
3598
- `gen_${path14.basename(inputFilePath)}`
3625
+ const artifactsDir2 = path15.join(sessionsDir, runId);
3626
+ const generatedScriptPath2 = path15.join(
3627
+ path15.dirname(inputFilePath),
3628
+ `gen_${path15.basename(inputFilePath)}`
3599
3629
  );
3600
3630
  let failedStudioResult;
3601
3631
  try {
3602
3632
  const failedScriptRaw = await fs13.readFile(generatedScriptPath2, "utf-8");
3603
3633
  failedStudioResult = JSON.parse(failedScriptRaw);
3604
- await fs13.copyFile(generatedScriptPath2, path14.join(artifactsDir2, "action-script.json"));
3634
+ await fs13.copyFile(generatedScriptPath2, path15.join(artifactsDir2, "action-script.json"));
3605
3635
  await fs13.unlink(generatedScriptPath2).catch(() => {
3606
3636
  });
3607
3637
  } catch {
@@ -3631,9 +3661,9 @@ async function runTestGenerationLocked(params) {
3631
3661
  errorMessage: failureMessage
3632
3662
  };
3633
3663
  }
3634
- const generatedScriptPath = path14.join(
3635
- path14.dirname(inputFilePath),
3636
- `gen_${path14.basename(inputFilePath)}`
3664
+ const generatedScriptPath = path15.join(
3665
+ path15.dirname(inputFilePath),
3666
+ `gen_${path15.basename(inputFilePath)}`
3637
3667
  );
3638
3668
  const generatedScriptRaw = await fs13.readFile(generatedScriptPath, "utf-8");
3639
3669
  const generatedScript = JSON.parse(generatedScriptRaw);
@@ -3777,7 +3807,7 @@ async function runReplayLocked(params) {
3777
3807
  });
3778
3808
  if (executionResult.exitCode !== 0 || executionResult.stopReason !== void 0) {
3779
3809
  const failureMessage = describeElectronFailure({ executionResult, timeoutMs });
3780
- const artifactsDir2 = path14.join(getStorageService().getSessionsDir(), runId);
3810
+ const artifactsDir2 = path15.join(getStorageService().getSessionsDir(), runId);
3781
3811
  const failedReplayStudioResult = await readCloudRefsFile(inputFilePath);
3782
3812
  storage.updateRunResult(runId, {
3783
3813
  status: resolveFailedRunStatus(executionResult),
@@ -3798,7 +3828,7 @@ async function runReplayLocked(params) {
3798
3828
  errorMessage: failureMessage
3799
3829
  };
3800
3830
  }
3801
- const artifactsDir = path14.join(getStorageService().getSessionsDir(), runId);
3831
+ const artifactsDir = path15.join(getStorageService().getSessionsDir(), runId);
3802
3832
  const replayStudioResult = await readCloudRefsFile(inputFilePath);
3803
3833
  const replayStudioCloudRefs = extractStudioCloudRefs(replayStudioResult);
3804
3834
  storage.updateRunResult(runId, {
@@ -4223,6 +4253,45 @@ __export(e2e_exports, {
4223
4253
  executeQaTool: () => executeQaTool,
4224
4254
  getQaToolByName: () => getQaToolByName
4225
4255
  });
4256
+
4257
+ // packages/mcps/src/shared/dashboard-link/dashboard-link-constants.ts
4258
+ var DASHBOARD_PROJECT_PAGE_SEGMENTS = {
4259
+ ["project" /* Project */]: "",
4260
+ ["test-cases" /* TestCases */]: "testcases",
4261
+ ["scripts" /* Scripts */]: "scripts",
4262
+ ["runs" /* Runs */]: "runs"
4263
+ };
4264
+ var SCRIPTS_MODAL_QUERY_KEY = "modal";
4265
+ var SCRIPT_DETAILS_MODAL_VALUE = "script-details";
4266
+ var SCRIPTS_MODAL_TEST_CASE_ID_KEY = "testCaseId";
4267
+ var SCRIPTS_MODAL_ACTION_SCRIPT_ID_KEY = "actionScriptId";
4268
+ var DASHBOARD_URL_FIELD = "dashboardUrl";
4269
+
4270
+ // packages/mcps/src/shared/dashboard-link/dashboard-link.ts
4271
+ function buildDashboardUrl(target, dashboardBaseUrl = getDashboardBaseUrl()) {
4272
+ if (target.page === "projects" /* Projects */) {
4273
+ return dashboardBaseUrl;
4274
+ }
4275
+ const projectUrl = `${dashboardBaseUrl}/${encodeURIComponent(target.projectId)}`;
4276
+ if (target.page === "script-details" /* ScriptDetails */) {
4277
+ const query = new URLSearchParams({
4278
+ [SCRIPTS_MODAL_QUERY_KEY]: SCRIPT_DETAILS_MODAL_VALUE,
4279
+ [SCRIPTS_MODAL_TEST_CASE_ID_KEY]: target.testCaseId
4280
+ });
4281
+ if (target.actionScriptId) {
4282
+ query.set(SCRIPTS_MODAL_ACTION_SCRIPT_ID_KEY, target.actionScriptId);
4283
+ }
4284
+ return `${projectUrl}/${DASHBOARD_PROJECT_PAGE_SEGMENTS["scripts" /* Scripts */]}?${query.toString()}`;
4285
+ }
4286
+ const segment = DASHBOARD_PROJECT_PAGE_SEGMENTS[target.page];
4287
+ return segment ? `${projectUrl}/${segment}` : projectUrl;
4288
+ }
4289
+ function withDashboardUrl(toolOutput, dashboardUrl) {
4290
+ if (toolOutput === null || typeof toolOutput !== "object" || Array.isArray(toolOutput)) {
4291
+ return toolOutput;
4292
+ }
4293
+ return { ...toolOutput, [DASHBOARD_URL_FIELD]: dashboardUrl };
4294
+ }
4226
4295
  var INSTALL_ID_FILENAME = "install-id.json";
4227
4296
  var cachedInstallId;
4228
4297
  function installIdFilePath() {
@@ -4327,7 +4396,7 @@ var PREFS_FILENAME = "preferences.json";
4327
4396
  var OAUTH_SESSION_FILENAME = "oauth-session.json";
4328
4397
  var RELEASE_MANIFEST_FILENAME = "release-manifest.json";
4329
4398
  function getDataDir3() {
4330
- return path14.join(os4.homedir(), DATA_DIR_NAME2);
4399
+ return path15.join(os4.homedir(), DATA_DIR_NAME2);
4331
4400
  }
4332
4401
 
4333
4402
  var cachedInstallId2;
@@ -4392,9 +4461,9 @@ function isValid3(value) {
4392
4461
  function readReleaseManifest2() {
4393
4462
  if (cachedManifest2 !== void 0)
4394
4463
  return cachedManifest2;
4395
- const path20 = MANIFEST_PATH2;
4464
+ const path21 = MANIFEST_PATH2;
4396
4465
  try {
4397
- const raw = readFileSync(path20, "utf8");
4466
+ const raw = readFileSync(path21, "utf8");
4398
4467
  const parsed = JSON.parse(raw);
4399
4468
  cachedManifest2 = isValid3(parsed) ? parsed : DEV_MANIFEST2;
4400
4469
  return cachedManifest2;
@@ -5213,17 +5282,17 @@ var PromptServiceClient = class {
5213
5282
  * @param path - Path to validate.
5214
5283
  * @throws GatewayError if path is not allowed.
5215
5284
  */
5216
- validatePath(path20) {
5217
- const isAllowed = ALLOWED_UPSTREAM_PREFIXES.some((prefix) => path20.startsWith(prefix));
5285
+ validatePath(path21) {
5286
+ const isAllowed = ALLOWED_UPSTREAM_PREFIXES.some((prefix) => path21.startsWith(prefix));
5218
5287
  if (!isAllowed) {
5219
5288
  const logger7 = getLogger();
5220
5289
  logger7.error("Path not in allowlist", {
5221
- path: path20,
5290
+ path: path21,
5222
5291
  allowedPrefixes: ALLOWED_UPSTREAM_PREFIXES
5223
5292
  });
5224
5293
  throw new GatewayError({
5225
5294
  code: "FORBIDDEN" /* FORBIDDEN */,
5226
- message: `Path '${path20}' is not allowed`
5295
+ message: `Path '${path21}' is not allowed`
5227
5296
  });
5228
5297
  }
5229
5298
  }
@@ -5537,6 +5606,52 @@ async function resolveFieldAsync(params) {
5537
5606
  return resolvedId;
5538
5607
  }
5539
5608
 
5609
+ // packages/mcps/src/mcp/tools/e2e/dashboard-link-targets.ts
5610
+ function readStringField(source, key) {
5611
+ if (source === null || typeof source !== "object") {
5612
+ return void 0;
5613
+ }
5614
+ const fieldValue = source[key];
5615
+ return typeof fieldValue === "string" && fieldValue !== "" ? fieldValue : void 0;
5616
+ }
5617
+ function linkToProjects() {
5618
+ return { page: "projects" /* Projects */ };
5619
+ }
5620
+ function linkToInputProjectPage(page) {
5621
+ return (input) => {
5622
+ const projectId = readStringField(input, "projectId");
5623
+ return projectId ? { page, projectId } : null;
5624
+ };
5625
+ }
5626
+ function linkToCreatedProject(_input, response) {
5627
+ const projectId = readStringField(response.data, "id");
5628
+ return projectId ? { page: "project" /* Project */, projectId } : null;
5629
+ }
5630
+ function linkToInputScriptDetails(input) {
5631
+ const projectId = readStringField(input, "projectId");
5632
+ const testCaseId = readStringField(input, "testCaseId");
5633
+ return projectId && testCaseId ? { page: "script-details" /* ScriptDetails */, projectId, testCaseId } : null;
5634
+ }
5635
+ function linkToFetchedTestCase(input, response) {
5636
+ const projectId = readStringField(response.data, "projectId");
5637
+ const testCaseId = readStringField(input, "testCaseId");
5638
+ return projectId && testCaseId ? { page: "script-details" /* ScriptDetails */, projectId, testCaseId } : null;
5639
+ }
5640
+ function linkToFetchedTestScript(_input, response) {
5641
+ const projectId = readStringField(response.data, "projectId");
5642
+ const testCaseId = readStringField(response.data, "testCaseId");
5643
+ if (!projectId || !testCaseId) {
5644
+ return null;
5645
+ }
5646
+ const actionScriptId = readStringField(response.data, "actionScriptId");
5647
+ return {
5648
+ page: "script-details" /* ScriptDetails */,
5649
+ projectId,
5650
+ testCaseId,
5651
+ ...actionScriptId ? { actionScriptId } : {}
5652
+ };
5653
+ }
5654
+
5540
5655
  // packages/mcps/src/mcp/tools/e2e/organization-list-transform.ts
5541
5656
  function mapOrganizationList(response) {
5542
5657
  const envelope = response.data;
@@ -5612,6 +5727,7 @@ var projectTools = [
5612
5727
  name: "muggle-remote-project-create",
5613
5728
  description: "Create an E2E acceptance testing project to organize browser tests for a web app. A project groups test scenarios (use cases), specific test steps (test cases), and replayable browser scripts (test scripts) for one application. Create a project first before generating or running any E2E tests. Pass organizationId to create it under an organization the caller belongs to; omit it for a personal project.",
5614
5729
  inputSchema: ProjectCreateInputSchema,
5730
+ dashboardLink: linkToCreatedProject,
5615
5731
  mapToUpstream: (input) => {
5616
5732
  const toolInput = input;
5617
5733
  const body = {
@@ -5631,6 +5747,7 @@ var projectTools = [
5631
5747
  name: "muggle-remote-project-get",
5632
5748
  description: "Get details of a specific project by ID.",
5633
5749
  inputSchema: ProjectGetInputSchema,
5750
+ dashboardLink: linkToInputProjectPage("project" /* Project */),
5634
5751
  mapToUpstream: (input) => {
5635
5752
  const toolInput = input;
5636
5753
  return {
@@ -5661,6 +5778,7 @@ var projectTools = [
5661
5778
  name: "muggle-remote-project-list",
5662
5779
  description: "List projects accessible to the authenticated user. Returns up to 10 items per page by default (max 100). Response includes pagination metadata (totalCount, totalPages, hasMore) \u2014 check `hasMore` to decide whether to fetch additional pages.",
5663
5780
  inputSchema: ProjectListInputSchema,
5781
+ dashboardLink: linkToProjects,
5664
5782
  mapToUpstream: (input) => {
5665
5783
  const toolInput = input;
5666
5784
  return {
@@ -5730,6 +5848,7 @@ var useCaseTools = [
5730
5848
  name: "muggle-remote-use-case-list",
5731
5849
  description: "List use cases for a project. Returns up to 10 items per page by default (max 100). Response includes pagination metadata (totalCount, totalPages, hasMore) \u2014 check `hasMore` to decide whether to fetch additional pages.",
5732
5850
  inputSchema: UseCaseListInputSchema,
5851
+ dashboardLink: linkToInputProjectPage("test-cases" /* TestCases */),
5733
5852
  mapToUpstream: (input) => {
5734
5853
  const toolInput = input;
5735
5854
  return {
@@ -5827,6 +5946,7 @@ var useCaseTools = [
5827
5946
  name: "muggle-remote-use-case-create",
5828
5947
  description: "Create a single use case from a fully-specified payload. Use this to persist use cases returned by muggle-remote-use-case-bulk-preview-submit \u2014 no LLM is invoked.",
5829
5948
  inputSchema: UseCaseCreateInputSchema,
5949
+ dashboardLink: linkToInputProjectPage("test-cases" /* TestCases */),
5830
5950
  mapToUpstream: (input) => {
5831
5951
  const toolInput = input;
5832
5952
  return {
@@ -5878,6 +5998,7 @@ var testCaseTools = [
5878
5998
  name: "muggle-remote-test-case-list",
5879
5999
  description: "List test cases for a project. Returns up to 10 items per page by default (max 100). Response includes pagination metadata (totalCount, totalPages, hasMore) \u2014 check `hasMore` to decide whether to fetch additional pages.",
5880
6000
  inputSchema: TestCaseListInputSchema,
6001
+ dashboardLink: linkToInputProjectPage("test-cases" /* TestCases */),
5881
6002
  mapToUpstream: (input) => {
5882
6003
  const toolInput = input;
5883
6004
  return {
@@ -5898,6 +6019,7 @@ var testCaseTools = [
5898
6019
  description: "Get details of a specific test case.",
5899
6020
  inputSchema: TestCaseGetInputSchema,
5900
6021
  entityReferenceFields: [TEST_CASE_ID_REFERENCE_FIELD],
6022
+ dashboardLink: linkToFetchedTestCase,
5901
6023
  mapToUpstream: (input) => {
5902
6024
  const toolInput = input;
5903
6025
  return {
@@ -5960,6 +6082,7 @@ var testCaseTools = [
5960
6082
  name: "muggle-remote-test-case-create",
5961
6083
  description: "Create a new test case for a use case.",
5962
6084
  inputSchema: TestCaseCreateInputSchema,
6085
+ dashboardLink: linkToInputProjectPage("test-cases" /* TestCases */),
5963
6086
  mapToUpstream: (input) => {
5964
6087
  const toolInput = input;
5965
6088
  return {
@@ -6091,6 +6214,7 @@ var testScriptTools = [
6091
6214
  name: "muggle-remote-test-script-list",
6092
6215
  description: "List test scripts for a project, optionally filtered by test case and by environment lane. Returns up to 10 items per page by default (max 100). Response includes pagination metadata (totalCount, totalPages, hasMore) \u2014 check `hasMore` to decide whether to fetch additional pages.",
6093
6216
  inputSchema: TestScriptListInputSchema,
6217
+ dashboardLink: linkToInputProjectPage("scripts" /* Scripts */),
6094
6218
  mapToUpstream: (input) => {
6095
6219
  const toolInput = input;
6096
6220
  return {
@@ -6113,6 +6237,7 @@ var testScriptTools = [
6113
6237
  description: "Get details of a specific test script.",
6114
6238
  inputSchema: TestScriptGetInputSchema,
6115
6239
  entityReferenceFields: [TEST_SCRIPT_ID_REFERENCE_FIELD],
6240
+ dashboardLink: linkToFetchedTestScript,
6116
6241
  mapToUpstream: (input) => {
6117
6242
  const toolInput = input;
6118
6243
  return {
@@ -6256,6 +6381,7 @@ var workflowTools = [
6256
6381
  name: "muggle-remote-workflow-start-test-script-generation",
6257
6382
  description: "Start a test script generation workflow.",
6258
6383
  inputSchema: WorkflowStartTestScriptGenerationInputSchema,
6384
+ dashboardLink: linkToInputScriptDetails,
6259
6385
  mapToUpstream: (input) => {
6260
6386
  const toolInput = input;
6261
6387
  return {
@@ -6282,6 +6408,7 @@ var workflowTools = [
6282
6408
  name: "muggle-remote-workflow-start-test-script-generation-bulk",
6283
6409
  description: "Start a bulk test script generation workflow to generate scripts for multiple test cases in a single request.",
6284
6410
  inputSchema: WorkflowStartTestScriptGenerationBulkInputSchema,
6411
+ dashboardLink: linkToInputProjectPage("scripts" /* Scripts */),
6285
6412
  mapToUpstream: (input) => {
6286
6413
  const toolInput = input;
6287
6414
  return {
@@ -6326,6 +6453,7 @@ var workflowTools = [
6326
6453
  description: "Start a test script replay workflow to execute a single test script.",
6327
6454
  inputSchema: WorkflowStartTestScriptReplayInputSchema,
6328
6455
  entityReferenceFields: [USE_CASE_ID_REFERENCE_FIELD, TEST_CASE_ID_REFERENCE_FIELD, TEST_SCRIPT_ID_REFERENCE_FIELD],
6456
+ dashboardLink: linkToInputScriptDetails,
6329
6457
  mapToUpstream: (input) => {
6330
6458
  const toolInput = input;
6331
6459
  return {
@@ -6360,6 +6488,7 @@ var workflowTools = [
6360
6488
  name: "muggle-remote-workflow-start-test-script-replay-bulk",
6361
6489
  description: "Start a bulk test script replay workflow to execute multiple test scripts.",
6362
6490
  inputSchema: WorkflowStartTestScriptReplayBulkInputSchema,
6491
+ dashboardLink: linkToInputProjectPage("runs" /* Runs */),
6363
6492
  mapToUpstream: (input) => {
6364
6493
  const toolInput = input;
6365
6494
  return {
@@ -6484,6 +6613,7 @@ var reportTools = [
6484
6613
  name: "muggle-remote-project-test-results-summary-get",
6485
6614
  description: "Get a summary of test results for a project.",
6486
6615
  inputSchema: ProjectTestResultsSummaryInputSchema,
6616
+ dashboardLink: linkToInputProjectPage("runs" /* Runs */),
6487
6617
  mapToUpstream: (input) => {
6488
6618
  const toolInput = input;
6489
6619
  return {
@@ -6496,6 +6626,7 @@ var reportTools = [
6496
6626
  name: "muggle-remote-project-test-scripts-summary-get",
6497
6627
  description: "Get a paginated, slimmed script-generation summary for a project. One row per TEST CASE, not per script: a test case with no script yet still gets a row, with `testScriptId` absent and a status such as TEST_CASE_DRAFTED. Row count is therefore a test-case count \u2014 do not read it as a number of scripts, and do not infer from a row's presence that a script exists. Response shape: { page, pageSize, totalCount, totalPages, hasMore, scripts: [{ status, testCaseId, testCaseTitle, useCaseId, useCaseTitle, testScriptId, lastRunAt, error }] }. Returns 20 rows per page by default (max 100). Check `hasMore` to decide whether to fetch additional pages. Use muggle-remote-test-script-get for full per-script detail.",
6498
6628
  inputSchema: ProjectTestScriptsSummaryInputSchema,
6629
+ dashboardLink: linkToInputProjectPage("scripts" /* Scripts */),
6499
6630
  mapToUpstream: (input) => {
6500
6631
  const toolInput = input;
6501
6632
  return {
@@ -6515,6 +6646,7 @@ var reportTools = [
6515
6646
  name: "muggle-remote-project-test-runs-summary-get",
6516
6647
  description: "Get a paginated, slimmed summary of latest test runs for a project. Response shape: { page, pageSize, totalCount, totalPages, hasMore, runs: [{ status, testCaseId, testCaseTitle, useCaseId, useCaseTitle, lastRunAt, error, latestWorkflowRunId }] }. Returns 20 runs per page by default (max 100). `totalCount` is the project-wide total after the replay-status filter; `runs` is the page slice. Check `hasMore` to decide whether to fetch additional pages. Use muggle-remote-test-case-get / muggle-remote-wf-get-ts-replay-latest-run for full per-run detail.",
6517
6648
  inputSchema: ProjectTestRunsSummaryInputSchema,
6649
+ dashboardLink: linkToInputProjectPage("runs" /* Runs */),
6518
6650
  mapToUpstream: (input) => {
6519
6651
  const toolInput = input;
6520
6652
  return {
@@ -7290,8 +7422,10 @@ async function executeQaTool(toolName, input, correlationId) {
7290
7422
  const response = await client.execute(upstreamCall, credentials, correlationId);
7291
7423
  const mapper = tool.mapFromUpstream || defaultResponseMapper;
7292
7424
  const mappedResponse = mapper(response, resolvedInput);
7425
+ const dashboardLinkTarget = tool.dashboardLink?.(resolvedInput, response) ?? null;
7426
+ const toolOutput = dashboardLinkTarget ? withDashboardUrl(mappedResponse, buildDashboardUrl(dashboardLinkTarget)) : mappedResponse;
7293
7427
  return {
7294
- content: JSON.stringify(mappedResponse, null, 2),
7428
+ content: JSON.stringify(toolOutput, null, 2),
7295
7429
  isError: false
7296
7430
  };
7297
7431
  } catch (error) {
@@ -7551,9 +7685,9 @@ var TELEMETRY_DIR_NAME = "telemetry";
7551
7685
  var FAILURE_EVENTS_FILE_NAME = "failure-events.jsonl";
7552
7686
  function appendFailureEvent(record) {
7553
7687
  try {
7554
- const dir = path14.join(getDataDir(), TELEMETRY_DIR_NAME);
7688
+ const dir = path15.join(getDataDir(), TELEMETRY_DIR_NAME);
7555
7689
  fs4.mkdirSync(dir, { recursive: true });
7556
- const filePath = path14.join(dir, FAILURE_EVENTS_FILE_NAME);
7690
+ const filePath = path15.join(dir, FAILURE_EVENTS_FILE_NAME);
7557
7691
  const full = { ts: (/* @__PURE__ */ new Date()).toISOString(), ...record };
7558
7692
  fs4.appendFileSync(filePath, `${JSON.stringify(full)}
7559
7693
  `, "utf-8");
@@ -7574,7 +7708,7 @@ var ProjectPreferencesReconcileOutcome = /* @__PURE__ */ ((ProjectPreferencesRec
7574
7708
 
7575
7709
  // packages/mcps/src/shared/preferences-service.ts
7576
7710
  function getGlobalPreferencesFilePath(dataDirOverride2) {
7577
- return path14.join(dataDirOverride2 ?? getDataDir(), PREFERENCES_FILE_NAME);
7711
+ return path15.join(dataDirOverride2 ?? getDataDir(), PREFERENCES_FILE_NAME);
7578
7712
  }
7579
7713
  function isFirstRun(dataDirOverride2) {
7580
7714
  return !fs4.existsSync(getGlobalPreferencesFilePath(dataDirOverride2));
@@ -7620,7 +7754,7 @@ function resolvePreferences(dataDirOverride2) {
7620
7754
  function writePreferences2(prefs, dataDirOverride2) {
7621
7755
  const dir = dataDirOverride2 ?? getDataDir();
7622
7756
  fs4.mkdirSync(dir, { recursive: true });
7623
- const filePath = path14.join(dir, PREFERENCES_FILE_NAME);
7757
+ const filePath = path15.join(dir, PREFERENCES_FILE_NAME);
7624
7758
  const existing = readPreferencesFile(filePath);
7625
7759
  writePreferencesFile(filePath, { ...existing, ...prefs });
7626
7760
  }
@@ -7634,7 +7768,7 @@ function readPreferencesMetadata(dataDirOverride2) {
7634
7768
  function writePreferencesWithMetadata(prefs, metadata, dataDirOverride2) {
7635
7769
  const dir = dataDirOverride2 ?? getDataDir();
7636
7770
  fs4.mkdirSync(dir, { recursive: true });
7637
- const filePath = path14.join(dir, PREFERENCES_FILE_NAME);
7771
+ const filePath = path15.join(dir, PREFERENCES_FILE_NAME);
7638
7772
  const existing = readRawPreferencesFile(filePath);
7639
7773
  const file = {
7640
7774
  ...existing,
@@ -7659,7 +7793,7 @@ function resetPreference(key, dataDirOverride2) {
7659
7793
  writePreferencesFile(filePath, existing);
7660
7794
  }
7661
7795
  function reconcileProjectPreferences(cwd, dataDirOverride2) {
7662
- const projectFilePath = path14.join(cwd, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_FILE_NAME);
7796
+ const projectFilePath = path15.join(cwd, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_FILE_NAME);
7663
7797
  const projectPreferences = readPreferencesFile(projectFilePath);
7664
7798
  const projectKeys = Object.keys(projectPreferences);
7665
7799
  if (projectKeys.length === 0) {
@@ -7704,10 +7838,10 @@ var MUGGLE_HOME_DISPLAY_DIR = "~/.muggle-ai";
7704
7838
 
7705
7839
  // packages/mcps/src/shared/cwd-keyed-cache.ts
7706
7840
  function resolveHomeFilePath(cache) {
7707
- return path14.join(getDataDir(), cache.fileName);
7841
+ return path15.join(getDataDir(), cache.fileName);
7708
7842
  }
7709
7843
  function resolveLegacyFilePath(cache, cwd) {
7710
- return path14.join(cwd, LEGACY_CACHE_DIR_NAME, cache.fileName);
7844
+ return path15.join(cwd, LEGACY_CACHE_DIR_NAME, cache.fileName);
7711
7845
  }
7712
7846
  function parseJsonFile(filePath) {
7713
7847
  try {
@@ -7747,7 +7881,7 @@ function readLegacyEntry(cache, cwd) {
7747
7881
  return parsed?.[cache.legacyEntryKey] ?? null;
7748
7882
  }
7749
7883
  function readCwdEntry(cache, cwd) {
7750
- const cwdKey = path14.resolve(cwd);
7884
+ const cwdKey = path15.resolve(cwd);
7751
7885
  const entries = readHomeEntries(cache);
7752
7886
  const homeEntry = entries[cwdKey];
7753
7887
  if (homeEntry) {
@@ -7769,11 +7903,11 @@ function readCwdEntry(cache, cwd) {
7769
7903
  }
7770
7904
  function writeCwdEntry(cache, cwd, entry) {
7771
7905
  const entries = readHomeEntries(cache);
7772
- writeHomeEntries(cache, { ...entries, [path14.resolve(cwd)]: entry });
7906
+ writeHomeEntries(cache, { ...entries, [path15.resolve(cwd)]: entry });
7773
7907
  }
7774
7908
  function clearCwdEntry(cache, cwd) {
7775
7909
  const entries = readHomeEntries(cache);
7776
- const cwdKey = path14.resolve(cwd);
7910
+ const cwdKey = path15.resolve(cwd);
7777
7911
  if (cwdKey in entries) {
7778
7912
  delete entries[cwdKey];
7779
7913
  writeHomeEntries(cache, entries);
@@ -7949,6 +8083,11 @@ var runResultGetTool = {
7949
8083
  if (!storedRunResult) {
7950
8084
  return { content: `Run result not found: ${input.runId}`, isError: true };
7951
8085
  }
8086
+ const fallbackDashboardUrl = storedRunResult.viewUrl ? void 0 : buildDashboardUrl({
8087
+ page: "script-details" /* ScriptDetails */,
8088
+ projectId: storedRunResult.projectId,
8089
+ testCaseId: storedRunResult.cloudTestCaseId
8090
+ });
7952
8091
  const contentParts = [
7953
8092
  "## Run Result Details",
7954
8093
  "",
@@ -7959,7 +8098,7 @@ var runResultGetTool = {
7959
8098
  `**Duration:** ${storedRunResult.executionTimeMs ?? 0}ms`,
7960
8099
  storedRunResult.errorMessage ? `**Error:** ${storedRunResult.errorMessage}` : "",
7961
8100
  // The studio publishes the run during execution; these are its returned cloud refs.
7962
- storedRunResult.viewUrl ? `**View URL:** ${storedRunResult.viewUrl}` : "",
8101
+ storedRunResult.viewUrl ? `**View URL:** ${storedRunResult.viewUrl}` : `**Dashboard:** ${fallbackDashboardUrl}`,
7963
8102
  storedRunResult.cloudTestScriptId ? `**Cloud Test Script ID:** ${storedRunResult.cloudTestScriptId}` : "",
7964
8103
  storedRunResult.cloudActionScriptId ? `**Cloud Action Script ID:** ${storedRunResult.cloudActionScriptId}` : ""
7965
8104
  ];
@@ -7976,11 +8115,11 @@ var runResultGetTool = {
7976
8115
  `**Location:** \`${storedRunResult.artifactsDir}\``,
7977
8116
  ""
7978
8117
  );
7979
- const actionScriptPath = path14.join(storedRunResult.artifactsDir, "action-script.json");
7980
- const resultsMdPath = path14.join(storedRunResult.artifactsDir, "results.md");
7981
- const screenshotsDir = path14.join(storedRunResult.artifactsDir, "screenshots");
7982
- const stdoutLogPath = path14.join(storedRunResult.artifactsDir, "stdout.log");
7983
- const stderrLogPath = path14.join(storedRunResult.artifactsDir, "stderr.log");
8118
+ const actionScriptPath = path15.join(storedRunResult.artifactsDir, "action-script.json");
8119
+ const resultsMdPath = path15.join(storedRunResult.artifactsDir, "results.md");
8120
+ const screenshotsDir = path15.join(storedRunResult.artifactsDir, "screenshots");
8121
+ const stdoutLogPath = path15.join(storedRunResult.artifactsDir, "stdout.log");
8122
+ const stderrLogPath = path15.join(storedRunResult.artifactsDir, "stderr.log");
7984
8123
  const artifactItems = [];
7985
8124
  if (fs4.existsSync(actionScriptPath)) {
7986
8125
  artifactItems.push("- `action-script.json` \u2014 generated test steps");
@@ -8012,7 +8151,11 @@ var runResultGetTool = {
8012
8151
  storedRunResult.artifactsDir ? `- **Artifacts path:** \`${storedRunResult.artifactsDir}\`` : ""
8013
8152
  );
8014
8153
  const content = contentParts.filter(Boolean).join("\n");
8015
- return { content, isError: false, data: storedRunResult };
8154
+ return {
8155
+ content,
8156
+ isError: false,
8157
+ data: fallbackDashboardUrl ? { ...storedRunResult, dashboardUrl: fallbackDashboardUrl } : storedRunResult
8158
+ };
8016
8159
  }
8017
8160
  };
8018
8161
  var testScriptListTool = {
@@ -8915,4 +9058,4 @@ function applyOnboardingAnswers(answers, dataDirOverride2, now = /* @__PURE__ */
8915
9058
  return { isCompleted: true, preferences: prefs };
8916
9059
  }
8917
9060
 
8918
- export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ElectronAppReleaseStream, EventName, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, ServiceName, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports2 as e2e_exports, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir2 as getDataDir, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, mcp_exports, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writePreferences2 as writePreferences, writePreferencesWithMetadata, writeRunViewHtml };
9061
+ export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, EventName, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, ServiceName, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports2 as e2e_exports, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, mcp_exports, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, src_exports, startDeviceCodeFlow, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writePreferences2 as writePreferences, writePreferencesWithMetadata, writeRunViewHtml };