chrome-devtools-mcp 1.11.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 +73 -21
- package/{build → out/Default/gen}/src/BrowserManager.js +49 -18
- package/out/Default/gen/src/LogpointManager.js +307 -0
- package/{build → out/Default/gen}/src/McpContext.js +439 -133
- package/{build → out/Default/gen}/src/McpPage.js +368 -59
- package/{build → out/Default/gen}/src/McpResponse.js +90 -47
- package/out/Default/gen/src/NetworkOverrideManager.js +419 -0
- package/{build → out/Default/gen}/src/TextSnapshot.js +37 -18
- package/out/Default/gen/src/ToolHandler.js +512 -0
- package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp-main.js +6 -4
- package/{build → out/Default/gen}/src/bin/chrome-devtools.js +4 -4
- package/{build → out/Default/gen}/src/collectors/PageCollector.js +28 -12
- package/{build → out/Default/gen}/src/collectors/ServiceWorkerCollector.js +2 -2
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigParser.js +162 -0
- package/{build → out/Default/gen}/src/config/ConfigWatcher.js +3 -2
- package/out/Default/gen/src/config/ServerConfig.js +251 -0
- package/{build → out/Default/gen}/src/config/browser-options.js +13 -4
- package/{build → out/Default/gen}/src/config/category-options.js +10 -0
- package/{build → out/Default/gen}/src/config/cli-options.js +223 -22
- package/{build → out/Default/gen}/src/config/mcp-options.js +62 -36
- package/{build → out/Default/gen}/src/config/puppeteer-options.js +4 -2
- package/{build → out/Default/gen}/src/daemon/client.js +3 -3
- package/{build → out/Default/gen}/src/daemon/daemon.js +7 -3
- package/{build → out/Default/gen}/src/daemon/utils.js +2 -1
- package/{build → out/Default/gen}/src/devtools/DevToolsCommentBridge.js +28 -5
- package/{build → out/Default/gen}/src/devtools/DevtoolsUtils.js +94 -20
- package/{build → out/Default/gen}/src/formatters/ConsoleFormatter.js +28 -1
- package/{build → out/Default/gen}/src/formatters/HeapSnapshotFormatter.js +14 -18
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/{build → out/Default/gen}/src/formatters/NetworkFormatter.js +70 -17
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +49 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/{build → out/Default/gen}/src/formatters/SnapshotFormatter.js +13 -3
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/index.js +435 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +569 -0
- package/{build → out/Default/gen}/src/telemetry/transformation.js +1 -1
- package/{build → out/Default/gen}/src/third_party/THIRD_PARTY_NOTICES +796 -712
- 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/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/{build → out/Default/gen}/src/tools/categories.js +4 -0
- package/{build → out/Default/gen}/src/tools/comments.js +46 -4
- package/{build → out/Default/gen}/src/tools/console.js +8 -6
- package/{build → out/Default/gen}/src/tools/css.js +1 -0
- package/{build → out/Default/gen}/src/tools/emulation.js +5 -4
- package/{build → out/Default/gen}/src/tools/extensions.js +6 -1
- package/{build → out/Default/gen}/src/tools/input.js +23 -28
- package/{build → out/Default/gen}/src/tools/lighthouse.js +30 -8
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/{build → out/Default/gen}/src/tools/memory.js +59 -53
- package/out/Default/gen/src/tools/network.js +260 -0
- package/{build → out/Default/gen}/src/tools/pages.js +48 -6
- package/{build → out/Default/gen}/src/tools/performance.js +33 -7
- package/{build → out/Default/gen}/src/tools/pwa.js +7 -0
- package/{build → out/Default/gen}/src/tools/screencast.js +3 -1
- package/{build → out/Default/gen}/src/tools/screenshot.js +23 -7
- package/{build → out/Default/gen}/src/tools/script.js +38 -6
- package/{build → out/Default/gen}/src/tools/slim/tools.js +21 -5
- package/{build → out/Default/gen}/src/tools/snapshot.js +29 -5
- package/{build → out/Default/gen}/src/tools/thirdPartyDeveloper.js +6 -20
- 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 +5 -19
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/{build → out/Default/gen}/src/utils/WaitForHelper.js +16 -2
- package/{build → out/Default/gen}/src/utils/bytes.js +2 -12
- package/{build → out/Default/gen}/src/utils/check-for-updates.js +8 -2
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/{build → out/Default/gen}/src/utils/errorHandling.js +3 -0
- package/{build → out/Default/gen}/src/utils/keyboard.js +15 -5
- package/out/Default/gen/src/utils/logger.js +131 -0
- package/out/Default/gen/src/utils/network.js +81 -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 +44 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/{build → out/Default/gen}/src/utils/url.js +73 -17
- package/{build → out/Default/gen}/src/version.js +1 -1
- package/package.json +26 -32
- package/skills/a11y-debugging/SKILL.md +3 -8
- package/skills/chrome-devtools/SKILL.md +2 -0
- package/skills/chrome-devtools-cli/SKILL.md +12 -1
- package/build/src/ToolHandler.js +0 -360
- package/build/src/config/ConfigParser.js +0 -264
- package/build/src/index.js +0 -282
- package/build/src/processors/HeapSnapshotManager.js +0 -307
- package/build/src/third_party/bundled-packages.json +0 -11
- package/build/src/third_party/devtools-formatter-worker.js +0 -16625
- package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -12084
- package/build/src/third_party/index.js +0 -189603
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +0 -58435
- package/build/src/tools/ToolDefinition.js +0 -92
- package/build/src/tools/network.js +0 -128
- package/build/src/utils/logger.js +0 -62
- package/build/src/utils/text.js +0 -15
- /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/bin/check-latest-version.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigLocator.js +0 -0
- /package/{build → out/Default/gen}/src/config/cli-commands.js +0 -0
- /package/{build → out/Default/gen}/src/config/tool-options.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/types.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/CssFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/IssueFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/processors/ChunkedTraceParser.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/types.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/pagination.js +0 -0
- /package/{build → out/Default/gen}/src/utils/polyfill.js +0 -0
|
@@ -3,27 +3,121 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
7
|
+
if (value !== null && value !== void 0) {
|
|
8
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
9
|
+
var dispose, inner;
|
|
10
|
+
if (async) {
|
|
11
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
12
|
+
dispose = value[Symbol.asyncDispose];
|
|
13
|
+
}
|
|
14
|
+
if (dispose === void 0) {
|
|
15
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
16
|
+
dispose = value[Symbol.dispose];
|
|
17
|
+
if (async) inner = dispose;
|
|
18
|
+
}
|
|
19
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
20
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
21
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
22
|
+
}
|
|
23
|
+
else if (async) {
|
|
24
|
+
env.stack.push({ async: true });
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
29
|
+
return function (env) {
|
|
30
|
+
function fail(e) {
|
|
31
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
32
|
+
env.hasError = true;
|
|
33
|
+
}
|
|
34
|
+
var r, s = 0;
|
|
35
|
+
function next() {
|
|
36
|
+
while (r = env.stack.pop()) {
|
|
37
|
+
try {
|
|
38
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
39
|
+
if (r.dispose) {
|
|
40
|
+
var result = r.dispose.call(r.value);
|
|
41
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
42
|
+
}
|
|
43
|
+
else s |= 1;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
fail(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
50
|
+
if (env.hasError) throw env.error;
|
|
51
|
+
}
|
|
52
|
+
return next();
|
|
53
|
+
};
|
|
54
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
55
|
+
var e = new Error(message);
|
|
56
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
57
|
+
});
|
|
6
58
|
import fs from 'node:fs/promises';
|
|
7
59
|
import os from 'node:os';
|
|
8
60
|
import path from 'node:path';
|
|
9
61
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
62
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
10
63
|
import { overrideDevToolsGlobals } from './devtools/DevtoolsUtils.js';
|
|
11
64
|
import { McpPage } from './McpPage.js';
|
|
12
65
|
import { ServiceWorkerConsoleCollector } from './collectors/ServiceWorkerCollector.js';
|
|
13
|
-
import { Locator, } from './third_party/index.js';
|
|
14
|
-
import {
|
|
66
|
+
import { Locator, Mutex, } from './third_party/index.js';
|
|
67
|
+
import { ToolCategory } from './tools/categories.js';
|
|
68
|
+
import { CLOSE_PAGE_ERROR, isCapabilityEnabled, } from './tools/ToolDefinition.js';
|
|
15
69
|
import { McpWorker } from './McpWorker.js';
|
|
16
70
|
import { getTempFilePath, resolveCanonicalPath } from './utils/files.js';
|
|
17
|
-
import { escapeForLog } from './utils/logger.js';
|
|
71
|
+
import { escapeForLog, redactUrlForLogging } from './utils/logger.js';
|
|
72
|
+
import { fetchWithValidatedRedirects, validateUrlNotBlocked, } from './utils/network.js';
|
|
18
73
|
import { isAllowedUrl } from './utils/url.js';
|
|
74
|
+
function hasOptionChanged(gate, previousArgs, nextArgs) {
|
|
75
|
+
return gate.options.some(option => !isDeepStrictEqual(nextArgs[option], previousArgs[option]));
|
|
76
|
+
}
|
|
77
|
+
const FEATURE_CONTROLLERS = [
|
|
78
|
+
{
|
|
79
|
+
gate: { options: ['blockedUrlPattern', 'allowedUrlPattern'] },
|
|
80
|
+
onChange: context => context.syncNetworkRestrictions(),
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
gate: { options: ['sourceMaps'] },
|
|
84
|
+
onChange: context => context.syncSourceMaps(),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
gate: { options: ['experimentalIncludeAllPages'] },
|
|
88
|
+
onChange: context => context.createPagesSnapshot(),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
gate: { category: ToolCategory.DEBUGGING },
|
|
92
|
+
onDisable: context => context.releaseScreencasts(),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
gate: { category: ToolCategory.MEMORY, conditions: ['memoryDebugging'] },
|
|
96
|
+
onDisable: context => context.releaseHeapSnapshots(),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
gate: { category: ToolCategory.PERFORMANCE },
|
|
100
|
+
onDisable: context => context.releasePerformanceTrace(),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
gate: { category: ToolCategory.DEBUGGING, conditions: ['devtoolsComments'] },
|
|
104
|
+
onDisable: context => context.releaseDevToolsComments(),
|
|
105
|
+
},
|
|
106
|
+
];
|
|
19
107
|
// Page ids are handed out from a process-wide counter so they stay unique
|
|
20
108
|
// across all contexts, in particular across browser reconnects. An id issued
|
|
21
109
|
// before a reconnect then fails to resolve instead of hitting an unrelated
|
|
22
110
|
// page of the reconnected browser.
|
|
23
111
|
let nextPageId = 1;
|
|
24
112
|
export class McpContext {
|
|
25
|
-
browser;
|
|
26
113
|
logger;
|
|
114
|
+
#browser;
|
|
115
|
+
// Initialization of #browser, settles once its browser-dependent state is
|
|
116
|
+
// ready.
|
|
117
|
+
#browserReady;
|
|
118
|
+
// Whether a browser connection was established before, so that switching to
|
|
119
|
+
// a new browser surfaces a reconnect notice.
|
|
120
|
+
#hasConnected = false;
|
|
27
121
|
// Maps LLM-provided isolatedContext name → Puppeteer BrowserContext.
|
|
28
122
|
#isolatedContexts = new Map();
|
|
29
123
|
// Auto-generated name counter for when no name is provided.
|
|
@@ -32,53 +126,240 @@ export class McpContext {
|
|
|
32
126
|
// referential identity holds and workers can carry per-worker state later.
|
|
33
127
|
#workers = new Map();
|
|
34
128
|
#mcpPages = new Map();
|
|
129
|
+
/**
|
|
130
|
+
* Queue for the browser-wide state (page list, selected page, trace
|
|
131
|
+
* state). Every page queue is a child of it, so a task on it waits for
|
|
132
|
+
* every page task and blocks later page tasks.
|
|
133
|
+
*/
|
|
134
|
+
taskQueue;
|
|
135
|
+
#taskRunner;
|
|
136
|
+
#pageTaskQueues = new Map();
|
|
137
|
+
/**
|
|
138
|
+
* Serializes `createPagesSnapshot()`. Two tasks on different page queues
|
|
139
|
+
* can call it at the same time.
|
|
140
|
+
*/
|
|
141
|
+
#pagesSnapshotMutex = new Mutex();
|
|
35
142
|
#selectedPage;
|
|
36
143
|
#selectedPageFallback;
|
|
144
|
+
#selectedPageFallbackRead = false;
|
|
37
145
|
#serviceWorkerConsoleCollector;
|
|
38
|
-
#isRunningTrace = false;
|
|
39
146
|
#reconnectNotice = false;
|
|
40
147
|
#traceResults = [];
|
|
41
148
|
#locatorClass;
|
|
149
|
+
#config;
|
|
42
150
|
#options;
|
|
43
151
|
#heapSnapshotManager;
|
|
44
152
|
#roots = undefined;
|
|
45
|
-
|
|
46
|
-
constructor(browser, logger, options, locatorClass) {
|
|
153
|
+
constructor(logger, options, locatorClass) {
|
|
47
154
|
overrideDevToolsGlobals({
|
|
48
155
|
loadResource: (url) => {
|
|
49
156
|
return this.loadResource(url);
|
|
50
157
|
},
|
|
51
158
|
});
|
|
52
|
-
this.browser = browser;
|
|
53
159
|
this.logger = logger;
|
|
54
160
|
this.#locatorClass = locatorClass;
|
|
161
|
+
this.#taskRunner = options.taskRunner;
|
|
162
|
+
this.taskQueue = options.taskRunner.createQueue();
|
|
163
|
+
this.#config = options.config;
|
|
55
164
|
this.#options = options;
|
|
56
165
|
this.#heapSnapshotManager = options.heapSnapshotManager;
|
|
57
|
-
this.#allowUnrestrictedPaths = options.allowUnrestrictedPaths ?? false;
|
|
58
|
-
this.#reconnectNotice = options.reconnected ?? false;
|
|
59
|
-
this.#serviceWorkerConsoleCollector = new ServiceWorkerConsoleCollector(this.browser);
|
|
60
166
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
167
|
+
/**
|
|
168
|
+
* The browser of the current connection. Throws if no browser connection was
|
|
169
|
+
* established yet, see {@link McpContext.ensureBrowser}.
|
|
170
|
+
*/
|
|
171
|
+
get browser() {
|
|
172
|
+
if (!this.#browser) {
|
|
173
|
+
throw new Error('Not connected to a browser.');
|
|
174
|
+
}
|
|
175
|
+
return this.#browser;
|
|
67
176
|
}
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
177
|
+
#allMcpPages() {
|
|
178
|
+
const pages = new Set(this.#mcpPages.values());
|
|
179
|
+
if (this.#selectedPage) {
|
|
180
|
+
pages.add(this.#selectedPage);
|
|
181
|
+
}
|
|
182
|
+
return pages;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Synchronizes browser/page state and releases state of capabilities that
|
|
186
|
+
* transitioned from enabled to disabled after a config reload.
|
|
187
|
+
*/
|
|
188
|
+
async onConfigChanged(previousArgs) {
|
|
189
|
+
const nextArgs = this.#config.resolved;
|
|
190
|
+
for (const controller of FEATURE_CONTROLLERS) {
|
|
191
|
+
if ('onChange' in controller) {
|
|
192
|
+
if (hasOptionChanged(controller.gate, previousArgs, nextArgs)) {
|
|
193
|
+
await controller.onChange(this);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (isCapabilityEnabled(controller.gate, previousArgs) &&
|
|
197
|
+
!isCapabilityEnabled(controller.gate, nextArgs)) {
|
|
198
|
+
await controller.onDisable(this);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Applies updated URL allowlist/blocklist rules to the connected browser and
|
|
204
|
+
* clears incompatible page network throttling state.
|
|
205
|
+
*/
|
|
206
|
+
async syncNetworkRestrictions() {
|
|
207
|
+
const { blockedUrlPattern, allowedUrlPattern } = this.#config.resolved;
|
|
208
|
+
if (blockedUrlPattern || allowedUrlPattern) {
|
|
209
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
210
|
+
await mcpPage.clearNetworkConditions();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (this.#browser) {
|
|
214
|
+
await this.#browser.restrictNetwork({
|
|
215
|
+
blocklist: blockedUrlPattern,
|
|
216
|
+
allowlist: allowedUrlPattern,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Synchronizes the DevTools source maps setting across all pages.
|
|
222
|
+
*/
|
|
223
|
+
syncSourceMaps() {
|
|
224
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
225
|
+
mcpPage.syncSourceMaps();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Stops and saves active screencast recordings across all pages when
|
|
230
|
+
* screencast tools are disabled.
|
|
231
|
+
*/
|
|
232
|
+
async releaseScreencasts() {
|
|
233
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
234
|
+
const screenRecorderData = mcpPage.getScreenRecorder();
|
|
235
|
+
if (!screenRecorderData) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const { recorder, filePath } = screenRecorderData;
|
|
239
|
+
mcpPage.setScreenRecorder(null);
|
|
240
|
+
try {
|
|
241
|
+
await recorder.stop();
|
|
242
|
+
this.logger?.(`The screencast recording was stopped and saved to ${filePath} because screencast tools were disabled.`);
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
this.logger?.('Failed to stop the screencast recording', err);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Closes all loaded heap snapshots when memory tools are disabled.
|
|
251
|
+
*/
|
|
252
|
+
releaseHeapSnapshots() {
|
|
253
|
+
if (this.#heapSnapshotManager.hasSnapshots()) {
|
|
254
|
+
this.#heapSnapshotManager.dispose();
|
|
255
|
+
this.logger?.('Loaded heap snapshots were closed because memory tools were disabled.');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Discards recorded performance traces and stops any running trace when
|
|
260
|
+
* performance tools are disabled.
|
|
261
|
+
*/
|
|
262
|
+
async releasePerformanceTrace() {
|
|
263
|
+
this.#traceResults = [];
|
|
264
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
265
|
+
if (!mcpPage.isRunningPerformanceTrace()) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
mcpPage.setIsRunningPerformanceTrace(false);
|
|
269
|
+
try {
|
|
270
|
+
await mcpPage.pptrPage.tracing.stop();
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
this.logger?.('Failed to stop the performance trace', err);
|
|
274
|
+
}
|
|
275
|
+
this.logger?.('The running performance trace was discarded because performance tools were disabled.');
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Disposes DevTools comment bridges across all pages when DevTools comment
|
|
280
|
+
* tools are disabled.
|
|
281
|
+
*/
|
|
282
|
+
releaseDevToolsComments() {
|
|
283
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
284
|
+
mcpPage.disposeCommentBridge();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Returns the browser, establishing the connection if needed. If the browser
|
|
289
|
+
* changed since the last call (e.g. after a reconnect), all
|
|
290
|
+
* browser-dependent state is rebuilt for the new browser.
|
|
291
|
+
*/
|
|
292
|
+
async ensureBrowser() {
|
|
293
|
+
const browser = await this.#options.getBrowser();
|
|
294
|
+
if (browser === this.#browser && this.#browserReady) {
|
|
295
|
+
// Joins a still pending initialization instead of handing out
|
|
296
|
+
// half-initialized state.
|
|
297
|
+
await this.#browserReady;
|
|
298
|
+
return browser;
|
|
299
|
+
}
|
|
300
|
+
this.#resetBrowserState();
|
|
301
|
+
this.#browser = browser;
|
|
302
|
+
const ready = this.#initBrowserState(browser);
|
|
303
|
+
this.#browserReady = ready;
|
|
304
|
+
try {
|
|
305
|
+
await ready;
|
|
306
|
+
return browser;
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
// Leave no half-initialized state behind, the next call starts over. If
|
|
310
|
+
// a later call already installed another browser, its state is left
|
|
311
|
+
// intact.
|
|
312
|
+
if (this.#browserReady === ready) {
|
|
313
|
+
this.#resetBrowserState();
|
|
314
|
+
}
|
|
315
|
+
throw err;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async #initBrowserState(browser) {
|
|
319
|
+
const collector = new ServiceWorkerConsoleCollector(browser);
|
|
320
|
+
this.#serviceWorkerConsoleCollector = collector;
|
|
321
|
+
// All listeners are registered synchronously, before the first await. If
|
|
322
|
+
// this call hangs and is abandoned by the tool-call timeout, a later call
|
|
323
|
+
// that installs a different browser removes them in #resetBrowserState().
|
|
324
|
+
browser.on('targetcreated', this.#onTargetCreated);
|
|
325
|
+
browser.on('targetdestroyed', this.#onTargetDestroyed);
|
|
326
|
+
await Promise.all([
|
|
327
|
+
collector.init(this.createWorkersSnapshot()),
|
|
328
|
+
this.createPagesSnapshot(),
|
|
329
|
+
]);
|
|
330
|
+
// The state now belongs to the browser of a later call, leave it intact.
|
|
331
|
+
if (this.#browser !== browser) {
|
|
332
|
+
throw new Error('Browser was replaced while initializing.');
|
|
333
|
+
}
|
|
334
|
+
if (this.#hasConnected) {
|
|
335
|
+
this.#reconnectNotice = true;
|
|
336
|
+
}
|
|
337
|
+
this.#hasConnected = true;
|
|
338
|
+
}
|
|
339
|
+
#resetBrowserState() {
|
|
340
|
+
this.#browser?.off('targetcreated', this.#onTargetCreated);
|
|
341
|
+
this.#browser?.off('targetdestroyed', this.#onTargetDestroyed);
|
|
342
|
+
this.#serviceWorkerConsoleCollector?.dispose();
|
|
343
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
344
|
+
this.#disposeMcpPage(mcpPage);
|
|
74
345
|
}
|
|
75
|
-
this.#selectedPage?.dispose();
|
|
76
346
|
this.#mcpPages.clear();
|
|
77
347
|
this.#workers.clear();
|
|
78
348
|
// Isolated contexts are intentionally not closed here.
|
|
79
349
|
// Either the entire browser will be closed or we disconnect
|
|
80
350
|
// without destroying browser state.
|
|
81
351
|
this.#isolatedContexts.clear();
|
|
352
|
+
this.#nextIsolatedContextId = 1;
|
|
353
|
+
this.#selectedPage = undefined;
|
|
354
|
+
this.#selectedPageFallback = undefined;
|
|
355
|
+
this.#selectedPageFallbackRead = false;
|
|
356
|
+
this.#traceResults = [];
|
|
357
|
+
this.#serviceWorkerConsoleCollector = undefined;
|
|
358
|
+
this.#browser = undefined;
|
|
359
|
+
this.#browserReady = undefined;
|
|
360
|
+
}
|
|
361
|
+
dispose() {
|
|
362
|
+
this.#resetBrowserState();
|
|
82
363
|
}
|
|
83
364
|
#onTargetCreated = (target) => {
|
|
84
365
|
try {
|
|
@@ -95,7 +376,7 @@ export class McpContext {
|
|
|
95
376
|
try {
|
|
96
377
|
const mcpPage = this.#mcpPages.get(target);
|
|
97
378
|
if (mcpPage) {
|
|
98
|
-
mcpPage
|
|
379
|
+
this.#disposeMcpPage(mcpPage);
|
|
99
380
|
this.#mcpPages.delete(target);
|
|
100
381
|
}
|
|
101
382
|
this.#workers.delete(target);
|
|
@@ -104,12 +385,10 @@ export class McpContext {
|
|
|
104
385
|
this.logger?.('Error handling targetdestroyed', err);
|
|
105
386
|
}
|
|
106
387
|
};
|
|
107
|
-
static
|
|
388
|
+
static create(logger, opts,
|
|
108
389
|
/* Let tests use unbundled Locator class to avoid overly strict checks within puppeteer that fail when mixing bundled and unbundled class instances */
|
|
109
390
|
locatorClass = Locator) {
|
|
110
|
-
|
|
111
|
-
await context.#init();
|
|
112
|
-
return context;
|
|
391
|
+
return new McpContext(logger, opts, locatorClass);
|
|
113
392
|
}
|
|
114
393
|
static resetPageIdsForTesting() {
|
|
115
394
|
nextPageId = 1;
|
|
@@ -145,7 +424,8 @@ export class McpContext {
|
|
|
145
424
|
// If the client never negotiated roots and the operator has explicitly
|
|
146
425
|
// opted into unrestricted access via --allow-unrestricted-paths, restore
|
|
147
426
|
// the previous permissive behavior and skip validation.
|
|
148
|
-
if (this.#roots === undefined &&
|
|
427
|
+
if (this.#roots === undefined &&
|
|
428
|
+
this.#config.resolved.allowUnrestrictedPaths) {
|
|
149
429
|
// Canonical path might not exist yet so we fallback to
|
|
150
430
|
// path.resolve(filePath). Consumers should not follow symlinks.
|
|
151
431
|
return canonicalPath || path.resolve(filePath);
|
|
@@ -166,8 +446,13 @@ export class McpContext {
|
|
|
166
446
|
const result = resolvedRoots[i];
|
|
167
447
|
if (result.status === 'fulfilled') {
|
|
168
448
|
const canonicalRoot = result.value;
|
|
449
|
+
// A filesystem root such as `/` or `C:\` already ends with the
|
|
450
|
+
// separator; appending another one would match no path below it.
|
|
451
|
+
const rootPrefix = canonicalRoot.endsWith(path.sep)
|
|
452
|
+
? canonicalRoot
|
|
453
|
+
: canonicalRoot + path.sep;
|
|
169
454
|
if (canonicalPath === canonicalRoot ||
|
|
170
|
-
canonicalPath.startsWith(
|
|
455
|
+
canonicalPath.startsWith(rootPrefix)) {
|
|
171
456
|
allowed = true;
|
|
172
457
|
break;
|
|
173
458
|
}
|
|
@@ -204,7 +489,7 @@ export class McpContext {
|
|
|
204
489
|
page = await this.browser.newPage({ background });
|
|
205
490
|
}
|
|
206
491
|
const mcpPage = this.#createMcpPage(page.target());
|
|
207
|
-
await mcpPage.init();
|
|
492
|
+
await mcpPage.init({ emulateFocus: true });
|
|
208
493
|
this.selectPage(mcpPage);
|
|
209
494
|
await this.createPagesSnapshot();
|
|
210
495
|
return mcpPage;
|
|
@@ -217,9 +502,6 @@ export class McpContext {
|
|
|
217
502
|
this.#mcpPages.delete(page.target);
|
|
218
503
|
await page.close();
|
|
219
504
|
}
|
|
220
|
-
get #hasNetworkBlockOrAllowlist() {
|
|
221
|
-
return !!(this.#options.allowlist || this.#options.blocklist);
|
|
222
|
-
}
|
|
223
505
|
async installPWA(options) {
|
|
224
506
|
try {
|
|
225
507
|
return await this.browser.installPWA(options);
|
|
@@ -251,14 +533,16 @@ export class McpContext {
|
|
|
251
533
|
getPWAState(options) {
|
|
252
534
|
return this.browser.getPWAState(options);
|
|
253
535
|
}
|
|
254
|
-
setIsRunningPerformanceTrace(x) {
|
|
255
|
-
this.#isRunningTrace = x;
|
|
256
|
-
}
|
|
257
536
|
isRunningPerformanceTrace() {
|
|
258
|
-
|
|
537
|
+
for (const mcpPage of this.#allMcpPages()) {
|
|
538
|
+
if (mcpPage.isRunningPerformanceTrace()) {
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return false;
|
|
259
543
|
}
|
|
260
544
|
isCruxEnabled() {
|
|
261
|
-
return this.#
|
|
545
|
+
return this.#config.resolved.performanceCrux;
|
|
262
546
|
}
|
|
263
547
|
getPages() {
|
|
264
548
|
return Array.from(this.#mcpPages.values());
|
|
@@ -327,9 +611,9 @@ export class McpContext {
|
|
|
327
611
|
}
|
|
328
612
|
}
|
|
329
613
|
/**
|
|
330
|
-
* Returns true once
|
|
331
|
-
*
|
|
332
|
-
*
|
|
614
|
+
* Returns true once after the browser connection was re-established with a
|
|
615
|
+
* new browser, so the next response can surface a note. Cleared on first
|
|
616
|
+
* call.
|
|
333
617
|
*/
|
|
334
618
|
consumeReconnectNotice() {
|
|
335
619
|
const notice = this.#reconnectNotice;
|
|
@@ -343,14 +627,39 @@ export class McpContext {
|
|
|
343
627
|
}
|
|
344
628
|
return page;
|
|
345
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* The queue for tasks on page `pageId`. The queue exists before the page
|
|
632
|
+
* does, so a tool call can enter it before the browser connects. It is a
|
|
633
|
+
* child of {@link taskQueue}.
|
|
634
|
+
*/
|
|
635
|
+
pageTaskQueue(pageId) {
|
|
636
|
+
let queue = this.#pageTaskQueues.get(pageId);
|
|
637
|
+
if (!queue) {
|
|
638
|
+
queue = this.#taskRunner.createQueue(this.taskQueue);
|
|
639
|
+
this.#pageTaskQueues.set(pageId, queue);
|
|
640
|
+
}
|
|
641
|
+
return queue;
|
|
642
|
+
}
|
|
643
|
+
#disposeMcpPage(mcpPage) {
|
|
644
|
+
mcpPage.dispose();
|
|
645
|
+
this.#pageTaskQueues
|
|
646
|
+
.get(mcpPage.id)
|
|
647
|
+
?.dispose(new Error(`Page ${mcpPage.id} is closed.`));
|
|
648
|
+
this.#pageTaskQueues.delete(mcpPage.id);
|
|
649
|
+
}
|
|
346
650
|
isPageSelected(page) {
|
|
347
651
|
return this.#selectedPage === page;
|
|
348
652
|
}
|
|
349
653
|
selectPage(newPage) {
|
|
654
|
+
this.#selectedPageFallback = undefined;
|
|
655
|
+
this.#selectedPageFallbackRead = false;
|
|
656
|
+
this.#selectPage(newPage);
|
|
657
|
+
}
|
|
658
|
+
#selectPage(newPage) {
|
|
350
659
|
if (this.#selectedPage &&
|
|
351
660
|
this.#selectedPage !== newPage &&
|
|
352
661
|
!this.#mcpPages.has(this.#selectedPage.target)) {
|
|
353
|
-
this.#selectedPage
|
|
662
|
+
this.#disposeMcpPage(this.#selectedPage);
|
|
354
663
|
}
|
|
355
664
|
this.#selectedPage = newPage;
|
|
356
665
|
newPage.updateTimeouts();
|
|
@@ -358,10 +667,12 @@ export class McpContext {
|
|
|
358
667
|
/**
|
|
359
668
|
* Returns details about the last page snapshot automatically replacing the
|
|
360
669
|
* selection because the selected page disappeared from the page list, or
|
|
361
|
-
* `undefined` if the snapshot left the selection intact.
|
|
362
|
-
* createPagesSnapshot() call
|
|
670
|
+
* `undefined` if the snapshot left the selection intact. Cleared on the next
|
|
671
|
+
* createPagesSnapshot() call after it has been read, or when selectPage() is
|
|
672
|
+
* called explicitly.
|
|
363
673
|
*/
|
|
364
674
|
getSelectedPageFallback() {
|
|
675
|
+
this.#selectedPageFallbackRead = true;
|
|
365
676
|
return this.#selectedPageFallback;
|
|
366
677
|
}
|
|
367
678
|
/**
|
|
@@ -390,8 +701,13 @@ export class McpContext {
|
|
|
390
701
|
}
|
|
391
702
|
return Array.from(this.#workers.values());
|
|
392
703
|
}
|
|
393
|
-
getServiceWorkerConsoleData(
|
|
394
|
-
|
|
704
|
+
getServiceWorkerConsoleData(serviceWorkerId) {
|
|
705
|
+
const worker = this.getWorkerById(serviceWorkerId);
|
|
706
|
+
if (worker?.type !== 'service_worker') {
|
|
707
|
+
throw new Error('Service worker not found.');
|
|
708
|
+
}
|
|
709
|
+
const extensionId = new URL(worker.url).hostname;
|
|
710
|
+
return this.#serviceWorkerConsoleCollector?.getData(extensionId) ?? [];
|
|
395
711
|
}
|
|
396
712
|
#getBrowserContextToNameMap() {
|
|
397
713
|
// Build a reverse lookup from BrowserContext instance → name.
|
|
@@ -417,61 +733,92 @@ export class McpContext {
|
|
|
417
733
|
(this.#selectedPage?.target === target ? this.#selectedPage : undefined);
|
|
418
734
|
if (!mcpPage) {
|
|
419
735
|
mcpPage = new McpPage(target, nextPageId++, {
|
|
736
|
+
config: this.#config,
|
|
420
737
|
locatorClass: this.#locatorClass,
|
|
421
|
-
hasNetworkBlockOrAllowlist: this.#hasNetworkBlockOrAllowlist,
|
|
422
738
|
isolatedContextName: this.#getBrowserContextToNameMap().get(target.browserContext()),
|
|
423
739
|
navigationTimeout: this.#options.navigationTimeout,
|
|
424
|
-
sourceMaps: this.#options.sourceMaps,
|
|
425
|
-
onNotification: this.#options.onNotification,
|
|
426
740
|
});
|
|
427
741
|
}
|
|
428
742
|
this.#mcpPages.set(target, mcpPage);
|
|
429
743
|
return mcpPage;
|
|
430
744
|
}
|
|
431
745
|
async createPagesSnapshot() {
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
this.#
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
746
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
747
|
+
try {
|
|
748
|
+
if (!this.#browser) {
|
|
749
|
+
return [];
|
|
750
|
+
}
|
|
751
|
+
const guard = __addDisposableResource(env_1, await this.#pagesSnapshotMutex.acquire(), false);
|
|
752
|
+
const allTargets = this.#fetchPageTargets();
|
|
753
|
+
for (const target of allTargets) {
|
|
754
|
+
this.#createMcpPage(target);
|
|
755
|
+
}
|
|
756
|
+
// Prune orphaned #mcpPages entries (targets that no longer exist).
|
|
757
|
+
const currentTargets = new Set(allTargets);
|
|
758
|
+
for (const [target, mcpPage] of this.#mcpPages) {
|
|
759
|
+
if (!currentTargets.has(target)) {
|
|
760
|
+
if (mcpPage !== this.#selectedPage || mcpPage.isClosed()) {
|
|
761
|
+
this.#disposeMcpPage(mcpPage);
|
|
762
|
+
}
|
|
763
|
+
this.#mcpPages.delete(target);
|
|
442
764
|
}
|
|
443
|
-
this.#mcpPages.delete(target);
|
|
444
765
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (this.#selectedPage) {
|
|
455
|
-
this.#selectedPageFallback = {
|
|
456
|
-
wasClosed: this.#selectedPage.isClosed(),
|
|
457
|
-
};
|
|
766
|
+
const pages = Array.from(this.#mcpPages.values());
|
|
767
|
+
// Only fall back when the selected page is actually gone or no longer
|
|
768
|
+
// counts as a page, e.g. a background page after
|
|
769
|
+
// experimentalIncludeAllPages was turned off. Gating on `isClosed()`
|
|
770
|
+
// instead of `pages` membership avoids silently swapping a live page that
|
|
771
|
+
// is momentarily missing from the snapshot.
|
|
772
|
+
if (this.#selectedPageFallbackRead) {
|
|
773
|
+
this.#selectedPageFallback = undefined;
|
|
774
|
+
this.#selectedPageFallbackRead = false;
|
|
458
775
|
}
|
|
459
|
-
this
|
|
776
|
+
if (!this.#selectedPage ||
|
|
777
|
+
this.#selectedPage.isClosed() ||
|
|
778
|
+
!this.#isPageTarget(this.#selectedPage.target)) {
|
|
779
|
+
if (pages[0]) {
|
|
780
|
+
// Record the automatic change so the response can surface it. Skipped on
|
|
781
|
+
// first connect, when there was no prior selection to replace.
|
|
782
|
+
if (this.#selectedPage) {
|
|
783
|
+
this.#selectedPageFallback = {
|
|
784
|
+
wasClosed: this.#selectedPage.isClosed(),
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
this.#selectPage(pages[0]);
|
|
788
|
+
}
|
|
789
|
+
else if (this.#selectedPage) {
|
|
790
|
+
const wasClosed = Boolean(this.#selectedPage.isClosed());
|
|
791
|
+
if (!wasClosed) {
|
|
792
|
+
this.#disposeMcpPage(this.#selectedPage);
|
|
793
|
+
}
|
|
794
|
+
this.#selectedPage = undefined;
|
|
795
|
+
this.#selectedPageFallback = { wasClosed };
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
if (this.#selectedPage && !this.#selectedPage.isClosed()) {
|
|
799
|
+
// Automatic page snapshots must preserve real focus on untouched tabs.
|
|
800
|
+
await this.#selectedPage.init({ emulateFocus: false });
|
|
801
|
+
}
|
|
802
|
+
return pages;
|
|
460
803
|
}
|
|
461
|
-
|
|
462
|
-
|
|
804
|
+
catch (e_1) {
|
|
805
|
+
env_1.error = e_1;
|
|
806
|
+
env_1.hasError = true;
|
|
807
|
+
}
|
|
808
|
+
finally {
|
|
809
|
+
__disposeResources(env_1);
|
|
463
810
|
}
|
|
464
|
-
return pages;
|
|
465
811
|
}
|
|
466
812
|
#isPageTarget(target) {
|
|
467
|
-
const existingMcpPage = this.#mcpPages.get(target)
|
|
813
|
+
const existingMcpPage = this.#mcpPages.get(target) ??
|
|
814
|
+
(this.#selectedPage?.target === target ? this.#selectedPage : undefined);
|
|
468
815
|
const url = existingMcpPage ? existingMcpPage.url() : target.url();
|
|
469
|
-
if (!this.#
|
|
816
|
+
if (!this.#config.resolved.experimentalDevtools &&
|
|
470
817
|
url.startsWith('devtools://')) {
|
|
471
818
|
return false;
|
|
472
819
|
}
|
|
473
820
|
if (!isAllowedUrl(url, {
|
|
474
|
-
categoryExtensions: this.#
|
|
821
|
+
categoryExtensions: this.#config.resolved.categoryExtensions,
|
|
475
822
|
})) {
|
|
476
823
|
return false;
|
|
477
824
|
}
|
|
@@ -479,11 +826,11 @@ export class McpContext {
|
|
|
479
826
|
if (type === 'page') {
|
|
480
827
|
return true;
|
|
481
828
|
}
|
|
482
|
-
if (this.#
|
|
829
|
+
if (this.#config.resolved.experimentalIncludeAllPages &&
|
|
483
830
|
(type === 'background_page' || type === 'webview')) {
|
|
484
831
|
return true;
|
|
485
832
|
}
|
|
486
|
-
if (this.#
|
|
833
|
+
if (this.#config.resolved.experimentalDevtools &&
|
|
487
834
|
type === 'other' &&
|
|
488
835
|
url.startsWith('devtools://')) {
|
|
489
836
|
return true;
|
|
@@ -612,60 +959,19 @@ export class McpContext {
|
|
|
612
959
|
async getHeapSnapshotDominators(filePath, nodeId) {
|
|
613
960
|
return await this.#heapSnapshotManager.getDominatorsOf(filePath, nodeId);
|
|
614
961
|
}
|
|
615
|
-
#validateUrlNotBlocked(url) {
|
|
616
|
-
if (!this.#options.blocklist) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
for (const block of this.#options.blocklist) {
|
|
620
|
-
const pattern = new URLPattern(block);
|
|
621
|
-
if (pattern.test(url)) {
|
|
622
|
-
throw new Error(`Blocked by blocklist: ${url}`);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
#validateUrlAllowed(url) {
|
|
627
|
-
if (!this.#options.allowlist) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
for (const allow of this.#options.allowlist) {
|
|
631
|
-
const pattern = new URLPattern(allow);
|
|
632
|
-
if (pattern.test(url)) {
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
throw new Error(`Not allowed by allowlist: ${url}`);
|
|
637
|
-
}
|
|
638
962
|
async #loadNetworkResource(url) {
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
const response = await fetch(currentUrl, { redirect: 'manual' });
|
|
646
|
-
if (!redirectStatuses.has(response.status)) {
|
|
647
|
-
if (!response.ok) {
|
|
648
|
-
throw new Error(`Failed to load resource: ${currentUrl}`);
|
|
649
|
-
}
|
|
650
|
-
return await response.text();
|
|
651
|
-
}
|
|
652
|
-
const location = response.headers.get('location');
|
|
653
|
-
if (!location) {
|
|
654
|
-
throw new Error(`Failed to load resource: ${currentUrl}`);
|
|
655
|
-
}
|
|
656
|
-
if (redirectCount >= maxRedirects) {
|
|
657
|
-
throw new Error(`Too many redirects loading resource: ${url}`);
|
|
658
|
-
}
|
|
659
|
-
await response.body?.cancel();
|
|
660
|
-
currentUrl = new URL(location, currentUrl);
|
|
661
|
-
if (currentUrl.protocol !== 'https:' && currentUrl.protocol !== 'http:') {
|
|
662
|
-
throw new Error(`Unsupported protocol for: ${currentUrl}`);
|
|
663
|
-
}
|
|
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));
|
|
664
969
|
}
|
|
970
|
+
return await response.text();
|
|
665
971
|
}
|
|
666
972
|
async loadResource(path) {
|
|
667
973
|
const url = new URL(path);
|
|
668
|
-
|
|
974
|
+
validateUrlNotBlocked(url, this.#config.resolved.blockedUrlPattern);
|
|
669
975
|
switch (url.protocol) {
|
|
670
976
|
case 'https:':
|
|
671
977
|
case 'http:': {
|