@chenpx976/chrome-devtools-mcp 0.0.0-stage → 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/LICENSE +202 -0
- package/README.md +223 -2
- package/out/Default/gen/src/ArcBrowser.js +128 -0
- package/out/Default/gen/src/BrowserManager.js +562 -0
- package/out/Default/gen/src/LogpointManager.js +287 -0
- package/out/Default/gen/src/McpContext.js +1031 -0
- package/out/Default/gen/src/McpPage.js +1427 -0
- package/out/Default/gen/src/McpResponse.js +1350 -0
- package/out/Default/gen/src/McpWorker.js +66 -0
- package/out/Default/gen/src/NetworkOverrideManager.js +447 -0
- package/out/Default/gen/src/SlimMcpResponse.js +23 -0
- package/out/Default/gen/src/TextSnapshot.js +336 -0
- package/out/Default/gen/src/ToolHandler.js +531 -0
- package/out/Default/gen/src/bin/check-latest-version.js +53 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp-main.js +80 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp.js +23 -0
- package/out/Default/gen/src/bin/chrome-devtools.js +213 -0
- package/out/Default/gen/src/collectors/PageCollector.js +325 -0
- package/out/Default/gen/src/collectors/ServiceWorkerCollector.js +198 -0
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigLocator.js +70 -0
- package/out/Default/gen/src/config/ConfigParser.js +163 -0
- package/out/Default/gen/src/config/ConfigWatcher.js +94 -0
- package/out/Default/gen/src/config/ServerConfig.js +284 -0
- package/out/Default/gen/src/config/browser-options.js +135 -0
- package/out/Default/gen/src/config/category-options.js +84 -0
- package/out/Default/gen/src/config/cli-commands.js +208 -0
- package/out/Default/gen/src/config/cli-options.js +2090 -0
- package/out/Default/gen/src/config/mcp-options.js +371 -0
- package/out/Default/gen/src/config/puppeteer-options.js +69 -0
- package/out/Default/gen/src/config/tool-options.js +60 -0
- package/out/Default/gen/src/daemon/client.js +281 -0
- package/out/Default/gen/src/daemon/daemon.js +280 -0
- package/out/Default/gen/src/daemon/types.js +7 -0
- package/out/Default/gen/src/daemon/utils.js +173 -0
- package/out/Default/gen/src/devtools/DevToolsCommentBridge.js +151 -0
- package/out/Default/gen/src/devtools/DevtoolsUtils.js +413 -0
- package/out/Default/gen/src/devtools/McpHostBindingAdapter.js +164 -0
- package/out/Default/gen/src/devtools/issueDescriptions.js +42 -0
- package/out/Default/gen/src/formatters/CommentFormatter.js +73 -0
- package/out/Default/gen/src/formatters/ConsoleFormatter.js +363 -0
- package/out/Default/gen/src/formatters/CssFormatter.js +883 -0
- package/out/Default/gen/src/formatters/HeapSnapshotFormatter.js +239 -0
- package/out/Default/gen/src/formatters/IssueFormatter.js +194 -0
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/out/Default/gen/src/formatters/NetworkFormatter.js +295 -0
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +57 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/out/Default/gen/src/formatters/SnapshotFormatter.js +172 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/formatters/constants.js +8 -0
- package/out/Default/gen/src/index.js +434 -0
- package/out/Default/gen/src/processors/ChunkedTraceParser.js +361 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +595 -0
- package/out/Default/gen/src/processors/PerformanceTrace.js +132 -0
- package/out/Default/gen/src/telemetry/ClearcutLogger.js +271 -0
- package/out/Default/gen/src/telemetry/WatchdogClient.js +60 -0
- package/out/Default/gen/src/telemetry/errors.js +18 -0
- package/out/Default/gen/src/telemetry/flagUtils.js +89 -0
- package/out/Default/gen/src/telemetry/metricsRegistry.js +85 -0
- package/out/Default/gen/src/telemetry/persistence.js +82 -0
- package/out/Default/gen/src/telemetry/transformation.js +229 -0
- package/out/Default/gen/src/telemetry/types.js +36 -0
- package/out/Default/gen/src/telemetry/watchdog/ClearcutSender.js +213 -0
- package/out/Default/gen/src/telemetry/watchdog/main.js +142 -0
- package/out/Default/gen/src/third_party/THIRD_PARTY_NOTICES +3774 -0
- package/out/Default/gen/src/third_party/browser.js +808 -0
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +139 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +125 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +111 -0
- package/out/Default/gen/src/third_party/index.js +128 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
- package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/out/Default/gen/src/tools/categories.js +37 -0
- package/out/Default/gen/src/tools/comments.js +230 -0
- package/out/Default/gen/src/tools/console.js +122 -0
- package/out/Default/gen/src/tools/css.js +54 -0
- package/out/Default/gen/src/tools/emulation.js +98 -0
- package/out/Default/gen/src/tools/extensions.js +108 -0
- package/out/Default/gen/src/tools/input.js +658 -0
- package/out/Default/gen/src/tools/lighthouse.js +279 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/memory.js +531 -0
- package/out/Default/gen/src/tools/network.js +325 -0
- package/out/Default/gen/src/tools/pages.js +420 -0
- package/out/Default/gen/src/tools/performance.js +258 -0
- package/out/Default/gen/src/tools/pwa.js +152 -0
- package/out/Default/gen/src/tools/screencast.js +160 -0
- package/out/Default/gen/src/tools/screenshot.js +315 -0
- package/out/Default/gen/src/tools/script.js +319 -0
- package/out/Default/gen/src/tools/slim/tools.js +110 -0
- package/out/Default/gen/src/tools/snapshot.js +88 -0
- package/out/Default/gen/src/tools/thirdPartyDeveloper.js +73 -0
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/out/Default/gen/src/tools/tools.js +72 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/out/Default/gen/src/tools/webmcp.js +55 -0
- package/out/Default/gen/src/types.js +21 -0
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/out/Default/gen/src/utils/WaitForHelper.js +343 -0
- package/out/Default/gen/src/utils/bytes.js +95 -0
- package/out/Default/gen/src/utils/check-for-updates.js +81 -0
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/out/Default/gen/src/utils/errorHandling.js +23 -0
- package/out/Default/gen/src/utils/files.js +81 -0
- package/out/Default/gen/src/utils/id.js +16 -0
- package/out/Default/gen/src/utils/keyboard.js +307 -0
- package/out/Default/gen/src/utils/logger.js +145 -0
- package/out/Default/gen/src/utils/logpoint.js +44 -0
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/pagination.js +50 -0
- package/out/Default/gen/src/utils/polyfill.js +11 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/out/Default/gen/src/utils/resourceType.js +27 -0
- package/out/Default/gen/src/utils/text.js +43 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/out/Default/gen/src/utils/url.js +311 -0
- package/out/Default/gen/src/version.js +11 -0
- package/package.json +125 -4
- package/skills/a11y-debugging/SKILL.md +86 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/arc-compatibility/SKILL.md +168 -0
- package/skills/arc-compatibility/SOURCES.md +216 -0
- package/skills/arc-compatibility/references/compatibility.md +113 -0
- package/skills/arc-compatibility/references/output-contract.md +62 -0
- package/skills/arc-compatibility/references/workflows.md +105 -0
- package/skills/chrome-devtools/SKILL.md +80 -0
- package/skills/chrome-devtools-cli/SKILL.md +208 -0
- package/skills/chrome-devtools-cli/references/installation.md +24 -0
- package/skills/cookie-debugging/SKILL.md +152 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/inspect-in-devtools/SKILL.md +82 -0
- package/skills/memory-leak-debugging/SKILL.md +58 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/troubleshooting/SKILL.md +107 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { UncaughtError } from './PageCollector.js';
|
|
7
|
+
import { createIdGenerator, stableIdSymbol, } from '../utils/id.js';
|
|
8
|
+
import { logger } from '../utils/logger.js';
|
|
9
|
+
const CHROME_EXTENSION_PREFIX = 'chrome-extension://';
|
|
10
|
+
/**
|
|
11
|
+
* Subscribes to one service worker target. All listeners are attached to the
|
|
12
|
+
* same {@link WebWorker} in one synchronous block, so no event is emitted
|
|
13
|
+
* before every listener exists and the target is attached only once.
|
|
14
|
+
*/
|
|
15
|
+
export class ServiceWorkerSubscriber {
|
|
16
|
+
#target;
|
|
17
|
+
#extensionId;
|
|
18
|
+
#callbacks;
|
|
19
|
+
#worker;
|
|
20
|
+
constructor(target, extensionId, callbacks) {
|
|
21
|
+
this.#target = target;
|
|
22
|
+
this.#extensionId = extensionId;
|
|
23
|
+
this.#callbacks = callbacks;
|
|
24
|
+
}
|
|
25
|
+
async subscribe() {
|
|
26
|
+
this.#worker = (await this.#target.worker()) ?? undefined;
|
|
27
|
+
if (this.#worker) {
|
|
28
|
+
this.#worker.on('console', this.#onConsole);
|
|
29
|
+
this.#worker.on('exception', this.#onException);
|
|
30
|
+
this.#worker.on('request', this.#onRequest);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
unsubscribe() {
|
|
34
|
+
if (this.#worker) {
|
|
35
|
+
this.#worker.off('console', this.#onConsole);
|
|
36
|
+
this.#worker.off('exception', this.#onException);
|
|
37
|
+
this.#worker.off('request', this.#onRequest);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
#onConsole = (message) => {
|
|
41
|
+
this.#callbacks.onConsole(message);
|
|
42
|
+
};
|
|
43
|
+
#onException = (exception) => {
|
|
44
|
+
if (!this.#worker) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const error = UncaughtError.fromException(exception, this.#extensionId, this.#worker.client);
|
|
48
|
+
if (error) {
|
|
49
|
+
this.#callbacks.onConsole(error);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
#onRequest = (request) => {
|
|
53
|
+
this.#callbacks.onRequest(request);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Stores items per extension id with stable ids, keeping at most `maxItems`
|
|
58
|
+
* per extension.
|
|
59
|
+
*/
|
|
60
|
+
export class ExtensionItemStore {
|
|
61
|
+
#storage = new Map();
|
|
62
|
+
#maxItems;
|
|
63
|
+
#idGenerator = createIdGenerator();
|
|
64
|
+
constructor(maxItems) {
|
|
65
|
+
this.#maxItems = maxItems;
|
|
66
|
+
}
|
|
67
|
+
addLog(extensionId, log) {
|
|
68
|
+
const logs = this.#storage.get(extensionId) ?? [];
|
|
69
|
+
const withId = Object.assign(log, {
|
|
70
|
+
[stableIdSymbol]: this.#idGenerator(),
|
|
71
|
+
});
|
|
72
|
+
logs.push(withId);
|
|
73
|
+
if (logs.length > this.#maxItems) {
|
|
74
|
+
logs.shift();
|
|
75
|
+
}
|
|
76
|
+
this.#storage.set(extensionId, logs);
|
|
77
|
+
}
|
|
78
|
+
getData(extensionId) {
|
|
79
|
+
return this.#storage.get(extensionId) ?? [];
|
|
80
|
+
}
|
|
81
|
+
getById(extensionId, stableId) {
|
|
82
|
+
const logs = this.#storage.get(extensionId);
|
|
83
|
+
if (!logs) {
|
|
84
|
+
throw new Error(`No items found for extension ${extensionId}.`);
|
|
85
|
+
}
|
|
86
|
+
const item = logs.find(item => item[stableIdSymbol] === stableId);
|
|
87
|
+
if (item) {
|
|
88
|
+
return item;
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Item ${stableId} not found for extension ${extensionId}.`);
|
|
91
|
+
}
|
|
92
|
+
find(extensionId, filter) {
|
|
93
|
+
const logs = this.#storage.get(extensionId);
|
|
94
|
+
if (!logs) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return logs.find(filter);
|
|
98
|
+
}
|
|
99
|
+
clearLogs(extensionId) {
|
|
100
|
+
this.#storage.delete(extensionId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Tracks extension service worker targets across the browser and stores their
|
|
105
|
+
* console messages and network requests, keyed by extension id so data
|
|
106
|
+
* survives service worker restarts.
|
|
107
|
+
*/
|
|
108
|
+
export class ServiceWorkerCollector {
|
|
109
|
+
console;
|
|
110
|
+
network;
|
|
111
|
+
#browser;
|
|
112
|
+
#serviceWorkerSubscribers = new Map();
|
|
113
|
+
constructor(browser, maxItems = 1000) {
|
|
114
|
+
this.#browser = browser;
|
|
115
|
+
this.console = new ExtensionItemStore(maxItems);
|
|
116
|
+
this.network = new ExtensionItemStore(maxItems);
|
|
117
|
+
}
|
|
118
|
+
async init(workers) {
|
|
119
|
+
if (!this.#browser) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.#browser.on('targetcreated', this.#onTargetCreated);
|
|
123
|
+
this.#browser.on('targetdestroyed', this.#onTargetDestroyed);
|
|
124
|
+
for (const worker of workers) {
|
|
125
|
+
void this.#onTargetCreated(worker.target);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
dispose() {
|
|
129
|
+
if (!this.#browser) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.#browser.off('targetcreated', this.#onTargetCreated);
|
|
133
|
+
this.#browser.off('targetdestroyed', this.#onTargetDestroyed);
|
|
134
|
+
for (const subscriber of this.#serviceWorkerSubscribers.values()) {
|
|
135
|
+
subscriber.unsubscribe();
|
|
136
|
+
}
|
|
137
|
+
this.#serviceWorkerSubscribers.clear();
|
|
138
|
+
}
|
|
139
|
+
#onTargetCreated = async (target) => {
|
|
140
|
+
if (this.#serviceWorkerSubscribers.has(target)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const origin = target.url();
|
|
144
|
+
if (target.type() === 'service_worker' && isExtensionOrigin(origin)) {
|
|
145
|
+
const extensionId = extractExtensionId(origin);
|
|
146
|
+
if (!extensionId) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const subscriber = new ServiceWorkerSubscriber(target, extensionId, {
|
|
150
|
+
onConsole: item => this.console.addLog(extensionId, item),
|
|
151
|
+
onRequest: request => this.network.addLog(extensionId, request),
|
|
152
|
+
});
|
|
153
|
+
this.#serviceWorkerSubscribers.set(target, subscriber);
|
|
154
|
+
try {
|
|
155
|
+
await subscriber.subscribe();
|
|
156
|
+
if (this.#serviceWorkerSubscribers.get(target) !== subscriber) {
|
|
157
|
+
subscriber.unsubscribe();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
if (this.#serviceWorkerSubscribers.get(target) === subscriber) {
|
|
162
|
+
this.#serviceWorkerSubscribers.delete(target);
|
|
163
|
+
}
|
|
164
|
+
if (!isIgnoredTargetError(err)) {
|
|
165
|
+
logger?.(`Failed to subscribe to service worker of extension ${extensionId} (${origin})`, err);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
#onTargetDestroyed = (target) => {
|
|
171
|
+
const subscriber = this.#serviceWorkerSubscribers.get(target);
|
|
172
|
+
if (subscriber) {
|
|
173
|
+
this.#serviceWorkerSubscribers.delete(target);
|
|
174
|
+
subscriber.unsubscribe();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function extractExtensionId(origin) {
|
|
179
|
+
if (!origin || !isExtensionOrigin(origin)) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const pathPart = origin.substring(CHROME_EXTENSION_PREFIX.length);
|
|
183
|
+
const slashIndex = pathPart.indexOf('/');
|
|
184
|
+
// if there's no / it means that pathPart is now the extensionId, otherwise
|
|
185
|
+
// we take everything until the first /
|
|
186
|
+
return slashIndex === -1 ? pathPart : pathPart.substring(0, slashIndex);
|
|
187
|
+
}
|
|
188
|
+
function isExtensionOrigin(origin) {
|
|
189
|
+
return origin.startsWith(CHROME_EXTENSION_PREFIX);
|
|
190
|
+
}
|
|
191
|
+
function isIgnoredTargetError(err) {
|
|
192
|
+
return (err instanceof Error &&
|
|
193
|
+
(err.message.includes('Target closed') ||
|
|
194
|
+
err.message.includes('Session closed') ||
|
|
195
|
+
err.message.includes('No target with given id found') ||
|
|
196
|
+
err.message.includes('No session with given id')));
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=ServiceWorkerCollector.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
export const CONFIG_FILE_NAME = 'cd4a.config.json';
|
|
10
|
+
/**
|
|
11
|
+
* Turns off config file discovery, for example in tests. A config file passed
|
|
12
|
+
* via `--config` is still used.
|
|
13
|
+
*/
|
|
14
|
+
export const NO_CONFIG_DISCOVERY_ENV = 'CHROME_DEVTOOLS_MCP_NO_CONFIG_DISCOVERY';
|
|
15
|
+
function isFile(filePath) {
|
|
16
|
+
try {
|
|
17
|
+
return fs.statSync(filePath, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Finds the config file in the predefined locations. The first existing file
|
|
25
|
+
* wins, config files are not merged.
|
|
26
|
+
*
|
|
27
|
+
* Locations, from highest to lowest priority:
|
|
28
|
+
* 1. `${PLUGIN_DATA}/cd4a.config.json`
|
|
29
|
+
* 2. The global config: `$XDG_CONFIG_HOME/cd4a/config.json` on macOS and
|
|
30
|
+
* Linux, `%LOCALAPPDATA%/Google/cd4a/config.json` on Windows, with a
|
|
31
|
+
* fallback to `~/.config/cd4a/config.json`.
|
|
32
|
+
*
|
|
33
|
+
* An explicit `--config` takes precedence over all of them and is handled by
|
|
34
|
+
* the ConfigParser. Discovery is turned off if the
|
|
35
|
+
* `CHROME_DEVTOOLS_MCP_NO_CONFIG_DISCOVERY` env variable is set.
|
|
36
|
+
*/
|
|
37
|
+
export class ConfigLocator {
|
|
38
|
+
getSearchPaths(env = process.env) {
|
|
39
|
+
const searchPaths = [];
|
|
40
|
+
const pluginData = env['PLUGIN_DATA'];
|
|
41
|
+
if (pluginData) {
|
|
42
|
+
searchPaths.push(path.join(pluginData, CONFIG_FILE_NAME));
|
|
43
|
+
}
|
|
44
|
+
searchPaths.push(this.getGlobalConfigPath(env));
|
|
45
|
+
return searchPaths;
|
|
46
|
+
}
|
|
47
|
+
getGlobalConfigPath(env = process.env, platform = process.platform, homedir = os.homedir()) {
|
|
48
|
+
if (platform === 'win32') {
|
|
49
|
+
const localAppData = env['LOCALAPPDATA'];
|
|
50
|
+
if (localAppData) {
|
|
51
|
+
return path.join(localAppData, 'Google', 'cd4a', 'config.json');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Per the XDG Base Directory spec, relative paths must be ignored.
|
|
56
|
+
const xdgConfigHome = env['XDG_CONFIG_HOME'];
|
|
57
|
+
if (xdgConfigHome && path.isAbsolute(xdgConfigHome)) {
|
|
58
|
+
return path.join(xdgConfigHome, 'cd4a', 'config.json');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return path.join(homedir, '.config', 'cd4a', 'config.json');
|
|
62
|
+
}
|
|
63
|
+
locate(env = process.env, checkIsFile = isFile) {
|
|
64
|
+
if (env[NO_CONFIG_DISCOVERY_ENV]) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return this.getSearchPaths(env).find(filePath => checkIsFile(filePath));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=ConfigLocator.js.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { yargs, hideBin, } from '../third_party/cli.js';
|
|
8
|
+
import { getErrorMessage } from '../utils/errorHandling.js';
|
|
9
|
+
import { PACKAGE_NAME } from '../version.js';
|
|
10
|
+
import { ConfigLocator } from './ConfigLocator.js';
|
|
11
|
+
import { mcpOptions, CLI_EXAMPLES, stripYargsPositionalArgs, withoutDefaults, } from './mcp-options.js';
|
|
12
|
+
import { ServerConfig } from './ServerConfig.js';
|
|
13
|
+
function isPlainObject(value) {
|
|
14
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
export class ConfigParser {
|
|
17
|
+
version;
|
|
18
|
+
argv;
|
|
19
|
+
env;
|
|
20
|
+
exitProcess;
|
|
21
|
+
#configPath;
|
|
22
|
+
#cliArgs;
|
|
23
|
+
#usageStatisticsNoticeShown = false;
|
|
24
|
+
configLocator;
|
|
25
|
+
constructor(version, argv = process.argv, env = process.env, exitProcess = true, configLocator) {
|
|
26
|
+
this.version = version;
|
|
27
|
+
this.argv = argv;
|
|
28
|
+
this.env = env;
|
|
29
|
+
this.exitProcess = exitProcess;
|
|
30
|
+
this.configLocator = configLocator ?? new ConfigLocator();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The config file resolved by the last `parse()` call, if any.
|
|
34
|
+
*/
|
|
35
|
+
get configPath() {
|
|
36
|
+
return this.#configPath;
|
|
37
|
+
}
|
|
38
|
+
buildCliParser(options = mcpOptions) {
|
|
39
|
+
const yargsInstance = yargs(hideBin(this.argv));
|
|
40
|
+
return yargsInstance
|
|
41
|
+
.scriptName(`npx ${PACKAGE_NAME}@latest`)
|
|
42
|
+
.parserConfiguration({
|
|
43
|
+
'strip-aliased': true,
|
|
44
|
+
'strip-dashed': true,
|
|
45
|
+
})
|
|
46
|
+
.options(options)
|
|
47
|
+
.showHelpOnFail(false, 'Specify --help for available options')
|
|
48
|
+
.example(CLI_EXAMPLES)
|
|
49
|
+
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
|
50
|
+
.help()
|
|
51
|
+
.version(this.version);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Step 1: parses the CLI flags without applying defaults, so the result only
|
|
55
|
+
* contains what the user passed. `--help` and `--version` print and exit the
|
|
56
|
+
* process; parse errors throw.
|
|
57
|
+
*/
|
|
58
|
+
parseCliArgs() {
|
|
59
|
+
const parsed = this.buildCliParser(withoutDefaults(mcpOptions))
|
|
60
|
+
.fail(false)
|
|
61
|
+
.parseSync();
|
|
62
|
+
return stripYargsPositionalArgs(parsed);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Step 2: reads the JSON config file and runs it through yargs to reject
|
|
66
|
+
* unknown keys and apply coercions, without applying defaults.
|
|
67
|
+
*/
|
|
68
|
+
static parseConfigFile(configPath, rawContent) {
|
|
69
|
+
try {
|
|
70
|
+
const content = rawContent ?? readFileSync(configPath, 'utf-8');
|
|
71
|
+
// Strip a leading UTF-8 byte order mark (U+FEFF). Windows PowerShell 5.1
|
|
72
|
+
// writes one by default, and JSON.parse rejects it.
|
|
73
|
+
const fileContent = JSON.parse(content.replace(/^\uFEFF/, ''));
|
|
74
|
+
if (!isPlainObject(fileContent)) {
|
|
75
|
+
throw new Error('Config must be a JSON object');
|
|
76
|
+
}
|
|
77
|
+
const configOptions = withoutDefaults(mcpOptions);
|
|
78
|
+
delete configOptions.config;
|
|
79
|
+
const parsed = yargs([])
|
|
80
|
+
.parserConfiguration({
|
|
81
|
+
'strip-aliased': true,
|
|
82
|
+
'camel-case-expansion': false,
|
|
83
|
+
})
|
|
84
|
+
.options(configOptions)
|
|
85
|
+
.help(false)
|
|
86
|
+
.version(false)
|
|
87
|
+
.config(fileContent)
|
|
88
|
+
.strict()
|
|
89
|
+
.fail(false)
|
|
90
|
+
.exitProcess(false)
|
|
91
|
+
.parseSync([]);
|
|
92
|
+
return stripYargsPositionalArgs(parsed);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
throw new Error(`Invalid JSON config file: ${getErrorMessage(err)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
parseConfigFile(configPath, rawContent) {
|
|
99
|
+
return ConfigParser.parseConfigFile(configPath, rawContent);
|
|
100
|
+
}
|
|
101
|
+
warnUnknownArgs(cliArgs) {
|
|
102
|
+
const allowedArgs = new Set(Object.keys(mcpOptions));
|
|
103
|
+
const unknownArgs = Object.keys(cliArgs).filter(arg => !allowedArgs.has(arg));
|
|
104
|
+
if (unknownArgs.length > 0) {
|
|
105
|
+
console.error(`Unknown arguments: ${unknownArgs.map(arg => `--${arg}`)}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Parses CLI arguments and the config file into a layered
|
|
110
|
+
* {@link ServerConfig}.
|
|
111
|
+
*/
|
|
112
|
+
parseConfig() {
|
|
113
|
+
try {
|
|
114
|
+
const cliArgs = this.parseCliArgs();
|
|
115
|
+
this.#cliArgs = cliArgs;
|
|
116
|
+
this.#configPath = cliArgs.config ?? this.configLocator.locate(this.env);
|
|
117
|
+
this.warnUnknownArgs(cliArgs);
|
|
118
|
+
return this.#resolveConfig(cliArgs);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (this.exitProcess) {
|
|
122
|
+
console.error(getErrorMessage(error));
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
parse() {
|
|
129
|
+
return this.parseConfig().resolved;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Re-reads the config file resolved by `parse()` and merges it with the CLI
|
|
133
|
+
* arguments again into a new {@link ServerConfig}. Unlike `parseConfig()`, it
|
|
134
|
+
* does not discover a new config file and throws on invalid configuration
|
|
135
|
+
* instead of exiting the process.
|
|
136
|
+
*/
|
|
137
|
+
reloadConfig() {
|
|
138
|
+
this.#cliArgs ??= this.parseCliArgs();
|
|
139
|
+
return this.#resolveConfig(this.#cliArgs);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Re-reads the config file resolved by `parse()` and merges it with the CLI
|
|
143
|
+
* arguments again. Unlike `parse()`, it does not discover a new config file
|
|
144
|
+
* and throws on invalid configuration instead of exiting the process.
|
|
145
|
+
*/
|
|
146
|
+
reload() {
|
|
147
|
+
return this.reloadConfig().resolved;
|
|
148
|
+
}
|
|
149
|
+
#resolveConfig(cliArgs) {
|
|
150
|
+
const configPath = this.#configPath;
|
|
151
|
+
const fileArgs = configPath ? this.parseConfigFile(configPath) : {};
|
|
152
|
+
const config = ServerConfig.create({
|
|
153
|
+
cliArgs,
|
|
154
|
+
fileArgs,
|
|
155
|
+
configPath,
|
|
156
|
+
env: this.env,
|
|
157
|
+
suppressUsageStatisticsNotice: this.#usageStatisticsNoticeShown,
|
|
158
|
+
});
|
|
159
|
+
this.#usageStatisticsNoticeShown = true;
|
|
160
|
+
return config;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=ConfigParser.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { Debouncer } from '../third_party/index.js';
|
|
9
|
+
import { getErrorMessage } from '../utils/errorHandling.js';
|
|
10
|
+
import { logger } from '../utils/logger.js';
|
|
11
|
+
const DEFAULT_DEBOUNCE_MS = 200;
|
|
12
|
+
/**
|
|
13
|
+
* Returns undefined if the file cannot be read, for example while it is being
|
|
14
|
+
* replaced.
|
|
15
|
+
*/
|
|
16
|
+
function readContent(filePath) {
|
|
17
|
+
try {
|
|
18
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Watches a config file and calls `onChange` with the new content after it was
|
|
26
|
+
* modified.
|
|
27
|
+
*
|
|
28
|
+
* - Symlinks are resolved once on start, and the directory of the real file is
|
|
29
|
+
* watched. Watching the directory instead of the file keeps working when
|
|
30
|
+
* editors save atomically by replacing the file.
|
|
31
|
+
* - Events are debounced because some platforms emit several events for a
|
|
32
|
+
* single change.
|
|
33
|
+
* - Some platforms do not report the file name, such events are not filtered.
|
|
34
|
+
* - `onChange` is only called if the content changed. For example, macOS can
|
|
35
|
+
* report events that happened shortly before the watcher was started.
|
|
36
|
+
*/
|
|
37
|
+
export class ConfigWatcher {
|
|
38
|
+
#configPath;
|
|
39
|
+
#onChange;
|
|
40
|
+
#debounceMs;
|
|
41
|
+
#watcher;
|
|
42
|
+
#debounced;
|
|
43
|
+
#content;
|
|
44
|
+
#pending = Promise.resolve();
|
|
45
|
+
constructor(configPath, onChange, options = {}) {
|
|
46
|
+
this.#configPath = configPath;
|
|
47
|
+
this.#onChange = onChange;
|
|
48
|
+
this.#debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Starts watching the config file. Throws if `configPath` does not exist.
|
|
52
|
+
*/
|
|
53
|
+
start() {
|
|
54
|
+
if (this.#watcher) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const realPath = fs.realpathSync(this.#configPath);
|
|
58
|
+
const fileName = path.basename(realPath);
|
|
59
|
+
this.#content = readContent(realPath);
|
|
60
|
+
this.#debounced = Debouncer.debounce(() => {
|
|
61
|
+
const content = readContent(realPath);
|
|
62
|
+
if (content === undefined || content === this.#content) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.#content = content;
|
|
66
|
+
this.#pending = this.#pending
|
|
67
|
+
.then(() => this.#onChange(content))
|
|
68
|
+
.catch(err => {
|
|
69
|
+
console.error(`Failed to apply ${this.#configPath}:`, err);
|
|
70
|
+
});
|
|
71
|
+
}, this.#debounceMs);
|
|
72
|
+
this.#watcher = fs.watch(path.dirname(realPath), { persistent: false }, (_eventType, changedFileName) => {
|
|
73
|
+
if (changedFileName !== null && changedFileName !== fileName) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.#debounced?.();
|
|
77
|
+
});
|
|
78
|
+
this.#watcher.on('error', err => {
|
|
79
|
+
console.error(`Stopped watching ${this.#configPath}: ${getErrorMessage(err)}`);
|
|
80
|
+
this.dispose();
|
|
81
|
+
});
|
|
82
|
+
logger?.(`Watching ${realPath} for config changes`);
|
|
83
|
+
}
|
|
84
|
+
dispose() {
|
|
85
|
+
this.#debounced?.cancel();
|
|
86
|
+
this.#debounced = undefined;
|
|
87
|
+
this.#watcher?.close();
|
|
88
|
+
this.#watcher = undefined;
|
|
89
|
+
}
|
|
90
|
+
[Symbol.dispose]() {
|
|
91
|
+
this.dispose();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=ConfigWatcher.js.map
|