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.
- package/README.md +26 -9
- package/build/src/HeapSnapshotManager.js +62 -23
- package/build/src/McpContext.js +64 -23
- package/build/src/McpPage.js +225 -11
- package/build/src/McpResponse.js +188 -280
- package/build/src/PageCollector.js +8 -3
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +19 -8
- package/build/src/WaitForHelper.js +142 -68
- package/build/src/bin/chrome-devtools-cli-options.js +38 -2
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +1 -1
- package/build/src/bin/chrome-devtools-mcp-main.js +1 -1
- package/build/src/bin/chrome-devtools.js +19 -3
- package/build/src/daemon/client.js +22 -0
- package/build/src/daemon/daemon.js +15 -11
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +7 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
- package/build/src/index.js +2 -1
- package/build/src/telemetry/ClearcutLogger.js +3 -0
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +231 -52
- package/build/src/third_party/bundled-packages.json +3 -4
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
- package/build/src/third_party/index.js +28280 -9450
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
- package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
- package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
- package/build/src/tools/input.js +197 -105
- package/build/src/tools/memory.js +35 -4
- package/build/src/tools/network.js +1 -1
- package/build/src/tools/pages.js +1 -0
- package/build/src/tools/performance.js +60 -39
- package/build/src/tools/screenshot.js +152 -77
- package/build/src/tools/script.js +95 -31
- package/build/src/utils/polyfill.js +6 -3
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +20 -16
- package/skills/memory-leak-debugging/SKILL.md +12 -16
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/utils/Mutex.js +0 -38
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- 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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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();
|
package/build/src/ToolHandler.js
CHANGED
|
@@ -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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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(
|
|
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
|
-
#
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
202
|
+
else if (actionToTake === 'accept') {
|
|
203
|
+
void dialog.accept();
|
|
121
204
|
}
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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.#
|
|
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.#
|
|
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: '
|
|
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
|
|
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',
|
|
@@ -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(
|
|
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);
|