@yezack/chrome-devtools-mcp-108 0.0.0-stage → 1.10.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/FORK-NOTICE.md +45 -0
- package/LICENSE +202 -0
- package/README.md +45 -2
- package/build/src/BrowserManager.js +401 -0
- package/build/src/McpContext.js +642 -0
- package/build/src/McpPage.js +850 -0
- package/build/src/McpResponse.js +1086 -0
- package/build/src/SlimMcpResponse.js +19 -0
- package/build/src/TextSnapshot.js +315 -0
- package/build/src/ToolHandler.js +322 -0
- package/build/src/bin/check-latest-version.js +51 -0
- package/build/src/bin/chrome-devtools-mcp-main.js +77 -0
- package/build/src/bin/chrome-devtools-mcp.js +23 -0
- package/build/src/bin/chrome-devtools.js +222 -0
- package/build/src/collectors/PageCollector.js +291 -0
- package/build/src/collectors/ServiceWorkerCollector.js +171 -0
- package/build/src/config/browser-options.js +125 -0
- package/build/src/config/category-options.js +89 -0
- package/build/src/config/cli-commands.js +26 -0
- package/build/src/config/cli-options.js +1473 -0
- package/build/src/config/mcp-options.js +417 -0
- package/build/src/daemon/client.js +221 -0
- package/build/src/daemon/daemon.js +266 -0
- package/build/src/daemon/types.js +7 -0
- package/build/src/daemon/utils.js +136 -0
- package/build/src/devtools/DevToolsCommentBridge.js +91 -0
- package/build/src/devtools/DevtoolsUtils.js +307 -0
- package/build/src/devtools/McpHostBindingAdapter.js +165 -0
- package/build/src/devtools/issueDescriptions.js +42 -0
- package/build/src/formatters/CommentFormatter.js +82 -0
- package/build/src/formatters/ConsoleFormatter.js +321 -0
- package/build/src/formatters/CssFormatter.js +812 -0
- package/build/src/formatters/HeapSnapshotFormatter.js +185 -0
- package/build/src/formatters/IssueFormatter.js +193 -0
- package/build/src/formatters/NetworkFormatter.js +241 -0
- package/build/src/formatters/SnapshotFormatter.js +135 -0
- package/build/src/index.js +237 -0
- package/build/src/processors/ChunkedTraceParser.js +361 -0
- package/build/src/processors/HeapSnapshotManager.js +270 -0
- package/build/src/processors/PerformanceTrace.js +132 -0
- package/build/src/telemetry/ClearcutLogger.js +242 -0
- package/build/src/telemetry/WatchdogClient.js +61 -0
- package/build/src/telemetry/errors.js +18 -0
- package/build/src/telemetry/flagUtils.js +90 -0
- package/build/src/telemetry/metricsRegistry.js +85 -0
- package/build/src/telemetry/persistence.js +82 -0
- package/build/src/telemetry/transformation.js +233 -0
- package/build/src/telemetry/types.js +36 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
- package/build/src/telemetry/watchdog/main.js +128 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +4077 -0
- package/build/src/third_party/bundled-packages.json +12 -0
- package/build/src/third_party/devtools-formatter-worker.js +15494 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +10979 -0
- package/build/src/third_party/index.js +200978 -0
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/build/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
- package/build/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/build/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/build/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
- package/build/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +58435 -0
- package/build/src/tools/ToolDefinition.js +80 -0
- package/build/src/tools/categories.js +33 -0
- package/build/src/tools/comments.js +169 -0
- package/build/src/tools/console.js +104 -0
- package/build/src/tools/css.js +45 -0
- package/build/src/tools/emulation.js +84 -0
- package/build/src/tools/extensions.js +103 -0
- package/build/src/tools/input.js +652 -0
- package/build/src/tools/lighthouse.js +149 -0
- package/build/src/tools/memory.js +424 -0
- package/build/src/tools/network.js +128 -0
- package/build/src/tools/pages.js +363 -0
- package/build/src/tools/performance.js +212 -0
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +119 -0
- package/build/src/tools/screenshot.js +277 -0
- package/build/src/tools/script.js +232 -0
- package/build/src/tools/slim/tools.js +96 -0
- package/build/src/tools/snapshot.js +63 -0
- package/build/src/tools/thirdPartyDeveloper.js +85 -0
- package/build/src/tools/tools.js +55 -0
- package/build/src/tools/webmcp.js +66 -0
- package/build/src/types.js +10 -0
- package/build/src/utils/WaitForHelper.js +316 -0
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/check-for-updates.js +75 -0
- package/build/src/utils/files.js +57 -0
- package/build/src/utils/id.js +16 -0
- package/build/src/utils/keyboard.js +297 -0
- package/build/src/utils/logger.js +52 -0
- package/build/src/utils/pagination.js +50 -0
- package/build/src/utils/polyfill.js +11 -0
- package/build/src/utils/url.js +116 -0
- package/build/src/version.js +10 -0
- package/package.json +41 -4
- package/skills/a11y-debugging/SKILL.md +91 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/chrome-devtools/SKILL.md +74 -0
- package/skills/chrome-devtools-cli/SKILL.md +194 -0
- package/skills/chrome-devtools-cli/references/installation.md +14 -0
- package/skills/cookie-debugging/SKILL.md +149 -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/memory-leak-debugging/SKILL.md +58 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/troubleshooting/SKILL.md +99 -0
|
@@ -0,0 +1,82 @@
|
|
|
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 '../utils/logger.js';
|
|
11
|
+
import { ClearcutLogger } from './ClearcutLogger.js';
|
|
12
|
+
import { ErrorCode } from './errors.js';
|
|
13
|
+
function isValidTime(time) {
|
|
14
|
+
if (time === undefined) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (typeof time !== 'string' || time === '') {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return !Number.isNaN(new Date(time).getTime());
|
|
21
|
+
}
|
|
22
|
+
function isContextValid(state) {
|
|
23
|
+
return isValidTime(state.lastActive) && isValidTime(state.lastToolCall);
|
|
24
|
+
}
|
|
25
|
+
const STATE_FILE_NAME = 'telemetry_state.json';
|
|
26
|
+
function getDataFolder() {
|
|
27
|
+
const homedir = os.homedir();
|
|
28
|
+
const { env } = process;
|
|
29
|
+
const name = 'chrome-devtools-mcp';
|
|
30
|
+
if (process.platform === 'darwin') {
|
|
31
|
+
return path.join(homedir, 'Library', 'Application Support', name);
|
|
32
|
+
}
|
|
33
|
+
if (process.platform === 'win32') {
|
|
34
|
+
const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
|
|
35
|
+
return path.join(localAppData, name, 'Data');
|
|
36
|
+
}
|
|
37
|
+
return path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name);
|
|
38
|
+
}
|
|
39
|
+
export class FilePersistence {
|
|
40
|
+
#dataFolder;
|
|
41
|
+
constructor(dataFolderOverride) {
|
|
42
|
+
this.#dataFolder = dataFolderOverride ?? getDataFolder();
|
|
43
|
+
}
|
|
44
|
+
async loadState() {
|
|
45
|
+
const filePath = path.join(this.#dataFolder, STATE_FILE_NAME);
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(filePath);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// File doesn't exist. Not an error because new users do not have the state file.
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
let state;
|
|
54
|
+
try {
|
|
55
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
56
|
+
state = JSON.parse(content);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger?.(`Failed to read telemetry state from ${filePath}:`, error);
|
|
60
|
+
void ClearcutLogger.get()?.logServerError({
|
|
61
|
+
errorCode: ErrorCode.ERROR_CODE_PERSISTENCE_FILE_READ_FAILED,
|
|
62
|
+
});
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
return isContextValid(state) ? state : {};
|
|
66
|
+
}
|
|
67
|
+
async saveState(state) {
|
|
68
|
+
const filePath = path.join(this.#dataFolder, STATE_FILE_NAME);
|
|
69
|
+
try {
|
|
70
|
+
await fs.mkdir(this.#dataFolder, { recursive: true });
|
|
71
|
+
await fs.writeFile(filePath, JSON.stringify(state, null, 2), 'utf-8');
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
// Ignore errors during state saving to avoid crashing the server
|
|
75
|
+
logger?.(`Failed to save telemetry state to ${filePath}:`, error);
|
|
76
|
+
void ClearcutLogger.get()?.logServerError({
|
|
77
|
+
errorCode: ErrorCode.ERROR_CODE_PERSISTENCE_FILE_SAVE_FAILED,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=persistence.js.map
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { isLocalhost } from '../utils/url.js';
|
|
7
|
+
const LATENCY_BUCKETS = [50, 100, 250, 500, 1000, 2500, 5000, 10000];
|
|
8
|
+
export function bucketizeLatency(latencyMs) {
|
|
9
|
+
for (const bucket of LATENCY_BUCKETS) {
|
|
10
|
+
if (latencyMs <= bucket) {
|
|
11
|
+
return bucket;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return LATENCY_BUCKETS[LATENCY_BUCKETS.length - 1];
|
|
15
|
+
}
|
|
16
|
+
export const MAX_ACTIVE_DAYS = 31;
|
|
17
|
+
export function bucketizeDaysSince(days) {
|
|
18
|
+
return Math.min(days, MAX_ACTIVE_DAYS);
|
|
19
|
+
}
|
|
20
|
+
export const REDACTED_CLIENT_NAME = '<redacted>';
|
|
21
|
+
const VALID_CLIENT_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
|
|
22
|
+
const MAX_CLIENT_NAME_LENGTH = 32;
|
|
23
|
+
export function sanitizeClientName(clientName) {
|
|
24
|
+
if (clientName.length > 0 &&
|
|
25
|
+
clientName.length < MAX_CLIENT_NAME_LENGTH &&
|
|
26
|
+
VALID_CLIENT_NAME_REGEX.test(clientName)) {
|
|
27
|
+
return clientName;
|
|
28
|
+
}
|
|
29
|
+
return REDACTED_CLIENT_NAME;
|
|
30
|
+
}
|
|
31
|
+
export const PARAM_BLOCKLIST = new Set(['uid', 'reqid', 'msgid']);
|
|
32
|
+
const SUPPORTED_ZOD_TYPES = [
|
|
33
|
+
'ZodString',
|
|
34
|
+
'ZodNumber',
|
|
35
|
+
'ZodBoolean',
|
|
36
|
+
'ZodArray',
|
|
37
|
+
'ZodEnum',
|
|
38
|
+
];
|
|
39
|
+
function isObjectWithDef(val) {
|
|
40
|
+
return typeof val === 'object' && val !== null && '_def' in val;
|
|
41
|
+
}
|
|
42
|
+
function isZodType(type) {
|
|
43
|
+
return SUPPORTED_ZOD_TYPES.includes(type);
|
|
44
|
+
}
|
|
45
|
+
export function getZodType(zodType) {
|
|
46
|
+
if (!isObjectWithDef(zodType)) {
|
|
47
|
+
throw new Error('Invalid zod schema');
|
|
48
|
+
}
|
|
49
|
+
const def = zodType._def;
|
|
50
|
+
let typeName = def.typeName;
|
|
51
|
+
if (!typeName && def.type) {
|
|
52
|
+
typeName = 'Zod' + def.type.charAt(0).toUpperCase() + def.type.slice(1);
|
|
53
|
+
}
|
|
54
|
+
if (typeName === 'ZodOptional' ||
|
|
55
|
+
typeName === 'ZodDefault' ||
|
|
56
|
+
typeName === 'ZodNullable') {
|
|
57
|
+
return getZodType(def.innerType);
|
|
58
|
+
}
|
|
59
|
+
if (typeName === 'ZodEffects') {
|
|
60
|
+
return getZodType(def.schema);
|
|
61
|
+
}
|
|
62
|
+
if (typeName === 'ZodPipeline' || typeName === 'ZodPipe') {
|
|
63
|
+
return getZodType(isObjectWithDef(def.in) &&
|
|
64
|
+
(def.in._def.type === 'transform' ||
|
|
65
|
+
def.in._def.typeName === 'ZodTransform')
|
|
66
|
+
? def.out
|
|
67
|
+
: def.in);
|
|
68
|
+
}
|
|
69
|
+
if (typeName && isZodType(typeName)) {
|
|
70
|
+
return typeName;
|
|
71
|
+
}
|
|
72
|
+
throw new Error(`Unsupported zod type for tool parameter: ${typeName}`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolves the values of an enum parameter, unwrapping any optional/default/
|
|
76
|
+
* nullable/effects wrappers (in any order), mirroring {@link getZodType}.
|
|
77
|
+
*/
|
|
78
|
+
export function getEnumValues(zodType) {
|
|
79
|
+
if (!isObjectWithDef(zodType)) {
|
|
80
|
+
throw new Error('Invalid zod schema');
|
|
81
|
+
}
|
|
82
|
+
const def = zodType._def;
|
|
83
|
+
let typeName = def.typeName;
|
|
84
|
+
if (!typeName && def.type) {
|
|
85
|
+
typeName = 'Zod' + def.type.charAt(0).toUpperCase() + def.type.slice(1);
|
|
86
|
+
}
|
|
87
|
+
if (typeName === 'ZodOptional' ||
|
|
88
|
+
typeName === 'ZodDefault' ||
|
|
89
|
+
typeName === 'ZodNullable') {
|
|
90
|
+
return getEnumValues(def.innerType);
|
|
91
|
+
}
|
|
92
|
+
if (typeName === 'ZodEffects') {
|
|
93
|
+
return getEnumValues(def.schema);
|
|
94
|
+
}
|
|
95
|
+
if (typeName === 'ZodPipeline' || typeName === 'ZodPipe') {
|
|
96
|
+
return getEnumValues(isObjectWithDef(def.in) &&
|
|
97
|
+
(def.in._def.type === 'transform' ||
|
|
98
|
+
def.in._def.typeName === 'ZodTransform')
|
|
99
|
+
? def.out
|
|
100
|
+
: def.in);
|
|
101
|
+
}
|
|
102
|
+
if (typeName === 'ZodEnum') {
|
|
103
|
+
if (def.values) {
|
|
104
|
+
return def.values;
|
|
105
|
+
}
|
|
106
|
+
if (def.entries) {
|
|
107
|
+
return Object.values(def.entries);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw new Error(`Cannot resolve enum values for zod type: ${typeName}`);
|
|
111
|
+
}
|
|
112
|
+
export function stripUnderscoreBeforeNumber(name) {
|
|
113
|
+
return name.replace(/_([0-9])/g, '$1');
|
|
114
|
+
}
|
|
115
|
+
export function transformArgName(zodType, name) {
|
|
116
|
+
const snakeCaseName = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
|
|
117
|
+
let transformed;
|
|
118
|
+
if (zodType === 'ZodString') {
|
|
119
|
+
transformed = `${snakeCaseName}_length`;
|
|
120
|
+
}
|
|
121
|
+
else if (zodType === 'ZodArray') {
|
|
122
|
+
transformed = `${snakeCaseName}_count`;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
transformed = snakeCaseName;
|
|
126
|
+
}
|
|
127
|
+
return stripUnderscoreBeforeNumber(transformed);
|
|
128
|
+
}
|
|
129
|
+
export function transformArgType(zodType) {
|
|
130
|
+
if (zodType === 'ZodString' || zodType === 'ZodArray') {
|
|
131
|
+
return 'number';
|
|
132
|
+
}
|
|
133
|
+
switch (zodType) {
|
|
134
|
+
case 'ZodNumber':
|
|
135
|
+
return 'number';
|
|
136
|
+
case 'ZodBoolean':
|
|
137
|
+
return 'boolean';
|
|
138
|
+
case 'ZodEnum':
|
|
139
|
+
return 'enum';
|
|
140
|
+
default:
|
|
141
|
+
throw new Error(`Unsupported zod type for tool parameter: ${zodType}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const BUCKETS = [
|
|
145
|
+
0, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000,
|
|
146
|
+
];
|
|
147
|
+
function bucketize(value) {
|
|
148
|
+
for (const bucket of BUCKETS) {
|
|
149
|
+
if (bucket >= value) {
|
|
150
|
+
return bucket;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return BUCKETS[BUCKETS.length - 1];
|
|
154
|
+
}
|
|
155
|
+
function transformValue(zodType, value) {
|
|
156
|
+
if (zodType === 'ZodString') {
|
|
157
|
+
return bucketize(value.length);
|
|
158
|
+
}
|
|
159
|
+
else if (zodType === 'ZodArray') {
|
|
160
|
+
return value.length;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function hasEquivalentType(zodType, value) {
|
|
167
|
+
if (zodType === 'ZodString') {
|
|
168
|
+
return typeof value === 'string';
|
|
169
|
+
}
|
|
170
|
+
else if (zodType === 'ZodArray') {
|
|
171
|
+
return Array.isArray(value);
|
|
172
|
+
}
|
|
173
|
+
else if (zodType === 'ZodNumber') {
|
|
174
|
+
return typeof value === 'number';
|
|
175
|
+
}
|
|
176
|
+
else if (zodType === 'ZodBoolean') {
|
|
177
|
+
return typeof value === 'boolean';
|
|
178
|
+
}
|
|
179
|
+
else if (zodType === 'ZodEnum') {
|
|
180
|
+
return (typeof value === 'string' ||
|
|
181
|
+
typeof value === 'number' ||
|
|
182
|
+
typeof value === 'boolean');
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export function sanitizeParams(params, schema) {
|
|
189
|
+
const transformed = {};
|
|
190
|
+
for (const [name, value] of Object.entries(params)) {
|
|
191
|
+
if (PARAM_BLOCKLIST.has(name)) {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const zodType = getZodType(schema[name]);
|
|
195
|
+
if (!hasEquivalentType(zodType, value)) {
|
|
196
|
+
throw new Error(`parameter ${name} has type ${zodType} but value ${value} is not of equivalent type`);
|
|
197
|
+
}
|
|
198
|
+
const transformedName = transformArgName(zodType, name);
|
|
199
|
+
const transformedValue = transformValue(zodType, value);
|
|
200
|
+
transformed[transformedName] = transformedValue;
|
|
201
|
+
}
|
|
202
|
+
return transformed;
|
|
203
|
+
}
|
|
204
|
+
function transformDevToolsData(devToolsData) {
|
|
205
|
+
const logged = {};
|
|
206
|
+
if (devToolsData.cdpBackendNodeId !== undefined) {
|
|
207
|
+
logged.is_dom_element_selected = true;
|
|
208
|
+
}
|
|
209
|
+
if (devToolsData.cdpRequestId !== undefined) {
|
|
210
|
+
logged.is_network_request_selected = true;
|
|
211
|
+
}
|
|
212
|
+
return logged;
|
|
213
|
+
}
|
|
214
|
+
export function buildContext(devToolsData, pageUrl) {
|
|
215
|
+
let context;
|
|
216
|
+
if (devToolsData === undefined) {
|
|
217
|
+
context = { is_devtools_open: false };
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
context = {
|
|
221
|
+
is_devtools_open: Object.keys(devToolsData).length > 0,
|
|
222
|
+
};
|
|
223
|
+
const loggedDevtoolsData = transformDevToolsData(devToolsData);
|
|
224
|
+
if (Object.keys(loggedDevtoolsData).length > 0) {
|
|
225
|
+
context.devtools_data = loggedDevtoolsData;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (pageUrl !== undefined) {
|
|
229
|
+
context.is_localhost = isLocalhost(pageUrl);
|
|
230
|
+
}
|
|
231
|
+
return context;
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=transformation.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
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 McpClient;
|
|
15
|
+
(function (McpClient) {
|
|
16
|
+
McpClient[McpClient["MCP_CLIENT_UNSPECIFIED"] = 0] = "MCP_CLIENT_UNSPECIFIED";
|
|
17
|
+
McpClient[McpClient["MCP_CLIENT_CLAUDE_CODE"] = 1] = "MCP_CLIENT_CLAUDE_CODE";
|
|
18
|
+
McpClient[McpClient["MCP_CLIENT_GEMINI_CLI"] = 2] = "MCP_CLIENT_GEMINI_CLI";
|
|
19
|
+
McpClient[McpClient["MCP_CLIENT_DT_MCP_CLI"] = 4] = "MCP_CLIENT_DT_MCP_CLI";
|
|
20
|
+
McpClient[McpClient["MCP_CLIENT_OPENCLAW"] = 5] = "MCP_CLIENT_OPENCLAW";
|
|
21
|
+
McpClient[McpClient["MCP_CLIENT_CODEX"] = 6] = "MCP_CLIENT_CODEX";
|
|
22
|
+
McpClient[McpClient["MCP_CLIENT_ANTIGRAVITY"] = 7] = "MCP_CLIENT_ANTIGRAVITY";
|
|
23
|
+
McpClient[McpClient["MCP_CLIENT_GROK"] = 8] = "MCP_CLIENT_GROK";
|
|
24
|
+
McpClient[McpClient["MCP_CLIENT_OPENCODE"] = 9] = "MCP_CLIENT_OPENCODE";
|
|
25
|
+
McpClient[McpClient["MCP_CLIENT_CLAUDE_DESKTOP"] = 10] = "MCP_CLIENT_CLAUDE_DESKTOP";
|
|
26
|
+
McpClient[McpClient["MCP_CLIENT_GITHUB_COPILOT"] = 11] = "MCP_CLIENT_GITHUB_COPILOT";
|
|
27
|
+
McpClient[McpClient["MCP_CLIENT_HERMES"] = 12] = "MCP_CLIENT_HERMES";
|
|
28
|
+
McpClient[McpClient["MCP_CLIENT_OTHER"] = 3] = "MCP_CLIENT_OTHER";
|
|
29
|
+
})(McpClient || (McpClient = {}));
|
|
30
|
+
// IPC types for messages between the main process and the
|
|
31
|
+
// telemetry watchdog process.
|
|
32
|
+
export var WatchdogMessageType;
|
|
33
|
+
(function (WatchdogMessageType) {
|
|
34
|
+
WatchdogMessageType["LOG_EVENT"] = "log-event";
|
|
35
|
+
})(WatchdogMessageType || (WatchdogMessageType = {}));
|
|
36
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import crypto from 'node:crypto';
|
|
7
|
+
import { logger } from '../../utils/logger.js';
|
|
8
|
+
const MAX_BUFFER_SIZE = 1000;
|
|
9
|
+
const DEFAULT_CLEARCUT_ENDPOINT = 'https://play.googleapis.com/log?format=json_proto';
|
|
10
|
+
const DEFAULT_FLUSH_INTERVAL_MS = 15 * 60 * 1000;
|
|
11
|
+
const LOG_SOURCE = 2839;
|
|
12
|
+
const CLIENT_TYPE = 47;
|
|
13
|
+
const MIN_RATE_LIMIT_WAIT_MS = 30_000;
|
|
14
|
+
const REQUEST_TIMEOUT_MS = 30_000;
|
|
15
|
+
const SHUTDOWN_TIMEOUT_MS = 5_000;
|
|
16
|
+
const SESSION_ROTATION_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
17
|
+
export class ClearcutSender {
|
|
18
|
+
#appVersion;
|
|
19
|
+
#osType;
|
|
20
|
+
#clearcutEndpoint;
|
|
21
|
+
#flushIntervalMs;
|
|
22
|
+
#includePidHeader;
|
|
23
|
+
#sessionId;
|
|
24
|
+
#sessionCreated;
|
|
25
|
+
#buffer = [];
|
|
26
|
+
#flushTimer = null;
|
|
27
|
+
#isFlushing = false;
|
|
28
|
+
#timerStarted = false;
|
|
29
|
+
constructor(config) {
|
|
30
|
+
this.#appVersion = config.appVersion;
|
|
31
|
+
this.#osType = config.osType;
|
|
32
|
+
this.#clearcutEndpoint =
|
|
33
|
+
config.clearcutEndpoint ?? DEFAULT_CLEARCUT_ENDPOINT;
|
|
34
|
+
this.#flushIntervalMs =
|
|
35
|
+
config.forceFlushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
36
|
+
this.#includePidHeader = config.includePidHeader ?? false;
|
|
37
|
+
this.#sessionId = crypto.randomUUID();
|
|
38
|
+
this.#sessionCreated = Date.now();
|
|
39
|
+
}
|
|
40
|
+
enqueueEvent(event) {
|
|
41
|
+
if (Date.now() - this.#sessionCreated > SESSION_ROTATION_INTERVAL_MS) {
|
|
42
|
+
this.#sessionId = crypto.randomUUID();
|
|
43
|
+
this.#sessionCreated = Date.now();
|
|
44
|
+
}
|
|
45
|
+
const eventToSend = {
|
|
46
|
+
...event,
|
|
47
|
+
session_id: this.#sessionId,
|
|
48
|
+
app_version: this.#appVersion,
|
|
49
|
+
os_type: this.#osType,
|
|
50
|
+
};
|
|
51
|
+
logger?.('Enqueing telemetry event', JSON.stringify(eventToSend, null, 2));
|
|
52
|
+
this.#addToBuffer(eventToSend);
|
|
53
|
+
if (!this.#timerStarted) {
|
|
54
|
+
this.#timerStarted = true;
|
|
55
|
+
this.#scheduleFlush(this.#flushIntervalMs);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async sendShutdownEvent() {
|
|
59
|
+
if (this.#flushTimer) {
|
|
60
|
+
clearTimeout(this.#flushTimer);
|
|
61
|
+
this.#flushTimer = null;
|
|
62
|
+
}
|
|
63
|
+
const shutdownEvent = {
|
|
64
|
+
server_shutdown: {},
|
|
65
|
+
};
|
|
66
|
+
this.enqueueEvent(shutdownEvent);
|
|
67
|
+
try {
|
|
68
|
+
await Promise.race([
|
|
69
|
+
this.#finalFlush(),
|
|
70
|
+
new Promise(resolve => setTimeout(resolve, SHUTDOWN_TIMEOUT_MS)),
|
|
71
|
+
]);
|
|
72
|
+
logger?.('Final flush completed');
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
logger?.('Final flush failed:', error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async #flush() {
|
|
79
|
+
if (this.#isFlushing) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.#buffer.length === 0) {
|
|
83
|
+
this.#scheduleFlush(this.#flushIntervalMs);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.#isFlushing = true;
|
|
87
|
+
let nextDelayMs = this.#flushIntervalMs;
|
|
88
|
+
// Optimistically remove events from buffer before sending.
|
|
89
|
+
// This prevents race conditions where a simultaneous #finalFlush would include these same events.
|
|
90
|
+
const eventsToSend = [...this.#buffer];
|
|
91
|
+
this.#buffer = [];
|
|
92
|
+
try {
|
|
93
|
+
const result = await this.#sendBatch(eventsToSend);
|
|
94
|
+
if (result.success) {
|
|
95
|
+
if (result.nextRequestWaitMs !== undefined) {
|
|
96
|
+
nextDelayMs = Math.max(result.nextRequestWaitMs, MIN_RATE_LIMIT_WAIT_MS);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (result.isPermanentError) {
|
|
100
|
+
logger?.('Permanent error, dropped batch of', eventsToSend.length, 'events');
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Transient error: Requeue events at the front of the buffer
|
|
104
|
+
// to maintain order and retry them later.
|
|
105
|
+
this.#buffer = [...eventsToSend, ...this.#buffer];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
// Safety catch for unexpected errors, requeue events
|
|
110
|
+
this.#buffer = [...eventsToSend, ...this.#buffer];
|
|
111
|
+
logger?.('Flush failed unexpectedly:', error);
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
this.#isFlushing = false;
|
|
115
|
+
this.#scheduleFlush(nextDelayMs);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
#addToBuffer(event) {
|
|
119
|
+
if (this.#buffer.length >= MAX_BUFFER_SIZE) {
|
|
120
|
+
this.#buffer.shift();
|
|
121
|
+
logger?.('Telemetry buffer overflow: dropped oldest event');
|
|
122
|
+
}
|
|
123
|
+
this.#buffer.push({
|
|
124
|
+
event,
|
|
125
|
+
timestamp: Date.now(),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
#scheduleFlush(delayMs) {
|
|
129
|
+
logger?.(`Scheduling flush in ${delayMs}`);
|
|
130
|
+
if (this.#flushTimer) {
|
|
131
|
+
clearTimeout(this.#flushTimer);
|
|
132
|
+
}
|
|
133
|
+
this.#flushTimer = setTimeout(() => {
|
|
134
|
+
this.#flush().catch(err => {
|
|
135
|
+
logger?.('Flush error:', err);
|
|
136
|
+
});
|
|
137
|
+
}, delayMs);
|
|
138
|
+
}
|
|
139
|
+
async #sendBatch(events) {
|
|
140
|
+
logger?.(`Sending batch of ${events.length}`);
|
|
141
|
+
const requestBody = {
|
|
142
|
+
log_source: LOG_SOURCE,
|
|
143
|
+
request_time_ms: Date.now().toString(),
|
|
144
|
+
client_info: {
|
|
145
|
+
client_type: CLIENT_TYPE,
|
|
146
|
+
},
|
|
147
|
+
log_event: events.map(({ event, timestamp }) => ({
|
|
148
|
+
event_time_ms: timestamp.toString(),
|
|
149
|
+
source_extension_json: JSON.stringify(event),
|
|
150
|
+
})),
|
|
151
|
+
};
|
|
152
|
+
const controller = new AbortController();
|
|
153
|
+
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
154
|
+
try {
|
|
155
|
+
const response = await fetch(this.#clearcutEndpoint, {
|
|
156
|
+
method: 'POST',
|
|
157
|
+
headers: {
|
|
158
|
+
'Content-Type': 'application/json',
|
|
159
|
+
// Used in E2E tests to confirm that the watchdog process is killed
|
|
160
|
+
...(this.#includePidHeader
|
|
161
|
+
? { 'X-Watchdog-Pid': process.pid.toString() }
|
|
162
|
+
: {}),
|
|
163
|
+
},
|
|
164
|
+
body: JSON.stringify(requestBody),
|
|
165
|
+
signal: controller.signal,
|
|
166
|
+
});
|
|
167
|
+
clearTimeout(timeoutId);
|
|
168
|
+
if (response.ok) {
|
|
169
|
+
const data = (await response.json());
|
|
170
|
+
return {
|
|
171
|
+
success: true,
|
|
172
|
+
nextRequestWaitMs: data.next_request_wait_millis,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const status = response.status;
|
|
176
|
+
if (status >= 500 || status === 429) {
|
|
177
|
+
return { success: false };
|
|
178
|
+
}
|
|
179
|
+
logger?.('Telemetry permanent error:', status);
|
|
180
|
+
return { success: false, isPermanentError: true };
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
clearTimeout(timeoutId);
|
|
184
|
+
return { success: false };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async #finalFlush() {
|
|
188
|
+
if (this.#buffer.length === 0) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const eventsToSend = [...this.#buffer];
|
|
192
|
+
await this.#sendBatch(eventsToSend);
|
|
193
|
+
}
|
|
194
|
+
stopForTesting() {
|
|
195
|
+
if (this.#flushTimer) {
|
|
196
|
+
clearTimeout(this.#flushTimer);
|
|
197
|
+
this.#flushTimer = null;
|
|
198
|
+
}
|
|
199
|
+
this.#timerStarted = false;
|
|
200
|
+
}
|
|
201
|
+
get bufferSizeForTesting() {
|
|
202
|
+
return this.#buffer.length;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=ClearcutSender.js.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import process from 'node:process';
|
|
7
|
+
import readline from 'node:readline';
|
|
8
|
+
import { parseArgs } from 'node:util';
|
|
9
|
+
import { logger, flushLogs, saveLogsToFile } from '../../utils/logger.js';
|
|
10
|
+
import { WatchdogMessageType } from '../types.js';
|
|
11
|
+
import { ClearcutSender } from './ClearcutSender.js';
|
|
12
|
+
function parseWatchdogArgs() {
|
|
13
|
+
const { values } = parseArgs({
|
|
14
|
+
options: {
|
|
15
|
+
'parent-pid': { type: 'string' },
|
|
16
|
+
'app-version': { type: 'string' },
|
|
17
|
+
'os-type': { type: 'string' },
|
|
18
|
+
'log-file': { type: 'string' },
|
|
19
|
+
'clearcut-endpoint': { type: 'string' },
|
|
20
|
+
'clearcut-force-flush-interval-ms': { type: 'string' },
|
|
21
|
+
'clearcut-include-pid-header': { type: 'boolean' },
|
|
22
|
+
},
|
|
23
|
+
strict: true,
|
|
24
|
+
});
|
|
25
|
+
// Verify required arguments
|
|
26
|
+
const parentPid = parseInt(values['parent-pid'] ?? '', 10);
|
|
27
|
+
const appVersion = values['app-version'];
|
|
28
|
+
const osType = parseInt(values['os-type'] ?? '', 10);
|
|
29
|
+
if (isNaN(parentPid) || !appVersion || isNaN(osType)) {
|
|
30
|
+
console.error('Invalid arguments provided for watchdog process: ', JSON.stringify({ parentPid, appVersion, osType }));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
// Parse Optional Arguments
|
|
34
|
+
const logFile = values['log-file'];
|
|
35
|
+
const clearcutEndpoint = values['clearcut-endpoint'];
|
|
36
|
+
const clearcutIncludePidHeader = values['clearcut-include-pid-header'];
|
|
37
|
+
let clearcutForceFlushIntervalMs;
|
|
38
|
+
if (values['clearcut-force-flush-interval-ms']) {
|
|
39
|
+
const parsed = parseInt(values['clearcut-force-flush-interval-ms'], 10);
|
|
40
|
+
if (!isNaN(parsed)) {
|
|
41
|
+
clearcutForceFlushIntervalMs = parsed;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
parentPid,
|
|
46
|
+
appVersion,
|
|
47
|
+
osType,
|
|
48
|
+
logFile,
|
|
49
|
+
clearcutEndpoint,
|
|
50
|
+
clearcutForceFlushIntervalMs,
|
|
51
|
+
clearcutIncludePidHeader,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function main() {
|
|
55
|
+
const { parentPid, appVersion, osType, logFile, clearcutEndpoint, clearcutForceFlushIntervalMs, clearcutIncludePidHeader, } = parseWatchdogArgs();
|
|
56
|
+
let logStream;
|
|
57
|
+
if (logFile) {
|
|
58
|
+
logStream = saveLogsToFile(logFile);
|
|
59
|
+
}
|
|
60
|
+
const exit = (code) => {
|
|
61
|
+
if (!logStream) {
|
|
62
|
+
process.exit(code);
|
|
63
|
+
}
|
|
64
|
+
void flushLogs(logStream).finally(() => {
|
|
65
|
+
process.exit(code);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
logger?.('Watchdog started', JSON.stringify({
|
|
69
|
+
pid: process.pid,
|
|
70
|
+
parentPid,
|
|
71
|
+
version: appVersion,
|
|
72
|
+
osType,
|
|
73
|
+
}, null, 2));
|
|
74
|
+
const sender = new ClearcutSender({
|
|
75
|
+
appVersion,
|
|
76
|
+
osType: osType,
|
|
77
|
+
clearcutEndpoint,
|
|
78
|
+
forceFlushIntervalMs: clearcutForceFlushIntervalMs,
|
|
79
|
+
includePidHeader: clearcutIncludePidHeader,
|
|
80
|
+
});
|
|
81
|
+
let isShuttingDown = false;
|
|
82
|
+
function onParentDeath(reason) {
|
|
83
|
+
if (isShuttingDown) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
isShuttingDown = true;
|
|
87
|
+
logger?.(`Parent death detected (${reason}). Sending shutdown event...`);
|
|
88
|
+
sender
|
|
89
|
+
.sendShutdownEvent()
|
|
90
|
+
.then(() => {
|
|
91
|
+
logger?.('Shutdown event sent. Exiting.');
|
|
92
|
+
exit(0);
|
|
93
|
+
})
|
|
94
|
+
.catch(err => {
|
|
95
|
+
logger?.('Failed to send shutdown event', err);
|
|
96
|
+
exit(1);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
process.stdin.on('end', () => onParentDeath('stdin end'));
|
|
100
|
+
process.stdin.on('close', () => onParentDeath('stdin close'));
|
|
101
|
+
process.on('disconnect', () => onParentDeath('ipc disconnect'));
|
|
102
|
+
const rl = readline.createInterface({
|
|
103
|
+
input: process.stdin,
|
|
104
|
+
terminal: false,
|
|
105
|
+
});
|
|
106
|
+
rl.on('line', line => {
|
|
107
|
+
try {
|
|
108
|
+
if (!line.trim()) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const msg = JSON.parse(line);
|
|
112
|
+
if (msg.type === WatchdogMessageType.LOG_EVENT && msg.payload) {
|
|
113
|
+
sender.enqueueEvent(msg.payload);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
logger?.('Failed to parse IPC message', err);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
main();
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.error('Watchdog fatal error:', err);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=main.js.map
|