chrome-devtools-mcp 1.11.0 → 1.13.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 (389) hide show
  1. package/README.md +73 -21
  2. package/{build → out/Default/gen}/src/BrowserManager.js +49 -18
  3. package/out/Default/gen/src/LogpointManager.js +307 -0
  4. package/{build → out/Default/gen}/src/McpContext.js +439 -133
  5. package/{build → out/Default/gen}/src/McpPage.js +368 -59
  6. package/{build → out/Default/gen}/src/McpResponse.js +90 -47
  7. package/out/Default/gen/src/NetworkOverrideManager.js +419 -0
  8. package/{build → out/Default/gen}/src/TextSnapshot.js +37 -18
  9. package/out/Default/gen/src/ToolHandler.js +512 -0
  10. package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp-main.js +6 -4
  11. package/{build → out/Default/gen}/src/bin/chrome-devtools.js +4 -4
  12. package/{build → out/Default/gen}/src/collectors/PageCollector.js +28 -12
  13. package/{build → out/Default/gen}/src/collectors/ServiceWorkerCollector.js +2 -2
  14. package/out/Default/gen/src/collectors/constants.js +7 -0
  15. package/out/Default/gen/src/config/ConfigParser.js +162 -0
  16. package/{build → out/Default/gen}/src/config/ConfigWatcher.js +3 -2
  17. package/out/Default/gen/src/config/ServerConfig.js +251 -0
  18. package/{build → out/Default/gen}/src/config/browser-options.js +13 -4
  19. package/{build → out/Default/gen}/src/config/category-options.js +10 -0
  20. package/{build → out/Default/gen}/src/config/cli-options.js +223 -22
  21. package/{build → out/Default/gen}/src/config/mcp-options.js +62 -36
  22. package/{build → out/Default/gen}/src/config/puppeteer-options.js +4 -2
  23. package/{build → out/Default/gen}/src/daemon/client.js +3 -3
  24. package/{build → out/Default/gen}/src/daemon/daemon.js +7 -3
  25. package/{build → out/Default/gen}/src/daemon/utils.js +2 -1
  26. package/{build → out/Default/gen}/src/devtools/DevToolsCommentBridge.js +28 -5
  27. package/{build → out/Default/gen}/src/devtools/DevtoolsUtils.js +94 -20
  28. package/{build → out/Default/gen}/src/formatters/ConsoleFormatter.js +28 -1
  29. package/{build → out/Default/gen}/src/formatters/HeapSnapshotFormatter.js +14 -18
  30. package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
  31. package/{build → out/Default/gen}/src/formatters/NetworkFormatter.js +70 -17
  32. package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +49 -0
  33. package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
  34. package/{build → out/Default/gen}/src/formatters/SnapshotFormatter.js +13 -3
  35. package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
  36. package/out/Default/gen/src/index.js +435 -0
  37. package/out/Default/gen/src/processors/HeapSnapshotManager.js +569 -0
  38. package/{build → out/Default/gen}/src/telemetry/transformation.js +1 -1
  39. package/{build → out/Default/gen}/src/third_party/THIRD_PARTY_NOTICES +796 -712
  40. package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
  41. package/out/Default/gen/src/third_party/cli.js +9023 -0
  42. package/out/Default/gen/src/third_party/devtools-formatter-worker.js +31904 -0
  43. package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +26467 -0
  44. package/out/Default/gen/src/third_party/index.js +201574 -0
  45. package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
  46. package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
  47. package/{build → out/Default/gen}/src/tools/categories.js +4 -0
  48. package/{build → out/Default/gen}/src/tools/comments.js +46 -4
  49. package/{build → out/Default/gen}/src/tools/console.js +8 -6
  50. package/{build → out/Default/gen}/src/tools/css.js +1 -0
  51. package/{build → out/Default/gen}/src/tools/emulation.js +5 -4
  52. package/{build → out/Default/gen}/src/tools/extensions.js +6 -1
  53. package/{build → out/Default/gen}/src/tools/input.js +23 -28
  54. package/{build → out/Default/gen}/src/tools/lighthouse.js +30 -8
  55. package/out/Default/gen/src/tools/logpoints.js +51 -0
  56. package/{build → out/Default/gen}/src/tools/memory.js +59 -53
  57. package/out/Default/gen/src/tools/network.js +260 -0
  58. package/{build → out/Default/gen}/src/tools/pages.js +48 -6
  59. package/{build → out/Default/gen}/src/tools/performance.js +33 -7
  60. package/{build → out/Default/gen}/src/tools/pwa.js +7 -0
  61. package/{build → out/Default/gen}/src/tools/screencast.js +3 -1
  62. package/{build → out/Default/gen}/src/tools/screenshot.js +23 -7
  63. package/{build → out/Default/gen}/src/tools/script.js +38 -6
  64. package/{build → out/Default/gen}/src/tools/slim/tools.js +21 -5
  65. package/{build → out/Default/gen}/src/tools/snapshot.js +29 -5
  66. package/{build → out/Default/gen}/src/tools/thirdPartyDeveloper.js +6 -20
  67. package/out/Default/gen/src/tools/toolNames.js +10 -0
  68. package/{build → out/Default/gen}/src/tools/tools.js +4 -0
  69. package/out/Default/gen/src/tools/webauthn.js +51 -0
  70. package/{build → out/Default/gen}/src/tools/webmcp.js +5 -19
  71. package/out/Default/gen/src/utils/TaskRunner.js +151 -0
  72. package/{build → out/Default/gen}/src/utils/WaitForHelper.js +16 -2
  73. package/{build → out/Default/gen}/src/utils/bytes.js +2 -12
  74. package/{build → out/Default/gen}/src/utils/check-for-updates.js +8 -2
  75. package/out/Default/gen/src/utils/disclaimers.js +27 -0
  76. package/{build → out/Default/gen}/src/utils/errorHandling.js +3 -0
  77. package/{build → out/Default/gen}/src/utils/keyboard.js +15 -5
  78. package/out/Default/gen/src/utils/logger.js +131 -0
  79. package/out/Default/gen/src/utils/network.js +81 -0
  80. package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
  81. package/out/Default/gen/src/utils/resourceType.js +27 -0
  82. package/out/Default/gen/src/utils/text.js +44 -0
  83. package/out/Default/gen/src/utils/timeout.js +14 -0
  84. package/{build → out/Default/gen}/src/utils/url.js +73 -17
  85. package/{build → out/Default/gen}/src/version.js +1 -1
  86. package/package.json +26 -32
  87. package/skills/a11y-debugging/SKILL.md +3 -8
  88. package/skills/chrome-devtools/SKILL.md +2 -0
  89. package/skills/chrome-devtools-cli/SKILL.md +12 -1
  90. package/build/src/ToolHandler.js +0 -360
  91. package/build/src/config/ConfigParser.js +0 -264
  92. package/build/src/index.js +0 -282
  93. package/build/src/processors/HeapSnapshotManager.js +0 -307
  94. package/build/src/third_party/bundled-packages.json +0 -11
  95. package/build/src/third_party/devtools-formatter-worker.js +0 -16625
  96. package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -12084
  97. package/build/src/third_party/index.js +0 -189603
  98. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +0 -58435
  99. package/build/src/tools/ToolDefinition.js +0 -92
  100. package/build/src/tools/network.js +0 -128
  101. package/build/src/utils/logger.js +0 -62
  102. package/build/src/utils/text.js +0 -15
  103. /package/{build → out/Default/gen}/src/McpWorker.js +0 -0
  104. /package/{build → out/Default/gen}/src/SlimMcpResponse.js +0 -0
  105. /package/{build → out/Default/gen}/src/bin/check-latest-version.js +0 -0
  106. /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp.js +0 -0
  107. /package/{build → out/Default/gen}/src/config/ConfigLocator.js +0 -0
  108. /package/{build → out/Default/gen}/src/config/cli-commands.js +0 -0
  109. /package/{build → out/Default/gen}/src/config/tool-options.js +0 -0
  110. /package/{build → out/Default/gen}/src/daemon/types.js +0 -0
  111. /package/{build → out/Default/gen}/src/devtools/McpHostBindingAdapter.js +0 -0
  112. /package/{build → out/Default/gen}/src/devtools/issueDescriptions.js +0 -0
  113. /package/{build → out/Default/gen}/src/formatters/CommentFormatter.js +0 -0
  114. /package/{build → out/Default/gen}/src/formatters/CssFormatter.js +0 -0
  115. /package/{build → out/Default/gen}/src/formatters/IssueFormatter.js +0 -0
  116. /package/{build → out/Default/gen}/src/processors/ChunkedTraceParser.js +0 -0
  117. /package/{build → out/Default/gen}/src/processors/PerformanceTrace.js +0 -0
  118. /package/{build → out/Default/gen}/src/telemetry/ClearcutLogger.js +0 -0
  119. /package/{build → out/Default/gen}/src/telemetry/WatchdogClient.js +0 -0
  120. /package/{build → out/Default/gen}/src/telemetry/errors.js +0 -0
  121. /package/{build → out/Default/gen}/src/telemetry/flagUtils.js +0 -0
  122. /package/{build → out/Default/gen}/src/telemetry/metricsRegistry.js +0 -0
  123. /package/{build → out/Default/gen}/src/telemetry/persistence.js +0 -0
  124. /package/{build → out/Default/gen}/src/telemetry/types.js +0 -0
  125. /package/{build → out/Default/gen}/src/telemetry/watchdog/ClearcutSender.js +0 -0
  126. /package/{build → out/Default/gen}/src/telemetry/watchdog/main.js +0 -0
  127. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -0
  128. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -0
  129. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -0
  130. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -0
  131. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -0
  132. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -0
  133. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -0
  134. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/LowTextContrast.md +0 -0
  135. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +0 -0
  136. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -0
  137. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -0
  138. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -0
  139. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -0
  140. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -0
  141. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -0
  142. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -0
  143. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -0
  144. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +0 -0
  145. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +0 -0
  146. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +0 -0
  147. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -0
  148. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -0
  149. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -0
  150. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -0
  151. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -0
  152. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -0
  153. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -0
  154. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -0
  155. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -0
  156. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -0
  157. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -0
  158. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -0
  159. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -0
  160. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -0
  161. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +0 -0
  162. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -0
  163. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +0 -0
  164. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -0
  165. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -0
  166. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -0
  167. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -0
  168. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -0
  169. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -0
  170. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -0
  171. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -0
  172. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -0
  173. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -0
  174. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -0
  175. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -0
  176. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -0
  177. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -0
  178. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspEvalViolation.md +0 -0
  179. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspInlineViolation.md +0 -0
  180. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -0
  181. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -0
  182. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspURLViolation.md +0 -0
  183. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/deprecation.md +0 -0
  184. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +0 -0
  185. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +0 -0
  186. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +0 -0
  187. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +0 -0
  188. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +0 -0
  189. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +0 -0
  190. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +0 -0
  191. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +0 -0
  192. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +0 -0
  193. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +0 -0
  194. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +0 -0
  195. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +0 -0
  196. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +0 -0
  197. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +0 -0
  198. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +0 -0
  199. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +0 -0
  200. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +0 -0
  201. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +0 -0
  202. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +0 -0
  203. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +0 -0
  204. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +0 -0
  205. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +0 -0
  206. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +0 -0
  207. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +0 -0
  208. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +0 -0
  209. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +0 -0
  210. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +0 -0
  211. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +0 -0
  212. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +0 -0
  213. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +0 -0
  214. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +0 -0
  215. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +0 -0
  216. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +0 -0
  217. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +0 -0
  218. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +0 -0
  219. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +0 -0
  220. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +0 -0
  221. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +0 -0
  222. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +0 -0
  223. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +0 -0
  224. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +0 -0
  225. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +0 -0
  226. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +0 -0
  227. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +0 -0
  228. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +0 -0
  229. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +0 -0
  230. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +0 -0
  231. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +0 -0
  232. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +0 -0
  233. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +0 -0
  234. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +0 -0
  235. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +0 -0
  236. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +0 -0
  237. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +0 -0
  238. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +0 -0
  239. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +0 -0
  240. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +0 -0
  241. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -0
  242. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -0
  243. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -0
  244. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -0
  245. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -0
  246. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +0 -0
  247. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -0
  248. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -0
  249. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +0 -0
  250. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -0
  251. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -0
  252. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -0
  253. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -0
  254. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -0
  255. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -0
  256. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -0
  257. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -0
  258. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -0
  259. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +0 -0
  260. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -0
  261. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -0
  262. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -0
  263. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -0
  264. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -0
  265. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -0
  266. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -0
  267. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -0
  268. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -0
  269. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -0
  270. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +0 -0
  271. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -0
  272. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -0
  273. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -0
  274. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -0
  275. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -0
  276. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -0
  277. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -0
  278. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -0
  279. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -0
  280. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -0
  281. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +0 -0
  282. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +0 -0
  283. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +0 -0
  284. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +0 -0
  285. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +0 -0
  286. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +0 -0
  287. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -0
  288. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -0
  289. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/heavyAd.md +0 -0
  290. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +0 -0
  291. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/mixedContent.md +0 -0
  292. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -0
  293. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -0
  294. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -0
  295. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -0
  296. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -0
  297. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -0
  298. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -0
  299. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -0
  300. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -0
  301. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -0
  302. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -0
  303. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -0
  304. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -0
  305. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -0
  306. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -0
  307. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -0
  308. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -0
  309. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -0
  310. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -0
  311. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -0
  312. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -0
  313. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -0
  314. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -0
  315. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -0
  316. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -0
  317. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -0
  318. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -0
  319. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -0
  320. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -0
  321. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -0
  322. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -0
  323. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -0
  324. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -0
  325. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +0 -0
  326. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -0
  327. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -0
  328. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -0
  329. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -0
  330. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -0
  331. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -0
  332. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -0
  333. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -0
  334. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -0
  335. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -0
  336. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -0
  337. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -0
  338. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -0
  339. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -0
  340. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -0
  341. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -0
  342. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -0
  343. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -0
  344. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -0
  345. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -0
  346. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -0
  347. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -0
  348. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -0
  349. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -0
  350. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -0
  351. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -0
  352. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -0
  353. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -0
  354. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -0
  355. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -0
  356. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -0
  357. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -0
  358. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -0
  359. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -0
  360. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -0
  361. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -0
  362. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -0
  363. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -0
  364. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -0
  365. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -0
  366. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -0
  367. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -0
  368. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -0
  369. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -0
  370. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -0
  371. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -0
  372. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -0
  373. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -0
  374. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -0
  375. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -0
  376. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -0
  377. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -0
  378. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -0
  379. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -0
  380. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingId.md +0 -0
  381. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +0 -0
  382. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +0 -0
  383. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallNoManifest.md +0 -0
  384. /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +0 -0
  385. /package/{build → out/Default/gen}/src/types.js +0 -0
  386. /package/{build → out/Default/gen}/src/utils/files.js +0 -0
  387. /package/{build → out/Default/gen}/src/utils/id.js +0 -0
  388. /package/{build → out/Default/gen}/src/utils/pagination.js +0 -0
  389. /package/{build → out/Default/gen}/src/utils/polyfill.js +0 -0
@@ -3,27 +3,121 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
7
+ if (value !== null && value !== void 0) {
8
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
9
+ var dispose, inner;
10
+ if (async) {
11
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
12
+ dispose = value[Symbol.asyncDispose];
13
+ }
14
+ if (dispose === void 0) {
15
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
16
+ dispose = value[Symbol.dispose];
17
+ if (async) inner = dispose;
18
+ }
19
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
21
+ env.stack.push({ value: value, dispose: dispose, async: async });
22
+ }
23
+ else if (async) {
24
+ env.stack.push({ async: true });
25
+ }
26
+ return value;
27
+ };
28
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
29
+ return function (env) {
30
+ function fail(e) {
31
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
32
+ env.hasError = true;
33
+ }
34
+ var r, s = 0;
35
+ function next() {
36
+ while (r = env.stack.pop()) {
37
+ try {
38
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
39
+ if (r.dispose) {
40
+ var result = r.dispose.call(r.value);
41
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
42
+ }
43
+ else s |= 1;
44
+ }
45
+ catch (e) {
46
+ fail(e);
47
+ }
48
+ }
49
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
50
+ if (env.hasError) throw env.error;
51
+ }
52
+ return next();
53
+ };
54
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
55
+ var e = new Error(message);
56
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
57
+ });
6
58
  import fs from 'node:fs/promises';
7
59
  import os from 'node:os';
8
60
  import path from 'node:path';
9
61
  import { fileURLToPath, pathToFileURL } from 'node:url';
62
+ import { isDeepStrictEqual } from 'node:util';
10
63
  import { overrideDevToolsGlobals } from './devtools/DevtoolsUtils.js';
11
64
  import { McpPage } from './McpPage.js';
12
65
  import { ServiceWorkerConsoleCollector } from './collectors/ServiceWorkerCollector.js';
13
- import { Locator, } from './third_party/index.js';
14
- import { CLOSE_PAGE_ERROR } from './tools/ToolDefinition.js';
66
+ import { Locator, Mutex, } from './third_party/index.js';
67
+ import { ToolCategory } from './tools/categories.js';
68
+ import { CLOSE_PAGE_ERROR, isCapabilityEnabled, } from './tools/ToolDefinition.js';
15
69
  import { McpWorker } from './McpWorker.js';
16
70
  import { getTempFilePath, resolveCanonicalPath } from './utils/files.js';
17
- import { escapeForLog } from './utils/logger.js';
71
+ import { escapeForLog, redactUrlForLogging } from './utils/logger.js';
72
+ import { fetchWithValidatedRedirects, validateUrlNotBlocked, } from './utils/network.js';
18
73
  import { isAllowedUrl } from './utils/url.js';
74
+ function hasOptionChanged(gate, previousArgs, nextArgs) {
75
+ return gate.options.some(option => !isDeepStrictEqual(nextArgs[option], previousArgs[option]));
76
+ }
77
+ const FEATURE_CONTROLLERS = [
78
+ {
79
+ gate: { options: ['blockedUrlPattern', 'allowedUrlPattern'] },
80
+ onChange: context => context.syncNetworkRestrictions(),
81
+ },
82
+ {
83
+ gate: { options: ['sourceMaps'] },
84
+ onChange: context => context.syncSourceMaps(),
85
+ },
86
+ {
87
+ gate: { options: ['experimentalIncludeAllPages'] },
88
+ onChange: context => context.createPagesSnapshot(),
89
+ },
90
+ {
91
+ gate: { category: ToolCategory.DEBUGGING },
92
+ onDisable: context => context.releaseScreencasts(),
93
+ },
94
+ {
95
+ gate: { category: ToolCategory.MEMORY, conditions: ['memoryDebugging'] },
96
+ onDisable: context => context.releaseHeapSnapshots(),
97
+ },
98
+ {
99
+ gate: { category: ToolCategory.PERFORMANCE },
100
+ onDisable: context => context.releasePerformanceTrace(),
101
+ },
102
+ {
103
+ gate: { category: ToolCategory.DEBUGGING, conditions: ['devtoolsComments'] },
104
+ onDisable: context => context.releaseDevToolsComments(),
105
+ },
106
+ ];
19
107
  // Page ids are handed out from a process-wide counter so they stay unique
20
108
  // across all contexts, in particular across browser reconnects. An id issued
21
109
  // before a reconnect then fails to resolve instead of hitting an unrelated
22
110
  // page of the reconnected browser.
23
111
  let nextPageId = 1;
24
112
  export class McpContext {
25
- browser;
26
113
  logger;
114
+ #browser;
115
+ // Initialization of #browser, settles once its browser-dependent state is
116
+ // ready.
117
+ #browserReady;
118
+ // Whether a browser connection was established before, so that switching to
119
+ // a new browser surfaces a reconnect notice.
120
+ #hasConnected = false;
27
121
  // Maps LLM-provided isolatedContext name → Puppeteer BrowserContext.
28
122
  #isolatedContexts = new Map();
29
123
  // Auto-generated name counter for when no name is provided.
@@ -32,53 +126,240 @@ export class McpContext {
32
126
  // referential identity holds and workers can carry per-worker state later.
33
127
  #workers = new Map();
34
128
  #mcpPages = new Map();
129
+ /**
130
+ * Queue for the browser-wide state (page list, selected page, trace
131
+ * state). Every page queue is a child of it, so a task on it waits for
132
+ * every page task and blocks later page tasks.
133
+ */
134
+ taskQueue;
135
+ #taskRunner;
136
+ #pageTaskQueues = new Map();
137
+ /**
138
+ * Serializes `createPagesSnapshot()`. Two tasks on different page queues
139
+ * can call it at the same time.
140
+ */
141
+ #pagesSnapshotMutex = new Mutex();
35
142
  #selectedPage;
36
143
  #selectedPageFallback;
144
+ #selectedPageFallbackRead = false;
37
145
  #serviceWorkerConsoleCollector;
38
- #isRunningTrace = false;
39
146
  #reconnectNotice = false;
40
147
  #traceResults = [];
41
148
  #locatorClass;
149
+ #config;
42
150
  #options;
43
151
  #heapSnapshotManager;
44
152
  #roots = undefined;
45
- #allowUnrestrictedPaths;
46
- constructor(browser, logger, options, locatorClass) {
153
+ constructor(logger, options, locatorClass) {
47
154
  overrideDevToolsGlobals({
48
155
  loadResource: (url) => {
49
156
  return this.loadResource(url);
50
157
  },
51
158
  });
52
- this.browser = browser;
53
159
  this.logger = logger;
54
160
  this.#locatorClass = locatorClass;
161
+ this.#taskRunner = options.taskRunner;
162
+ this.taskQueue = options.taskRunner.createQueue();
163
+ this.#config = options.config;
55
164
  this.#options = options;
56
165
  this.#heapSnapshotManager = options.heapSnapshotManager;
57
- this.#allowUnrestrictedPaths = options.allowUnrestrictedPaths ?? false;
58
- this.#reconnectNotice = options.reconnected ?? false;
59
- this.#serviceWorkerConsoleCollector = new ServiceWorkerConsoleCollector(this.browser);
60
166
  }
61
- async #init() {
62
- await this.createPagesSnapshot();
63
- const workers = this.createWorkersSnapshot();
64
- await this.#serviceWorkerConsoleCollector.init(workers);
65
- this.browser.on('targetcreated', this.#onTargetCreated);
66
- this.browser.on('targetdestroyed', this.#onTargetDestroyed);
167
+ /**
168
+ * The browser of the current connection. Throws if no browser connection was
169
+ * established yet, see {@link McpContext.ensureBrowser}.
170
+ */
171
+ get browser() {
172
+ if (!this.#browser) {
173
+ throw new Error('Not connected to a browser.');
174
+ }
175
+ return this.#browser;
67
176
  }
68
- dispose() {
69
- this.browser.off('targetcreated', this.#onTargetCreated);
70
- this.browser.off('targetdestroyed', this.#onTargetDestroyed);
71
- this.#serviceWorkerConsoleCollector.dispose();
72
- for (const mcpPage of this.#mcpPages.values()) {
73
- mcpPage.dispose();
177
+ #allMcpPages() {
178
+ const pages = new Set(this.#mcpPages.values());
179
+ if (this.#selectedPage) {
180
+ pages.add(this.#selectedPage);
181
+ }
182
+ return pages;
183
+ }
184
+ /**
185
+ * Synchronizes browser/page state and releases state of capabilities that
186
+ * transitioned from enabled to disabled after a config reload.
187
+ */
188
+ async onConfigChanged(previousArgs) {
189
+ const nextArgs = this.#config.resolved;
190
+ for (const controller of FEATURE_CONTROLLERS) {
191
+ if ('onChange' in controller) {
192
+ if (hasOptionChanged(controller.gate, previousArgs, nextArgs)) {
193
+ await controller.onChange(this);
194
+ }
195
+ }
196
+ else if (isCapabilityEnabled(controller.gate, previousArgs) &&
197
+ !isCapabilityEnabled(controller.gate, nextArgs)) {
198
+ await controller.onDisable(this);
199
+ }
200
+ }
201
+ }
202
+ /**
203
+ * Applies updated URL allowlist/blocklist rules to the connected browser and
204
+ * clears incompatible page network throttling state.
205
+ */
206
+ async syncNetworkRestrictions() {
207
+ const { blockedUrlPattern, allowedUrlPattern } = this.#config.resolved;
208
+ if (blockedUrlPattern || allowedUrlPattern) {
209
+ for (const mcpPage of this.#allMcpPages()) {
210
+ await mcpPage.clearNetworkConditions();
211
+ }
212
+ }
213
+ if (this.#browser) {
214
+ await this.#browser.restrictNetwork({
215
+ blocklist: blockedUrlPattern,
216
+ allowlist: allowedUrlPattern,
217
+ });
218
+ }
219
+ }
220
+ /**
221
+ * Synchronizes the DevTools source maps setting across all pages.
222
+ */
223
+ syncSourceMaps() {
224
+ for (const mcpPage of this.#allMcpPages()) {
225
+ mcpPage.syncSourceMaps();
226
+ }
227
+ }
228
+ /**
229
+ * Stops and saves active screencast recordings across all pages when
230
+ * screencast tools are disabled.
231
+ */
232
+ async releaseScreencasts() {
233
+ for (const mcpPage of this.#allMcpPages()) {
234
+ const screenRecorderData = mcpPage.getScreenRecorder();
235
+ if (!screenRecorderData) {
236
+ continue;
237
+ }
238
+ const { recorder, filePath } = screenRecorderData;
239
+ mcpPage.setScreenRecorder(null);
240
+ try {
241
+ await recorder.stop();
242
+ this.logger?.(`The screencast recording was stopped and saved to ${filePath} because screencast tools were disabled.`);
243
+ }
244
+ catch (err) {
245
+ this.logger?.('Failed to stop the screencast recording', err);
246
+ }
247
+ }
248
+ }
249
+ /**
250
+ * Closes all loaded heap snapshots when memory tools are disabled.
251
+ */
252
+ releaseHeapSnapshots() {
253
+ if (this.#heapSnapshotManager.hasSnapshots()) {
254
+ this.#heapSnapshotManager.dispose();
255
+ this.logger?.('Loaded heap snapshots were closed because memory tools were disabled.');
256
+ }
257
+ }
258
+ /**
259
+ * Discards recorded performance traces and stops any running trace when
260
+ * performance tools are disabled.
261
+ */
262
+ async releasePerformanceTrace() {
263
+ this.#traceResults = [];
264
+ for (const mcpPage of this.#allMcpPages()) {
265
+ if (!mcpPage.isRunningPerformanceTrace()) {
266
+ continue;
267
+ }
268
+ mcpPage.setIsRunningPerformanceTrace(false);
269
+ try {
270
+ await mcpPage.pptrPage.tracing.stop();
271
+ }
272
+ catch (err) {
273
+ this.logger?.('Failed to stop the performance trace', err);
274
+ }
275
+ this.logger?.('The running performance trace was discarded because performance tools were disabled.');
276
+ }
277
+ }
278
+ /**
279
+ * Disposes DevTools comment bridges across all pages when DevTools comment
280
+ * tools are disabled.
281
+ */
282
+ releaseDevToolsComments() {
283
+ for (const mcpPage of this.#allMcpPages()) {
284
+ mcpPage.disposeCommentBridge();
285
+ }
286
+ }
287
+ /**
288
+ * Returns the browser, establishing the connection if needed. If the browser
289
+ * changed since the last call (e.g. after a reconnect), all
290
+ * browser-dependent state is rebuilt for the new browser.
291
+ */
292
+ async ensureBrowser() {
293
+ const browser = await this.#options.getBrowser();
294
+ if (browser === this.#browser && this.#browserReady) {
295
+ // Joins a still pending initialization instead of handing out
296
+ // half-initialized state.
297
+ await this.#browserReady;
298
+ return browser;
299
+ }
300
+ this.#resetBrowserState();
301
+ this.#browser = browser;
302
+ const ready = this.#initBrowserState(browser);
303
+ this.#browserReady = ready;
304
+ try {
305
+ await ready;
306
+ return browser;
307
+ }
308
+ catch (err) {
309
+ // Leave no half-initialized state behind, the next call starts over. If
310
+ // a later call already installed another browser, its state is left
311
+ // intact.
312
+ if (this.#browserReady === ready) {
313
+ this.#resetBrowserState();
314
+ }
315
+ throw err;
316
+ }
317
+ }
318
+ async #initBrowserState(browser) {
319
+ const collector = new ServiceWorkerConsoleCollector(browser);
320
+ this.#serviceWorkerConsoleCollector = collector;
321
+ // All listeners are registered synchronously, before the first await. If
322
+ // this call hangs and is abandoned by the tool-call timeout, a later call
323
+ // that installs a different browser removes them in #resetBrowserState().
324
+ browser.on('targetcreated', this.#onTargetCreated);
325
+ browser.on('targetdestroyed', this.#onTargetDestroyed);
326
+ await Promise.all([
327
+ collector.init(this.createWorkersSnapshot()),
328
+ this.createPagesSnapshot(),
329
+ ]);
330
+ // The state now belongs to the browser of a later call, leave it intact.
331
+ if (this.#browser !== browser) {
332
+ throw new Error('Browser was replaced while initializing.');
333
+ }
334
+ if (this.#hasConnected) {
335
+ this.#reconnectNotice = true;
336
+ }
337
+ this.#hasConnected = true;
338
+ }
339
+ #resetBrowserState() {
340
+ this.#browser?.off('targetcreated', this.#onTargetCreated);
341
+ this.#browser?.off('targetdestroyed', this.#onTargetDestroyed);
342
+ this.#serviceWorkerConsoleCollector?.dispose();
343
+ for (const mcpPage of this.#allMcpPages()) {
344
+ this.#disposeMcpPage(mcpPage);
74
345
  }
75
- this.#selectedPage?.dispose();
76
346
  this.#mcpPages.clear();
77
347
  this.#workers.clear();
78
348
  // Isolated contexts are intentionally not closed here.
79
349
  // Either the entire browser will be closed or we disconnect
80
350
  // without destroying browser state.
81
351
  this.#isolatedContexts.clear();
352
+ this.#nextIsolatedContextId = 1;
353
+ this.#selectedPage = undefined;
354
+ this.#selectedPageFallback = undefined;
355
+ this.#selectedPageFallbackRead = false;
356
+ this.#traceResults = [];
357
+ this.#serviceWorkerConsoleCollector = undefined;
358
+ this.#browser = undefined;
359
+ this.#browserReady = undefined;
360
+ }
361
+ dispose() {
362
+ this.#resetBrowserState();
82
363
  }
83
364
  #onTargetCreated = (target) => {
84
365
  try {
@@ -95,7 +376,7 @@ export class McpContext {
95
376
  try {
96
377
  const mcpPage = this.#mcpPages.get(target);
97
378
  if (mcpPage) {
98
- mcpPage.dispose();
379
+ this.#disposeMcpPage(mcpPage);
99
380
  this.#mcpPages.delete(target);
100
381
  }
101
382
  this.#workers.delete(target);
@@ -104,12 +385,10 @@ export class McpContext {
104
385
  this.logger?.('Error handling targetdestroyed', err);
105
386
  }
106
387
  };
107
- static async from(browser, logger, opts,
388
+ static create(logger, opts,
108
389
  /* Let tests use unbundled Locator class to avoid overly strict checks within puppeteer that fail when mixing bundled and unbundled class instances */
109
390
  locatorClass = Locator) {
110
- const context = new McpContext(browser, logger, opts, locatorClass);
111
- await context.#init();
112
- return context;
391
+ return new McpContext(logger, opts, locatorClass);
113
392
  }
114
393
  static resetPageIdsForTesting() {
115
394
  nextPageId = 1;
@@ -145,7 +424,8 @@ export class McpContext {
145
424
  // If the client never negotiated roots and the operator has explicitly
146
425
  // opted into unrestricted access via --allow-unrestricted-paths, restore
147
426
  // the previous permissive behavior and skip validation.
148
- if (this.#roots === undefined && this.#allowUnrestrictedPaths) {
427
+ if (this.#roots === undefined &&
428
+ this.#config.resolved.allowUnrestrictedPaths) {
149
429
  // Canonical path might not exist yet so we fallback to
150
430
  // path.resolve(filePath). Consumers should not follow symlinks.
151
431
  return canonicalPath || path.resolve(filePath);
@@ -166,8 +446,13 @@ export class McpContext {
166
446
  const result = resolvedRoots[i];
167
447
  if (result.status === 'fulfilled') {
168
448
  const canonicalRoot = result.value;
449
+ // A filesystem root such as `/` or `C:\` already ends with the
450
+ // separator; appending another one would match no path below it.
451
+ const rootPrefix = canonicalRoot.endsWith(path.sep)
452
+ ? canonicalRoot
453
+ : canonicalRoot + path.sep;
169
454
  if (canonicalPath === canonicalRoot ||
170
- canonicalPath.startsWith(canonicalRoot + path.sep)) {
455
+ canonicalPath.startsWith(rootPrefix)) {
171
456
  allowed = true;
172
457
  break;
173
458
  }
@@ -204,7 +489,7 @@ export class McpContext {
204
489
  page = await this.browser.newPage({ background });
205
490
  }
206
491
  const mcpPage = this.#createMcpPage(page.target());
207
- await mcpPage.init();
492
+ await mcpPage.init({ emulateFocus: true });
208
493
  this.selectPage(mcpPage);
209
494
  await this.createPagesSnapshot();
210
495
  return mcpPage;
@@ -217,9 +502,6 @@ export class McpContext {
217
502
  this.#mcpPages.delete(page.target);
218
503
  await page.close();
219
504
  }
220
- get #hasNetworkBlockOrAllowlist() {
221
- return !!(this.#options.allowlist || this.#options.blocklist);
222
- }
223
505
  async installPWA(options) {
224
506
  try {
225
507
  return await this.browser.installPWA(options);
@@ -251,14 +533,16 @@ export class McpContext {
251
533
  getPWAState(options) {
252
534
  return this.browser.getPWAState(options);
253
535
  }
254
- setIsRunningPerformanceTrace(x) {
255
- this.#isRunningTrace = x;
256
- }
257
536
  isRunningPerformanceTrace() {
258
- return this.#isRunningTrace;
537
+ for (const mcpPage of this.#allMcpPages()) {
538
+ if (mcpPage.isRunningPerformanceTrace()) {
539
+ return true;
540
+ }
541
+ }
542
+ return false;
259
543
  }
260
544
  isCruxEnabled() {
261
- return this.#options.performanceCrux;
545
+ return this.#config.resolved.performanceCrux;
262
546
  }
263
547
  getPages() {
264
548
  return Array.from(this.#mcpPages.values());
@@ -327,9 +611,9 @@ export class McpContext {
327
611
  }
328
612
  }
329
613
  /**
330
- * Returns true once if this context was created by reconnecting after the
331
- * previous browser connection was lost, so the next response can surface a
332
- * note. Cleared on first call.
614
+ * Returns true once after the browser connection was re-established with a
615
+ * new browser, so the next response can surface a note. Cleared on first
616
+ * call.
333
617
  */
334
618
  consumeReconnectNotice() {
335
619
  const notice = this.#reconnectNotice;
@@ -343,14 +627,39 @@ export class McpContext {
343
627
  }
344
628
  return page;
345
629
  }
630
+ /**
631
+ * The queue for tasks on page `pageId`. The queue exists before the page
632
+ * does, so a tool call can enter it before the browser connects. It is a
633
+ * child of {@link taskQueue}.
634
+ */
635
+ pageTaskQueue(pageId) {
636
+ let queue = this.#pageTaskQueues.get(pageId);
637
+ if (!queue) {
638
+ queue = this.#taskRunner.createQueue(this.taskQueue);
639
+ this.#pageTaskQueues.set(pageId, queue);
640
+ }
641
+ return queue;
642
+ }
643
+ #disposeMcpPage(mcpPage) {
644
+ mcpPage.dispose();
645
+ this.#pageTaskQueues
646
+ .get(mcpPage.id)
647
+ ?.dispose(new Error(`Page ${mcpPage.id} is closed.`));
648
+ this.#pageTaskQueues.delete(mcpPage.id);
649
+ }
346
650
  isPageSelected(page) {
347
651
  return this.#selectedPage === page;
348
652
  }
349
653
  selectPage(newPage) {
654
+ this.#selectedPageFallback = undefined;
655
+ this.#selectedPageFallbackRead = false;
656
+ this.#selectPage(newPage);
657
+ }
658
+ #selectPage(newPage) {
350
659
  if (this.#selectedPage &&
351
660
  this.#selectedPage !== newPage &&
352
661
  !this.#mcpPages.has(this.#selectedPage.target)) {
353
- this.#selectedPage.dispose();
662
+ this.#disposeMcpPage(this.#selectedPage);
354
663
  }
355
664
  this.#selectedPage = newPage;
356
665
  newPage.updateTimeouts();
@@ -358,10 +667,12 @@ export class McpContext {
358
667
  /**
359
668
  * Returns details about the last page snapshot automatically replacing the
360
669
  * selection because the selected page disappeared from the page list, or
361
- * `undefined` if the snapshot left the selection intact. Recomputed on every
362
- * createPagesSnapshot() call.
670
+ * `undefined` if the snapshot left the selection intact. Cleared on the next
671
+ * createPagesSnapshot() call after it has been read, or when selectPage() is
672
+ * called explicitly.
363
673
  */
364
674
  getSelectedPageFallback() {
675
+ this.#selectedPageFallbackRead = true;
365
676
  return this.#selectedPageFallback;
366
677
  }
367
678
  /**
@@ -390,8 +701,13 @@ export class McpContext {
390
701
  }
391
702
  return Array.from(this.#workers.values());
392
703
  }
393
- getServiceWorkerConsoleData(extensionId) {
394
- return this.#serviceWorkerConsoleCollector.getData(extensionId);
704
+ getServiceWorkerConsoleData(serviceWorkerId) {
705
+ const worker = this.getWorkerById(serviceWorkerId);
706
+ if (worker?.type !== 'service_worker') {
707
+ throw new Error('Service worker not found.');
708
+ }
709
+ const extensionId = new URL(worker.url).hostname;
710
+ return this.#serviceWorkerConsoleCollector?.getData(extensionId) ?? [];
395
711
  }
396
712
  #getBrowserContextToNameMap() {
397
713
  // Build a reverse lookup from BrowserContext instance → name.
@@ -417,61 +733,92 @@ export class McpContext {
417
733
  (this.#selectedPage?.target === target ? this.#selectedPage : undefined);
418
734
  if (!mcpPage) {
419
735
  mcpPage = new McpPage(target, nextPageId++, {
736
+ config: this.#config,
420
737
  locatorClass: this.#locatorClass,
421
- hasNetworkBlockOrAllowlist: this.#hasNetworkBlockOrAllowlist,
422
738
  isolatedContextName: this.#getBrowserContextToNameMap().get(target.browserContext()),
423
739
  navigationTimeout: this.#options.navigationTimeout,
424
- sourceMaps: this.#options.sourceMaps,
425
- onNotification: this.#options.onNotification,
426
740
  });
427
741
  }
428
742
  this.#mcpPages.set(target, mcpPage);
429
743
  return mcpPage;
430
744
  }
431
745
  async createPagesSnapshot() {
432
- const allTargets = this.#fetchPageTargets();
433
- for (const target of allTargets) {
434
- this.#createMcpPage(target);
435
- }
436
- // Prune orphaned #mcpPages entries (targets that no longer exist).
437
- const currentTargets = new Set(allTargets);
438
- for (const [target, mcpPage] of this.#mcpPages) {
439
- if (!currentTargets.has(target)) {
440
- if (mcpPage !== this.#selectedPage || mcpPage.isClosed()) {
441
- mcpPage.dispose();
746
+ const env_1 = { stack: [], error: void 0, hasError: false };
747
+ try {
748
+ if (!this.#browser) {
749
+ return [];
750
+ }
751
+ const guard = __addDisposableResource(env_1, await this.#pagesSnapshotMutex.acquire(), false);
752
+ const allTargets = this.#fetchPageTargets();
753
+ for (const target of allTargets) {
754
+ this.#createMcpPage(target);
755
+ }
756
+ // Prune orphaned #mcpPages entries (targets that no longer exist).
757
+ const currentTargets = new Set(allTargets);
758
+ for (const [target, mcpPage] of this.#mcpPages) {
759
+ if (!currentTargets.has(target)) {
760
+ if (mcpPage !== this.#selectedPage || mcpPage.isClosed()) {
761
+ this.#disposeMcpPage(mcpPage);
762
+ }
763
+ this.#mcpPages.delete(target);
442
764
  }
443
- this.#mcpPages.delete(target);
444
765
  }
445
- }
446
- const pages = Array.from(this.#mcpPages.values());
447
- // Only fall back when the selected page is actually gone. Gating on
448
- // `isClosed()` instead of `pages` membership avoids silently swapping a
449
- // live page that is momentarily missing from the snapshot.
450
- this.#selectedPageFallback = undefined;
451
- if ((!this.#selectedPage || this.#selectedPage.isClosed()) && pages[0]) {
452
- // Record the automatic change so the response can surface it. Skipped on
453
- // first connect, when there was no prior selection to replace.
454
- if (this.#selectedPage) {
455
- this.#selectedPageFallback = {
456
- wasClosed: this.#selectedPage.isClosed(),
457
- };
766
+ const pages = Array.from(this.#mcpPages.values());
767
+ // Only fall back when the selected page is actually gone or no longer
768
+ // counts as a page, e.g. a background page after
769
+ // experimentalIncludeAllPages was turned off. Gating on `isClosed()`
770
+ // instead of `pages` membership avoids silently swapping a live page that
771
+ // is momentarily missing from the snapshot.
772
+ if (this.#selectedPageFallbackRead) {
773
+ this.#selectedPageFallback = undefined;
774
+ this.#selectedPageFallbackRead = false;
458
775
  }
459
- this.selectPage(pages[0]);
776
+ if (!this.#selectedPage ||
777
+ this.#selectedPage.isClosed() ||
778
+ !this.#isPageTarget(this.#selectedPage.target)) {
779
+ if (pages[0]) {
780
+ // Record the automatic change so the response can surface it. Skipped on
781
+ // first connect, when there was no prior selection to replace.
782
+ if (this.#selectedPage) {
783
+ this.#selectedPageFallback = {
784
+ wasClosed: this.#selectedPage.isClosed(),
785
+ };
786
+ }
787
+ this.#selectPage(pages[0]);
788
+ }
789
+ else if (this.#selectedPage) {
790
+ const wasClosed = Boolean(this.#selectedPage.isClosed());
791
+ if (!wasClosed) {
792
+ this.#disposeMcpPage(this.#selectedPage);
793
+ }
794
+ this.#selectedPage = undefined;
795
+ this.#selectedPageFallback = { wasClosed };
796
+ }
797
+ }
798
+ if (this.#selectedPage && !this.#selectedPage.isClosed()) {
799
+ // Automatic page snapshots must preserve real focus on untouched tabs.
800
+ await this.#selectedPage.init({ emulateFocus: false });
801
+ }
802
+ return pages;
460
803
  }
461
- if (this.#selectedPage && !this.#selectedPage.isClosed()) {
462
- await this.#selectedPage.init();
804
+ catch (e_1) {
805
+ env_1.error = e_1;
806
+ env_1.hasError = true;
807
+ }
808
+ finally {
809
+ __disposeResources(env_1);
463
810
  }
464
- return pages;
465
811
  }
466
812
  #isPageTarget(target) {
467
- const existingMcpPage = this.#mcpPages.get(target);
813
+ const existingMcpPage = this.#mcpPages.get(target) ??
814
+ (this.#selectedPage?.target === target ? this.#selectedPage : undefined);
468
815
  const url = existingMcpPage ? existingMcpPage.url() : target.url();
469
- if (!this.#options.experimentalDevToolsDebugging &&
816
+ if (!this.#config.resolved.experimentalDevtools &&
470
817
  url.startsWith('devtools://')) {
471
818
  return false;
472
819
  }
473
820
  if (!isAllowedUrl(url, {
474
- categoryExtensions: this.#options.categoryExtensions,
821
+ categoryExtensions: this.#config.resolved.categoryExtensions,
475
822
  })) {
476
823
  return false;
477
824
  }
@@ -479,11 +826,11 @@ export class McpContext {
479
826
  if (type === 'page') {
480
827
  return true;
481
828
  }
482
- if (this.#options.experimentalIncludeAllPages &&
829
+ if (this.#config.resolved.experimentalIncludeAllPages &&
483
830
  (type === 'background_page' || type === 'webview')) {
484
831
  return true;
485
832
  }
486
- if (this.#options.experimentalDevToolsDebugging &&
833
+ if (this.#config.resolved.experimentalDevtools &&
487
834
  type === 'other' &&
488
835
  url.startsWith('devtools://')) {
489
836
  return true;
@@ -612,60 +959,19 @@ export class McpContext {
612
959
  async getHeapSnapshotDominators(filePath, nodeId) {
613
960
  return await this.#heapSnapshotManager.getDominatorsOf(filePath, nodeId);
614
961
  }
615
- #validateUrlNotBlocked(url) {
616
- if (!this.#options.blocklist) {
617
- return;
618
- }
619
- for (const block of this.#options.blocklist) {
620
- const pattern = new URLPattern(block);
621
- if (pattern.test(url)) {
622
- throw new Error(`Blocked by blocklist: ${url}`);
623
- }
624
- }
625
- }
626
- #validateUrlAllowed(url) {
627
- if (!this.#options.allowlist) {
628
- return;
629
- }
630
- for (const allow of this.#options.allowlist) {
631
- const pattern = new URLPattern(allow);
632
- if (pattern.test(url)) {
633
- return;
634
- }
635
- }
636
- throw new Error(`Not allowed by allowlist: ${url}`);
637
- }
638
962
  async #loadNetworkResource(url) {
639
- const redirectStatuses = new Set([301, 302, 303, 307, 308]);
640
- const maxRedirects = 20;
641
- let currentUrl = url;
642
- for (let redirectCount = 0;; redirectCount++) {
643
- this.#validateUrlNotBlocked(currentUrl);
644
- this.#validateUrlAllowed(currentUrl);
645
- const response = await fetch(currentUrl, { redirect: 'manual' });
646
- if (!redirectStatuses.has(response.status)) {
647
- if (!response.ok) {
648
- throw new Error(`Failed to load resource: ${currentUrl}`);
649
- }
650
- return await response.text();
651
- }
652
- const location = response.headers.get('location');
653
- if (!location) {
654
- throw new Error(`Failed to load resource: ${currentUrl}`);
655
- }
656
- if (redirectCount >= maxRedirects) {
657
- throw new Error(`Too many redirects loading resource: ${url}`);
658
- }
659
- await response.body?.cancel();
660
- currentUrl = new URL(location, currentUrl);
661
- if (currentUrl.protocol !== 'https:' && currentUrl.protocol !== 'http:') {
662
- throw new Error(`Unsupported protocol for: ${currentUrl}`);
663
- }
963
+ const response = await fetchWithValidatedRedirects(url, {
964
+ policy: this.#config.resolved,
965
+ });
966
+ if (!response.ok) {
967
+ throw new Error('Failed to load resource: ' +
968
+ redactUrlForLogging(response.url || url.href));
664
969
  }
970
+ return await response.text();
665
971
  }
666
972
  async loadResource(path) {
667
973
  const url = new URL(path);
668
- this.#validateUrlNotBlocked(url);
974
+ validateUrlNotBlocked(url, this.#config.resolved.blockedUrlPattern);
669
975
  switch (url.protocol) {
670
976
  case 'https:':
671
977
  case 'http:': {