chrome-devtools-frontend 1.0.1730971 → 1.0.1732418
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/front_end/Tests.js +20 -0
- package/front_end/core/host/AidaClient.ts +47 -3
- package/front_end/core/host/AidaClientTypes.ts +8 -1
- package/front_end/core/host/AidaGcaTranslation.ts +1 -1
- package/front_end/core/sdk/NetworkManager.ts +2 -1
- package/front_end/generated/Deprecation.ts +0 -8
- package/front_end/generated/InspectorBackendCommands.ts +2 -1
- package/front_end/generated/protocol.ts +9 -0
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +6 -1
- package/front_end/models/ai_assistance/contexts/LighthouseContext.ts +4 -3
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +91 -11
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +90 -43
- package/front_end/models/ai_assistance/skills/styling.md +4 -2
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +31 -36
- package/front_end/models/bindings/CompilerScriptMapping.ts +0 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -1
- package/front_end/models/har/HARFormat.ts +1 -0
- package/front_end/models/har/Importer.ts +7 -1
- package/front_end/models/har/Log.snapshot.txt +2 -0
- package/front_end/models/har/Log.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.ts +0 -4
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
- package/front_end/panels/ai_assistance/components/chatInput.css +1 -1
- package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -1
- package/front_end/panels/animation/animationTimeline.css +11 -9
- package/front_end/panels/application/IndexedDBViews.ts +2 -2
- package/front_end/panels/application/PrivateVerificationTokensView.ts +217 -9
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
- package/front_end/panels/application/ServiceWorkersView.ts +1 -1
- package/front_end/panels/application/StorageView.ts +1 -1
- package/front_end/panels/application/appManifestView.css +0 -6
- package/front_end/panels/application/backgroundServiceView.css +0 -21
- package/front_end/panels/application/components/backForwardCacheView.css +1 -9
- package/front_end/panels/application/components/endpointsGrid.css +1 -1
- package/front_end/panels/application/components/permissionsPolicySection.css +1 -1
- package/front_end/panels/application/cookieItemsView.css +0 -1
- package/front_end/panels/application/frameDetailsReportView.css +0 -10
- package/front_end/panels/application/indexedDBViews.css +0 -6
- package/front_end/panels/application/privateVerificationTokensView.css +12 -0
- package/front_end/panels/application/resourcesPanel.css +0 -14
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +4 -4
- package/front_end/panels/application/serviceWorkersView.css +1 -1
- package/front_end/panels/changes/CombinedDiffView.ts +1 -1
- package/front_end/panels/comments/CommentsPane.ts +5 -0
- package/front_end/panels/common/CommentsOverlayWidget.ts +337 -117
- package/front_end/panels/console/consoleView.css +5 -3
- package/front_end/panels/coverage/CoverageView.ts +0 -1
- package/front_end/panels/coverage/coverageView.css +4 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +0 -1
- package/front_end/panels/elements/AccessibilityTreeView.ts +1 -1
- package/front_end/panels/elements/CSSValueTraceView.ts +2 -4
- package/front_end/panels/elements/DOMTreeContextMenu.ts +1 -1
- package/front_end/panels/elements/DOMTreeWidget.ts +14 -0
- package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
- package/front_end/panels/elements/PlatformFontsWidget.ts +0 -1
- package/front_end/panels/elements/PropertiesWidget.ts +1 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -0
- package/front_end/panels/elements/WebCustomData.ts +1 -1
- package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
- package/front_end/panels/elements/components/cssVariableValueView.css +3 -1
- package/front_end/panels/elements/components/elementsTreeExpandButton.css +3 -2
- package/front_end/panels/elements/components/stylePropertyEditor.css +2 -2
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +4 -4
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/stylesSidebarPane.css +1 -1
- package/front_end/panels/emulation/DeviceModeView.ts +4 -3
- package/front_end/panels/emulation/deviceModeView.css +6 -7
- package/front_end/panels/event_listeners/eventListenersView.css +4 -4
- package/front_end/panels/explain/components/consoleInsight.css +3 -18
- package/front_end/panels/issues/issuesTree.css +5 -6
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +4 -2
- package/front_end/panels/layer_viewer/TransformController.ts +106 -54
- package/front_end/panels/lighthouse/lighthousePanel.css +4 -7
- package/front_end/panels/lighthouse/lighthouseStartView.css +1 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +4 -4
- package/front_end/panels/media/EventTimelineView.ts +1 -4
- package/front_end/panels/media/TickingFlameChart.ts +3 -2
- package/front_end/panels/media/playerListView.css +6 -3
- package/front_end/panels/media/playerMessagesView.css +2 -2
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +5 -7
- package/front_end/panels/network/NetworkConfigView.ts +1 -1
- package/front_end/panels/network/binaryResourceView.css +0 -7
- package/front_end/panels/network/networkLogView.css +0 -7
- package/front_end/panels/network/networkTimingTable.css +2 -2
- package/front_end/panels/network/requestConditionsDrawer.css +1 -24
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
- package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
- package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
- package/front_end/panels/protocol_monitor/protocolMonitor.css +1 -1
- package/front_end/panels/recorder/extensionView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +3 -3
- package/front_end/panels/recorder/recordingListView.css +1 -1
- package/front_end/panels/recorder/stepEditor.css +2 -2
- package/front_end/panels/recorder/stepView.css +0 -24
- package/front_end/panels/screencast/screencastView.css +2 -1
- package/front_end/panels/search/searchView.css +4 -3
- package/front_end/panels/security/SecurityPanelSidebar.ts +0 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/security/originView.css +0 -4
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +2 -1
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +1 -2
- package/front_end/panels/sources/breakpointsView.css +0 -1
- package/front_end/panels/sources/tabbedEditorContainer.css +1 -1
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -2
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +1 -1
- package/front_end/panels/timeline/components/OriginMap.ts +1 -1
- package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
- package/front_end/panels/timeline/components/metricCard.css +1 -1
- package/front_end/panels/timeline/components/networkRequestDetails.css +0 -1
- package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
- package/front_end/panels/timeline/timelineFlamechartPopover.css +1 -1
- package/front_end/panels/timeline/timelineHistoryManager.css +1 -1
- package/front_end/panels/timeline/timelineMiniMap.css +1 -1
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/web_audio/webAudio.css +0 -20
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +166 -8
- package/front_end/ui/comments/CommentOverlayManager.ts +17 -2
- package/front_end/ui/components/diff_view/diffView.css +1 -1
- package/front_end/ui/components/markdown_view/markdownView.css +1 -1
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/menuItem.css +1 -1
- package/front_end/ui/components/panel_feedback/panelFeedback.css +2 -2
- package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
- package/front_end/ui/components/report_view/reportValue.css +5 -2
- package/front_end/ui/components/suggestion_input/suggestionInput.css +4 -4
- package/front_end/ui/legacy/ContextMenu.ts +3 -0
- package/front_end/ui/legacy/GlassPane.ts +3 -3
- package/front_end/ui/legacy/SoftContextMenu.ts +7 -1
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -0
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +7 -6
- package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +3 -3
- package/front_end/ui/legacy/components/perf_ui/flameChart.css +7 -6
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +4 -3
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +3 -3
- package/front_end/ui/legacy/components/source_frame/imageView.css +4 -4
- package/front_end/ui/legacy/components/utils/jsUtils.css +2 -1
- package/front_end/ui/legacy/dropTarget.css +1 -1
- package/front_end/ui/legacy/filter.css +4 -3
- package/front_end/ui/legacy/inspectorCommon.css +8 -23
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- package/front_end/ui/legacy/suggestBox.css +2 -1
- package/front_end/ui/legacy/toolbar.css +2 -1
- package/front_end/ui/legacy/treeoutline.css +5 -4
- package/front_end/ui/legacy/viewContainers.css +2 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
- package/inspector_overlay/highlight_anchor.ts +8 -11
- package/package.json +1 -1
package/front_end/Tests.js
CHANGED
|
@@ -251,6 +251,11 @@
|
|
|
251
251
|
* @param panelName Name of the panel to show.
|
|
252
252
|
*/
|
|
253
253
|
TestSuite.prototype.showPanel = function(panelName) {
|
|
254
|
+
// TODO(crbug.com/518066451): Remove fallback once https://crrev.com/c/8702200
|
|
255
|
+
// lands in chromium/src (see https://crrev.com/c/8704657).
|
|
256
|
+
if (!UI.ViewManager.ViewManager.instance().hasView(panelName)) {
|
|
257
|
+
return this.showExtensionSidebarPane(panelName);
|
|
258
|
+
}
|
|
254
259
|
return UI.InspectorView.InspectorView.instance().showPanel(panelName);
|
|
255
260
|
};
|
|
256
261
|
|
|
@@ -610,6 +615,21 @@
|
|
|
610
615
|
this.takeControl();
|
|
611
616
|
};
|
|
612
617
|
|
|
618
|
+
TestSuite.prototype.showExtensionSidebarPane = function(title) {
|
|
619
|
+
const viewManager = UI.ViewManager.ViewManager.instance();
|
|
620
|
+
for (const view of viewManager.views.values()) {
|
|
621
|
+
if (view.viewId().startsWith('extension-sidebar-') && view.title() === title) {
|
|
622
|
+
return viewManager.revealView(view);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
return Promise.reject(new Error(`Extension sidebar pane '${title}' not found`));
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
TestSuite.prototype.switchToExtensionSidebarPane = function(title) {
|
|
629
|
+
this.showExtensionSidebarPane(title).then(this.releaseControl.bind(this));
|
|
630
|
+
this.takeControl();
|
|
631
|
+
};
|
|
632
|
+
|
|
613
633
|
// Regression test for crbug.com/370035.
|
|
614
634
|
TestSuite.prototype.testDeviceMetricsOverrides = function() {
|
|
615
635
|
function dumpPageMetrics() {
|
|
@@ -543,8 +543,25 @@ export interface EventTypes {
|
|
|
543
543
|
[Events.AIDA_AVAILABILITY_CHANGED]: AidaAccessPreconditions;
|
|
544
544
|
}
|
|
545
545
|
|
|
546
|
+
/**
|
|
547
|
+
* Checks whether any of the provided error strings indicate a quota or rate-limit failure.
|
|
548
|
+
*
|
|
549
|
+
* AIDA and GCA surface quota errors across different fields (status codes, human-readable
|
|
550
|
+
* messages, and serialized `google.rpc.ErrorInfo` details), so we check three substrings:
|
|
551
|
+
* - `'quota'`: direct AIDA error messages or details (for example,
|
|
552
|
+
* `"Quota exceeded for quota metric 'AiCodeCompleteService'"` or `"USER_QUOTA_EXCEEDED"`).
|
|
553
|
+
* - `'resource_exhausted'`: the standard `google.rpc.Code` status string (for example,
|
|
554
|
+
* `status: "RESOURCE_EXHAUSTED"` or `"RESOURCE_EXHAUSTED: quota exceeded"`).
|
|
555
|
+
* - `'rate_limit_exceeded'`: the `reason` field inside `google.rpc.ErrorInfo` details when
|
|
556
|
+
* the message itself does not mention `'quota'` (for example, GCA returning
|
|
557
|
+
* `message: "You have exhausted your capacity on this model."` with
|
|
558
|
+
* `details: [{"reason": "RATE_LIMIT_EXCEEDED", "domain": "cloudcode-pa.googleapis.com"}]`).
|
|
559
|
+
*/
|
|
546
560
|
export function isQuotaError(...inputs: Array<string|undefined>): boolean {
|
|
547
|
-
return inputs.some(input =>
|
|
561
|
+
return inputs.some(input => {
|
|
562
|
+
const lower = input?.toLowerCase();
|
|
563
|
+
return lower?.includes('quota') || lower?.includes('resource_exhausted') || lower?.includes('rate_limit_exceeded');
|
|
564
|
+
});
|
|
548
565
|
}
|
|
549
566
|
|
|
550
567
|
export function isPayloadTooLargeError(...inputs: Array<string|undefined>): boolean {
|
|
@@ -552,8 +569,17 @@ export function isPayloadTooLargeError(...inputs: Array<string|undefined>): bool
|
|
|
552
569
|
}
|
|
553
570
|
|
|
554
571
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
572
|
+
* Type guard that narrows an `unknown` error value in `mapError` to a plain key-value
|
|
573
|
+
* object so structured `google.rpc.Status` fields (`code`, `status`, `message`, `details`)
|
|
574
|
+
* can be safely inspected.
|
|
575
|
+
*/
|
|
576
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
577
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Maps AIDA-specific errors, DispatchHttpRequestErrors, strings, structured
|
|
582
|
+
* error objects, and generic Errors to dedicated AidaClientError subclasses.
|
|
557
583
|
*/
|
|
558
584
|
export function mapError(err: unknown, detail?: string): AidaClientError {
|
|
559
585
|
if (err instanceof AidaClientError) {
|
|
@@ -602,5 +628,23 @@ export function mapError(err: unknown, detail?: string): AidaClientError {
|
|
|
602
628
|
if (err instanceof Error) {
|
|
603
629
|
return new AidaUnknownError(err.message, {cause: err});
|
|
604
630
|
}
|
|
631
|
+
|
|
632
|
+
if (isRecord(err)) {
|
|
633
|
+
const code = typeof err.code === 'number' ? err.code : undefined;
|
|
634
|
+
const status = typeof err.status === 'string' ? err.status : undefined;
|
|
635
|
+
const message = typeof err.message === 'string' ? err.message : undefined;
|
|
636
|
+
const details = err.details !== undefined ? JSON.stringify(err.details) : undefined;
|
|
637
|
+
if (code === 429 || isQuotaError(status, message, details)) {
|
|
638
|
+
return new AidaQuotaError(message ?? 'Server responded: quota exceeded', {cause: err});
|
|
639
|
+
}
|
|
640
|
+
if (code === 403 || status === 'PERMISSION_DENIED') {
|
|
641
|
+
return new AidaPermissionDeniedError(message ?? 'Server responded: permission denied', {cause: err});
|
|
642
|
+
}
|
|
643
|
+
if (isPayloadTooLargeError(message, details)) {
|
|
644
|
+
return new AidaPayloadTooLargeError(message ?? 'Server responded: payload size exceeds the limit', {cause: err});
|
|
645
|
+
}
|
|
646
|
+
return new AidaUnknownError(message ?? JSON.stringify(err), {cause: err});
|
|
647
|
+
}
|
|
648
|
+
|
|
605
649
|
return new AidaUnknownError(String(err));
|
|
606
650
|
}
|
|
@@ -465,7 +465,14 @@ export interface AidaChunkResponse {
|
|
|
465
465
|
functionCallChunk?: {
|
|
466
466
|
functionCall: AidaFunctionCall,
|
|
467
467
|
};
|
|
468
|
-
|
|
468
|
+
/**
|
|
469
|
+
* Error information returned in the chunk.
|
|
470
|
+
* Supports direct AIDA stream chunk error strings (for example,
|
|
471
|
+
* "RESOURCE_EXHAUSTED: quota exceeded") and structured google.rpc.Status
|
|
472
|
+
* error objects translated from GCA stream chunks (for example,
|
|
473
|
+
* {"code": 429, "message": "You have exhausted your capacity on this model.", "status": "RESOURCE_EXHAUSTED", "details": [...]}).
|
|
474
|
+
*/
|
|
475
|
+
error?: string|Record<string, unknown>;
|
|
469
476
|
}
|
|
470
477
|
|
|
471
478
|
export function debugLog(...log: unknown[]): void {
|
|
@@ -475,7 +475,7 @@ function convertAidaParamToGcaSchema<T extends string|number|symbol = string>(pa
|
|
|
475
475
|
export function gcaChunkResponseToAidaChunkResponse(response: GCA.GenerateContentResponse): AIDA.AidaChunkResponse[] {
|
|
476
476
|
try {
|
|
477
477
|
if (response.error) {
|
|
478
|
-
|
|
478
|
+
return [{error: response.error}];
|
|
479
479
|
}
|
|
480
480
|
const candidate = response.candidates?.[0];
|
|
481
481
|
const parts = candidate?.content?.parts || [];
|
|
@@ -927,7 +927,8 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
|
927
927
|
}
|
|
928
928
|
|
|
929
929
|
requestForLoaderId(loaderId: Protocol.Network.LoaderId): NetworkRequest|null {
|
|
930
|
-
return this.#requestsByLoaderId.get(loaderId) ||
|
|
930
|
+
return this.#requestsByLoaderId.get(loaderId) ||
|
|
931
|
+
this.#multitargetNetworkManager.inflightMainResourceRequests.get(loaderId) || null;
|
|
931
932
|
}
|
|
932
933
|
|
|
933
934
|
resourceChangedPriority({requestId, newPriority}: Protocol.Network.ResourceChangedPriorityEvent): void {
|
|
@@ -74,10 +74,6 @@ export const UIStrings = {
|
|
|
74
74
|
* @description Warning displayed to developers that they are using the Fenced Frame API which has been deprecated and is scheduled to be removed.
|
|
75
75
|
*/
|
|
76
76
|
FencedFrame: "Fenced Frame API is deprecated and scheduled for removal.",
|
|
77
|
-
/**
|
|
78
|
-
* @description A deprecation warning shown in the DevTools Issues tab. It's shown when one of the Protected Audience APIs like `navigator.joinAdInterestGroup`, `navigator.getInterestGroupAdAuctionData` or `navigator.runAdAuction` are called.
|
|
79
|
-
*/
|
|
80
|
-
Fledge: "The Protected Audience API is deprecated and will be removed in a future release.",
|
|
81
77
|
/**
|
|
82
78
|
* @description Warning displayed to developers when the Geolocation API is used from an insecure origin (one that isn't localhost or doesn't use HTTPS) to notify them that this use is no longer supported.
|
|
83
79
|
*/
|
|
@@ -102,10 +98,6 @@ export const UIStrings = {
|
|
|
102
98
|
* @description This warning occurs when an insecure context (e.g., HTTP) requests a private resource (not on open internet). This is done to mitigate the potential for CSRF and other attacks.
|
|
103
99
|
*/
|
|
104
100
|
InsecurePrivateNetworkSubresourceRequest: "The website requested a subresource from a network that it could only access because of its users' privileged network position. These requests expose non-public devices and servers to the internet, increasing the risk of a cross-site request forgery (CSRF) attack, and/or information leakage. To mitigate these risks, Chrome deprecates requests to non-public subresources when initiated from non-secure contexts, and will start blocking them.",
|
|
105
|
-
/**
|
|
106
|
-
* @description This is a deprecated warning to developers that a field in a structure has been renamed.
|
|
107
|
-
*/
|
|
108
|
-
InterestGroupDailyUpdateUrl: "The `dailyUpdateUrl` field of `InterestGroups` passed to `joinAdInterestGroup()` has been renamed to `updateUrl`, to more accurately reflect its behavior.",
|
|
109
101
|
/**
|
|
110
102
|
* @description Warning displayed to developers that instead of calling the `Intl.v8BreakIterator` constructor, which is not a standard JavaScript API, use ECMA402 standard API Intl.Segmenter shipped in end of 2020 instead.
|
|
111
103
|
*/
|
|
@@ -1160,7 +1160,8 @@ inspectorBackend.registerEnum("Page.SetTouchEmulationEnabledRequestConfiguration
|
|
|
1160
1160
|
inspectorBackend.registerCommand("Page.setTouchEmulationEnabled", [{"name": "enabled", "type": "boolean", "optional": false, "description": "Whether the touch event emulation should be enabled.", "typeRef": null}, {"name": "configuration", "type": "string", "optional": true, "description": "Touch/gesture events configuration. Default: current platform.", "typeRef": "Page.SetTouchEmulationEnabledRequestConfiguration"}], [], "Toggles mouse event-based touch event emulation.");
|
|
1161
1161
|
inspectorBackend.registerEnum("Page.StartScreencastRequestFormat", {Jpeg: "jpeg", Png: "png"});
|
|
1162
1162
|
inspectorBackend.registerCommand("Page.startScreencast", [{"name": "format", "type": "string", "optional": true, "description": "Image compression format.", "typeRef": "Page.StartScreencastRequestFormat"}, {"name": "quality", "type": "number", "optional": true, "description": "Compression quality from range [0..100].", "typeRef": null}, {"name": "maxWidth", "type": "number", "optional": true, "description": "Maximum screenshot width.", "typeRef": null}, {"name": "maxHeight", "type": "number", "optional": true, "description": "Maximum screenshot height.", "typeRef": null}, {"name": "everyNthFrame", "type": "number", "optional": true, "description": "Send every n-th frame. Must be a positive integer.", "typeRef": null}, {"name": "maxFramesInFlight", "type": "number", "optional": true, "description": "Maximum number of frames sent until screencastFrameAck is required. Defaults to 3. Must be a positive integer.", "typeRef": null}, {"name": "sendLastFrame", "type": "boolean", "optional": true, "description": "By default, after screencastFrameAck arrives, the next produced frame is sent. Passing this flag enables storing the last produced frame in memory, which is immediately sent upon screencastFrameAck. This way, overall performance is traded for a better latency.", "typeRef": null}], [], "Starts sending each frame using the `screencastFrame` event.");
|
|
1163
|
-
inspectorBackend.
|
|
1163
|
+
inspectorBackend.registerEnum("Page.StartScreenRecordingRequestCaptureArea", {Target: "target", BrowserWindow: "browserWindow"});
|
|
1164
|
+
inspectorBackend.registerCommand("Page.startScreenRecording", [{"name": "audio", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "maxWidth", "type": "number", "optional": true, "description": "Maximum frame width in pixels.", "typeRef": null}, {"name": "maxHeight", "type": "number", "optional": true, "description": "Maximum frame height in pixels.", "typeRef": null}, {"name": "frameRate", "type": "number", "optional": true, "description": "Maximum frame rate in frames per second.", "typeRef": null}, {"name": "captureArea", "type": "string", "optional": true, "description": "The area to record. Defaults to `target`.", "typeRef": "Page.StartScreenRecordingRequestCaptureArea"}], ["stream"], "Starts screencast video recording.");
|
|
1164
1165
|
inspectorBackend.registerCommand("Page.stopScreenRecording", [], ["stream"], "Stops screencast video recording.");
|
|
1165
1166
|
inspectorBackend.registerCommand("Page.stopLoading", [], [], "Force the page stop all navigations and pending resource fetches.");
|
|
1166
1167
|
inspectorBackend.registerCommand("Page.crash", [], [], "Crashes renderer on the IO thread, generates minidumps.");
|
|
@@ -16586,6 +16586,11 @@ export namespace Page {
|
|
|
16586
16586
|
sendLastFrame?: boolean;
|
|
16587
16587
|
}
|
|
16588
16588
|
|
|
16589
|
+
export const enum StartScreenRecordingRequestCaptureArea {
|
|
16590
|
+
Target = 'target',
|
|
16591
|
+
BrowserWindow = 'browserWindow',
|
|
16592
|
+
}
|
|
16593
|
+
|
|
16589
16594
|
export interface StartScreenRecordingRequest {
|
|
16590
16595
|
audio?: boolean;
|
|
16591
16596
|
/**
|
|
@@ -16600,6 +16605,10 @@ export namespace Page {
|
|
|
16600
16605
|
* Maximum frame rate in frames per second.
|
|
16601
16606
|
*/
|
|
16602
16607
|
frameRate?: integer;
|
|
16608
|
+
/**
|
|
16609
|
+
* The area to record. Defaults to `target`.
|
|
16610
|
+
*/
|
|
16611
|
+
captureArea?: StartScreenRecordingRequestCaptureArea;
|
|
16603
16612
|
}
|
|
16604
16613
|
|
|
16605
16614
|
export interface StartScreenRecordingResponse extends ProtocolResponseWithError {
|
|
@@ -78,7 +78,7 @@ Content:
|
|
|
78
78
|
"properties": {
|
|
79
79
|
"code": {
|
|
80
80
|
"type": 1,
|
|
81
|
-
"description": "JavaScript code snippet to run on the inspected page. Make sure the code is formatted for readability.\n\n# Instructions\n\n* To return data, define a top-level `data` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to `data`.\n* $0 refers to the currently selected DOM node (or document body if none selected).\n* **CRITICAL** Do not call `console` methods (e.g., `console.log`, `console.warn`, `console.error`) by default when returning data via `data`.\n* **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.\n* **CRITICAL** Variables from previous function calls are not available in subsequent calls.\n* **CRITICAL** Keep code concise (max 40 lines, 120 characters per line, and 2,500 characters). Split complex logic into multiple steps.\n* **CRITICAL** Network requests (e.g., fetch, XMLHttpRequest) are disabled and cannot be made.\n\nFor example, to query DOM elements:\n\n```\nconst data = {\n title: document.title,\n elementText: $0?.textContent?.trim(),\n childCount: $0?.children.length,\n};\n```\n"
|
|
81
|
+
"description": "JavaScript code snippet to run on the inspected page. Make sure the code is formatted for readability.\n\n# Instructions\n\n* To return data, define a top-level `data` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to `data`.\n* $0 refers to the currently selected DOM node (or document body if none selected).\n* **CRITICAL** Do not call `console` methods (e.g., `console.log`, `console.warn`, `console.error`) by default when returning data via `data`.\n* **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.\n* **CRITICAL** Variables from previous function calls are not available in subsequent calls.\n* **CRITICAL** Keep code concise (max 40 lines, max 120 characters per line, and max 2,500 total characters). To stay well under 120 characters per line:\n - Put each statement, object property, array item, and `&&`/`||` condition on its own line.\n - Extract long CSS selectors or strings into a variable (or `.join(', ')` array) before calling `querySelectorAll`.\n - Store intermediate DOM lookups (`getComputedStyle`, `getAttribute`) in short local variables instead of chaining them on one line.\n - Split complex logic into multiple steps.\n* **CRITICAL** Network requests (e.g., fetch, XMLHttpRequest) are disabled and cannot be made.\n\nFor example, to query DOM elements:\n\n```\nconst data = {\n title: document.title,\n elementText: $0?.textContent?.trim(),\n childCount: $0?.children.length,\n};\n```\n"
|
|
82
82
|
},
|
|
83
83
|
"explanation": {
|
|
84
84
|
"type": 1,
|
|
@@ -8,6 +8,11 @@ Lighthouse Version: 1.0.0
|
|
|
8
8
|
|
|
9
9
|
## Category Scores
|
|
10
10
|
- Accessibility: 50
|
|
11
|
+
|
|
12
|
+
## Failing audits
|
|
13
|
+
|
|
14
|
+
### Accessibility (categoryId: "accessibility")
|
|
15
|
+
- Accessibility Audit: 50
|
|
11
16
|
# Audits for Accessibility
|
|
12
17
|
|
|
13
18
|
The following audits in this category have a score below 90 and may need attention:
|
|
@@ -20,7 +25,7 @@ Content:
|
|
|
20
25
|
[
|
|
21
26
|
{
|
|
22
27
|
"title": "Lighthouse report",
|
|
23
|
-
"text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
|
|
28
|
+
"text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
|
|
24
29
|
}
|
|
25
30
|
]
|
|
26
31
|
=== end content
|
|
@@ -58,9 +58,10 @@ export class LighthouseContext extends ConversationContext<LHModel.ReporterTypes
|
|
|
58
58
|
this.#cachedPayload =
|
|
59
59
|
'**CRITICAL**: The Lighthouse report failed to record or all category scores are error/unavailable (n/a). This indicates a failed run or missing data.';
|
|
60
60
|
} else if (Root.Runtime.hostConfig.devToolsAiV2Architecture?.enabled) {
|
|
61
|
-
// AI V2 sends failing audit titles without their details to
|
|
62
|
-
// uses the category IDs in the
|
|
63
|
-
|
|
61
|
+
// AI V2 sends the report summary (including failing audit titles without their details) to
|
|
62
|
+
// keep the prompt small. The agent uses the category IDs in the summary to fetch full
|
|
63
|
+
// details with `getLighthouseAudits`.
|
|
64
|
+
this.#cachedPayload = formatter.summary(this.#lh);
|
|
64
65
|
} else {
|
|
65
66
|
// The V1 `AccessibilityAgent` expects the accessibility audits up front. Remove this branch with V1.
|
|
66
67
|
this.#cachedPayload =
|
|
@@ -8,6 +8,14 @@ Lighthouse Version: 12.0.0
|
|
|
8
8
|
## Category Scores
|
|
9
9
|
- Performance: 80
|
|
10
10
|
- Accessibility: 100
|
|
11
|
+
|
|
12
|
+
## Failing audits
|
|
13
|
+
|
|
14
|
+
### Performance (categoryId: "performance")
|
|
15
|
+
- First Audit: 80
|
|
16
|
+
|
|
17
|
+
### Accessibility (categoryId: "accessibility")
|
|
18
|
+
- No failing audits.
|
|
11
19
|
=== end content
|
|
12
20
|
|
|
13
21
|
Title: LighthouseFormatter generates audits for a category
|
|
@@ -134,17 +142,6 @@ The following audits in this category have a score below 90 and may need attenti
|
|
|
134
142
|
* **Est Savings**: 16.9 kB
|
|
135
143
|
=== end content
|
|
136
144
|
|
|
137
|
-
Title: LighthouseFormatter lists failing audits grouped by category with the category ID
|
|
138
|
-
Content:
|
|
139
|
-
## Failing audits
|
|
140
|
-
|
|
141
|
-
### Performance (categoryId: "performance")
|
|
142
|
-
- First Audit: 80
|
|
143
|
-
|
|
144
|
-
### Accessibility (categoryId: "accessibility")
|
|
145
|
-
- No failing audits.
|
|
146
|
-
=== end content
|
|
147
|
-
|
|
148
145
|
Title: LighthouseFormatter formats 0-based source locations as 1-based
|
|
149
146
|
Content:
|
|
150
147
|
# Audits for Accessibility
|
|
@@ -198,10 +195,26 @@ Mode: navigation
|
|
|
198
195
|
## Category Scores
|
|
199
196
|
- Performance: 80
|
|
200
197
|
- Agentic Browsing: 1/2 audits passed
|
|
198
|
+
|
|
199
|
+
## Failing audits
|
|
200
|
+
|
|
201
|
+
### Performance (categoryId: "performance")
|
|
202
|
+
- First Audit: 80
|
|
203
|
+
|
|
204
|
+
### Agentic Browsing (categoryId: "agentic-browsing")
|
|
205
|
+
- llms.txt is valid: 0
|
|
201
206
|
=== end content
|
|
202
207
|
|
|
203
208
|
Title: LighthouseFormatter surfaces errored audits
|
|
204
209
|
Content:
|
|
210
|
+
# Lighthouse Report Summary
|
|
211
|
+
URL: https://example.com
|
|
212
|
+
Fetch Time: 2025-01-01T00:00:00.000Z
|
|
213
|
+
Lighthouse Version: 12.0.0
|
|
214
|
+
|
|
215
|
+
## Category Scores
|
|
216
|
+
- Performance: 50
|
|
217
|
+
|
|
205
218
|
## Failing audits
|
|
206
219
|
|
|
207
220
|
### Performance (categoryId: "performance")
|
|
@@ -221,6 +234,14 @@ The following audits in this category errored:
|
|
|
221
234
|
=== end content
|
|
222
235
|
Title: LighthouseFormatter excludes hidden audits
|
|
223
236
|
Content:
|
|
237
|
+
# Lighthouse Report Summary
|
|
238
|
+
URL: https://example.com
|
|
239
|
+
Fetch Time: 2025-01-01T00:00:00.000Z
|
|
240
|
+
Lighthouse Version: 12.0.0
|
|
241
|
+
|
|
242
|
+
## Category Scores
|
|
243
|
+
- Performance: 100
|
|
244
|
+
|
|
224
245
|
## Failing audits
|
|
225
246
|
|
|
226
247
|
### Performance (categoryId: "performance")
|
|
@@ -291,3 +312,62 @@ The following audits in this category have a score below 90 and may need attenti
|
|
|
291
312
|
- https://example.com/font.woff2 (650 ms, 16.4 kB) (longest chain)
|
|
292
313
|
- https://example.com/app.js (400 ms, 2 kB)
|
|
293
314
|
=== end content
|
|
315
|
+
|
|
316
|
+
Title: LighthouseFormatter surfaces non-hidden informative audits with details
|
|
317
|
+
Content:
|
|
318
|
+
# Lighthouse Report Summary
|
|
319
|
+
URL: https://example.com
|
|
320
|
+
Fetch Time: 2025-01-01T00:00:00.000Z
|
|
321
|
+
Lighthouse Version: 12.0.0
|
|
322
|
+
|
|
323
|
+
## Category Scores
|
|
324
|
+
- Agentic Browsing: 0/0 audits passed
|
|
325
|
+
- Performance: 80
|
|
326
|
+
|
|
327
|
+
## Failing audits
|
|
328
|
+
|
|
329
|
+
### Agentic Browsing (categoryId: "agentic-browsing")
|
|
330
|
+
- No audits scored below 90, but these informative audits report findings:
|
|
331
|
+
- Informative Audit With Score 1
|
|
332
|
+
|
|
333
|
+
### Performance (categoryId: "performance")
|
|
334
|
+
- First Audit: 80
|
|
335
|
+
- Informative audits:
|
|
336
|
+
- Minimize main-thread work
|
|
337
|
+
|
|
338
|
+
# Audits for Agentic Browsing
|
|
339
|
+
|
|
340
|
+
Informative audits:
|
|
341
|
+
- **Informative Audit With Score 1**: informative (1 item found)
|
|
342
|
+
* Informative audit whose score is 1.
|
|
343
|
+
|
|
344
|
+
- Item:
|
|
345
|
+
* **Name**: exampleItem
|
|
346
|
+
|
|
347
|
+
# Audits for Performance
|
|
348
|
+
|
|
349
|
+
The following audits in this category have a score below 90 and may need attention:
|
|
350
|
+
- **First Audit**: 80 (1.2s)
|
|
351
|
+
* Description of first audit
|
|
352
|
+
|
|
353
|
+
Informative audits:
|
|
354
|
+
- **Minimize main-thread work**: informative (2.5 s)
|
|
355
|
+
* Consider reducing the time spent parsing, compiling and executing JS.
|
|
356
|
+
|
|
357
|
+
- Item:
|
|
358
|
+
* **Category**: Script Evaluation
|
|
359
|
+
* **Time Spent**: 1,800 ms
|
|
360
|
+
=== end content
|
|
361
|
+
|
|
362
|
+
Title: LighthouseFormatter filters webmcp-registered-tools table columns to tool and description
|
|
363
|
+
Content:
|
|
364
|
+
# Audits for Agentic Browsing
|
|
365
|
+
|
|
366
|
+
Informative audits:
|
|
367
|
+
- **Registered WebMCP tools**: informative (1 tool registered)
|
|
368
|
+
* Lists WebMCP tools registered on the page.
|
|
369
|
+
|
|
370
|
+
- Item:
|
|
371
|
+
* **Tool Name**: searchProducts
|
|
372
|
+
* **Description**: Searches the product catalog by keyword.
|
|
373
|
+
=== end content
|
|
@@ -11,6 +11,12 @@ import {bytes, millis} from './UnitFormatters.js';
|
|
|
11
11
|
// not export `Util`, so this threshold is defined locally.
|
|
12
12
|
const PASS_THRESHOLD = 0.9;
|
|
13
13
|
|
|
14
|
+
const AUDIT_TABLE_COLUMN_KEYS = new Map<string, ReadonlySet<string>>([
|
|
15
|
+
// For webmcp-registered-tools, only include the tool name and description to
|
|
16
|
+
// keep the output concise (omitting inputSchema, source, and element).
|
|
17
|
+
['webmcp-registered-tools', new Set(['tool', 'description'])],
|
|
18
|
+
]);
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* Category argument for Lighthouse tools, accepting a specific category ID or `'all'`
|
|
16
22
|
* to target a full report across all standard categories.
|
|
@@ -23,7 +29,18 @@ export type LighthouseCategoryArg = 'all'|LHModel.RunTypes.CategoryId;
|
|
|
23
29
|
*/
|
|
24
30
|
export class LighthouseFormatter {
|
|
25
31
|
/**
|
|
26
|
-
* Returns an overall summary and high-level overview of the Lighthouse report
|
|
32
|
+
* Returns an overall summary and high-level overview of the Lighthouse report
|
|
33
|
+
* for the initial conversation context payload.
|
|
34
|
+
*
|
|
35
|
+
* Includes:
|
|
36
|
+
* - Report metadata (URL, fetch time, Lighthouse version, and gather mode when present).
|
|
37
|
+
* - Category scores (0-100 percentage, "n/a", or "<passed>/<total> audits passed" for
|
|
38
|
+
* fraction-scored modes and categories).
|
|
39
|
+
* - A per-category overview of non-hidden failing audits (score < 90), errored audits
|
|
40
|
+
* (with their error messages), and informative audits that carry details, without
|
|
41
|
+
* full descriptions or details tables so the prompt stays compact. Each category
|
|
42
|
+
* heading includes its category ID so the agent can request full details via
|
|
43
|
+
* `getLighthouseAudits`.
|
|
27
44
|
*/
|
|
28
45
|
summary(report: LHModel.ReporterTypes.ReportJSON): string {
|
|
29
46
|
const lines: string[] = [];
|
|
@@ -39,6 +56,36 @@ export class LighthouseFormatter {
|
|
|
39
56
|
for (const category of Object.values(report.categories)) {
|
|
40
57
|
lines.push(`- ${category.title}: ${this.#formatCategoryScore(report, category)}`);
|
|
41
58
|
}
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push('## Failing audits');
|
|
61
|
+
for (const [categoryId, category] of Object.entries(report.categories)) {
|
|
62
|
+
lines.push('');
|
|
63
|
+
lines.push(`### ${category.title} (categoryId: "${categoryId}")`);
|
|
64
|
+
const failingAudits = this.#findFailingAudits(report, category);
|
|
65
|
+
const erroredAudits = this.#findErroredAudits(report, category);
|
|
66
|
+
const informativeAudits = this.#findInformativeAuditsToReport(report, category);
|
|
67
|
+
if (failingAudits.length === 0 && erroredAudits.length === 0 && informativeAudits.length === 0) {
|
|
68
|
+
lines.push('- No failing audits.');
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
for (const audit of failingAudits) {
|
|
72
|
+
lines.push(`- ${audit.title}: ${this.#formatScore(audit.score)}`);
|
|
73
|
+
}
|
|
74
|
+
for (const audit of erroredAudits) {
|
|
75
|
+
const errorSuffix = audit.errorMessage ? ` (${this.#toSingleLine(audit.errorMessage)})` : '';
|
|
76
|
+
lines.push(`- ${audit.title}: Error${errorSuffix}`);
|
|
77
|
+
}
|
|
78
|
+
if (informativeAudits.length > 0) {
|
|
79
|
+
if (failingAudits.length === 0 && erroredAudits.length === 0) {
|
|
80
|
+
lines.push('- No audits scored below 90, but these informative audits report findings:');
|
|
81
|
+
} else {
|
|
82
|
+
lines.push('- Informative audits:');
|
|
83
|
+
}
|
|
84
|
+
for (const audit of informativeAudits) {
|
|
85
|
+
lines.push(` - ${audit.title}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
42
89
|
return lines.join('\n');
|
|
43
90
|
}
|
|
44
91
|
|
|
@@ -105,34 +152,6 @@ export class LighthouseFormatter {
|
|
|
105
152
|
}
|
|
106
153
|
}
|
|
107
154
|
|
|
108
|
-
/**
|
|
109
|
-
* Returns the title and score of every failing audit (score < 90), grouped by category.
|
|
110
|
-
* Descriptions and details tables are left out to keep the prompt small. Each category
|
|
111
|
-
* heading includes its category ID so the agent can request the full audit details.
|
|
112
|
-
*/
|
|
113
|
-
failingAuditsSummary(report: LHModel.ReporterTypes.ReportJSON): string {
|
|
114
|
-
const lines: string[] = [];
|
|
115
|
-
lines.push('## Failing audits');
|
|
116
|
-
for (const [categoryId, category] of Object.entries(report.categories)) {
|
|
117
|
-
lines.push('');
|
|
118
|
-
lines.push(`### ${category.title} (categoryId: "${categoryId}")`);
|
|
119
|
-
const failingAudits = this.#findFailingAudits(report, category);
|
|
120
|
-
const erroredAudits = this.#findErroredAudits(report, category);
|
|
121
|
-
if (failingAudits.length === 0 && erroredAudits.length === 0) {
|
|
122
|
-
lines.push('- No failing audits.');
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
for (const audit of failingAudits) {
|
|
126
|
-
lines.push(`- ${audit.title}: ${this.#formatScore(audit.score)}`);
|
|
127
|
-
}
|
|
128
|
-
for (const audit of erroredAudits) {
|
|
129
|
-
const errorSuffix = audit.errorMessage ? ` (${this.#toSingleLine(audit.errorMessage)})` : '';
|
|
130
|
-
lines.push(`- ${audit.title}: Error${errorSuffix}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return lines.join('\n');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
155
|
/**
|
|
137
156
|
* Formats a Lighthouse report for an AI Agent. If categoryId is 'all', returns
|
|
138
157
|
* each category's audits. Otherwise, returns audits for the specified category.
|
|
@@ -166,8 +185,9 @@ export class LighthouseFormatter {
|
|
|
166
185
|
|
|
167
186
|
const failingAudits = this.#findFailingAudits(report, category);
|
|
168
187
|
const erroredAudits = this.#findErroredAudits(report, category);
|
|
188
|
+
const informativeAudits = this.#findInformativeAuditsToReport(report, category);
|
|
169
189
|
|
|
170
|
-
if (failingAudits.length === 0 && erroredAudits.length === 0) {
|
|
190
|
+
if (failingAudits.length === 0 && erroredAudits.length === 0 && informativeAudits.length === 0) {
|
|
171
191
|
lines.push('All audits in this category passed (score >= 90).');
|
|
172
192
|
return lines.join('\n');
|
|
173
193
|
}
|
|
@@ -190,6 +210,14 @@ export class LighthouseFormatter {
|
|
|
190
210
|
sections.push(sectionLines.join('\n'));
|
|
191
211
|
}
|
|
192
212
|
|
|
213
|
+
if (informativeAudits.length > 0) {
|
|
214
|
+
const sectionLines = ['Informative audits:'];
|
|
215
|
+
for (const audit of informativeAudits) {
|
|
216
|
+
sectionLines.push(...this.#formatAudit(audit, 'informative'));
|
|
217
|
+
}
|
|
218
|
+
sections.push(sectionLines.join('\n'));
|
|
219
|
+
}
|
|
220
|
+
|
|
193
221
|
lines.push(sections.join('\n\n'));
|
|
194
222
|
return lines.join('\n');
|
|
195
223
|
}
|
|
@@ -214,7 +242,7 @@ export class LighthouseFormatter {
|
|
|
214
242
|
}
|
|
215
243
|
}
|
|
216
244
|
if (audit.details) {
|
|
217
|
-
const formattedDetails = this.#formatDetails(audit.details);
|
|
245
|
+
const formattedDetails = this.#formatDetails(audit.details, audit.id);
|
|
218
246
|
if (formattedDetails) {
|
|
219
247
|
lines.push('');
|
|
220
248
|
lines.push(formattedDetails.split('\n').map(l => l ? ` ${l}` : '').join('\n'));
|
|
@@ -233,7 +261,8 @@ export class LighthouseFormatter {
|
|
|
233
261
|
return category.auditRefs.filter(ref => ref.group !== 'hidden')
|
|
234
262
|
.map(ref => report.audits[ref.id])
|
|
235
263
|
.filter((audit): audit is LHModel.ReporterTypes.AuditResultJSON&{score: number} => Boolean(audit) &&
|
|
236
|
-
audit.scoreDisplayMode !== 'error' && audit.
|
|
264
|
+
audit.scoreDisplayMode !== 'error' && audit.scoreDisplayMode !== 'informative' &&
|
|
265
|
+
audit.score !== null && audit.score < PASS_THRESHOLD);
|
|
237
266
|
}
|
|
238
267
|
|
|
239
268
|
/**
|
|
@@ -248,11 +277,26 @@ export class LighthouseFormatter {
|
|
|
248
277
|
Boolean(audit) && audit.scoreDisplayMode === 'error');
|
|
249
278
|
}
|
|
250
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Returns non-hidden informative audits (`scoreDisplayMode === 'informative'`)
|
|
282
|
+
* that carry details to display. Informative audits may have `score: null` or
|
|
283
|
+
* `score: 1` (for example, `webmcp-registered-tools`), so `#findFailingAudits`
|
|
284
|
+
* also excludes `scoreDisplayMode === 'informative'`.
|
|
285
|
+
*/
|
|
286
|
+
#findInformativeAuditsToReport(report: LHModel.ReporterTypes.ReportJSON,
|
|
287
|
+
category: LHModel.ReporterTypes.CategoryJSON):
|
|
288
|
+
LHModel.ReporterTypes.AuditResultJSON[] {
|
|
289
|
+
return category.auditRefs.filter(ref => ref.group !== 'hidden')
|
|
290
|
+
.map(ref => report.audits[ref.id])
|
|
291
|
+
.filter((audit): audit is LHModel.ReporterTypes.AuditResultJSON =>
|
|
292
|
+
Boolean(audit) && audit.scoreDisplayMode === 'informative' && Boolean(audit.details));
|
|
293
|
+
}
|
|
294
|
+
|
|
251
295
|
#formatScore(score: number): number {
|
|
252
296
|
return Math.round(score * 100);
|
|
253
297
|
}
|
|
254
298
|
|
|
255
|
-
#formatDetails(details: LHModel.ReporterTypes.DetailsJSON): string {
|
|
299
|
+
#formatDetails(details: LHModel.ReporterTypes.DetailsJSON, auditId?: string): string {
|
|
256
300
|
switch (details.type) {
|
|
257
301
|
case 'table': {
|
|
258
302
|
const lines: string[] = [];
|
|
@@ -270,7 +314,7 @@ export class LighthouseFormatter {
|
|
|
270
314
|
lines.push(summaryParts.join('\n'));
|
|
271
315
|
}
|
|
272
316
|
}
|
|
273
|
-
lines.push(this.#formatTable(details.headings, details.items));
|
|
317
|
+
lines.push(this.#formatTable(details.headings, details.items, auditId));
|
|
274
318
|
return lines.join('\n');
|
|
275
319
|
}
|
|
276
320
|
case 'opportunity': {
|
|
@@ -285,11 +329,11 @@ export class LighthouseFormatter {
|
|
|
285
329
|
if (summaryParts.length > 0) {
|
|
286
330
|
lines.push(summaryParts.join(', '));
|
|
287
331
|
}
|
|
288
|
-
lines.push(this.#formatTable(details.headings, details.items));
|
|
332
|
+
lines.push(this.#formatTable(details.headings, details.items, auditId));
|
|
289
333
|
return lines.join('\n');
|
|
290
334
|
}
|
|
291
335
|
case 'list':
|
|
292
|
-
return this.#formatList(details);
|
|
336
|
+
return this.#formatList(details, auditId);
|
|
293
337
|
case 'checklist':
|
|
294
338
|
return Object.values(details.items)
|
|
295
339
|
.map(item => `- ${this.#toSingleLine(item.label)}: ${item.value ? 'Passed' : 'Failed'}`)
|
|
@@ -324,7 +368,7 @@ export class LighthouseFormatter {
|
|
|
324
368
|
return lines;
|
|
325
369
|
}
|
|
326
370
|
|
|
327
|
-
#formatList(details: LHModel.ReporterTypes.ListDetailsJSON): string {
|
|
371
|
+
#formatList(details: LHModel.ReporterTypes.ListDetailsJSON, auditId?: string): string {
|
|
328
372
|
const itemStrings: string[] = [];
|
|
329
373
|
for (const item of details.items) {
|
|
330
374
|
if (item.type === 'list-section') {
|
|
@@ -335,7 +379,7 @@ export class LighthouseFormatter {
|
|
|
335
379
|
if (item.description) {
|
|
336
380
|
sectionLines.push(this.#toSingleLine(item.description));
|
|
337
381
|
}
|
|
338
|
-
const formattedValue = this.#formatListValue(item.value);
|
|
382
|
+
const formattedValue = this.#formatListValue(item.value, auditId);
|
|
339
383
|
if (formattedValue) {
|
|
340
384
|
sectionLines.push(formattedValue);
|
|
341
385
|
}
|
|
@@ -343,7 +387,7 @@ export class LighthouseFormatter {
|
|
|
343
387
|
itemStrings.push(sectionLines.join('\n'));
|
|
344
388
|
}
|
|
345
389
|
} else {
|
|
346
|
-
const formattedItem = this.#formatListValue(item);
|
|
390
|
+
const formattedItem = this.#formatListValue(item, auditId);
|
|
347
391
|
if (formattedItem) {
|
|
348
392
|
itemStrings.push(formattedItem);
|
|
349
393
|
}
|
|
@@ -352,7 +396,7 @@ export class LighthouseFormatter {
|
|
|
352
396
|
return itemStrings.join('\n\n');
|
|
353
397
|
}
|
|
354
398
|
|
|
355
|
-
#formatListValue(value: LHModel.ReporterTypes.ListItemValueJSON): string {
|
|
399
|
+
#formatListValue(value: LHModel.ReporterTypes.ListItemValueJSON, auditId?: string): string {
|
|
356
400
|
switch (value.type) {
|
|
357
401
|
case 'node':
|
|
358
402
|
return this.#formatNodeFields(value)
|
|
@@ -365,7 +409,7 @@ export class LighthouseFormatter {
|
|
|
365
409
|
case 'url':
|
|
366
410
|
return this.#toSingleLine(value.value);
|
|
367
411
|
default:
|
|
368
|
-
return this.#formatDetails(value);
|
|
412
|
+
return this.#formatDetails(value, auditId);
|
|
369
413
|
}
|
|
370
414
|
}
|
|
371
415
|
|
|
@@ -388,12 +432,15 @@ export class LighthouseFormatter {
|
|
|
388
432
|
return results;
|
|
389
433
|
}
|
|
390
434
|
|
|
391
|
-
#formatTable(headings: LHModel.ReporterTypes.TableHeadingJSON[], items: LHModel.ReporterTypes.TableItem[]
|
|
435
|
+
#formatTable(headings: LHModel.ReporterTypes.TableHeadingJSON[], items: LHModel.ReporterTypes.TableItem[],
|
|
436
|
+
auditId?: string): string {
|
|
392
437
|
const lines: string[] = [];
|
|
438
|
+
const allowedKeys = auditId ? AUDIT_TABLE_COLUMN_KEYS.get(auditId) : undefined;
|
|
439
|
+
const filteredHeadings = allowedKeys ? headings.filter(h => allowedKeys.has(h.key)) : headings;
|
|
393
440
|
|
|
394
441
|
for (const item of items) {
|
|
395
442
|
const itemLines: string[] = [];
|
|
396
|
-
for (const heading of
|
|
443
|
+
for (const heading of filteredHeadings) {
|
|
397
444
|
const value = item[heading.key] as LHModel.ReporterTypes.TableItemValue;
|
|
398
445
|
const formattedValues = this.#formatTableValues(value, heading.valueType);
|
|
399
446
|
for (const {labelSuffix, value: v} of formattedValues) {
|