chrome-devtools-mcp 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -22
- package/build/src/McpContext.js +121 -44
- package/build/src/McpPage.js +230 -14
- package/build/src/McpResponse.js +209 -283
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +80 -15
- package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
- package/build/src/bin/chrome-devtools.js +47 -32
- package/build/src/browser.js +3 -1
- package/build/src/{PageCollector.js → collectors/PageCollector.js} +15 -10
- package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
- package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +414 -23
- package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +74 -9
- package/build/src/daemon/client.js +33 -2
- package/build/src/daemon/daemon.js +17 -13
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +9 -16
- package/build/src/formatters/ConsoleFormatter.js +43 -10
- package/build/src/formatters/HeapSnapshotFormatter.js +58 -13
- package/build/src/formatters/IssueFormatter.js +1 -1
- package/build/src/formatters/NetworkFormatter.js +7 -7
- package/build/src/index.js +34 -5
- package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +82 -27
- package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
- package/build/src/telemetry/ClearcutLogger.js +16 -1
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/telemetry/types.js +4 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +235 -113
- package/build/src/third_party/bundled-packages.json +6 -7
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +657 -224
- package/build/src/third_party/index.js +62484 -43814
- 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/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- 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/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- 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/categories.js +3 -0
- package/build/src/tools/console.js +9 -3
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +7 -5
- package/build/src/tools/input.js +222 -120
- package/build/src/tools/lighthouse.js +3 -1
- package/build/src/tools/memory.js +144 -17
- package/build/src/tools/network.js +6 -3
- package/build/src/tools/pages.js +13 -16
- package/build/src/tools/performance.js +57 -46
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +6 -4
- package/build/src/tools/screenshot.js +192 -84
- package/build/src/tools/script.js +118 -34
- package/build/src/tools/slim/tools.js +3 -3
- package/build/src/tools/snapshot.js +5 -3
- package/build/src/tools/thirdPartyDeveloper.js +2 -2
- package/build/src/tools/tools.js +2 -0
- package/build/src/tools/webmcp.js +2 -2
- package/build/src/utils/WaitForHelper.js +299 -0
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/logger.js +25 -11
- 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 +37 -25
- package/skills/a11y-debugging/SKILL.md +2 -0
- package/skills/chrome-devtools/SKILL.md +5 -4
- package/skills/chrome-devtools-cli/SKILL.md +109 -64
- package/skills/debug-optimize-lcp/SKILL.md +9 -9
- package/skills/memory-leak-debugging/SKILL.md +14 -18
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/skills/troubleshooting/SKILL.md +1 -0
- package/build/src/WaitForHelper.js +0 -200
- 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/build/src/utils/string.js +0 -37
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- package/skills/memory-leak-debugging/references/memlab.md +0 -29
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { DevTools } from '../third_party/index.js';
|
|
7
7
|
import { stableIdSymbol } from '../utils/id.js';
|
|
8
|
+
const { formatBytesToKb } = DevTools.I18n.ByteUtilities;
|
|
8
9
|
export function isNodeLike(item) {
|
|
9
10
|
return (typeof item === 'object' && item !== null && 'id' in item && 'name' in item);
|
|
10
11
|
}
|
|
@@ -32,15 +33,15 @@ export class HeapSnapshotFormatter {
|
|
|
32
33
|
lines.push('nodeId,nodeName,type,distance,selfSize,retainedSize');
|
|
33
34
|
}
|
|
34
35
|
else if (isEdgeLike(firstItem)) {
|
|
35
|
-
lines.push('name,type,nodeId,nodeName');
|
|
36
|
+
lines.push('name,type,nodeId,nodeName,selfSize,retainedSize');
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
for (const item of items) {
|
|
39
40
|
if (isNodeLike(item)) {
|
|
40
|
-
lines.push(`${item.id},${item.name},${item.type},${item.distance},${
|
|
41
|
+
lines.push(`${item.id},${item.name},${item.type},${item.distance},${formatBytesToKb(item.selfSize)},${formatBytesToKb(item.retainedSize)}`);
|
|
41
42
|
}
|
|
42
43
|
else if (isEdgeLike(item)) {
|
|
43
|
-
lines.push(`${item.name},${item.type},${item.node.id},${item.node.name}`);
|
|
44
|
+
lines.push(`${item.name},${item.type},${item.node.id},${item.node.name},${formatBytesToKb(item.node.selfSize)},${formatBytesToKb(item.node.retainedSize)}`);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
return lines.join('\n');
|
|
@@ -63,7 +64,7 @@ export class HeapSnapshotFormatter {
|
|
|
63
64
|
const lines = [];
|
|
64
65
|
lines.push('nodeId,nodeName,selfSize,retainedSize');
|
|
65
66
|
for (const node of dominators) {
|
|
66
|
-
lines.push(`${node.nodeId},${node.nodeName},${
|
|
67
|
+
lines.push(`${node.nodeId},${node.nodeName},${formatBytesToKb(node.selfSize)},${formatBytesToKb(node.retainedSize)}`);
|
|
67
68
|
}
|
|
68
69
|
return lines.join('\n');
|
|
69
70
|
}
|
|
@@ -73,20 +74,39 @@ export class HeapSnapshotFormatter {
|
|
|
73
74
|
for (const group of groups) {
|
|
74
75
|
const nodeIds = group.nodes.map(n => `@${n.id}`).join(' ');
|
|
75
76
|
const truncated = group.truncated ?? false;
|
|
76
|
-
lines.push(`${JSON.stringify(group.value)},${group.count},${
|
|
77
|
+
lines.push(`${JSON.stringify(group.value)},${group.count},${formatBytesToKb(group.totalSelfSize)},${formatBytesToKb(group.totalRetainedSize)},${truncated},${nodeIds}`);
|
|
77
78
|
}
|
|
78
79
|
return lines.join('\n');
|
|
79
80
|
}
|
|
81
|
+
static formatNativeContextSizes(sizes) {
|
|
82
|
+
const lines = [];
|
|
83
|
+
lines.push('nodeId,nodeName,selfSize,retainedSize,attributedSize');
|
|
84
|
+
const sortedContexts = [...sizes.nativeContexts].sort((a, b) => b.attributedSize - a.attributedSize);
|
|
85
|
+
for (const nc of sortedContexts) {
|
|
86
|
+
lines.push(`${nc.nodeId},${nc.nodeName},${formatBytesToKb(nc.selfSize)},${formatBytesToKb(nc.retainedSize)},${formatBytesToKb(nc.attributedSize)}`);
|
|
87
|
+
}
|
|
88
|
+
lines.push(`Shared Size: ${formatBytesToKb(sizes.sharedSize)}`);
|
|
89
|
+
lines.push(`Unattributed Size: ${formatBytesToKb(sizes.noAttributionSize)}`);
|
|
90
|
+
return lines.join('\n');
|
|
91
|
+
}
|
|
92
|
+
static formatRetainedByContextSummary(summary) {
|
|
93
|
+
const lines = [];
|
|
94
|
+
lines.push(`Context count: ${summary.contextCount}`);
|
|
95
|
+
lines.push(`Retained by context size: ${formatBytesToKb(summary.retainedByContextSize)} (${summary.retainedByContextCount} objects)`);
|
|
96
|
+
lines.push(`Not retained by context size: ${formatBytesToKb(summary.notRetainedByContextSize)} (${summary.notRetainedByContextCount} objects)`);
|
|
97
|
+
lines.push(`Total size: ${formatBytesToKb(summary.totalSize)}`);
|
|
98
|
+
return lines.join('\n');
|
|
99
|
+
}
|
|
80
100
|
#getSortedAggregates() {
|
|
81
101
|
return Object.values(this.#aggregates).sort((a, b) => b.maxRet - a.maxRet);
|
|
82
102
|
}
|
|
83
103
|
toString() {
|
|
84
104
|
const sorted = this.#getSortedAggregates();
|
|
85
105
|
const lines = [];
|
|
86
|
-
lines.push('id,name,count,selfSize,
|
|
106
|
+
lines.push('id,name,count,selfSize,retainedSize');
|
|
87
107
|
for (const info of sorted) {
|
|
88
108
|
const id = info[stableIdSymbol] ?? '';
|
|
89
|
-
lines.push(`${id},${info.name},${info.count},${
|
|
109
|
+
lines.push(`${id},${info.name},${info.count},${formatBytesToKb(info.self)},${formatBytesToKb(info.maxRet)}`);
|
|
90
110
|
}
|
|
91
111
|
return lines.join('\n');
|
|
92
112
|
}
|
|
@@ -96,8 +116,8 @@ export class HeapSnapshotFormatter {
|
|
|
96
116
|
id: info[stableIdSymbol],
|
|
97
117
|
className: info.name,
|
|
98
118
|
count: info.count,
|
|
99
|
-
selfSize:
|
|
100
|
-
retainedSize:
|
|
119
|
+
selfSize: formatBytesToKb(info.self),
|
|
120
|
+
retainedSize: formatBytesToKb(info.maxRet),
|
|
101
121
|
}));
|
|
102
122
|
}
|
|
103
123
|
static sort(aggregates) {
|
|
@@ -108,7 +128,7 @@ export class HeapSnapshotFormatter {
|
|
|
108
128
|
lines.push('index,className,addedCount,removedCount,countDelta,addedSize,removedSize,sizeDelta');
|
|
109
129
|
let index = 0;
|
|
110
130
|
for (const diff of diffs) {
|
|
111
|
-
lines.push(`${index},${diff.className},${diff.addedCount},${diff.removedCount},${diff.countDelta},${
|
|
131
|
+
lines.push(`${index},${diff.className},${diff.addedCount},${diff.removedCount},${diff.countDelta},${formatBytesToKb(diff.addedSize)},${formatBytesToKb(diff.removedSize)},${formatBytesToKb(diff.sizeDelta)}`);
|
|
112
132
|
index++;
|
|
113
133
|
}
|
|
114
134
|
return lines.join('\n');
|
|
@@ -122,19 +142,44 @@ export class HeapSnapshotFormatter {
|
|
|
122
142
|
const deletedSelfSizes = diff.deletedSelfSizes;
|
|
123
143
|
lines.push(`Objects:`);
|
|
124
144
|
for (let i = 0; i < addedIds.length; i++) {
|
|
125
|
-
lines.push(` + @${addedIds[i]} (self_size: ${
|
|
145
|
+
lines.push(` + @${addedIds[i]} (self_size: ${formatBytesToKb(addedSelfSizes[i])})`);
|
|
126
146
|
}
|
|
127
147
|
for (let i = 0; i < deletedIds.length; i++) {
|
|
128
|
-
lines.push(` - @${deletedIds[i]} (self_size: ${
|
|
148
|
+
lines.push(` - @${deletedIds[i]} (self_size: ${formatBytesToKb(deletedSelfSizes[i])})`);
|
|
129
149
|
}
|
|
130
150
|
return lines.join('\n');
|
|
131
151
|
}
|
|
152
|
+
static formatObjectInfo(info) {
|
|
153
|
+
const lines = [
|
|
154
|
+
`id: @${info.id}`,
|
|
155
|
+
`name: ${info.name}`,
|
|
156
|
+
`type: ${info.type}`,
|
|
157
|
+
`detachedness: ${formatDOMLinkState(info.detachedness)}`,
|
|
158
|
+
`selfSize: ${formatBytesToKb(info.selfSize)}`,
|
|
159
|
+
`retainedSize: ${formatBytesToKb(info.retainedSize)}`,
|
|
160
|
+
`distance: ${info.distance}`,
|
|
161
|
+
`edgeCount: ${info.edgeCount}`,
|
|
162
|
+
`retainerCount: ${info.retainerCount}`,
|
|
163
|
+
];
|
|
164
|
+
return lines.join('\n');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function formatDOMLinkState(state) {
|
|
168
|
+
switch (state) {
|
|
169
|
+
case 1 /* DevTools.HeapSnapshotModel.HeapSnapshotModel.DOMLinkState.ATTACHED */:
|
|
170
|
+
return 'attached';
|
|
171
|
+
case 2 /* DevTools.HeapSnapshotModel.HeapSnapshotModel.DOMLinkState.DETACHED */:
|
|
172
|
+
return 'detached';
|
|
173
|
+
case 0 /* DevTools.HeapSnapshotModel.HeapSnapshotModel.DOMLinkState.UNKNOWN */:
|
|
174
|
+
default:
|
|
175
|
+
return 'unknown';
|
|
176
|
+
}
|
|
132
177
|
}
|
|
133
178
|
function formatSignedCount(n) {
|
|
134
179
|
return n > 0 ? `+${n}` : `${n}`;
|
|
135
180
|
}
|
|
136
181
|
function formatSignedSize(bytes) {
|
|
137
|
-
const formatted =
|
|
182
|
+
const formatted = formatBytesToKb(bytes);
|
|
138
183
|
return bytes > 0 ? `+${formatted}` : formatted;
|
|
139
184
|
}
|
|
140
185
|
//# sourceMappingURL=HeapSnapshotFormatter.js.map
|
|
@@ -144,7 +144,7 @@ export class IssueFormatter {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
function convertIssueConciseToString(issue) {
|
|
147
|
-
return `msgid=${issue.id} [issue] ${issue.title} (count: ${issue.count})`;
|
|
147
|
+
return `msgid=${issue.id} [issue] ${issue.title ?? 'Unknown Issue'} (count: ${issue.count})`;
|
|
148
148
|
}
|
|
149
149
|
function convertIssueDetailedToString(issue) {
|
|
150
150
|
const result = [];
|
|
@@ -38,7 +38,7 @@ export class NetworkFormatter {
|
|
|
38
38
|
const requestBodyNotAvailableMessage = '<Request body not available anymore>';
|
|
39
39
|
if (this.#options.requestFilePath) {
|
|
40
40
|
if (!this.#options.saveFile) {
|
|
41
|
-
throw new Error('saveFile
|
|
41
|
+
throw new Error('Unable to save the request body to a file: no saveFile callback was configured.');
|
|
42
42
|
}
|
|
43
43
|
if (data) {
|
|
44
44
|
const result = await this.#options.saveFile(Buffer.from(data), this.#options.requestFilePath, '.network-request');
|
|
@@ -65,7 +65,7 @@ export class NetworkFormatter {
|
|
|
65
65
|
try {
|
|
66
66
|
const buffer = await response.buffer();
|
|
67
67
|
if (!this.#options.saveFile) {
|
|
68
|
-
throw new Error('saveFile
|
|
68
|
+
throw new Error('Unable to save the response body to a file: no saveFile callback was configured.');
|
|
69
69
|
}
|
|
70
70
|
const result = await this.#options.saveFile(buffer, this.#options.responseFilePath, '.network-response');
|
|
71
71
|
this.#responseBodyFilePath = result.filename;
|
|
@@ -86,7 +86,7 @@ export class NetworkFormatter {
|
|
|
86
86
|
return convertNetworkRequestConciseToString(this.toJSON());
|
|
87
87
|
}
|
|
88
88
|
toStringDetailed() {
|
|
89
|
-
return
|
|
89
|
+
return convertNetworkRequestDetailedToStringDetailed(this.toJSONDetailed());
|
|
90
90
|
}
|
|
91
91
|
toJSON() {
|
|
92
92
|
return {
|
|
@@ -181,19 +181,19 @@ function convertNetworkRequestConciseToString(data) {
|
|
|
181
181
|
// TODO truncate the URL
|
|
182
182
|
return `reqid=${data.requestId} ${data.method} ${data.url} [${data.status}]${data.selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function formatHeaders(headers) {
|
|
185
185
|
const response = [];
|
|
186
186
|
for (const [name, value] of Object.entries(headers)) {
|
|
187
187
|
response.push(`- ${name}:${value}`);
|
|
188
188
|
}
|
|
189
189
|
return response;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function convertNetworkRequestDetailedToStringDetailed(data) {
|
|
192
192
|
const response = [];
|
|
193
193
|
response.push(`## Request ${data.url}`);
|
|
194
194
|
response.push(`Status: ${data.status}`);
|
|
195
195
|
response.push(`### Request Headers`);
|
|
196
|
-
for (const line of
|
|
196
|
+
for (const line of formatHeaders(data.requestHeaders)) {
|
|
197
197
|
response.push(line);
|
|
198
198
|
}
|
|
199
199
|
if (data.requestBody) {
|
|
@@ -206,7 +206,7 @@ function converNetworkRequestDetailedToStringDetailed(data) {
|
|
|
206
206
|
}
|
|
207
207
|
if (data.responseHeaders) {
|
|
208
208
|
response.push(`### Response Headers`);
|
|
209
|
-
for (const line of
|
|
209
|
+
for (const line of formatHeaders(data.responseHeaders)) {
|
|
210
210
|
response.push(line);
|
|
211
211
|
}
|
|
212
212
|
}
|
package/build/src/index.js
CHANGED
|
@@ -12,9 +12,19 @@ import { McpServer, SetLevelRequestSchema, ListRootsResultSchema, RootsListChang
|
|
|
12
12
|
import { ToolHandler } from './ToolHandler.js';
|
|
13
13
|
import { createTools } from './tools/tools.js';
|
|
14
14
|
import { logger } from './utils/logger.js';
|
|
15
|
-
import { Mutex } from './
|
|
15
|
+
import { Mutex, puppeteer } from './third_party/index.js';
|
|
16
16
|
import { VERSION } from './version.js';
|
|
17
17
|
export { buildFlag } from './ToolHandler.js';
|
|
18
|
+
puppeteer.setFollowSymlinks(false);
|
|
19
|
+
/**
|
|
20
|
+
* Timeout for a `roots/list` that a tool call is waiting on, matching the 5s
|
|
21
|
+
* default used for page operations. `getContext()` awaits it while
|
|
22
|
+
* `ToolHandler` holds the tool mutex, so leaving it unbounded lets a client
|
|
23
|
+
* that negotiates `roots` but does not answer block every tool for the SDK's
|
|
24
|
+
* default of 60s. Background refreshes are not bounded by this, so roots a
|
|
25
|
+
* slow client sends late still land.
|
|
26
|
+
*/
|
|
27
|
+
const ROOTS_REQUEST_TIMEOUT = 5_000;
|
|
18
28
|
export async function createMcpServer(serverArgs, options) {
|
|
19
29
|
if (serverArgs.usageStatistics) {
|
|
20
30
|
ClearcutLogger.initialize({
|
|
@@ -34,13 +44,21 @@ export async function createMcpServer(serverArgs, options) {
|
|
|
34
44
|
server.server.setRequestHandler(SetLevelRequestSchema, () => {
|
|
35
45
|
return {};
|
|
36
46
|
});
|
|
37
|
-
|
|
47
|
+
// Roots are client state rather than browser state, so the last listing stays
|
|
48
|
+
// valid across browser reconnects and only the client can invalidate it, via
|
|
49
|
+
// the `roots/list_changed` notification handled below
|
|
50
|
+
let lastRoots;
|
|
51
|
+
// `timeout` is only passed where a tool call is waiting on the result – the
|
|
52
|
+
// background refreshes below block nobody, so bounding them would just discard
|
|
53
|
+
// roots a slow client was about to send
|
|
54
|
+
const updateRoots = async (timeout) => {
|
|
38
55
|
if (!server.server.getClientCapabilities()?.roots) {
|
|
39
56
|
return;
|
|
40
57
|
}
|
|
41
58
|
try {
|
|
42
|
-
const roots = await server.server.request({ method: 'roots/list' }, ListRootsResultSchema);
|
|
43
|
-
|
|
59
|
+
const roots = await server.server.request({ method: 'roots/list' }, ListRootsResultSchema, timeout === undefined ? undefined : { timeout });
|
|
60
|
+
lastRoots = roots.roots;
|
|
61
|
+
context?.setRoots(lastRoots);
|
|
44
62
|
}
|
|
45
63
|
catch (e) {
|
|
46
64
|
logger?.('Failed to list roots', e);
|
|
@@ -110,6 +128,7 @@ export async function createMcpServer(serverArgs, options) {
|
|
|
110
128
|
allowlist,
|
|
111
129
|
});
|
|
112
130
|
if (context?.browser !== browser) {
|
|
131
|
+
context?.dispose();
|
|
113
132
|
context = await McpContext.from(browser, logger, {
|
|
114
133
|
experimentalDevToolsDebugging: devtools,
|
|
115
134
|
experimentalIncludeAllPages: serverArgs.experimentalIncludeAllPages,
|
|
@@ -120,7 +139,17 @@ export async function createMcpServer(serverArgs, options) {
|
|
|
120
139
|
// Surfaces a one-time note in the next response after a reconnect.
|
|
121
140
|
reconnected: context !== undefined,
|
|
122
141
|
});
|
|
123
|
-
|
|
142
|
+
if (lastRoots === undefined) {
|
|
143
|
+
// Nothing listed yet, so this call has to wait – bounded, since it is
|
|
144
|
+
// holding the tool mutex, and a later background refresh still lands
|
|
145
|
+
await updateRoots(ROOTS_REQUEST_TIMEOUT);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Carry the known roots over and refresh out of band, so a reconnect
|
|
149
|
+
// never pays for a client round-trip
|
|
150
|
+
context.setRoots(lastRoots);
|
|
151
|
+
void updateRoots();
|
|
152
|
+
}
|
|
124
153
|
}
|
|
125
154
|
return context;
|
|
126
155
|
}
|
|
@@ -5,12 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import fsSync from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import { DevTools } from '
|
|
9
|
-
import { createIdGenerator, stableIdSymbol, } from '
|
|
8
|
+
import { DevTools } from '../third_party/index.js';
|
|
9
|
+
import { createIdGenerator, stableIdSymbol, } from '../utils/id.js';
|
|
10
|
+
const VALID_EXTENSIONS = ['.heapsnapshot', '.heaptimeline'];
|
|
11
|
+
function hasValidHeapSnapshotExtension(filePath) {
|
|
12
|
+
return VALID_EXTENSIONS.some(ext => filePath.endsWith(ext));
|
|
13
|
+
}
|
|
10
14
|
export class HeapSnapshotManager {
|
|
11
15
|
#snapshotIdGenerator = createIdGenerator();
|
|
12
16
|
#snapshots = new Map();
|
|
13
17
|
async getSnapshot(filePath) {
|
|
18
|
+
if (!hasValidHeapSnapshotExtension(filePath)) {
|
|
19
|
+
throw new Error(`File ${filePath} must have a .heapsnapshot or .heaptimeline extension.`);
|
|
20
|
+
}
|
|
14
21
|
const absolutePath = path.resolve(filePath);
|
|
15
22
|
const cached = this.#snapshots.get(absolutePath);
|
|
16
23
|
if (cached) {
|
|
@@ -26,12 +33,25 @@ export class HeapSnapshotManager {
|
|
|
26
33
|
});
|
|
27
34
|
return snapshot;
|
|
28
35
|
}
|
|
29
|
-
async
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
async #applyNodeFilter(snapshot, filter, filterName, objectId) {
|
|
37
|
+
if (filterName === 'attributedToSpecificNativeContext') {
|
|
38
|
+
if (objectId === undefined) {
|
|
39
|
+
throw new Error('objectId is required when filterName is attributedToSpecificNativeContext');
|
|
40
|
+
}
|
|
41
|
+
const nodeIndex = await snapshot.nodeIndexForId(objectId);
|
|
42
|
+
if (nodeIndex === undefined) {
|
|
43
|
+
throw new Error(`Node with ID ${objectId} not found`);
|
|
44
|
+
}
|
|
45
|
+
filter.filterName = `nativeContext_${nodeIndex}`;
|
|
46
|
+
}
|
|
47
|
+
else if (filterName) {
|
|
33
48
|
filter.filterName = filterName;
|
|
34
49
|
}
|
|
50
|
+
}
|
|
51
|
+
async getAggregates(filePath, filterName, objectId) {
|
|
52
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
53
|
+
const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
|
|
54
|
+
await this.#applyNodeFilter(snapshot, filter, filterName, objectId);
|
|
35
55
|
const aggregates = await snapshot.aggregatesWithFilter(filter);
|
|
36
56
|
let objectCount = 0;
|
|
37
57
|
let totalSelfSize = 0;
|
|
@@ -55,6 +75,14 @@ export class HeapSnapshotManager {
|
|
|
55
75
|
const snapshot = await this.getSnapshot(filePath);
|
|
56
76
|
return snapshot.staticData;
|
|
57
77
|
}
|
|
78
|
+
async getNativeContextSizes(filePath) {
|
|
79
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
80
|
+
return await snapshot.getNativeContextSizes();
|
|
81
|
+
}
|
|
82
|
+
async getRetainedByContextSummary(filePath) {
|
|
83
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
84
|
+
return await snapshot.getRetainedByContextSummary();
|
|
85
|
+
}
|
|
58
86
|
async getOrCreateIdForClassKey(filePath, classKey) {
|
|
59
87
|
const cached = this.#getCachedSnapshot(filePath);
|
|
60
88
|
let id = cached.classKeyToId.get(classKey);
|
|
@@ -65,12 +93,10 @@ export class HeapSnapshotManager {
|
|
|
65
93
|
}
|
|
66
94
|
return id;
|
|
67
95
|
}
|
|
68
|
-
async getNodesById(filePath, id, filterName) {
|
|
96
|
+
async getNodesById(filePath, id, filterName, objectId) {
|
|
69
97
|
const snapshot = await this.getSnapshot(filePath);
|
|
70
98
|
const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
|
|
71
|
-
|
|
72
|
-
filter.filterName = filterName;
|
|
73
|
-
}
|
|
99
|
+
await this.#applyNodeFilter(snapshot, filter, filterName, objectId);
|
|
74
100
|
const className = await this.resolveClassKeyFromId(filePath, id);
|
|
75
101
|
if (!className) {
|
|
76
102
|
throw new Error(`Class with ID ${id} not found in heap snapshot`);
|
|
@@ -87,6 +113,14 @@ export class HeapSnapshotManager {
|
|
|
87
113
|
const provider = snapshot.createRetainingEdgesProvider(nodeIndex);
|
|
88
114
|
return await provider.serializeItemsRange(0, Infinity);
|
|
89
115
|
}
|
|
116
|
+
async getObjectInfo(filePath, nodeId) {
|
|
117
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
118
|
+
const nodeIndex = await snapshot.nodeIndexForId(nodeId);
|
|
119
|
+
if (nodeIndex === undefined) {
|
|
120
|
+
throw new Error(`Node with ID ${nodeId} not found`);
|
|
121
|
+
}
|
|
122
|
+
return await snapshot.getObjectInfo(nodeIndex);
|
|
123
|
+
}
|
|
90
124
|
async getRetainingPaths(filePath, nodeId, maxDepth, maxNodes, maxSiblings) {
|
|
91
125
|
const snapshot = await this.getSnapshot(filePath);
|
|
92
126
|
const nodeIndex = await snapshot.nodeIndexForId(nodeId);
|
|
@@ -103,13 +137,13 @@ export class HeapSnapshotManager {
|
|
|
103
137
|
}
|
|
104
138
|
return await snapshot.getDominatorsOf(nodeIndex);
|
|
105
139
|
}
|
|
106
|
-
async getEdges(filePath, nodeId) {
|
|
140
|
+
async getEdges(filePath, nodeId, options) {
|
|
107
141
|
const snapshot = await this.getSnapshot(filePath);
|
|
108
142
|
const nodeIndex = await snapshot.nodeIndexForId(nodeId);
|
|
109
143
|
if (nodeIndex === undefined) {
|
|
110
144
|
throw new Error(`Node with ID ${nodeId} not found`);
|
|
111
145
|
}
|
|
112
|
-
const provider = snapshot.createEdgesProvider(nodeIndex);
|
|
146
|
+
const provider = snapshot.createEdgesProvider(nodeIndex, options);
|
|
113
147
|
return await provider.serializeItemsRange(0, Infinity);
|
|
114
148
|
}
|
|
115
149
|
async getClassDiffs(baseFilePath, currentFilePath) {
|
|
@@ -178,30 +212,45 @@ export class HeapSnapshotManager {
|
|
|
178
212
|
async #loadSnapshot(absolutePath, uid) {
|
|
179
213
|
const workerProxy = new DevTools.HeapSnapshotModel.HeapSnapshotProxy.HeapSnapshotWorkerProxy(() => {
|
|
180
214
|
/* noop */
|
|
181
|
-
}, import.meta.resolve('
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
await
|
|
215
|
+
}, DevTools.Common.Console.Console.instance(), import.meta.resolve('../third_party/devtools-heap-snapshot-worker.js'));
|
|
216
|
+
try {
|
|
217
|
+
const { promise: snapshotPromise, resolve: resolveSnapshot } = Promise.withResolvers();
|
|
218
|
+
const loaderProxy = workerProxy.createLoader(uid, snapshotProxy => {
|
|
219
|
+
resolveSnapshot(snapshotProxy);
|
|
220
|
+
});
|
|
221
|
+
const fileStream = fsSync.createReadStream(absolutePath, {
|
|
222
|
+
encoding: 'utf-8',
|
|
223
|
+
highWaterMark: 1024 * 1024,
|
|
224
|
+
});
|
|
225
|
+
for await (const chunk of fileStream) {
|
|
226
|
+
await loaderProxy.write(chunk);
|
|
227
|
+
}
|
|
228
|
+
await loaderProxy.close();
|
|
229
|
+
const snapshot = await snapshotPromise;
|
|
230
|
+
return { snapshot, worker: workerProxy };
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
// The worker is created before the read, and a failed load never reaches
|
|
234
|
+
// the #snapshots map, so dispose()/disposeAll() can never clean it up.
|
|
235
|
+
// Dispose it here to avoid leaking a worker on every failed load (e.g. a
|
|
236
|
+
// missing or invalid .heapsnapshot path).
|
|
237
|
+
workerProxy.dispose();
|
|
238
|
+
throw error;
|
|
192
239
|
}
|
|
193
|
-
await loaderProxy.close();
|
|
194
|
-
const snapshot = await snapshotPromise;
|
|
195
|
-
return { snapshot, worker: workerProxy };
|
|
196
240
|
}
|
|
197
241
|
async getDuplicateStrings(filePath) {
|
|
198
242
|
const snapshot = await this.getSnapshot(filePath);
|
|
199
243
|
return await snapshot.getDuplicateStrings();
|
|
200
244
|
}
|
|
245
|
+
async queryObjects(filePath, options) {
|
|
246
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
247
|
+
const provider = snapshot.queryObjects(options);
|
|
248
|
+
return await provider.serializeItemsRange(0, Infinity);
|
|
249
|
+
}
|
|
201
250
|
hasSnapshots() {
|
|
202
251
|
return this.#snapshots.size > 0;
|
|
203
252
|
}
|
|
204
|
-
|
|
253
|
+
disposeSnapshot(filePath) {
|
|
205
254
|
const absolutePath = path.resolve(filePath);
|
|
206
255
|
const cached = this.#snapshots.get(absolutePath);
|
|
207
256
|
if (cached) {
|
|
@@ -211,5 +260,11 @@ export class HeapSnapshotManager {
|
|
|
211
260
|
}
|
|
212
261
|
return false;
|
|
213
262
|
}
|
|
263
|
+
dispose() {
|
|
264
|
+
for (const cached of this.#snapshots.values()) {
|
|
265
|
+
cached.worker.dispose();
|
|
266
|
+
}
|
|
267
|
+
this.#snapshots.clear();
|
|
268
|
+
}
|
|
214
269
|
}
|
|
215
270
|
//# sourceMappingURL=HeapSnapshotManager.js.map
|
|
@@ -82,4 +82,4 @@ export function getInsightOutput(result, insightSetId, insightName, deviceScope)
|
|
|
82
82
|
const formatter = new DevTools.PerformanceInsightFormatter(DevTools.AgentFocus.fromParsedTrace(result.parsedTrace), matchingInsight, deviceScope);
|
|
83
83
|
return { output: formatter.formatInsight() };
|
|
84
84
|
}
|
|
85
|
-
//# sourceMappingURL=
|
|
85
|
+
//# sourceMappingURL=PerformanceTrace.js.map
|
|
@@ -58,7 +58,10 @@ export class ClearcutLogger {
|
|
|
58
58
|
}
|
|
59
59
|
setClientName(clientName) {
|
|
60
60
|
const lowerName = clientName.toLowerCase();
|
|
61
|
-
if (lowerName.includes('claude')) {
|
|
61
|
+
if (lowerName.includes('claude-desktop')) {
|
|
62
|
+
this.#mcpClient = McpClient.MCP_CLIENT_CLAUDE_DESKTOP;
|
|
63
|
+
}
|
|
64
|
+
else if (lowerName.includes('claude')) {
|
|
62
65
|
this.#mcpClient = McpClient.MCP_CLIENT_CLAUDE_CODE;
|
|
63
66
|
}
|
|
64
67
|
else if (lowerName.includes('gemini')) {
|
|
@@ -70,12 +73,21 @@ export class ClearcutLogger {
|
|
|
70
73
|
else if (lowerName.includes('openclaw')) {
|
|
71
74
|
this.#mcpClient = McpClient.MCP_CLIENT_OPENCLAW;
|
|
72
75
|
}
|
|
76
|
+
else if (lowerName.includes('opencode')) {
|
|
77
|
+
this.#mcpClient = McpClient.MCP_CLIENT_OPENCODE;
|
|
78
|
+
}
|
|
73
79
|
else if (lowerName.includes('codex')) {
|
|
74
80
|
this.#mcpClient = McpClient.MCP_CLIENT_CODEX;
|
|
75
81
|
}
|
|
76
82
|
else if (lowerName.includes('antigravity')) {
|
|
77
83
|
this.#mcpClient = McpClient.MCP_CLIENT_ANTIGRAVITY;
|
|
78
84
|
}
|
|
85
|
+
else if (lowerName.includes('grok') || lowerName.includes('xai')) {
|
|
86
|
+
this.#mcpClient = McpClient.MCP_CLIENT_GROK;
|
|
87
|
+
}
|
|
88
|
+
else if (lowerName.includes('copilot')) {
|
|
89
|
+
this.#mcpClient = McpClient.MCP_CLIENT_GITHUB_COPILOT;
|
|
90
|
+
}
|
|
79
91
|
else {
|
|
80
92
|
this.#mcpClient = McpClient.MCP_CLIENT_OTHER;
|
|
81
93
|
}
|
|
@@ -87,6 +99,9 @@ export class ClearcutLogger {
|
|
|
87
99
|
success: args.success,
|
|
88
100
|
latency_ms: args.latencyMs,
|
|
89
101
|
};
|
|
102
|
+
if (Object.keys(args.context).length > 0) {
|
|
103
|
+
tool_invocation.context = args.context;
|
|
104
|
+
}
|
|
90
105
|
if (Object.keys(args.params).length > 0) {
|
|
91
106
|
tool_invocation.tool_params = {
|
|
92
107
|
[`${sanitizedToolName}_params`]: sanitizeParams(args.params, args.schema),
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { DevTools } from '../third_party/index.js';
|
|
7
7
|
import { stripUnderscoreBeforeNumber } from './transformation.js';
|
|
8
|
+
const { StringUtilities } = DevTools.Platform;
|
|
8
9
|
/**
|
|
9
10
|
* For enums, log the value as uppercase.
|
|
10
11
|
* We're going to have an enum for such flags with choices represented
|
|
@@ -30,7 +31,7 @@ export function computeFlagUsage(args, options) {
|
|
|
30
31
|
const usage = {};
|
|
31
32
|
for (const [flagName, config] of Object.entries(options)) {
|
|
32
33
|
const value = args[flagName];
|
|
33
|
-
const snakeCaseName = stripUnderscoreBeforeNumber(toSnakeCase(flagName));
|
|
34
|
+
const snakeCaseName = stripUnderscoreBeforeNumber(StringUtilities.toSnakeCase(flagName));
|
|
34
35
|
// If there isn't a default value provided for the flag,
|
|
35
36
|
// we're going to log whether it's present on the args user
|
|
36
37
|
// provided or not. If there is a default value, we only log presence
|
|
@@ -59,7 +60,7 @@ export function computeFlagUsage(args, options) {
|
|
|
59
60
|
export function getPossibleFlagMetrics(options) {
|
|
60
61
|
const metrics = [];
|
|
61
62
|
for (const [flagName, config] of Object.entries(options)) {
|
|
62
|
-
const snakeCaseName = stripUnderscoreBeforeNumber(toSnakeCase(flagName));
|
|
63
|
+
const snakeCaseName = stripUnderscoreBeforeNumber(StringUtilities.toSnakeCase(flagName));
|
|
63
64
|
// _present is always a possible metric
|
|
64
65
|
metrics.push({
|
|
65
66
|
name: `${snakeCaseName}_present`,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { isLocalhost } from '../utils/url.js';
|
|
6
7
|
const LATENCY_BUCKETS = [50, 100, 250, 500, 1000, 2500, 5000, 10000];
|
|
7
8
|
export function bucketizeLatency(latencyMs) {
|
|
8
9
|
for (const bucket of LATENCY_BUCKETS) {
|
|
@@ -151,4 +152,33 @@ export function sanitizeParams(params, schema) {
|
|
|
151
152
|
}
|
|
152
153
|
return transformed;
|
|
153
154
|
}
|
|
155
|
+
function transformDevToolsData(devToolsData) {
|
|
156
|
+
const logged = {};
|
|
157
|
+
if (devToolsData.cdpBackendNodeId !== undefined) {
|
|
158
|
+
logged.is_dom_element_selected = true;
|
|
159
|
+
}
|
|
160
|
+
if (devToolsData.cdpRequestId !== undefined) {
|
|
161
|
+
logged.is_network_request_selected = true;
|
|
162
|
+
}
|
|
163
|
+
return logged;
|
|
164
|
+
}
|
|
165
|
+
export function buildContext(devToolsData, pageUrl) {
|
|
166
|
+
let context;
|
|
167
|
+
if (devToolsData === undefined) {
|
|
168
|
+
context = { is_devtools_open: false };
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
context = {
|
|
172
|
+
is_devtools_open: Object.keys(devToolsData).length > 0,
|
|
173
|
+
};
|
|
174
|
+
const loggedDevtoolsData = transformDevToolsData(devToolsData);
|
|
175
|
+
if (Object.keys(loggedDevtoolsData).length > 0) {
|
|
176
|
+
context.devtools_data = loggedDevtoolsData;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (pageUrl !== undefined) {
|
|
180
|
+
context.is_localhost = isLocalhost(pageUrl);
|
|
181
|
+
}
|
|
182
|
+
return context;
|
|
183
|
+
}
|
|
154
184
|
//# sourceMappingURL=transformation.js.map
|
|
@@ -20,6 +20,10 @@ export var McpClient;
|
|
|
20
20
|
McpClient[McpClient["MCP_CLIENT_OPENCLAW"] = 5] = "MCP_CLIENT_OPENCLAW";
|
|
21
21
|
McpClient[McpClient["MCP_CLIENT_CODEX"] = 6] = "MCP_CLIENT_CODEX";
|
|
22
22
|
McpClient[McpClient["MCP_CLIENT_ANTIGRAVITY"] = 7] = "MCP_CLIENT_ANTIGRAVITY";
|
|
23
|
+
McpClient[McpClient["MCP_CLIENT_GROK"] = 8] = "MCP_CLIENT_GROK";
|
|
24
|
+
McpClient[McpClient["MCP_CLIENT_OPENCODE"] = 9] = "MCP_CLIENT_OPENCODE";
|
|
25
|
+
McpClient[McpClient["MCP_CLIENT_CLAUDE_DESKTOP"] = 10] = "MCP_CLIENT_CLAUDE_DESKTOP";
|
|
26
|
+
McpClient[McpClient["MCP_CLIENT_GITHUB_COPILOT"] = 11] = "MCP_CLIENT_GITHUB_COPILOT";
|
|
23
27
|
McpClient[McpClient["MCP_CLIENT_OTHER"] = 3] = "MCP_CLIENT_OTHER";
|
|
24
28
|
})(McpClient || (McpClient = {}));
|
|
25
29
|
// IPC types for messages between the main process and the
|