chrome-devtools-mcp 1.6.0 → 1.7.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 (277) hide show
  1. package/README.md +26 -9
  2. package/build/src/HeapSnapshotManager.js +62 -23
  3. package/build/src/McpContext.js +64 -23
  4. package/build/src/McpPage.js +225 -11
  5. package/build/src/McpResponse.js +188 -280
  6. package/build/src/PageCollector.js +8 -3
  7. package/build/src/SlimMcpResponse.js +1 -1
  8. package/build/src/TextSnapshot.js +80 -19
  9. package/build/src/ToolHandler.js +19 -8
  10. package/build/src/WaitForHelper.js +142 -68
  11. package/build/src/bin/chrome-devtools-cli-options.js +38 -2
  12. package/build/src/bin/chrome-devtools-mcp-cli-options.js +1 -1
  13. package/build/src/bin/chrome-devtools-mcp-main.js +1 -1
  14. package/build/src/bin/chrome-devtools.js +19 -3
  15. package/build/src/daemon/client.js +22 -0
  16. package/build/src/daemon/daemon.js +15 -11
  17. package/build/src/daemon/utils.js +18 -3
  18. package/build/src/devtools/DevtoolsUtils.js +7 -2
  19. package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
  20. package/build/src/index.js +2 -1
  21. package/build/src/telemetry/ClearcutLogger.js +3 -0
  22. package/build/src/telemetry/transformation.js +30 -0
  23. package/build/src/third_party/THIRD_PARTY_NOTICES +231 -52
  24. package/build/src/third_party/bundled-packages.json +3 -4
  25. package/build/src/third_party/devtools-formatter-worker.js +60 -19
  26. package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
  27. package/build/src/third_party/index.js +28280 -9450
  28. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
  29. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
  30. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
  31. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
  32. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
  33. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
  34. package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
  35. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
  36. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
  37. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
  38. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
  39. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
  40. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
  41. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
  42. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
  43. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
  44. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
  45. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
  46. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
  47. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
  48. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
  49. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
  50. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
  51. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
  52. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
  53. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
  54. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
  55. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
  56. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
  57. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
  58. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
  59. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
  60. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
  61. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
  62. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
  63. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
  64. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
  65. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
  66. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
  67. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
  68. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
  69. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
  70. package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
  71. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
  72. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
  73. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
  74. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
  75. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
  76. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
  77. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
  78. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
  79. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
  80. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
  81. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
  82. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
  83. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
  84. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
  85. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
  86. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
  87. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
  88. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
  89. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
  90. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
  91. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
  92. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
  93. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
  94. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
  95. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
  96. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
  97. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
  98. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
  99. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
  100. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
  101. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
  102. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
  103. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
  104. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
  105. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
  106. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
  107. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
  108. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
  109. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
  110. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
  127. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
  128. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
  129. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
  130. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
  131. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
  132. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
  133. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  134. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
  135. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  136. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
  143. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
  144. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
  145. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
  146. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
  147. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
  148. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
  149. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
  150. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
  151. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
  152. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
  153. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
  154. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
  155. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
  156. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
  157. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
  158. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
  159. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
  160. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
  161. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
  162. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
  163. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
  164. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
  165. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
  166. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
  167. package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
  168. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  169. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
  170. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
  171. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
  172. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
  173. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
  174. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
  175. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
  176. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
  177. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
  178. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
  179. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
  180. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
  181. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
  182. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
  183. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
  184. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
  185. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
  186. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
  187. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
  188. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
  189. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
  190. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
  191. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
  192. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
  193. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
  194. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
  195. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
  196. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
  197. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
  198. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
  199. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
  200. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
  201. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
  202. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
  203. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
  204. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
  205. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
  206. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
  207. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
  208. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
  209. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
  210. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
  211. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
  212. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
  213. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
  214. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
  215. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
  216. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
  217. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
  218. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
  219. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
  220. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
  221. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
  222. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
  223. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
  224. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
  225. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
  226. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
  227. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
  228. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
  229. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
  230. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
  231. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
  232. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
  233. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
  234. package/build/src/tools/input.js +197 -105
  235. package/build/src/tools/memory.js +35 -4
  236. package/build/src/tools/network.js +1 -1
  237. package/build/src/tools/pages.js +1 -0
  238. package/build/src/tools/performance.js +60 -39
  239. package/build/src/tools/screenshot.js +152 -77
  240. package/build/src/tools/script.js +95 -31
  241. package/build/src/utils/polyfill.js +6 -3
  242. package/build/src/utils/url.js +43 -0
  243. package/build/src/version.js +1 -1
  244. package/package.json +20 -16
  245. package/skills/memory-leak-debugging/SKILL.md +12 -16
  246. package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
  247. package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
  248. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  249. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  250. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  251. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  252. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  253. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  254. package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
  255. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
  256. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  257. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  258. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
  259. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  260. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  261. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  262. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
  263. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  264. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
  265. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
  266. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
  267. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
  268. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
  269. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
  270. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
  271. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
  272. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
  273. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
  274. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
  275. package/build/src/utils/Mutex.js +0 -38
  276. package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
  277. package/skills/memory-leak-debugging/references/memlab.md +0 -29
@@ -3,6 +3,58 @@
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 { logger } from './utils/logger.js';
7
59
  export class TextSnapshot {
8
60
  static nextSnapshotId = 1;
@@ -153,28 +205,37 @@ export class TextSnapshot {
153
205
  return extraNode;
154
206
  };
155
207
  const findAncestorNode = async (handle) => {
156
- let ancestorHandle = await handle.evaluateHandle(el => el.parentElement);
157
- while (ancestorHandle) {
158
- const ancestorElement = ancestorHandle.asElement();
159
- if (!ancestorElement) {
160
- await ancestorHandle.dispose();
161
- return null;
162
- }
163
- const ancestorBackendId = await ancestorElement.backendNodeId();
164
- if (ancestorBackendId) {
165
- const ancestorNode = idToNode
166
- .values()
167
- .find(node => node.backendNodeId === ancestorBackendId);
168
- if (ancestorNode) {
169
- await ancestorHandle.dispose();
170
- return ancestorNode;
208
+ const env_1 = { stack: [], error: void 0, hasError: false };
209
+ try {
210
+ let ancestorHandle = await handle.evaluateHandle(el => el.parentElement);
211
+ const stack = __addDisposableResource(env_1, new DisposableStack(), false);
212
+ while (ancestorHandle) {
213
+ stack.use(ancestorHandle);
214
+ const ancestorElement = ancestorHandle.asElement();
215
+ if (!ancestorElement) {
216
+ return null;
217
+ }
218
+ const ancestorBackendId = await ancestorElement.backendNodeId();
219
+ if (ancestorBackendId) {
220
+ const ancestorNode = idToNode
221
+ .values()
222
+ .find(node => node.backendNodeId === ancestorBackendId);
223
+ if (ancestorNode) {
224
+ return ancestorNode;
225
+ }
171
226
  }
227
+ const nextHandle = await ancestorElement.evaluateHandle(el => el.parentElement);
228
+ ancestorHandle = nextHandle;
172
229
  }
173
- const nextHandle = await ancestorElement.evaluateHandle(el => el.parentElement);
174
- await ancestorHandle.dispose();
175
- ancestorHandle = nextHandle;
230
+ return null;
231
+ }
232
+ catch (e_1) {
233
+ env_1.error = e_1;
234
+ env_1.hasError = true;
235
+ }
236
+ finally {
237
+ __disposeResources(env_1);
176
238
  }
177
- return null;
178
239
  };
179
240
  const findDescendantNodes = async (backendNodeId) => {
180
241
  const descendantIds = new Set();
@@ -6,7 +6,7 @@
6
6
  import { McpResponse } from './McpResponse.js';
7
7
  import { SlimMcpResponse } from './SlimMcpResponse.js';
8
8
  import { ClearcutLogger } from './telemetry/ClearcutLogger.js';
9
- import { bucketizeLatency } from './telemetry/transformation.js';
9
+ import { bucketizeLatency, buildContext } from './telemetry/transformation.js';
10
10
  import { zod } from './third_party/index.js';
11
11
  import { labels, OFF_BY_DEFAULT_CATEGORIES } from './tools/categories.js';
12
12
  import { pageIdSchema } from './tools/ToolDefinition.js';
@@ -138,6 +138,8 @@ export class ToolHandler {
138
138
  const guard = await this.toolMutex.acquire();
139
139
  const startTime = Date.now();
140
140
  let success = false;
141
+ let devToolsData;
142
+ let pageUrl;
141
143
  try {
142
144
  logger?.(`${this.tool.name} request: ${JSON.stringify(params, null, ' ')}`);
143
145
  const context = await this.getContext();
@@ -149,6 +151,7 @@ export class ToolHandler {
149
151
  if (context.consumeReconnectNotice()) {
150
152
  response.setReconnectNotice();
151
153
  }
154
+ let page;
152
155
  try {
153
156
  if (this.tool.verifyFilesSchema) {
154
157
  for (const key of this.tool.verifyFilesSchema) {
@@ -158,11 +161,12 @@ export class ToolHandler {
158
161
  }
159
162
  if (isPageScopedTool(this.tool)) {
160
163
  const pageId = typeof params.pageId === 'number' ? params.pageId : undefined;
161
- const page = this.serverArgs.experimentalPageIdRouting &&
162
- pageId !== undefined &&
163
- !this.serverArgs.slim
164
- ? context.getPageById(pageId)
165
- : context.getSelectedMcpPage();
164
+ page =
165
+ this.serverArgs.experimentalPageIdRouting &&
166
+ pageId !== undefined &&
167
+ !this.serverArgs.slim
168
+ ? context.getPageById(pageId)
169
+ : context.getSelectedMcpPage();
166
170
  response.setPage(page);
167
171
  if (this.tool.blockedByDialog) {
168
172
  page.throwIfDialogOpen();
@@ -181,6 +185,11 @@ export class ToolHandler {
181
185
  catch (err) {
182
186
  response.setError(err);
183
187
  }
188
+ devToolsData = await context.getDevToolsData(page);
189
+ const targetPage = page ?? context.getSelectedMcpPage();
190
+ if (targetPage?.pptrPage?.isClosed() === false) {
191
+ pageUrl = targetPage.pptrPage.url();
192
+ }
184
193
  // Resolve data format: --experimentalDataFormat takes precedence, fall back to legacy --experimentalToonFormat
185
194
  let dataFormat = 'default';
186
195
  if (this.serverArgs.experimentalDataFormat) {
@@ -189,7 +198,7 @@ export class ToolHandler {
189
198
  else if (this.serverArgs.experimentalToonFormat) {
190
199
  dataFormat = 'toon';
191
200
  }
192
- const { content, structuredContent } = await response.handle(this.tool.name, context, dataFormat);
201
+ const { content, structuredContent } = await response.handle(context, dataFormat);
193
202
  const result = {
194
203
  content,
195
204
  };
@@ -219,14 +228,16 @@ export class ToolHandler {
219
228
  };
220
229
  }
221
230
  finally {
231
+ const context = buildContext(devToolsData, pageUrl);
222
232
  void ClearcutLogger.get()?.logToolInvocation({
223
233
  toolName: this.tool.name,
224
234
  params,
225
235
  schema: this.inputSchema,
226
236
  success,
227
237
  latencyMs: bucketizeLatency(Date.now() - startTime),
238
+ context,
228
239
  });
229
- guard.dispose();
240
+ guard[Symbol.dispose]();
230
241
  }
231
242
  }
232
243
  }
@@ -3,6 +3,58 @@
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 { logger } from './utils/logger.js';
7
59
  export class WaitForHelper {
8
60
  #abortController = new AbortController();
@@ -11,7 +63,9 @@ export class WaitForHelper {
11
63
  #stableDomFor;
12
64
  #expectNavigationIn;
13
65
  #navigationTimeout;
14
- #dialogOpened = false;
66
+ #dialogHandled = false;
67
+ /** Track all dialogs as they pause the renderer. */
68
+ #dialogDetected = false;
15
69
  #initialUrl;
16
70
  constructor(page, cpuTimeoutMultiplier, networkTimeoutMultiplier) {
17
71
  this.#stableDomTimeout = 3000 * cpuTimeoutMultiplier;
@@ -27,49 +81,67 @@ export class WaitForHelper {
27
81
  * for the DOM to be stable before returning.
28
82
  */
29
83
  async waitForStableDom() {
30
- const stableDomObserver = await this.#page.evaluateHandle(timeout => {
31
- let timeoutId;
32
- function callback() {
33
- clearTimeout(timeoutId);
34
- timeoutId = setTimeout(() => {
35
- domObserver.resolver.resolve();
36
- domObserver.observer.disconnect();
37
- }, timeout);
84
+ const env_1 = { stack: [], error: void 0, hasError: false };
85
+ try {
86
+ // Bound the setup evaluation against the stable-DOM timeout. Without this
87
+ // cap a paused renderer (e.g. an open dialog) would make evaluateHandle
88
+ // hang until protocolTimeout (default 180s) while the tool mutex is held.
89
+ const stableDomObserver = __addDisposableResource(env_1, await Promise.race([
90
+ this.#page.evaluateHandle(timeout => {
91
+ let timeoutId;
92
+ function callback() {
93
+ clearTimeout(timeoutId);
94
+ timeoutId = setTimeout(() => {
95
+ domObserver.resolver.resolve();
96
+ domObserver.observer.disconnect();
97
+ }, timeout);
98
+ }
99
+ const domObserver = {
100
+ resolver: Promise.withResolvers(),
101
+ observer: new MutationObserver(callback),
102
+ };
103
+ // It's possible that the DOM is not gonna change so we
104
+ // need to start the timeout initially.
105
+ callback();
106
+ domObserver.observer.observe(document.body, {
107
+ childList: true,
108
+ subtree: true,
109
+ attributes: true,
110
+ });
111
+ return domObserver;
112
+ }, this.#stableDomFor),
113
+ this.timeout(this.#stableDomTimeout),
114
+ ]).catch(() => undefined), false);
115
+ if (!stableDomObserver) {
116
+ return;
38
117
  }
39
- const domObserver = {
40
- resolver: Promise.withResolvers(),
41
- observer: new MutationObserver(callback),
42
- };
43
- // It's possible that the DOM is not gonna change so we
44
- // need to start the timeout initially.
45
- callback();
46
- domObserver.observer.observe(document.body, {
47
- childList: true,
48
- subtree: true,
49
- attributes: true,
118
+ this.#abortController.signal.addEventListener('abort', async () => {
119
+ try {
120
+ await stableDomObserver.evaluate(observer => {
121
+ observer.observer.disconnect();
122
+ observer.resolver.resolve();
123
+ });
124
+ }
125
+ catch {
126
+ // Ignored cleanup errors
127
+ }
50
128
  });
51
- return domObserver;
52
- }, this.#stableDomFor);
53
- this.#abortController.signal.addEventListener('abort', async () => {
54
- try {
55
- await stableDomObserver.evaluate(observer => {
56
- observer.observer.disconnect();
57
- observer.resolver.resolve();
58
- });
59
- await stableDomObserver.dispose();
60
- }
61
- catch {
62
- // Ignored cleanup errors
63
- }
64
- });
65
- return Promise.race([
66
- stableDomObserver.evaluate(async (observer) => {
67
- return await observer.resolver.promise;
68
- }),
69
- this.timeout(this.#stableDomTimeout).then(() => {
70
- throw new Error('Timeout');
71
- }),
72
- ]);
129
+ return Promise.race([
130
+ stableDomObserver.evaluate(async (observer) => {
131
+ return await observer.resolver.promise;
132
+ }),
133
+ this.timeout(this.#stableDomTimeout).then(() => {
134
+ throw new Error('Timeout');
135
+ }),
136
+ ]);
137
+ }
138
+ catch (e_1) {
139
+ env_1.error = e_1;
140
+ env_1.hasError = true;
141
+ }
142
+ finally {
143
+ __disposeResources(env_1);
144
+ }
73
145
  }
74
146
  async waitForNavigationStarted() {
75
147
  // Currently Puppeteer does not have API
@@ -110,33 +182,35 @@ export class WaitForHelper {
110
182
  if (this.#abortController.signal.aborted) {
111
183
  throw new Error("Can't re-use a WaitForHelper");
112
184
  }
113
- if (options?.handleDialog) {
114
- const dialogHandler = (dialog) => {
115
- let actionToTake;
116
- if (typeof options.handleDialog === 'object') {
117
- actionToTake = options.handleDialog[dialog.type()];
185
+ const dialogHandler = (dialog) => {
186
+ this.#dialogDetected = true;
187
+ if (!options?.handleDialog) {
188
+ return;
189
+ }
190
+ let actionToTake;
191
+ if (typeof options.handleDialog === 'object') {
192
+ actionToTake = options.handleDialog[dialog.type()];
193
+ }
194
+ else {
195
+ actionToTake = options.handleDialog;
196
+ }
197
+ if (actionToTake) {
198
+ this.#dialogHandled = true;
199
+ if (actionToTake === 'dismiss') {
200
+ void dialog.dismiss();
118
201
  }
119
- else {
120
- actionToTake = options.handleDialog;
202
+ else if (actionToTake === 'accept') {
203
+ void dialog.accept();
121
204
  }
122
- if (actionToTake) {
123
- this.#dialogOpened = true;
124
- if (actionToTake === 'dismiss') {
125
- void dialog.dismiss();
126
- }
127
- else if (actionToTake === 'accept') {
128
- void dialog.accept();
129
- }
130
- else {
131
- void dialog.accept(actionToTake);
132
- }
205
+ else {
206
+ void dialog.accept(actionToTake);
133
207
  }
134
- };
135
- this.#page.on('dialog', dialogHandler);
136
- this.#abortController.signal.addEventListener('abort', () => {
137
- this.#page.off('dialog', dialogHandler);
138
- });
139
- }
208
+ }
209
+ };
210
+ this.#page.on('dialog', dialogHandler);
211
+ this.#abortController.signal.addEventListener('abort', () => {
212
+ this.#page.off('dialog', dialogHandler);
213
+ });
140
214
  const navigationFinished = this.waitForNavigationStarted()
141
215
  .then(navigationStated => {
142
216
  if (navigationStated) {
@@ -158,7 +232,7 @@ export class WaitForHelper {
158
232
  }
159
233
  try {
160
234
  await navigationFinished;
161
- if (this.#dialogOpened) {
235
+ if (this.#dialogDetected) {
162
236
  return this.#getResult();
163
237
  }
164
238
  // Wait for stable dom after navigation so we execute in
@@ -179,7 +253,7 @@ export class WaitForHelper {
179
253
  ...(urlAfterAction !== this.#initialUrl
180
254
  ? { navigatedToUrl: urlAfterAction }
181
255
  : {}),
182
- dialogHandled: this.#dialogOpened,
256
+ dialogHandled: this.#dialogHandled,
183
257
  };
184
258
  }
185
259
  }
@@ -308,8 +308,17 @@ export const commands = {
308
308
  'objectsRetainedByConsole',
309
309
  'objectsRetainedByEventHandlers',
310
310
  'objectsRetainedByContexts',
311
+ 'sharedNativeContext',
312
+ 'noNativeContext',
313
+ 'attributedToSpecificNativeContext',
311
314
  ],
312
315
  },
316
+ objectId: {
317
+ name: 'objectId',
318
+ type: 'number',
319
+ description: 'The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.',
320
+ required: false,
321
+ },
313
322
  pageIdx: {
314
323
  name: 'pageIdx',
315
324
  type: 'number',
@@ -344,8 +353,17 @@ export const commands = {
344
353
  'objectsRetainedByConsole',
345
354
  'objectsRetainedByEventHandlers',
346
355
  'objectsRetainedByContexts',
356
+ 'sharedNativeContext',
357
+ 'noNativeContext',
358
+ 'attributedToSpecificNativeContext',
347
359
  ],
348
360
  },
361
+ objectId: {
362
+ name: 'objectId',
363
+ type: 'number',
364
+ description: 'The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.',
365
+ required: false,
366
+ },
349
367
  pageIdx: {
350
368
  name: 'pageIdx',
351
369
  type: 'number',
@@ -432,6 +450,24 @@ export const commands = {
432
450
  },
433
451
  },
434
452
  },
453
+ get_heapsnapshot_object_details: {
454
+ description: 'Loads a memory heapsnapshot and returns detailed information about a specific object by its node ID, including size, type, distance, and DOM detachedness. (requires flag: --memoryDebugging=true)',
455
+ category: 'Memory',
456
+ args: {
457
+ filePath: {
458
+ name: 'filePath',
459
+ type: 'string',
460
+ description: 'A path to a .heapsnapshot file to read.',
461
+ required: true,
462
+ },
463
+ nodeId: {
464
+ name: 'nodeId',
465
+ type: 'number',
466
+ description: 'The node ID to get object details for.',
467
+ required: true,
468
+ },
469
+ },
470
+ },
435
471
  get_heapsnapshot_retainers: {
436
472
  description: 'Loads a memory heapsnapshot and returns retainers for a specific node ID. (requires flag: --memoryDebugging=true)',
437
473
  category: 'Memory',
@@ -499,7 +535,7 @@ export const commands = {
499
535
  },
500
536
  },
501
537
  get_heapsnapshot_summary: {
502
- description: 'Loads a memory heapsnapshot and returns snapshot summary stats. (requires flag: --memoryDebugging=true)',
538
+ description: 'Loads a memory heapsnapshot and returns snapshot summary stats, including native contexts and their sizes. (requires flag: --memoryDebugging=true)',
503
539
  category: 'Memory',
504
540
  args: {
505
541
  filePath: {
@@ -659,7 +695,7 @@ export const commands = {
659
695
  args: {},
660
696
  },
661
697
  list_network_requests: {
662
- description: 'List all requests for the currently selected page since the last navigation.',
698
+ description: 'Lists the most recent requests for the currently selected page since the last navigation.',
663
699
  category: 'Network',
664
700
  args: {
665
701
  pageSize: {
@@ -186,7 +186,7 @@ export const cliOptions = {
186
186
  },
187
187
  categoryExperimentalWebmcp: {
188
188
  type: 'boolean',
189
- describe: 'Set to true to enable debugging WebMCP tools. Requires Chrome 149+ with the following flags: `--enable-features=WebMCP,DevToolsWebMCPSupport`',
189
+ describe: 'Set to true to enable debugging WebMCP tools. Requires Chrome 150+ with the following flag: `--enable-features=WebMCP`',
190
190
  },
191
191
  chromeArg: {
192
192
  type: 'array',
@@ -40,7 +40,7 @@ async function shutdown(reason) {
40
40
  setTimeout(() => {
41
41
  logger?.('Shutdown timeout exceeded, forcing exit');
42
42
  process.exit(0);
43
- }, 10000).unref();
43
+ }, 5000).unref();
44
44
  await closeBrowser();
45
45
  process.exit(0);
46
46
  }
@@ -6,8 +6,8 @@
6
6
  */
7
7
  process.title = 'chrome-devtools';
8
8
  import process from 'node:process';
9
- import { startDaemon, stopDaemon, sendCommand, handleResponse, } from '../daemon/client.js';
10
- import { isDaemonRunning, serializeArgs } from '../daemon/utils.js';
9
+ import { startDaemon, stopDaemon, sendCommand, handleResponse, verifyDaemonVersion, } from '../daemon/client.js';
10
+ import { isDaemonRunning, serializeArgs, assertValidSessionId, } from '../daemon/utils.js';
11
11
  import { logDisclaimers } from '../index.js';
12
12
  import { hideBin, yargs } from '../third_party/index.js';
13
13
  import { checkForUpdates } from '../utils/check-for-updates.js';
@@ -51,6 +51,10 @@ const y = yargs(hideBin(process.argv))
51
51
  description: 'Session ID for daemon scoping',
52
52
  default: '',
53
53
  hidden: true,
54
+ coerce: (sessionId) => {
55
+ assertValidSessionId(sessionId);
56
+ return sessionId;
57
+ },
54
58
  })
55
59
  .demandCommand()
56
60
  .version(VERSION)
@@ -108,6 +112,9 @@ y.command('status', 'Checks if chrome-devtools-mcp is running', y => y, async (a
108
112
  const data = JSON.parse(response.result);
109
113
  console.log(`pid=${data.pid} socket=${data.socketPath} start-date=${data.startDate} version=${data.version}`);
110
114
  console.log(`args=${JSON.stringify(data.args)}`);
115
+ if (data.version !== VERSION) {
116
+ console.warn(`Warning: Daemon server version (${data.version}) does not match CLI version (${VERSION}). Run 'chrome-devtools start' to update and restart the daemon.`);
117
+ }
111
118
  }
112
119
  else {
113
120
  console.error('Error:', response.error);
@@ -181,8 +188,11 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
181
188
  }, async (argv) => {
182
189
  const sessionId = argv.sessionId;
183
190
  try {
191
+ const versionWarningPromise = isDaemonRunning(sessionId)
192
+ ? verifyDaemonVersion(sessionId, VERSION)
193
+ : Promise.resolve(undefined);
184
194
  if (!isDaemonRunning(sessionId)) {
185
- await start([], sessionId);
195
+ await start(serializeArgs(cliOptions, argv), sessionId);
186
196
  }
187
197
  const commandArgs = {};
188
198
  for (const argName of Object.keys(args)) {
@@ -200,6 +210,12 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
200
210
  }
201
211
  else {
202
212
  console.error('Error:', response.error);
213
+ }
214
+ const versionWarning = await versionWarningPromise;
215
+ if (versionWarning) {
216
+ console.warn(versionWarning);
217
+ }
218
+ if (!response.success) {
203
219
  process.exit(1);
204
220
  }
205
221
  }
@@ -103,6 +103,10 @@ const SEND_COMMAND_TIMEOUT = 60_000; // ms
103
103
  * `sendCommand` opens a socket connection sends a single command and disconnects.
104
104
  */
105
105
  export async function sendCommand(command, sessionId, timeout = SEND_COMMAND_TIMEOUT) {
106
+ // Before connecting and sending, verify the daemon is still alive.
107
+ if (!isDaemonRunning(sessionId)) {
108
+ throw new Error('Daemon is not running.');
109
+ }
106
110
  const socketPath = getSocketPath(sessionId);
107
111
  const socket = net.createConnection({
108
112
  path: socketPath,
@@ -141,6 +145,24 @@ export async function stopDaemon(sessionId) {
141
145
  await sendCommand({ method: 'stop' }, sessionId);
142
146
  await waitForFile(pidFilePath, /*removed=*/ true);
143
147
  }
148
+ export async function verifyDaemonVersion(sessionId, cliVersion) {
149
+ if (!isDaemonRunning(sessionId)) {
150
+ return undefined;
151
+ }
152
+ try {
153
+ const response = await sendCommand({ method: 'status' }, sessionId);
154
+ if (response.success) {
155
+ const data = JSON.parse(response.result);
156
+ if (data?.version && data.version !== cliVersion) {
157
+ return `Warning: Daemon server version (${data.version}) does not match CLI version (${cliVersion}). Run 'chrome-devtools start' to update and restart the daemon.`;
158
+ }
159
+ }
160
+ }
161
+ catch {
162
+ // Suppress communication failures during check; command execution handles unreachable daemon errors.
163
+ }
164
+ return undefined;
165
+ }
144
166
  export async function handleResponse(response, format) {
145
167
  if (response.isError) {
146
168
  return JSON.stringify(response.content);