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
package/build/src/McpResponse.js
CHANGED
|
@@ -10,143 +10,12 @@ import { NetworkFormatter } from './formatters/NetworkFormatter.js';
|
|
|
10
10
|
import { SnapshotFormatter } from './formatters/SnapshotFormatter.js';
|
|
11
11
|
import { UncaughtError } from './PageCollector.js';
|
|
12
12
|
import { TextSnapshot } from './TextSnapshot.js';
|
|
13
|
-
import { DevTools, getToonEncode, getGcfEncode
|
|
13
|
+
import { DevTools, getToonEncode, getGcfEncode } from './third_party/index.js';
|
|
14
14
|
import { handleDialog, listPages } from './tools/pages.js';
|
|
15
15
|
import { getInsightOutput, getTraceSummary } from './trace-processing/parse.js';
|
|
16
16
|
import { stableIdSymbol } from './utils/id.js';
|
|
17
17
|
import { paginate } from './utils/pagination.js';
|
|
18
|
-
|
|
19
|
-
if (typeof schema === 'boolean') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
let isHtmlElement = false;
|
|
23
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
24
|
-
if (key === 'x-mcp-type' && value === 'HTMLElement') {
|
|
25
|
-
isHtmlElement = true;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (isHtmlElement) {
|
|
30
|
-
schema.properties = { uid: { type: 'string' } };
|
|
31
|
-
schema.required = ['uid'];
|
|
32
|
-
}
|
|
33
|
-
if (schema.properties) {
|
|
34
|
-
for (const key of Object.keys(schema.properties)) {
|
|
35
|
-
replaceHtmlElementsWithUids(schema.properties[key]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (schema.items) {
|
|
39
|
-
if (Array.isArray(schema.items)) {
|
|
40
|
-
for (const item of schema.items) {
|
|
41
|
-
replaceHtmlElementsWithUids(item);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
replaceHtmlElementsWithUids(schema.items);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (schema.anyOf) {
|
|
49
|
-
for (const s of schema.anyOf) {
|
|
50
|
-
replaceHtmlElementsWithUids(s);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (schema.allOf) {
|
|
54
|
-
for (const s of schema.allOf) {
|
|
55
|
-
replaceHtmlElementsWithUids(s);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (schema.oneOf) {
|
|
59
|
-
for (const s of schema.oneOf) {
|
|
60
|
-
replaceHtmlElementsWithUids(s);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function getToolGroups(page) {
|
|
65
|
-
// Check if there is a `devtoolstooldiscovery` event listener
|
|
66
|
-
const windowHandle = await page.pptrPage.evaluateHandle(() => window);
|
|
67
|
-
// @ts-expect-error internal API
|
|
68
|
-
const client = page.pptrPage._client();
|
|
69
|
-
const { listeners } = await client.send('DOMDebugger.getEventListeners', {
|
|
70
|
-
objectId: windowHandle.remoteObject().objectId,
|
|
71
|
-
});
|
|
72
|
-
if (listeners.find(l => l.type === 'devtoolstooldiscovery') === undefined) {
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
const toolGroups = await page.pptrPage.evaluate(() => {
|
|
76
|
-
if (window.__dtmcp) {
|
|
77
|
-
window.__dtmcp.toolGroups = [];
|
|
78
|
-
}
|
|
79
|
-
return new Promise(resolve => {
|
|
80
|
-
const event = new CustomEvent('devtoolstooldiscovery');
|
|
81
|
-
const groups = [];
|
|
82
|
-
// @ts-expect-error Adding custom property
|
|
83
|
-
event.respondWith = toolGroup => {
|
|
84
|
-
if (!window.__dtmcp) {
|
|
85
|
-
window.__dtmcp = {};
|
|
86
|
-
}
|
|
87
|
-
if (!window.__dtmcp.toolGroups) {
|
|
88
|
-
window.__dtmcp.toolGroups = [];
|
|
89
|
-
}
|
|
90
|
-
if (typeof toolGroup.name !== 'string' ||
|
|
91
|
-
(toolGroup.description &&
|
|
92
|
-
typeof toolGroup.description !== 'string') ||
|
|
93
|
-
!Array.isArray(toolGroup.tools)) {
|
|
94
|
-
console.error('Invalid toolGroup:', toolGroup);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
for (const tool of toolGroup.tools) {
|
|
98
|
-
if (typeof tool.name !== 'string' ||
|
|
99
|
-
typeof tool.description !== 'string' ||
|
|
100
|
-
typeof tool.inputSchema !== 'object' ||
|
|
101
|
-
typeof tool.execute !== 'function') {
|
|
102
|
-
console.error('Invalid tool:', tool);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
window.__dtmcp.toolGroups.push(toolGroup);
|
|
107
|
-
// When receiving a toolGroup for the first time, expose a simple execution helper
|
|
108
|
-
if (!window.__dtmcp.executeTool) {
|
|
109
|
-
window.__dtmcp.executeTool = async (toolName, args) => {
|
|
110
|
-
if (!window.__dtmcp?.toolGroups ||
|
|
111
|
-
window.__dtmcp.toolGroups.length === 0) {
|
|
112
|
-
throw new Error('No tools found on the page');
|
|
113
|
-
}
|
|
114
|
-
for (const group of window.__dtmcp.toolGroups) {
|
|
115
|
-
const tool = group.tools?.find(t => t.name === toolName);
|
|
116
|
-
if (tool) {
|
|
117
|
-
return await tool.execute(args);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
throw new Error(`Tool ${toolName} not found`);
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
groups.push(toolGroup);
|
|
124
|
-
};
|
|
125
|
-
window.dispatchEvent(event);
|
|
126
|
-
// If at least one toolGroup was added synchronously, resolve with the array.
|
|
127
|
-
// Otherwise, use setTimeout to allow for any microtask/asynchronous respondWith calls, or resolve with an empty array.
|
|
128
|
-
if (groups.length > 0) {
|
|
129
|
-
resolve(groups);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
if (groups.length > 0) {
|
|
134
|
-
resolve(groups);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
resolve([]);
|
|
138
|
-
}
|
|
139
|
-
}, 0);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
for (const group of toolGroups) {
|
|
144
|
-
for (const tool of group.tools ?? []) {
|
|
145
|
-
replaceHtmlElementsWithUids(tool.inputSchema);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return toolGroups;
|
|
149
|
-
}
|
|
18
|
+
const { formatBytesToKb } = DevTools.I18n.ByteUtilities;
|
|
150
19
|
export class McpResponse {
|
|
151
20
|
#includePages = false;
|
|
152
21
|
#includeExtensionServiceWorkers = false;
|
|
@@ -326,12 +195,13 @@ export class McpResponse {
|
|
|
326
195
|
pagination: options,
|
|
327
196
|
};
|
|
328
197
|
}
|
|
329
|
-
setHeapSnapshotStats(stats, staticData) {
|
|
198
|
+
setHeapSnapshotStats(stats, staticData, nativeContextSizes) {
|
|
330
199
|
this.#heapSnapshotOptions = {
|
|
331
200
|
...this.#heapSnapshotOptions,
|
|
332
201
|
include: true,
|
|
333
202
|
stats,
|
|
334
203
|
staticData,
|
|
204
|
+
nativeContextSizes,
|
|
335
205
|
};
|
|
336
206
|
}
|
|
337
207
|
setHeapSnapshotNodes(nodes, options) {
|
|
@@ -378,6 +248,13 @@ export class McpResponse {
|
|
|
378
248
|
detailedClassDiff,
|
|
379
249
|
};
|
|
380
250
|
}
|
|
251
|
+
setHeapSnapshotObjectDetails(objectInfo) {
|
|
252
|
+
this.#heapSnapshotOptions = {
|
|
253
|
+
...this.#heapSnapshotOptions,
|
|
254
|
+
include: true,
|
|
255
|
+
objectInfo,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
381
258
|
attachImage(value) {
|
|
382
259
|
this.#images.push(value);
|
|
383
260
|
}
|
|
@@ -393,172 +270,188 @@ export class McpResponse {
|
|
|
393
270
|
get listWebMcpTools() {
|
|
394
271
|
return this.#listWebMcpTools;
|
|
395
272
|
}
|
|
396
|
-
async
|
|
273
|
+
async #handleSnapshot(context) {
|
|
397
274
|
if (this.#includePages) {
|
|
398
275
|
await context.createPagesSnapshot();
|
|
399
276
|
}
|
|
400
|
-
if (this.#
|
|
401
|
-
|
|
277
|
+
if (!this.#snapshotParams) {
|
|
278
|
+
return undefined;
|
|
402
279
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (!this.#page) {
|
|
406
|
-
throw new Error('Response must have a page');
|
|
407
|
-
}
|
|
408
|
-
this.#page.textSnapshot = await TextSnapshot.create(this.#page, {
|
|
409
|
-
verbose: this.#snapshotParams.verbose,
|
|
410
|
-
devtoolsData: this.#devToolsData,
|
|
411
|
-
});
|
|
412
|
-
const textSnapshot = this.#page.textSnapshot;
|
|
413
|
-
if (textSnapshot) {
|
|
414
|
-
const formatter = new SnapshotFormatter(textSnapshot);
|
|
415
|
-
if (this.#snapshotParams.filePath) {
|
|
416
|
-
const result = await context.saveFile(new TextEncoder().encode(formatter.toString()), this.#snapshotParams.filePath, '.txt');
|
|
417
|
-
snapshot = result.filename;
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
snapshot = formatter;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
280
|
+
if (!this.#page) {
|
|
281
|
+
throw new Error('Response must have a page');
|
|
423
282
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
283
|
+
this.#page.textSnapshot = await TextSnapshot.create(this.#page, {
|
|
284
|
+
verbose: this.#snapshotParams.verbose,
|
|
285
|
+
devtoolsData: this.#devToolsData,
|
|
286
|
+
});
|
|
287
|
+
const formatter = new SnapshotFormatter(this.#page.textSnapshot);
|
|
288
|
+
if (this.#snapshotParams.filePath) {
|
|
289
|
+
const result = await context.saveFile(new TextEncoder().encode(formatter.toString()), this.#snapshotParams.filePath, '.txt');
|
|
290
|
+
return result.filename;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
return formatter;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async #handleAttachedNetworkRequest(context) {
|
|
297
|
+
if (!this.#attachedNetworkRequestId) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
if (!this.#page) {
|
|
301
|
+
throw new Error(`Response must have an McpPage`);
|
|
302
|
+
}
|
|
303
|
+
const request = this.#page.getNetworkRequestById(this.#attachedNetworkRequestId);
|
|
304
|
+
return await NetworkFormatter.from(request, {
|
|
305
|
+
requestId: this.#attachedNetworkRequestId,
|
|
306
|
+
requestIdResolver: req => this.getNetworkRequestStableId(req),
|
|
307
|
+
fetchData: true,
|
|
308
|
+
requestFilePath: this.#attachedNetworkRequestOptions?.requestFilePath,
|
|
309
|
+
responseFilePath: this.#attachedNetworkRequestOptions?.responseFilePath,
|
|
310
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
311
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async #handleAttachedConsoleMessage() {
|
|
315
|
+
if (!this.#attachedConsoleMessageId) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
if (!this.#page) {
|
|
319
|
+
throw new Error(`Response must have an McpPage`);
|
|
320
|
+
}
|
|
321
|
+
const message = this.#page.getConsoleMessageById(this.#attachedConsoleMessageId);
|
|
322
|
+
const consoleMessageStableId = this.#attachedConsoleMessageId;
|
|
323
|
+
if ('args' in message || message instanceof UncaughtError) {
|
|
324
|
+
const consoleMessage = message;
|
|
325
|
+
return await ConsoleFormatter.from(consoleMessage, {
|
|
326
|
+
id: consoleMessageStableId,
|
|
327
|
+
fetchDetailedData: true,
|
|
328
|
+
devTools: this.#page.devtoolsUniverse,
|
|
438
329
|
});
|
|
439
|
-
detailedNetworkRequest = formatter;
|
|
440
330
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const consoleMessage = message;
|
|
450
|
-
const devTools = this.#page.devtoolsUniverse;
|
|
451
|
-
detailedConsoleMessage = await ConsoleFormatter.from(consoleMessage, {
|
|
452
|
-
id: consoleMessageStableId,
|
|
453
|
-
fetchDetailedData: true,
|
|
454
|
-
devTools: devTools ?? undefined,
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
else if (message instanceof DevTools.AggregatedIssue) {
|
|
458
|
-
const formatter = new IssueFormatter(message, {
|
|
459
|
-
id: consoleMessageStableId,
|
|
460
|
-
requestIdResolver: this.#page.resolveCdpRequestId.bind(this.#page),
|
|
461
|
-
elementIdResolver: this.#page.textSnapshot?.resolveCdpElementId.bind(this.#page.textSnapshot),
|
|
462
|
-
});
|
|
463
|
-
if (!formatter.isValid()) {
|
|
464
|
-
throw new Error("Can't provide details for the msgid " + consoleMessageStableId);
|
|
465
|
-
}
|
|
466
|
-
detailedConsoleMessage = formatter;
|
|
331
|
+
else if (message instanceof DevTools.AggregatedIssue) {
|
|
332
|
+
const formatter = new IssueFormatter(message, {
|
|
333
|
+
id: consoleMessageStableId,
|
|
334
|
+
requestIdResolver: this.#page.resolveCdpRequestId.bind(this.#page),
|
|
335
|
+
elementIdResolver: this.#page.textSnapshot?.resolveCdpElementId.bind(this.#page.textSnapshot),
|
|
336
|
+
});
|
|
337
|
+
if (!formatter.isValid()) {
|
|
338
|
+
throw new Error("Can't provide details for the msgid " + consoleMessageStableId);
|
|
467
339
|
}
|
|
340
|
+
return formatter;
|
|
468
341
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
extensions = await context.listExtensions();
|
|
342
|
+
else {
|
|
343
|
+
return undefined;
|
|
472
344
|
}
|
|
473
|
-
|
|
345
|
+
}
|
|
346
|
+
async #handleThirdPartyDevelopeTools() {
|
|
474
347
|
if (this.#args.categoryExperimentalThirdParty &&
|
|
475
348
|
this.#listThirdPartyDeveloperTools &&
|
|
476
349
|
this.#page) {
|
|
477
|
-
|
|
478
|
-
if (thirdPartyDeveloperTools) {
|
|
479
|
-
this.#page.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
|
|
480
|
-
}
|
|
350
|
+
return await this.#page.getToolGroups();
|
|
481
351
|
}
|
|
482
|
-
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
async #handleWebMCP() {
|
|
483
355
|
if (this.#args.categoryExperimentalWebmcp &&
|
|
484
356
|
this.#listWebMcpTools &&
|
|
485
357
|
this.#page) {
|
|
486
|
-
|
|
358
|
+
return this.#page.getWebMcpTools();
|
|
487
359
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
504
|
-
messages = messages.filter(message => {
|
|
505
|
-
if ('type' in message) {
|
|
506
|
-
return normalizedTypes.has(message.type());
|
|
507
|
-
}
|
|
508
|
-
if (message instanceof DevTools.AggregatedIssue) {
|
|
509
|
-
return normalizedTypes.has('issue');
|
|
510
|
-
}
|
|
511
|
-
return normalizedTypes.has('error');
|
|
512
|
-
});
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
async #handleConsoleList(context) {
|
|
363
|
+
if (!this.#consoleDataOptions?.include) {
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
let messages;
|
|
367
|
+
let page;
|
|
368
|
+
if (this.#consoleDataOptions.serviceWorkerId) {
|
|
369
|
+
messages = context.getServiceWorkerConsoleData(this.#consoleDataOptions.serviceWorkerId);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
page = this.#page;
|
|
373
|
+
if (!page) {
|
|
374
|
+
throw new Error(`Response must have an McpPage`);
|
|
513
375
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
devTools: page ? page.devtoolsUniverse : undefined,
|
|
522
|
-
});
|
|
376
|
+
messages = page.getConsoleData(this.#consoleDataOptions.includePreservedMessages);
|
|
377
|
+
}
|
|
378
|
+
if (this.#consoleDataOptions.types?.length) {
|
|
379
|
+
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
380
|
+
messages = messages.filter(message => {
|
|
381
|
+
if ('type' in message) {
|
|
382
|
+
return normalizedTypes.has(message.type());
|
|
523
383
|
}
|
|
524
|
-
if (
|
|
525
|
-
|
|
526
|
-
id: consoleMessageStableId,
|
|
527
|
-
});
|
|
528
|
-
if (!formatter.isValid()) {
|
|
529
|
-
return null;
|
|
530
|
-
}
|
|
531
|
-
return formatter;
|
|
384
|
+
if (message instanceof DevTools.AggregatedIssue) {
|
|
385
|
+
return normalizedTypes.has('issue');
|
|
532
386
|
}
|
|
533
|
-
return
|
|
534
|
-
})
|
|
387
|
+
return normalizedTypes.has('error');
|
|
388
|
+
});
|
|
535
389
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
545
|
-
requests = requests.filter(request => {
|
|
546
|
-
const type = request.resourceType();
|
|
547
|
-
return normalizedTypes.has(type);
|
|
390
|
+
return (await Promise.all(messages.map(async (item) => {
|
|
391
|
+
const consoleMessageStableId = this.getConsoleMessageStableId(item);
|
|
392
|
+
if ('args' in item || item instanceof UncaughtError) {
|
|
393
|
+
const consoleMessage = item;
|
|
394
|
+
return await ConsoleFormatter.from(consoleMessage, {
|
|
395
|
+
id: consoleMessageStableId,
|
|
396
|
+
fetchDetailedData: false,
|
|
397
|
+
devTools: page ? page.devtoolsUniverse : undefined,
|
|
548
398
|
});
|
|
549
399
|
}
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
})));
|
|
400
|
+
if (item instanceof DevTools.AggregatedIssue) {
|
|
401
|
+
const formatter = new IssueFormatter(item, {
|
|
402
|
+
id: consoleMessageStableId,
|
|
403
|
+
});
|
|
404
|
+
if (!formatter.isValid()) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
return formatter;
|
|
559
408
|
}
|
|
409
|
+
return null;
|
|
410
|
+
}))).filter(item => item !== null);
|
|
411
|
+
}
|
|
412
|
+
async #handleNetworkRequestList(context) {
|
|
413
|
+
if (!this.#networkRequestsOptions?.include) {
|
|
414
|
+
return undefined;
|
|
560
415
|
}
|
|
561
|
-
|
|
416
|
+
if (!this.#page) {
|
|
417
|
+
throw new Error(`Response must have an McpPage`);
|
|
418
|
+
}
|
|
419
|
+
let requests = this.#page.getNetworkRequests(this.#networkRequestsOptions?.includePreservedRequests);
|
|
420
|
+
// Apply resource type filtering if specified
|
|
421
|
+
if (this.#networkRequestsOptions.resourceTypes?.length) {
|
|
422
|
+
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
423
|
+
requests = requests.filter(request => {
|
|
424
|
+
const type = request.resourceType();
|
|
425
|
+
return normalizedTypes.has(type);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return await Promise.all(requests.map(request => NetworkFormatter.from(request, {
|
|
429
|
+
requestId: this.getNetworkRequestStableId(request),
|
|
430
|
+
selectedInDevToolsUI: this.getNetworkRequestStableId(request) ===
|
|
431
|
+
this.#networkRequestsOptions?.networkRequestIdInDevToolsUI,
|
|
432
|
+
fetchData: false,
|
|
433
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
434
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
435
|
+
})));
|
|
436
|
+
}
|
|
437
|
+
async handle(context, dataFormat = 'default') {
|
|
438
|
+
const [snapshot, detailedNetworkRequest, detailedConsoleMessage, thirdPartyDeveloperTools, webmcpTools, consoleMessages, networkRequests,] = await Promise.all([
|
|
439
|
+
this.#handleSnapshot(context),
|
|
440
|
+
this.#handleAttachedNetworkRequest(context),
|
|
441
|
+
this.#handleAttachedConsoleMessage(),
|
|
442
|
+
this.#handleThirdPartyDevelopeTools(),
|
|
443
|
+
this.#handleWebMCP(),
|
|
444
|
+
this.#handleConsoleList(context),
|
|
445
|
+
this.#handleNetworkRequestList(context),
|
|
446
|
+
]);
|
|
447
|
+
if (this.#includeExtensionServiceWorkers) {
|
|
448
|
+
await context.createExtensionServiceWorkersSnapshot();
|
|
449
|
+
}
|
|
450
|
+
let extensions;
|
|
451
|
+
if (this.#listExtensions) {
|
|
452
|
+
extensions = await context.listExtensions();
|
|
453
|
+
}
|
|
454
|
+
return this.format(context, {
|
|
562
455
|
detailedConsoleMessage,
|
|
563
456
|
consoleMessages,
|
|
564
457
|
snapshot,
|
|
@@ -579,7 +472,7 @@ export class McpResponse {
|
|
|
579
472
|
getNetworkRequestStableId(request) {
|
|
580
473
|
return request[stableIdSymbol] ?? -1;
|
|
581
474
|
}
|
|
582
|
-
async format(
|
|
475
|
+
async format(context, data, dataFormat = 'default') {
|
|
583
476
|
const structuredContent = {};
|
|
584
477
|
// Resolve the compact encoder based on the chosen format
|
|
585
478
|
let compactEncode;
|
|
@@ -817,12 +710,19 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
817
710
|
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
818
711
|
structuredContent.heapSnapshot.staticData = staticData;
|
|
819
712
|
}
|
|
713
|
+
const nativeContextSizes = this.#heapSnapshotOptions.nativeContextSizes;
|
|
714
|
+
if (nativeContextSizes) {
|
|
715
|
+
response.push('### Native Contexts');
|
|
716
|
+
response.push(HeapSnapshotFormatter.formatNativeContextSizes(nativeContextSizes));
|
|
717
|
+
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
718
|
+
structuredContent.heapSnapshot.nativeContextSizes = nativeContextSizes;
|
|
719
|
+
}
|
|
820
720
|
const aggregateData = this.#heapSnapshotOptions.aggregateData;
|
|
821
721
|
if (aggregateData) {
|
|
822
722
|
const sortedEntries = HeapSnapshotFormatter.sort(aggregateData.aggregates);
|
|
823
723
|
const paginationData = this.#dataWithPagination(sortedEntries, this.#heapSnapshotOptions.pagination);
|
|
824
724
|
response.push(`Objects: ${aggregateData.objectCount}`);
|
|
825
|
-
response.push(`Total shallow size: ${
|
|
725
|
+
response.push(`Total shallow size: ${formatBytesToKb(aggregateData.totalSelfSize)}`);
|
|
826
726
|
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
827
727
|
structuredContent.heapSnapshot.aggregateStats = {
|
|
828
728
|
objectCount: aggregateData.objectCount,
|
|
@@ -913,6 +813,14 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
913
813
|
response.push(formatted);
|
|
914
814
|
structuredContent.heapSnapshotDuplicateStrings = paginationData.items;
|
|
915
815
|
}
|
|
816
|
+
const objectInfo = this.#heapSnapshotOptions.objectInfo;
|
|
817
|
+
if (objectInfo) {
|
|
818
|
+
response.push('### Object Details');
|
|
819
|
+
response.push(compactEncode
|
|
820
|
+
? compactEncode(objectInfo)
|
|
821
|
+
: HeapSnapshotFormatter.formatObjectInfo(objectInfo));
|
|
822
|
+
structuredContent.heapSnapshotObjectDetails = objectInfo;
|
|
823
|
+
}
|
|
916
824
|
}
|
|
917
825
|
if (data.detailedNetworkRequest) {
|
|
918
826
|
response.push(data.detailedNetworkRequest.toStringDetailed());
|
|
@@ -940,11 +848,11 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
940
848
|
response.push(extensionsMessage);
|
|
941
849
|
}
|
|
942
850
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
851
|
+
const thirdPartyDeveloperTools = data.thirdPartyDeveloperTools;
|
|
852
|
+
if (thirdPartyDeveloperTools?.length) {
|
|
853
|
+
structuredContent.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
|
|
946
854
|
response.push('## Third-party developer tools');
|
|
947
|
-
for (const toolGroup of
|
|
855
|
+
for (const toolGroup of thirdPartyDeveloperTools) {
|
|
948
856
|
response.push(`${toolGroup.name}: ${toolGroup.description}`);
|
|
949
857
|
response.push('Available tools:');
|
|
950
858
|
const toolDefinitionsMessage = toolGroup.tools
|
|
@@ -25,13 +25,17 @@ export class PageCollector {
|
|
|
25
25
|
* The newer navigations come first.
|
|
26
26
|
*/
|
|
27
27
|
storage = [[]];
|
|
28
|
-
constructor(page, listeners) {
|
|
28
|
+
constructor(page, listeners, maxResourcesPerNavigation) {
|
|
29
29
|
this.pptrPage = page;
|
|
30
30
|
const idGenerator = createIdGenerator();
|
|
31
31
|
const listenerMap = listeners(value => {
|
|
32
32
|
const withId = value;
|
|
33
33
|
withId[stableIdSymbol] = idGenerator();
|
|
34
34
|
this.storage[0].push(withId);
|
|
35
|
+
if (maxResourcesPerNavigation !== undefined &&
|
|
36
|
+
this.storage[0].length > maxResourcesPerNavigation) {
|
|
37
|
+
this.storage[0].splice(0, this.storage[0].length - maxResourcesPerNavigation);
|
|
38
|
+
}
|
|
35
39
|
});
|
|
36
40
|
listenerMap['framenavigated'] = (frame) => {
|
|
37
41
|
// Only split the storage on main frame navigation
|
|
@@ -191,14 +195,15 @@ class PageEventSubscriber {
|
|
|
191
195
|
};
|
|
192
196
|
}
|
|
193
197
|
export class NetworkCollector extends PageCollector {
|
|
194
|
-
|
|
198
|
+
static MAX_REQUESTS_PER_NAVIGATION = 1_000;
|
|
199
|
+
constructor(page, maxRequestsPerNavigation = NetworkCollector.MAX_REQUESTS_PER_NAVIGATION, listeners = collect => {
|
|
195
200
|
return {
|
|
196
201
|
request: req => {
|
|
197
202
|
collect(req);
|
|
198
203
|
},
|
|
199
204
|
};
|
|
200
205
|
}) {
|
|
201
|
-
super(page, listeners);
|
|
206
|
+
super(page, listeners, maxRequestsPerNavigation);
|
|
202
207
|
}
|
|
203
208
|
splitAfterNavigation() {
|
|
204
209
|
const requests = this.storage[0];
|