@chenpx976/chrome-devtools-mcp 0.0.0-stage → 1.13.1
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/LICENSE +202 -0
- package/README.md +223 -2
- package/out/Default/gen/src/ArcBrowser.js +128 -0
- package/out/Default/gen/src/BrowserManager.js +562 -0
- package/out/Default/gen/src/LogpointManager.js +287 -0
- package/out/Default/gen/src/McpContext.js +1031 -0
- package/out/Default/gen/src/McpPage.js +1427 -0
- package/out/Default/gen/src/McpResponse.js +1350 -0
- package/out/Default/gen/src/McpWorker.js +66 -0
- package/out/Default/gen/src/NetworkOverrideManager.js +447 -0
- package/out/Default/gen/src/SlimMcpResponse.js +23 -0
- package/out/Default/gen/src/TextSnapshot.js +336 -0
- package/out/Default/gen/src/ToolHandler.js +531 -0
- package/out/Default/gen/src/bin/check-latest-version.js +53 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp-main.js +80 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp.js +23 -0
- package/out/Default/gen/src/bin/chrome-devtools.js +213 -0
- package/out/Default/gen/src/collectors/PageCollector.js +325 -0
- package/out/Default/gen/src/collectors/ServiceWorkerCollector.js +198 -0
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigLocator.js +70 -0
- package/out/Default/gen/src/config/ConfigParser.js +163 -0
- package/out/Default/gen/src/config/ConfigWatcher.js +94 -0
- package/out/Default/gen/src/config/ServerConfig.js +284 -0
- package/out/Default/gen/src/config/browser-options.js +135 -0
- package/out/Default/gen/src/config/category-options.js +84 -0
- package/out/Default/gen/src/config/cli-commands.js +208 -0
- package/out/Default/gen/src/config/cli-options.js +2090 -0
- package/out/Default/gen/src/config/mcp-options.js +371 -0
- package/out/Default/gen/src/config/puppeteer-options.js +69 -0
- package/out/Default/gen/src/config/tool-options.js +60 -0
- package/out/Default/gen/src/daemon/client.js +281 -0
- package/out/Default/gen/src/daemon/daemon.js +280 -0
- package/out/Default/gen/src/daemon/types.js +7 -0
- package/out/Default/gen/src/daemon/utils.js +173 -0
- package/out/Default/gen/src/devtools/DevToolsCommentBridge.js +151 -0
- package/out/Default/gen/src/devtools/DevtoolsUtils.js +413 -0
- package/out/Default/gen/src/devtools/McpHostBindingAdapter.js +164 -0
- package/out/Default/gen/src/devtools/issueDescriptions.js +42 -0
- package/out/Default/gen/src/formatters/CommentFormatter.js +73 -0
- package/out/Default/gen/src/formatters/ConsoleFormatter.js +363 -0
- package/out/Default/gen/src/formatters/CssFormatter.js +883 -0
- package/out/Default/gen/src/formatters/HeapSnapshotFormatter.js +239 -0
- package/out/Default/gen/src/formatters/IssueFormatter.js +194 -0
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/out/Default/gen/src/formatters/NetworkFormatter.js +295 -0
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +57 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/out/Default/gen/src/formatters/SnapshotFormatter.js +172 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/formatters/constants.js +8 -0
- package/out/Default/gen/src/index.js +434 -0
- package/out/Default/gen/src/processors/ChunkedTraceParser.js +361 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +595 -0
- package/out/Default/gen/src/processors/PerformanceTrace.js +132 -0
- package/out/Default/gen/src/telemetry/ClearcutLogger.js +271 -0
- package/out/Default/gen/src/telemetry/WatchdogClient.js +60 -0
- package/out/Default/gen/src/telemetry/errors.js +18 -0
- package/out/Default/gen/src/telemetry/flagUtils.js +89 -0
- package/out/Default/gen/src/telemetry/metricsRegistry.js +85 -0
- package/out/Default/gen/src/telemetry/persistence.js +82 -0
- package/out/Default/gen/src/telemetry/transformation.js +229 -0
- package/out/Default/gen/src/telemetry/types.js +36 -0
- package/out/Default/gen/src/telemetry/watchdog/ClearcutSender.js +213 -0
- package/out/Default/gen/src/telemetry/watchdog/main.js +142 -0
- package/out/Default/gen/src/third_party/THIRD_PARTY_NOTICES +3774 -0
- package/out/Default/gen/src/third_party/browser.js +808 -0
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +139 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +125 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +111 -0
- package/out/Default/gen/src/third_party/index.js +128 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
- package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/out/Default/gen/src/tools/categories.js +37 -0
- package/out/Default/gen/src/tools/comments.js +230 -0
- package/out/Default/gen/src/tools/console.js +122 -0
- package/out/Default/gen/src/tools/css.js +54 -0
- package/out/Default/gen/src/tools/emulation.js +98 -0
- package/out/Default/gen/src/tools/extensions.js +108 -0
- package/out/Default/gen/src/tools/input.js +658 -0
- package/out/Default/gen/src/tools/lighthouse.js +279 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/memory.js +531 -0
- package/out/Default/gen/src/tools/network.js +325 -0
- package/out/Default/gen/src/tools/pages.js +420 -0
- package/out/Default/gen/src/tools/performance.js +258 -0
- package/out/Default/gen/src/tools/pwa.js +152 -0
- package/out/Default/gen/src/tools/screencast.js +160 -0
- package/out/Default/gen/src/tools/screenshot.js +315 -0
- package/out/Default/gen/src/tools/script.js +319 -0
- package/out/Default/gen/src/tools/slim/tools.js +110 -0
- package/out/Default/gen/src/tools/snapshot.js +88 -0
- package/out/Default/gen/src/tools/thirdPartyDeveloper.js +73 -0
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/out/Default/gen/src/tools/tools.js +72 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/out/Default/gen/src/tools/webmcp.js +55 -0
- package/out/Default/gen/src/types.js +21 -0
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/out/Default/gen/src/utils/WaitForHelper.js +343 -0
- package/out/Default/gen/src/utils/bytes.js +95 -0
- package/out/Default/gen/src/utils/check-for-updates.js +81 -0
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/out/Default/gen/src/utils/errorHandling.js +23 -0
- package/out/Default/gen/src/utils/files.js +81 -0
- package/out/Default/gen/src/utils/id.js +16 -0
- package/out/Default/gen/src/utils/keyboard.js +307 -0
- package/out/Default/gen/src/utils/logger.js +145 -0
- package/out/Default/gen/src/utils/logpoint.js +44 -0
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/pagination.js +50 -0
- package/out/Default/gen/src/utils/polyfill.js +11 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/out/Default/gen/src/utils/resourceType.js +27 -0
- package/out/Default/gen/src/utils/text.js +43 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/out/Default/gen/src/utils/url.js +311 -0
- package/out/Default/gen/src/version.js +11 -0
- package/package.json +125 -4
- package/skills/a11y-debugging/SKILL.md +86 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/arc-compatibility/SKILL.md +174 -0
- package/skills/arc-compatibility/SOURCES.md +238 -0
- package/skills/arc-compatibility/references/compatibility.md +115 -0
- package/skills/arc-compatibility/references/output-contract.md +62 -0
- package/skills/arc-compatibility/references/workflows.md +108 -0
- package/skills/chrome-devtools/SKILL.md +80 -0
- package/skills/chrome-devtools-cli/SKILL.md +208 -0
- package/skills/chrome-devtools-cli/references/installation.md +24 -0
- package/skills/cookie-debugging/SKILL.md +152 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/inspect-in-devtools/SKILL.md +82 -0
- package/skills/memory-leak-debugging/SKILL.md +58 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/troubleshooting/SKILL.md +107 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { DevTools, } from '../third_party/browser.js';
|
|
7
|
+
import { McpHostBindingAdapter } from './McpHostBindingAdapter.js';
|
|
8
|
+
/**
|
|
9
|
+
* A mock implementation of an issues manager that only implements the methods
|
|
10
|
+
* that are actually used by the IssuesAggregator
|
|
11
|
+
*/
|
|
12
|
+
export class FakeIssuesManager extends DevTools.Common.ObjectWrapper
|
|
13
|
+
.ObjectWrapper {
|
|
14
|
+
issues() {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function overrideDevToolsGlobals({ loadResource, }) {
|
|
19
|
+
DevTools.Host.InspectorFrontendHost.installInspectorFrontendHost(new McpHostBindingAdapter(loadResource));
|
|
20
|
+
// DevTools CDP errors can get noisy.
|
|
21
|
+
DevTools.ProtocolClient.InspectorBackend.test.suppressRequestErrors = true;
|
|
22
|
+
const noopAgentCommand = () => {
|
|
23
|
+
return Promise.resolve({
|
|
24
|
+
getError: () => undefined,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
// Stub out Network emulation commands on the DevTools Agent prototype globally.
|
|
28
|
+
// This prevents the DevTools Frontend from ever resetting/clearing Puppeteer's
|
|
29
|
+
// active network blocking/throttling rules during target setup or session lifetime.
|
|
30
|
+
const networkAgentPrototype = DevTools.ProtocolClient.InspectorBackend.inspectorBackend.agentPrototypes.get('Network');
|
|
31
|
+
if (networkAgentPrototype) {
|
|
32
|
+
Object.defineProperty(networkAgentPrototype, 'invoke_emulateNetworkConditionsByRule', {
|
|
33
|
+
value: () => {
|
|
34
|
+
return Promise.resolve({
|
|
35
|
+
ruleIds: [],
|
|
36
|
+
getError: () => undefined,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
writable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
enumerable: true,
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(networkAgentPrototype, 'invoke_overrideNetworkState', {
|
|
44
|
+
value: noopAgentCommand,
|
|
45
|
+
writable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
enumerable: true,
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(networkAgentPrototype, 'invoke_enable', {
|
|
50
|
+
value: noopAgentCommand,
|
|
51
|
+
writable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(networkAgentPrototype, 'invoke_disable', {
|
|
56
|
+
value: noopAgentCommand,
|
|
57
|
+
writable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
enumerable: true,
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(networkAgentPrototype, 'invoke_setBlockedURLs', {
|
|
62
|
+
value: noopAgentCommand,
|
|
63
|
+
writable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Puppeteer already collects issues from its own Audits subscription. Avoid
|
|
69
|
+
// enabling the DevTools Frontend's redundant subscription, which can replay
|
|
70
|
+
// a large retained issue backlog and delay unrelated page work.
|
|
71
|
+
const auditsAgentPrototype = DevTools.ProtocolClient.InspectorBackend.inspectorBackend.agentPrototypes.get('Audits');
|
|
72
|
+
if (auditsAgentPrototype) {
|
|
73
|
+
Object.defineProperty(auditsAgentPrototype, 'invoke_enable', {
|
|
74
|
+
value: noopAgentCommand,
|
|
75
|
+
writable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
DevTools.I18n.DevToolsLocale.DevToolsLocale.instance({
|
|
81
|
+
create: true,
|
|
82
|
+
data: {
|
|
83
|
+
navigatorLanguage: 'en-US',
|
|
84
|
+
settingLanguage: 'en-US',
|
|
85
|
+
lookupClosestDevToolsLocale: l => l,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
DevTools.I18n.i18n.registerLocaleDataForTest('en-US', {});
|
|
89
|
+
DevTools.Formatter.FormatterWorkerPool.FormatterWorkerPool.instance({
|
|
90
|
+
forceNew: true,
|
|
91
|
+
entrypointURL: import.meta
|
|
92
|
+
.resolve('../third_party/devtools-formatter-worker.js'),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export async function createTargetUniverse(session, options) {
|
|
96
|
+
const settingStorage = new DevTools.Common.Settings.SettingsStorage({});
|
|
97
|
+
const universe = new DevTools.Foundation.Universe.Universe({
|
|
98
|
+
settingsCreationOptions: {
|
|
99
|
+
syncedStorage: settingStorage,
|
|
100
|
+
globalStorage: settingStorage,
|
|
101
|
+
localStorage: settingStorage,
|
|
102
|
+
settingRegistrations: DevTools.Common.SettingRegistration.getRegisteredSettings(),
|
|
103
|
+
},
|
|
104
|
+
overrideAutoStartModels: new Set([DevTools.DebuggerModel]),
|
|
105
|
+
hostConfig: {},
|
|
106
|
+
inspectorFrontendHost: DevTools.Host.InspectorFrontendHost.InspectorFrontendHostInstance,
|
|
107
|
+
supportsEmulation: false,
|
|
108
|
+
});
|
|
109
|
+
const sourceMaps = options?.sourceMaps ?? true;
|
|
110
|
+
const jsSourceMapsSetting = universe.settings.resolve(DevTools.SDKSettings.jsSourceMapsEnabledSettingDescriptor);
|
|
111
|
+
jsSourceMapsSetting.set(sourceMaps);
|
|
112
|
+
const cssSourceMapsSetting = universe.settings.resolve(DevTools.SDKSettings.cssSourceMapsEnabledSettingDescriptor);
|
|
113
|
+
cssSourceMapsSetting.set(sourceMaps);
|
|
114
|
+
const setting = universe.settings.resolve(DevTools.SourceMapManager.lazyLoadingSettingDescriptor);
|
|
115
|
+
setting.set(true);
|
|
116
|
+
const skipAllPausesSetting = universe.settings.resolve(DevTools.skipAllPausesSettingDescriptor);
|
|
117
|
+
skipAllPausesSetting.set(true);
|
|
118
|
+
// @ts-expect-error devtools-frontend has different types.
|
|
119
|
+
const connection = new DevTools.PuppeteerDevToolsConnection(session);
|
|
120
|
+
const targetManager = universe.context.get(DevTools.TargetManager);
|
|
121
|
+
targetManager.observeModels(DevTools.NetworkManager.NetworkManager, DISABLE_NETWORK);
|
|
122
|
+
const target = targetManager.createTarget('main', '', 'frame', // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
123
|
+
/* parentTarget */ null, session.id(), undefined, connection);
|
|
124
|
+
return { target, universe, session };
|
|
125
|
+
}
|
|
126
|
+
// Not recording network requests in the DevTools universe.
|
|
127
|
+
//
|
|
128
|
+
// The network requests are collected through pptr and there isn't a use case for
|
|
129
|
+
// enabling devtools SDK's network domain.
|
|
130
|
+
const DISABLE_NETWORK = {
|
|
131
|
+
modelAdded(model) {
|
|
132
|
+
void model.target().networkAgent().invoke_disable();
|
|
133
|
+
},
|
|
134
|
+
modelRemoved() {
|
|
135
|
+
// Do nothing.
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Maximum number of `cause` links resolved for one error. A page can create a
|
|
140
|
+
* cyclic chain (`error.cause = error`), and CDP returns a new object id on
|
|
141
|
+
* every lookup of the same object, so a cycle cannot be detected by id.
|
|
142
|
+
*/
|
|
143
|
+
const MAX_CAUSE_DEPTH = 10;
|
|
144
|
+
/**
|
|
145
|
+
* Constructed from Runtime.ExceptionDetails of an uncaught error.
|
|
146
|
+
*
|
|
147
|
+
* TODO: Also construct from a RemoteObject of subtype 'error'.
|
|
148
|
+
*
|
|
149
|
+
* Consists of the message, a fully resolved stack trace and a fully resolved 'cause' chain.
|
|
150
|
+
*/
|
|
151
|
+
export class SymbolizedError {
|
|
152
|
+
message;
|
|
153
|
+
stackTrace;
|
|
154
|
+
cause;
|
|
155
|
+
constructor(message, stackTrace, cause) {
|
|
156
|
+
this.message = message;
|
|
157
|
+
this.stackTrace = stackTrace;
|
|
158
|
+
this.cause = cause;
|
|
159
|
+
}
|
|
160
|
+
static async fromDetails(opts) {
|
|
161
|
+
return await SymbolizedError.#fromDetails(opts, 0);
|
|
162
|
+
}
|
|
163
|
+
static async #fromDetails(opts, causeDepth) {
|
|
164
|
+
const message = SymbolizedError.#getMessage(opts.details);
|
|
165
|
+
if (!opts.includeStackAndCause || (!opts.devTools && !opts.session)) {
|
|
166
|
+
return new SymbolizedError(message, opts.resolvedStackTraceForTesting, opts.resolvedCauseForTesting);
|
|
167
|
+
}
|
|
168
|
+
let stackTrace;
|
|
169
|
+
if (opts.resolvedStackTraceForTesting) {
|
|
170
|
+
stackTrace = opts.resolvedStackTraceForTesting;
|
|
171
|
+
}
|
|
172
|
+
else if (opts.devTools && opts.details.stackTrace) {
|
|
173
|
+
try {
|
|
174
|
+
stackTrace = await createStackTrace(opts.devTools, opts.details.stackTrace, opts.targetId);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// ignore
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// TODO: Turn opts.details.exception into a JSHandle and retrieve the 'cause' property.
|
|
181
|
+
// If its an Error, recursively create a SymbolizedError.
|
|
182
|
+
let cause;
|
|
183
|
+
if (opts.resolvedCauseForTesting) {
|
|
184
|
+
cause = opts.resolvedCauseForTesting;
|
|
185
|
+
}
|
|
186
|
+
else if (opts.details.exception && causeDepth < MAX_CAUSE_DEPTH) {
|
|
187
|
+
try {
|
|
188
|
+
const causeRemoteObj = await SymbolizedError.#lookupCause(opts.devTools, opts.details.exception, opts.targetId, opts.session);
|
|
189
|
+
if (causeRemoteObj) {
|
|
190
|
+
cause = await SymbolizedError.#fromError({
|
|
191
|
+
devTools: opts.devTools,
|
|
192
|
+
error: causeRemoteObj,
|
|
193
|
+
targetId: opts.targetId,
|
|
194
|
+
session: opts.session,
|
|
195
|
+
}, causeDepth + 1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// Ignore
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return new SymbolizedError(message, stackTrace, cause);
|
|
203
|
+
}
|
|
204
|
+
static async fromError(opts) {
|
|
205
|
+
return await SymbolizedError.#fromError(opts, 0);
|
|
206
|
+
}
|
|
207
|
+
static async #fromError(opts, causeDepth) {
|
|
208
|
+
const details = await SymbolizedError.#getExceptionDetails(opts.devTools, opts.error, opts.targetId, opts.session);
|
|
209
|
+
if (details) {
|
|
210
|
+
return await SymbolizedError.#fromDetails({
|
|
211
|
+
details,
|
|
212
|
+
devTools: opts.devTools,
|
|
213
|
+
targetId: opts.targetId,
|
|
214
|
+
session: opts.session,
|
|
215
|
+
includeStackAndCause: true,
|
|
216
|
+
}, causeDepth);
|
|
217
|
+
}
|
|
218
|
+
return new SymbolizedError(SymbolizedError.#getMessageFromException(opts.error));
|
|
219
|
+
}
|
|
220
|
+
static #getMessage(details) {
|
|
221
|
+
// For Runtime.exceptionThrown with a present exception object, `details.text` will be "Uncaught" and
|
|
222
|
+
// we have to manually parse out the error text from the exception description.
|
|
223
|
+
// In the case of Runtime.getExceptionDetails, `details.text` has the Error.message.
|
|
224
|
+
// Unhandled promise rejections work the same way, with
|
|
225
|
+
// "Uncaught (in promise)" as `details.text` and the rejection reason as
|
|
226
|
+
// the exception.
|
|
227
|
+
if ((details.text === 'Uncaught' ||
|
|
228
|
+
details.text === 'Uncaught (in promise)') &&
|
|
229
|
+
details.exception) {
|
|
230
|
+
return (details.text +
|
|
231
|
+
' ' +
|
|
232
|
+
SymbolizedError.#getMessageFromException(details.exception));
|
|
233
|
+
}
|
|
234
|
+
return details.text;
|
|
235
|
+
}
|
|
236
|
+
static #getMessageFromException(error) {
|
|
237
|
+
if (error.description === undefined) {
|
|
238
|
+
// Primitive values, e.g. `Promise.reject('reason')`, have no description.
|
|
239
|
+
if (error.unserializableValue !== undefined) {
|
|
240
|
+
return error.unserializableValue;
|
|
241
|
+
}
|
|
242
|
+
return error.value === undefined ? '' : String(error.value);
|
|
243
|
+
}
|
|
244
|
+
const messageWithRest = error.description.split('\n at ', 2);
|
|
245
|
+
return messageWithRest[0] ?? '';
|
|
246
|
+
}
|
|
247
|
+
static async #getExceptionDetails(devTools, error, targetId, session) {
|
|
248
|
+
if (error.type !== 'object' && error.subtype !== 'error') {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
if (session) {
|
|
252
|
+
if (!error.objectId) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
const { exceptionDetails } = await session.send('Runtime.getExceptionDetails', { errorObjectId: error.objectId });
|
|
256
|
+
return exceptionDetails ?? null;
|
|
257
|
+
}
|
|
258
|
+
if (!devTools) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
262
|
+
const target = targetId
|
|
263
|
+
? targetManager.targetById(targetId) || devTools.target
|
|
264
|
+
: devTools.target;
|
|
265
|
+
const model = target.model(DevTools.RuntimeModel);
|
|
266
|
+
return ((await model.getExceptionDetails(error.objectId)) ?? null);
|
|
267
|
+
}
|
|
268
|
+
static async #lookupCause(devTools, error, targetId, session) {
|
|
269
|
+
if (error.type !== 'object' && error.subtype !== 'error') {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
if (session) {
|
|
273
|
+
if (!error.objectId) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const { result } = await session.send('Runtime.getProperties', {
|
|
277
|
+
objectId: error.objectId,
|
|
278
|
+
});
|
|
279
|
+
return result.find(prop => prop.name === 'cause')?.value ?? null;
|
|
280
|
+
}
|
|
281
|
+
if (!devTools) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
285
|
+
const target = targetId
|
|
286
|
+
? targetManager.targetById(targetId) || devTools.target
|
|
287
|
+
: devTools.target;
|
|
288
|
+
const properties = await target.runtimeAgent().invoke_getProperties({
|
|
289
|
+
objectId: error.objectId,
|
|
290
|
+
});
|
|
291
|
+
if (properties.getError()) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
return properties.result.find(prop => prop.name === 'cause')?.value ?? null;
|
|
295
|
+
}
|
|
296
|
+
static createForTesting(message, stackTrace, cause) {
|
|
297
|
+
return new SymbolizedError(message, stackTrace, cause);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
export async function createStackTraceForConsoleMessage(devTools, consoleMessage) {
|
|
301
|
+
const message = consoleMessage;
|
|
302
|
+
const rawStackTrace = message._rawStackTrace();
|
|
303
|
+
if (rawStackTrace) {
|
|
304
|
+
return await createStackTrace(devTools, rawStackTrace, message._targetId());
|
|
305
|
+
}
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
export async function createStackTrace(devTools, rawStackTrace, targetId) {
|
|
309
|
+
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
310
|
+
const target = targetId
|
|
311
|
+
? targetManager.targetById(targetId) || devTools.target
|
|
312
|
+
: devTools.target;
|
|
313
|
+
const model = target.model(DevTools.DebuggerModel);
|
|
314
|
+
// DevTools doesn't wait for source maps to attach before building a stack trace, rather it'll send
|
|
315
|
+
// an update event once a source map was attached and the stack trace retranslated. This doesn't
|
|
316
|
+
// work in the MCP case, so we'll collect all script IDs upfront and wait for any pending source map
|
|
317
|
+
// loads before creating the stack trace. We might also have to wait for Debugger.ScriptParsed events if
|
|
318
|
+
// the stack trace is created particularly early.
|
|
319
|
+
const scriptUrls = new Map();
|
|
320
|
+
for (const frame of rawStackTrace.callFrames) {
|
|
321
|
+
scriptUrls.set(frame.scriptId, frame.url);
|
|
322
|
+
}
|
|
323
|
+
for (let asyncStack = rawStackTrace.parent; asyncStack; asyncStack = asyncStack.parent) {
|
|
324
|
+
for (const frame of asyncStack.callFrames) {
|
|
325
|
+
scriptUrls.set(frame.scriptId, frame.url);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const signal = AbortSignal.timeout(1_000);
|
|
329
|
+
const scripts = await Promise.all([...scriptUrls].map(async ([scriptId, url]) => {
|
|
330
|
+
try {
|
|
331
|
+
const script = await waitForScript(model, scriptId, signal);
|
|
332
|
+
// V8 leaves data: URLs out of stack frames.
|
|
333
|
+
const scriptUrl = script.sourceURL.startsWith('data:')
|
|
334
|
+
? ''
|
|
335
|
+
: script.sourceURL;
|
|
336
|
+
// Script ids restart in a new renderer process, so after a
|
|
337
|
+
// cross-process navigation the id can belong to another script.
|
|
338
|
+
return scriptUrl === url ? script : undefined;
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
// The script is gone, e.g. after a navigation.
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
}));
|
|
345
|
+
const knownScripts = scripts.filter(script => script !== undefined);
|
|
346
|
+
await waitForSourceMaps(model, knownScripts, signal);
|
|
347
|
+
const knownScriptIds = new Set(knownScripts.map(script => script.scriptId));
|
|
348
|
+
const binding = devTools.universe.context.get(DevTools.DebuggerWorkspaceBinding);
|
|
349
|
+
// DevTools uses branded types for ScriptId and others. Casting the puppeteer protocol type to the DevTools protocol type is safe.
|
|
350
|
+
return await binding.createStackTraceFromProtocolRuntime(withUnknownScriptsRaw(rawStackTrace, knownScriptIds), target);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Copies `stackTrace` and gives the frames of scripts that are not in
|
|
354
|
+
* `knownScriptIds` the script id 0, which V8 never assigns, so DevTools
|
|
355
|
+
* resolves them neither by id nor by URL and keeps their raw location.
|
|
356
|
+
*/
|
|
357
|
+
function withUnknownScriptsRaw(stackTrace, knownScriptIds) {
|
|
358
|
+
const copy = {
|
|
359
|
+
...stackTrace,
|
|
360
|
+
callFrames: stackTrace.callFrames.map(frame => knownScriptIds.has(frame.scriptId) ? frame : { ...frame, scriptId: '0' }),
|
|
361
|
+
};
|
|
362
|
+
if (stackTrace.parent) {
|
|
363
|
+
copy.parent = withUnknownScriptsRaw(stackTrace.parent, knownScriptIds);
|
|
364
|
+
}
|
|
365
|
+
return copy;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Waits for the source maps of `scripts` to load, so that their original
|
|
369
|
+
* sources are in the workspace. Scripts without a source map are skipped.
|
|
370
|
+
* Non-trivial pages have hundreds of source maps, so the wait ends when
|
|
371
|
+
* `signal` aborts; loads still pending then continue in the background and
|
|
372
|
+
* resolve later.
|
|
373
|
+
*/
|
|
374
|
+
export async function waitForSourceMaps(model, scripts, signal) {
|
|
375
|
+
const manager = model.sourceMapManager();
|
|
376
|
+
const aborted = new Promise(resolve => {
|
|
377
|
+
if (signal.aborted) {
|
|
378
|
+
resolve();
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
signal.addEventListener('abort', () => resolve(), { once: true });
|
|
382
|
+
});
|
|
383
|
+
await Promise.all([...scripts].map(script => {
|
|
384
|
+
if (!script.sourceMapURL) {
|
|
385
|
+
return undefined;
|
|
386
|
+
}
|
|
387
|
+
return Promise.race([
|
|
388
|
+
manager.sourceMapForClientPromise(script).then(() => undefined),
|
|
389
|
+
aborted,
|
|
390
|
+
]);
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
// Waits indefinitely for the script so pair it with Promise.race.
|
|
394
|
+
async function waitForScript(model, scriptId, signal) {
|
|
395
|
+
while (true) {
|
|
396
|
+
if (signal.aborted) {
|
|
397
|
+
throw signal.reason;
|
|
398
|
+
}
|
|
399
|
+
const script = model.scriptForId(scriptId);
|
|
400
|
+
if (script) {
|
|
401
|
+
return script;
|
|
402
|
+
}
|
|
403
|
+
await new Promise((resolve, reject) => {
|
|
404
|
+
signal.addEventListener('abort', () => reject(signal.reason), {
|
|
405
|
+
once: true,
|
|
406
|
+
});
|
|
407
|
+
void model
|
|
408
|
+
.once('ParsedScriptSource')
|
|
409
|
+
.then(resolve);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=DevtoolsUtils.js.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { DevTools } from '../third_party/browser.js';
|
|
7
|
+
/**
|
|
8
|
+
* BaseClass that is noop or throws for methods.
|
|
9
|
+
* the McpHostBindingAdapter should only implement methods
|
|
10
|
+
* that it needs to support.
|
|
11
|
+
*/
|
|
12
|
+
class BaseMcpHostBindingAdapter {
|
|
13
|
+
connectAutomaticFileSystem() { }
|
|
14
|
+
disconnectAutomaticFileSystem() { }
|
|
15
|
+
addFileSystem() { }
|
|
16
|
+
loadCompleted() { }
|
|
17
|
+
indexPath() { }
|
|
18
|
+
setInspectedPageBounds() { }
|
|
19
|
+
showCertificateViewer() { }
|
|
20
|
+
setWhitelistedShortcuts() { }
|
|
21
|
+
setEyeDropperActive() { }
|
|
22
|
+
inspectElementCompleted() { }
|
|
23
|
+
openInNewTab() { }
|
|
24
|
+
openSearchResultsInNewTab() { }
|
|
25
|
+
showItemInFolder() { }
|
|
26
|
+
removeFileSystem() { }
|
|
27
|
+
requestFileSystems() { }
|
|
28
|
+
save() { }
|
|
29
|
+
append() { }
|
|
30
|
+
close() { }
|
|
31
|
+
searchInPath() { }
|
|
32
|
+
stopIndexing() { }
|
|
33
|
+
bringToFront() { }
|
|
34
|
+
closeWindow() { }
|
|
35
|
+
copyText() { }
|
|
36
|
+
inspectedURLChanged() { }
|
|
37
|
+
isolatedFileSystem() {
|
|
38
|
+
throw new Error('Not implemented');
|
|
39
|
+
}
|
|
40
|
+
registerPreference() { }
|
|
41
|
+
getPreferences() { }
|
|
42
|
+
getPreference() { }
|
|
43
|
+
setPreference() { }
|
|
44
|
+
removePreference() { }
|
|
45
|
+
clearPreferences() { }
|
|
46
|
+
getSyncInformation() { }
|
|
47
|
+
getHostConfig() { }
|
|
48
|
+
upgradeDraggedFileSystemPermissions() { }
|
|
49
|
+
platform() {
|
|
50
|
+
throw new Error('Not implemented');
|
|
51
|
+
}
|
|
52
|
+
recordCountHistogram() { }
|
|
53
|
+
recordEnumeratedHistogram() { }
|
|
54
|
+
recordPerformanceHistogram() { }
|
|
55
|
+
recordPerformanceHistogramMedium() { }
|
|
56
|
+
recordUserMetricsAction() { }
|
|
57
|
+
recordNewBadgeUsage() { }
|
|
58
|
+
sendMessageToBackend() { }
|
|
59
|
+
setDevicesDiscoveryConfig() { }
|
|
60
|
+
setDevicesUpdatesEnabled() { }
|
|
61
|
+
openRemotePage() { }
|
|
62
|
+
openNodeFrontend() { }
|
|
63
|
+
setInjectedScriptForOrigin() { }
|
|
64
|
+
setIsDocked() { }
|
|
65
|
+
showSurvey() { }
|
|
66
|
+
canShowSurvey() { }
|
|
67
|
+
zoomFactor() {
|
|
68
|
+
throw new Error('Not implemented');
|
|
69
|
+
}
|
|
70
|
+
zoomIn() { }
|
|
71
|
+
zoomOut() { }
|
|
72
|
+
resetZoom() { }
|
|
73
|
+
showContextMenuAtPoint() { }
|
|
74
|
+
reattach() { }
|
|
75
|
+
readyForTest() { }
|
|
76
|
+
connectionReady() { }
|
|
77
|
+
setOpenNewWindowForPopups() { }
|
|
78
|
+
isHostedMode() {
|
|
79
|
+
throw new Error('Not implemented');
|
|
80
|
+
}
|
|
81
|
+
setAddExtensionCallback() { }
|
|
82
|
+
initialTargetId() {
|
|
83
|
+
throw new Error('Not implemented');
|
|
84
|
+
}
|
|
85
|
+
doAidaConversation(_request, _streamId, cb) {
|
|
86
|
+
cb({
|
|
87
|
+
error: 'Not implemented',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
registerAidaClientEvent(_request, cb) {
|
|
91
|
+
cb({
|
|
92
|
+
error: 'Not implemented',
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
aidaCodeComplete(_request, cb) {
|
|
96
|
+
cb({
|
|
97
|
+
error: 'Not implemented',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
dispatchHttpRequest(_request, cb) {
|
|
101
|
+
cb({
|
|
102
|
+
error: 'Not implemented',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
recordImpression() { }
|
|
106
|
+
recordResize() { }
|
|
107
|
+
recordClick() { }
|
|
108
|
+
recordHover() { }
|
|
109
|
+
recordDrag() { }
|
|
110
|
+
recordChange() { }
|
|
111
|
+
recordKeyDown() { }
|
|
112
|
+
recordSettingAccess() { }
|
|
113
|
+
recordFunctionCall() { }
|
|
114
|
+
setChromeFlag() { }
|
|
115
|
+
requestRestart() { }
|
|
116
|
+
loadNetworkResource(_urlString, _headers, _streamId, _callback) { }
|
|
117
|
+
}
|
|
118
|
+
export class McpHostBindingAdapter extends BaseMcpHostBindingAdapter {
|
|
119
|
+
#loadResource;
|
|
120
|
+
constructor(loadResource) {
|
|
121
|
+
super();
|
|
122
|
+
this.#loadResource = loadResource;
|
|
123
|
+
}
|
|
124
|
+
isolatedFileSystem() {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
platform() {
|
|
128
|
+
switch (process.platform) {
|
|
129
|
+
case 'darwin':
|
|
130
|
+
return 'mac';
|
|
131
|
+
case 'win32':
|
|
132
|
+
return 'windows';
|
|
133
|
+
default:
|
|
134
|
+
return 'linux';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
zoomFactor() {
|
|
138
|
+
return 1;
|
|
139
|
+
}
|
|
140
|
+
isHostedMode() {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
initialTargetId() {
|
|
144
|
+
return Promise.resolve(null);
|
|
145
|
+
}
|
|
146
|
+
loadNetworkResource(urlString, _headers, streamId, callback) {
|
|
147
|
+
if (!URL.canParse(urlString)) {
|
|
148
|
+
callback({
|
|
149
|
+
statusCode: 404,
|
|
150
|
+
urlValid: false,
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.#loadResource(urlString)
|
|
155
|
+
.then(content => {
|
|
156
|
+
DevTools.Host.ResourceLoader.streamWrite(streamId, content);
|
|
157
|
+
callback({ statusCode: 200 });
|
|
158
|
+
})
|
|
159
|
+
.catch(() => {
|
|
160
|
+
callback({ statusCode: 404 });
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=McpHostBindingAdapter.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
const DESCRIPTIONS_PATH = path.join(import.meta.dirname, '../third_party/issue-descriptions');
|
|
9
|
+
let issueDescriptions = {};
|
|
10
|
+
/**
|
|
11
|
+
* Reads all issue descriptions from the filesystem into memory.
|
|
12
|
+
*/
|
|
13
|
+
export async function loadIssueDescriptions() {
|
|
14
|
+
if (Object.keys(issueDescriptions).length > 0) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const files = await fs.promises.readdir(DESCRIPTIONS_PATH);
|
|
18
|
+
const descriptions = {};
|
|
19
|
+
const results = await Promise.all(files
|
|
20
|
+
.filter(file => file.endsWith('.md'))
|
|
21
|
+
.map(async (file) => {
|
|
22
|
+
const content = await fs.promises.readFile(path.join(DESCRIPTIONS_PATH, file), 'utf-8');
|
|
23
|
+
return { file, content };
|
|
24
|
+
}));
|
|
25
|
+
for (const { file, content } of results) {
|
|
26
|
+
descriptions[file] = content;
|
|
27
|
+
}
|
|
28
|
+
issueDescriptions = descriptions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets an issue description from the in-memory cache.
|
|
32
|
+
* @param fileName The file name of the issue description.
|
|
33
|
+
* @returns The description of the issue, or null if it doesn't exist.
|
|
34
|
+
*/
|
|
35
|
+
export function getIssueDescription(fileName) {
|
|
36
|
+
return issueDescriptions[fileName] ?? null;
|
|
37
|
+
}
|
|
38
|
+
export const ISSUE_UTILS = {
|
|
39
|
+
loadIssueDescriptions,
|
|
40
|
+
getIssueDescription,
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=issueDescriptions.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
function formatCommentThread(thread) {
|
|
7
|
+
const lines = [
|
|
8
|
+
`### Thread: ${thread.id}`,
|
|
9
|
+
`- Comment: ${thread.text}`,
|
|
10
|
+
];
|
|
11
|
+
if (thread.elementUid) {
|
|
12
|
+
lines.push(`- Related element uid: ${thread.elementUid}`);
|
|
13
|
+
}
|
|
14
|
+
if (thread.reqid !== undefined) {
|
|
15
|
+
lines.push(`- Related network reqid: ${thread.reqid}`);
|
|
16
|
+
}
|
|
17
|
+
return lines.join('\n');
|
|
18
|
+
}
|
|
19
|
+
function formatComments(threads) {
|
|
20
|
+
if (threads.length === 0) {
|
|
21
|
+
return 'No open DevTools comments found.';
|
|
22
|
+
}
|
|
23
|
+
const lines = [
|
|
24
|
+
`Found ${threads.length} DevTools comment thread(s):`,
|
|
25
|
+
];
|
|
26
|
+
for (const thread of threads) {
|
|
27
|
+
lines.push(`\n${formatCommentThread(thread)}`);
|
|
28
|
+
}
|
|
29
|
+
return lines.join('\n');
|
|
30
|
+
}
|
|
31
|
+
export class CommentFormatter {
|
|
32
|
+
#threads;
|
|
33
|
+
constructor(threads) {
|
|
34
|
+
this.#threads = threads;
|
|
35
|
+
}
|
|
36
|
+
static async from(threads, options) {
|
|
37
|
+
const structuredThreads = [];
|
|
38
|
+
for (const thread of threads) {
|
|
39
|
+
let elementUid;
|
|
40
|
+
const resolveBackendNodeId = options?.resolveBackendNodeId;
|
|
41
|
+
if (thread.node?.backendNodeId !== undefined && resolveBackendNodeId) {
|
|
42
|
+
elementUid = await resolveBackendNodeId(thread.node.backendNodeId);
|
|
43
|
+
}
|
|
44
|
+
let reqid;
|
|
45
|
+
const resolveCdpRequestId = options?.resolveCdpRequestId;
|
|
46
|
+
if (thread.networkRequestId !== undefined && resolveCdpRequestId) {
|
|
47
|
+
reqid = resolveCdpRequestId(thread.networkRequestId);
|
|
48
|
+
}
|
|
49
|
+
const item = {
|
|
50
|
+
id: thread.id,
|
|
51
|
+
text: thread.text,
|
|
52
|
+
};
|
|
53
|
+
if (elementUid) {
|
|
54
|
+
item.elementUid = elementUid;
|
|
55
|
+
}
|
|
56
|
+
if (reqid !== undefined) {
|
|
57
|
+
item.reqid = reqid;
|
|
58
|
+
}
|
|
59
|
+
structuredThreads.push(item);
|
|
60
|
+
}
|
|
61
|
+
return new CommentFormatter(structuredThreads);
|
|
62
|
+
}
|
|
63
|
+
static formatThread(thread) {
|
|
64
|
+
return formatCommentThread(thread);
|
|
65
|
+
}
|
|
66
|
+
toJSON() {
|
|
67
|
+
return [...this.#threads];
|
|
68
|
+
}
|
|
69
|
+
toString() {
|
|
70
|
+
return formatComments(this.toJSON());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=CommentFormatter.js.map
|