chrome-devtools-mcp 0.17.1 → 0.17.2
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 +4 -1
- package/package.json +3 -3
- package/build/src/DevToolsConnectionAdapter.js +0 -69
- package/build/src/DevtoolsUtils.js +0 -340
- package/build/src/McpContext.js +0 -603
- package/build/src/McpResponse.js +0 -490
- package/build/src/Mutex.js +0 -37
- package/build/src/PageCollector.js +0 -309
- package/build/src/WaitForHelper.js +0 -139
- package/build/src/browser.js +0 -182
- package/build/src/cli.js +0 -295
- package/build/src/formatters/ConsoleFormatter.js +0 -240
- package/build/src/formatters/IssueFormatter.js +0 -190
- package/build/src/formatters/NetworkFormatter.js +0 -226
- package/build/src/formatters/SnapshotFormatter.js +0 -134
- package/build/src/index.js +0 -21
- package/build/src/issue-descriptions.js +0 -39
- package/build/src/logger.js +0 -36
- package/build/src/main.js +0 -196
- package/build/src/polyfill.js +0 -7
- package/build/src/telemetry/ClearcutLogger.js +0 -102
- package/build/src/telemetry/WatchdogClient.js +0 -60
- package/build/src/telemetry/flagUtils.js +0 -45
- package/build/src/telemetry/metricUtils.js +0 -14
- package/build/src/telemetry/persistence.js +0 -53
- package/build/src/telemetry/types.js +0 -33
- package/build/src/telemetry/watchdog/ClearcutSender.js +0 -201
- package/build/src/telemetry/watchdog/main.js +0 -127
- package/build/src/third_party/THIRD_PARTY_NOTICES +0 -2011
- package/build/src/third_party/bundled-packages.json +0 -8
- package/build/src/third_party/devtools-formatter-worker.js +0 -15449
- package/build/src/third_party/index.js +0 -172791
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -4
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -8
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -18
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -7
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -10
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -5
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -5
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +0 -5
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -9
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -9
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -3
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -4
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -4
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -8
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -7
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -10
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -12
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -8
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -7
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -6
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -7
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -7
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsInsecurePrivateNetwork.md +0 -10
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -7
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -19
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -5
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -6
- package/build/src/third_party/issue-descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -5
- package/build/src/third_party/issue-descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -5
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -8
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +0 -9
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -5
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -8
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/deprecation.md +0 -3
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -7
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -8
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -7
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -4
- package/build/src/third_party/issue-descriptions/heavyAd.md +0 -10
- package/build/src/third_party/issue-descriptions/mixedContent.md +0 -5
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -7
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -7
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -7
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -3
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -14
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -15
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -8
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -7
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -14
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -15
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -13
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -12
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -6
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -11
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -10
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -5
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -6
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -11
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -4
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -3
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -12
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -17
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -14
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -15
- package/build/src/tools/ToolDefinition.js +0 -20
- package/build/src/tools/categories.js +0 -24
- package/build/src/tools/console.js +0 -85
- package/build/src/tools/emulation.js +0 -169
- package/build/src/tools/extensions.js +0 -79
- package/build/src/tools/input.js +0 -343
- package/build/src/tools/network.js +0 -120
- package/build/src/tools/pages.js +0 -323
- package/build/src/tools/performance.js +0 -188
- package/build/src/tools/screenshot.js +0 -84
- package/build/src/tools/script.js +0 -71
- package/build/src/tools/snapshot.js +0 -52
- package/build/src/tools/tools.js +0 -31
- package/build/src/trace-processing/parse.js +0 -84
- package/build/src/utils/ExtensionRegistry.js +0 -35
- package/build/src/utils/keyboard.js +0 -296
- package/build/src/utils/pagination.js +0 -49
- package/build/src/utils/string.js +0 -36
- package/build/src/utils/types.js +0 -6
package/build/src/main.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import './polyfill.js';
|
|
7
|
-
import process from 'node:process';
|
|
8
|
-
import { ensureBrowserConnected, ensureBrowserLaunched } from './browser.js';
|
|
9
|
-
import { cliOptions, parseArguments } from './cli.js';
|
|
10
|
-
import { loadIssueDescriptions } from './issue-descriptions.js';
|
|
11
|
-
import { logger, saveLogsToFile } from './logger.js';
|
|
12
|
-
import { McpContext } from './McpContext.js';
|
|
13
|
-
import { McpResponse } from './McpResponse.js';
|
|
14
|
-
import { Mutex } from './Mutex.js';
|
|
15
|
-
import { ClearcutLogger } from './telemetry/ClearcutLogger.js';
|
|
16
|
-
import { computeFlagUsage } from './telemetry/flagUtils.js';
|
|
17
|
-
import { bucketizeLatency } from './telemetry/metricUtils.js';
|
|
18
|
-
import { McpServer, StdioServerTransport, SetLevelRequestSchema, } from './third_party/index.js';
|
|
19
|
-
import { ToolCategory } from './tools/categories.js';
|
|
20
|
-
import { tools } from './tools/tools.js';
|
|
21
|
-
// If moved update release-please config
|
|
22
|
-
// x-release-please-start-version
|
|
23
|
-
const VERSION = '0.17.1';
|
|
24
|
-
// x-release-please-end
|
|
25
|
-
export const args = parseArguments(VERSION);
|
|
26
|
-
const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
|
|
27
|
-
if (process.env['CI'] ||
|
|
28
|
-
process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']) {
|
|
29
|
-
console.error("turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.");
|
|
30
|
-
args.usageStatistics = false;
|
|
31
|
-
}
|
|
32
|
-
let clearcutLogger;
|
|
33
|
-
if (args.usageStatistics) {
|
|
34
|
-
clearcutLogger = new ClearcutLogger({
|
|
35
|
-
logFile: args.logFile,
|
|
36
|
-
appVersion: VERSION,
|
|
37
|
-
clearcutEndpoint: args.clearcutEndpoint,
|
|
38
|
-
clearcutForceFlushIntervalMs: args.clearcutForceFlushIntervalMs,
|
|
39
|
-
clearcutIncludePidHeader: args.clearcutIncludePidHeader,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
43
|
-
logger('Unhandled promise rejection', promise, reason);
|
|
44
|
-
});
|
|
45
|
-
logger(`Starting Chrome DevTools MCP Server v${VERSION}`);
|
|
46
|
-
const server = new McpServer({
|
|
47
|
-
name: 'chrome_devtools',
|
|
48
|
-
title: 'Chrome DevTools MCP server',
|
|
49
|
-
version: VERSION,
|
|
50
|
-
}, { capabilities: { logging: {} } });
|
|
51
|
-
server.server.setRequestHandler(SetLevelRequestSchema, () => {
|
|
52
|
-
return {};
|
|
53
|
-
});
|
|
54
|
-
let context;
|
|
55
|
-
async function getContext() {
|
|
56
|
-
const chromeArgs = (args.chromeArg ?? []).map(String);
|
|
57
|
-
const ignoreDefaultChromeArgs = (args.ignoreDefaultChromeArg ?? []).map(String);
|
|
58
|
-
if (args.proxyServer) {
|
|
59
|
-
chromeArgs.push(`--proxy-server=${args.proxyServer}`);
|
|
60
|
-
}
|
|
61
|
-
const devtools = args.experimentalDevtools ?? false;
|
|
62
|
-
const browser = args.browserUrl || args.wsEndpoint || args.autoConnect
|
|
63
|
-
? await ensureBrowserConnected({
|
|
64
|
-
browserURL: args.browserUrl,
|
|
65
|
-
wsEndpoint: args.wsEndpoint,
|
|
66
|
-
wsHeaders: args.wsHeaders,
|
|
67
|
-
// Important: only pass channel, if autoConnect is true.
|
|
68
|
-
channel: args.autoConnect ? args.channel : undefined,
|
|
69
|
-
userDataDir: args.userDataDir,
|
|
70
|
-
devtools,
|
|
71
|
-
})
|
|
72
|
-
: await ensureBrowserLaunched({
|
|
73
|
-
headless: args.headless,
|
|
74
|
-
executablePath: args.executablePath,
|
|
75
|
-
channel: args.channel,
|
|
76
|
-
isolated: args.isolated ?? false,
|
|
77
|
-
userDataDir: args.userDataDir,
|
|
78
|
-
logFile,
|
|
79
|
-
viewport: args.viewport,
|
|
80
|
-
chromeArgs,
|
|
81
|
-
ignoreDefaultChromeArgs,
|
|
82
|
-
acceptInsecureCerts: args.acceptInsecureCerts,
|
|
83
|
-
devtools,
|
|
84
|
-
enableExtensions: args.categoryExtensions,
|
|
85
|
-
});
|
|
86
|
-
if (context?.browser !== browser) {
|
|
87
|
-
context = await McpContext.from(browser, logger, {
|
|
88
|
-
experimentalDevToolsDebugging: devtools,
|
|
89
|
-
experimentalIncludeAllPages: args.experimentalIncludeAllPages,
|
|
90
|
-
performanceCrux: args.performanceCrux,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return context;
|
|
94
|
-
}
|
|
95
|
-
const logDisclaimers = () => {
|
|
96
|
-
console.error(`chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
|
|
97
|
-
debug, and modify any data in the browser or DevTools.
|
|
98
|
-
Avoid sharing sensitive or personal information that you do not want to share with MCP clients.`);
|
|
99
|
-
if (args.performanceCrux) {
|
|
100
|
-
console.error(`Performance tools may send trace URLs to the Google CrUX API to fetch real-user experience data. To disable, run with --no-performance-crux.`);
|
|
101
|
-
}
|
|
102
|
-
if (args.usageStatistics) {
|
|
103
|
-
console.error(`
|
|
104
|
-
Google collects usage statistics to improve Chrome DevTools MCP. To opt-out, run with --no-usage-statistics.
|
|
105
|
-
For more details, visit: https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics`);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const toolMutex = new Mutex();
|
|
109
|
-
function registerTool(tool) {
|
|
110
|
-
if (tool.annotations.category === ToolCategory.EMULATION &&
|
|
111
|
-
args.categoryEmulation === false) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (tool.annotations.category === ToolCategory.PERFORMANCE &&
|
|
115
|
-
args.categoryPerformance === false) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (tool.annotations.category === ToolCategory.NETWORK &&
|
|
119
|
-
args.categoryNetwork === false) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (tool.annotations.category === ToolCategory.EXTENSIONS &&
|
|
123
|
-
args.categoryExtensions === false) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (tool.annotations.conditions?.includes('computerVision') &&
|
|
127
|
-
!args.experimentalVision) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (tool.annotations.conditions?.includes('experimentalInteropTools') &&
|
|
131
|
-
!args.experimentalInteropTools) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
server.registerTool(tool.name, {
|
|
135
|
-
description: tool.description,
|
|
136
|
-
inputSchema: tool.schema,
|
|
137
|
-
annotations: tool.annotations,
|
|
138
|
-
}, async (params) => {
|
|
139
|
-
const guard = await toolMutex.acquire();
|
|
140
|
-
const startTime = Date.now();
|
|
141
|
-
let success = false;
|
|
142
|
-
try {
|
|
143
|
-
logger(`${tool.name} request: ${JSON.stringify(params, null, ' ')}`);
|
|
144
|
-
const context = await getContext();
|
|
145
|
-
logger(`${tool.name} context: resolved`);
|
|
146
|
-
await context.detectOpenDevToolsWindows();
|
|
147
|
-
const response = new McpResponse();
|
|
148
|
-
await tool.handler({
|
|
149
|
-
params,
|
|
150
|
-
}, response, context);
|
|
151
|
-
const { content, structuredContent } = await response.handle(tool.name, context);
|
|
152
|
-
const result = {
|
|
153
|
-
content,
|
|
154
|
-
};
|
|
155
|
-
success = true;
|
|
156
|
-
if (args.experimentalStructuredContent) {
|
|
157
|
-
result.structuredContent = structuredContent;
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
logger(`${tool.name} error:`, err, err?.stack);
|
|
163
|
-
let errorText = err && 'message' in err ? err.message : String(err);
|
|
164
|
-
if ('cause' in err && err.cause) {
|
|
165
|
-
errorText += `\nCause: ${err.cause.message}`;
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
content: [
|
|
169
|
-
{
|
|
170
|
-
type: 'text',
|
|
171
|
-
text: errorText,
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
isError: true,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
finally {
|
|
178
|
-
void clearcutLogger?.logToolInvocation({
|
|
179
|
-
toolName: tool.name,
|
|
180
|
-
success,
|
|
181
|
-
latencyMs: bucketizeLatency(Date.now() - startTime),
|
|
182
|
-
});
|
|
183
|
-
guard.dispose();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
for (const tool of tools) {
|
|
188
|
-
registerTool(tool);
|
|
189
|
-
}
|
|
190
|
-
await loadIssueDescriptions();
|
|
191
|
-
const transport = new StdioServerTransport();
|
|
192
|
-
await server.connect(transport);
|
|
193
|
-
logger('Chrome DevTools MCP Server connected');
|
|
194
|
-
logDisclaimers();
|
|
195
|
-
void clearcutLogger?.logDailyActiveIfNeeded();
|
|
196
|
-
void clearcutLogger?.logServerStart(computeFlagUsage(args, cliOptions));
|
package/build/src/polyfill.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import process from 'node:process';
|
|
7
|
-
import { logger } from '../logger.js';
|
|
8
|
-
import { FilePersistence } from './persistence.js';
|
|
9
|
-
import { WatchdogMessageType, OsType } from './types.js';
|
|
10
|
-
import { WatchdogClient } from './WatchdogClient.js';
|
|
11
|
-
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
12
|
-
function detectOsType() {
|
|
13
|
-
switch (process.platform) {
|
|
14
|
-
case 'win32':
|
|
15
|
-
return OsType.OS_TYPE_WINDOWS;
|
|
16
|
-
case 'darwin':
|
|
17
|
-
return OsType.OS_TYPE_MACOS;
|
|
18
|
-
case 'linux':
|
|
19
|
-
return OsType.OS_TYPE_LINUX;
|
|
20
|
-
default:
|
|
21
|
-
return OsType.OS_TYPE_UNSPECIFIED;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export class ClearcutLogger {
|
|
25
|
-
#persistence;
|
|
26
|
-
#watchdog;
|
|
27
|
-
constructor(options) {
|
|
28
|
-
this.#persistence = options.persistence ?? new FilePersistence();
|
|
29
|
-
this.#watchdog =
|
|
30
|
-
options.watchdogClient ??
|
|
31
|
-
new WatchdogClient({
|
|
32
|
-
parentPid: process.pid,
|
|
33
|
-
appVersion: options.appVersion,
|
|
34
|
-
osType: detectOsType(),
|
|
35
|
-
logFile: options.logFile,
|
|
36
|
-
clearcutEndpoint: options.clearcutEndpoint,
|
|
37
|
-
clearcutForceFlushIntervalMs: options.clearcutForceFlushIntervalMs,
|
|
38
|
-
clearcutIncludePidHeader: options.clearcutIncludePidHeader,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async logToolInvocation(args) {
|
|
42
|
-
this.#watchdog.send({
|
|
43
|
-
type: WatchdogMessageType.LOG_EVENT,
|
|
44
|
-
payload: {
|
|
45
|
-
tool_invocation: {
|
|
46
|
-
tool_name: args.toolName,
|
|
47
|
-
success: args.success,
|
|
48
|
-
latency_ms: args.latencyMs,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async logServerStart(flagUsage) {
|
|
54
|
-
this.#watchdog.send({
|
|
55
|
-
type: WatchdogMessageType.LOG_EVENT,
|
|
56
|
-
payload: {
|
|
57
|
-
server_start: {
|
|
58
|
-
flag_usage: flagUsage,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async logDailyActiveIfNeeded() {
|
|
64
|
-
try {
|
|
65
|
-
const state = await this.#persistence.loadState();
|
|
66
|
-
if (this.#shouldLogDailyActive(state)) {
|
|
67
|
-
let daysSince = -1;
|
|
68
|
-
if (state.lastActive) {
|
|
69
|
-
const lastActiveDate = new Date(state.lastActive);
|
|
70
|
-
const now = new Date();
|
|
71
|
-
const diffTime = Math.abs(now.getTime() - lastActiveDate.getTime());
|
|
72
|
-
daysSince = Math.ceil(diffTime / MS_PER_DAY);
|
|
73
|
-
}
|
|
74
|
-
this.#watchdog.send({
|
|
75
|
-
type: WatchdogMessageType.LOG_EVENT,
|
|
76
|
-
payload: {
|
|
77
|
-
daily_active: {
|
|
78
|
-
days_since_last_active: daysSince,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
state.lastActive = new Date().toISOString();
|
|
83
|
-
await this.#persistence.saveState(state);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
logger('Error in logDailyActiveIfNeeded:', err);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
#shouldLogDailyActive(state) {
|
|
91
|
-
if (!state.lastActive) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
const lastActiveDate = new Date(state.lastActive);
|
|
95
|
-
const now = new Date();
|
|
96
|
-
// Compare UTC dates
|
|
97
|
-
const isSameDay = lastActiveDate.getUTCFullYear() === now.getUTCFullYear() &&
|
|
98
|
-
lastActiveDate.getUTCMonth() === now.getUTCMonth() &&
|
|
99
|
-
lastActiveDate.getUTCDate() === now.getUTCDate();
|
|
100
|
-
return !isSameDay;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { spawn } from 'node:child_process';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { logger } from '../logger.js';
|
|
9
|
-
export class WatchdogClient {
|
|
10
|
-
#childProcess;
|
|
11
|
-
constructor(config, options) {
|
|
12
|
-
const watchdogPath = fileURLToPath(new URL('./watchdog/main.js', import.meta.url));
|
|
13
|
-
const args = [
|
|
14
|
-
watchdogPath,
|
|
15
|
-
`--parent-pid=${config.parentPid}`,
|
|
16
|
-
`--app-version=${config.appVersion}`,
|
|
17
|
-
`--os-type=${config.osType}`,
|
|
18
|
-
];
|
|
19
|
-
if (config.logFile) {
|
|
20
|
-
args.push(`--log-file=${config.logFile}`);
|
|
21
|
-
}
|
|
22
|
-
if (config.clearcutEndpoint) {
|
|
23
|
-
args.push(`--clearcut-endpoint=${config.clearcutEndpoint}`);
|
|
24
|
-
}
|
|
25
|
-
if (config.clearcutForceFlushIntervalMs) {
|
|
26
|
-
args.push(`--clearcut-force-flush-interval-ms=${config.clearcutForceFlushIntervalMs}`);
|
|
27
|
-
}
|
|
28
|
-
if (config.clearcutIncludePidHeader) {
|
|
29
|
-
args.push('--clearcut-include-pid-header');
|
|
30
|
-
}
|
|
31
|
-
const spawner = options?.spawn ?? spawn;
|
|
32
|
-
this.#childProcess = spawner(process.execPath, args, {
|
|
33
|
-
stdio: ['pipe', 'ignore', 'ignore'],
|
|
34
|
-
detached: true,
|
|
35
|
-
});
|
|
36
|
-
this.#childProcess.unref();
|
|
37
|
-
this.#childProcess.on('error', err => {
|
|
38
|
-
logger('Watchdog process error:', err);
|
|
39
|
-
});
|
|
40
|
-
this.#childProcess.on('exit', (code, signal) => {
|
|
41
|
-
logger(`Watchdog exited with code ${code} and signal ${signal}`);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
send(message) {
|
|
45
|
-
if (this.#childProcess.stdin &&
|
|
46
|
-
!this.#childProcess.stdin.destroyed &&
|
|
47
|
-
this.#childProcess.pid) {
|
|
48
|
-
try {
|
|
49
|
-
const line = JSON.stringify(message) + '\n';
|
|
50
|
-
this.#childProcess.stdin.write(line);
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
logger('Failed to write to watchdog stdin', err);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
logger('Watchdog stdin not available, dropping message');
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { toSnakeCase } from '../utils/string.js';
|
|
7
|
-
/**
|
|
8
|
-
* Computes telemetry flag usage from parsed arguments and CLI options.
|
|
9
|
-
*
|
|
10
|
-
* Iterates over the defined CLI options to construct a payload:
|
|
11
|
-
* - Flag names are converted to snake_case (e.g. `browserUrl` -> `browser_url`).
|
|
12
|
-
* - A flag is logged as `{flag_name}_present` if:
|
|
13
|
-
* - It has no default value, OR
|
|
14
|
-
* - The provided value differs from the default value.
|
|
15
|
-
* - Boolean flags are logged with their literal value.
|
|
16
|
-
* - String flags with defined `choices` (Enums) are logged as their uppercase value.
|
|
17
|
-
*/
|
|
18
|
-
export function computeFlagUsage(args, options) {
|
|
19
|
-
const usage = {};
|
|
20
|
-
for (const [flagName, config] of Object.entries(options)) {
|
|
21
|
-
const value = args[flagName];
|
|
22
|
-
const snakeCaseName = toSnakeCase(flagName);
|
|
23
|
-
// If there isn't a default value provided for the flag,
|
|
24
|
-
// we're going to log whether it's present on the args user
|
|
25
|
-
// provided or not. If there is a default value, we only log presence
|
|
26
|
-
// if the value differs from the default, implying explicit user intent.
|
|
27
|
-
if (!('default' in config) || value !== config.default) {
|
|
28
|
-
usage[`${snakeCaseName}_present`] = value !== undefined && value !== null;
|
|
29
|
-
}
|
|
30
|
-
if (config.type === 'boolean' && typeof value === 'boolean') {
|
|
31
|
-
// For boolean options, we're going to log the value directly.
|
|
32
|
-
usage[snakeCaseName] = value;
|
|
33
|
-
}
|
|
34
|
-
else if (config.type === 'string' &&
|
|
35
|
-
typeof value === 'string' &&
|
|
36
|
-
'choices' in config &&
|
|
37
|
-
config.choices) {
|
|
38
|
-
// For enums, log the value as uppercase
|
|
39
|
-
// We're going to have an enum for such flags with choices represented
|
|
40
|
-
// as an `enum` where the keys of the enum will map to the uppercase `choice`.
|
|
41
|
-
usage[snakeCaseName] = `${snakeCaseName}_${value}`.toUpperCase();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return usage;
|
|
45
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
const LATENCY_BUCKETS = [50, 100, 250, 500, 1000, 2500, 5000, 10000];
|
|
7
|
-
export function bucketizeLatency(latencyMs) {
|
|
8
|
-
for (const bucket of LATENCY_BUCKETS) {
|
|
9
|
-
if (latencyMs <= bucket) {
|
|
10
|
-
return bucket;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return LATENCY_BUCKETS[LATENCY_BUCKETS.length - 1];
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import fs from 'node:fs/promises';
|
|
7
|
-
import os from 'node:os';
|
|
8
|
-
import path from 'node:path';
|
|
9
|
-
import process from 'node:process';
|
|
10
|
-
import { logger } from '../logger.js';
|
|
11
|
-
const STATE_FILE_NAME = 'telemetry_state.json';
|
|
12
|
-
function getDataFolder() {
|
|
13
|
-
const homedir = os.homedir();
|
|
14
|
-
const { env } = process;
|
|
15
|
-
const name = 'chrome-devtools-mcp';
|
|
16
|
-
if (process.platform === 'darwin') {
|
|
17
|
-
return path.join(homedir, 'Library', 'Application Support', name);
|
|
18
|
-
}
|
|
19
|
-
if (process.platform === 'win32') {
|
|
20
|
-
const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
|
|
21
|
-
return path.join(localAppData, name, 'Data');
|
|
22
|
-
}
|
|
23
|
-
return path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name);
|
|
24
|
-
}
|
|
25
|
-
export class FilePersistence {
|
|
26
|
-
#dataFolder;
|
|
27
|
-
constructor(dataFolderOverride) {
|
|
28
|
-
this.#dataFolder = dataFolderOverride ?? getDataFolder();
|
|
29
|
-
}
|
|
30
|
-
async loadState() {
|
|
31
|
-
try {
|
|
32
|
-
const filePath = path.join(this.#dataFolder, STATE_FILE_NAME);
|
|
33
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
34
|
-
return JSON.parse(content);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return {
|
|
38
|
-
lastActive: '',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async saveState(state) {
|
|
43
|
-
const filePath = path.join(this.#dataFolder, STATE_FILE_NAME);
|
|
44
|
-
try {
|
|
45
|
-
await fs.mkdir(this.#dataFolder, { recursive: true });
|
|
46
|
-
await fs.writeFile(filePath, JSON.stringify(state, null, 2), 'utf-8');
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
// Ignore errors during state saving to avoid crashing the server
|
|
50
|
-
logger(`Failed to save telemetry state to ${filePath}:`, error);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
// Enums
|
|
7
|
-
export var OsType;
|
|
8
|
-
(function (OsType) {
|
|
9
|
-
OsType[OsType["OS_TYPE_UNSPECIFIED"] = 0] = "OS_TYPE_UNSPECIFIED";
|
|
10
|
-
OsType[OsType["OS_TYPE_WINDOWS"] = 1] = "OS_TYPE_WINDOWS";
|
|
11
|
-
OsType[OsType["OS_TYPE_MACOS"] = 2] = "OS_TYPE_MACOS";
|
|
12
|
-
OsType[OsType["OS_TYPE_LINUX"] = 3] = "OS_TYPE_LINUX";
|
|
13
|
-
})(OsType || (OsType = {}));
|
|
14
|
-
export var ChromeChannel;
|
|
15
|
-
(function (ChromeChannel) {
|
|
16
|
-
ChromeChannel[ChromeChannel["CHROME_CHANNEL_UNSPECIFIED"] = 0] = "CHROME_CHANNEL_UNSPECIFIED";
|
|
17
|
-
ChromeChannel[ChromeChannel["CHROME_CHANNEL_CANARY"] = 1] = "CHROME_CHANNEL_CANARY";
|
|
18
|
-
ChromeChannel[ChromeChannel["CHROME_CHANNEL_DEV"] = 2] = "CHROME_CHANNEL_DEV";
|
|
19
|
-
ChromeChannel[ChromeChannel["CHROME_CHANNEL_BETA"] = 3] = "CHROME_CHANNEL_BETA";
|
|
20
|
-
ChromeChannel[ChromeChannel["CHROME_CHANNEL_STABLE"] = 4] = "CHROME_CHANNEL_STABLE";
|
|
21
|
-
})(ChromeChannel || (ChromeChannel = {}));
|
|
22
|
-
export var McpClient;
|
|
23
|
-
(function (McpClient) {
|
|
24
|
-
McpClient[McpClient["MCP_CLIENT_UNSPECIFIED"] = 0] = "MCP_CLIENT_UNSPECIFIED";
|
|
25
|
-
McpClient[McpClient["MCP_CLIENT_CLAUDE_CODE"] = 1] = "MCP_CLIENT_CLAUDE_CODE";
|
|
26
|
-
McpClient[McpClient["MCP_CLIENT_GEMINI_CLI"] = 2] = "MCP_CLIENT_GEMINI_CLI";
|
|
27
|
-
})(McpClient || (McpClient = {}));
|
|
28
|
-
// IPC types for messages between the main process and the
|
|
29
|
-
// telemetry watchdog process.
|
|
30
|
-
export var WatchdogMessageType;
|
|
31
|
-
(function (WatchdogMessageType) {
|
|
32
|
-
WatchdogMessageType["LOG_EVENT"] = "log-event";
|
|
33
|
-
})(WatchdogMessageType || (WatchdogMessageType = {}));
|