chrome-devtools-mcp 1.12.0 → 1.13.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 +1 -1
- package/{build → out/Default/gen}/src/BrowserManager.js +22 -0
- package/out/Default/gen/src/LogpointManager.js +307 -0
- package/{build → out/Default/gen}/src/McpContext.js +10 -52
- package/{build → out/Default/gen}/src/McpPage.js +181 -2
- package/{build → out/Default/gen}/src/McpResponse.js +29 -3
- package/out/Default/gen/src/NetworkOverrideManager.js +419 -0
- package/{build → out/Default/gen}/src/ToolHandler.js +53 -22
- package/{build → out/Default/gen}/src/collectors/PageCollector.js +15 -3
- package/{build → out/Default/gen}/src/config/ConfigParser.js +4 -1
- package/{build → out/Default/gen}/src/config/category-options.js +10 -0
- package/{build → out/Default/gen}/src/config/cli-options.js +188 -3
- package/{build → out/Default/gen}/src/config/mcp-options.js +1 -1
- package/{build → out/Default/gen}/src/devtools/DevtoolsUtils.js +45 -8
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/{build → out/Default/gen}/src/formatters/NetworkFormatter.js +16 -2
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +49 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/{build → out/Default/gen}/src/index.js +2 -1
- package/{build → out/Default/gen}/src/telemetry/transformation.js +1 -1
- package/{build → out/Default/gen}/src/third_party/THIRD_PARTY_NOTICES +354 -367
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +9023 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +31904 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +26467 -0
- package/out/Default/gen/src/third_party/index.js +201574 -0
- package/{build → out/Default/gen}/src/third_party/lighthouse-devtools-mcp-bundle.js +11034 -11476
- package/{build → out/Default/gen}/src/tools/ToolDefinition.js +66 -56
- package/{build → out/Default/gen}/src/tools/categories.js +4 -0
- package/{build → out/Default/gen}/src/tools/comments.js +4 -1
- package/{build → out/Default/gen}/src/tools/console.js +2 -2
- package/{build → out/Default/gen}/src/tools/extensions.js +1 -1
- package/{build → out/Default/gen}/src/tools/input.js +9 -29
- package/{build → out/Default/gen}/src/tools/lighthouse.js +6 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/network.js +260 -0
- package/{build → out/Default/gen}/src/tools/performance.js +26 -3
- package/{build → out/Default/gen}/src/tools/snapshot.js +20 -6
- package/{build → out/Default/gen}/src/tools/thirdPartyDeveloper.js +3 -19
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/{build → out/Default/gen}/src/tools/tools.js +4 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/{build → out/Default/gen}/src/tools/webmcp.js +3 -19
- package/{build → out/Default/gen}/src/utils/TaskRunner.js +31 -16
- package/{build → out/Default/gen}/src/utils/WaitForHelper.js +15 -1
- package/{build → out/Default/gen}/src/utils/check-for-updates.js +7 -1
- package/{build → out/Default/gen}/src/utils/errorHandling.js +3 -0
- package/{build → out/Default/gen}/src/utils/keyboard.js +5 -7
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/{build → out/Default/gen}/src/utils/url.js +33 -18
- package/{build → out/Default/gen}/src/version.js +1 -1
- package/package.json +25 -32
- package/skills/chrome-devtools/SKILL.md +2 -0
- package/skills/chrome-devtools-cli/SKILL.md +12 -1
- package/build/src/third_party/bundled-packages.json +0 -11
- package/build/src/third_party/cli.js +0 -9239
- package/build/src/third_party/devtools-formatter-worker.js +0 -17276
- package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -12255
- package/build/src/third_party/index.js +0 -186086
- package/build/src/tools/network.js +0 -129
- /package/{build → out/Default/gen}/src/McpWorker.js +0 -0
- /package/{build → out/Default/gen}/src/SlimMcpResponse.js +0 -0
- /package/{build → out/Default/gen}/src/TextSnapshot.js +0 -0
- /package/{build → out/Default/gen}/src/bin/check-latest-version.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp-main.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools.js +0 -0
- /package/{build → out/Default/gen}/src/collectors/ServiceWorkerCollector.js +0 -0
- /package/{build → out/Default/gen}/src/collectors/constants.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigLocator.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigWatcher.js +0 -0
- /package/{build → out/Default/gen}/src/config/ServerConfig.js +0 -0
- /package/{build → out/Default/gen}/src/config/browser-options.js +0 -0
- /package/{build → out/Default/gen}/src/config/cli-commands.js +0 -0
- /package/{build → out/Default/gen}/src/config/puppeteer-options.js +0 -0
- /package/{build → out/Default/gen}/src/config/tool-options.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/client.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/daemon.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/types.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/utils.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/DevToolsCommentBridge.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/McpHostBindingAdapter.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/issueDescriptions.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/CommentFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/ConsoleFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/CssFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/HeapSnapshotFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/IssueFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/RemoteObjectFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/SnapshotFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/processors/ChunkedTraceParser.js +0 -0
- /package/{build → out/Default/gen}/src/processors/HeapSnapshotManager.js +0 -0
- /package/{build → out/Default/gen}/src/processors/PerformanceTrace.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/ClearcutLogger.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/WatchdogClient.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/errors.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/flagUtils.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/metricsRegistry.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/persistence.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/types.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/watchdog/ClearcutSender.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/watchdog/main.js +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/LowTextContrast.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspEvalViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspInlineViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspURLViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/deprecation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/heavyAd.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/mixedContent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingId.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallNoManifest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +0 -0
- /package/{build → out/Default/gen}/src/tools/css.js +0 -0
- /package/{build → out/Default/gen}/src/tools/emulation.js +0 -0
- /package/{build → out/Default/gen}/src/tools/memory.js +0 -0
- /package/{build → out/Default/gen}/src/tools/pages.js +0 -0
- /package/{build → out/Default/gen}/src/tools/pwa.js +0 -0
- /package/{build → out/Default/gen}/src/tools/screencast.js +0 -0
- /package/{build → out/Default/gen}/src/tools/screenshot.js +0 -0
- /package/{build → out/Default/gen}/src/tools/script.js +0 -0
- /package/{build → out/Default/gen}/src/tools/slim/tools.js +0 -0
- /package/{build → out/Default/gen}/src/types.js +0 -0
- /package/{build → out/Default/gen}/src/utils/bytes.js +0 -0
- /package/{build → out/Default/gen}/src/utils/disclaimers.js +0 -0
- /package/{build → out/Default/gen}/src/utils/files.js +0 -0
- /package/{build → out/Default/gen}/src/utils/id.js +0 -0
- /package/{build → out/Default/gen}/src/utils/logger.js +0 -0
- /package/{build → out/Default/gen}/src/utils/pagination.js +0 -0
- /package/{build → out/Default/gen}/src/utils/polyfill.js +0 -0
- /package/{build → out/Default/gen}/src/utils/resourceType.js +0 -0
- /package/{build → out/Default/gen}/src/utils/text.js +0 -0
- /package/{build → out/Default/gen}/src/utils/timeout.js +0 -0
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ For basic browser tasks only, the `--slim` flag exposes a reduced set of tools.
|
|
|
177
177
|
|
|
178
178
|
## Advanced Usage
|
|
179
179
|
|
|
180
|
-
For advanced features such as handling concurrent sessions, persistent user data directories, connecting to a running Chrome instance instead of starting a new one, or debugging on Android, see our [Advanced Usage Guide][advanced-usage-guide].
|
|
180
|
+
For advanced features such as handling concurrent sessions, persistent user data directories, using a custom or non-standard browser path (`--executablePath`), connecting to a running Chrome instance instead of starting a new one, or debugging on Android, see our [Advanced Usage Guide][advanced-usage-guide].
|
|
181
181
|
|
|
182
182
|
## Integrating as a browser subagent
|
|
183
183
|
|
|
@@ -135,6 +135,24 @@ export class BrowserManager {
|
|
|
135
135
|
cause: error,
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Puppeteer reports a headed launch without a display as "Missing X server"
|
|
140
|
+
* and suggests its own `headless` option, which users of this server cannot
|
|
141
|
+
* set directly. Point them to the `--headless` flag instead.
|
|
142
|
+
*
|
|
143
|
+
* Returns `undefined` for headless launches and for unrelated failures.
|
|
144
|
+
*/
|
|
145
|
+
static missingDisplayLaunchError(error, headless) {
|
|
146
|
+
if (headless || !error.message.includes('Missing X server')) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return new Error(`Chrome failed to start: ${error.message}\n\n` +
|
|
150
|
+
'No X server is available to show a headed Chrome window. Start ' +
|
|
151
|
+
'chrome-devtools-mcp with --headless, set DISPLAY to a running X ' +
|
|
152
|
+
'server, or run chrome-devtools-mcp under xvfb-run.', {
|
|
153
|
+
cause: error,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
138
156
|
async ensureBrowser() {
|
|
139
157
|
if (this.#initPromise) {
|
|
140
158
|
return await this.#initPromise;
|
|
@@ -318,6 +336,10 @@ export class BrowserManager {
|
|
|
318
336
|
if (rootError) {
|
|
319
337
|
throw rootError;
|
|
320
338
|
}
|
|
339
|
+
const displayError = _a.missingDisplayLaunchError(error, headless);
|
|
340
|
+
if (displayError) {
|
|
341
|
+
throw displayError;
|
|
342
|
+
}
|
|
321
343
|
}
|
|
322
344
|
throw error;
|
|
323
345
|
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Script } from 'node:vm';
|
|
7
|
+
import { waitForSourceMaps, } from './devtools/DevtoolsUtils.js';
|
|
8
|
+
import { DevTools } from './third_party/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Thrown by {@link LogpointManager.setLogpoints} when some locations could
|
|
11
|
+
* not be bound. The other logpoints were applied; `logpoints` holds the
|
|
12
|
+
* resulting state.
|
|
13
|
+
*/
|
|
14
|
+
export class LogpointError extends Error {
|
|
15
|
+
logpoints;
|
|
16
|
+
constructor(message, logpoints) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = 'LogpointError';
|
|
19
|
+
this.logpoints = logpoints;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export const LOGPOINT_FORMAT = '<url>:<lineNumber>[:<columnNumber>] <expression>';
|
|
23
|
+
/**
|
|
24
|
+
* Parses a logpoint given as `<url>:<lineNumber>[:<columnNumber>] <expression>`.
|
|
25
|
+
* The url may itself contain colons (for example a port), so the location is
|
|
26
|
+
* the shortest prefix that ends in one or two numbers followed by whitespace.
|
|
27
|
+
*/
|
|
28
|
+
export function parseLogpoint(text) {
|
|
29
|
+
const match = /^(\S+?):(\d+)(?::(\d+))?\s+(\S.*)$/s.exec(text.trim());
|
|
30
|
+
if (!match) {
|
|
31
|
+
throw new Error(`Invalid logpoint "${text}". Expected the format ${LOGPOINT_FORMAT}, for example "src/app.ts:42 'total', cart.total".`);
|
|
32
|
+
}
|
|
33
|
+
const [, url, lineNumber, columnNumber, expression] = match;
|
|
34
|
+
const logpoint = {
|
|
35
|
+
url,
|
|
36
|
+
lineNumber: Number(lineNumber),
|
|
37
|
+
expression,
|
|
38
|
+
};
|
|
39
|
+
if (columnNumber !== undefined) {
|
|
40
|
+
logpoint.columnNumber = Number(columnNumber);
|
|
41
|
+
}
|
|
42
|
+
if (logpoint.lineNumber < 1 || logpoint.columnNumber === 0) {
|
|
43
|
+
throw new Error(`Invalid logpoint "${text}": line and column numbers are 1-based.`);
|
|
44
|
+
}
|
|
45
|
+
return logpoint;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks that the expression parses as `console.log()` arguments. V8 is used
|
|
49
|
+
* for parsing both here and in the browser, so an expression that is rejected
|
|
50
|
+
* here would also be rejected as a breakpoint condition. The script is only
|
|
51
|
+
* compiled, never run.
|
|
52
|
+
*/
|
|
53
|
+
export function validateExpression(expression) {
|
|
54
|
+
try {
|
|
55
|
+
new Script(`console.log(${expression})`);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw new Error(`The logpoint expression \`${expression}\` does not compile: ${error instanceof Error ? error.message : String(error)}. Provide the expression like arguments to console.log(...).`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function toUserCondition(expression) {
|
|
62
|
+
return expression;
|
|
63
|
+
}
|
|
64
|
+
function isFromSourceMap(uiSourceCode) {
|
|
65
|
+
return uiSourceCode.contentType().isFromSourceMap();
|
|
66
|
+
}
|
|
67
|
+
function locationKey(url, lineNumber, columnNumber) {
|
|
68
|
+
return `${url}:${lineNumber}${columnNumber === undefined ? '' : `:${columnNumber}`}`;
|
|
69
|
+
}
|
|
70
|
+
function baseName(url) {
|
|
71
|
+
return url.slice(url.lastIndexOf('/') + 1).toLowerCase();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* How long to wait for the source maps of the page to load before an original
|
|
75
|
+
* source URL is reported as unknown. Loads still pending then continue in the
|
|
76
|
+
* background, so a retry finds the source.
|
|
77
|
+
*/
|
|
78
|
+
const SOURCE_MAP_LOAD_TIMEOUT_MS = 5_000;
|
|
79
|
+
/**
|
|
80
|
+
* Manages logpoints for a single page on top of the `BreakpointManager` of
|
|
81
|
+
* the page's DevTools universe.
|
|
82
|
+
*
|
|
83
|
+
* A logpoint is a DevTools breakpoint with `isLogpoint` set: its condition
|
|
84
|
+
* logs the expression and never pauses. The breakpoint manager resolves the
|
|
85
|
+
* location through source maps, substitutes minified variable names in the
|
|
86
|
+
* expression and keeps the breakpoint bound across reloads and rebuilt
|
|
87
|
+
* bundles. This class only maps the tool API (URLs and 1-based positions)
|
|
88
|
+
* onto workspace source codes.
|
|
89
|
+
*/
|
|
90
|
+
export class LogpointManager {
|
|
91
|
+
#universe;
|
|
92
|
+
#target;
|
|
93
|
+
/**
|
|
94
|
+
* The breakpoints that are logpoints of this page. The breakpoint manager
|
|
95
|
+
* keeps one `Breakpoint` per normalized location, so two requested
|
|
96
|
+
* locations can share one entry.
|
|
97
|
+
*/
|
|
98
|
+
#records = new Set();
|
|
99
|
+
constructor(devTools) {
|
|
100
|
+
this.#universe = devTools.universe;
|
|
101
|
+
this.#target = devTools.target;
|
|
102
|
+
}
|
|
103
|
+
get #debuggerModel() {
|
|
104
|
+
const model = this.#target.model(DevTools.DebuggerModel);
|
|
105
|
+
if (!model) {
|
|
106
|
+
throw new Error('The DevTools debugger model is not available.');
|
|
107
|
+
}
|
|
108
|
+
return model;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Makes the given logpoints the complete set of logpoints on the page:
|
|
112
|
+
* logpoints not in the list are removed, new ones are added and the
|
|
113
|
+
* expression of an existing logpoint at the same location is replaced.
|
|
114
|
+
* Expressions and locations are validated before anything is changed.
|
|
115
|
+
* Throws a {@link LogpointError} when a location has no executable code;
|
|
116
|
+
* the other logpoints are applied regardless.
|
|
117
|
+
*/
|
|
118
|
+
async setLogpoints(desired) {
|
|
119
|
+
for (const options of desired) {
|
|
120
|
+
validateExpression(options.expression);
|
|
121
|
+
}
|
|
122
|
+
const resolved = new Map();
|
|
123
|
+
for (const options of desired) {
|
|
124
|
+
const uiSourceCode = await this.#findUISourceCode(options.url);
|
|
125
|
+
const key = locationKey(uiSourceCode.url(), options.lineNumber, options.columnNumber);
|
|
126
|
+
// The last entry for a location wins, like setting it twice would.
|
|
127
|
+
resolved.set(key, { options, uiSourceCode, key });
|
|
128
|
+
}
|
|
129
|
+
const kept = new Set();
|
|
130
|
+
const unbound = [];
|
|
131
|
+
for (const { options, uiSourceCode, key } of resolved.values()) {
|
|
132
|
+
const breakpoint = await this.#universe.breakpointManager.setBreakpoint(uiSourceCode,
|
|
133
|
+
// The tool API is 1-based like the DevTools UI; the model is 0-based.
|
|
134
|
+
options.lineNumber - 1, options.columnNumber === undefined
|
|
135
|
+
? undefined
|
|
136
|
+
: options.columnNumber - 1, toUserCondition(options.expression),
|
|
137
|
+
/* enabled */ true,
|
|
138
|
+
/* isLogpoint */ true, "USER_ACTION" /* DevTools.BreakpointManager.BreakpointOrigin.USER_ACTION */);
|
|
139
|
+
if (!breakpoint) {
|
|
140
|
+
unbound.push(key);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// Wait for the breakpoint to be set in the backend so that the result
|
|
144
|
+
// reports whether the location resolved.
|
|
145
|
+
await breakpoint.updateBreakpoint();
|
|
146
|
+
if (!this.#records.has(breakpoint) && !breakpoint.bound()) {
|
|
147
|
+
await breakpoint.remove(/* keepInStorage */ false);
|
|
148
|
+
unbound.push(key);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
this.#records.add(breakpoint);
|
|
152
|
+
kept.add(breakpoint);
|
|
153
|
+
}
|
|
154
|
+
for (const breakpoint of [...this.#records]) {
|
|
155
|
+
if (!kept.has(breakpoint)) {
|
|
156
|
+
this.#records.delete(breakpoint);
|
|
157
|
+
await breakpoint.remove(/* keepInStorage */ false);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
this.#setLazySourceMapLoading(this.#records.size === 0);
|
|
161
|
+
const logpoints = this.#currentLogpoints();
|
|
162
|
+
if (unbound.length) {
|
|
163
|
+
throw new LogpointError(`No executable code at ${unbound.join(', ')} (for example a comment, type annotation or empty line, or a line not mapped to the generated script). Pick lines containing executable code. The other logpoints were applied.`, logpoints);
|
|
164
|
+
}
|
|
165
|
+
return logpoints;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Releases the records. The breakpoints are not removed from the backend:
|
|
169
|
+
* the universe is being disposed and its session detaches, which removes
|
|
170
|
+
* them along with the page.
|
|
171
|
+
*/
|
|
172
|
+
dispose() {
|
|
173
|
+
this.#records.clear();
|
|
174
|
+
}
|
|
175
|
+
#currentLogpoints() {
|
|
176
|
+
return [...this.#records].map(breakpoint => this.#snapshot(breakpoint));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Reads the current state of a breakpoint, so that the result reflects
|
|
180
|
+
* the normalized location and the re-binding done by the breakpoint
|
|
181
|
+
* manager after reloads. The breakpoint manager may have moved a
|
|
182
|
+
* generated location to its original source, so whether the logpoint is
|
|
183
|
+
* source-mapped follows from the breakpoint, not from the request.
|
|
184
|
+
*/
|
|
185
|
+
#snapshot(breakpoint) {
|
|
186
|
+
const sourceMapped = [...breakpoint.getUiSourceCodes()].some(isFromSourceMap);
|
|
187
|
+
const modelBreakpoint = breakpoint.modelBreakpoint(this.#debuggerModel);
|
|
188
|
+
const generatedLocations = [];
|
|
189
|
+
if (breakpoint.bound()) {
|
|
190
|
+
for (const position of modelBreakpoint?.currentState ?? []) {
|
|
191
|
+
generatedLocations.push({
|
|
192
|
+
url: position.url,
|
|
193
|
+
lineNumber: position.lineNumber + 1,
|
|
194
|
+
columnNumber: (position.columnNumber ?? 0) + 1,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const columnNumber = breakpoint.columnNumber();
|
|
199
|
+
return {
|
|
200
|
+
url: breakpoint.url(),
|
|
201
|
+
lineNumber: breakpoint.lineNumber() + 1,
|
|
202
|
+
columnNumber: columnNumber === undefined ? undefined : columnNumber + 1,
|
|
203
|
+
expression: breakpoint.condition(),
|
|
204
|
+
sourceMapped,
|
|
205
|
+
generatedLocations,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Source maps load lazily by default, so after a reload the original
|
|
210
|
+
* sources of a rebuilt bundle would not re-appear in the workspace and a
|
|
211
|
+
* logpoint on an original source file could not be re-bound to the new
|
|
212
|
+
* generated location. While logpoints exist, source maps are loaded
|
|
213
|
+
* eagerly instead, like DevTools does with the Sources panel open.
|
|
214
|
+
*/
|
|
215
|
+
#setLazySourceMapLoading(lazy) {
|
|
216
|
+
this.#universe.settings
|
|
217
|
+
.resolve(DevTools.SourceMapManager.lazyLoadingSettingDescriptor)
|
|
218
|
+
.set(lazy);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Finds the workspace source code for a script or original source URL,
|
|
222
|
+
* loading source maps if needed. Throws a descriptive error, including
|
|
223
|
+
* sources with the same file name, when nothing matches.
|
|
224
|
+
*/
|
|
225
|
+
async #findUISourceCode(url) {
|
|
226
|
+
// Source maps are loaded lazily in the DevTools universe and original
|
|
227
|
+
// sources only appear in the workspace once their source map has loaded.
|
|
228
|
+
let match = this.#matchUISourceCode(url);
|
|
229
|
+
let timedOut = false;
|
|
230
|
+
if (match && !isFromSourceMap(match)) {
|
|
231
|
+
// The script may be a transpiled file served at the URL of its original
|
|
232
|
+
// source (see #matchUISourceCode); its source map decides.
|
|
233
|
+
const matchedUrl = match.url();
|
|
234
|
+
const scripts = this.#debuggerModel
|
|
235
|
+
.scripts()
|
|
236
|
+
.filter(script => script.sourceURL === matchedUrl);
|
|
237
|
+
if (scripts.some(script => script.sourceMapURL)) {
|
|
238
|
+
const signal = AbortSignal.timeout(SOURCE_MAP_LOAD_TIMEOUT_MS);
|
|
239
|
+
await waitForSourceMaps(this.#debuggerModel, scripts, signal);
|
|
240
|
+
match = this.#matchUISourceCode(url);
|
|
241
|
+
if (signal.aborted && (!match || !isFromSourceMap(match))) {
|
|
242
|
+
// Setting the logpoint on the served script would use its line
|
|
243
|
+
// numbers instead of those of the original source.
|
|
244
|
+
throw new Error(`The source map of ${matchedUrl} was still loading after ${SOURCE_MAP_LOAD_TIMEOUT_MS / 1000} seconds; retry.`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (!match) {
|
|
249
|
+
const signal = AbortSignal.timeout(SOURCE_MAP_LOAD_TIMEOUT_MS);
|
|
250
|
+
await waitForSourceMaps(this.#debuggerModel, this.#debuggerModel.scripts(), signal);
|
|
251
|
+
timedOut = signal.aborted;
|
|
252
|
+
match = this.#matchUISourceCode(url);
|
|
253
|
+
}
|
|
254
|
+
if (match) {
|
|
255
|
+
return match;
|
|
256
|
+
}
|
|
257
|
+
const name = baseName(url);
|
|
258
|
+
const similar = [...this.#pageSourceCodes()]
|
|
259
|
+
.map(uiSourceCode => uiSourceCode.url())
|
|
260
|
+
.filter(candidate => baseName(candidate) === name)
|
|
261
|
+
.slice(0, 5);
|
|
262
|
+
throw new Error(`No parsed script or original source file matches "${url}". The url must match the URL of a script as served to the browser or an original source file from a source map, exactly or as a path suffix.${timedOut ? ` Some source maps were still loading after ${SOURCE_MAP_LOAD_TIMEOUT_MS / 1000} seconds; retry if the file comes from a source map.` : ''}${similar.length ? ` Sources with the same file name: ${similar.join(', ')}.` : ''}`);
|
|
263
|
+
}
|
|
264
|
+
/** The scripts and source-map sources of the page in the workspace. */
|
|
265
|
+
*#pageSourceCodes() {
|
|
266
|
+
for (const uiSourceCode of this.#universe.workspace.uiSourceCodes()) {
|
|
267
|
+
const projectType = uiSourceCode.project().type();
|
|
268
|
+
// Content scripts of extensions are left out: they are not part of the
|
|
269
|
+
// page under development and would make path-suffix matches ambiguous.
|
|
270
|
+
if (projectType === DevTools.Workspace.Workspace.projectTypes.Network) {
|
|
271
|
+
yield uiSourceCode;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Finds the workspace source code for a script or original source URL.
|
|
277
|
+
* An exact URL match wins; otherwise the URL is matched as a path suffix so
|
|
278
|
+
* that users can pass "src/app.ts" without knowing the bundler's URL
|
|
279
|
+
* scheme. An ambiguous suffix match is reported as an error.
|
|
280
|
+
*/
|
|
281
|
+
#matchUISourceCode(url) {
|
|
282
|
+
const candidates = new Map();
|
|
283
|
+
for (const uiSourceCode of this.#pageSourceCodes()) {
|
|
284
|
+
const candidateUrl = uiSourceCode.url();
|
|
285
|
+
if (candidateUrl !== url && !candidateUrl.endsWith('/' + url)) {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
// Dev servers like Vite serve a transpiled file at the URL of its
|
|
289
|
+
// original source, with a source map pointing back at that same URL.
|
|
290
|
+
// The original source then has the line numbers of the file on disk,
|
|
291
|
+
// so it wins over the script served at the same URL.
|
|
292
|
+
const existing = candidates.get(candidateUrl);
|
|
293
|
+
if (!existing || isFromSourceMap(uiSourceCode)) {
|
|
294
|
+
candidates.set(candidateUrl, uiSourceCode);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const exact = candidates.get(url);
|
|
298
|
+
if (exact) {
|
|
299
|
+
return exact;
|
|
300
|
+
}
|
|
301
|
+
if (candidates.size > 1) {
|
|
302
|
+
throw new Error(`"${url}" matches multiple sources: ${[...candidates.keys()].join(', ')}. Specify a longer path.`);
|
|
303
|
+
}
|
|
304
|
+
return candidates.values().next().value ?? null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=LogpointManager.js.map
|
|
@@ -68,7 +68,8 @@ import { ToolCategory } from './tools/categories.js';
|
|
|
68
68
|
import { CLOSE_PAGE_ERROR, isCapabilityEnabled, } from './tools/ToolDefinition.js';
|
|
69
69
|
import { McpWorker } from './McpWorker.js';
|
|
70
70
|
import { getTempFilePath, resolveCanonicalPath } from './utils/files.js';
|
|
71
|
-
import { escapeForLog } from './utils/logger.js';
|
|
71
|
+
import { escapeForLog, redactUrlForLogging } from './utils/logger.js';
|
|
72
|
+
import { fetchWithValidatedRedirects, validateUrlNotBlocked, } from './utils/network.js';
|
|
72
73
|
import { isAllowedUrl } from './utils/url.js';
|
|
73
74
|
function hasOptionChanged(gate, previousArgs, nextArgs) {
|
|
74
75
|
return gate.options.some(option => !isDeepStrictEqual(nextArgs[option], previousArgs[option]));
|
|
@@ -958,62 +959,19 @@ export class McpContext {
|
|
|
958
959
|
async getHeapSnapshotDominators(filePath, nodeId) {
|
|
959
960
|
return await this.#heapSnapshotManager.getDominatorsOf(filePath, nodeId);
|
|
960
961
|
}
|
|
961
|
-
#validateUrlNotBlocked(url) {
|
|
962
|
-
const blocklist = this.#config.resolved.blockedUrlPattern;
|
|
963
|
-
if (!blocklist) {
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
for (const block of blocklist) {
|
|
967
|
-
const pattern = new URLPattern(block);
|
|
968
|
-
if (pattern.test(url)) {
|
|
969
|
-
throw new Error(`Blocked by blocklist: ${url}`);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
#validateUrlAllowed(url) {
|
|
974
|
-
const allowlist = this.#config.resolved.allowedUrlPattern;
|
|
975
|
-
if (!allowlist) {
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
for (const allow of allowlist) {
|
|
979
|
-
const pattern = new URLPattern(allow);
|
|
980
|
-
if (pattern.test(url)) {
|
|
981
|
-
return;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
throw new Error(`Not allowed by allowlist: ${url}`);
|
|
985
|
-
}
|
|
986
962
|
async #loadNetworkResource(url) {
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
const response = await fetch(currentUrl, { redirect: 'manual' });
|
|
994
|
-
if (!redirectStatuses.has(response.status)) {
|
|
995
|
-
if (!response.ok) {
|
|
996
|
-
throw new Error(`Failed to load resource: ${currentUrl}`);
|
|
997
|
-
}
|
|
998
|
-
return await response.text();
|
|
999
|
-
}
|
|
1000
|
-
const location = response.headers.get('location');
|
|
1001
|
-
if (!location) {
|
|
1002
|
-
throw new Error(`Failed to load resource: ${currentUrl}`);
|
|
1003
|
-
}
|
|
1004
|
-
if (redirectCount >= maxRedirects) {
|
|
1005
|
-
throw new Error(`Too many redirects loading resource: ${url}`);
|
|
1006
|
-
}
|
|
1007
|
-
await response.body?.cancel();
|
|
1008
|
-
currentUrl = new URL(location, currentUrl);
|
|
1009
|
-
if (currentUrl.protocol !== 'https:' && currentUrl.protocol !== 'http:') {
|
|
1010
|
-
throw new Error(`Unsupported protocol for: ${currentUrl}`);
|
|
1011
|
-
}
|
|
963
|
+
const response = await fetchWithValidatedRedirects(url, {
|
|
964
|
+
policy: this.#config.resolved,
|
|
965
|
+
});
|
|
966
|
+
if (!response.ok) {
|
|
967
|
+
throw new Error('Failed to load resource: ' +
|
|
968
|
+
redactUrlForLogging(response.url || url.href));
|
|
1012
969
|
}
|
|
970
|
+
return await response.text();
|
|
1013
971
|
}
|
|
1014
972
|
async loadResource(path) {
|
|
1015
973
|
const url = new URL(path);
|
|
1016
|
-
|
|
974
|
+
validateUrlNotBlocked(url, this.#config.resolved.blockedUrlPattern);
|
|
1017
975
|
switch (url.protocol) {
|
|
1018
976
|
case 'https:':
|
|
1019
977
|
case 'http:': {
|
|
@@ -58,10 +58,30 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
58
58
|
import { DevToolsCommentBridge } from './devtools/DevToolsCommentBridge.js';
|
|
59
59
|
import { createTargetUniverse, } from './devtools/DevtoolsUtils.js';
|
|
60
60
|
import { ConsoleCollector, NetworkCollector, } from './collectors/PageCollector.js';
|
|
61
|
+
import { LogpointManager } from './LogpointManager.js';
|
|
61
62
|
import { TextSnapshot } from './TextSnapshot.js';
|
|
63
|
+
import { NetworkOverrideManager, } from './NetworkOverrideManager.js';
|
|
62
64
|
import { PredefinedNetworkConditions, DevTools, lighthouseNavigation, lighthouseSnapshot, } from './third_party/index.js';
|
|
65
|
+
import { getErrorMessage } from './utils/errorHandling.js';
|
|
63
66
|
import { logger } from './utils/logger.js';
|
|
64
67
|
import { getNetworkMultiplierFromString, WaitForHelper, } from './utils/WaitForHelper.js';
|
|
68
|
+
const WEBAUTHN_PROTOCOLS = {
|
|
69
|
+
ctap2: "ctap2" /* DevTools.Protocol.WebAuthn.AuthenticatorProtocol.Ctap2 */,
|
|
70
|
+
u2f: "u2f" /* DevTools.Protocol.WebAuthn.AuthenticatorProtocol.U2f */,
|
|
71
|
+
};
|
|
72
|
+
const WEBAUTHN_TRANSPORTS = {
|
|
73
|
+
internal: "internal" /* DevTools.Protocol.WebAuthn.AuthenticatorTransport.Internal */,
|
|
74
|
+
usb: "usb" /* DevTools.Protocol.WebAuthn.AuthenticatorTransport.Usb */,
|
|
75
|
+
nfc: "nfc" /* DevTools.Protocol.WebAuthn.AuthenticatorTransport.Nfc */,
|
|
76
|
+
ble: "ble" /* DevTools.Protocol.WebAuthn.AuthenticatorTransport.Ble */,
|
|
77
|
+
hybrid: "hybrid" /* DevTools.Protocol.WebAuthn.AuthenticatorTransport.Hybrid */,
|
|
78
|
+
};
|
|
79
|
+
const WEBAUTHN_CREATION_OPTIONS = [
|
|
80
|
+
'protocol',
|
|
81
|
+
'transport',
|
|
82
|
+
'hasResidentKey',
|
|
83
|
+
'hasUserVerification',
|
|
84
|
+
];
|
|
65
85
|
export function replaceHtmlElementsWithUids(schema) {
|
|
66
86
|
if (typeof schema === 'boolean') {
|
|
67
87
|
return;
|
|
@@ -115,6 +135,7 @@ function isDebuggingWebMcpTool(tool) {
|
|
|
115
135
|
}
|
|
116
136
|
const DEFAULT_TIMEOUT = 5_000;
|
|
117
137
|
const NAVIGATION_TIMEOUT = 10_000;
|
|
138
|
+
const DEVTOOLS_UNIVERSE_TIMEOUT_MS = 5_000;
|
|
118
139
|
/**
|
|
119
140
|
* Chrome reports a URL-derived placeholder as the target title until the
|
|
120
141
|
* document provides one. The placeholder omits the `http://` / `https://`
|
|
@@ -155,6 +176,10 @@ export class McpPage {
|
|
|
155
176
|
// Metadata
|
|
156
177
|
isolatedContextName;
|
|
157
178
|
#devtoolsUniverse;
|
|
179
|
+
#webAuthnEnabled = false;
|
|
180
|
+
#webAuthnAuthenticator;
|
|
181
|
+
// Logpoints, created on first use.
|
|
182
|
+
#logpointManager;
|
|
158
183
|
// Dialog
|
|
159
184
|
#dialog;
|
|
160
185
|
#dialogHandler;
|
|
@@ -168,6 +193,7 @@ export class McpPage {
|
|
|
168
193
|
#navigationTimeout;
|
|
169
194
|
#config;
|
|
170
195
|
#commentBridge;
|
|
196
|
+
#networkOverrideManager;
|
|
171
197
|
constructor(target, id, options) {
|
|
172
198
|
this.#config = options.config;
|
|
173
199
|
this.#locatorClass = options.locatorClass;
|
|
@@ -274,6 +300,7 @@ export class McpPage {
|
|
|
274
300
|
return;
|
|
275
301
|
}
|
|
276
302
|
this.#pptrPage = page;
|
|
303
|
+
this.#networkOverrideManager = new NetworkOverrideManager(page, this.#config);
|
|
277
304
|
page.on('dialog', this.#dialogHandler);
|
|
278
305
|
this.#networkCollector = new NetworkCollector(page, {
|
|
279
306
|
maxNavigationSaved: this.#config.resolved.maxNavigationSaved,
|
|
@@ -335,6 +362,124 @@ export class McpPage {
|
|
|
335
362
|
get devtoolsUniverse() {
|
|
336
363
|
return this.#devtoolsUniverse;
|
|
337
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* Makes the given logpoints the complete set of logpoints on the page, see
|
|
367
|
+
* {@link LogpointManager.setLogpoints}. The manager is created on first
|
|
368
|
+
* use, so an empty list on a page without logpoints is a no-op.
|
|
369
|
+
*/
|
|
370
|
+
setLogpoints(logpoints) {
|
|
371
|
+
if (!this.#logpointManager) {
|
|
372
|
+
if (logpoints.length === 0) {
|
|
373
|
+
return Promise.resolve([]);
|
|
374
|
+
}
|
|
375
|
+
const devtoolsUniverse = this.devtoolsUniverse;
|
|
376
|
+
if (!devtoolsUniverse) {
|
|
377
|
+
throw new Error(`DevTools universe is not available for page ${this.id ?? '?'}.`);
|
|
378
|
+
}
|
|
379
|
+
this.#logpointManager = new LogpointManager(devtoolsUniverse);
|
|
380
|
+
}
|
|
381
|
+
return this.#logpointManager.setLogpoints(logpoints);
|
|
382
|
+
}
|
|
383
|
+
getWebAuthnAuthenticator() {
|
|
384
|
+
return (this.#webAuthnAuthenticator && {
|
|
385
|
+
...this.#webAuthnAuthenticator.options,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
async configureWebAuthn(config) {
|
|
389
|
+
const model = this.devtoolsUniverse?.target.model(DevTools.WebAuthnModel.WebAuthnModel);
|
|
390
|
+
if (!model) {
|
|
391
|
+
throw new Error(`WebAuthn is not available for page ${this.id}.`);
|
|
392
|
+
}
|
|
393
|
+
const options = config.enabled
|
|
394
|
+
? this.#resolveWebAuthnOptions(config)
|
|
395
|
+
: undefined;
|
|
396
|
+
try {
|
|
397
|
+
return await this.#applyWebAuthnConfig(model, options);
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
const orphan = this.#webAuthnAuthenticator;
|
|
401
|
+
this.#webAuthnEnabled = false;
|
|
402
|
+
this.#webAuthnAuthenticator = undefined;
|
|
403
|
+
if (orphan) {
|
|
404
|
+
try {
|
|
405
|
+
await model.removeAuthenticator(orphan.id);
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
// Already gone, e.g. another client disabled the environment.
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
throw new Error(`Failed to configure WebAuthn for page ${this.id}: ${getErrorMessage(error)}`, { cause: error });
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
#resolveWebAuthnOptions(config) {
|
|
415
|
+
const current = this.#webAuthnAuthenticator?.options;
|
|
416
|
+
const protocol = config.protocol ?? current?.protocol ?? 'ctap2';
|
|
417
|
+
const transport = config.transport ?? current?.transport ?? 'internal';
|
|
418
|
+
const isUserVerified = config.isUserVerified ?? current?.isUserVerified ?? true;
|
|
419
|
+
if (protocol === 'u2f') {
|
|
420
|
+
if (config.hasResidentKey || config.hasUserVerification) {
|
|
421
|
+
throw new Error(`protocol 'u2f' does not support hasResidentKey or hasUserVerification. Set them to false or omit them.`);
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
protocol,
|
|
425
|
+
transport,
|
|
426
|
+
hasResidentKey: false,
|
|
427
|
+
hasUserVerification: false,
|
|
428
|
+
isUserVerified,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
protocol,
|
|
433
|
+
transport,
|
|
434
|
+
hasResidentKey: config.hasResidentKey ?? current?.hasResidentKey ?? true,
|
|
435
|
+
hasUserVerification: config.hasUserVerification ?? current?.hasUserVerification ?? true,
|
|
436
|
+
isUserVerified,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
async #applyWebAuthnConfig(model, options) {
|
|
440
|
+
if (!options) {
|
|
441
|
+
this.#webAuthnAuthenticator = undefined;
|
|
442
|
+
this.#webAuthnEnabled = false;
|
|
443
|
+
await model.setVirtualAuthEnvEnabled(false);
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
if (!this.#webAuthnEnabled) {
|
|
447
|
+
await model.setVirtualAuthEnvEnabled(true, false);
|
|
448
|
+
this.#webAuthnEnabled = true;
|
|
449
|
+
}
|
|
450
|
+
const current = this.#webAuthnAuthenticator;
|
|
451
|
+
let authenticator = current;
|
|
452
|
+
if (!authenticator ||
|
|
453
|
+
WEBAUTHN_CREATION_OPTIONS.some(key => options[key] !== authenticator?.options[key])) {
|
|
454
|
+
if (authenticator) {
|
|
455
|
+
await model.removeAuthenticator(authenticator.id);
|
|
456
|
+
this.#webAuthnAuthenticator = undefined;
|
|
457
|
+
}
|
|
458
|
+
const id = await model.addAuthenticator({
|
|
459
|
+
...options,
|
|
460
|
+
protocol: WEBAUTHN_PROTOCOLS[options.protocol],
|
|
461
|
+
transport: WEBAUTHN_TRANSPORTS[options.transport],
|
|
462
|
+
automaticPresenceSimulation: true,
|
|
463
|
+
});
|
|
464
|
+
authenticator = { id, options };
|
|
465
|
+
this.#webAuthnAuthenticator = authenticator;
|
|
466
|
+
}
|
|
467
|
+
else if (options.isUserVerified !== authenticator.options.isUserVerified) {
|
|
468
|
+
await model.setUserVerified(authenticator.id, options.isUserVerified);
|
|
469
|
+
authenticator.options.isUserVerified = options.isUserVerified;
|
|
470
|
+
}
|
|
471
|
+
const credentials = await model.getCredentials(authenticator.id);
|
|
472
|
+
return {
|
|
473
|
+
...authenticator.options,
|
|
474
|
+
credentials: credentials.map(credential => ({
|
|
475
|
+
credentialId: credential.credentialId,
|
|
476
|
+
rpId: credential.rpId,
|
|
477
|
+
isResidentCredential: credential.isResidentCredential,
|
|
478
|
+
userName: credential.userName,
|
|
479
|
+
signCount: credential.signCount,
|
|
480
|
+
})),
|
|
481
|
+
};
|
|
482
|
+
}
|
|
338
483
|
getDialog() {
|
|
339
484
|
if (this.#dialog?.handled) {
|
|
340
485
|
this.#dialog = undefined;
|
|
@@ -540,10 +685,19 @@ export class McpPage {
|
|
|
540
685
|
return undefined;
|
|
541
686
|
}
|
|
542
687
|
}
|
|
688
|
+
/**
|
|
689
|
+
* Opens the DevTools window and waits until the DevTools frontend creates
|
|
690
|
+
* its universe, which also creates the CD4A bridge when it is enabled.
|
|
691
|
+
*/
|
|
543
692
|
async openDevTools() {
|
|
544
693
|
const devtoolsPage = await this.pptrPage.openDevTools();
|
|
545
|
-
|
|
546
|
-
await
|
|
694
|
+
try {
|
|
695
|
+
await devtoolsPage.waitForFunction(() => Boolean(window.universe), {
|
|
696
|
+
timeout: DEVTOOLS_UNIVERSE_TIMEOUT_MS,
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
catch (e) {
|
|
700
|
+
logger?.(`DevTools might not have loaded completely within ${DEVTOOLS_UNIVERSE_TIMEOUT_MS / 1000} seconds`, e);
|
|
547
701
|
}
|
|
548
702
|
return devtoolsPage;
|
|
549
703
|
}
|
|
@@ -603,15 +757,40 @@ export class McpPage {
|
|
|
603
757
|
});
|
|
604
758
|
}
|
|
605
759
|
this.#pptrPage?.off('dialog', this.#dialogHandler);
|
|
760
|
+
void this.#networkOverrideManager?.dispose();
|
|
606
761
|
this.#networkCollector?.dispose();
|
|
607
762
|
this.#consoleCollector?.dispose();
|
|
763
|
+
this.#logpointManager?.dispose();
|
|
764
|
+
this.#logpointManager = undefined;
|
|
608
765
|
const devtoolsUniverse = this.#devtoolsUniverse;
|
|
609
766
|
this.#devtoolsUniverse = undefined;
|
|
767
|
+
this.#webAuthnAuthenticator = undefined;
|
|
610
768
|
devtoolsUniverse?.universe.dispose();
|
|
611
769
|
void devtoolsUniverse?.session.detach().catch(e => {
|
|
612
770
|
logger?.('Failed to detach DevTools session', e);
|
|
613
771
|
});
|
|
614
772
|
}
|
|
773
|
+
async mockNetwork(input) {
|
|
774
|
+
const manager = await this.#getNetworkOverrideManagerForChanges();
|
|
775
|
+
return await manager.mock(input);
|
|
776
|
+
}
|
|
777
|
+
async #getNetworkOverrideManagerForChanges() {
|
|
778
|
+
if (this.#isRunningPerformanceTrace) {
|
|
779
|
+
throw new Error('Cannot change network mocks while a performance trace is running.');
|
|
780
|
+
}
|
|
781
|
+
await this.init();
|
|
782
|
+
if (!this.#networkOverrideManager) {
|
|
783
|
+
throw new Error(`McpPage (id=${this.id}) is not initialized.`);
|
|
784
|
+
}
|
|
785
|
+
return this.#networkOverrideManager;
|
|
786
|
+
}
|
|
787
|
+
listNetworkMocks(filter) {
|
|
788
|
+
return this.#networkOverrideManager?.list(filter) ?? [];
|
|
789
|
+
}
|
|
790
|
+
async removeNetworkMocks(filter) {
|
|
791
|
+
const manager = await this.#getNetworkOverrideManagerForChanges();
|
|
792
|
+
return await manager.remove(filter);
|
|
793
|
+
}
|
|
615
794
|
async executeThirdPartyDeveloperTool(toolName, params, response) {
|
|
616
795
|
const webmcpTool = this.pptrPage.webmcp
|
|
617
796
|
.tools()
|