chrome-devtools-mcp 1.6.0 → 1.8.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 (313) hide show
  1. package/README.md +73 -22
  2. package/build/src/McpContext.js +121 -44
  3. package/build/src/McpPage.js +230 -14
  4. package/build/src/McpResponse.js +209 -283
  5. package/build/src/SlimMcpResponse.js +1 -1
  6. package/build/src/TextSnapshot.js +80 -19
  7. package/build/src/ToolHandler.js +80 -15
  8. package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
  9. package/build/src/bin/chrome-devtools.js +47 -32
  10. package/build/src/browser.js +3 -1
  11. package/build/src/{PageCollector.js → collectors/PageCollector.js} +15 -10
  12. package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
  13. package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +414 -23
  14. package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +74 -9
  15. package/build/src/daemon/client.js +33 -2
  16. package/build/src/daemon/daemon.js +17 -13
  17. package/build/src/daemon/utils.js +18 -3
  18. package/build/src/devtools/DevtoolsUtils.js +9 -16
  19. package/build/src/formatters/ConsoleFormatter.js +43 -10
  20. package/build/src/formatters/HeapSnapshotFormatter.js +58 -13
  21. package/build/src/formatters/IssueFormatter.js +1 -1
  22. package/build/src/formatters/NetworkFormatter.js +7 -7
  23. package/build/src/index.js +34 -5
  24. package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +82 -27
  25. package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
  26. package/build/src/telemetry/ClearcutLogger.js +16 -1
  27. package/build/src/telemetry/flagUtils.js +4 -3
  28. package/build/src/telemetry/transformation.js +30 -0
  29. package/build/src/telemetry/types.js +4 -0
  30. package/build/src/third_party/THIRD_PARTY_NOTICES +235 -113
  31. package/build/src/third_party/bundled-packages.json +6 -7
  32. package/build/src/third_party/devtools-formatter-worker.js +60 -19
  33. package/build/src/third_party/devtools-heap-snapshot-worker.js +657 -224
  34. package/build/src/third_party/index.js +62484 -43814
  35. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
  36. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
  37. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
  38. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
  39. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
  40. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
  41. package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
  42. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
  43. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
  44. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
  45. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
  46. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
  47. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
  48. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
  49. package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  50. package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  51. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  52. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
  53. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
  54. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
  55. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
  56. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
  57. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
  58. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
  59. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
  60. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
  61. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
  62. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
  63. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
  64. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
  65. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
  66. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
  67. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
  68. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
  69. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
  70. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
  71. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
  72. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
  73. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
  74. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
  75. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
  76. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
  77. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
  78. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
  79. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
  80. package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
  81. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
  82. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
  83. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
  84. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
  85. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
  86. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
  87. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
  88. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
  89. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
  90. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
  91. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
  92. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
  93. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
  94. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
  95. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
  96. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
  97. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
  98. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
  99. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
  100. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
  101. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
  102. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
  103. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
  104. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
  105. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
  106. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
  107. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
  108. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
  109. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
  110. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
  127. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
  128. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
  129. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
  130. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
  131. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
  132. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
  133. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
  134. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
  135. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
  136. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
  143. package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
  144. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
  145. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  146. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
  147. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
  148. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  149. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  150. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  151. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
  152. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
  153. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
  154. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
  155. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
  156. package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
  157. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
  158. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
  159. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
  160. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
  161. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
  162. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
  163. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
  164. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
  165. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
  166. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
  167. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
  168. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
  169. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
  170. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
  171. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
  172. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
  173. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
  174. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
  175. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
  176. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
  177. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
  178. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
  179. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
  180. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
  181. package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
  182. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  183. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
  184. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
  185. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
  186. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
  187. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
  188. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
  189. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
  190. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
  191. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
  192. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
  193. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
  194. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
  195. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
  196. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
  197. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
  198. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
  199. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
  200. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
  201. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
  202. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
  203. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
  204. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
  205. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
  206. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
  207. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
  208. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
  209. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
  210. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
  211. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
  212. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
  213. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
  214. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
  215. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
  216. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
  217. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
  218. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
  219. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
  220. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
  221. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
  222. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
  223. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
  224. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
  225. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
  226. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
  227. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
  228. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
  229. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
  230. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
  231. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
  232. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
  233. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
  234. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
  235. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
  236. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
  237. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
  238. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
  239. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
  240. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
  241. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
  242. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
  243. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
  244. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
  245. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
  246. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
  247. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
  248. package/build/src/tools/categories.js +3 -0
  249. package/build/src/tools/console.js +9 -3
  250. package/build/src/tools/emulation.js +2 -2
  251. package/build/src/tools/extensions.js +7 -5
  252. package/build/src/tools/input.js +222 -120
  253. package/build/src/tools/lighthouse.js +3 -1
  254. package/build/src/tools/memory.js +144 -17
  255. package/build/src/tools/network.js +6 -3
  256. package/build/src/tools/pages.js +13 -16
  257. package/build/src/tools/performance.js +57 -46
  258. package/build/src/tools/pwa.js +128 -0
  259. package/build/src/tools/screencast.js +6 -4
  260. package/build/src/tools/screenshot.js +192 -84
  261. package/build/src/tools/script.js +118 -34
  262. package/build/src/tools/slim/tools.js +3 -3
  263. package/build/src/tools/snapshot.js +5 -3
  264. package/build/src/tools/thirdPartyDeveloper.js +2 -2
  265. package/build/src/tools/tools.js +2 -0
  266. package/build/src/tools/webmcp.js +2 -2
  267. package/build/src/utils/WaitForHelper.js +299 -0
  268. package/build/src/utils/bytes.js +105 -0
  269. package/build/src/utils/logger.js +25 -11
  270. package/build/src/utils/polyfill.js +6 -3
  271. package/build/src/utils/url.js +43 -0
  272. package/build/src/version.js +1 -1
  273. package/package.json +37 -25
  274. package/skills/a11y-debugging/SKILL.md +2 -0
  275. package/skills/chrome-devtools/SKILL.md +5 -4
  276. package/skills/chrome-devtools-cli/SKILL.md +109 -64
  277. package/skills/debug-optimize-lcp/SKILL.md +9 -9
  278. package/skills/memory-leak-debugging/SKILL.md +14 -18
  279. package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
  280. package/skills/troubleshooting/SKILL.md +1 -0
  281. package/build/src/WaitForHelper.js +0 -200
  282. package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
  283. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  284. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  285. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  286. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  287. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  288. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  289. package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
  290. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
  291. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  292. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  293. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
  294. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  295. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  296. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  297. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
  298. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  299. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
  300. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
  301. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
  302. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
  303. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
  304. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
  305. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
  306. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
  307. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
  308. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
  309. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
  310. package/build/src/utils/Mutex.js +0 -38
  311. package/build/src/utils/string.js +0 -37
  312. package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
  313. package/skills/memory-leak-debugging/references/memlab.md +0 -29
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { zod } from '../third_party/index.js';
7
+ import { byteSizeRangeSchema } from '../utils/bytes.js';
7
8
  import { ToolCategory } from './categories.js';
8
9
  import { definePageTool, defineTool } from './ToolDefinition.js';
9
10
  const HEAP_SNAPSHOT_FILTERS = [
@@ -11,10 +12,13 @@ const HEAP_SNAPSHOT_FILTERS = [
11
12
  'objectsRetainedByConsole',
12
13
  'objectsRetainedByEventHandlers',
13
14
  'objectsRetainedByContexts',
15
+ 'sharedNativeContext',
16
+ 'noNativeContext',
17
+ 'attributedToSpecificNativeContext',
14
18
  ];
15
19
  export const takeHeapSnapshot = definePageTool({
16
20
  name: 'take_heapsnapshot',
17
- description: `Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.`,
21
+ description: `Capture a heap snapshot of the target page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.`,
18
22
  annotations: {
19
23
  category: ToolCategory.MEMORY,
20
24
  readOnlyHint: false,
@@ -25,7 +29,9 @@ export const takeHeapSnapshot = definePageTool({
25
29
  .describe('A path to a .heapsnapshot file to save the heapsnapshot to.'),
26
30
  },
27
31
  blockedByDialog: true,
28
- verifyFilesSchema: ['filePath'],
32
+ verifyFilesSchema: {
33
+ filePath: true,
34
+ },
29
35
  handler: async (request, response, context) => {
30
36
  const page = request.page;
31
37
  const snapshotPath = await context.ensureExtension(request.params.filePath, '.heapsnapshot');
@@ -37,7 +43,7 @@ export const takeHeapSnapshot = definePageTool({
37
43
  });
38
44
  export const getHeapSnapshotSummary = defineTool({
39
45
  name: 'get_heapsnapshot_summary',
40
- description: 'Loads a memory heapsnapshot and returns snapshot summary stats.',
46
+ description: 'Loads a memory heapsnapshot and returns snapshot summary stats, including native contexts and their sizes, and retained by context summary.',
41
47
  annotations: {
42
48
  category: ToolCategory.MEMORY,
43
49
  readOnlyHint: true,
@@ -47,11 +53,15 @@ export const getHeapSnapshotSummary = defineTool({
47
53
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
48
54
  },
49
55
  blockedByDialog: false,
50
- verifyFilesSchema: ['filePath'],
56
+ verifyFilesSchema: {
57
+ filePath: true,
58
+ },
51
59
  handler: async (request, response, context) => {
52
60
  const stats = await context.getHeapSnapshotStats(request.params.filePath);
53
61
  const staticData = await context.getHeapSnapshotStaticData(request.params.filePath);
54
- response.setHeapSnapshotStats(stats, staticData);
62
+ const nativeContextSizes = await context.getHeapSnapshotNativeContextSizes(request.params.filePath);
63
+ const retainedByContextSummary = await context.getHeapSnapshotRetainedByContextSummary(request.params.filePath);
64
+ response.setHeapSnapshotStats(stats, staticData, nativeContextSizes, retainedByContextSummary);
55
65
  },
56
66
  });
57
67
  export const getHeapSnapshotDetails = defineTool({
@@ -68,6 +78,10 @@ export const getHeapSnapshotDetails = defineTool({
68
78
  .enum(HEAP_SNAPSHOT_FILTERS)
69
79
  .optional()
70
80
  .describe('An optional filter to apply to the aggregates.'),
81
+ objectId: zod
82
+ .number()
83
+ .optional()
84
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
71
85
  pageIdx: zod
72
86
  .number()
73
87
  .optional()
@@ -78,9 +92,11 @@ export const getHeapSnapshotDetails = defineTool({
78
92
  .describe('The page size for pagination of aggregates.'),
79
93
  },
80
94
  blockedByDialog: false,
81
- verifyFilesSchema: ['filePath'],
95
+ verifyFilesSchema: {
96
+ filePath: true,
97
+ },
82
98
  handler: async (request, response, context) => {
83
- const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName);
99
+ const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName, request.params.objectId);
84
100
  response.setHeapSnapshotAggregates(aggregates, {
85
101
  pageIdx: request.params.pageIdx,
86
102
  pageSize: request.params.pageSize,
@@ -102,13 +118,19 @@ export const getHeapSnapshotClassNodes = defineTool({
102
118
  .enum(HEAP_SNAPSHOT_FILTERS)
103
119
  .optional()
104
120
  .describe('An optional filter to apply to the nodes.'),
121
+ objectId: zod
122
+ .number()
123
+ .optional()
124
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
105
125
  pageIdx: zod.number().optional().describe('The page index for pagination.'),
106
126
  pageSize: zod.number().optional().describe('The page size for pagination.'),
107
127
  },
108
128
  blockedByDialog: false,
109
- verifyFilesSchema: ['filePath'],
129
+ verifyFilesSchema: {
130
+ filePath: true,
131
+ },
110
132
  handler: async (request, response, context) => {
111
- const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName);
133
+ const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName, request.params.objectId);
112
134
  response.setHeapSnapshotNodes(nodes, {
113
135
  pageIdx: request.params.pageIdx,
114
136
  pageSize: request.params.pageSize,
@@ -124,7 +146,9 @@ export const getHeapSnapshotRetainers = defineTool({
124
146
  conditions: ['memoryDebugging'],
125
147
  },
126
148
  blockedByDialog: false,
127
- verifyFilesSchema: ['filePath'],
149
+ verifyFilesSchema: {
150
+ filePath: true,
151
+ },
128
152
  schema: {
129
153
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
130
154
  nodeId: zod.number().describe('The node ID to get retainers for.'),
@@ -147,7 +171,9 @@ export const closeHeapSnapshot = defineTool({
147
171
  readOnlyHint: false,
148
172
  conditions: ['memoryDebugging'],
149
173
  },
150
- verifyFilesSchema: ['filePath'],
174
+ verifyFilesSchema: {
175
+ filePath: true,
176
+ },
151
177
  schema: {
152
178
  filePath: zod
153
179
  .string()
@@ -170,7 +196,9 @@ export const getHeapSnapshotRetainingPaths = defineTool({
170
196
  readOnlyHint: true,
171
197
  conditions: ['memoryDebugging'],
172
198
  },
173
- verifyFilesSchema: ['filePath'],
199
+ verifyFilesSchema: {
200
+ filePath: true,
201
+ },
174
202
  blockedByDialog: false,
175
203
  schema: {
176
204
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
@@ -202,15 +230,31 @@ export const getHeapSnapshotEdges = defineTool({
202
230
  conditions: ['memoryDebugging'],
203
231
  },
204
232
  blockedByDialog: false,
205
- verifyFilesSchema: ['filePath'],
233
+ verifyFilesSchema: {
234
+ filePath: true,
235
+ },
206
236
  schema: {
207
237
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
208
238
  nodeId: zod.number().describe('The node ID to get outgoing edges for.'),
239
+ sortBy: zod
240
+ .enum(['retainedSize', 'selfSize', 'name'])
241
+ .optional()
242
+ .describe('Sort order for edges. Default is retainedSize.'),
243
+ retainedSize: byteSizeRangeSchema('Inclusive retained size range (e.g. "1MB-2MB", "-1MB", or "1MB-") for target nodes. A single value is treated as a minimum. Currently, only the lower bound is applied.').optional(),
244
+ excludePrimitives: zod
245
+ .boolean()
246
+ .optional()
247
+ .describe('Whether to exclude primitive target nodes. Default is true.'),
209
248
  pageIdx: zod.number().optional().describe('The page index for pagination.'),
210
249
  pageSize: zod.number().optional().describe('The page size for pagination.'),
211
250
  },
212
251
  handler: async (request, response, context) => {
213
- const edges = await context.getHeapSnapshotEdges(request.params.filePath, request.params.nodeId);
252
+ const edges = await context.getHeapSnapshotEdges(request.params.filePath, request.params.nodeId, {
253
+ sortBy: request.params.sortBy ?? 'retainedSize',
254
+ // DevTools currently only supports a lower retained-size bound here.
255
+ minRetainedSize: request.params.retainedSize?.min,
256
+ excludePrimitives: request.params.excludePrimitives ?? true,
257
+ });
214
258
  response.setHeapSnapshotNodes(edges, {
215
259
  pageIdx: request.params.pageIdx,
216
260
  pageSize: request.params.pageSize,
@@ -226,7 +270,9 @@ export const getHeapSnapshotDominators = defineTool({
226
270
  conditions: ['memoryDebugging'],
227
271
  },
228
272
  blockedByDialog: false,
229
- verifyFilesSchema: ['filePath'],
273
+ verifyFilesSchema: {
274
+ filePath: true,
275
+ },
230
276
  schema: {
231
277
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
232
278
  nodeId: zod
@@ -246,7 +292,10 @@ export const compareHeapSnapshots = defineTool({
246
292
  readOnlyHint: true,
247
293
  conditions: ['memoryDebugging'],
248
294
  },
249
- verifyFilesSchema: ['baseFilePath', 'currentFilePath'],
295
+ verifyFilesSchema: {
296
+ baseFilePath: true,
297
+ currentFilePath: true,
298
+ },
250
299
  schema: {
251
300
  baseFilePath: zod
252
301
  .string()
@@ -280,7 +329,9 @@ export const getHeapSnapshotDuplicateStrings = defineTool({
280
329
  conditions: ['memoryDebugging'],
281
330
  },
282
331
  blockedByDialog: false,
283
- verifyFilesSchema: ['filePath'],
332
+ verifyFilesSchema: {
333
+ filePath: true,
334
+ },
284
335
  schema: {
285
336
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
286
337
  pageIdx: zod.number().optional().describe('The page index for pagination.'),
@@ -294,4 +345,80 @@ export const getHeapSnapshotDuplicateStrings = defineTool({
294
345
  });
295
346
  },
296
347
  });
348
+ export const getHeapSnapshotObjectDetails = defineTool({
349
+ name: 'get_heapsnapshot_object_details',
350
+ description: 'Loads a memory heapsnapshot and returns detailed information about a specific object by its node ID, including size, type, distance, and DOM detachedness.',
351
+ annotations: {
352
+ category: ToolCategory.MEMORY,
353
+ readOnlyHint: true,
354
+ conditions: ['memoryDebugging'],
355
+ },
356
+ blockedByDialog: false,
357
+ verifyFilesSchema: {
358
+ filePath: true,
359
+ },
360
+ schema: {
361
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
362
+ nodeId: zod.number().describe('The node ID to get object details for.'),
363
+ },
364
+ handler: async (request, response, context) => {
365
+ const objectInfo = await context.getHeapSnapshotObjectDetails(request.params.filePath, request.params.nodeId);
366
+ response.setHeapSnapshotObjectDetails(objectInfo);
367
+ },
368
+ });
369
+ export const queryHeapSnapshotObjects = defineTool({
370
+ name: 'query_heapsnapshot_objects',
371
+ description: 'Loads a memory heapsnapshot and queries objects matching specific filters (className, propertyName, nodeType, retainedSize, selfSize, isDetached, sortBy).',
372
+ annotations: {
373
+ category: ToolCategory.MEMORY,
374
+ readOnlyHint: true,
375
+ conditions: ['memoryDebugging'],
376
+ },
377
+ blockedByDialog: false,
378
+ verifyFilesSchema: { filePath: true },
379
+ schema: {
380
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
381
+ className: zod
382
+ .string()
383
+ .optional()
384
+ .describe('Optional regex or text matching object class name.'),
385
+ propertyName: zod
386
+ .string()
387
+ .optional()
388
+ .describe('Optional property name filter for outgoing reference edges.'),
389
+ nodeType: zod
390
+ .string()
391
+ .optional()
392
+ .describe('Optional V8 node type filter (e.g. object, closure, string, array, code).'),
393
+ retainedSize: byteSizeRangeSchema('Inclusive retained size range (e.g. "1MB-2MB", "-1MB", or "1MB-"). A single value is treated as a minimum.').optional(),
394
+ selfSize: byteSizeRangeSchema('Inclusive self size range (e.g. "1MB-2MB", "-1MB", or "1MB-"). A single value is treated as a minimum.').optional(),
395
+ isDetached: zod
396
+ .boolean()
397
+ .optional()
398
+ .describe('Whether to filter for detached DOM nodes.'),
399
+ sortBy: zod
400
+ .enum(['retainedSize', 'selfSize', 'id'])
401
+ .optional()
402
+ .describe('Sort order for results. Default is retainedSize.'),
403
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
404
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
405
+ },
406
+ handler: async (request, response, context) => {
407
+ const range = await context.queryHeapSnapshotObjects(request.params.filePath, {
408
+ className: request.params.className,
409
+ propertyName: request.params.propertyName,
410
+ nodeType: request.params.nodeType,
411
+ minRetainedSize: request.params.retainedSize?.min,
412
+ maxRetainedSize: request.params.retainedSize?.max,
413
+ minSelfSize: request.params.selfSize?.min,
414
+ maxSelfSize: request.params.selfSize?.max,
415
+ isDetached: request.params.isDetached,
416
+ sortBy: request.params.sortBy,
417
+ });
418
+ response.setHeapSnapshotNodes(range, {
419
+ pageIdx: request.params.pageIdx,
420
+ pageSize: request.params.pageSize,
421
+ });
422
+ },
423
+ });
297
424
  //# sourceMappingURL=memory.js.map
@@ -29,7 +29,7 @@ const FILTERABLE_RESOURCE_TYPES = [
29
29
  ];
30
30
  export const listNetworkRequests = definePageTool({
31
31
  name: 'list_network_requests',
32
- description: `List all requests for the currently selected page since the last navigation.`,
32
+ description: `Lists the most recent requests for the target page since the last navigation.`,
33
33
  annotations: {
34
34
  category: ToolCategory.NETWORK,
35
35
  readOnlyHint: true,
@@ -58,7 +58,7 @@ export const listNetworkRequests = definePageTool({
58
58
  .describe('Set to true to return the preserved requests over the last 3 navigations.'),
59
59
  },
60
60
  blockedByDialog: false,
61
- verifyFilesSchema: [],
61
+ verifyFilesSchema: {},
62
62
  handler: async (request, response) => {
63
63
  const data = await request.page.getDevToolsData();
64
64
  response.attachDevToolsData(data);
@@ -96,7 +96,10 @@ export const getNetworkRequest = definePageTool({
96
96
  .describe('The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.'),
97
97
  },
98
98
  blockedByDialog: true,
99
- verifyFilesSchema: ['requestFilePath', 'responseFilePath'],
99
+ verifyFilesSchema: {
100
+ requestFilePath: true,
101
+ responseFilePath: true,
102
+ },
100
103
  handler: async (request, response) => {
101
104
  if (request.params.reqid) {
102
105
  response.attachNetworkRequest(request.params.reqid, {
@@ -17,7 +17,7 @@ export const listPages = defineTool(args => {
17
17
  },
18
18
  schema: {},
19
19
  blockedByDialog: false,
20
- verifyFilesSchema: [],
20
+ verifyFilesSchema: {},
21
21
  handler: async (_request, response) => {
22
22
  response.setIncludePages(true);
23
23
  response.setListThirdPartyDeveloperTools();
@@ -42,7 +42,7 @@ export const selectPage = defineTool({
42
42
  .describe('Whether to focus the page and bring it to the top.'),
43
43
  },
44
44
  blockedByDialog: false,
45
- verifyFilesSchema: [],
45
+ verifyFilesSchema: {},
46
46
  handler: async (request, response, context) => {
47
47
  const page = context.getPageById(request.params.pageId);
48
48
  context.selectPage(page);
@@ -67,7 +67,7 @@ export const closePage = defineTool({
67
67
  .describe('The ID of the page to close. Call list_pages to list pages.'),
68
68
  },
69
69
  blockedByDialog: false,
70
- verifyFilesSchema: [],
70
+ verifyFilesSchema: {},
71
71
  handler: async (request, response, context) => {
72
72
  try {
73
73
  await context.closePage(request.params.pageId);
@@ -107,7 +107,7 @@ export const newPage = defineTool(() => {
107
107
  ...timeoutSchema,
108
108
  },
109
109
  blockedByDialog: false,
110
- verifyFilesSchema: [],
110
+ verifyFilesSchema: {},
111
111
  handler: async (request, response, context) => {
112
112
  const page = await context.newPage(request.params.background, request.params.isolatedContext);
113
113
  await page.waitForEventsAfterAction(async () => {
@@ -149,7 +149,7 @@ export const navigatePage = definePageTool(() => {
149
149
  ...timeoutSchema,
150
150
  },
151
151
  blockedByDialog: false,
152
- verifyFilesSchema: [],
152
+ verifyFilesSchema: {},
153
153
  handler: async (request, response) => {
154
154
  const page = request.page;
155
155
  const options = {
@@ -239,7 +239,7 @@ export const navigatePage = definePageTool(() => {
239
239
  });
240
240
  export const resizePage = definePageTool({
241
241
  name: 'resize_page',
242
- description: `Resizes the selected page's window so that the page has specified dimension`,
242
+ description: `Resizes the page's window so that the page has specified dimension`,
243
243
  annotations: {
244
244
  category: ToolCategory.EMULATION,
245
245
  readOnlyHint: false,
@@ -249,7 +249,7 @@ export const resizePage = definePageTool({
249
249
  height: zod.number().describe('Page height'),
250
250
  },
251
251
  blockedByDialog: false,
252
- verifyFilesSchema: [],
252
+ verifyFilesSchema: {},
253
253
  handler: async (request, response) => {
254
254
  const page = request.page;
255
255
  try {
@@ -292,7 +292,7 @@ export const handleDialog = definePageTool({
292
292
  .describe('Optional prompt text to enter into the dialog.'),
293
293
  },
294
294
  blockedByDialog: false,
295
- verifyFilesSchema: [],
295
+ verifyFilesSchema: {},
296
296
  handler: async (request, response) => {
297
297
  const page = request.page;
298
298
  const dialog = page.getDialog();
@@ -335,17 +335,14 @@ export const getTabId = definePageTool({
335
335
  readOnlyHint: true,
336
336
  conditions: ['experimentalInteropTools'],
337
337
  },
338
- schema: {
339
- pageId: zod
340
- .number()
341
- .describe(`The ID of the page to get the tab ID for. Call ${listPages().name} to get available pages.`),
342
- },
338
+ schema: {},
343
339
  blockedByDialog: false,
344
- verifyFilesSchema: [],
345
- handler: async (request, response, context) => {
346
- const page = context.getPageById(request.params.pageId);
340
+ verifyFilesSchema: {},
341
+ handler: async (request, response) => {
342
+ const page = request.page;
347
343
  const tabId = page.pptrPage._tabId;
348
344
  response.setTabId(tabId);
345
+ response.appendResponseLine(`Tab ID: ${tabId}`);
349
346
  },
350
347
  });
351
348
  //# sourceMappingURL=pages.js.map
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import zlib from 'node:zlib';
7
7
  import { zod, DevTools } from '../third_party/index.js';
8
- import { parseRawTraceBuffer, traceResultIsSuccess, } from '../trace-processing/parse.js';
8
+ import { parseRawTraceBuffer, traceResultIsSuccess, } from '../processors/PerformanceTrace.js';
9
9
  import { logger } from '../utils/logger.js';
10
10
  import { ToolCategory } from './categories.js';
11
11
  import { definePageTool } from './ToolDefinition.js';
@@ -15,7 +15,7 @@ const filePathSchema = zod
15
15
  .describe('The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).');
16
16
  export const startTrace = definePageTool({
17
17
  name: 'performance_start_trace',
18
- description: `Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.`,
18
+ description: `Start a performance trace on the target webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.`,
19
19
  annotations: {
20
20
  category: ToolCategory.PERFORMANCE,
21
21
  readOnlyHint: false,
@@ -24,7 +24,7 @@ export const startTrace = definePageTool({
24
24
  reload: zod
25
25
  .boolean()
26
26
  .default(true)
27
- .describe('Determines if, once tracing has started, the current selected page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.'),
27
+ .describe('Determines if, once tracing has started, the target page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.'),
28
28
  autoStop: zod
29
29
  .boolean()
30
30
  .default(true)
@@ -32,7 +32,9 @@ export const startTrace = definePageTool({
32
32
  filePath: filePathSchema,
33
33
  },
34
34
  blockedByDialog: true,
35
- verifyFilesSchema: ['filePath'],
35
+ verifyFilesSchema: {
36
+ filePath: true,
37
+ },
36
38
  handler: async (request, response, context) => {
37
39
  if (context.isRunningPerformanceTrace()) {
38
40
  response.appendResponseLine('Error: a performance trace is already running. Use performance_stop_trace to stop it. Only one trace can be running at any given time.');
@@ -41,53 +43,60 @@ export const startTrace = definePageTool({
41
43
  context.setIsRunningPerformanceTrace(true);
42
44
  const page = request.page;
43
45
  const pageUrlForTracing = page.pptrPage.url();
44
- if (request.params.reload) {
45
- // Before starting the recording, navigate to about:blank to clear out any state.
46
- await page.pptrPage.goto('about:blank', {
47
- waitUntil: ['networkidle0'],
48
- });
49
- }
50
- // Keep in sync with the categories arrays in:
51
- // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/timeline/TimelineController.ts
52
- // https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/gather/gatherers/trace.js
53
- const categories = [
54
- '-*',
55
- 'blink.console',
56
- 'blink.user_timing',
57
- 'devtools.timeline',
58
- 'disabled-by-default-devtools.screenshot',
59
- 'disabled-by-default-devtools.timeline',
60
- 'disabled-by-default-devtools.timeline.invalidationTracking',
61
- 'disabled-by-default-devtools.timeline.frame',
62
- 'disabled-by-default-devtools.timeline.stack',
63
- 'disabled-by-default-v8.cpu_profiler',
64
- 'disabled-by-default-v8.cpu_profiler.hires',
65
- 'latencyInfo',
66
- 'loading',
67
- 'disabled-by-default-lighthouse',
68
- 'v8.execute',
69
- 'v8',
70
- ];
71
- await page.pptrPage.tracing.start({
72
- categories,
73
- });
74
- if (request.params.reload) {
75
- await page.pptrPage.goto(pageUrlForTracing, {
76
- waitUntil: ['load'],
46
+ try {
47
+ if (request.params.reload) {
48
+ // Before starting the recording, navigate to about:blank to clear out any state.
49
+ // We use `load` because `networkidle0` is known to be flaky for about:blank in Puppeteer.
50
+ await page.pptrPage.goto('about:blank', {
51
+ waitUntil: 'load',
52
+ });
53
+ }
54
+ const categories = [
55
+ '-*',
56
+ ...DevTools.TracingDefaultCategories,
57
+ // These categories are optional in DevTools, but enabled by default in the DevTools UI, so we enable them here too.
58
+ ...DevTools.TracingOptionalCategories.JsSampling,
59
+ ...DevTools.TracingOptionalCategories.Screenshot,
60
+ ];
61
+ await page.pptrPage.tracing.start({
62
+ categories,
77
63
  });
64
+ if (request.params.reload) {
65
+ await page.pptrPage.goto(pageUrlForTracing, {
66
+ waitUntil: ['load'],
67
+ });
68
+ }
69
+ if (request.params.autoStop) {
70
+ await new Promise(resolve => setTimeout(resolve, 5_000));
71
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
72
+ }
73
+ else {
74
+ response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
75
+ }
78
76
  }
79
- if (request.params.autoStop) {
80
- await new Promise(resolve => setTimeout(resolve, 5_000));
81
- await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
82
- }
83
- else {
84
- response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
77
+ catch (error) {
78
+ // If a setup step (navigation, tracing.start) throws before
79
+ // stopTracingAndAppendOutput runs, the running flag would otherwise stay
80
+ // stuck `true` for the rest of the session, blocking all future traces.
81
+ // Unwind here: stop tracing if it was started and clear the flag. When
82
+ // autoStop already ran stopTracingAndAppendOutput the flag is already
83
+ // false and this is a no-op.
84
+ if (context.isRunningPerformanceTrace()) {
85
+ try {
86
+ await page.pptrPage.tracing.stop();
87
+ }
88
+ catch {
89
+ // Tracing may not have started yet; ignore.
90
+ }
91
+ context.setIsRunningPerformanceTrace(false);
92
+ }
93
+ throw error;
85
94
  }
86
95
  },
87
96
  });
88
97
  export const stopTrace = definePageTool({
89
98
  name: 'performance_stop_trace',
90
- description: 'Stop the active performance trace recording on the selected webpage.',
99
+ description: 'Stop the active performance trace recording on the target webpage.',
91
100
  annotations: {
92
101
  category: ToolCategory.PERFORMANCE,
93
102
  readOnlyHint: false,
@@ -96,7 +105,9 @@ export const stopTrace = definePageTool({
96
105
  filePath: filePathSchema,
97
106
  },
98
107
  blockedByDialog: true,
99
- verifyFilesSchema: ['filePath'],
108
+ verifyFilesSchema: {
109
+ filePath: true,
110
+ },
100
111
  handler: async (request, response, context) => {
101
112
  if (!context.isRunningPerformanceTrace()) {
102
113
  return;
@@ -121,7 +132,7 @@ export const analyzeInsight = definePageTool({
121
132
  .describe('The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"'),
122
133
  },
123
134
  blockedByDialog: false,
124
- verifyFilesSchema: [],
135
+ verifyFilesSchema: {},
125
136
  handler: async (request, response, context) => {
126
137
  const lastRecording = context.recordedTraces().at(-1);
127
138
  if (!lastRecording) {