chrome-devtools-frontend 1.0.1613625 → 1.0.1615539
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/AUTHORS +1 -0
- package/docs/contributing/infrastructure.md +0 -1
- package/front_end/core/common/VersionController.ts +17 -1
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/root/ExperimentNames.ts +0 -1
- package/front_end/core/sdk/OverlayModel.ts +2 -4
- package/front_end/core/sdk/sdk-meta.ts +13 -0
- package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +4 -0
- package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -1
- package/front_end/entrypoints/greendev_floaty/floaty.css +3 -0
- package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +0 -6
- package/front_end/entrypoints/shell/shell.ts +4 -0
- package/front_end/entrypoints/trace_app/trace_app.ts +4 -0
- package/front_end/generated/InspectorBackendCommands.ts +6 -4
- package/front_end/generated/protocol-mapping.d.ts +14 -0
- package/front_end/generated/protocol-proxy-api.d.ts +10 -0
- package/front_end/generated/protocol.ts +33 -3
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +10 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +23 -7
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +200 -46
- package/front_end/models/issues_manager/IssuesManager.ts +4 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +673 -639
- package/front_end/models/stack_trace/DetailedErrorStackParser.ts +161 -0
- package/front_end/models/stack_trace/StackTrace.ts +18 -0
- package/front_end/models/stack_trace/StackTraceImpl.ts +96 -4
- package/front_end/models/stack_trace/StackTraceModel.ts +39 -0
- package/front_end/models/stack_trace/Trie.ts +21 -0
- package/front_end/models/stack_trace/stack_trace_impl.ts +2 -0
- package/front_end/panels/ai_assistance/components/AccessibilityAgentMarkdownRenderer.ts +55 -14
- package/front_end/panels/ai_assistance/components/ChatView.ts +4 -3
- package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +4 -1
- package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -2
- package/front_end/panels/application/WebMCPView.ts +270 -18
- package/front_end/panels/application/components/ProtocolHandlersView.ts +2 -2
- package/front_end/panels/application/webMCPView.css +4 -1
- package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +7 -0
- package/front_end/panels/console/ConsoleContextSelector.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +8 -2
- package/front_end/panels/console/consoleView.css +4 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -3
- package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -2
- package/front_end/panels/network/RequestConditionsDrawer.ts +4 -2
- package/front_end/panels/network/RequestPayloadView.ts +8 -3
- package/front_end/panels/network/RequestTimingView.ts +6 -7
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +7 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +4 -4
- package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +1 -1
- package/front_end/tsconfig.json +2 -1
- package/front_end/ui/legacy/EmptyWidget.ts +2 -2
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -2
- package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +4 -5
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -7
- package/front_end/ui/lit/lit.ts +4 -1
- package/front_end/ui/lit/render.ts +81 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -1
- package/package.json +1 -1
- /package/front_end/third_party/codemirror/package/addon/runmode/{runmode-standalone.mjs.d.ts → runmode-standalone.d.mts} +0 -0
- /package/front_end/third_party/codemirror/package/mode/css/{css.mjs.d.ts → css.d.mts} +0 -0
- /package/front_end/third_party/codemirror/package/mode/javascript/{javascript.mjs.d.ts → javascript.d.mts} +0 -0
- /package/front_end/third_party/codemirror/package/mode/xml/{xml.mjs.d.ts → xml.d.mts} +0 -0
- /package/front_end/third_party/lighthouse/report-assets/{report-generator.mjs.d.ts → report-generator.d.mts} +0 -0
package/AUTHORS
CHANGED
|
@@ -41,6 +41,7 @@ Emir D <emrd434@gmail.com>
|
|
|
41
41
|
Ergün Erdoğmuş <erdogmusergun@gmail.com>
|
|
42
42
|
Eric Rannaud <eric.rannaud@gmail.com>
|
|
43
43
|
Faisal Salman <fyzlman@gmail.com>
|
|
44
|
+
Fedor Indutny <indutny@signal.org>
|
|
44
45
|
Feng Lu <lufengd3@gmail.com>
|
|
45
46
|
Feng Yu <f3n67u@gmail.com>
|
|
46
47
|
Gabriel Luong <gabriel.luong@gmail.com>
|
|
@@ -112,7 +112,6 @@ for the current logic.
|
|
|
112
112
|
Some of the filters currently in use are:
|
|
113
113
|
|
|
114
114
|
- `cpp_debug_extension` builders only trigger on changes related to the extension
|
|
115
|
-
- `dtf_check_no_bundle` builder only trigger on GN changes
|
|
116
115
|
- all other builders will not trigger if only documentation files are updated
|
|
117
116
|
|
|
118
117
|
## Branch cutting process
|
|
@@ -17,7 +17,7 @@ export class VersionController {
|
|
|
17
17
|
static readonly SYNCED_VERSION_SETTING_NAME = 'syncedInspectorVersion';
|
|
18
18
|
static readonly LOCAL_VERSION_SETTING_NAME = 'localInspectorVersion';
|
|
19
19
|
|
|
20
|
-
static readonly CURRENT_VERSION =
|
|
20
|
+
static readonly CURRENT_VERSION = 44;
|
|
21
21
|
|
|
22
22
|
readonly #settings: Settings;
|
|
23
23
|
readonly #globalVersionSetting: Setting<number>;
|
|
@@ -848,6 +848,22 @@ export class VersionController {
|
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
|
|
851
|
+
updateVersionFrom43To44(): void {
|
|
852
|
+
const apcaExperimentEnabled =
|
|
853
|
+
Root.Runtime.experiments.getValueFromStorage('apca' as Root.ExperimentNames.ExperimentName);
|
|
854
|
+
if (apcaExperimentEnabled !== undefined) {
|
|
855
|
+
if (this.#settings.syncedStorage.has('apca')) {
|
|
856
|
+
return; // Already migrated
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
const apcaSetting = this.#settings.moduleSetting('apca');
|
|
860
|
+
apcaSetting.set(apcaExperimentEnabled);
|
|
861
|
+
} catch {
|
|
862
|
+
// If the setting is not registered yet (e.g. in tests), skip.
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
851
867
|
/*
|
|
852
868
|
* Any new migration should be added before this comment.
|
|
853
869
|
*
|
|
@@ -816,7 +816,6 @@ export enum DevtoolsExperiments {
|
|
|
816
816
|
'protocol-monitor' = 13,
|
|
817
817
|
'sampling-heap-profiler-timeline' = 17,
|
|
818
818
|
'timeline-invalidation-tracking' = 26,
|
|
819
|
-
apca = 39,
|
|
820
819
|
'font-editor' = 41,
|
|
821
820
|
'instrumentation-breakpoints' = 61,
|
|
822
821
|
'use-source-map-scopes' = 76,
|
|
@@ -9,7 +9,6 @@ export enum ExperimentName {
|
|
|
9
9
|
PROTOCOL_MONITOR = 'protocol-monitor',
|
|
10
10
|
SAMPLING_HEAP_PROFILER_TIMELINE = 'sampling-heap-profiler-timeline',
|
|
11
11
|
TIMELINE_INVALIDATION_TRACKING = 'timeline-invalidation-tracking',
|
|
12
|
-
APCA = 'apca',
|
|
13
12
|
FONT_EDITOR = 'font-editor',
|
|
14
13
|
INSTRUMENTATION_BREAKPOINTS = 'instrumentation-breakpoints',
|
|
15
14
|
USE_SOURCE_MAP_SCOPES = 'use-source-map-scopes',
|
|
@@ -7,7 +7,6 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
|
7
7
|
import * as Protocol from '../../generated/protocol.js';
|
|
8
8
|
import * as Common from '../common/common.js';
|
|
9
9
|
import * as i18n from '../i18n/i18n.js';
|
|
10
|
-
import * as Root from '../root/root.js';
|
|
11
10
|
|
|
12
11
|
import type {CSSModel} from './CSSModel.js';
|
|
13
12
|
import {DebuggerModel, Events as DebuggerModelEvents} from './DebuggerModel.js';
|
|
@@ -534,9 +533,8 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
534
533
|
gridHighlightConfig: {},
|
|
535
534
|
flexContainerHighlightConfig: {},
|
|
536
535
|
flexItemHighlightConfig: {},
|
|
537
|
-
contrastAlgorithm:
|
|
538
|
-
|
|
539
|
-
Protocol.Overlay.ContrastAlgorithm.Aa,
|
|
536
|
+
contrastAlgorithm: settings.moduleSetting('apca').get() ? Protocol.Overlay.ContrastAlgorithm.Apca :
|
|
537
|
+
Protocol.Overlay.ContrastAlgorithm.Aa,
|
|
540
538
|
};
|
|
541
539
|
|
|
542
540
|
if (mode === 'all' || mode === 'content') {
|
|
@@ -403,6 +403,10 @@ const UIStrings = {
|
|
|
403
403
|
* @description Title of a setting under the Console category in Settings
|
|
404
404
|
*/
|
|
405
405
|
logXmlhttprequests: 'Log XMLHttpRequests',
|
|
406
|
+
/**
|
|
407
|
+
* @description Title of a setting under the Elements category in Settings.
|
|
408
|
+
*/
|
|
409
|
+
apca: 'Advanced Perceptual Contrast Algorithm (APCA) replacing previous contrast ratio and AA/AAA guidelines',
|
|
406
410
|
} as const;
|
|
407
411
|
const str_ = i18n.i18n.registerUIStrings('core/sdk/sdk-meta.ts', UIStrings);
|
|
408
412
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
@@ -521,6 +525,15 @@ Common.Settings.registerSettingExtension({
|
|
|
521
525
|
defaultValue: false,
|
|
522
526
|
});
|
|
523
527
|
|
|
528
|
+
Common.Settings.registerSettingExtension({
|
|
529
|
+
category: Common.Settings.SettingCategory.ELEMENTS,
|
|
530
|
+
storageType: Common.Settings.SettingStorageType.SYNCED,
|
|
531
|
+
title: i18nLazyString(UIStrings.apca),
|
|
532
|
+
settingName: 'apca',
|
|
533
|
+
settingType: Common.Settings.SettingType.BOOLEAN,
|
|
534
|
+
defaultValue: false,
|
|
535
|
+
});
|
|
536
|
+
|
|
524
537
|
Common.Settings.registerSettingExtension({
|
|
525
538
|
category: Common.Settings.SettingCategory.GRID,
|
|
526
539
|
storageType: Common.Settings.SettingStorageType.SYNCED,
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import '../../core/dom_extension/dom_extension.js';
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
+
// @ts-ignore: tsc 6.0 does not support side-effect imports without a type definition.
|
|
8
|
+
// We cannot use `@ts-expect-error` here because the import is correctly resolved
|
|
9
|
+
// when bundling the application (which doesn't error) and only errors in unbundled builds.
|
|
6
10
|
import '../../Images/Images.js';
|
|
7
11
|
|
|
8
12
|
if (window.opener) {
|
|
@@ -368,7 +368,6 @@ async function init(): Promise<void> {
|
|
|
368
368
|
safeRegisterExperiment(Root.ExperimentNames.ExperimentName.PROTOCOL_MONITOR, 'Protocol Monitor');
|
|
369
369
|
safeRegisterExperiment(
|
|
370
370
|
Root.ExperimentNames.ExperimentName.SAMPLING_HEAP_PROFILER_TIMELINE, 'Sampling heap profiler timeline');
|
|
371
|
-
safeRegisterExperiment(Root.ExperimentNames.ExperimentName.APCA, 'APCA');
|
|
372
371
|
|
|
373
372
|
const hostUnsyncedStorage: Common.Settings.SettingsBackingStore = {
|
|
374
373
|
register: (name: string) =>
|
|
@@ -99,6 +99,8 @@ html, body {
|
|
|
99
99
|
overflow-wrap: break-word;
|
|
100
100
|
line-height: 1.4;
|
|
101
101
|
white-space: pre-wrap; /* Preserve newlines */
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
min-height: min-content;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
.user-message {
|
|
@@ -182,6 +184,7 @@ html, body {
|
|
|
182
184
|
flex-direction: column;
|
|
183
185
|
gap: 8px;
|
|
184
186
|
border: 1px solid #d3e3fd;
|
|
187
|
+
flex-shrink: 0;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
.green-dev-floaty-dialog-node-description {
|
|
@@ -254,7 +254,6 @@ async function init(): Promise<void> {
|
|
|
254
254
|
Root.Runtime.experiments.register(Root.ExperimentNames.ExperimentName.PROTOCOL_MONITOR, 'Protocol Monitor');
|
|
255
255
|
Root.Runtime.experiments.register(
|
|
256
256
|
Root.ExperimentNames.ExperimentName.SAMPLING_HEAP_PROFILER_TIMELINE, 'Sampling heap profiler timeline');
|
|
257
|
-
Root.Runtime.experiments.register(Root.ExperimentNames.ExperimentName.APCA, 'APCA');
|
|
258
257
|
|
|
259
258
|
const WINDOW_LOCAL_STORAGE: Common.Settings.SettingsBackingStore = {
|
|
260
259
|
register(_setting: string): void{},
|
|
@@ -372,12 +372,6 @@ export class MainImpl {
|
|
|
372
372
|
Root.Runtime.experiments.register(
|
|
373
373
|
Root.ExperimentNames.ExperimentName.USE_SOURCE_MAP_SCOPES, 'Use scope information from source maps');
|
|
374
374
|
|
|
375
|
-
// Advanced Perceptual Contrast Algorithm.
|
|
376
|
-
Root.Runtime.experiments.register(
|
|
377
|
-
Root.ExperimentNames.ExperimentName.APCA,
|
|
378
|
-
'Advanced Perceptual Contrast Algorithm (APCA) replacing previous contrast ratio and AA/AAA guidelines',
|
|
379
|
-
'https://developer.chrome.com/blog/new-in-devtools-89/#apca');
|
|
380
|
-
|
|
381
375
|
// Font Editor
|
|
382
376
|
Root.Runtime.experiments.register(
|
|
383
377
|
Root.ExperimentNames.ExperimentName.FONT_EDITOR, 'New font editor in the Styles tab',
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore: tsc 6.0 does not support side-effect imports without a type definition.
|
|
7
|
+
// We cannot use `@ts-expect-error` here because the import is correctly resolved
|
|
8
|
+
// when bundling the application (which doesn't error) and only errors in unbundled builds.
|
|
5
9
|
import '../../Images/Images.js';
|
|
6
10
|
import '../../core/dom_extension/dom_extension.js';
|
|
7
11
|
import '../../panels/sources/sources-meta.js';
|
|
@@ -6,6 +6,10 @@ import '../main/main-meta.js';
|
|
|
6
6
|
import '../inspector_main/inspector_main-meta.js';
|
|
7
7
|
import '../../core/sdk/sdk-meta.js';
|
|
8
8
|
import '../../models/workspace/workspace-meta.js';
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
+
// @ts-ignore: tsc 6.0 does not support side-effect imports without a type definition.
|
|
11
|
+
// We cannot use `@ts-expect-error` here because the import is correctly resolved
|
|
12
|
+
// when bundling the application (which doesn't error) and only errors in unbundled builds.
|
|
9
13
|
import '../../Images/Images.js';
|
|
10
14
|
import '../../models/logs/logs-meta.js';
|
|
11
15
|
import '../../models/persistence/persistence-meta.js';
|
|
@@ -808,8 +808,8 @@ inspectorBackend.registerEnum("Network.ReportStatus", {Queued: "Queued", Pending
|
|
|
808
808
|
inspectorBackend.registerEnum("Network.DeviceBoundSessionWithUsageUsage", {NotInScope: "NotInScope", InScopeRefreshNotYetNeeded: "InScopeRefreshNotYetNeeded", InScopeRefreshNotAllowed: "InScopeRefreshNotAllowed", ProactiveRefreshNotPossible: "ProactiveRefreshNotPossible", ProactiveRefreshAttempted: "ProactiveRefreshAttempted", Deferred: "Deferred"});
|
|
809
809
|
inspectorBackend.registerEnum("Network.DeviceBoundSessionUrlRuleRuleType", {Exclude: "Exclude", Include: "Include"});
|
|
810
810
|
inspectorBackend.registerEnum("Network.DeviceBoundSessionFetchResult", {Success: "Success", KeyError: "KeyError", SigningError: "SigningError", ServerRequestedTermination: "ServerRequestedTermination", InvalidSessionId: "InvalidSessionId", InvalidChallenge: "InvalidChallenge", TooManyChallenges: "TooManyChallenges", InvalidFetcherUrl: "InvalidFetcherUrl", InvalidRefreshUrl: "InvalidRefreshUrl", TransientHttpError: "TransientHttpError", ScopeOriginSameSiteMismatch: "ScopeOriginSameSiteMismatch", RefreshUrlSameSiteMismatch: "RefreshUrlSameSiteMismatch", MismatchedSessionId: "MismatchedSessionId", MissingScope: "MissingScope", NoCredentials: "NoCredentials", SubdomainRegistrationWellKnownUnavailable: "SubdomainRegistrationWellKnownUnavailable", SubdomainRegistrationUnauthorized: "SubdomainRegistrationUnauthorized", SubdomainRegistrationWellKnownMalformed: "SubdomainRegistrationWellKnownMalformed", SessionProviderWellKnownUnavailable: "SessionProviderWellKnownUnavailable", RelyingPartyWellKnownUnavailable: "RelyingPartyWellKnownUnavailable", FederatedKeyThumbprintMismatch: "FederatedKeyThumbprintMismatch", InvalidFederatedSessionUrl: "InvalidFederatedSessionUrl", InvalidFederatedKey: "InvalidFederatedKey", TooManyRelyingOriginLabels: "TooManyRelyingOriginLabels", BoundCookieSetForbidden: "BoundCookieSetForbidden", NetError: "NetError", ProxyError: "ProxyError", EmptySessionConfig: "EmptySessionConfig", InvalidCredentialsConfig: "InvalidCredentialsConfig", InvalidCredentialsType: "InvalidCredentialsType", InvalidCredentialsEmptyName: "InvalidCredentialsEmptyName", InvalidCredentialsCookie: "InvalidCredentialsCookie", PersistentHttpError: "PersistentHttpError", RegistrationAttemptedChallenge: "RegistrationAttemptedChallenge", InvalidScopeOrigin: "InvalidScopeOrigin", ScopeOriginContainsPath: "ScopeOriginContainsPath", RefreshInitiatorNotString: "RefreshInitiatorNotString", RefreshInitiatorInvalidHostPattern: "RefreshInitiatorInvalidHostPattern", InvalidScopeSpecification: "InvalidScopeSpecification", MissingScopeSpecificationType: "MissingScopeSpecificationType", EmptyScopeSpecificationDomain: "EmptyScopeSpecificationDomain", EmptyScopeSpecificationPath: "EmptyScopeSpecificationPath", InvalidScopeSpecificationType: "InvalidScopeSpecificationType", InvalidScopeIncludeSite: "InvalidScopeIncludeSite", MissingScopeIncludeSite: "MissingScopeIncludeSite", FederatedNotAuthorizedByProvider: "FederatedNotAuthorizedByProvider", FederatedNotAuthorizedByRelyingParty: "FederatedNotAuthorizedByRelyingParty", SessionProviderWellKnownMalformed: "SessionProviderWellKnownMalformed", SessionProviderWellKnownHasProviderOrigin: "SessionProviderWellKnownHasProviderOrigin", RelyingPartyWellKnownMalformed: "RelyingPartyWellKnownMalformed", RelyingPartyWellKnownHasRelyingOrigins: "RelyingPartyWellKnownHasRelyingOrigins", InvalidFederatedSessionProviderSessionMissing: "InvalidFederatedSessionProviderSessionMissing", InvalidFederatedSessionWrongProviderOrigin: "InvalidFederatedSessionWrongProviderOrigin", InvalidCredentialsCookieCreationTime: "InvalidCredentialsCookieCreationTime", InvalidCredentialsCookieName: "InvalidCredentialsCookieName", InvalidCredentialsCookieParsing: "InvalidCredentialsCookieParsing", InvalidCredentialsCookieUnpermittedAttribute: "InvalidCredentialsCookieUnpermittedAttribute", InvalidCredentialsCookieInvalidDomain: "InvalidCredentialsCookieInvalidDomain", InvalidCredentialsCookiePrefix: "InvalidCredentialsCookiePrefix", InvalidScopeRulePath: "InvalidScopeRulePath", InvalidScopeRuleHostPattern: "InvalidScopeRuleHostPattern", ScopeRuleOriginScopedHostPatternMismatch: "ScopeRuleOriginScopedHostPatternMismatch", ScopeRuleSiteScopedHostPatternMismatch: "ScopeRuleSiteScopedHostPatternMismatch", SigningQuotaExceeded: "SigningQuotaExceeded", InvalidConfigJson: "InvalidConfigJson", InvalidFederatedSessionProviderFailedToRestoreKey: "InvalidFederatedSessionProviderFailedToRestoreKey", FailedToUnwrapKey: "FailedToUnwrapKey", SessionDeletedDuringRefresh: "SessionDeletedDuringRefresh"});
|
|
811
|
-
inspectorBackend.registerEnum("Network.RefreshEventDetailsRefreshResult", {Refreshed: "Refreshed", InitializedService: "InitializedService", Unreachable: "Unreachable", ServerError: "ServerError", RefreshQuotaExceeded: "RefreshQuotaExceeded", FatalError: "FatalError", SigningQuotaExceeded: "SigningQuotaExceeded"});
|
|
812
|
-
inspectorBackend.registerEnum("Network.TerminationEventDetailsDeletionReason", {Expired: "Expired", FailedToRestoreKey: "FailedToRestoreKey", FailedToUnwrapKey: "FailedToUnwrapKey", StoragePartitionCleared: "StoragePartitionCleared", ClearBrowsingData: "ClearBrowsingData", ServerRequested: "ServerRequested", InvalidSessionParams: "InvalidSessionParams", RefreshFatalError: "RefreshFatalError"});
|
|
811
|
+
inspectorBackend.registerEnum("Network.RefreshEventDetailsRefreshResult", {Refreshed: "Refreshed", RefreshedAsWaiter: "RefreshedAsWaiter", InitializedService: "InitializedService", Unreachable: "Unreachable", ServerError: "ServerError", RefreshQuotaExceeded: "RefreshQuotaExceeded", FatalError: "FatalError", SigningQuotaExceeded: "SigningQuotaExceeded"});
|
|
812
|
+
inspectorBackend.registerEnum("Network.TerminationEventDetailsDeletionReason", {Expired: "Expired", FailedToRestoreKey: "FailedToRestoreKey", FailedToUnwrapKey: "FailedToUnwrapKey", StoragePartitionCleared: "StoragePartitionCleared", ClearBrowsingData: "ClearBrowsingData", ServerRequested: "ServerRequested", InvalidSessionParams: "InvalidSessionParams", RefreshFatalError: "RefreshFatalError", DevTools: "DevTools"});
|
|
813
813
|
inspectorBackend.registerEnum("Network.ChallengeEventDetailsChallengeResult", {Success: "Success", NoSessionId: "NoSessionId", NoSessionMatch: "NoSessionMatch", CantSetBoundCookie: "CantSetBoundCookie"});
|
|
814
814
|
inspectorBackend.registerEvent("Network.dataReceived", ["requestId", "timestamp", "dataLength", "encodedDataLength", "data"]);
|
|
815
815
|
inspectorBackend.registerEvent("Network.eventSourceMessageReceived", ["requestId", "timestamp", "eventName", "eventId", "data"]);
|
|
@@ -893,6 +893,7 @@ inspectorBackend.registerCommand("Network.streamResourceContent", [{"name": "req
|
|
|
893
893
|
inspectorBackend.registerCommand("Network.getSecurityIsolationStatus", [{"name": "frameId", "type": "string", "optional": true, "description": "If no frameId is provided, the status of the target is provided.", "typeRef": "Page.FrameId"}], ["status"], "Returns information about the COEP/COOP isolation status.");
|
|
894
894
|
inspectorBackend.registerCommand("Network.enableReportingApi", [{"name": "enable", "type": "boolean", "optional": false, "description": "Whether to enable or disable events for the Reporting API", "typeRef": null}], [], "Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. Enabling triggers 'reportingApiReportAdded' for all existing reports.");
|
|
895
895
|
inspectorBackend.registerCommand("Network.enableDeviceBoundSessions", [{"name": "enable", "type": "boolean", "optional": false, "description": "Whether to enable or disable events.", "typeRef": null}], [], "Sets up tracking device bound sessions and fetching of initial set of sessions.");
|
|
896
|
+
inspectorBackend.registerCommand("Network.deleteDeviceBoundSession", [{"name": "key", "type": "object", "optional": false, "description": "", "typeRef": "Network.DeviceBoundSessionKey"}], [], "Deletes a device bound session.");
|
|
896
897
|
inspectorBackend.registerCommand("Network.fetchSchemefulSite", [{"name": "origin", "type": "string", "optional": false, "description": "The URL origin.", "typeRef": null}], ["schemefulSite"], "Fetches the schemeful site for a specific origin.");
|
|
897
898
|
inspectorBackend.registerCommand("Network.loadNetworkResource", [{"name": "frameId", "type": "string", "optional": true, "description": "Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.", "typeRef": "Page.FrameId"}, {"name": "url", "type": "string", "optional": false, "description": "URL of the resource to get content for.", "typeRef": null}, {"name": "options", "type": "object", "optional": false, "description": "Options for the request.", "typeRef": "Network.LoadNetworkResourceOptions"}], ["resource"], "Fetches the resource and returns the content.");
|
|
898
899
|
inspectorBackend.registerCommand("Network.setCookieControls", [{"name": "enableThirdPartyCookieRestriction", "type": "boolean", "optional": false, "description": "Whether 3pc restriction is enabled.", "typeRef": null}], [], "Sets Controls for third-party cookie access Page reload is required before the new cookie behavior will be observed");
|
|
@@ -1408,7 +1409,7 @@ inspectorBackend.registerCommand("Target.setDiscoverTargets", [{"name": "discove
|
|
|
1408
1409
|
inspectorBackend.registerCommand("Target.setRemoteLocations", [{"name": "locations", "type": "array", "optional": false, "description": "List of remote locations.", "typeRef": "Target.RemoteLocation"}], [], "Enables target discovery for the specified locations, when `setDiscoverTargets` was set to `true`.");
|
|
1409
1410
|
inspectorBackend.registerCommand("Target.getDevToolsTarget", [{"name": "targetId", "type": "string", "optional": false, "description": "Page or tab target ID.", "typeRef": "Target.TargetID"}], ["targetId"], "Gets the targetId of the DevTools page target opened for the given target (if any).");
|
|
1410
1411
|
inspectorBackend.registerCommand("Target.openDevTools", [{"name": "targetId", "type": "string", "optional": false, "description": "This can be the page or tab target ID.", "typeRef": "Target.TargetID"}, {"name": "panelId", "type": "string", "optional": true, "description": "The id of the panel we want DevTools to open initially. Currently supported panels are elements, console, network, sources, resources and performance.", "typeRef": null}], ["targetId"], "Opens a DevTools window for the target.");
|
|
1411
|
-
inspectorBackend.registerType("Target.TargetInfo", [{"name": "targetId", "type": "string", "optional": false, "description": "", "typeRef": "Target.TargetID"}, {"name": "type", "type": "string", "optional": false, "description": "List of types: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypeTab%5B%5D%22", "typeRef": null}, {"name": "title", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "url", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "attached", "type": "boolean", "optional": false, "description": "Whether the target has an attached client.", "typeRef": null}, {"name": "openerId", "type": "string", "optional": true, "description": "Opener target Id", "typeRef": "Target.TargetID"}, {"name": "canAccessOpener", "type": "boolean", "optional": false, "description": "Whether the target has access to the originating window.", "typeRef": null}, {"name": "openerFrameId", "type": "string", "optional": true, "description": "Frame id of originating window (is only set if target has an opener).", "typeRef": "Page.FrameId"}, {"name": "parentFrameId", "type": "string", "optional": true, "description": "Id of the parent frame,
|
|
1412
|
+
inspectorBackend.registerType("Target.TargetInfo", [{"name": "targetId", "type": "string", "optional": false, "description": "", "typeRef": "Target.TargetID"}, {"name": "type", "type": "string", "optional": false, "description": "List of types: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypeTab%5B%5D%22", "typeRef": null}, {"name": "title", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "url", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "attached", "type": "boolean", "optional": false, "description": "Whether the target has an attached client.", "typeRef": null}, {"name": "openerId", "type": "string", "optional": true, "description": "Opener target Id", "typeRef": "Target.TargetID"}, {"name": "canAccessOpener", "type": "boolean", "optional": false, "description": "Whether the target has access to the originating window.", "typeRef": null}, {"name": "openerFrameId", "type": "string", "optional": true, "description": "Frame id of originating window (is only set if target has an opener).", "typeRef": "Page.FrameId"}, {"name": "parentFrameId", "type": "string", "optional": true, "description": "Id of the parent frame, present for \\\"iframe\\\" and \\\"worker\\\" targets. For nested workers, this is the \\\"ancestor\\\" frame that created the first worker in the nested chain.", "typeRef": "Page.FrameId"}, {"name": "browserContextId", "type": "string", "optional": true, "description": "", "typeRef": "Browser.BrowserContextID"}, {"name": "subtype", "type": "string", "optional": true, "description": "Provides additional details for specific target types. For example, for the type of \\\"page\\\", this may be set to \\\"prerender\\\".", "typeRef": null}]);
|
|
1412
1413
|
inspectorBackend.registerType("Target.FilterEntry", [{"name": "exclude", "type": "boolean", "optional": true, "description": "If set, causes exclusion of matching targets from the list.", "typeRef": null}, {"name": "type", "type": "string", "optional": true, "description": "If not present, matches any type.", "typeRef": null}]);
|
|
1413
1414
|
inspectorBackend.registerType("Target.TargetFilter", [{"name": "TargetFilter", "type": "array", "optional": false, "description": "The entries in TargetFilter are matched sequentially against targets and the first entry that matches determines if the target is included or not, depending on the value of `exclude` field in the entry. If filter is not specified, the one assumed is [{type: \\\"browser\\\", exclude: true}, {type: \\\"tab\\\", exclude: true}, {}] (i.e. include everything but `browser` and `tab`).", "typeRef": "Target.FilterEntry"}]);
|
|
1414
1415
|
inspectorBackend.registerType("Target.RemoteLocation", [{"name": "host", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "port", "type": "number", "optional": false, "description": "", "typeRef": null}]);
|
|
@@ -1489,13 +1490,14 @@ inspectorBackend.registerType("WebAuthn.VirtualAuthenticatorOptions", [{"name":
|
|
|
1489
1490
|
inspectorBackend.registerType("WebAuthn.Credential", [{"name": "credentialId", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "isResidentCredential", "type": "boolean", "optional": false, "description": "", "typeRef": null}, {"name": "rpId", "type": "string", "optional": true, "description": "Relying Party ID the credential is scoped to. Must be set when adding a credential.", "typeRef": null}, {"name": "privateKey", "type": "string", "optional": false, "description": "The ECDSA P-256 private key in PKCS#8 format.", "typeRef": null}, {"name": "userHandle", "type": "string", "optional": true, "description": "An opaque byte sequence with a maximum size of 64 bytes mapping the credential to a specific user.", "typeRef": null}, {"name": "signCount", "type": "number", "optional": false, "description": "Signature counter. This is incremented by one for each successful assertion. See https://w3c.github.io/webauthn/#signature-counter", "typeRef": null}, {"name": "largeBlob", "type": "string", "optional": true, "description": "The large blob associated with the credential. See https://w3c.github.io/webauthn/#sctn-large-blob-extension", "typeRef": null}, {"name": "backupEligibility", "type": "boolean", "optional": true, "description": "Assertions returned by this credential will have the backup eligibility (BE) flag set to this value. Defaults to the authenticator's defaultBackupEligibility value.", "typeRef": null}, {"name": "backupState", "type": "boolean", "optional": true, "description": "Assertions returned by this credential will have the backup state (BS) flag set to this value. Defaults to the authenticator's defaultBackupState value.", "typeRef": null}, {"name": "userName", "type": "string", "optional": true, "description": "The credential's user.name property. Equivalent to empty if not set. https://w3c.github.io/webauthn/#dom-publickeycredentialentity-name", "typeRef": null}, {"name": "userDisplayName", "type": "string", "optional": true, "description": "The credential's user.displayName property. Equivalent to empty if not set. https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname", "typeRef": null}]);
|
|
1490
1491
|
|
|
1491
1492
|
// WebMCP.
|
|
1492
|
-
inspectorBackend.registerEnum("WebMCP.InvocationStatus", {
|
|
1493
|
+
inspectorBackend.registerEnum("WebMCP.InvocationStatus", {Completed: "Completed", Canceled: "Canceled", Error: "Error"});
|
|
1493
1494
|
inspectorBackend.registerEvent("WebMCP.toolsAdded", ["tools"]);
|
|
1494
1495
|
inspectorBackend.registerEvent("WebMCP.toolsRemoved", ["tools"]);
|
|
1495
1496
|
inspectorBackend.registerEvent("WebMCP.toolInvoked", ["toolName", "frameId", "invocationId", "input"]);
|
|
1496
1497
|
inspectorBackend.registerEvent("WebMCP.toolResponded", ["invocationId", "status", "output", "errorText", "exception"]);
|
|
1497
1498
|
inspectorBackend.registerCommand("WebMCP.enable", [], [], "Enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for all currently registered tools.");
|
|
1498
1499
|
inspectorBackend.registerCommand("WebMCP.disable", [], [], "Disables the WebMCP domain.");
|
|
1500
|
+
inspectorBackend.registerCommand("WebMCP.invokeTool", [{"name": "frameId", "type": "string", "optional": false, "description": "Frame in which to invoke the tool.", "typeRef": "Page.FrameId"}, {"name": "toolName", "type": "string", "optional": false, "description": "Name of the tool to invoke.", "typeRef": null}, {"name": "input", "type": "object", "optional": false, "description": "Input parameters for the tool, matching the tool's inputSchema.", "typeRef": null}], ["invocationId"], "Invokes a registered tool.");
|
|
1499
1501
|
inspectorBackend.registerType("WebMCP.Annotation", [{"name": "readOnly", "type": "boolean", "optional": true, "description": "A hint indicating that the tool does not modify any state.", "typeRef": null}, {"name": "autosubmit", "type": "boolean", "optional": true, "description": "If the declarative tool was declared with the autosubmit attribute.", "typeRef": null}]);
|
|
1500
1502
|
inspectorBackend.registerType("WebMCP.Tool", [{"name": "name", "type": "string", "optional": false, "description": "Tool name.", "typeRef": null}, {"name": "description", "type": "string", "optional": false, "description": "Tool description.", "typeRef": null}, {"name": "inputSchema", "type": "object", "optional": true, "description": "Schema for the tool's input parameters.", "typeRef": null}, {"name": "annotations", "type": "object", "optional": true, "description": "Optional annotations for the tool.", "typeRef": "WebMCP.Annotation"}, {"name": "frameId", "type": "string", "optional": false, "description": "Frame identifier associated with the tool registration.", "typeRef": "Page.FrameId"}, {"name": "backendNodeId", "type": "number", "optional": true, "description": "Optional node ID for declarative tools.", "typeRef": "DOM.BackendNodeId"}, {"name": "stackTrace", "type": "object", "optional": true, "description": "The stack trace at the time of the registration.", "typeRef": "Runtime.StackTrace"}]);
|
|
1501
1503
|
|
|
@@ -3719,6 +3719,13 @@ export namespace ProtocolMapping {
|
|
|
3719
3719
|
paramsType: [Protocol.Network.EnableDeviceBoundSessionsRequest];
|
|
3720
3720
|
returnType: void;
|
|
3721
3721
|
};
|
|
3722
|
+
/**
|
|
3723
|
+
* Deletes a device bound session.
|
|
3724
|
+
*/
|
|
3725
|
+
'Network.deleteDeviceBoundSession': {
|
|
3726
|
+
paramsType: [Protocol.Network.DeleteDeviceBoundSessionRequest];
|
|
3727
|
+
returnType: void;
|
|
3728
|
+
};
|
|
3722
3729
|
/**
|
|
3723
3730
|
* Fetches the schemeful site for a specific origin.
|
|
3724
3731
|
*/
|
|
@@ -5375,6 +5382,13 @@ export namespace ProtocolMapping {
|
|
|
5375
5382
|
paramsType: [];
|
|
5376
5383
|
returnType: void;
|
|
5377
5384
|
};
|
|
5385
|
+
/**
|
|
5386
|
+
* Invokes a registered tool.
|
|
5387
|
+
*/
|
|
5388
|
+
'WebMCP.invokeTool': {
|
|
5389
|
+
paramsType: [Protocol.WebMCP.InvokeToolRequest];
|
|
5390
|
+
returnType: Protocol.WebMCP.InvokeToolResponse;
|
|
5391
|
+
};
|
|
5378
5392
|
/**
|
|
5379
5393
|
* Continues execution until specific location is reached.
|
|
5380
5394
|
*/
|
|
@@ -2731,6 +2731,11 @@ declare namespace ProtocolProxyApi {
|
|
|
2731
2731
|
*/
|
|
2732
2732
|
invoke_enableDeviceBoundSessions(params: Protocol.Network.EnableDeviceBoundSessionsRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
2733
2733
|
|
|
2734
|
+
/**
|
|
2735
|
+
* Deletes a device bound session.
|
|
2736
|
+
*/
|
|
2737
|
+
invoke_deleteDeviceBoundSession(params: Protocol.Network.DeleteDeviceBoundSessionRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
2738
|
+
|
|
2734
2739
|
/**
|
|
2735
2740
|
* Fetches the schemeful site for a specific origin.
|
|
2736
2741
|
*/
|
|
@@ -4848,6 +4853,11 @@ declare namespace ProtocolProxyApi {
|
|
|
4848
4853
|
*/
|
|
4849
4854
|
invoke_disable(): Promise<Protocol.ProtocolResponseWithError>;
|
|
4850
4855
|
|
|
4856
|
+
/**
|
|
4857
|
+
* Invokes a registered tool.
|
|
4858
|
+
*/
|
|
4859
|
+
invoke_invokeTool(params: Protocol.WebMCP.InvokeToolRequest): Promise<Protocol.WebMCP.InvokeToolResponse>;
|
|
4860
|
+
|
|
4851
4861
|
}
|
|
4852
4862
|
export interface WebMCPDispatcher {
|
|
4853
4863
|
/**
|
|
@@ -11922,6 +11922,7 @@ export namespace Network {
|
|
|
11922
11922
|
|
|
11923
11923
|
export const enum RefreshEventDetailsRefreshResult {
|
|
11924
11924
|
Refreshed = 'Refreshed',
|
|
11925
|
+
RefreshedAsWaiter = 'RefreshedAsWaiter',
|
|
11925
11926
|
InitializedService = 'InitializedService',
|
|
11926
11927
|
Unreachable = 'Unreachable',
|
|
11927
11928
|
ServerError = 'ServerError',
|
|
@@ -11967,6 +11968,7 @@ export namespace Network {
|
|
|
11967
11968
|
ServerRequested = 'ServerRequested',
|
|
11968
11969
|
InvalidSessionParams = 'InvalidSessionParams',
|
|
11969
11970
|
RefreshFatalError = 'RefreshFatalError',
|
|
11971
|
+
DevTools = 'DevTools',
|
|
11970
11972
|
}
|
|
11971
11973
|
|
|
11972
11974
|
/**
|
|
@@ -12555,6 +12557,10 @@ export namespace Network {
|
|
|
12555
12557
|
enable: boolean;
|
|
12556
12558
|
}
|
|
12557
12559
|
|
|
12560
|
+
export interface DeleteDeviceBoundSessionRequest {
|
|
12561
|
+
key: DeviceBoundSessionKey;
|
|
12562
|
+
}
|
|
12563
|
+
|
|
12558
12564
|
export interface FetchSchemefulSiteRequest {
|
|
12559
12565
|
/**
|
|
12560
12566
|
* The URL origin.
|
|
@@ -19043,7 +19049,8 @@ export namespace Target {
|
|
|
19043
19049
|
*/
|
|
19044
19050
|
openerFrameId?: Page.FrameId;
|
|
19045
19051
|
/**
|
|
19046
|
-
* Id of the parent frame,
|
|
19052
|
+
* Id of the parent frame, present for "iframe" and "worker" targets. For nested workers,
|
|
19053
|
+
* this is the "ancestor" frame that created the first worker in the nested chain.
|
|
19047
19054
|
*/
|
|
19048
19055
|
parentFrameId?: Page.FrameId;
|
|
19049
19056
|
browserContextId?: Browser.BrowserContextID;
|
|
@@ -20316,7 +20323,7 @@ export namespace WebMCP {
|
|
|
20316
20323
|
* Represents the status of a tool invocation.
|
|
20317
20324
|
*/
|
|
20318
20325
|
export const enum InvocationStatus {
|
|
20319
|
-
|
|
20326
|
+
Completed = 'Completed',
|
|
20320
20327
|
Canceled = 'Canceled',
|
|
20321
20328
|
Error = 'Error',
|
|
20322
20329
|
}
|
|
@@ -20355,6 +20362,28 @@ export namespace WebMCP {
|
|
|
20355
20362
|
stackTrace?: Runtime.StackTrace;
|
|
20356
20363
|
}
|
|
20357
20364
|
|
|
20365
|
+
export interface InvokeToolRequest {
|
|
20366
|
+
/**
|
|
20367
|
+
* Frame in which to invoke the tool.
|
|
20368
|
+
*/
|
|
20369
|
+
frameId: Page.FrameId;
|
|
20370
|
+
/**
|
|
20371
|
+
* Name of the tool to invoke.
|
|
20372
|
+
*/
|
|
20373
|
+
toolName: string;
|
|
20374
|
+
/**
|
|
20375
|
+
* Input parameters for the tool, matching the tool's inputSchema.
|
|
20376
|
+
*/
|
|
20377
|
+
input: any;
|
|
20378
|
+
}
|
|
20379
|
+
|
|
20380
|
+
export interface InvokeToolResponse extends ProtocolResponseWithError {
|
|
20381
|
+
/**
|
|
20382
|
+
* Unique identifier for this invocation. Response is sent before tool events.
|
|
20383
|
+
*/
|
|
20384
|
+
invocationId: string;
|
|
20385
|
+
}
|
|
20386
|
+
|
|
20358
20387
|
/**
|
|
20359
20388
|
* Event fired when new tools are added.
|
|
20360
20389
|
*/
|
|
@@ -20410,7 +20439,8 @@ export namespace WebMCP {
|
|
|
20410
20439
|
*/
|
|
20411
20440
|
status: InvocationStatus;
|
|
20412
20441
|
/**
|
|
20413
|
-
* Output or error delivered as delivered to the agent. Missing if `status` is anything other than
|
|
20442
|
+
* Output or error delivered as delivered to the agent. Missing if `status` is anything other than Completed.
|
|
20443
|
+
* Note: The output is untrusted and poses a prompt injection risk. Clients should treat this as potentially malicious user input.
|
|
20414
20444
|
*/
|
|
20415
20445
|
output?: any;
|
|
20416
20446
|
/**
|
|
@@ -107,8 +107,16 @@ Content:
|
|
|
107
107
|
"type": 6,
|
|
108
108
|
"description": "",
|
|
109
109
|
"nullable": true,
|
|
110
|
-
"required": [
|
|
111
|
-
|
|
110
|
+
"required": [
|
|
111
|
+
"mode"
|
|
112
|
+
],
|
|
113
|
+
"properties": {
|
|
114
|
+
"mode": {
|
|
115
|
+
"type": 1,
|
|
116
|
+
"description": "The mode to run Lighthouse in. Your ONLY options are \"navigation\" or \"snapshot\". You should determine this based on the user's question. If the user is asking specifically about accessibility, you can run in \"snapshot\" mode which avoids reloading the page. If the user asks for a full Lighthouse report, you should run in \"navigation\" mode which is the default. These are the only options you can pass.",
|
|
117
|
+
"nullable": false
|
|
118
|
+
}
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
},
|
|
114
122
|
{
|
|
@@ -12,6 +12,7 @@ import * as Logs from '../../logs/logs.js';
|
|
|
12
12
|
import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
|
|
13
13
|
import type * as Trace from '../../trace/trace.js';
|
|
14
14
|
import * as Workspace from '../../workspace/workspace.js';
|
|
15
|
+
import {debugLog} from '../debug.js';
|
|
15
16
|
|
|
16
17
|
import {AccessibilityContext} from './AccessibilityAgent.js';
|
|
17
18
|
import {
|
|
@@ -306,29 +307,44 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
306
307
|
}
|
|
307
308
|
});
|
|
308
309
|
|
|
309
|
-
|
|
310
|
+
type LHSupportedRunMode = Extract<LHModel.RunTypes.RunMode, 'navigation'|'snapshot'>;
|
|
311
|
+
const parseLighthouseMode = (mode?: string): LHSupportedRunMode => {
|
|
312
|
+
return mode === 'snapshot' ? 'snapshot' : 'navigation';
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
this.declareFunction<{mode: LHSupportedRunMode}>('runLighthouseAudits', {
|
|
310
316
|
description:
|
|
311
317
|
'Records a Lighthouse audit on the current page. Use this to debug accessibility, SEO, and best practices. (For performance metrics like LCP, use performanceRecordAndReload instead).',
|
|
312
318
|
parameters: {
|
|
313
319
|
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
314
320
|
description: '',
|
|
315
321
|
nullable: true,
|
|
316
|
-
required: [],
|
|
317
|
-
properties: {
|
|
322
|
+
required: ['mode'],
|
|
323
|
+
properties: {
|
|
324
|
+
mode: {
|
|
325
|
+
type: Host.AidaClient.ParametersTypes.STRING,
|
|
326
|
+
description:
|
|
327
|
+
'The mode to run Lighthouse in. Your ONLY options are "navigation" or "snapshot". You should determine this based on the user\'s question. If the user is asking specifically about accessibility, you can run in "snapshot" mode which avoids reloading the page. If the user asks for a full Lighthouse report, you should run in "navigation" mode which is the default. These are the only options you can pass.',
|
|
328
|
+
nullable: false,
|
|
329
|
+
}
|
|
330
|
+
},
|
|
318
331
|
},
|
|
319
|
-
displayInfoFromArgs:
|
|
332
|
+
displayInfoFromArgs: args => {
|
|
333
|
+
const mode = parseLighthouseMode(args.mode);
|
|
320
334
|
return {
|
|
321
335
|
title: 'Auditing your page with Lighthouse',
|
|
322
|
-
action:
|
|
336
|
+
action: `runLighthouseAudits(${mode})`,
|
|
323
337
|
};
|
|
324
338
|
},
|
|
325
|
-
handler: async
|
|
339
|
+
handler: async params => {
|
|
326
340
|
if (!this.#lighthouseRecording) {
|
|
327
341
|
return {
|
|
328
342
|
error: 'Lighthouse report is not available.',
|
|
329
343
|
};
|
|
330
344
|
}
|
|
331
|
-
const
|
|
345
|
+
const mode = parseLighthouseMode(params.mode);
|
|
346
|
+
debugLog(`Recording with Lighthouse; runMode=${mode}`);
|
|
347
|
+
const result = await this.#lighthouseRecording({mode});
|
|
332
348
|
if (!result) {
|
|
333
349
|
return {error: 'Failed to generate Lighthouse report.'};
|
|
334
350
|
}
|