chrome-devtools-mcp 1.5.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 +41 -9
- package/build/src/HeapSnapshotManager.js +77 -28
- package/build/src/McpContext.js +233 -383
- package/build/src/McpPage.js +466 -41
- package/build/src/McpResponse.js +285 -331
- package/build/src/PageCollector.js +53 -122
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +100 -21
- package/build/src/ToolHandler.js +31 -10
- package/build/src/WaitForHelper.js +140 -56
- package/build/src/bin/chrome-devtools-cli-options.js +63 -3
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +16 -7
- package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
- package/build/src/bin/chrome-devtools.js +19 -3
- package/build/src/browser.js +1 -1
- package/build/src/daemon/client.js +55 -3
- package/build/src/daemon/daemon.js +17 -12
- package/build/src/daemon/utils.js +19 -4
- package/build/src/devtools/DevtoolsUtils.js +9 -65
- package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +2 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
- package/build/src/formatters/IssueFormatter.js +2 -2
- package/build/src/index.js +13 -3
- package/build/src/telemetry/ClearcutLogger.js +4 -1
- package/build/src/telemetry/WatchdogClient.js +1 -1
- package/build/src/telemetry/metricsRegistry.js +2 -9
- package/build/src/telemetry/persistence.js +1 -1
- package/build/src/telemetry/transformation.js +50 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
- package/build/src/telemetry/watchdog/main.js +1 -1
- package/build/src/third_party/THIRD_PARTY_NOTICES +230 -287
- package/build/src/third_party/bundled-packages.json +4 -6
- 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 +30171 -11328
- 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 +3177 -6340
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +1 -1
- package/build/src/tools/input.js +213 -112
- package/build/src/tools/lighthouse.js +1 -1
- package/build/src/tools/memory.js +49 -4
- package/build/src/tools/network.js +5 -5
- package/build/src/tools/pages.js +22 -89
- package/build/src/tools/performance.js +62 -41
- package/build/src/tools/screenshot.js +152 -77
- package/build/src/tools/script.js +95 -28
- package/build/src/tools/snapshot.js +2 -2
- package/build/src/tools/thirdPartyDeveloper.js +1 -1
- package/build/src/tools/webmcp.js +1 -1
- package/build/src/trace-processing/parse.js +1 -1
- package/build/src/{logger.js → utils/logger.js} +1 -1
- package/build/src/utils/polyfill.js +11 -0
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +23 -15
- package/skills/memory-leak-debugging/SKILL.md +23 -19
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/build/src/Mutex.js +0 -38
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- package/build/src/polyfill.js +0 -8
- 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/types.js +0 -7
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- package/skills/memory-leak-debugging/references/memlab.md +0 -29
|
@@ -3,7 +3,59 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
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
|
+
});
|
|
58
|
+
import { logger } from './utils/logger.js';
|
|
7
59
|
export class WaitForHelper {
|
|
8
60
|
#abortController = new AbortController();
|
|
9
61
|
#page;
|
|
@@ -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,24 +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
|
-
|
|
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') {
|
|
117
200
|
void dialog.dismiss();
|
|
118
201
|
}
|
|
119
|
-
else if (
|
|
202
|
+
else if (actionToTake === 'accept') {
|
|
120
203
|
void dialog.accept();
|
|
121
204
|
}
|
|
122
205
|
else {
|
|
123
|
-
void dialog.accept(
|
|
206
|
+
void dialog.accept(actionToTake);
|
|
124
207
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
this.#page.on('dialog', dialogHandler);
|
|
211
|
+
this.#abortController.signal.addEventListener('abort', () => {
|
|
212
|
+
this.#page.off('dialog', dialogHandler);
|
|
213
|
+
});
|
|
131
214
|
const navigationFinished = this.waitForNavigationStarted()
|
|
132
215
|
.then(navigationStated => {
|
|
133
216
|
if (navigationStated) {
|
|
@@ -149,7 +232,7 @@ export class WaitForHelper {
|
|
|
149
232
|
}
|
|
150
233
|
try {
|
|
151
234
|
await navigationFinished;
|
|
152
|
-
if (this.#
|
|
235
|
+
if (this.#dialogDetected) {
|
|
153
236
|
return this.#getResult();
|
|
154
237
|
}
|
|
155
238
|
// Wait for stable dom after navigation so we execute in
|
|
@@ -170,6 +253,7 @@ export class WaitForHelper {
|
|
|
170
253
|
...(urlAfterAction !== this.#initialUrl
|
|
171
254
|
? { navigatedToUrl: urlAfterAction }
|
|
172
255
|
: {}),
|
|
256
|
+
dialogHandled: this.#dialogHandled,
|
|
173
257
|
};
|
|
174
258
|
}
|
|
175
259
|
}
|
|
@@ -298,6 +298,27 @@ export const commands = {
|
|
|
298
298
|
description: 'The ID for the class, obtained from details.',
|
|
299
299
|
required: true,
|
|
300
300
|
},
|
|
301
|
+
filterName: {
|
|
302
|
+
name: 'filterName',
|
|
303
|
+
type: 'string',
|
|
304
|
+
description: 'An optional filter to apply to the nodes.',
|
|
305
|
+
required: false,
|
|
306
|
+
enum: [
|
|
307
|
+
'objectsRetainedByDetachedDomNodes',
|
|
308
|
+
'objectsRetainedByConsole',
|
|
309
|
+
'objectsRetainedByEventHandlers',
|
|
310
|
+
'objectsRetainedByContexts',
|
|
311
|
+
'sharedNativeContext',
|
|
312
|
+
'noNativeContext',
|
|
313
|
+
'attributedToSpecificNativeContext',
|
|
314
|
+
],
|
|
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
|
+
},
|
|
301
322
|
pageIdx: {
|
|
302
323
|
name: 'pageIdx',
|
|
303
324
|
type: 'number',
|
|
@@ -322,6 +343,27 @@ export const commands = {
|
|
|
322
343
|
description: 'A path to a .heapsnapshot file to read.',
|
|
323
344
|
required: true,
|
|
324
345
|
},
|
|
346
|
+
filterName: {
|
|
347
|
+
name: 'filterName',
|
|
348
|
+
type: 'string',
|
|
349
|
+
description: 'An optional filter to apply to the aggregates.',
|
|
350
|
+
required: false,
|
|
351
|
+
enum: [
|
|
352
|
+
'objectsRetainedByDetachedDomNodes',
|
|
353
|
+
'objectsRetainedByConsole',
|
|
354
|
+
'objectsRetainedByEventHandlers',
|
|
355
|
+
'objectsRetainedByContexts',
|
|
356
|
+
'sharedNativeContext',
|
|
357
|
+
'noNativeContext',
|
|
358
|
+
'attributedToSpecificNativeContext',
|
|
359
|
+
],
|
|
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
|
+
},
|
|
325
367
|
pageIdx: {
|
|
326
368
|
name: 'pageIdx',
|
|
327
369
|
type: 'number',
|
|
@@ -408,6 +450,24 @@ export const commands = {
|
|
|
408
450
|
},
|
|
409
451
|
},
|
|
410
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
|
+
},
|
|
411
471
|
get_heapsnapshot_retainers: {
|
|
412
472
|
description: 'Loads a memory heapsnapshot and returns retainers for a specific node ID. (requires flag: --memoryDebugging=true)',
|
|
413
473
|
category: 'Memory',
|
|
@@ -475,7 +535,7 @@ export const commands = {
|
|
|
475
535
|
},
|
|
476
536
|
},
|
|
477
537
|
get_heapsnapshot_summary: {
|
|
478
|
-
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)',
|
|
479
539
|
category: 'Memory',
|
|
480
540
|
args: {
|
|
481
541
|
filePath: {
|
|
@@ -635,7 +695,7 @@ export const commands = {
|
|
|
635
695
|
args: {},
|
|
636
696
|
},
|
|
637
697
|
list_network_requests: {
|
|
638
|
-
description: '
|
|
698
|
+
description: 'Lists the most recent requests for the currently selected page since the last navigation.',
|
|
639
699
|
category: 'Network',
|
|
640
700
|
args: {
|
|
641
701
|
pageSize: {
|
|
@@ -703,7 +763,7 @@ export const commands = {
|
|
|
703
763
|
type: 'string',
|
|
704
764
|
description: 'Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.',
|
|
705
765
|
required: false,
|
|
706
|
-
enum: ['accept', '
|
|
766
|
+
enum: ['accept', 'dismiss'],
|
|
707
767
|
},
|
|
708
768
|
initScript: {
|
|
709
769
|
name: 'initScript',
|
|
@@ -157,18 +157,19 @@ export const cliOptions = {
|
|
|
157
157
|
},
|
|
158
158
|
experimentalToonFormat: {
|
|
159
159
|
type: 'boolean',
|
|
160
|
-
describe: 'Whether to format structured data
|
|
160
|
+
describe: 'Deprecated: use --experimentalDataFormat=toon instead. Whether to format structured data using TOON (requires @toon-format/toon).',
|
|
161
|
+
hidden: true,
|
|
162
|
+
},
|
|
163
|
+
experimentalDataFormat: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
describe: 'Override format for structured data in text responses. Default uses built-in formatters. "toon" (requires @toon-format/toon) or "gcf" (requires @blackwell-systems/gcf) replace structured content with the specified encoding.',
|
|
166
|
+
choices: ['default', 'toon', 'gcf'],
|
|
161
167
|
hidden: true,
|
|
162
168
|
},
|
|
163
169
|
experimentalIncludeAllPages: {
|
|
164
170
|
type: 'boolean',
|
|
165
171
|
describe: 'Whether to include all kinds of pages such as webviews or background pages as pages.',
|
|
166
172
|
},
|
|
167
|
-
experimentalNavigationAllowlist: {
|
|
168
|
-
type: 'boolean',
|
|
169
|
-
describe: 'Whether to enable navigation allowlist tool parameter.',
|
|
170
|
-
hidden: true,
|
|
171
|
-
},
|
|
172
173
|
experimentalInteropTools: {
|
|
173
174
|
type: 'boolean',
|
|
174
175
|
describe: 'Whether to enable interoperability tools',
|
|
@@ -185,7 +186,7 @@ export const cliOptions = {
|
|
|
185
186
|
},
|
|
186
187
|
categoryExperimentalWebmcp: {
|
|
187
188
|
type: 'boolean',
|
|
188
|
-
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`',
|
|
189
190
|
},
|
|
190
191
|
chromeArg: {
|
|
191
192
|
type: 'array',
|
|
@@ -314,6 +315,14 @@ export const cliOptions = {
|
|
|
314
315
|
describe: 'If true, redacts some of the network headers considered sensitive before returning to the client.',
|
|
315
316
|
default: false,
|
|
316
317
|
},
|
|
318
|
+
allowUnrestrictedPaths: {
|
|
319
|
+
type: 'boolean',
|
|
320
|
+
default: false,
|
|
321
|
+
describe: 'If set, disables the default path restriction that applies when the MCP client does not negotiate ' +
|
|
322
|
+
'the roots capability. By default, file-writing tools are restricted to the OS temp directory when ' +
|
|
323
|
+
'no roots are configured. Use this only when connecting a trusted local client that does not implement ' +
|
|
324
|
+
'MCP roots and requires access to paths outside the temp directory.',
|
|
325
|
+
},
|
|
317
326
|
};
|
|
318
327
|
export function parseArguments(version, argv = process.argv, env = process.env) {
|
|
319
328
|
const yargsInstance = yargs(hideBin(argv))
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import '../polyfill.js';
|
|
6
|
+
import '../utils/polyfill.js';
|
|
7
7
|
import process from 'node:process';
|
|
8
8
|
import { closeBrowser } from '../browser.js';
|
|
9
9
|
import { createMcpServer, logDisclaimers } from '../index.js';
|
|
10
|
-
import { logger, saveLogsToFile } from '../logger.js';
|
|
11
10
|
import { ClearcutLogger } from '../telemetry/ClearcutLogger.js';
|
|
12
11
|
import { computeFlagUsage } from '../telemetry/flagUtils.js';
|
|
13
12
|
import { StdioServerTransport } from '../third_party/index.js';
|
|
14
13
|
import { checkForUpdates } from '../utils/check-for-updates.js';
|
|
14
|
+
import { logger, saveLogsToFile } from '../utils/logger.js';
|
|
15
15
|
import { VERSION } from '../version.js';
|
|
16
16
|
import { cliOptions, parseArguments } from './chrome-devtools-mcp-cli-options.js';
|
|
17
17
|
await checkForUpdates('Run `npm install chrome-devtools-mcp@latest` to update.');
|
|
@@ -40,7 +40,7 @@ async function shutdown(reason) {
|
|
|
40
40
|
setTimeout(() => {
|
|
41
41
|
logger?.('Shutdown timeout exceeded, forcing exit');
|
|
42
42
|
process.exit(0);
|
|
43
|
-
},
|
|
43
|
+
}, 5000).unref();
|
|
44
44
|
await closeBrowser();
|
|
45
45
|
process.exit(0);
|
|
46
46
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
process.title = 'chrome-devtools';
|
|
8
8
|
import process from 'node:process';
|
|
9
|
-
import { startDaemon, stopDaemon, sendCommand, handleResponse, } from '../daemon/client.js';
|
|
10
|
-
import { isDaemonRunning, serializeArgs } from '../daemon/utils.js';
|
|
9
|
+
import { startDaemon, stopDaemon, sendCommand, handleResponse, verifyDaemonVersion, } from '../daemon/client.js';
|
|
10
|
+
import { isDaemonRunning, serializeArgs, assertValidSessionId, } from '../daemon/utils.js';
|
|
11
11
|
import { logDisclaimers } from '../index.js';
|
|
12
12
|
import { hideBin, yargs } from '../third_party/index.js';
|
|
13
13
|
import { checkForUpdates } from '../utils/check-for-updates.js';
|
|
@@ -51,6 +51,10 @@ const y = yargs(hideBin(process.argv))
|
|
|
51
51
|
description: 'Session ID for daemon scoping',
|
|
52
52
|
default: '',
|
|
53
53
|
hidden: true,
|
|
54
|
+
coerce: (sessionId) => {
|
|
55
|
+
assertValidSessionId(sessionId);
|
|
56
|
+
return sessionId;
|
|
57
|
+
},
|
|
54
58
|
})
|
|
55
59
|
.demandCommand()
|
|
56
60
|
.version(VERSION)
|
|
@@ -108,6 +112,9 @@ y.command('status', 'Checks if chrome-devtools-mcp is running', y => y, async (a
|
|
|
108
112
|
const data = JSON.parse(response.result);
|
|
109
113
|
console.log(`pid=${data.pid} socket=${data.socketPath} start-date=${data.startDate} version=${data.version}`);
|
|
110
114
|
console.log(`args=${JSON.stringify(data.args)}`);
|
|
115
|
+
if (data.version !== VERSION) {
|
|
116
|
+
console.warn(`Warning: Daemon server version (${data.version}) does not match CLI version (${VERSION}). Run 'chrome-devtools start' to update and restart the daemon.`);
|
|
117
|
+
}
|
|
111
118
|
}
|
|
112
119
|
else {
|
|
113
120
|
console.error('Error:', response.error);
|
|
@@ -181,8 +188,11 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
|
|
|
181
188
|
}, async (argv) => {
|
|
182
189
|
const sessionId = argv.sessionId;
|
|
183
190
|
try {
|
|
191
|
+
const versionWarningPromise = isDaemonRunning(sessionId)
|
|
192
|
+
? verifyDaemonVersion(sessionId, VERSION)
|
|
193
|
+
: Promise.resolve(undefined);
|
|
184
194
|
if (!isDaemonRunning(sessionId)) {
|
|
185
|
-
await start(
|
|
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
|
}
|
package/build/src/browser.js
CHANGED
|
@@ -7,8 +7,8 @@ import { execSync } from 'node:child_process';
|
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import os from 'node:os';
|
|
9
9
|
import path from 'node:path';
|
|
10
|
-
import { logger } from './logger.js';
|
|
11
10
|
import { puppeteer } from './third_party/index.js';
|
|
11
|
+
import { logger } from './utils/logger.js';
|
|
12
12
|
let browser;
|
|
13
13
|
let browserMode;
|
|
14
14
|
function makeTargetFilter(enableExtensions = false) {
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import net from 'node:net';
|
|
9
|
-
import { logger } from '../logger.js';
|
|
10
9
|
import { PipeTransport } from '../third_party/index.js';
|
|
11
10
|
import { getTempFilePath } from '../utils/files.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
12
|
import { DAEMON_SCRIPT_PATH, getSocketPath, getPidFilePath, isDaemonRunning, } from './utils.js';
|
|
13
13
|
const FILE_TIMEOUT = 10_000;
|
|
14
|
+
const READY_CHECK_INTERVAL = 100;
|
|
15
|
+
const READY_CHECK_COMMAND_TIMEOUT = 1_000;
|
|
14
16
|
/**
|
|
15
17
|
* Waits for a file to be created and populated (removed = false) or removed (removed = true).
|
|
16
18
|
*/
|
|
@@ -48,9 +50,36 @@ function waitForFile(filePath, removed = false) {
|
|
|
48
50
|
});
|
|
49
51
|
});
|
|
50
52
|
}
|
|
53
|
+
function delay(ms) {
|
|
54
|
+
return new Promise(resolve => {
|
|
55
|
+
setTimeout(resolve, ms);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function waitForDaemonReady(sessionId) {
|
|
59
|
+
const deadline = Date.now() + FILE_TIMEOUT;
|
|
60
|
+
let lastError;
|
|
61
|
+
while (Date.now() < deadline) {
|
|
62
|
+
try {
|
|
63
|
+
const response = await sendCommand({ method: 'status' }, sessionId, READY_CHECK_COMMAND_TIMEOUT);
|
|
64
|
+
if (response.success) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
lastError = new Error(String(response.error));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
lastError = error;
|
|
71
|
+
}
|
|
72
|
+
const timeLeft = deadline - Date.now();
|
|
73
|
+
if (timeLeft > 0) {
|
|
74
|
+
await delay(Math.min(READY_CHECK_INTERVAL, timeLeft));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
throw new Error(`Timeout: daemon not ready within ${FILE_TIMEOUT}ms`, lastError === undefined ? undefined : { cause: lastError });
|
|
78
|
+
}
|
|
51
79
|
export async function startDaemon(mcpArgs = [], sessionId) {
|
|
52
80
|
if (isDaemonRunning(sessionId)) {
|
|
53
81
|
logger?.('Daemon is already running');
|
|
82
|
+
await waitForDaemonReady(sessionId);
|
|
54
83
|
return;
|
|
55
84
|
}
|
|
56
85
|
const pidFilePath = getPidFilePath(sessionId);
|
|
@@ -67,12 +96,17 @@ export async function startDaemon(mcpArgs = [], sessionId) {
|
|
|
67
96
|
});
|
|
68
97
|
child.unref();
|
|
69
98
|
await waitForFile(pidFilePath);
|
|
99
|
+
await waitForDaemonReady(sessionId);
|
|
70
100
|
}
|
|
71
101
|
const SEND_COMMAND_TIMEOUT = 60_000; // ms
|
|
72
102
|
/**
|
|
73
103
|
* `sendCommand` opens a socket connection sends a single command and disconnects.
|
|
74
104
|
*/
|
|
75
|
-
export async function sendCommand(command, sessionId) {
|
|
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
|
+
}
|
|
76
110
|
const socketPath = getSocketPath(sessionId);
|
|
77
111
|
const socket = net.createConnection({
|
|
78
112
|
path: socketPath,
|
|
@@ -81,7 +115,7 @@ export async function sendCommand(command, sessionId) {
|
|
|
81
115
|
const timer = setTimeout(() => {
|
|
82
116
|
socket.destroy();
|
|
83
117
|
reject(new Error('Timeout waiting for daemon response'));
|
|
84
|
-
},
|
|
118
|
+
}, timeout);
|
|
85
119
|
const transport = new PipeTransport(socket, socket);
|
|
86
120
|
transport.onmessage = async (message) => {
|
|
87
121
|
clearTimeout(timer);
|
|
@@ -111,6 +145,24 @@ export async function stopDaemon(sessionId) {
|
|
|
111
145
|
await sendCommand({ method: 'stop' }, sessionId);
|
|
112
146
|
await waitForFile(pidFilePath, /*removed=*/ true);
|
|
113
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
|
+
}
|
|
114
166
|
export async function handleResponse(response, format) {
|
|
115
167
|
if (response.isError) {
|
|
116
168
|
return JSON.stringify(response.content);
|