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
package/build/src/McpResponse.js
CHANGED
|
@@ -10,142 +10,12 @@ import { NetworkFormatter } from './formatters/NetworkFormatter.js';
|
|
|
10
10
|
import { SnapshotFormatter } from './formatters/SnapshotFormatter.js';
|
|
11
11
|
import { UncaughtError } from './PageCollector.js';
|
|
12
12
|
import { TextSnapshot } from './TextSnapshot.js';
|
|
13
|
-
import { DevTools, getToonEncode } from './third_party/index.js';
|
|
14
|
-
import { handleDialog } from './tools/pages.js';
|
|
13
|
+
import { DevTools, getToonEncode, getGcfEncode } from './third_party/index.js';
|
|
14
|
+
import { handleDialog, listPages } from './tools/pages.js';
|
|
15
15
|
import { getInsightOutput, getTraceSummary } from './trace-processing/parse.js';
|
|
16
|
+
import { stableIdSymbol } from './utils/id.js';
|
|
16
17
|
import { paginate } from './utils/pagination.js';
|
|
17
|
-
|
|
18
|
-
if (typeof schema === 'boolean') {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
let isHtmlElement = false;
|
|
22
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
23
|
-
if (key === 'x-mcp-type' && value === 'HTMLElement') {
|
|
24
|
-
isHtmlElement = true;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (isHtmlElement) {
|
|
29
|
-
schema.properties = { uid: { type: 'string' } };
|
|
30
|
-
schema.required = ['uid'];
|
|
31
|
-
}
|
|
32
|
-
if (schema.properties) {
|
|
33
|
-
for (const key of Object.keys(schema.properties)) {
|
|
34
|
-
replaceHtmlElementsWithUids(schema.properties[key]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (schema.items) {
|
|
38
|
-
if (Array.isArray(schema.items)) {
|
|
39
|
-
for (const item of schema.items) {
|
|
40
|
-
replaceHtmlElementsWithUids(item);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
replaceHtmlElementsWithUids(schema.items);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (schema.anyOf) {
|
|
48
|
-
for (const s of schema.anyOf) {
|
|
49
|
-
replaceHtmlElementsWithUids(s);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (schema.allOf) {
|
|
53
|
-
for (const s of schema.allOf) {
|
|
54
|
-
replaceHtmlElementsWithUids(s);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (schema.oneOf) {
|
|
58
|
-
for (const s of schema.oneOf) {
|
|
59
|
-
replaceHtmlElementsWithUids(s);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async function getToolGroups(page) {
|
|
64
|
-
// Check if there is a `devtoolstooldiscovery` event listener
|
|
65
|
-
const windowHandle = await page.pptrPage.evaluateHandle(() => window);
|
|
66
|
-
// @ts-expect-error internal API
|
|
67
|
-
const client = page.pptrPage._client();
|
|
68
|
-
const { listeners } = await client.send('DOMDebugger.getEventListeners', {
|
|
69
|
-
objectId: windowHandle.remoteObject().objectId,
|
|
70
|
-
});
|
|
71
|
-
if (listeners.find(l => l.type === 'devtoolstooldiscovery') === undefined) {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
const toolGroups = await page.pptrPage.evaluate(() => {
|
|
75
|
-
if (window.__dtmcp) {
|
|
76
|
-
window.__dtmcp.toolGroups = [];
|
|
77
|
-
}
|
|
78
|
-
return new Promise(resolve => {
|
|
79
|
-
const event = new CustomEvent('devtoolstooldiscovery');
|
|
80
|
-
const groups = [];
|
|
81
|
-
// @ts-expect-error Adding custom property
|
|
82
|
-
event.respondWith = toolGroup => {
|
|
83
|
-
if (!window.__dtmcp) {
|
|
84
|
-
window.__dtmcp = {};
|
|
85
|
-
}
|
|
86
|
-
if (!window.__dtmcp.toolGroups) {
|
|
87
|
-
window.__dtmcp.toolGroups = [];
|
|
88
|
-
}
|
|
89
|
-
if (typeof toolGroup.name !== 'string' ||
|
|
90
|
-
(toolGroup.description &&
|
|
91
|
-
typeof toolGroup.description !== 'string') ||
|
|
92
|
-
!Array.isArray(toolGroup.tools)) {
|
|
93
|
-
console.error('Invalid toolGroup:', toolGroup);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
for (const tool of toolGroup.tools) {
|
|
97
|
-
if (typeof tool.name !== 'string' ||
|
|
98
|
-
typeof tool.description !== 'string' ||
|
|
99
|
-
typeof tool.inputSchema !== 'object' ||
|
|
100
|
-
typeof tool.execute !== 'function') {
|
|
101
|
-
console.error('Invalid tool:', tool);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
window.__dtmcp.toolGroups.push(toolGroup);
|
|
106
|
-
// When receiving a toolGroup for the first time, expose a simple execution helper
|
|
107
|
-
if (!window.__dtmcp.executeTool) {
|
|
108
|
-
window.__dtmcp.executeTool = async (toolName, args) => {
|
|
109
|
-
if (!window.__dtmcp?.toolGroups ||
|
|
110
|
-
window.__dtmcp.toolGroups.length === 0) {
|
|
111
|
-
throw new Error('No tools found on the page');
|
|
112
|
-
}
|
|
113
|
-
for (const group of window.__dtmcp.toolGroups) {
|
|
114
|
-
const tool = group.tools?.find(t => t.name === toolName);
|
|
115
|
-
if (tool) {
|
|
116
|
-
return await tool.execute(args);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
throw new Error(`Tool ${toolName} not found`);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
groups.push(toolGroup);
|
|
123
|
-
};
|
|
124
|
-
window.dispatchEvent(event);
|
|
125
|
-
// If at least one toolGroup was added synchronously, resolve with the array.
|
|
126
|
-
// Otherwise, use setTimeout to allow for any microtask/asynchronous respondWith calls, or resolve with an empty array.
|
|
127
|
-
if (groups.length > 0) {
|
|
128
|
-
resolve(groups);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
setTimeout(() => {
|
|
132
|
-
if (groups.length > 0) {
|
|
133
|
-
resolve(groups);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
resolve([]);
|
|
137
|
-
}
|
|
138
|
-
}, 0);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
for (const group of toolGroups) {
|
|
143
|
-
for (const tool of group.tools ?? []) {
|
|
144
|
-
replaceHtmlElementsWithUids(tool.inputSchema);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return toolGroups;
|
|
148
|
-
}
|
|
18
|
+
const { formatBytesToKb } = DevTools.I18n.ByteUtilities;
|
|
149
19
|
export class McpResponse {
|
|
150
20
|
#includePages = false;
|
|
151
21
|
#includeExtensionServiceWorkers = false;
|
|
@@ -172,6 +42,7 @@ export class McpResponse {
|
|
|
172
42
|
#redactNetworkHeaders = true;
|
|
173
43
|
#error;
|
|
174
44
|
#attachedWaitForResult;
|
|
45
|
+
#reconnectNotice = false;
|
|
175
46
|
get #deviceScope() {
|
|
176
47
|
return this.#page?.viewport?.isMobile ? 'PHONE' : 'DESKTOP';
|
|
177
48
|
}
|
|
@@ -184,6 +55,13 @@ export class McpResponse {
|
|
|
184
55
|
setRedactNetworkHeaders(value) {
|
|
185
56
|
this.#redactNetworkHeaders = value;
|
|
186
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Surfaces a one-time note that the browser reconnected and page ids changed.
|
|
60
|
+
* Set by the tool handler when the context reports a pending reconnect notice.
|
|
61
|
+
*/
|
|
62
|
+
setReconnectNotice() {
|
|
63
|
+
this.#reconnectNotice = true;
|
|
64
|
+
}
|
|
187
65
|
attachDevToolsData(data) {
|
|
188
66
|
this.#devToolsData = data;
|
|
189
67
|
}
|
|
@@ -218,7 +96,7 @@ export class McpResponse {
|
|
|
218
96
|
}
|
|
219
97
|
this.#networkRequestsOptions = {
|
|
220
98
|
include: value,
|
|
221
|
-
pagination: options?.pageSize || options?.pageIdx
|
|
99
|
+
pagination: options?.pageSize !== undefined || options?.pageIdx !== undefined
|
|
222
100
|
? {
|
|
223
101
|
pageSize: options.pageSize,
|
|
224
102
|
pageIdx: options.pageIdx,
|
|
@@ -236,7 +114,7 @@ export class McpResponse {
|
|
|
236
114
|
}
|
|
237
115
|
this.#consoleDataOptions = {
|
|
238
116
|
include: value,
|
|
239
|
-
pagination: options?.pageSize || options?.pageIdx
|
|
117
|
+
pagination: options?.pageSize !== undefined || options?.pageIdx !== undefined
|
|
240
118
|
? {
|
|
241
119
|
pageSize: options.pageSize,
|
|
242
120
|
pageIdx: options.pageIdx,
|
|
@@ -309,20 +187,21 @@ export class McpResponse {
|
|
|
309
187
|
attachWaitForResult(result) {
|
|
310
188
|
this.#attachedWaitForResult = result;
|
|
311
189
|
}
|
|
312
|
-
setHeapSnapshotAggregates(
|
|
190
|
+
setHeapSnapshotAggregates(aggregateData, options) {
|
|
313
191
|
this.#heapSnapshotOptions = {
|
|
314
192
|
...this.#heapSnapshotOptions,
|
|
315
193
|
include: true,
|
|
316
|
-
|
|
194
|
+
aggregateData,
|
|
317
195
|
pagination: options,
|
|
318
196
|
};
|
|
319
197
|
}
|
|
320
|
-
setHeapSnapshotStats(stats, staticData) {
|
|
198
|
+
setHeapSnapshotStats(stats, staticData, nativeContextSizes) {
|
|
321
199
|
this.#heapSnapshotOptions = {
|
|
322
200
|
...this.#heapSnapshotOptions,
|
|
323
201
|
include: true,
|
|
324
202
|
stats,
|
|
325
203
|
staticData,
|
|
204
|
+
nativeContextSizes,
|
|
326
205
|
};
|
|
327
206
|
}
|
|
328
207
|
setHeapSnapshotNodes(nodes, options) {
|
|
@@ -369,6 +248,13 @@ export class McpResponse {
|
|
|
369
248
|
detailedClassDiff,
|
|
370
249
|
};
|
|
371
250
|
}
|
|
251
|
+
setHeapSnapshotObjectDetails(objectInfo) {
|
|
252
|
+
this.#heapSnapshotOptions = {
|
|
253
|
+
...this.#heapSnapshotOptions,
|
|
254
|
+
include: true,
|
|
255
|
+
objectInfo,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
372
258
|
attachImage(value) {
|
|
373
259
|
this.#images.push(value);
|
|
374
260
|
}
|
|
@@ -384,175 +270,188 @@ export class McpResponse {
|
|
|
384
270
|
get listWebMcpTools() {
|
|
385
271
|
return this.#listWebMcpTools;
|
|
386
272
|
}
|
|
387
|
-
async
|
|
273
|
+
async #handleSnapshot(context) {
|
|
388
274
|
if (this.#includePages) {
|
|
389
275
|
await context.createPagesSnapshot();
|
|
390
276
|
}
|
|
391
|
-
if (this.#
|
|
392
|
-
|
|
277
|
+
if (!this.#snapshotParams) {
|
|
278
|
+
return undefined;
|
|
393
279
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (!this.#page) {
|
|
397
|
-
throw new Error('Response must have a page');
|
|
398
|
-
}
|
|
399
|
-
this.#page.textSnapshot = await TextSnapshot.create(this.#page, {
|
|
400
|
-
verbose: this.#snapshotParams.verbose,
|
|
401
|
-
devtoolsData: this.#devToolsData,
|
|
402
|
-
});
|
|
403
|
-
const textSnapshot = this.#page.textSnapshot;
|
|
404
|
-
if (textSnapshot) {
|
|
405
|
-
const formatter = new SnapshotFormatter(textSnapshot);
|
|
406
|
-
if (this.#snapshotParams.filePath) {
|
|
407
|
-
const result = await context.saveFile(new TextEncoder().encode(formatter.toString()), this.#snapshotParams.filePath, '.txt');
|
|
408
|
-
snapshot = result.filename;
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
snapshot = formatter;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
280
|
+
if (!this.#page) {
|
|
281
|
+
throw new Error('Response must have a page');
|
|
414
282
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
283
|
+
this.#page.textSnapshot = await TextSnapshot.create(this.#page, {
|
|
284
|
+
verbose: this.#snapshotParams.verbose,
|
|
285
|
+
devtoolsData: this.#devToolsData,
|
|
286
|
+
});
|
|
287
|
+
const formatter = new SnapshotFormatter(this.#page.textSnapshot);
|
|
288
|
+
if (this.#snapshotParams.filePath) {
|
|
289
|
+
const result = await context.saveFile(new TextEncoder().encode(formatter.toString()), this.#snapshotParams.filePath, '.txt');
|
|
290
|
+
return result.filename;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
return formatter;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async #handleAttachedNetworkRequest(context) {
|
|
297
|
+
if (!this.#attachedNetworkRequestId) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
if (!this.#page) {
|
|
301
|
+
throw new Error(`Response must have an McpPage`);
|
|
302
|
+
}
|
|
303
|
+
const request = this.#page.getNetworkRequestById(this.#attachedNetworkRequestId);
|
|
304
|
+
return await NetworkFormatter.from(request, {
|
|
305
|
+
requestId: this.#attachedNetworkRequestId,
|
|
306
|
+
requestIdResolver: req => this.getNetworkRequestStableId(req),
|
|
307
|
+
fetchData: true,
|
|
308
|
+
requestFilePath: this.#attachedNetworkRequestOptions?.requestFilePath,
|
|
309
|
+
responseFilePath: this.#attachedNetworkRequestOptions?.responseFilePath,
|
|
310
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
311
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async #handleAttachedConsoleMessage() {
|
|
315
|
+
if (!this.#attachedConsoleMessageId) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
if (!this.#page) {
|
|
319
|
+
throw new Error(`Response must have an McpPage`);
|
|
320
|
+
}
|
|
321
|
+
const message = this.#page.getConsoleMessageById(this.#attachedConsoleMessageId);
|
|
322
|
+
const consoleMessageStableId = this.#attachedConsoleMessageId;
|
|
323
|
+
if ('args' in message || message instanceof UncaughtError) {
|
|
324
|
+
const consoleMessage = message;
|
|
325
|
+
return await ConsoleFormatter.from(consoleMessage, {
|
|
326
|
+
id: consoleMessageStableId,
|
|
327
|
+
fetchDetailedData: true,
|
|
328
|
+
devTools: this.#page.devtoolsUniverse,
|
|
429
329
|
});
|
|
430
|
-
detailedNetworkRequest = formatter;
|
|
431
330
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const consoleMessage = message;
|
|
441
|
-
const devTools = context.getDevToolsUniverse(this.#page);
|
|
442
|
-
detailedConsoleMessage = await ConsoleFormatter.from(consoleMessage, {
|
|
443
|
-
id: consoleMessageStableId,
|
|
444
|
-
fetchDetailedData: true,
|
|
445
|
-
devTools: devTools ?? undefined,
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
else if (message instanceof DevTools.AggregatedIssue) {
|
|
449
|
-
const formatter = new IssueFormatter(message, {
|
|
450
|
-
id: consoleMessageStableId,
|
|
451
|
-
requestIdResolver: context.resolveCdpRequestId.bind(context, this.#page),
|
|
452
|
-
elementIdResolver: this.#page.resolveCdpElementId.bind(this.#page),
|
|
453
|
-
});
|
|
454
|
-
if (!formatter.isValid()) {
|
|
455
|
-
throw new Error("Can't provide details for the msgid " + consoleMessageStableId);
|
|
456
|
-
}
|
|
457
|
-
detailedConsoleMessage = formatter;
|
|
331
|
+
else if (message instanceof DevTools.AggregatedIssue) {
|
|
332
|
+
const formatter = new IssueFormatter(message, {
|
|
333
|
+
id: consoleMessageStableId,
|
|
334
|
+
requestIdResolver: this.#page.resolveCdpRequestId.bind(this.#page),
|
|
335
|
+
elementIdResolver: this.#page.textSnapshot?.resolveCdpElementId.bind(this.#page.textSnapshot),
|
|
336
|
+
});
|
|
337
|
+
if (!formatter.isValid()) {
|
|
338
|
+
throw new Error("Can't provide details for the msgid " + consoleMessageStableId);
|
|
458
339
|
}
|
|
340
|
+
return formatter;
|
|
459
341
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
extensions = await context.listExtensions();
|
|
342
|
+
else {
|
|
343
|
+
return undefined;
|
|
463
344
|
}
|
|
464
|
-
|
|
345
|
+
}
|
|
346
|
+
async #handleThirdPartyDevelopeTools() {
|
|
465
347
|
if (this.#args.categoryExperimentalThirdParty &&
|
|
466
348
|
this.#listThirdPartyDeveloperTools &&
|
|
467
349
|
this.#page) {
|
|
468
|
-
|
|
469
|
-
if (thirdPartyDeveloperTools) {
|
|
470
|
-
this.#page.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
|
|
471
|
-
}
|
|
350
|
+
return await this.#page.getToolGroups();
|
|
472
351
|
}
|
|
473
|
-
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
async #handleWebMCP() {
|
|
474
355
|
if (this.#args.categoryExperimentalWebmcp &&
|
|
475
356
|
this.#listWebMcpTools &&
|
|
476
357
|
this.#page) {
|
|
477
|
-
|
|
358
|
+
return this.#page.getWebMcpTools();
|
|
478
359
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
495
|
-
messages = messages.filter(message => {
|
|
496
|
-
if ('type' in message) {
|
|
497
|
-
return normalizedTypes.has(message.type());
|
|
498
|
-
}
|
|
499
|
-
if (message instanceof DevTools.AggregatedIssue) {
|
|
500
|
-
return normalizedTypes.has('issue');
|
|
501
|
-
}
|
|
502
|
-
return normalizedTypes.has('error');
|
|
503
|
-
});
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
async #handleConsoleList(context) {
|
|
363
|
+
if (!this.#consoleDataOptions?.include) {
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
let messages;
|
|
367
|
+
let page;
|
|
368
|
+
if (this.#consoleDataOptions.serviceWorkerId) {
|
|
369
|
+
messages = context.getServiceWorkerConsoleData(this.#consoleDataOptions.serviceWorkerId);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
page = this.#page;
|
|
373
|
+
if (!page) {
|
|
374
|
+
throw new Error(`Response must have an McpPage`);
|
|
504
375
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
return await ConsoleFormatter.from(consoleMessage, {
|
|
513
|
-
id: consoleMessageStableId,
|
|
514
|
-
fetchDetailedData: false,
|
|
515
|
-
devTools: devTools ?? undefined,
|
|
516
|
-
});
|
|
376
|
+
messages = page.getConsoleData(this.#consoleDataOptions.includePreservedMessages);
|
|
377
|
+
}
|
|
378
|
+
if (this.#consoleDataOptions.types?.length) {
|
|
379
|
+
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
380
|
+
messages = messages.filter(message => {
|
|
381
|
+
if ('type' in message) {
|
|
382
|
+
return normalizedTypes.has(message.type());
|
|
517
383
|
}
|
|
518
|
-
if (
|
|
519
|
-
|
|
520
|
-
id: consoleMessageStableId,
|
|
521
|
-
});
|
|
522
|
-
if (!formatter.isValid()) {
|
|
523
|
-
return null;
|
|
524
|
-
}
|
|
525
|
-
return formatter;
|
|
384
|
+
if (message instanceof DevTools.AggregatedIssue) {
|
|
385
|
+
return normalizedTypes.has('issue');
|
|
526
386
|
}
|
|
527
|
-
return
|
|
528
|
-
})
|
|
387
|
+
return normalizedTypes.has('error');
|
|
388
|
+
});
|
|
529
389
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
539
|
-
requests = requests.filter(request => {
|
|
540
|
-
const type = request.resourceType();
|
|
541
|
-
return normalizedTypes.has(type);
|
|
390
|
+
return (await Promise.all(messages.map(async (item) => {
|
|
391
|
+
const consoleMessageStableId = this.getConsoleMessageStableId(item);
|
|
392
|
+
if ('args' in item || item instanceof UncaughtError) {
|
|
393
|
+
const consoleMessage = item;
|
|
394
|
+
return await ConsoleFormatter.from(consoleMessage, {
|
|
395
|
+
id: consoleMessageStableId,
|
|
396
|
+
fetchDetailedData: false,
|
|
397
|
+
devTools: page ? page.devtoolsUniverse : undefined,
|
|
542
398
|
});
|
|
543
399
|
}
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
})));
|
|
400
|
+
if (item instanceof DevTools.AggregatedIssue) {
|
|
401
|
+
const formatter = new IssueFormatter(item, {
|
|
402
|
+
id: consoleMessageStableId,
|
|
403
|
+
});
|
|
404
|
+
if (!formatter.isValid()) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
return formatter;
|
|
553
408
|
}
|
|
409
|
+
return null;
|
|
410
|
+
}))).filter(item => item !== null);
|
|
411
|
+
}
|
|
412
|
+
async #handleNetworkRequestList(context) {
|
|
413
|
+
if (!this.#networkRequestsOptions?.include) {
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
if (!this.#page) {
|
|
417
|
+
throw new Error(`Response must have an McpPage`);
|
|
418
|
+
}
|
|
419
|
+
let requests = this.#page.getNetworkRequests(this.#networkRequestsOptions?.includePreservedRequests);
|
|
420
|
+
// Apply resource type filtering if specified
|
|
421
|
+
if (this.#networkRequestsOptions.resourceTypes?.length) {
|
|
422
|
+
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
423
|
+
requests = requests.filter(request => {
|
|
424
|
+
const type = request.resourceType();
|
|
425
|
+
return normalizedTypes.has(type);
|
|
426
|
+
});
|
|
554
427
|
}
|
|
555
|
-
return
|
|
428
|
+
return await Promise.all(requests.map(request => NetworkFormatter.from(request, {
|
|
429
|
+
requestId: this.getNetworkRequestStableId(request),
|
|
430
|
+
selectedInDevToolsUI: this.getNetworkRequestStableId(request) ===
|
|
431
|
+
this.#networkRequestsOptions?.networkRequestIdInDevToolsUI,
|
|
432
|
+
fetchData: false,
|
|
433
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
434
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
435
|
+
})));
|
|
436
|
+
}
|
|
437
|
+
async handle(context, dataFormat = 'default') {
|
|
438
|
+
const [snapshot, detailedNetworkRequest, detailedConsoleMessage, thirdPartyDeveloperTools, webmcpTools, consoleMessages, networkRequests,] = await Promise.all([
|
|
439
|
+
this.#handleSnapshot(context),
|
|
440
|
+
this.#handleAttachedNetworkRequest(context),
|
|
441
|
+
this.#handleAttachedConsoleMessage(),
|
|
442
|
+
this.#handleThirdPartyDevelopeTools(),
|
|
443
|
+
this.#handleWebMCP(),
|
|
444
|
+
this.#handleConsoleList(context),
|
|
445
|
+
this.#handleNetworkRequestList(context),
|
|
446
|
+
]);
|
|
447
|
+
if (this.#includeExtensionServiceWorkers) {
|
|
448
|
+
await context.createExtensionServiceWorkersSnapshot();
|
|
449
|
+
}
|
|
450
|
+
let extensions;
|
|
451
|
+
if (this.#listExtensions) {
|
|
452
|
+
extensions = await context.listExtensions();
|
|
453
|
+
}
|
|
454
|
+
return this.format(context, {
|
|
556
455
|
detailedConsoleMessage,
|
|
557
456
|
consoleMessages,
|
|
558
457
|
snapshot,
|
|
@@ -565,23 +464,45 @@ export class McpResponse {
|
|
|
565
464
|
thirdPartyDeveloperTools,
|
|
566
465
|
webmcpTools,
|
|
567
466
|
errorMessage: this.#error?.message,
|
|
568
|
-
},
|
|
467
|
+
}, dataFormat);
|
|
468
|
+
}
|
|
469
|
+
getConsoleMessageStableId(message) {
|
|
470
|
+
return message[stableIdSymbol] ?? -1;
|
|
569
471
|
}
|
|
570
|
-
|
|
472
|
+
getNetworkRequestStableId(request) {
|
|
473
|
+
return request[stableIdSymbol] ?? -1;
|
|
474
|
+
}
|
|
475
|
+
async format(context, data, dataFormat = 'default') {
|
|
571
476
|
const structuredContent = {};
|
|
572
|
-
|
|
573
|
-
|
|
477
|
+
// Resolve the compact encoder based on the chosen format
|
|
478
|
+
let compactEncode;
|
|
479
|
+
if (dataFormat === 'toon') {
|
|
574
480
|
try {
|
|
575
|
-
|
|
481
|
+
compactEncode = await getToonEncode();
|
|
576
482
|
}
|
|
577
483
|
catch {
|
|
578
|
-
throw new Error('The `@toon-format/toon` package is required to use
|
|
484
|
+
throw new Error('The `@toon-format/toon` package is required to use --experimentalDataFormat=toon. ' +
|
|
579
485
|
'Make sure the peer dependency is installed:\n' +
|
|
580
|
-
'- For npx: npx --package chrome-devtools-mcp@latest --package @toon-format/toon@latest chrome-devtools-mcp --
|
|
486
|
+
'- For npx: npx --package chrome-devtools-mcp@latest --package @toon-format/toon@latest chrome-devtools-mcp --experimentalDataFormat=toon\n' +
|
|
581
487
|
'- For npm: npm install @toon-format/toon (add -g if installed globally)');
|
|
582
488
|
}
|
|
583
489
|
}
|
|
490
|
+
else if (dataFormat === 'gcf') {
|
|
491
|
+
try {
|
|
492
|
+
compactEncode = await getGcfEncode();
|
|
493
|
+
}
|
|
494
|
+
catch {
|
|
495
|
+
throw new Error('The `@blackwell-systems/gcf` package is required to use --experimentalDataFormat=gcf. ' +
|
|
496
|
+
'Make sure the peer dependency is installed:\n' +
|
|
497
|
+
'- For npx: npx --package chrome-devtools-mcp@latest --package @blackwell-systems/gcf@latest chrome-devtools-mcp --experimentalDataFormat=gcf\n' +
|
|
498
|
+
'- For npm: npm install @blackwell-systems/gcf (add -g if installed globally)');
|
|
499
|
+
}
|
|
500
|
+
}
|
|
584
501
|
const response = [];
|
|
502
|
+
if (this.#reconnectNotice) {
|
|
503
|
+
structuredContent.reconnected = true;
|
|
504
|
+
response.push(`Note: the browser was restarted or reconnected since the last call. Page ids have changed. Call ${listPages().name} to see open pages.`);
|
|
505
|
+
}
|
|
585
506
|
if (this.#textResponseLines.length) {
|
|
586
507
|
structuredContent.message = this.#textResponseLines.join('\n');
|
|
587
508
|
response.push(...this.#textResponseLines);
|
|
@@ -642,29 +563,40 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
642
563
|
}
|
|
643
564
|
if (this.#includePages) {
|
|
644
565
|
const allPages = context.getPages();
|
|
645
|
-
const { regularPages, extensionPages } = allPages.reduce((acc,
|
|
646
|
-
if (
|
|
647
|
-
acc.extensionPages.push(
|
|
566
|
+
const { regularPages, extensionPages } = allPages.reduce((acc, mcpPage) => {
|
|
567
|
+
if (mcpPage.pptrPage.url().startsWith('chrome-extension://')) {
|
|
568
|
+
acc.extensionPages.push(mcpPage);
|
|
648
569
|
}
|
|
649
570
|
else {
|
|
650
|
-
acc.regularPages.push(
|
|
571
|
+
acc.regularPages.push(mcpPage);
|
|
651
572
|
}
|
|
652
573
|
return acc;
|
|
653
574
|
}, { regularPages: [], extensionPages: [] });
|
|
575
|
+
const selectionFallback = context.getSelectedPageFallback();
|
|
576
|
+
if (selectionFallback) {
|
|
577
|
+
let selectedPageId;
|
|
578
|
+
try {
|
|
579
|
+
selectedPageId = context.getSelectedMcpPage().id;
|
|
580
|
+
}
|
|
581
|
+
catch {
|
|
582
|
+
selectedPageId = undefined;
|
|
583
|
+
}
|
|
584
|
+
response.push(`Note: the previously selected page ${selectionFallback.wasClosed ? 'was closed' : 'is no longer listed'}.${selectedPageId !== undefined ? ` Page ${selectedPageId} is now selected.` : ''}`);
|
|
585
|
+
}
|
|
654
586
|
if (regularPages.length) {
|
|
655
587
|
const parts = [`## Pages`];
|
|
656
588
|
const structuredPages = [];
|
|
657
|
-
for (const
|
|
658
|
-
const isolatedContextName =
|
|
589
|
+
for (const mcpPage of regularPages) {
|
|
590
|
+
const isolatedContextName = mcpPage.isolatedContextName;
|
|
659
591
|
const contextLabel = isolatedContextName
|
|
660
592
|
? ` isolatedContext=${isolatedContextName}`
|
|
661
593
|
: '';
|
|
662
|
-
const title = await fetchPageTitle(
|
|
594
|
+
const title = await fetchPageTitle(mcpPage.pptrPage);
|
|
663
595
|
const pageLabel = title
|
|
664
|
-
? `${truncateTitle(title)} (${
|
|
665
|
-
:
|
|
666
|
-
parts.push(`${
|
|
667
|
-
structuredPages.push(createStructuredPage(
|
|
596
|
+
? `${truncateTitle(title)} (${mcpPage.pptrPage.url()})`
|
|
597
|
+
: mcpPage.pptrPage.url();
|
|
598
|
+
parts.push(`${mcpPage.id}: ${pageLabel}${context.isPageSelected(mcpPage) ? ' [selected]' : ''}${contextLabel}`);
|
|
599
|
+
structuredPages.push(createStructuredPage(mcpPage, context, title));
|
|
668
600
|
}
|
|
669
601
|
response.push(...parts);
|
|
670
602
|
structuredContent.pages = structuredPages;
|
|
@@ -673,17 +605,17 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
673
605
|
if (extensionPages.length) {
|
|
674
606
|
response.push(`## Extension Pages`);
|
|
675
607
|
const structuredExtensionPages = [];
|
|
676
|
-
for (const
|
|
677
|
-
const isolatedContextName =
|
|
608
|
+
for (const mcpPage of extensionPages) {
|
|
609
|
+
const isolatedContextName = mcpPage.isolatedContextName;
|
|
678
610
|
const contextLabel = isolatedContextName
|
|
679
611
|
? ` isolatedContext=${isolatedContextName}`
|
|
680
612
|
: '';
|
|
681
|
-
const title = await fetchPageTitle(
|
|
613
|
+
const title = await fetchPageTitle(mcpPage.pptrPage);
|
|
682
614
|
const pageLabel = title
|
|
683
|
-
? `${truncateTitle(title)} (${
|
|
684
|
-
:
|
|
685
|
-
response.push(`${
|
|
686
|
-
structuredExtensionPages.push(createStructuredPage(
|
|
615
|
+
? `${truncateTitle(title)} (${mcpPage.pptrPage.url()})`
|
|
616
|
+
: mcpPage.pptrPage.url();
|
|
617
|
+
response.push(`${mcpPage.id}: ${pageLabel}${context.isPageSelected(mcpPage) ? ' [selected]' : ''}${contextLabel}`);
|
|
618
|
+
structuredExtensionPages.push(createStructuredPage(mcpPage, context, title));
|
|
687
619
|
}
|
|
688
620
|
structuredContent.extensionPages = structuredExtensionPages;
|
|
689
621
|
}
|
|
@@ -759,8 +691,8 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
759
691
|
else {
|
|
760
692
|
structuredContent.snapshot = data.snapshot.toJSON();
|
|
761
693
|
response.push('## Latest page snapshot');
|
|
762
|
-
response.push(
|
|
763
|
-
?
|
|
694
|
+
response.push(compactEncode
|
|
695
|
+
? compactEncode(structuredContent.snapshot)
|
|
764
696
|
: data.snapshot.toString());
|
|
765
697
|
}
|
|
766
698
|
}
|
|
@@ -778,17 +710,31 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
778
710
|
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
779
711
|
structuredContent.heapSnapshot.staticData = staticData;
|
|
780
712
|
}
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
|
|
713
|
+
const nativeContextSizes = this.#heapSnapshotOptions.nativeContextSizes;
|
|
714
|
+
if (nativeContextSizes) {
|
|
715
|
+
response.push('### Native Contexts');
|
|
716
|
+
response.push(HeapSnapshotFormatter.formatNativeContextSizes(nativeContextSizes));
|
|
717
|
+
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
718
|
+
structuredContent.heapSnapshot.nativeContextSizes = nativeContextSizes;
|
|
719
|
+
}
|
|
720
|
+
const aggregateData = this.#heapSnapshotOptions.aggregateData;
|
|
721
|
+
if (aggregateData) {
|
|
722
|
+
const sortedEntries = HeapSnapshotFormatter.sort(aggregateData.aggregates);
|
|
784
723
|
const paginationData = this.#dataWithPagination(sortedEntries, this.#heapSnapshotOptions.pagination);
|
|
724
|
+
response.push(`Objects: ${aggregateData.objectCount}`);
|
|
725
|
+
response.push(`Total shallow size: ${formatBytesToKb(aggregateData.totalSelfSize)}`);
|
|
726
|
+
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
727
|
+
structuredContent.heapSnapshot.aggregateStats = {
|
|
728
|
+
objectCount: aggregateData.objectCount,
|
|
729
|
+
totalSelfSize: aggregateData.totalSelfSize,
|
|
730
|
+
};
|
|
785
731
|
structuredContent.pagination = paginationData.pagination;
|
|
786
732
|
response.push(...paginationData.info);
|
|
787
733
|
const paginatedRecord = Object.fromEntries(paginationData.items);
|
|
788
734
|
const formatter = new HeapSnapshotFormatter(paginatedRecord);
|
|
789
735
|
structuredContent.heapSnapshotData = formatter.toJSON();
|
|
790
|
-
response.push(
|
|
791
|
-
?
|
|
736
|
+
response.push(compactEncode
|
|
737
|
+
? compactEncode(structuredContent.heapSnapshotData)
|
|
792
738
|
: formatter.toString());
|
|
793
739
|
}
|
|
794
740
|
const nodes = this.#heapSnapshotOptions.nodes;
|
|
@@ -844,16 +790,16 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
844
790
|
const classDiffs = this.#heapSnapshotOptions.classDiffs;
|
|
845
791
|
if (classDiffs) {
|
|
846
792
|
response.push('### Heap Snapshot Diff');
|
|
847
|
-
response.push(
|
|
848
|
-
?
|
|
793
|
+
response.push(compactEncode
|
|
794
|
+
? compactEncode(classDiffs)
|
|
849
795
|
: HeapSnapshotFormatter.formatDiffSummary(classDiffs));
|
|
850
796
|
structuredContent.heapSnapshotClassDiffs = classDiffs;
|
|
851
797
|
}
|
|
852
798
|
const detailedClassDiff = this.#heapSnapshotOptions.detailedClassDiff;
|
|
853
799
|
if (detailedClassDiff) {
|
|
854
800
|
response.push('### Heap Snapshot Detailed Diff');
|
|
855
|
-
response.push(
|
|
856
|
-
?
|
|
801
|
+
response.push(compactEncode
|
|
802
|
+
? compactEncode(detailedClassDiff)
|
|
857
803
|
: HeapSnapshotFormatter.formatDiffDetails(detailedClassDiff));
|
|
858
804
|
structuredContent.heapSnapshotDetailedClassDiff = detailedClassDiff;
|
|
859
805
|
}
|
|
@@ -867,6 +813,14 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
867
813
|
response.push(formatted);
|
|
868
814
|
structuredContent.heapSnapshotDuplicateStrings = paginationData.items;
|
|
869
815
|
}
|
|
816
|
+
const objectInfo = this.#heapSnapshotOptions.objectInfo;
|
|
817
|
+
if (objectInfo) {
|
|
818
|
+
response.push('### Object Details');
|
|
819
|
+
response.push(compactEncode
|
|
820
|
+
? compactEncode(objectInfo)
|
|
821
|
+
: HeapSnapshotFormatter.formatObjectInfo(objectInfo));
|
|
822
|
+
structuredContent.heapSnapshotObjectDetails = objectInfo;
|
|
823
|
+
}
|
|
870
824
|
}
|
|
871
825
|
if (data.detailedNetworkRequest) {
|
|
872
826
|
response.push(data.detailedNetworkRequest.toStringDetailed());
|
|
@@ -894,11 +848,11 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
894
848
|
response.push(extensionsMessage);
|
|
895
849
|
}
|
|
896
850
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
851
|
+
const thirdPartyDeveloperTools = data.thirdPartyDeveloperTools;
|
|
852
|
+
if (thirdPartyDeveloperTools?.length) {
|
|
853
|
+
structuredContent.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
|
|
900
854
|
response.push('## Third-party developer tools');
|
|
901
|
-
for (const toolGroup of
|
|
855
|
+
for (const toolGroup of thirdPartyDeveloperTools) {
|
|
902
856
|
response.push(`${toolGroup.name}: ${toolGroup.description}`);
|
|
903
857
|
response.push('Available tools:');
|
|
904
858
|
const toolDefinitionsMessage = toolGroup.tools
|
|
@@ -938,8 +892,8 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
938
892
|
response.push(...paginationData.info);
|
|
939
893
|
if (data.networkRequests) {
|
|
940
894
|
structuredContent.networkRequests = paginationData.items.map(i => i.toJSON());
|
|
941
|
-
response.push(...(
|
|
942
|
-
? [
|
|
895
|
+
response.push(...(compactEncode
|
|
896
|
+
? [compactEncode(structuredContent.networkRequests)]
|
|
943
897
|
: paginationData.items.map(i => i.toString())));
|
|
944
898
|
}
|
|
945
899
|
}
|
|
@@ -956,8 +910,8 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
956
910
|
structuredContent.pagination = paginationData.pagination;
|
|
957
911
|
structuredContent.consoleMessages = paginationData.items.map(item => item.toJSON());
|
|
958
912
|
response.push(...paginationData.info);
|
|
959
|
-
if (
|
|
960
|
-
response.push(
|
|
913
|
+
if (compactEncode) {
|
|
914
|
+
response.push(compactEncode(structuredContent.consoleMessages));
|
|
961
915
|
}
|
|
962
916
|
else {
|
|
963
917
|
response.push(...paginationData.items.map(item => item.toString()));
|
|
@@ -1032,14 +986,14 @@ async function fetchPageTitle(page) {
|
|
|
1032
986
|
new Promise(resolve => setTimeout(() => resolve(''), 1000)),
|
|
1033
987
|
]);
|
|
1034
988
|
}
|
|
1035
|
-
function createStructuredPage(
|
|
1036
|
-
const isolatedContextName =
|
|
989
|
+
function createStructuredPage(mcpPage, context, rawTitle) {
|
|
990
|
+
const isolatedContextName = mcpPage.isolatedContextName;
|
|
1037
991
|
const title = truncateTitle(rawTitle);
|
|
1038
992
|
const entry = {
|
|
1039
|
-
id:
|
|
1040
|
-
url:
|
|
993
|
+
id: mcpPage.id,
|
|
994
|
+
url: mcpPage.pptrPage.url(),
|
|
1041
995
|
title,
|
|
1042
|
-
selected: context.isPageSelected(
|
|
996
|
+
selected: context.isPageSelected(mcpPage),
|
|
1043
997
|
};
|
|
1044
998
|
if (isolatedContextName) {
|
|
1045
999
|
entry.isolatedContext = isolatedContextName;
|