@mcp-b/chrome-devtools-mcp 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/build/src/DevToolsConnectionAdapter.js +5 -4
- package/build/src/DevtoolsUtils.js +8 -12
- package/build/src/McpContext.js +34 -39
- package/build/src/McpResponse.js +19 -45
- package/build/src/PageCollector.js +10 -11
- package/build/src/WaitForHelper.js +7 -11
- package/build/src/bin/chrome-devtools-cli-options.js +616 -665
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +5 -5
- package/build/src/bin/chrome-devtools.js +2 -24
- package/build/src/bin/cliDefinitions.js +615 -0
- package/build/src/browser.js +5 -10
- package/build/src/daemon/client.js +10 -34
- package/build/src/formatters/{consoleFormatter.js → ConsoleFormatter.js} +10 -17
- package/build/src/formatters/{networkFormatter.js → NetworkFormatter.js} +3 -6
- package/build/src/formatters/{snapshotFormatter.js → SnapshotFormatter.js} +3 -6
- package/build/src/index.js +6 -16
- package/build/src/tools/ToolDefinition.js +1 -1
- package/build/src/tools/emulation.js +1 -1
- package/build/src/tools/input.js +5 -11
- package/build/src/tools/pages.js +7 -19
- package/build/src/tools/performance.js +3 -3
- package/build/src/tools/script.js +4 -6
- package/build/src/tools/tools.js +0 -1
- package/build/src/version.js +1 -1
- package/package.json +9 -9
- 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/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/corsPreflightResponseInvalid.md +0 -5
- 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/selectivePermissionsIntervention.md +0 -7
- 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/README.md
CHANGED
|
@@ -689,10 +689,7 @@ Add the `--browser-url` option to your MCP client configuration. The value of th
|
|
|
689
689
|
"mcpServers": {
|
|
690
690
|
"chrome-devtools": {
|
|
691
691
|
"command": "npx",
|
|
692
|
-
"args": [
|
|
693
|
-
"chrome-devtools-mcp@latest",
|
|
694
|
-
"--browser-url=http://127.0.0.1:9222"
|
|
695
|
-
]
|
|
692
|
+
"args": ["chrome-devtools-mcp@latest", "--browser-url=http://127.0.0.1:9222"]
|
|
696
693
|
}
|
|
697
694
|
}
|
|
698
695
|
}
|
|
@@ -34,8 +34,8 @@ export class PuppeteerDevToolsConnection {
|
|
|
34
34
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
35
35
|
return session
|
|
36
36
|
.send(method, params)
|
|
37
|
-
.then(result => ({ result }))
|
|
38
|
-
.catch(error => ({ error }));
|
|
37
|
+
.then((result) => ({ result }))
|
|
38
|
+
.catch((error) => ({ error }));
|
|
39
39
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
40
40
|
}
|
|
41
41
|
observe(observer) {
|
|
@@ -55,11 +55,12 @@ export class PuppeteerDevToolsConnection {
|
|
|
55
55
|
session.off('*', handler);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
#handleEvent(sessionId, type, event
|
|
58
|
+
#handleEvent(sessionId, type, event // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
59
|
+
) {
|
|
59
60
|
if (typeof type === 'string' &&
|
|
60
61
|
type !== CDPSessionEvent.SessionAttached &&
|
|
61
62
|
type !== CDPSessionEvent.SessionDetached) {
|
|
62
|
-
this.#observers.forEach(observer => observer.onEvent({
|
|
63
|
+
this.#observers.forEach((observer) => observer.onEvent({
|
|
63
64
|
method: type,
|
|
64
65
|
sessionId,
|
|
65
66
|
params: event,
|
|
@@ -23,14 +23,13 @@ DevTools.I18n.DevToolsLocale.DevToolsLocale.instance({
|
|
|
23
23
|
data: {
|
|
24
24
|
navigatorLanguage: 'en-US',
|
|
25
25
|
settingLanguage: 'en-US',
|
|
26
|
-
lookupClosestDevToolsLocale: l => l,
|
|
26
|
+
lookupClosestDevToolsLocale: (l) => l,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
DevTools.I18n.i18n.registerLocaleDataForTest('en-US', {});
|
|
30
30
|
DevTools.Formatter.FormatterWorkerPool.FormatterWorkerPool.instance({
|
|
31
31
|
forceNew: true,
|
|
32
|
-
entrypointURL: import.meta
|
|
33
|
-
.resolve('./third_party/devtools-formatter-worker.js'),
|
|
32
|
+
entrypointURL: import.meta.resolve('./third_party/devtools-formatter-worker.js'),
|
|
34
33
|
});
|
|
35
34
|
export class UniverseManager {
|
|
36
35
|
#browser;
|
|
@@ -47,7 +46,7 @@ export class UniverseManager {
|
|
|
47
46
|
await this.#mutex.acquire();
|
|
48
47
|
const promises = [];
|
|
49
48
|
for (const page of pages) {
|
|
50
|
-
promises.push(this.#createUniverseFor(page).then(targetUniverse => this.#universes.set(page, targetUniverse)));
|
|
49
|
+
promises.push(this.#createUniverseFor(page).then((targetUniverse) => this.#universes.set(page, targetUniverse)));
|
|
51
50
|
}
|
|
52
51
|
this.#browser.on('targetcreated', this.#onTargetCreated);
|
|
53
52
|
this.#browser.on('targetdestroyed', this.#onTargetDestroyed);
|
|
@@ -196,8 +195,7 @@ export class SymbolizedError {
|
|
|
196
195
|
// we have to manually parse out the error text from the exception description.
|
|
197
196
|
// In the case of Runtime.getExceptionDetails, `details.text` has the Error.message.
|
|
198
197
|
if (details.text === 'Uncaught' && details.exception) {
|
|
199
|
-
return
|
|
200
|
-
SymbolizedError.#getMessageFromException(details.exception));
|
|
198
|
+
return 'Uncaught ' + SymbolizedError.#getMessageFromException(details.exception);
|
|
201
199
|
}
|
|
202
200
|
return details.text;
|
|
203
201
|
}
|
|
@@ -230,7 +228,7 @@ export class SymbolizedError {
|
|
|
230
228
|
if (properties.getError()) {
|
|
231
229
|
return null;
|
|
232
230
|
}
|
|
233
|
-
return properties.result.find(prop => prop.name === 'cause')?.value ?? null;
|
|
231
|
+
return properties.result.find((prop) => prop.name === 'cause')?.value ?? null;
|
|
234
232
|
}
|
|
235
233
|
static createForTesting(message, stackTrace, cause) {
|
|
236
234
|
return new SymbolizedError(message, stackTrace, cause);
|
|
@@ -246,9 +244,7 @@ export async function createStackTraceForConsoleMessage(devTools, consoleMessage
|
|
|
246
244
|
}
|
|
247
245
|
export async function createStackTrace(devTools, rawStackTrace, targetId) {
|
|
248
246
|
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
249
|
-
const target = targetId
|
|
250
|
-
? targetManager.targetById(targetId) || devTools.target
|
|
251
|
-
: devTools.target;
|
|
247
|
+
const target = targetId ? targetManager.targetById(targetId) || devTools.target : devTools.target;
|
|
252
248
|
const model = target.model(DevTools.DebuggerModel);
|
|
253
249
|
// DevTools doesn't wait for source maps to attach before building a stack trace, rather it'll send
|
|
254
250
|
// an update event once a source map was attached and the stack trace retranslated. This doesn't
|
|
@@ -265,8 +261,8 @@ export async function createStackTrace(devTools, rawStackTrace, targetId) {
|
|
|
265
261
|
}
|
|
266
262
|
}
|
|
267
263
|
const signal = AbortSignal.timeout(1_000);
|
|
268
|
-
await Promise.all([...scriptIds].map(id => waitForScript(model, id, signal)
|
|
269
|
-
.then(script => model.sourceMapManager().sourceMapForClientPromise(script))
|
|
264
|
+
await Promise.all([...scriptIds].map((id) => waitForScript(model, id, signal)
|
|
265
|
+
.then((script) => model.sourceMapManager().sourceMapForClientPromise(script))
|
|
270
266
|
.catch()));
|
|
271
267
|
const binding = devTools.universe.context.get(DevTools.DebuggerWorkspaceBinding);
|
|
272
268
|
// DevTools uses branded types for ScriptId and others. Casting the puppeteer protocol type to the DevTools protocol type is safe.
|
package/build/src/McpContext.js
CHANGED
|
@@ -7,12 +7,12 @@ import fs from 'node:fs/promises';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { UniverseManager } from './DevtoolsUtils.js';
|
|
9
9
|
import { McpPage } from './McpPage.js';
|
|
10
|
-
import { NetworkCollector, ConsoleCollector } from './PageCollector.js';
|
|
10
|
+
import { NetworkCollector, ConsoleCollector, } from './PageCollector.js';
|
|
11
11
|
import { Locator } from './third_party/index.js';
|
|
12
12
|
import { PredefinedNetworkConditions } from './third_party/index.js';
|
|
13
13
|
import { listPages } from './tools/pages.js';
|
|
14
14
|
import { CLOSE_PAGE_ERROR } from './tools/ToolDefinition.js';
|
|
15
|
-
import { ExtensionRegistry
|
|
15
|
+
import { ExtensionRegistry } from './utils/ExtensionRegistry.js';
|
|
16
16
|
import { saveTemporaryFile } from './utils/files.js';
|
|
17
17
|
import { WaitForHelper } from './WaitForHelper.js';
|
|
18
18
|
const DEFAULT_TIMEOUT = 5_000;
|
|
@@ -62,15 +62,15 @@ export class McpContext {
|
|
|
62
62
|
this.#locatorClass = locatorClass;
|
|
63
63
|
this.#options = options;
|
|
64
64
|
this.#networkCollector = new NetworkCollector(this.browser);
|
|
65
|
-
this.#consoleCollector = new ConsoleCollector(this.browser, collect => {
|
|
65
|
+
this.#consoleCollector = new ConsoleCollector(this.browser, (collect) => {
|
|
66
66
|
return {
|
|
67
|
-
console: event => {
|
|
67
|
+
console: (event) => {
|
|
68
68
|
collect(event);
|
|
69
69
|
},
|
|
70
|
-
uncaughtError: event => {
|
|
70
|
+
uncaughtError: (event) => {
|
|
71
71
|
collect(event);
|
|
72
72
|
},
|
|
73
|
-
issue: event => {
|
|
73
|
+
issue: (event) => {
|
|
74
74
|
collect(event);
|
|
75
75
|
},
|
|
76
76
|
};
|
|
@@ -109,7 +109,7 @@ export class McpContext {
|
|
|
109
109
|
this.logger('no network request');
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
const request = this.#networkCollector.find(page.pptrPage, request => {
|
|
112
|
+
const request = this.#networkCollector.find(page.pptrPage, (request) => {
|
|
113
113
|
// @ts-expect-error id is internal.
|
|
114
114
|
return request.id === cdpRequestId;
|
|
115
115
|
});
|
|
@@ -241,9 +241,7 @@ export class McpContext {
|
|
|
241
241
|
newSettings.userAgent = options.userAgent;
|
|
242
242
|
}
|
|
243
243
|
if (!options.colorScheme || options.colorScheme === 'auto') {
|
|
244
|
-
await page.emulateMediaFeatures([
|
|
245
|
-
{ name: 'prefers-color-scheme', value: '' },
|
|
246
|
-
]);
|
|
244
|
+
await page.emulateMediaFeatures([{ name: 'prefers-color-scheme', value: '' }]);
|
|
247
245
|
delete newSettings.colorScheme;
|
|
248
246
|
}
|
|
249
247
|
else {
|
|
@@ -267,9 +265,7 @@ export class McpContext {
|
|
|
267
265
|
await page.setViewport(viewport);
|
|
268
266
|
newSettings.viewport = viewport;
|
|
269
267
|
}
|
|
270
|
-
mcpPage.emulationSettings = Object.keys(newSettings).length
|
|
271
|
-
? newSettings
|
|
272
|
-
: {};
|
|
268
|
+
mcpPage.emulationSettings = Object.keys(newSettings).length ? newSettings : {};
|
|
273
269
|
this.#updateSelectedPageTimeouts();
|
|
274
270
|
}
|
|
275
271
|
setIsRunningPerformanceTrace(x) {
|
|
@@ -302,7 +298,7 @@ export class McpContext {
|
|
|
302
298
|
return this.#getMcpPage(page);
|
|
303
299
|
}
|
|
304
300
|
getPageById(pageId) {
|
|
305
|
-
const page = this.#mcpPages.values().find(mcpPage => mcpPage.id === pageId);
|
|
301
|
+
const page = this.#mcpPages.values().find((mcpPage) => mcpPage.id === pageId);
|
|
306
302
|
if (!page) {
|
|
307
303
|
throw new Error('No page found');
|
|
308
304
|
}
|
|
@@ -357,16 +353,15 @@ export class McpContext {
|
|
|
357
353
|
*/
|
|
358
354
|
async createExtensionServiceWorkersSnapshot() {
|
|
359
355
|
const allTargets = await this.browser.targets();
|
|
360
|
-
const serviceWorkers = allTargets.filter(target => {
|
|
361
|
-
return
|
|
362
|
-
target.url().includes('chrome-extension://'));
|
|
356
|
+
const serviceWorkers = allTargets.filter((target) => {
|
|
357
|
+
return target.type() === 'service_worker' && target.url().includes('chrome-extension://');
|
|
363
358
|
});
|
|
364
359
|
for (const serviceWorker of serviceWorkers) {
|
|
365
360
|
if (!this.#extensionServiceWorkerMap.has(serviceWorker)) {
|
|
366
361
|
this.#extensionServiceWorkerMap.set(serviceWorker, 'sw-' + this.#nextExtensionServiceWorkerId++);
|
|
367
362
|
}
|
|
368
363
|
}
|
|
369
|
-
this.#extensionServiceWorkers = serviceWorkers.map(serviceWorker => {
|
|
364
|
+
this.#extensionServiceWorkers = serviceWorkers.map((serviceWorker) => {
|
|
370
365
|
return {
|
|
371
366
|
target: serviceWorker,
|
|
372
367
|
id: this.#extensionServiceWorkerMap.get(serviceWorker),
|
|
@@ -383,7 +378,7 @@ export class McpContext {
|
|
|
383
378
|
mcpPage = new McpPage(page, this.#nextPageId++);
|
|
384
379
|
this.#mcpPages.set(page, mcpPage);
|
|
385
380
|
// We emulate a focused page for all pages to support multi-agent workflows.
|
|
386
|
-
void page.emulateFocusedPage(true).catch(error => {
|
|
381
|
+
void page.emulateFocusedPage(true).catch((error) => {
|
|
387
382
|
this.logger('Error turning on focused page emulation', error);
|
|
388
383
|
});
|
|
389
384
|
}
|
|
@@ -397,12 +392,10 @@ export class McpContext {
|
|
|
397
392
|
this.#mcpPages.delete(page);
|
|
398
393
|
}
|
|
399
394
|
}
|
|
400
|
-
this.#pages = allPages.filter(page => {
|
|
401
|
-
return
|
|
402
|
-
!page.url().startsWith('devtools://'));
|
|
395
|
+
this.#pages = allPages.filter((page) => {
|
|
396
|
+
return this.#options.experimentalDevToolsDebugging || !page.url().startsWith('devtools://');
|
|
403
397
|
});
|
|
404
|
-
if ((!this.#selectedPage ||
|
|
405
|
-
this.#pages.indexOf(this.#selectedPage.pptrPage) === -1) &&
|
|
398
|
+
if ((!this.#selectedPage || this.#pages.indexOf(this.#selectedPage.pptrPage) === -1) &&
|
|
406
399
|
this.#pages[0]) {
|
|
407
400
|
this.selectPage(this.#getMcpPage(this.#pages[0]));
|
|
408
401
|
}
|
|
@@ -413,9 +406,8 @@ export class McpContext {
|
|
|
413
406
|
const defaultCtx = this.browser.defaultBrowserContext();
|
|
414
407
|
const allPages = await this.browser.pages(this.#options.experimentalIncludeAllPages);
|
|
415
408
|
const allTargets = this.browser.targets();
|
|
416
|
-
const extensionTargets = allTargets.filter(target => {
|
|
417
|
-
return
|
|
418
|
-
target.type() === 'page');
|
|
409
|
+
const extensionTargets = allTargets.filter((target) => {
|
|
410
|
+
return target.url().startsWith('chrome-extension://') && target.type() === 'page';
|
|
419
411
|
});
|
|
420
412
|
for (const target of extensionTargets) {
|
|
421
413
|
// Right now target.page() returns null for popup and side panel pages.
|
|
@@ -472,10 +464,18 @@ export class McpContext {
|
|
|
472
464
|
if (!mcpPage) {
|
|
473
465
|
return;
|
|
474
466
|
}
|
|
475
|
-
|
|
476
|
-
|
|
467
|
+
// Prior to Chrome 144.0.7559.59, the command fails,
|
|
468
|
+
// Some Electron apps still use older version
|
|
469
|
+
// Fall back to not exposing DevTools at all.
|
|
470
|
+
try {
|
|
471
|
+
if (await page.hasDevTools()) {
|
|
472
|
+
mcpPage.devToolsPage = await page.openDevTools();
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
mcpPage.devToolsPage = undefined;
|
|
476
|
+
}
|
|
477
477
|
}
|
|
478
|
-
|
|
478
|
+
catch {
|
|
479
479
|
mcpPage.devToolsPage = undefined;
|
|
480
480
|
}
|
|
481
481
|
}));
|
|
@@ -557,9 +557,7 @@ export class McpContext {
|
|
|
557
557
|
const nodeWithId = {
|
|
558
558
|
...node,
|
|
559
559
|
id,
|
|
560
|
-
children: node.children
|
|
561
|
-
? node.children.map(child => assignIds(child))
|
|
562
|
-
: [],
|
|
560
|
+
children: node.children ? node.children.map((child) => assignIds(child)) : [],
|
|
563
561
|
};
|
|
564
562
|
// The AXNode for an option doesn't contain its `value`.
|
|
565
563
|
// Therefore, set text content of the option as value.
|
|
@@ -632,10 +630,7 @@ export class McpContext {
|
|
|
632
630
|
waitForTextOnPage(text, timeout, targetPage) {
|
|
633
631
|
const page = targetPage ?? this.getSelectedPptrPage();
|
|
634
632
|
const frames = page.frames();
|
|
635
|
-
let locator = this.#locatorClass.race(frames.flatMap(frame => text.flatMap(value => [
|
|
636
|
-
frame.locator(`aria/${value}`),
|
|
637
|
-
frame.locator(`text/${value}`),
|
|
638
|
-
])));
|
|
633
|
+
let locator = this.#locatorClass.race(frames.flatMap((frame) => text.flatMap((value) => [frame.locator(`aria/${value}`), frame.locator(`text/${value}`)])));
|
|
639
634
|
if (timeout) {
|
|
640
635
|
locator = locator.setTimeout(timeout);
|
|
641
636
|
}
|
|
@@ -645,9 +640,9 @@ export class McpContext {
|
|
|
645
640
|
* We need to ignore favicon request as they make our test flaky
|
|
646
641
|
*/
|
|
647
642
|
async setUpNetworkCollectorForTesting() {
|
|
648
|
-
this.#networkCollector = new NetworkCollector(this.browser, collect => {
|
|
643
|
+
this.#networkCollector = new NetworkCollector(this.browser, (collect) => {
|
|
649
644
|
return {
|
|
650
|
-
request: req => {
|
|
645
|
+
request: (req) => {
|
|
651
646
|
if (req.url().includes('favicon.ico')) {
|
|
652
647
|
return;
|
|
653
648
|
}
|
package/build/src/McpResponse.js
CHANGED
|
@@ -24,9 +24,7 @@ export class McpResponse {
|
|
|
24
24
|
#attachedTraceInsight;
|
|
25
25
|
#attachedLighthouseResult;
|
|
26
26
|
#textResponseLines = [];
|
|
27
|
-
#mcpContent = [];
|
|
28
27
|
#images = [];
|
|
29
|
-
#isError = false;
|
|
30
28
|
#networkRequestsOptions;
|
|
31
29
|
#consoleDataOptions;
|
|
32
30
|
#listExtensions;
|
|
@@ -116,12 +114,6 @@ export class McpResponse {
|
|
|
116
114
|
attachLighthouseResult(result) {
|
|
117
115
|
this.#attachedLighthouseResult = result;
|
|
118
116
|
}
|
|
119
|
-
appendMcpContent(value) {
|
|
120
|
-
this.#mcpContent.push(value);
|
|
121
|
-
}
|
|
122
|
-
setToolResultError(value) {
|
|
123
|
-
this.#isError = value;
|
|
124
|
-
}
|
|
125
117
|
get includePages() {
|
|
126
118
|
return this.#includePages;
|
|
127
119
|
}
|
|
@@ -164,9 +156,6 @@ export class McpResponse {
|
|
|
164
156
|
get images() {
|
|
165
157
|
return this.#images;
|
|
166
158
|
}
|
|
167
|
-
get isError() {
|
|
168
|
-
return this.#isError;
|
|
169
|
-
}
|
|
170
159
|
get snapshotParams() {
|
|
171
160
|
return this.#snapshotParams;
|
|
172
161
|
}
|
|
@@ -203,7 +192,7 @@ export class McpResponse {
|
|
|
203
192
|
const request = context.getNetworkRequestById(this.#page, this.#attachedNetworkRequestId);
|
|
204
193
|
const formatter = await NetworkFormatter.from(request, {
|
|
205
194
|
requestId: this.#attachedNetworkRequestId,
|
|
206
|
-
requestIdResolver: req => context.getNetworkRequestStableId(req),
|
|
195
|
+
requestIdResolver: (req) => context.getNetworkRequestStableId(req),
|
|
207
196
|
fetchData: true,
|
|
208
197
|
requestFilePath: this.#attachedNetworkRequestOptions?.requestFilePath,
|
|
209
198
|
responseFilePath: this.#attachedNetworkRequestOptions?.responseFilePath,
|
|
@@ -252,7 +241,7 @@ export class McpResponse {
|
|
|
252
241
|
let messages = context.getConsoleData(this.#page, this.#consoleDataOptions.includePreservedMessages);
|
|
253
242
|
if (this.#consoleDataOptions.types?.length) {
|
|
254
243
|
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
255
|
-
messages = messages.filter(message => {
|
|
244
|
+
messages = messages.filter((message) => {
|
|
256
245
|
if ('type' in message) {
|
|
257
246
|
return normalizedTypes.has(message.type());
|
|
258
247
|
}
|
|
@@ -283,7 +272,7 @@ export class McpResponse {
|
|
|
283
272
|
return formatter;
|
|
284
273
|
}
|
|
285
274
|
return null;
|
|
286
|
-
}))).filter(item => item !== null);
|
|
275
|
+
}))).filter((item) => item !== null);
|
|
287
276
|
}
|
|
288
277
|
let networkRequests;
|
|
289
278
|
if (this.#networkRequestsOptions?.include) {
|
|
@@ -294,13 +283,13 @@ export class McpResponse {
|
|
|
294
283
|
// Apply resource type filtering if specified
|
|
295
284
|
if (this.#networkRequestsOptions.resourceTypes?.length) {
|
|
296
285
|
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
297
|
-
requests = requests.filter(request => {
|
|
286
|
+
requests = requests.filter((request) => {
|
|
298
287
|
const type = request.resourceType();
|
|
299
288
|
return normalizedTypes.has(type);
|
|
300
289
|
});
|
|
301
290
|
}
|
|
302
291
|
if (requests.length) {
|
|
303
|
-
networkRequests = await Promise.all(requests.map(request => NetworkFormatter.from(request, {
|
|
292
|
+
networkRequests = await Promise.all(requests.map((request) => NetworkFormatter.from(request, {
|
|
304
293
|
requestId: context.getNetworkRequestStableId(request),
|
|
305
294
|
selectedInDevToolsUI: context.getNetworkRequestStableId(request) ===
|
|
306
295
|
this.#networkRequestsOptions?.networkRequestIdInDevToolsUI,
|
|
@@ -358,9 +347,7 @@ export class McpResponse {
|
|
|
358
347
|
}
|
|
359
348
|
const dialog = this.#page?.getDialog();
|
|
360
349
|
if (dialog) {
|
|
361
|
-
const defaultValueIfNeeded = dialog.type() === 'prompt'
|
|
362
|
-
? ` (default value: "${dialog.defaultValue()}")`
|
|
363
|
-
: '';
|
|
350
|
+
const defaultValueIfNeeded = dialog.type() === 'prompt' ? ` (default value: "${dialog.defaultValue()}")` : '';
|
|
364
351
|
response.push(`# Open dialog
|
|
365
352
|
${dialog.type()}: ${dialog.message()}${defaultValueIfNeeded}.
|
|
366
353
|
Call ${handleDialog.name} to handle it before continuing.`);
|
|
@@ -386,9 +373,7 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
386
373
|
const structuredPages = [];
|
|
387
374
|
for (const page of regularPages) {
|
|
388
375
|
const isolatedContextName = context.getIsolatedContextName(page);
|
|
389
|
-
const contextLabel = isolatedContextName
|
|
390
|
-
? ` isolatedContext=${isolatedContextName}`
|
|
391
|
-
: '';
|
|
376
|
+
const contextLabel = isolatedContextName ? ` isolatedContext=${isolatedContextName}` : '';
|
|
392
377
|
parts.push(`${context.getPageId(page)}: ${page.url()}${context.isPageSelected(page) ? ' [selected]' : ''}${contextLabel}`);
|
|
393
378
|
structuredPages.push(createStructuredPage(page, context));
|
|
394
379
|
}
|
|
@@ -420,7 +405,7 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
420
405
|
}
|
|
421
406
|
structuredContent.extensionServiceWorkers = context
|
|
422
407
|
.getExtensionServiceWorkers()
|
|
423
|
-
.map(extensionServiceWorker => {
|
|
408
|
+
.map((extensionServiceWorker) => {
|
|
424
409
|
return {
|
|
425
410
|
id: extensionServiceWorker.id,
|
|
426
411
|
url: extensionServiceWorker.url,
|
|
@@ -486,13 +471,11 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
486
471
|
}
|
|
487
472
|
if (data.detailedNetworkRequest) {
|
|
488
473
|
response.push(data.detailedNetworkRequest.toStringDetailed());
|
|
489
|
-
structuredContent.networkRequest =
|
|
490
|
-
data.detailedNetworkRequest.toJSONDetailed();
|
|
474
|
+
structuredContent.networkRequest = data.detailedNetworkRequest.toJSONDetailed();
|
|
491
475
|
}
|
|
492
476
|
if (data.detailedConsoleMessage) {
|
|
493
477
|
response.push(data.detailedConsoleMessage.toStringDetailed());
|
|
494
|
-
structuredContent.consoleMessage =
|
|
495
|
-
data.detailedConsoleMessage.toJSONDetailed();
|
|
478
|
+
structuredContent.consoleMessage = data.detailedConsoleMessage.toJSONDetailed();
|
|
496
479
|
}
|
|
497
480
|
if (data.extensions) {
|
|
498
481
|
structuredContent.extensions = data.extensions;
|
|
@@ -502,7 +485,7 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
502
485
|
}
|
|
503
486
|
else {
|
|
504
487
|
const extensionsMessage = data.extensions
|
|
505
|
-
.map(extension => {
|
|
488
|
+
.map((extension) => {
|
|
506
489
|
return `id=${extension.id} "${extension.name}" v${extension.version} ${extension.isEnabled ? 'Enabled' : 'Disabled'}`;
|
|
507
490
|
})
|
|
508
491
|
.join('\n');
|
|
@@ -535,34 +518,25 @@ Call ${handleDialog.name} to handle it before continuing.`);
|
|
|
535
518
|
const paginationData = this.#dataWithPagination(messages, this.#consoleDataOptions.pagination);
|
|
536
519
|
structuredContent.pagination = paginationData.pagination;
|
|
537
520
|
response.push(...paginationData.info);
|
|
538
|
-
response.push(...paginationData.items.map(message => message.toString()));
|
|
539
|
-
structuredContent.consoleMessages = paginationData.items.map(message => message.toJSON());
|
|
521
|
+
response.push(...paginationData.items.map((message) => message.toString()));
|
|
522
|
+
structuredContent.consoleMessages = paginationData.items.map((message) => message.toJSON());
|
|
540
523
|
}
|
|
541
524
|
else {
|
|
542
525
|
response.push('<no console messages found>');
|
|
543
526
|
}
|
|
544
527
|
}
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
},
|
|
551
|
-
]
|
|
552
|
-
: [];
|
|
553
|
-
const images = this.#images.map(imageData => {
|
|
528
|
+
const text = {
|
|
529
|
+
type: 'text',
|
|
530
|
+
text: response.join('\n'),
|
|
531
|
+
};
|
|
532
|
+
const images = this.#images.map((imageData) => {
|
|
554
533
|
return {
|
|
555
534
|
type: 'image',
|
|
556
535
|
...imageData,
|
|
557
536
|
};
|
|
558
537
|
});
|
|
559
|
-
const content = [
|
|
560
|
-
...textBlocks,
|
|
561
|
-
...this.#mcpContent,
|
|
562
|
-
...images,
|
|
563
|
-
];
|
|
564
538
|
return {
|
|
565
|
-
content,
|
|
539
|
+
content: [text, ...images],
|
|
566
540
|
structuredContent,
|
|
567
541
|
};
|
|
568
542
|
}
|
|
@@ -28,7 +28,7 @@ export class PageCollector {
|
|
|
28
28
|
#browser;
|
|
29
29
|
#listenersInitializer;
|
|
30
30
|
#listeners = new WeakMap();
|
|
31
|
-
|
|
31
|
+
maxNavigationSaved = 3;
|
|
32
32
|
/**
|
|
33
33
|
* This maps a Page to a list of navigations with a sub-list
|
|
34
34
|
* of all collected resources.
|
|
@@ -84,7 +84,7 @@ export class PageCollector {
|
|
|
84
84
|
const idGenerator = createIdGenerator();
|
|
85
85
|
const storedLists = [[]];
|
|
86
86
|
this.storage.set(page, storedLists);
|
|
87
|
-
const listeners = this.#listenersInitializer(value => {
|
|
87
|
+
const listeners = this.#listenersInitializer((value) => {
|
|
88
88
|
const withId = value;
|
|
89
89
|
withId[stableIdSymbol] = idGenerator();
|
|
90
90
|
const navigations = this.storage.get(page) ?? [[]];
|
|
@@ -109,7 +109,7 @@ export class PageCollector {
|
|
|
109
109
|
}
|
|
110
110
|
// Add the latest navigation first
|
|
111
111
|
navigations.unshift([]);
|
|
112
|
-
navigations.splice(this
|
|
112
|
+
navigations.splice(this.maxNavigationSaved);
|
|
113
113
|
}
|
|
114
114
|
cleanupPageDestroyed(page) {
|
|
115
115
|
const listeners = this.#listeners.get(page);
|
|
@@ -129,7 +129,7 @@ export class PageCollector {
|
|
|
129
129
|
return navigations[0];
|
|
130
130
|
}
|
|
131
131
|
const data = [];
|
|
132
|
-
for (let index = this
|
|
132
|
+
for (let index = this.maxNavigationSaved; index >= 0; index--) {
|
|
133
133
|
if (navigations[index]) {
|
|
134
134
|
data.push(...navigations[index]);
|
|
135
135
|
}
|
|
@@ -144,7 +144,7 @@ export class PageCollector {
|
|
|
144
144
|
if (!navigations) {
|
|
145
145
|
throw new Error('No requests found for selected page');
|
|
146
146
|
}
|
|
147
|
-
const item = this.find(page, item => item[stableIdSymbol] === stableId);
|
|
147
|
+
const item = this.find(page, (item) => item[stableIdSymbol] === stableId);
|
|
148
148
|
if (item) {
|
|
149
149
|
return item;
|
|
150
150
|
}
|
|
@@ -275,9 +275,9 @@ class PageEventSubscriber {
|
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
export class NetworkCollector extends PageCollector {
|
|
278
|
-
constructor(browser, listeners = collect => {
|
|
278
|
+
constructor(browser, listeners = (collect) => {
|
|
279
279
|
return {
|
|
280
|
-
request: req => {
|
|
280
|
+
request: (req) => {
|
|
281
281
|
collect(req);
|
|
282
282
|
},
|
|
283
283
|
};
|
|
@@ -290,10 +290,8 @@ export class NetworkCollector extends PageCollector {
|
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
292
|
const requests = navigations[0];
|
|
293
|
-
const lastRequestIdx = requests.findLastIndex(request => {
|
|
294
|
-
return request.frame() === page.mainFrame()
|
|
295
|
-
? request.isNavigationRequest()
|
|
296
|
-
: false;
|
|
293
|
+
const lastRequestIdx = requests.findLastIndex((request) => {
|
|
294
|
+
return request.frame() === page.mainFrame() ? request.isNavigationRequest() : false;
|
|
297
295
|
});
|
|
298
296
|
// Keep all requests since the last navigation request including that
|
|
299
297
|
// navigation request itself.
|
|
@@ -305,5 +303,6 @@ export class NetworkCollector extends PageCollector {
|
|
|
305
303
|
else {
|
|
306
304
|
navigations.unshift([]);
|
|
307
305
|
}
|
|
306
|
+
navigations.splice(this.maxNavigationSaved);
|
|
308
307
|
}
|
|
309
308
|
}
|
|
@@ -24,7 +24,7 @@ export class WaitForHelper {
|
|
|
24
24
|
* for the DOM to be stable before returning.
|
|
25
25
|
*/
|
|
26
26
|
async waitForStableDom() {
|
|
27
|
-
const stableDomObserver = await this.#page.evaluateHandle(timeout => {
|
|
27
|
+
const stableDomObserver = await this.#page.evaluateHandle((timeout) => {
|
|
28
28
|
let timeoutId;
|
|
29
29
|
function callback() {
|
|
30
30
|
clearTimeout(timeoutId);
|
|
@@ -49,7 +49,7 @@ export class WaitForHelper {
|
|
|
49
49
|
}, this.#stableDomFor);
|
|
50
50
|
this.#abortController.signal.addEventListener('abort', async () => {
|
|
51
51
|
try {
|
|
52
|
-
await stableDomObserver.evaluate(observer => {
|
|
52
|
+
await stableDomObserver.evaluate((observer) => {
|
|
53
53
|
observer.observer.disconnect();
|
|
54
54
|
observer.resolver.resolve();
|
|
55
55
|
});
|
|
@@ -71,13 +71,9 @@ export class WaitForHelper {
|
|
|
71
71
|
async waitForNavigationStarted() {
|
|
72
72
|
// Currently Puppeteer does not have API
|
|
73
73
|
// For when a navigation is about to start
|
|
74
|
-
const navigationStartedPromise = new Promise(resolve => {
|
|
74
|
+
const navigationStartedPromise = new Promise((resolve) => {
|
|
75
75
|
const listener = (event) => {
|
|
76
|
-
if ([
|
|
77
|
-
'historySameDocument',
|
|
78
|
-
'historyDifferentDocument',
|
|
79
|
-
'sameDocument',
|
|
80
|
-
].includes(event.navigationType)) {
|
|
76
|
+
if (['historySameDocument', 'historyDifferentDocument', 'sameDocument'].includes(event.navigationType)) {
|
|
81
77
|
resolve(false);
|
|
82
78
|
return;
|
|
83
79
|
}
|
|
@@ -95,7 +91,7 @@ export class WaitForHelper {
|
|
|
95
91
|
]);
|
|
96
92
|
}
|
|
97
93
|
timeout(time) {
|
|
98
|
-
return new Promise(res => {
|
|
94
|
+
return new Promise((res) => {
|
|
99
95
|
const id = setTimeout(res, time);
|
|
100
96
|
this.#abortController.signal.addEventListener('abort', () => {
|
|
101
97
|
res();
|
|
@@ -105,7 +101,7 @@ export class WaitForHelper {
|
|
|
105
101
|
}
|
|
106
102
|
async waitForEventsAfterAction(action, options) {
|
|
107
103
|
const navigationFinished = this.waitForNavigationStarted()
|
|
108
|
-
.then(navigationStated => {
|
|
104
|
+
.then((navigationStated) => {
|
|
109
105
|
if (navigationStated) {
|
|
110
106
|
return this.#page.waitForNavigation({
|
|
111
107
|
timeout: options?.timeout ?? this.#navigationTimeout,
|
|
@@ -114,7 +110,7 @@ export class WaitForHelper {
|
|
|
114
110
|
}
|
|
115
111
|
return;
|
|
116
112
|
})
|
|
117
|
-
.catch(error => logger(error));
|
|
113
|
+
.catch((error) => logger(error));
|
|
118
114
|
try {
|
|
119
115
|
await action();
|
|
120
116
|
}
|